Code

Updated recipe tab
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Oct 2010 08:16:14 +0000 (08:16 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Oct 2010 08:16:14 +0000 (08:16 +0000)
-The Recipe-tab adds the fai/puppets tabs now on demand.

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

gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc

index aca7d011437a3642f8458a8bfed376234437c30e..a4a33226138e65abac613a58d795214d00148056 100644 (file)
@@ -148,7 +148,11 @@ class InstallRecipe extends plugin
 
     function save_object()
     {
+
+        
         if(isset($_POST['InstallRecipePosted'])){
+
+            $currentInstallMethod = $this->kickstartConfigManagement;
             plugin::save_object();
             $this->kickstartRootEnabled = isset($_POST['kickstartRootEnabled']);
             $this->kickstartTimeUTC = isset($_POST['kickstartTimeUTC']);
@@ -167,6 +171,10 @@ class InstallRecipe extends plugin
                 }
             }
             $this->kickstartNTPServerList->setListData($this->kickstartNTPServer);
+
+            if($currentInstallMethod != $this->kickstartConfigManagement){
+                $this->updateRecipeTab();
+            }
         }
         if(isset($_POST['cancelPassword'])) $this->setKickstartRootPasswordHash =false;
         if(isset($_POST['setPassword'])) {
@@ -183,7 +191,6 @@ class InstallRecipe extends plugin
             $this->kickstartRootPasswordHash = @$test->generate_hash(get_post('rootPassword'));
         }
 
-        $this->updateRecipeTab();
     }
 
 
@@ -193,13 +200,52 @@ class InstallRecipe extends plugin
         if(!isset($this->recipeTabs[$mode])){
             $this->recipeTabs[$mode] = new DeviceConfig($this->config, $this->dn);
             $this->recipeTabs[$mode]->parent = &$this->parent;
+
+            if($this->recipeTabs[$mode]->setInstallMethod($mode)){
+
+                $class= &$this->recipeTabs[$mode];
+
+                // Add some dummy entries for testing.
+                if($mode == 'puppet'){ 
+                    $id = $class->addItem('PuppetModule','test1',
+                            array(
+                                'dependency' => array('stulle','Wurst'),
+                                'version' => '2.4-f',
+                                'name'  => 'Thundebird',
+                                'description' => 'Mozilla mail client')
+                            );
+                    $id = $class->addItem('PuppetModule','test2',
+                            array(
+                                'dependency' => array('Leipnitz','Dose'),
+                                'version' => 1,
+                                'name'  => 'Firefox',
+                                'description' => 'Test Module')
+                            );
+                    $class->setCurrentItem($id);
+                    $id = $class->addItem('PuppetTemplate','temp1',
+                            array(
+                                'name' => 'temp1',
+                                'data' => 'kekse.tpl')
+                            );
+                    $class->setCurrentItem($id);
+                    $id = $class->addItem('PuppetTemplate','tep1',
+                            array(
+                                'name' => 'tep1',
+                                'data' => 'kekse.tpl')
+                            );
+
+                    $class->setCurrentItem($class->getRootItemID());
+                }
+            }else{
+                unset($this->recipeTabs[$mode]);
+            }
         }
 
         // Update the recipe tab to match the selected installation method.
-        if($this->is_account){
+        if($this->is_account && isset($this->recipeTabs[$mode])){
 
             if(isset($this->parent->by_object['DeviceConfig']) && 
-                $this->recipeTabs[$mode] === $this->parent->by_object['DeviceConfig']){
+                    $this->recipeTabs[$mode] === $this->parent->by_object['DeviceConfig']){
                 return;
             }