From bfc48617024cfa5bb63af4fba699d3967b8fee09 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 30 Sep 2010 14:02:03 +0000 Subject: [PATCH] Updated device handling git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19873 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/goto/Config/DeviceConfig-list.xml | 17 +++++- .../admin/systems/goto/Device/DeviceTab.inc | 9 ++++ .../systems/goto/Device/InstallRecipe.tpl | 17 +++--- .../goto/Device/class_InstallRecipe.inc | 52 +++++++++++++++---- 4 files changed, 75 insertions(+), 20 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml index 27e6ec474..ba1af7e99 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml +++ b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml @@ -11,22 +11,35 @@ 1 - + FAKE_OC_DeviceItem Device - Device + Item images/lists/edit.png + + + 1FAKE_OC_DeviceItem + Device + 1Item + 1images/lists/edit.png + + |20px;c|||170px;r| + + %{filter:objectType(dn,objectClass)} + + %{filter:objectType(dn,objectClass)} + cn diff --git a/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc b/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc index e2e56e990..0152524a3 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc @@ -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 diff --git a/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl b/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl index 82d795623..05b5b0be7 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl +++ b/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl @@ -2,20 +2,21 @@

{t}Installation type{/t}

- + - + diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc index b8edebc7f..aca7d0114 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc @@ -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"), -- 2.30.2
- + {html_options options=$kickstartBootstrapMethodList + selected=$kickstartBootstrapMethod}
- + {html_options options=$kickstartConfigManagementList + selected=$kickstartConfigManagement}