summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 75a61c6)
raw | patch | inline | side by side (parent: 75a61c6)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 10 Aug 2007 12:05:54 +0000 (12:05 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 10 Aug 2007 12:05:54 +0000 (12:05 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7037 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/systems/class_termDNS.inc | patch | blob | history | |
plugins/admin/systems/network.tpl | patch | blob | history |
index a587f6cb76803cd68027270aa9363d24e285c809..6c25b978a5b0be4128fbc82eb694ae62876dd122 100644 (file)
var $dhcpHostEntry = array();
var $initial_dhcpParentNode = "";
var $initial_dhcpHostEntry = array();
+ var $initial_dhcp_is_Account = FALSE;
/* DNS attributes
$this->dhcpParentNode = $this->get_dhcp_parent_node();
if($this->dhcpParentNode){
$this->dhcp_is_Account = TRUE;
+ $this->initial_dhcp_is_Account = TRUE;
$this->dhcpHostEntry = $this->get_dhcp_host_entry();
}
$this->initial_dhcpHostEntry = $this->dhcpHostEntry;
**********/
if(isset($_POST['dhcpEditOptions'])){
- $this->dialog = new dhcpHost($this->dhcpHostEntry);
+
+ if(count($this->dhcpHostEntry) == 0){
+ $this->dialog = new dhcpHost($this->dhcpParentNode);
+ }else{
+ $this->dialog = new dhcpHost($this->dhcpHostEntry);
+ }
+
}
if(isset($_POST['cancel_dhcp'])){
}
if(isset($_POST['save_dhcp'])){
- $this->dialog = FALSE;
+ $this->dialog->save_object();
+
+ $msgs = $this->dialog->check(array());
+ if(count($msgs)){
+ foreach($msgs as $msg){
+ print_red($msg);
+ }
+ }else{
+ $this->dhcpHostEntry = $this->dialog->save();
+ $this->dialog = FALSE;
+ }
}
if(isset($this->dialog) && $this->dialog != FALSE){
+ $this->dialog->save_object();
return($this->dialog->execute());
}
/* Handle DHCP Posts*/
if($this->dhcpEnabled && isset($_POST['network_tpl_posted'])){
- if(isset($_POST['dhcp_is_Account'])){
- $this->dhcp_is_Account = TRUE;
- }else{
- $this->dhcp_is_Account = FALSE;
- }
foreach($this->dhcpAttributes as $attr){
if(isset($_POST[$attr])){
$this->$attr = $_POST[$attr];
}
}
+ if(isset($_POST['dhcp_is_Account'])){
+ $this->dhcp_is_Account = TRUE;
+ }else{
+ $this->dhcp_is_Account = FALSE;
+ }
}
/* Call common method to give check the hook */
$message= plugin::check();
+ if($this->dhcpEnabled && $this->dhcpParentNode != "" && count($this->dhcpHostEntry) == 0){
+ $message[] =_("You haven not configured your dhcp settings yet.");
+ }
+
/* Check if ip must be given
*/
if(($this->IPisMust)||($this->DNS_is_account)){
$this->cleanup();
$ldap->modify ($this->attrs);
+ /****************/
+ /* DHCP HANDLING */
+ /****************/
+
+ /* New entry */
+ if($this->dhcpEnabled){
+
+ /* Unset dhcpStatements if this attribute is empty */
+ if(isset($this->dhcpHostEntry['dhcpStatements']) &&
+ ($this->dhcpHostEntry['dhcpStatements'] == "" || count($this->dhcpHostEntry['dhcpStatements']) == 0) ){
+ unset($this->dhcpHostEntry['dhcpStatements']);
+ }
+
+ /* DHCP removed */
+ if($this->initial_dhcp_is_Account && !$this->dhcp_is_Account){
+ $ldap->rmdir_recursive($this->dhcpHostEntry['dn']);
+ show_ldap_error($ldap->get_error(),_("Removing dhcp entry for this object failed."));
+ }
+
+ /* DHCP Added */
+ if(!$this->initial_dhcp_is_Account && $this->dhcp_is_Account){
+ $attrs = $this->dhcpHostEntry;
+ unset($attrs['MODIFIED']);
+ unset($attrs['dn']);
+ $ldap->cd("cn=".$this->cn.",".$this->dhcpParentNode);
+ $res = $ldap->add($attrs);
+ show_ldap_error($ldap->get_error(),_("Tried to add new dhcp entry failed."));
+ }
+
+ /* DHCP still activated */
+ if($this->initial_dhcp_is_Account && $this->dhcp_is_Account){
+
+ /* DHCP node changed */
+ if($this->initial_dhcpParentNode != $this->dhcpParentNode){
+ $attrs = $this->dhcpHostEntry;
+ unset($attrs['dn']);
+ $ldap->cd("cn=".$this->cn.",".$this->dhcpParentNode);
+ $res = $ldap->add($attrs);
+ show_ldap_error($ldap->get_error(),_("Tried to add new dhcp entry failed."));
+ if($res){
+ $ldap->rmdir_recursive($this->dhcpHostEntry['dn']);
+ show_ldap_error($ldap->get_error(),_("Removing old dhcp entry failed."));
+ }
+ }
+
+ /* SAME node but modified */
+ if(isset($this->dhcpHostEntry['MODIFIED']) && $this->dhcpHostEntry['MODIFIED'] == 1 &&
+ $this->initial_dhcpParentNode == $this->dhcpParentNode){
+ $attrs = $this->dhcpHostEntry;
+ unset($attrs['dn']);
+ unset($attrs['MODIFIED']);
+ $ldap->cd($this->dhcpHostEntry['dn']);
+ $ldap->modify($attrs);
+ show_ldap_error($ldap->get_error(),_("Modifying dhcp entry failed."));
+ }
+ }
+ }
+
+
/****************/
/* DNS HANDLING */
/****************/
index ef8e9d1746ae90fff2d41e5f006bc9503738ceaa..0065f799589b5e5367ccbc0fbb3d8cbad7a6fc74 100644 (file)
<td>
<input name="macAddress" id="macAddress" size=25 maxlength=80 value="{$macAddress}" {$macAddressACL}>
{if $autonet==true}
- <input type="submit" name="autonet" value="{t}-><-{/t}"
+ <input type="submit" name="autonet" value="{t}Autodetect{/t}"
{if ($ipHostNumberACL !="" || $macAddressACL!= "")} disabled {/if}>
{/if}
</td>
<table>
<tr>
<td>
- <input {if $dhcp_is_Account} checked {/if} type='checkbox' name='dhcp_is_Account' class='center'>
+ <input onClick='document.mainform.submit();'
+ {if $dhcp_is_Account} checked {/if} type='checkbox' name='dhcp_is_Account' class='center'>
{t}Enable DHCP for this device{/t}
+ <input type='submit' value='reload'>
</td>
</tr>
{if $dhcp_is_Account}