Code

Updated distribution template
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Apr 2011 07:58:45 +0000 (07:58 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Apr 2011 07:58:45 +0000 (07:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20741 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 76272c1548ec9db69d2ff26930dadaa649200ff5..2c0383e334c5535d1be6f46b3ea44ac70a401383 100644 (file)
@@ -36,32 +36,32 @@ class newConfigManagement extends plugin
         $items['root']['name'] = '/';
         $items['root']['description'] = _('Root');
 
+        // Define distribution paramters.
+        $dOpt1 = array('description' => _('Name'), 'default' => '', 'value' => '', 'required' => true,
+                'type' => 'string', 'display' => _('Name'));
+        $dOpt2 = array('description' => _('Distribution type'), 'default' => 'deb', 'value' => 'deb', 'required' => true,
+                'type' => 'combobox', 'display' => _('Distribution type'), 'values' => array("deb" => 'deb', "rpm" => 'rpm'));
+        $dOpt3 = array('description' => _('Mirror Url'), 'default' => '', 'value' => '', 'required' => false,
+                'type' => 'string', 'display' => _('Mirror Url'));
+        $dOpt4 = array('description' => _('Method'), 'default' => 'puppet', 'value' => 'puppet', 'required' => false,
+                'type' => 'combobox', 'display' => _('Installation method'), 'values'=>array('puppet'=>_('Puppet')));
+
+        // Define release parameters
+        $rOpt1 = array('description' => _('Name'), 'default' => '', 'value' => '', 'required' => true,
+                'type' => 'string', 'display' => _('Name'));
+
         $items['Distribution']['container'] = array('Release');
         $items['Distribution']['name'] = 'Distribution';
         $items['Distribution']['description'] = _('Distribution');
-        $items['Distribution']['options']['name']['description'] = _("Name");
-        $items['Distribution']['options']['name']['default'] = "";
-        $items['Distribution']['options']['name']['value'] = "";
-        $items['Distribution']['options']['name']['required'] = true;
-        $items['Distribution']['options']['name']['type'] = 'string';
-        $items['Distribution']['options']['name']['display'] = _('Name');
-        $items['Distribution']['options']['installation_method']['description'] = _("Distribution type");
-        $items['Distribution']['options']['installation_method']['default'] = "deb";
-        $items['Distribution']['options']['installation_method']['value'] = "deb";
-        $items['Distribution']['options']['installation_method']['values'] = array("deb" => 'deb', "rpm" => 'rpm');
-        $items['Distribution']['options']['installation_method']['required'] = true;
-        $items['Distribution']['options']['installation_method']['type'] = 'combobox';
-        $items['Distribution']['options']['installation_method']['display'] = _('Distribution type');
+        $items['Distribution']['options']['name'] = $dOpt1;
+        $items['Distribution']['options']['mirror'] = $dOpt3;
+        $items['Distribution']['options']['installation_type'] = $dOpt2;
+        $items['Distribution']['options']['installation_method'] = $dOpt4;
 
         $items['Release']['container'] = array('Release', '__CFG_ITEMS__');
         $items['Release']['name'] = 'Release';
         $items['Release']['description'] = _('Release');
-        $items['Release']['options']['name']['description'] = _("Name");
-        $items['Release']['options']['name']['default'] = "";
-        $items['Release']['options']['name']['value'] = "";
-        $items['Release']['options']['name']['required'] = true;
-        $items['Release']['options']['name']['type'] = 'string';
-        $items['Release']['options']['name']['display'] = _('Name');
+        $items['Release']['options']['name'] = $rOpt1;
 
         $this->installationMethods = array();
         $this->installationMethods['root']['description'] = _('root');
@@ -152,10 +152,32 @@ class newConfigManagement extends plugin
         }else{
             foreach($res as $dist){
                 $this->dataModel->addItem('Distribution','/root', $dist['name'], $dist);
+
                 if(isset($dist['releases'])){
-                    foreach($dist['releases'] as $release){
+
+                    // Sort releases by name length
+                    $sort = array();
+                    foreach($dist['releases'] as $id => $release){
+                        $sort[strlen($release['name']) . $release['name']]  = $id;
+                    }
+                    uksort($sort, "strnatcasecmp");   
+
+                    // Append release tags
+                    foreach($sort as $id){
+                        $release = $dist['releases'][$id];
+                        $names = preg_split("/\//", $release['name']);
+    
+                        $rPath = "";
                         $distPath = "/root/{$dist['name']}";
-                        $this->dataModel->addItem('Release',$distPath, $release['name'], $release);
+                        foreach($names as $rName){
+                            $rPath .= '/'.$rName;
+                            
+                            
+                            $this->dataModel->addItem('Release',$distPath, $rName, $release);
+    
+                            print_a(array('Release',$distPath, $rName, $release));
+                            $distPath .= $rPath;
+                        }
                     }
                 }
             }
@@ -212,6 +234,8 @@ class newConfigManagement extends plugin
                 if(!$rpc->success()){
                     msg_dialog::display(_("Error"),sprintf(_("Failed to load distributions: %s"),$rpc->get_error()),ERROR_DIALOG);
                 }else{
+            
+                    if(!$res) return;
 
                     // Sort entries by path length 
                     $sLen = array();
index b936c01873a8f827add18a625824fabc625ea158..de539865be6876ab21b7d2522e3d9aada31ef6e6 100644 (file)
@@ -4,10 +4,18 @@
         <td>{$nameName}</td>
         <td>{$name}</td>
     </tr>
+    <tr>
+        <td>{$installation_typeName}</td>
+        <td>{$installation_type}</td>
+    </tr>
     <tr>
         <td>{$installation_methodName}</td>
         <td>{$installation_method}</td>
     </tr>
+    <tr>
+        <td>{$mirrorName}</td>
+        <td>{$mirror}</td>
+    </tr>
 </table>
 {else if $type == 'Release'}
 <table>