From: hickert Date: Fri, 10 Aug 2007 13:44:04 +0000 (+0000) Subject: Updated dhcp client side. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=57a4d4fe5cecf41bf500bd13e27990c3fea16297;p=gosa.git Updated dhcp client side. IP address and hostname will be inherited from parent object. Input fields are grey out git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7040 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_dhcpHost.inc b/plugins/admin/systems/class_dhcpHost.inc index 36d833176..2bca1bba7 100644 --- a/plugins/admin/systems/class_dhcpHost.inc +++ b/plugins/admin/systems/class_dhcpHost.inc @@ -22,11 +22,12 @@ class dhcpHost extends dhcpPlugin { /* Used attributes */ var $dhcpHWAddress= ""; - + var $realGosaHost = FALSE; + /* attribute list for save action */ var $objectclasses= array("top", "dhcpHost"); - function dhcpHost($attrs) + function dhcpHost($attrs,$host_exists_in_gosa = FALSE) { dhcpPlugin::dhcpPlugin($attrs); @@ -37,6 +38,8 @@ class dhcpHost extends dhcpPlugin $this->advanced->setAutoOptions(array("host-name")); $this->advanced->setAutoStatements(array("fixed-address")); + + $this->realGosaHost = $host_exists_in_gosa; } function execute() @@ -44,6 +47,7 @@ class dhcpHost extends dhcpPlugin $smarty= get_smarty(); $smarty->assign("cn", $this->cn); $smarty->assign("dhcpHWAddress", preg_replace('/^[^ ]+ /', '', $this->dhcpHWAddress)); + $smarty->assign("realGosaHost",$this->realGosaHost); /* Create fixed address */ if (isset($this->statements['fixed-address'])){ @@ -96,10 +100,13 @@ class dhcpHost extends dhcpPlugin /* Assemble hwAddress */ $this->dhcpHWAddress= get_post('hwtype')." ".get_post('dhcpHWAddress'); - $this->cn= validate(get_post('cn')); + + if(!$this->realGosaHost){ + $this->cn= validate(get_post('cn')); + } /* Save fixed address */ - if ($_POST['fixedaddr'] != ""){ + if (!$this->realGosaHost && $_POST['fixedaddr'] != ""){ $this->statements['fixed-address']= get_post('fixedaddr'); } else { unset ($this->statements['fixed-address']); diff --git a/plugins/admin/systems/class_termDNS.inc b/plugins/admin/systems/class_termDNS.inc index 6c25b978a..8ee236d18 100644 --- a/plugins/admin/systems/class_termDNS.inc +++ b/plugins/admin/systems/class_termDNS.inc @@ -205,11 +205,14 @@ class termDNS extends plugin if(isset($_POST['dhcpEditOptions'])){ if(count($this->dhcpHostEntry) == 0){ - $this->dialog = new dhcpHost($this->dhcpParentNode); + $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE); }else{ - $this->dialog = new dhcpHost($this->dhcpHostEntry); + $this->dialog = new dhcpHost($this->dhcpHostEntry,TRUE); + } + $this->dialog->cn = $this->cn; + if(!empty($this->ipHostNumber)){ + $this->dialog->statements['fixed-address'] = $this->ipHostNumber; } - } if(isset($_POST['cancel_dhcp'])){ @@ -559,6 +562,7 @@ class termDNS extends plugin if($this->initial_dhcpParentNode != $this->dhcpParentNode){ $attrs = $this->dhcpHostEntry; unset($attrs['dn']); + unset($attrs['MODIFIED']); $ldap->cd("cn=".$this->cn.",".$this->dhcpParentNode); $res = $ldap->add($attrs); show_ldap_error($ldap->get_error(),_("Tried to add new dhcp entry failed.")); diff --git a/plugins/admin/systems/dhcp_host.tpl b/plugins/admin/systems/dhcp_host.tpl index 31c271738..1c8d4d634 100644 --- a/plugins/admin/systems/dhcp_host.tpl +++ b/plugins/admin/systems/dhcp_host.tpl @@ -7,14 +7,15 @@ {t}Name{/t}{$must} - {t}Fixed address{/t} -