From: hickert Date: Wed, 29 Sep 2010 14:04:43 +0000 (+0000) Subject: Added listing for ntp servers X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1fe1fa0ab8ae364f14a53ac93661fffa6e3a99e0;p=gosa.git Added listing for ntp servers git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19853 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl b/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl index e4693688e..868d27971 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl +++ b/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl @@ -78,12 +78,6 @@ - - - - - - @@ -92,6 +86,14 @@ + + + {t}NTP server{/t} + {$kickstartNTPServerList} + + + + 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 40cdc4289..9d98c3601 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc @@ -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'])) {