From: cajus Date: Sat, 3 Nov 2007 13:40:18 +0000 (+0000) Subject: Updated to read from sample config X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1acdd7999b02bae39dca4b15a4370f1c7e087c0f;p=gosa.git Updated to read from sample config git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-playground@7723 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa.conf b/gosa.conf index c03ca2a98..02f25da4c 100644 --- a/gosa.conf +++ b/gosa.conf @@ -117,3 +117,8 @@ queue-script = "/usr/local/bin/queue-script.sh" [plugin/environment] kiosk-path = "/var/spool/kiosk" ppd-path = "/var/spool/ppds" + +[plugin/sample] +headline= "|{16px}|{90%}Name|{64px:R}Actions|" +footer= "Statistics with no information currently" +entryFormat= "|{_icon}|{cn} ({_filter(uppercase,{cn})})|{_actions}|" diff --git a/include/class_ConfigManager.inc b/include/class_ConfigManager.inc index 67061c71a..8c40ea19f 100644 --- a/include/class_ConfigManager.inc +++ b/include/class_ConfigManager.inc @@ -20,7 +20,9 @@ class ConfigManagerException extends Exception { class ConfigManager { /* Config container */ - protected $config= NULL; + private $config; + private $current; + private $section; public function __construct(){} @@ -48,36 +50,56 @@ class ConfigManager { throw new ConfigManagerException($ret); } - echo "Test config and load additional configuration data from LDAP\n"; + #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); + #print_r($this->config); } public function save($file){ + throw new ConfigManagerException(_("Save not supported yet!")); } - public function set_section($section_name){ + public function setSection($name){ + if (isset($this->config[$name])){ + $this->section= $name; + $this->current= &$this->config[$name]; + return TRUE; + } else { + $this->section= ""; + $this->current= NULL; + return FALSE; + } } - public function &get_section(){ + public function getSection(){ + return $this->section; } - public function &get_sections(){ + public function getSections(){ } - public function &get_value($section){ + public function getValue($name){ + if (!$this->current){ + throw new ConfigManagerException(_("Can't get value without current section set!")); + } + + if (isset($this->current[$name])){ + return $this->current[$name]; + } else { + return NULL; + } } - public function set_value($section, $value){ + public function setValue($section, $value){ } } diff --git a/include/class_ObjectListViewport.inc b/include/class_ObjectListViewport.inc index 330dbfc6c..414d45ba4 100644 --- a/include/class_ObjectListViewport.inc +++ b/include/class_ObjectListViewport.inc @@ -25,12 +25,12 @@ class ObjectListViewportException extends Exception { */ class ObjectListViewport { - # DUMMY values ----> - private $headline= "|{16px}|{90%}Name|{64px:R}Actions|"; - private $footer= "Statistics with no information currently"; - private $entryFormat= "|{_icon}|{cn} ({_filter(uppercase,{cn})})|{_actions}|"; + /* Dummy here ----> */ + private $headline; + private $footer; + private $entryFormat; private $attributes= array('cn', '_icon', '_actions', 'dn'); - # <--- DUMMY values. + /* <---- Dummy here */ /*! \brief Container for objects @@ -48,6 +48,13 @@ class ObjectListViewport { */ public function __construct($config){ + /* Dummy here */ + $cr= Registry::getInstance("ConfigManager"); + $cr->setSection("plugin/sample"); + $this->headline= $cr->getValue("headline"); + $this->footer= $cr->getValue("footer"); + $this->entryFormat= $cr->getValue("entryFormat"); + /* Load and instanciate classes, extract filter, icons, view hooks, etc. */ $this->objects= new ObjectList($config); } diff --git a/test b/test index 3b4469d15..6101c399f 100755 --- a/test +++ b/test @@ -10,8 +10,8 @@ require_once("include/autoload.inc"); try { /* Get new test instance of the Configuration */ - #$cr= Registry::getInstance("ConfigManager"); - #$cr->load("gosa.conf"); + $cr= Registry::getInstance("ConfigManager"); + $cr->load("gosa.conf"); /* Get a new test instance of ObjectListViewports */ $vp= new ObjectListViewport(array("dummy", "dummy"));