Code

Updated structure
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 15 Nov 2007 15:21:25 +0000 (15:21 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 15 Nov 2007 15:21:25 +0000 (15:21 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-playground@7805 594d385d-05f5-0310-b6e9-bd551577e9d8

include/autoload-data.inc
include/class_ConfigManager.inc [deleted file]
include/class_Registry.inc [deleted file]
include/class_ViewportController.inc [deleted file]
include/core/class_ConfigManager.inc [new file with mode: 0644]
include/core/class_Registry.inc [new file with mode: 0644]
include/core/class_ViewportController.inc [new file with mode: 0644]
include/interface_GOsaGuiElementInteraction.inc [deleted file]
include/interfaces/interface_GOsaGuiElementInteraction.inc [new file with mode: 0644]

index 14ff98e2b6f40522aa00e8b3841b4a4867d39b47..c1953c5c681087dbadeaf9eb5e1b7ef9309c4ad9 100644 (file)
@@ -1,21 +1,21 @@
 <?php
 $class_mapping= array(
-                "Registry" => "include/class_Registry.inc",
-                "ConfigManagerException" => "include/class_ConfigManager.inc",
-                "ConfigManager" => "include/class_ConfigManager.inc",
+                "ObjectListEntryFilter_uppercase" => "include/components/GUIObjectList/class_ObjectListEntryFilter_uppercase.inc",
+                "ObjectListViewportException" => "include/components/GUIObjectList/class_ObjectListViewport.inc",
+                "ObjectListViewport" => "include/components/GUIObjectList/class_ObjectListViewport.inc",
+                "ObjectListEntryFilter" => "include/components/GUIObjectList/interface_ObjectListEntryFilter.inc",
+                "Utils" => "include/utils/class_Utils.inc",
+                "ObjectListIterator" => "include/class_ObjectListIterator.inc",
+                "GOsaGuiElement" => "include/class_GOsaGuiElement.inc",
+                "GOsaGuiElementInteraction" => "include/interfaces/interface_GOsaGuiElementInteraction.inc",
                 "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",
-                "Utils" => "include/class_Utils.inc",
-                "ViewportControllerException" => "include/class_ViewportController.inc",
-                "ViewportController" => "include/class_ViewportController.inc",
-                "ObjectListEntryFilter" => "include/interface_ObjectListEntryFilter.inc",
-                "GOsaGuiElementInteraction" => "include/interface_GOsaGuiElementInteraction.inc",
-                "ObjectListEntryFilter_uppercase" => "include/class_ObjectListEntryFilter_uppercase.inc",
+                "ViewportControllerException" => "include/core/class_ViewportController.inc",
+                "ViewportController" => "include/core/class_ViewportController.inc",
+                "ConfigManagerException" => "include/core/class_ConfigManager.inc",
+                "ConfigManager" => "include/core/class_ConfigManager.inc",
+                "Registry" => "include/core/class_Registry.inc",
 );
 ?>
\ No newline at end of file
diff --git a/include/class_ConfigManager.inc b/include/class_ConfigManager.inc
deleted file mode 100644 (file)
index 4840a83..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-
-/**
- * ConfigManagerException to handle exceptions that happen inside
- * the config manager module.
- */
-class ConfigManagerException extends Exception {
-       public function __construct($message, $code = 0) {
-               parent::__construct($message, $code);
-       }
-}
-
-
-/**
- * ConfigManager loads and manages GOsa session configurations.
- *
- * This class should be integrated via Registry.
- */
-class ConfigManager {
-
-       /* Config container */
-       private $config;
-       private $current;
-       private $section;
-
-       public function __construct(){}
-
-       /**
-        * Returns a static instance of $class
-        * Creates a new instance of $class if required.
-        * @param string $class
-        * @return obj $$class
-        */
-       public function load($file){
-               if (!is_readable($file)){
-                       throw new ConfigManagerException(sprintf(_("Can't read configuration file '%s'!"), $file));
-               }
-
-               /* Capture errors - just the first line is interesting */
-               ob_start(); 
-               $this->config= parse_ini_file($file, TRUE);
-               $ret= preg_replace( array('/^.*\nWarning: /', '/\n.*$/'),
-                                   array('', ''),
-                                   ob_get_contents());
-               ob_end_clean(); 
-
-               /* Bail out in case of errors */
-               if ($ret != ""){
-                       throw new ConfigManagerException($ret);
-               }
-
-               #echo "Test config and load additional configuration data from LDAP\n";
-               #$this->test_config();
-               #$this->load_servers();        -> Section servers/...;
-               #$this->load_plugin_configs(); -> Section pugins/name/value;
-
-               #print_r($this->config);
-       }
-
-
-       public function save($file){
-               throw new ConfigManagerException(_("Save not supported yet!"));
-       }
-
-
-       public function setSection($name){
-    $this->section= $name;
-
-               if (isset($this->config[$name])){
-                       $this->current= &$this->config[$name];
-                       return TRUE;
-    } else {
-      $this->current= array();
-      return FALSE;
-    }
-       }
-
-
-       public function getSection(){
-               return $this->section;
-       }
-
-
-       public function getSections(){
-       }
-
-
-       public function getValue($name, $default= ""){
-               if (!$this->section){
-                       throw new ConfigManagerException(_("Can't get value without current section set!"));
-               }
-               
-               if (isset($this->current[$name])){
-                       return $this->current[$name];
-               } elseif ($default) {
-      return $default;
-    } else {
-                       return NULL;
-               }
-       }
-
-
-       public function setValue($section, $value){
-       }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/include/class_Registry.inc b/include/class_Registry.inc
deleted file mode 100644 (file)
index 3d611f6..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/**
- * GOsa Registry of static class instances that are accessible
- * from all locations.
- *
- * Creates a new instance of the requested class if required.
- */
-class Registry {
-
-       static private $registry = array();
-
-       private function __construct(){}
-
-       /**
-        * Returns a static instance of $class
-        * Creates a new instance of $class if required.
-        * @param string $class
-        * @return obj $$class
-        */
-       static function getInstance($class){
-               if (!isset(Registry::$registry[$class])){
-                       Registry::$registry[$class]= new $class;
-               }
-               return Registry::$registry[$class];
-       }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/include/class_ViewportController.inc b/include/class_ViewportController.inc
deleted file mode 100644 (file)
index 32a2a99..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-
-/* Provide Smarty capabilities */
-require("smarty/Smarty.class.php");
-
-/*! \brief   Exception implementation for ViewPortController
-    \author  Cajus Pollmeier <pollmeier@gonicus.de>
-    \version 1.00
-    \date    2007/11/02
-
-    This class handles the exceptions occuring in ObjectList.
- */
-class ViewportControllerException extends Exception {
-       public function __construct($message, $code = 0) {
-               parent::__construct($message, $code);
-       }
-}
-
-/*! \brief   Implementation for rendering the main view
-    \author  Cajus Pollmeier <pollmeier@gonicus.de>
-    \version 1.00
-    \date    2007/11/02
-
-    The class ViewportController handles the rendering of the main view port,
-    manages the location for images and templates based on themes.
- */
-class ViewportController {
-
-  private $theme;
-  private $smarty;
-  private $language= '';
-  private $timezone;
-  private $mainTemplate= 'main';
-
-  /*! \brief ViewportController constructor
-
-    The ViewportController loads the 'display' config option from the
-    ConfigRegistry and acts depending on these settings.
-   */
-       public function __construct(){
-
-    /* Do language setup during initialization, so we can really be sure
-       that most stuff gets translated in the beginning. */
-    $this->languageSetup();
-
-    /* Get configuration instance */
-    $config= Registry::getInstance("ConfigManager");
-    $config->setSection('display');
-
-    /* Set timezone */
-    $this->timezone= $config->getValue('timezone', 'GMT');
-    if (!date_default_timezone_set($this->timezone)){
-      throw new ViewportControllerException(_("Timezone '%s' is not valid!"), $this->timezone);
-    }
-
-    /* Do Smarty setup */
-    $this->Smarty= new Smarty;
-    $this->Smarty->template_dir= BASE_DIR.'/templates/';
-    $this->Smarty->caching= $config->getValue('cache-templates', FALSE);
-    $this->Smarty->php_handling= SMARTY_PHP_REMOVE;
-
-    /* Set template compile directory */
-    $this->Smarty->compile_dir= $config->getValue('compile-directory', '/var/spool/gosa');
-
-    /* Check if our template directory is accessible */
-    if (!(is_dir($this->Smarty->compile_dir) && is_writable($this->Smarty->compile_dir))){
-      throw new ViewportControllerException(sprintf(_("Directory '%s' specified as compile-directory is not accessible!"), $this->Smarty->compile_dir));
-    }
-
-    /* Get more display settings */
-    $this->theme= $config->getValue('theme', 'default');
-    
-    /* Check for old files in compile directory */
-    $this->cleanSmartyCompileDir();
-  }
-
-
-  private function cleanSmartyCompileDir() {
-    #TODO: Clean compile dir
-  }
-
-
-  private function languageSetup() {
-
-    /* Get the browser language if */
-    $lang= Utils::getBrowserLanguage();
-    if ($this->language != $lang){
-      #TODO: Emit EventObject for changed language
-      $this->language= $lang;
-    }
-
-    /* Get the browser language */
-    putenv("LANGUAGE=");
-    putenv("LANG=$this->language");
-    setlocale(LC_ALL, $this->language);
-
-    /* Set the text domain as 'messages' */
-    $domain= 'messages';
-    bindtextdomain($domain, BASE_DIR.'/locale');
-    textdomain($domain);
-
-    /* Set global Smarty variable to language and */
-    $GLOBALS['t_language']= $this->language;
-    $GLOBALS['t_gettext_message_dir']= BASE_DIR.'/locale/';
-  }
-
-
-  public function getSmartyInstance() {
-    return $this->Smarty;
-  }
-
-
-  public function getTemplatePath($name) {
-       return "horst";
-  }
-  
-  
-  public function render() {
-    #Header generator from template
-    echo $this->getTemplatePath('main');
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/include/core/class_ConfigManager.inc b/include/core/class_ConfigManager.inc
new file mode 100644 (file)
index 0000000..4840a83
--- /dev/null
@@ -0,0 +1,110 @@
+<?php
+
+/**
+ * ConfigManagerException to handle exceptions that happen inside
+ * the config manager module.
+ */
+class ConfigManagerException extends Exception {
+       public function __construct($message, $code = 0) {
+               parent::__construct($message, $code);
+       }
+}
+
+
+/**
+ * ConfigManager loads and manages GOsa session configurations.
+ *
+ * This class should be integrated via Registry.
+ */
+class ConfigManager {
+
+       /* Config container */
+       private $config;
+       private $current;
+       private $section;
+
+       public function __construct(){}
+
+       /**
+        * Returns a static instance of $class
+        * Creates a new instance of $class if required.
+        * @param string $class
+        * @return obj $$class
+        */
+       public function load($file){
+               if (!is_readable($file)){
+                       throw new ConfigManagerException(sprintf(_("Can't read configuration file '%s'!"), $file));
+               }
+
+               /* Capture errors - just the first line is interesting */
+               ob_start(); 
+               $this->config= parse_ini_file($file, TRUE);
+               $ret= preg_replace( array('/^.*\nWarning: /', '/\n.*$/'),
+                                   array('', ''),
+                                   ob_get_contents());
+               ob_end_clean(); 
+
+               /* Bail out in case of errors */
+               if ($ret != ""){
+                       throw new ConfigManagerException($ret);
+               }
+
+               #echo "Test config and load additional configuration data from LDAP\n";
+               #$this->test_config();
+               #$this->load_servers();        -> Section servers/...;
+               #$this->load_plugin_configs(); -> Section pugins/name/value;
+
+               #print_r($this->config);
+       }
+
+
+       public function save($file){
+               throw new ConfigManagerException(_("Save not supported yet!"));
+       }
+
+
+       public function setSection($name){
+    $this->section= $name;
+
+               if (isset($this->config[$name])){
+                       $this->current= &$this->config[$name];
+                       return TRUE;
+    } else {
+      $this->current= array();
+      return FALSE;
+    }
+       }
+
+
+       public function getSection(){
+               return $this->section;
+       }
+
+
+       public function getSections(){
+       }
+
+
+       public function getValue($name, $default= ""){
+               if (!$this->section){
+                       throw new ConfigManagerException(_("Can't get value without current section set!"));
+               }
+               
+               if (isset($this->current[$name])){
+                       return $this->current[$name];
+               } elseif ($default) {
+      return $default;
+    } else {
+                       return NULL;
+               }
+       }
+
+
+       public function setValue($section, $value){
+       }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/include/core/class_Registry.inc b/include/core/class_Registry.inc
new file mode 100644 (file)
index 0000000..3d611f6
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * GOsa Registry of static class instances that are accessible
+ * from all locations.
+ *
+ * Creates a new instance of the requested class if required.
+ */
+class Registry {
+
+       static private $registry = array();
+
+       private function __construct(){}
+
+       /**
+        * Returns a static instance of $class
+        * Creates a new instance of $class if required.
+        * @param string $class
+        * @return obj $$class
+        */
+       static function getInstance($class){
+               if (!isset(Registry::$registry[$class])){
+                       Registry::$registry[$class]= new $class;
+               }
+               return Registry::$registry[$class];
+       }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/include/core/class_ViewportController.inc b/include/core/class_ViewportController.inc
new file mode 100644 (file)
index 0000000..32a2a99
--- /dev/null
@@ -0,0 +1,127 @@
+<?php
+
+/* Provide Smarty capabilities */
+require("smarty/Smarty.class.php");
+
+/*! \brief   Exception implementation for ViewPortController
+    \author  Cajus Pollmeier <pollmeier@gonicus.de>
+    \version 1.00
+    \date    2007/11/02
+
+    This class handles the exceptions occuring in ObjectList.
+ */
+class ViewportControllerException extends Exception {
+       public function __construct($message, $code = 0) {
+               parent::__construct($message, $code);
+       }
+}
+
+/*! \brief   Implementation for rendering the main view
+    \author  Cajus Pollmeier <pollmeier@gonicus.de>
+    \version 1.00
+    \date    2007/11/02
+
+    The class ViewportController handles the rendering of the main view port,
+    manages the location for images and templates based on themes.
+ */
+class ViewportController {
+
+  private $theme;
+  private $smarty;
+  private $language= '';
+  private $timezone;
+  private $mainTemplate= 'main';
+
+  /*! \brief ViewportController constructor
+
+    The ViewportController loads the 'display' config option from the
+    ConfigRegistry and acts depending on these settings.
+   */
+       public function __construct(){
+
+    /* Do language setup during initialization, so we can really be sure
+       that most stuff gets translated in the beginning. */
+    $this->languageSetup();
+
+    /* Get configuration instance */
+    $config= Registry::getInstance("ConfigManager");
+    $config->setSection('display');
+
+    /* Set timezone */
+    $this->timezone= $config->getValue('timezone', 'GMT');
+    if (!date_default_timezone_set($this->timezone)){
+      throw new ViewportControllerException(_("Timezone '%s' is not valid!"), $this->timezone);
+    }
+
+    /* Do Smarty setup */
+    $this->Smarty= new Smarty;
+    $this->Smarty->template_dir= BASE_DIR.'/templates/';
+    $this->Smarty->caching= $config->getValue('cache-templates', FALSE);
+    $this->Smarty->php_handling= SMARTY_PHP_REMOVE;
+
+    /* Set template compile directory */
+    $this->Smarty->compile_dir= $config->getValue('compile-directory', '/var/spool/gosa');
+
+    /* Check if our template directory is accessible */
+    if (!(is_dir($this->Smarty->compile_dir) && is_writable($this->Smarty->compile_dir))){
+      throw new ViewportControllerException(sprintf(_("Directory '%s' specified as compile-directory is not accessible!"), $this->Smarty->compile_dir));
+    }
+
+    /* Get more display settings */
+    $this->theme= $config->getValue('theme', 'default');
+    
+    /* Check for old files in compile directory */
+    $this->cleanSmartyCompileDir();
+  }
+
+
+  private function cleanSmartyCompileDir() {
+    #TODO: Clean compile dir
+  }
+
+
+  private function languageSetup() {
+
+    /* Get the browser language if */
+    $lang= Utils::getBrowserLanguage();
+    if ($this->language != $lang){
+      #TODO: Emit EventObject for changed language
+      $this->language= $lang;
+    }
+
+    /* Get the browser language */
+    putenv("LANGUAGE=");
+    putenv("LANG=$this->language");
+    setlocale(LC_ALL, $this->language);
+
+    /* Set the text domain as 'messages' */
+    $domain= 'messages';
+    bindtextdomain($domain, BASE_DIR.'/locale');
+    textdomain($domain);
+
+    /* Set global Smarty variable to language and */
+    $GLOBALS['t_language']= $this->language;
+    $GLOBALS['t_gettext_message_dir']= BASE_DIR.'/locale/';
+  }
+
+
+  public function getSmartyInstance() {
+    return $this->Smarty;
+  }
+
+
+  public function getTemplatePath($name) {
+       return "horst";
+  }
+  
+  
+  public function render() {
+    #Header generator from template
+    echo $this->getTemplatePath('main');
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/include/interface_GOsaGuiElementInteraction.inc b/include/interface_GOsaGuiElementInteraction.inc
deleted file mode 100644 (file)
index 70f496b..0000000
+++ /dev/null
@@ -1,31 +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.
-   *
-   * @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:
-?>
diff --git a/include/interfaces/interface_GOsaGuiElementInteraction.inc b/include/interfaces/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:
+?>