summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7951885)
raw | patch | inline | side by side (parent: 7951885)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 28 Apr 2006 04:19:13 +0000 (04:19 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 28 Apr 2006 04:19:13 +0000 (04:19 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3151 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/systems/class_workstationGeneric.inc | patch | blob | history | |
plugins/admin/systems/workstation.tpl | patch | blob | history |
diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc
index 02374a3db10e5e1b3e2fda3cbfb5849035d6af66..cd714dea21497752554b28944c89ce00f7ec7890 100644 (file)
/* Generic terminal attributes */
var $gotoMode= "locked";
var $gotoSyslogServer= "";
- var $gotoNtpServer= "";
+ var $gotoNtpServer= array();
+ var $gotoNtpServers= array();
var $gotoSndModule= "";
var $gotoFloppyEnable= "";
var $gotoCdromEnable= "";
var $netConfigDNS;
+ var $inheritTimeServer = true;
+
/* attribute list for save action */
var $ignore_account= TRUE;
var $attributes= array("gotoMode", "gotoSyslogServer", "gotoNtpServer",
}
}
+ /* Create used ntp server array */
+ $this->gotoNtpServer= array();
+ if(isset($this->attrs['gotoNtpServer'])){
+ $this->inheritTimeServer = false;
+ unset($this->attrs['gotoNtpServer']['count']);
+ foreach($this->attrs['gotoNtpServer'] as $server){
+ $this->gotoNtpServer[$server] = $server;
+ }
+ }
+
+ /* Set inherit checkbox state */
+ if(in_array("default",$this->gotoNtpServer)){
+ $this->inheritTimeServer = true;
+ $this->gotoNtpServer=array();
+ }
+
+ /* Create available ntp options */
+ $this->gotoNtpServers = $this->config->data['SERVERS']['NTP'];
+ foreach($this->gotoNtpServers as $key => $server){
+ if($server == "default"){
+ unset($this->gotoNtpServers[$key]);
+ }
+ }
+
$this->modes["active"]= _("Activated");
$this->modes["locked"]= _("Locked");
$this->modes["memcheck"]= _("Memory test");
$this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
}
- /* Workaround for not single-value attribute gotoNtpServer */
- if (isset($this->attrs['gotoNtpServer'][0])){
- $this->gotoNtpServer= $this->attrs['gotoNtpServer'][0];
- }
-
/* Save 'dn' for later referal */
$this->orig_dn= $this->dn;
}
}
}
+ /* Add new ntp Server to our list */
+ if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers']))){
+ $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
+ }
+
+ /* Delete selected NtpServer for list of used servers */
+ if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected']))){
+ foreach($_POST['gotoNtpServerSelected'] as $name){
+ unset($this->gotoNtpServer[$name]);
+ }
+ }
+
/* Fill templating stuff */
$smarty= get_smarty();
$smarty->assign("cn", $this->cn);
$smarty->assign("l", $this->l);
$smarty->assign("bases", $this->config->idepartments);
$smarty->assign("staticAddress", "");
+ $smarty->assign("gotoNtpServers",$this->gotoNtpServers);
/* Check if workstation is online */
$query= "fping -q -r 1 -t 500 ".$this->cn;
}
$smarty->assign("actionACL", chkacl($this->acl, 'action'));
+ /* tell smarty the inherit checkbox state */
+ $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
+
/* Show main page */
$smarty->assign("netconfig", $this->netConfigDNS->execute());
return($smarty->fetch (get_template_path('workstation.tpl', TRUE)));
$this->base= $_POST['base'];
}
$this->netConfigDNS->save_object();
+
+ /* Set inherit mode */
+ if(isset($_POST['workgeneric_posted'])){
+ if(isset($_POST["inheritTimeServer"])){
+ $this->inheritTimeServer = true;
+ }else{
+ $this->inheritTimeServer = false;
+ }
+ }
+
}
}
}
}
+
+ /* Check for valid ntpServer selection */
+ if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
+ $message[]= _("There must be at least one NTP server selected, or the inherit mode activated.");
+ }
return ($message);
}
$this->attrs= $attrs;
}
+ /* Update ntp server settings */
+ if($this->inheritTimeServer){
+ $this->attrs['gotoNtpServer'] = "default";
+ }else{
+ /* Set ntpServers */
+ $this->attrs['gotoNtpServer'] = array();
+ foreach($this->gotoNtpServer as $server){
+ $this->attrs['gotoNtpServer'][] = $server;
+ }
+ }
+
/* Write back to ldap */
$ldap= $this->config->get_ldap_link();
if ($this->orig_dn == 'new'){
index d6ea1c5395d208e417726de7c4b3252637bf8470..27f3c00b112c3167616f5408afbb181133c8d6a9 100644 (file)
<table summary="" style="width:100%;">
<tr>
<td style="width:50%; vertical-align:top;">
-
<table summary="">
<tr>
{if $cn eq 'wdefault'}
<input name="l" id="l" size=18 maxlength=60 value="{$l}">
</td>
</tr>
- <tr>
- <td colspan=2> </td>
- </tr>
- <tr>
- <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
- <td>
- <select size="1" id="base" name="base" title="{t}Choose subtree to place terminal in{/t}">
- {html_options options=$bases selected=$base_select}
- </select>
- <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
- </tr>
</table>
-
</td>
-
- <td rowspan=2 style="border-left:1px solid #A0A0A0">
-
- </td>
-
- <td style="vertical-align:top;">
-
+ <td style="vertical-align:top;border-left:1px solid #A0A0A0;">
<table summary="">
<tr>
<td>{t}Mode{/t}</td>
</select>
</td>
</tr>
- <tr><td colspan=2><div style="height:15px;"></div></td></tr>
<tr>
<td><LABEL for="gotoSyslogServer">{t}Syslog server{/t}</LABEL></td>
<td>
</select>
</td>
</tr>
+ </table>
+ </td>
+ </tr>
+</table>
+<p class="seperator"> </p>
+<table summary="" style="width:100%;">
+ <tr>
+ <td style="width:50%; vertical-align:top;">
+ <table width="100%">
<tr>
- <td><LABEL for="gotoNtpServer">{t}NTP server{/t}</LABEL></td>
+ <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
<td>
- <select id="gotoNtpServer" name="gotoNtpServer" title="{t}Choose server to use for synchronizing time{/t}" {$gotoNtpServerACL}>
- {html_options values=$ntpservers output=$ntpservers selected=$gotoNtpServer_select}
+ <select size="1" id="base" name="base" title="{t}Choose subtree to place terminal in{/t}">
+ {html_options options=$bases selected=$base_select}
+ </select>
+ <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+ </tr>
+ </table>
+ </td>
+ <td style="vertical-align:top;border-left:1px solid #A0A0A0;">
+ <table width="100%">
+ <tr>
+ <td colspan="2">
+ <input type="checkbox" value="1" name="inheritTimeServer"
+ {if $inheritTimeServer } checked {/if}
+ onClick="javascript:
+ changeState('gotoNtpServerSelected');
+ changeState('gotoNtpServers');
+ changeState('addNtpServer');
+ changeState('delNtpServer');">{t}Inherit time server attributes{/t}
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" style='padding-left:14px;padding-top:5px;'><LABEL for="gotoNtpServerSelected">{t}NTP server{/t}</LABEL><br>
+ <select name="gotoNtpServerSelected[]" id="gotoNtpServerSelected" multiple size=5 style="width:100%;"
+ title="{t}Choose server to use for synchronizing time{/t}" {$gotoNtpServerACL} {if $inheritTimeServer} disabled {/if}>
+ {html_options options=$gotoNtpServer_select}
</select>
+ <br>
+ <select name="gotoNtpServers" id="gotoNtpServers" {$gotoNtpServerACL} {if $inheritTimeServer} disabled {/if} >
+ {html_options output=$gotoNtpServers values=$gotoNtpServers}
+ </select>
+ <input type="submit" name="addNtpServer" value="{t}Add{/t}" id="addNtpServer" {$gotoNtpServerACL}
+ {if $inheritTimeServer} disabled {/if}>
+ <input type="submit" name="delNtpServer" value="{t}Delete{/t}" id="delNtpServer" {$gotoNtpServerACL}
+ {if $inheritTimeServer} disabled {/if}>
</td>
</tr>
</table>
</td>
</tr>
</table>
-
+<input type="hidden" name="workgeneric_posted" value="1">
{if $cn eq 'wdefault'}
<!-- Place cursor -->
<script language="JavaScript" type="text/javascript">