Code

Updated Config Management to support Templates
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 May 2011 09:02:09 +0000 (09:02 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 May 2011 09:02:09 +0000 (09:02 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20853 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc
gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.tpl

index 7eb695dd883fd83ec2dfd860a95a9037960370d1..3bbf1f9b3bf81611f1a480892a0009a4dacb0fe4 100644 (file)
@@ -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();
index 839a4c69b22e4bc489c222e023519db6e6ab522a..c5318485bde98912772e33cbf662e40de1f64687 100644 (file)
         <td>{$name}</td>
     </tr>
 </table>
+{else if $type == 'Template'}
+<table>
+    <tr>
+        <td>{$nameName}</td>
+        <td>{$name}</td>
+    </tr>
+</table>
 {/if}