Code

Added listing for ntp servers
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 29 Sep 2010 14:04:43 +0000 (14:04 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 29 Sep 2010 14:04:43 +0000 (14:04 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19853 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl
gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc

index e4693688e852c2889f8f8588a3d2a9a3ea134e7f..868d27971f4a121d872ab5ae42862cbff5764ce1 100644 (file)
                         <LABEL for="kickstartTimeUTC">{t}Use UTC{/t}</LABEL>
                     </td>
                 </tr>
-                <tr>
-                    <td><LABEL for="kickstartNTPServer">{t}NTP server{/t}</LABEL></td>
-                    <td>
-                        <input type='text' name="kickstartNTPServer" id="kickstartNTPServer" value="{$kickstartNTPServer}">
-                    </td>
-                </tr>
                 <tr>
                     <td><LABEL for="kickstartTimezone">{t}Timezone{/t}</LABEL></td>
                     <td>
                         </select>
                     </td>
                 </tr>
+                <tr>    
+                    <td colspan=2>
+                        {t}NTP server{/t}
+                        {$kickstartNTPServerList}
+                        <input type='text' name="kickstartNTPServer_Input">
+                        <button name='kickstartNTPServer_Add'>{msgPool type=addButton}</button>
+                    </td>
+                </tr>
             </table>
         </td>
     </tr>
index 40cdc4289decd61a703c250836ec05eefe0737a2..9d98c360116f65ff9c176bea75a3e88cbf4f77f9 100644 (file)
@@ -7,7 +7,7 @@ class InstallRecipe extends plugin
     public $kickstartSystemLocale = "";
     public $kickstartTimezone = "";
     public $kickstartTimeUTC = "";
-    public $kickstartNTPServer = "";
+    public $kickstartNTPServer = array();
     public $kickstartMirrorDN = "";
     public $kickstartRootEnabled = "";
     public $kickstartRootPasswordHash = "";
@@ -21,6 +21,8 @@ class InstallRecipe extends plugin
 
     public $setKickstartRootPasswordHash = FALSE;
 
+    private $kickstartNTPServerList = NULL;
+
     function __construct(&$config, $dn)
     {
         plugin::plugin($config, $dn);
@@ -54,6 +56,24 @@ class InstallRecipe extends plugin
             $this->hashes[$name] = $name;
         }
         $this->hash = $this->config->get_cfg_value("core","passwordDefaultHash"); 
+
+        // Get list of NTP servers
+        $this->kickstartNTPServer = array();
+        if(isset($this->attrs['kickstartNTPServer']['count'])){
+            for($i = 0; $i < $this->attrs['kickstartNTPServer']['count']; $i++){
+                $this->kickstartNTPServer[] = $this->attrs['kickstartNTPServer'][$i];
+            }
+        }
+
+        // Prepare NTP servers list 
+        $this->kickstartNTPServerList= new sortableListing($this->kickstartNTPServer);
+        $this->kickstartNTPServerList->setDeleteable(true);
+        $this->kickstartNTPServerList->setEditable(false);
+        $this->kickstartNTPServerList->setColspecs(array('*'));
+        $this->kickstartNTPServerList->setWidth("100%");
+        $this->kickstartNTPServerList->setHeight("70px");
+
+
     }
 
     function execute()
@@ -68,10 +88,13 @@ class InstallRecipe extends plugin
             return($smarty->fetch(get_template_path('goto/Device/SetPassword.tpl', TRUE)));
         }
 
+        $this->kickstartNTPServerList->setAcl($this->getacl('kickstartNTPServer'));
+        $this->kickstartNTPServerList->update();
 
         plugin::execute();    
         $smarty = get_smarty();
         $smarty->assign('timezones', $this->timezones);
+        $smarty->assign('kickstartNTPServerList', $this->kickstartNTPServerList->render());
         foreach($this->attributes as $attr){
             $smarty->assign($attr, $this->$attr);
         }
@@ -91,6 +114,16 @@ class InstallRecipe extends plugin
             if(isset($_POST['setKickstartRootPasswordHash'])){
                 $this->setKickstartRootPasswordHash = true;
             }
+
+            $this->kickstartNTPServerList->save_object();
+            $this->kickstartNTPServer = $this->kickstartNTPServerList->getMaintainedData();
+            if(isset($_POST['kickstartNTPServer_Input']) && isset($_POST['kickstartNTPServer_Add'])){
+                $add = get_post('kickstartNTPServer_Input');
+                if(!in_array($add, $this->kickstartNTPServer) && !empty($add)){
+                    $this->kickstartNTPServer[] = $add;
+                }
+            }
+            $this->kickstartNTPServerList->setListData($this->kickstartNTPServer);
         }
         if(isset($_POST['cancelPassword'])) $this->setKickstartRootPasswordHash =false;
         if(isset($_POST['setPassword'])) {