Code

Updated release and distribution selector for the new Config Management
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Oct 2010 15:03:59 +0000 (15:03 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Oct 2010 15:03:59 +0000 (15:03 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20118 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 5617bec2fd089ce655b7a9473d361966efceb7b4..cfaf427758929671a7b416cf7e5eda6b9effbec6 100644 (file)
@@ -30,25 +30,26 @@ class ConfigManagementListing extends management
         return($this->distributionSelector->getBase());
     }
 
-    function getSelectedRelease()
+    function setDistribution($dist)
     {
-        return($this->releaseSelector->getBase());
+        return($this->distributionSelector->setBase($dist));
     }
 
-    function setDistribution($base)
+    function setRelease($rel)
     {
-        $this->distributionSelector->setBase($base);
+        return($this->releaseSelector->setBase($rel));
     }
 
-    function setDistributions($distributions) 
+    function getSelectedRelease()
     {
-        $this->distributionSelector->setBases($distributions);
-        $this->distributionSelector->update(TRUE);
+        return($this->releaseSelector->getBase());
     }
 
-    function setRelease($base)
+
+    function setDistributions($distributions) 
     {
-        $this->releaseSelector->setBase($base);
+        $this->distributionSelector->setBases($distributions);
+        $this->distributionSelector->update(TRUE);
     }
 
     function setReleases($releases) 
index 757534c3d0e2bae94062bb6c39657e4fc884c252..7cea340d67fe3031b7672a06090dad52acfaa7c3 100644 (file)
@@ -54,6 +54,21 @@ class newConfigManagement extends plugin
         $this->listing->save_object();
         $this->selectedDistribution = $this->listing->getSelectedDistribution();
         $this->selectedRelease = $this->listing->getSelectedRelease();
+    
+        $distList = $this->getDistList();
+        $releaseList = $this->getReleaseList();
+
+        if(!isset($releaseList[$this->selectedRelease])){
+            if(count($releaseList)){
+                $this->selectedRelease = key($releaseList);
+            }else{
+                $this->selectedRelease = "";
+            }
+        }
+        $this->listing->setDistribution($this->selectedDistribution);
+        $this->listing->setRelease($this->selectedRelease);
+        $this->listing->setDistributions($this->getDistList());
+        $this->listing->setReleases($this->getReleaseList());
     }
 
     
@@ -95,9 +110,6 @@ class newConfigManagement extends plugin
                 $displayEntries[] = $entry;
             }
         }
-    
-        $this->listing->setDistributions($this->getDistList());
-        $this->listing->setReleases($this->getReleaseList());
         return($this->listing->renderList());
     }
 
@@ -118,7 +130,7 @@ class newConfigManagement extends plugin
     function getDistList()
     {
         $list = $this->dataModel->getItemsByType('Distribution');
-        $res = array('/root/wurst' => 'wurst', '/root/tester' => 'tester');
+        $res = array();
         foreach($list as $base => $entry){
             $res[$entry['path']] = $entry['name'];
         }