From: hickert Date: Wed, 18 May 2011 09:02:09 +0000 (+0000) Subject: Updated Config Management to support Templates X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=79aada996eb86f84f678286cbafb938351a0ec4f;p=gosa.git Updated Config Management to support Templates git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20853 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc index 7eb695dd8..3bbf1f9b3 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc @@ -37,7 +37,7 @@ class newConfigManagement extends plugin // Preset item config - with Distribution and Release objects. $items = array(); - $items['root']['container'] = array('Distribution'); + $items['root']['container'] = array('Distribution', 'Template'); $items['root']['name'] = '/'; $items['root']['description'] = _('Root'); @@ -64,6 +64,10 @@ class newConfigManagement extends plugin $rOpt1 = array('description' => _('Name'), 'default' => '', 'value' => '', 'required' => true, 'type' => 'string', 'display' => _('Name')); + // Define template parameters + $tOpt1 = array('description' => _('Name'), 'default' => '', 'value' => '', 'required' => true, + 'type' => 'string', 'display' => _('Name')); + $items['Distribution']['container'] = array('Release'); $items['Distribution']['name'] = 'Distribution'; $items['Distribution']['description'] = _('Distribution'); @@ -81,6 +85,11 @@ class newConfigManagement extends plugin $items['Release']['description'] = _('Release'); $items['Release']['options']['name'] = $rOpt1; + $items['Template']['container'] = array(); + $items['Template']['name'] = 'Template'; + $items['Template']['description'] = _('Template'); + $items['Template']['options']['name'] = $tOpt1; + $this->installationMethods = array(); $this->installationMethods['root']['description'] = _('root'); $this->installationMethods['root']['name'] = 'root'; @@ -88,6 +97,7 @@ class newConfigManagement extends plugin $this->installationMethods['root']['items']['Distribution'] = &$items['Distribution']; $this->installationMethods['root']['items']['Release'] = &$items['Release']; $this->installationMethods['root']['items']['root'] = &$items['root']; + $this->installationMethods['root']['items']['Template'] = &$items['Template']; } @@ -165,6 +175,20 @@ class newConfigManagement extends plugin // Recreate the data model, to have a clean and fresh instance. $this->dataModel = new ConfigManagementDataModel(); + + // Load templates from the backend and append them on the base + $rpc = $this->config->getRpcHandle(); + $res = $rpc->installListTemplates(); + if(!$rpc->success()){ + $this->errorMessage = sprintf(_("Failed to load templates: %s"), $rpc->get_error()); + return(FALSE); + } + foreach($res as $tName => $tData){ + $tData['name'] = $tName; + $this->dataModel->addItem('Template','/root', $tName, $tData); + } + + // Load distributions $rpc = $this->config->getRpcHandle(); $res = $rpc->getDistributions(); diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.tpl b/gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.tpl index 839a4c69b..c5318485b 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.tpl +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.tpl @@ -48,4 +48,11 @@ {$name} +{else if $type == 'Template'} + + + + + +
{$nameName}{$name}
{/if}