Code

Updated base handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 29 Sep 2010 16:00:23 +0000 (16:00 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 29 Sep 2010 16:00:23 +0000 (16:00 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19861 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc

index 0bc9d755b243d80b3a6bf5c1167da8df60747f40..87d317a895d73eaf062edb9c5adcc73266866edb 100644 (file)
@@ -21,6 +21,7 @@ class DeviceConfig extends management
     public $is_account = FALSE;
     public $ignore_account = FALSE;
 
+    private $baseToDN = array();
 
     /*! \brief  Constructs the device configuration plugin 
      *  @param  Config  The GOsa configuration object.
@@ -65,6 +66,7 @@ class DeviceConfig extends management
         // Set current item to 'root', this is the minimum to get things running.
         $this->addItem($root,'root',array());
         $this->setCurrentItem('root');
+        $this->setBase($this->baseToDN['root']);
 
         $this->addItem('PuppetModule','test1',
                 array(
@@ -129,7 +131,7 @@ class DeviceConfig extends management
 
     function openEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
     {
-        $this->base = $this->currentItemValues[$target[0]]['base'];
+        $this->setBase($this->currentItemValues[$target[0]]['base']);
     }
 
 
@@ -243,15 +245,19 @@ class DeviceConfig extends management
         $this->idToName[] = $name;
 
         $base = (isset($current['base']))? ",".$current['base'] : '';
+        $base = "cn={$name}{$base}";
 
         $new = array(
-                'base' => "cn={$name}{$base}",
+                'base' => $base,
                 'children' => array(),
                 'type' => $type, 
                 'name' => $name, 
                 'values' => $values);
         $this->currentItemValues[$name] = $new;
         $current['children'][$name] = &$this->currentItemValues[$name];
+
+        $this->baseToDN[$name] = $base;
+        $this->baseToDN[$base] = $name;
     }
     
 
@@ -329,9 +335,17 @@ class DeviceConfig extends management
 
         // Get selected Items
         $this->itemContainerSelector->update();
-        $this->base = $this->itemContainerSelector->getBase();
+        $this->setBase($this->itemContainerSelector->getBase());
+    }
+
+   
+    function setBase($base)
+    {
+        $this->base = $base;
+        $item = $this->currentItemValues[$this->baseToDN[$base]];
     }
 
+
     /*! \brief    Forward plugin acls
      */
     function set_acl_base($base)