From: cajus Date: Thu, 15 Nov 2007 15:21:25 +0000 (+0000) Subject: Updated structure X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=852ac41d930a722e023bb20504d6ad843688f892;p=gosa.git Updated structure git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-playground@7805 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/autoload-data.inc b/include/autoload-data.inc index 14ff98e2b..c1953c5c6 100644 --- a/include/autoload-data.inc +++ b/include/autoload-data.inc @@ -1,21 +1,21 @@ "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 index 4840a83ac..000000000 --- a/include/class_ConfigManager.inc +++ /dev/null @@ -1,110 +0,0 @@ -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 index 3d611f619..000000000 --- a/include/class_Registry.inc +++ /dev/null @@ -1,30 +0,0 @@ - diff --git a/include/class_ViewportController.inc b/include/class_ViewportController.inc deleted file mode 100644 index 32a2a9978..000000000 --- a/include/class_ViewportController.inc +++ /dev/null @@ -1,127 +0,0 @@ - - \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 - \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 index 000000000..4840a83ac --- /dev/null +++ b/include/core/class_ConfigManager.inc @@ -0,0 +1,110 @@ +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 index 000000000..3d611f619 --- /dev/null +++ b/include/core/class_Registry.inc @@ -0,0 +1,30 @@ + diff --git a/include/core/class_ViewportController.inc b/include/core/class_ViewportController.inc new file mode 100644 index 000000000..32a2a9978 --- /dev/null +++ b/include/core/class_ViewportController.inc @@ -0,0 +1,127 @@ + + \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 + \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 index 70f496ba4..000000000 --- a/include/interface_GOsaGuiElementInteraction.inc +++ /dev/null @@ -1,31 +0,0 @@ - - \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 index 000000000..70f496ba4 --- /dev/null +++ b/include/interfaces/interface_GOsaGuiElementInteraction.inc @@ -0,0 +1,31 @@ + + \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: +?>