Code

Updated config manamgenet
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 25 Oct 2010 06:58:51 +0000 (06:58 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 25 Oct 2010 06:58:51 +0000 (06:58 +0000)
-Seperated both base selectors
 - One for the container objects and one for the items.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20132 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementDataModel.inc
gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementListing.inc
gosa-core/plugins/admin/newConfigManagement/class_newConfigManagement.inc

index 2f35075ec0d7f752d04d8b6ac909af9861d0f45d..2113c46a1cac6fb95e569e76f3d938909dc9e19e 100644 (file)
@@ -90,11 +90,11 @@ class ConfigManagementDataModel
         }
     }
 
-    function getItemsByType($type)
+    function getItemsByType($types)
     {
         $res = array();
         foreach($this->data['linear'] as $path => $item){
-            if($item['type'] == $type) $res[] = $item;
+            if(in_array($item['type'],$types)) $res[] = $item;
         }
         return($res);
     }
index 427f02276abd18c8633342e913a64cd093ec4e84..9153c4db90073a15d6f5a99b88792155935ffec6 100644 (file)
@@ -16,7 +16,7 @@ class ConfigManagementListing extends management
         $this->rebuildListing();
 
         $this->containerSelector = new ItemSelector(array(),'/root','/root');
-        $this->itemSelector = new ItemSelector(array(),'/root','/root');
+        $this->itemSelector = new ItemSelector(array(),'','');
     }
 
     function save_object()
index 8b7cf00d4be5cdb904ed0e8a2901f83440ce539b..eb7b13e7355c7cb042de187e927d2d8aba30cb93 100644 (file)
@@ -110,16 +110,16 @@ class newConfigManagement extends plugin
                                 $rpc->get_error()),ERROR_DIALOG);
                 }else{
                     $this->dataModel->setItemStatus($path, 'käse');
+                    $rpc = $this->config->getRpcHandle();
+                    $res = $rpc->getPackages($data['name']);
+
+                    return;
                     foreach($res as $itemPath => $type){
                 
                         // Make names dataModel conform
-                        $itemPath = $path.preg_replace("/^\//","/root", $itemPath);
+                        $itemPath = $path.'/'.preg_replace("/^\//","/root", $itemPath);
                         $name = preg_replace("/^.*\//","",$itemPath);   
-
                         $itemPath = preg_replace("/\/[^\/]*$/","", $itemPath);
-
-                        print_a(array($type, $itemPath, $name));
                         $this->dataModel->addItem($type, $itemPath, $name); 
                     }
                 }
@@ -136,7 +136,8 @@ class newConfigManagement extends plugin
         // Get the selected release and store it in a session variable
         //  to allow the configFilter to access it and display the
         //  packages and items.
-        $item = $this->dataModel->getItemByPath($this->selectedItem);
+        $path = $this->selectedContainer.$this->selectedItem;
+        $item = $this->dataModel->getItemByPath($path);
         session::set('CONFIG_ITEM', $item);
 
         return($this->listing->renderList());
@@ -149,14 +150,11 @@ class newConfigManagement extends plugin
      */
     function getItemList()
     {
-        $data = $this->dataModel->getItemByPath('/root');
-        return($this->__recurseItem($data));
-        $res = array();
-        $dist = $this->selectedContainer;
-        $list = $this->dataModel->getItemsByType('Release');
-        foreach($list as $base => $entry){
-            if($entry['parentPath'] != $dist) continue;
-            $res[$entry['path']] = $entry['name'];
+        $data = $this->dataModel->getItemByPath($this->selectedContainer);
+        $res = array(""=>"/");
+        if($data['type'] != 'Release'){
+        }else{
+            $res = array_merge($res,$this->__recurseItem($data, array('Component'),$this->selectedContainer));
         }
         return($res);
     }
@@ -169,25 +167,22 @@ class newConfigManagement extends plugin
     function getDistList()
     {
         $data = $this->dataModel->getItemByPath('/root');
-        return($this->__recurseItem($data));
-       
-
-        $list = $this->dataModel->getItemsByType('Distribution');
-        $res = array();
-        foreach($list as $base => $entry){
-            $res[$entry['path']] = $entry['name'];
-        }
+        $res["/root"] = "/";
+        $res = array_merge($res,$this->__recurseItem($data, array('Distribution','Release')));
         return($res);
     }
     
 
-    function __recurseItem($item)
+    function __recurseItem($item, $types, $parent = "")
     {
         $res = array();
-        $res[$item['path']] = $item['type'];
+        if(in_array($item['type'], $types)){
+            $path = preg_replace("/".preg_quote($parent,'/')."/","",$item['path']);
+            $res[$path] = $item['name'];
+        }
         if(count($item['children'])){
             foreach($item['children'] as $child){
-                $res = array_merge($res, $this->__recurseItem($child));
+                $res = array_merge($res, $this->__recurseItem($child, $types, $parent));
             }
         }
         return($res);