Code

Fixed problem with fetching config items
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Apr 2011 10:23:30 +0000 (10:23 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Apr 2011 10:23:30 +0000 (10:23 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20745 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc

index 21ffe2454ea0fbc0f3b47a1b1d03e98bdb94cbd4..f30ae5d95960a8e1b8d6f1ee17423010d122f7a9 100644 (file)
@@ -226,7 +226,11 @@ class newConfigManagement extends plugin
 
                 // Request all config items for the selected release via rpc.
                 $rpc = $this->config->getRpcHandle();
-                $res = $rpc->listConfigItems($data['name']);
+
+                $rPath = $this->getReleasePath($path);
+                $dPath = $this->getDistributionPath($path);
+                $releasePath = preg_replace("/^".preg_quote($dPath, '/')."\/?/", "", $rPath);
+                $res = $rpc->listConfigItems($releasePath);
                 if(!$rpc->success()){
                     msg_dialog::display(_("Error"),sprintf(_("Failed to load distributions: %s"),$rpc->get_error()),ERROR_DIALOG);
                 }else{
@@ -575,7 +579,24 @@ class newConfigManagement extends plugin
         }
         return(NULL);
     }
-   
+  
+    
+    /*! \brief  Extracts the distribution path out of a path.
+     *          e.g. /root/debian/squeeze/test/module -> /root/debian
+     */
+    function getDistributionPath($fullPath)
+    {
+        $fullPath.='/';
+        while(preg_match("/\//", $fullPath)){
+            $fullPath = preg_replace("/\/[^\/]*$/","", $fullPath);
+            $item = $this->dataModel->getItemByPath($fullPath);
+            if($item['type'] == 'Distribution'){
+                return($fullPath);
+            }
+        }
+        return(NULL);
+    }
  
     function saveItemChanges()
     {