Code

Updated configRegistry
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 May 2010 08:41:56 +0000 (08:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 May 2010 08:41:56 +0000 (08:41 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18071 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_config.inc
gosa-core/include/class_configRegistry.inc

index c76fc746c40b6e2ac45d994cedb41d56980d70be..fa7174269bb75f3ec17155dc0f220ac64ee946e0 100644 (file)
@@ -1077,6 +1077,11 @@ class config  {
    */
   function get_cfg_value($name, $default= "") 
   {
+
+    if($this->configRegistry->propertyExists('core',$name)){
+        return($this->configRegistry->getPropertyValue('core',$name));
+    }
+
     $name= strtoupper($name);
 
     /* Check if we have a current value for $name */
index 7520310d7f0acc3b7555a24c4a83263627bbd260..acfc29171f768be715469c2cd4e7b5be39e577a4 100644 (file)
@@ -31,8 +31,9 @@ class configRegistry{
         $this->fileStoredProperties = array();
         $this->properties = array();
         $this->mapByClass = array();
+        $this->mapByName = array();
         $this->mapPropertyToClass = array();
-        
+
         // Search for config flags defined in the config file (TAB section)
         foreach($this->config->data['TABS'] as $tabname => $tabdefs){
             foreach($tabdefs as $info){
@@ -80,7 +81,7 @@ class configRegistry{
             }
             $this->status = 'finished';
         }
+
         global $class_mapping;
         foreach ($class_mapping as $cname => $path){
             $cmethods = get_class_methods($cname);
@@ -166,6 +167,7 @@ class configRegistry{
         foreach($this->properties as $prop){
             $prop->save();
         }
+        $this->reload(TRUE);
     }
 }
 
@@ -221,12 +223,14 @@ class gosaProperty
         if(isset($this->parent->ldapStoredProperties[$this->class][$this->name])){
             $this->setStatus('ldap');
             $this->value = $this->parent->ldapStoredProperties[$this->class][$this->name];
+            return;
         }
 
         // Second check for values in the config file.
         if(isset($this->parent->fileStoredProperties[$this->class][strtolower($this->name)])){
             $this->setStatus('file');
             $this->value = $this->parent->fileStoredProperties[$this->class][strtolower($this->name)];
+            return;
         }
 
         // If there still wasn't found anything then fallback to the default.
@@ -275,16 +279,16 @@ class gosaProperty
             if(!$ldap->count()){
                 $ldap->cd($dn);
                 $data = array(
-                            'cn' => $this->class, 
-                            'objectClass' => array('top','gosaConfig'),
-                            'gosaSetting' => $this->name.":".$this->value);
+                        'cn' => $this->class, 
+                        'objectClass' => array('top','gosaConfig'),
+                        'gosaSetting' => $this->name.":".$this->value);
 
                 $ldap->add($data);
-                if($ldap->success()){
-                    $this->status = 'ldap';
-                }else{
+                if(!$ldap->success()){
                     echo $ldap->get_error();
                 }
+                $this->_restoreCurrentValue();
+
             }else{
                 $attrs = $ldap->fetch();
                 $data = array();
@@ -300,11 +304,10 @@ class gosaProperty
                 if(!$found) $data['gosaSetting'][] = "{$this->name}:{$this->value}";
                 $ldap->cd($dn);
                 $ldap->modify($data);
-                if($ldap->success()){
-                    $this->status = 'ldap';
-                }else{
+                if(!$ldap->success()){
                     echo $ldap->get_error();
                 }
+                $this->_restoreCurrentValue();
             } 
         }elseif($this->getStatus() == 'removed'){
             $ldap = $this->parent->config->get_ldap_link();
@@ -322,11 +325,10 @@ class gosaProperty
             }
             $ldap->cd($dn);
             $ldap->modify($data);
-            if($ldap->success()){
-                $this->_restoreCurrentValue();
-            }else{
+            if(!$ldap->success()){
                 echo $ldap->get_error();
             }
+            $this->_restoreCurrentValue();
         }
     }