Code

Updated device handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 30 Sep 2010 14:02:03 +0000 (14:02 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 30 Sep 2010 14:02:03 +0000 (14:02 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19873 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml
gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc
gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl
gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc

index 27e6ec474e00458a1be5c6390de3f2013f2af694..ba1af7e990bbda71fe99643f4552a0e7df1f590d 100644 (file)
     <defaultSortColumn>1</defaultSortColumn>
 
     <objectType>
-      <label>Device</label>
+      <label>Item</label>
       <objectClass>FAKE_OC_DeviceItem</objectClass>
       <category>Device</category>
-      <class>Device</class>
+      <class>Item</class>
       <image>images/lists/edit.png</image>
     </objectType>
 
+    <objectType>
+      <label>1Item</label>
+      <objectClass>1FAKE_OC_DeviceItem</objectClass>
+      <category>Device</category>
+      <class>1Item</class>
+      <image>1images/lists/edit.png</image>
+    </objectType>
+
   </definition>
 
   <table>
     <layout>|20px;c|||170px;r|</layout>
 
+    <department>
+      <value>%{filter:objectType(dn,objectClass)}</value>
+    </department>
+
     <column>
       <value>%{filter:objectType(dn,objectClass)}</value>
     </column>
 
+
     <column>
       <label>Name</label>
       <sortAttribute>cn</sortAttribute>
index e2e56e9901ce1cd4303f06dd779f997d9bae2f98..0152524a372b5e3c8b3e32c83fabf1213be22fe4 100644 (file)
@@ -2,6 +2,15 @@
 
 class DeviceTab extends tabs
 {
+
+    function __construct(&$config, $data, $dn, $acl_category= "", $hide_refs = FALSE, $hide_acls = FALSE)
+    {
+        tabs::tabs($config, $data, $dn, $acl_category, $hide_refs, $hide_acls);
+        if(isset($this->by_object['InstallRecipe'])){
+            $this->by_object['InstallRecipe']->updateRecipeTab();
+        }
+    }
+
     function save($ignore_account= FALSE)
     {
         // Prepare object DN
index 82d79562394fc8e7f3339d4a39a6aa655b73b864..05b5b0be728d4a01f1796678b15c0b6862c1d2c3 100644 (file)
@@ -2,20 +2,21 @@
 <h3>{t}Installation type{/t}</h3>
 <table>
     <tr>
-        <td><LABEL for="__missingBoostrap">{t}Bootstrap method{/t}</LABEL></td>
+        <td><LABEL for="kickstartBootstrapMethod">{t}Bootstrap method{/t}</LABEL></td>
         <td>
-            <select name="__missingBoostrap" size=1>
-                {html_options options=$__missingBoostrapList 
-                selected=$__missingBoostrap}
+            <select name="kickstartBootstrapMethod" size=1>
+                {html_options options=$kickstartBootstrapMethodList 
+                selected=$kickstartBootstrapMethod}
             </select>
         </td>
     </tr>
     <tr>
-        <td><LABEL for="__missingConfigManagement">{t}Config management{/t}</LABEL></td>
+        <td><LABEL for="kickstartConfigManagement">{t}Config management{/t}</LABEL></td>
         <td>
-            <select name="__missingConfigManagement" size=1>
-                {html_options options=$__missingConfigManagementList 
-                selected=$__missingConfigManagement}
+            <select name="kickstartConfigManagement" size=1
+                onChange='document.mainform.submit();'>
+                {html_options options=$kickstartConfigManagementList 
+                selected=$kickstartConfigManagement}
             </select>
         </td>
     </tr>
index b8edebc7f7558d0c5e91c9a95fc8e3cb3cd9449d..aca7d011437a3642f8458a8bfed376234437c30e 100644 (file)
@@ -3,11 +3,11 @@
 class InstallRecipe extends plugin
 {
 
-    public $__missingBoostrap = 'debian';
-    public $__missingBoostrapList = array('weißnicht' => 'Irgendwas','debian' => 'debian');
+    public $kickstartBootstrapMethod = 'debian';
+    public $kickstartBootstrapMethodList = NULL;
 
-    public $__missingConfigManagement = 'puppet';
-    public $__missingConfigManagementList = array('fai' => 'FAI','puppet' => 'Puppet');
+    public $kickstartConfigManagement = 'puppet';
+    public $kickstartConfigManagementList = array('fai' => 'FAI','puppet' => 'Puppet');
 
     public $kickstartTemplateDN = "";
     public $kickstartTemplateDNList = array(
@@ -34,7 +34,8 @@ class InstallRecipe extends plugin
     public $objectclasses = array('installRecipe');
     public $attributes = array("kickstartTemplateDN","kickstartKeyboardlayout","kickstartSystemLocale",
             "kickstartTimezone","kickstartTimeUTC","kickstartNTPServer","kickstartMirrorDN",
-            "kickstartRootEnabled","kickstartRootPasswordHash","kickstartKernelPackage","kickstartPartitionTable");
+            "kickstartRootEnabled","kickstartRootPasswordHash","kickstartKernelPackage",
+            "kickstartPartitionTable","kickstartConfigManagement","kickstartBootstrapMethod");
 
     public $setKickstartRootPasswordHash = FALSE;
 
@@ -91,7 +92,7 @@ class InstallRecipe extends plugin
         $this->kickstartNTPServerList->setHeight("70px");
 
         // Load list of bootstrap methods.
-        $this->__missingBoostrapList = $this->getBootstrapMethods();
+        $this->kickstartBootstrapMethodList = $this->getBootstrapMethods();
     }
 
     
@@ -133,10 +134,10 @@ class InstallRecipe extends plugin
         $smarty->assign('kickstartSystemLocaleList', $this->kickstartSystemLocaleList);
         $smarty->assign('kickstartNTPServerList', $this->kickstartNTPServerList->render());
 
-        $smarty->assign('__missingBoostrap', $this->__missingBoostrap);
-        $smarty->assign('__missingBoostrapList', $this->__missingBoostrapList);
-        $smarty->assign('__missingConfigManagement', $this->__missingConfigManagement);
-        $smarty->assign('__missingConfigManagementList', $this->__missingConfigManagementList);
+        $smarty->assign('kickstartBootstrapMethod', $this->kickstartBootstrapMethod);
+        $smarty->assign('kickstartBootstrapMethodList', $this->kickstartBootstrapMethodList);
+        $smarty->assign('kickstartConfigManagement', $this->kickstartConfigManagement);
+        $smarty->assign('kickstartConfigManagementList', $this->kickstartConfigManagementList);
         foreach($this->attributes as $attr){
             $smarty->assign($attr, $this->$attr);
         }
@@ -181,6 +182,35 @@ class InstallRecipe extends plugin
             $test = new $available[$hash]($this->config,$this->dn);
             $this->kickstartRootPasswordHash = @$test->generate_hash(get_post('rootPassword'));
         }
+
+        $this->updateRecipeTab();
+    }
+
+
+    function updateRecipeTab()
+    {
+        $mode = $this->kickstartConfigManagement;
+        if(!isset($this->recipeTabs[$mode])){
+            $this->recipeTabs[$mode] = new DeviceConfig($this->config, $this->dn);
+            $this->recipeTabs[$mode]->parent = &$this->parent;
+        }
+
+        // Update the recipe tab to match the selected installation method.
+        if($this->is_account){
+
+            if(isset($this->parent->by_object['DeviceConfig']) && 
+                $this->recipeTabs[$mode] === $this->parent->by_object['DeviceConfig']){
+                return;
+            }
+
+            $this->parent->by_name['DeviceConfig'] = $this->kickstartConfigManagementList[$mode];
+            $this->parent->by_object['DeviceConfig'] = &$this->recipeTabs[$mode];
+        }else{
+            if(isset($this->parent->by_name['DeviceConfig'])){
+                unset($this->parent->by_name['DeviceConfig']);
+                unset($this->parent->by_object['DeviceConfig']);
+            }
+        }
     }
 
 
@@ -220,6 +250,8 @@ class InstallRecipe extends plugin
                     "plProvidedAcls" => array(
                         "member" => _("Member"),
                         "kickstartTemplateDN" => _("Template"),
+                        "kickstartBootstrapMethod" => _("Bootstrap method"),
+                        "kickstartConfigManagement" => _("Config management"),
                         "kickstartKeyboardlayout" => _("Keyboard layout"),
                         "kickstartSystemLocale" => _("System locale"),
                         "kickstartTimezone" => _("Timezone"),