Code

automatically select the right installation method
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Apr 2011 07:14:48 +0000 (07:14 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Apr 2011 07:14:48 +0000 (07:14 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20650 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index a5bcdd1dc13f6c34cbc8801a40e6eedad890c2ce..7a4d574ad3806f63e96334f25392a8ef3df821c8 100644 (file)
@@ -89,8 +89,10 @@ class newConfigManagement extends plugin
             msg_dialog::display(_("Error"), sprintf(_("Failed to load distributions: %s"), $rpc->get_error()),ERROR_DIALOG);
             return(NULL);
         }else{
+            $this->cfgTypeMap = array();
             foreach($res as $dist){
                 $this->dataModel->addItem('Distribution','/root', $dist['name'], $dist);
+                $this->cfgTypeMap['/root/'.$dist['name']] = $dist['installation_method'];
                 foreach($dist['releases'] as $release){
                     $distPath = "/root/{$dist['name']}";
                     $this->dataModel->addItem('Release',$distPath, $release['name'], $release);
@@ -207,9 +209,8 @@ class newConfigManagement extends plugin
         $this->listing->setContainer($cont);
 
         // Set the correct installation method for the selected item
-        $item = $this->dataModel->getItemByPath($cont);
-        if($this->cfgTypeMap[$item['type']]){
-            $method = $this->cfgTypeMap[$item['type']];
+        if(isset($this->cfgTypeMap[$cont])){
+            $method = $this->cfgTypeMap[$cont];
             $this->setInstallMethod($method);
         }
     }
@@ -304,15 +305,6 @@ class newConfigManagement extends plugin
             msg_dialog::display(_("Setup"), $this->errorMessage , ERROR_DIALOG);
             $this->initFailed = TRUE;
             return;
-        }else{
-            
-            $this->cfgTypeMap = array();
-            foreach($this->installationMethods as $methodName => $data){
-                foreach($data['items'] as $itemName => $itemData){
-                    $this->cfgTypeMap[$itemName] = $methodName;
-                }
-            }
-
         }
     }