Code

Updated class hirachy
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 12 Nov 2007 16:11:37 +0000 (16:11 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 12 Nov 2007 16:11:37 +0000 (16:11 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-playground@7781 594d385d-05f5-0310-b6e9-bd551577e9d8

include/autoload-data.inc
include/class_GOsaGuiElement.inc [new file with mode: 0644]
include/class_ObjectListViewport.inc
include/interface_GOsaGuiElement.inc [deleted file]
include/interface_GOsaGuiElementInteraction.inc [new file with mode: 0644]
update-gosa

index e034a84dab66173d46a6ddc40751443a34a7293d..e28b621b17eae707544edc36bd5441acd5037096 100644 (file)
@@ -6,12 +6,13 @@ $class_mapping= array(
                 "AutoloadException" => "include/autoload.inc",
                 "ObjectListException" => "include/class_ObjectList.inc",
                 "ObjectList" => "include/class_ObjectList.inc",
+                "GOsaGuiElement" => "include/class_GOsaGuiElement.inc",
                 "ObjectListFilterIterator" => "include/class_ObjectListFilterIterator.inc",
                 "ObjectListViewportException" => "include/class_ObjectListViewport.inc",
                 "ObjectListViewport" => "include/class_ObjectListViewport.inc",
                 "ObjectListIterator" => "include/class_ObjectListIterator.inc",
-                "GOsaGuiElement" => "include/interface_GOsaGuiElement.inc",
                 "ObjectListEntryFilter" => "include/interface_ObjectListEntryFilter.inc",
+                "GOsaGuiElementInteraction" => "include/interface_GOsaGuiElementInteraction.inc",
                 "ObjectListEntryFilter_uppercase" => "include/class_ObjectListEntryFilter_uppercase.inc",
 );
 ?>
\ No newline at end of file
diff --git a/include/class_GOsaGuiElement.inc b/include/class_GOsaGuiElement.inc
new file mode 100644 (file)
index 0000000..d8284f2
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ */
+abstract class GOsaGuiElement implements GOsaGuiElementInteraction {
+
+  protected $errorMessage= "asdf";
+
+  public function render() {
+    if ($this->errorMessage) {
+      return "<div class='GOsaGuiElementError'>\n".$this->__render()."</div>\n";
+    } else {
+      return $this->__render();
+    }
+  }
+
+  public function process() {
+    return $this->__process();
+  }
+
+  abstract protected function __render();
+
+  abstract protected function __process();
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
index 3a7deac504b220bef414ef220585785869277e26..91a0d3e40f2a399e5dc9fb15b4479e14e7d0cdf6 100644 (file)
@@ -23,37 +23,37 @@ class ObjectListViewportException extends Exception {
 
     \sa ObjectList
  */
-class ObjectListViewport implements GOsaGuiElement {
+class ObjectListViewport extends GOsaGuiElement {
 
   /* Internal variable for color alternation */
-  protected $colorAlternator= 0;
+  private $colorAlternator= 0;
 
-  private $headline;
-  private $footer;
-  private $entryFormat;
+  protected $headline;
+  protected $footer;
+  protected $entryFormat;
 
   /* Dummy here ----> */
   private $attributes= array('cn', '_icon', '_actions', 'dn');
   /* <---- Dummy here */
 
-  private $displayHeaderFlag= TRUE;
-  private $displayFooterFlag= TRUE;
-  private $numberOfCols= 0;
+  protected $displayHeaderFlag= TRUE;
+  protected $displayFooterFlag= TRUE;
+  protected $numberOfCols= 0;
 
   /*!
     \brief Container for objects
 
     This variable stores the ObjectList object to be displayed.
    */
-       private $objects;
+       protected $objects;
 
   /*!
     \brief Switch to handle multiselect or not
    */
-       private $multiselect;
+       protected $multiselect;
 
   /*! \brief ID used to identify objects of same list */
-  private $id = "";
+  protected $id = "";
 
   
   /*! \brief ObjectListViewport constructor
@@ -101,7 +101,7 @@ class ObjectListViewport implements GOsaGuiElement {
 
       \return bool for if changes are present or not
         */
-  public function process(){
+  protected function __process(){
 
     /* TODO: process input */
     return FALSE;
@@ -245,7 +245,7 @@ class ObjectListViewport implements GOsaGuiElement {
 
       \return HTML rendered list
         */
-  public function render() {
+  protected function __render() {
 
     /* Apply current filter */
     $entries = "";
diff --git a/include/interface_GOsaGuiElement.inc b/include/interface_GOsaGuiElement.inc
deleted file mode 100644 (file)
index 3859ca6..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-/*! \brief   Interface for GOsaGuiElement objects.
-    \author  Cajus Pollmeier <pollmeier@gonicus.de>
-    \version 1.00
-    \date    2007/11/02
-
-    This interface describes what we need to display an element in the GUI
-    for use with list objects.
- */
-interface GOsaGuiElementInteraction {
-
-  /**
-   * Allows the GOsaGuiElement to process all _POST events that are
-   * related to itself.
-   * @param string $class
-   * @return obj $$class
-   */
-  public function process();
-
-  public function render();
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/include/interface_GOsaGuiElementInteraction.inc b/include/interface_GOsaGuiElementInteraction.inc
new file mode 100644 (file)
index 0000000..70f496b
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+/*! \brief   Interface for GOsaGuiElement objects.
+    \author  Cajus Pollmeier <pollmeier@gonicus.de>
+    \version 1.00
+    \date    2007/11/02
+
+    This interface describes what we need to display an element in the GUI
+    for use with list objects.
+ */
+interface GOsaGuiElementInteraction {
+
+  /**
+   * Allows the GOsaGuiElement to process all _POST events that are
+   * related to itself.
+   *
+   * @return TRUE if something has changed
+   */
+  public function process();
+
+
+  /**
+   * Allows the GOsaGuiElement to render themselves depending on several
+   * parameters.
+   */
+  public function render();
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
index 5d631efb70a8ee4963d39c5d01b790cefc16d2bd..083fffa7933d128c3f36455e2c990f7ef13a6683 100755 (executable)
@@ -45,6 +45,10 @@ function get_classes($folder= ".")
         $class= preg_replace('/^\s*class\s*(\w+).*$/', '\1', $line);
         $result[$class]= preg_replace("%$base_dir/%", "", "$currdir/$folder/$file");
       }
+      if (preg_match('/^\s*abstract\s*class\s*\w.*$/', $line)){
+        $class= preg_replace('/^\s*abstract\s*class\s*(\w+).*$/', '\1', $line);
+        $result[$class]= preg_replace("%$base_dir/%", "", "$currdir/$folder/$file");
+      }
       if (preg_match('/^\s*interface\s*\w.*$/', $line)){
         $class= preg_replace('/^\s*interface\s*(\w+).*$/', '\1', $line);
         $result[$class]= preg_replace("%$base_dir/%", "", "$currdir/$folder/$file");