From: hickert Date: Fri, 18 Sep 2009 07:26:18 +0000 (+0000) Subject: Added DHCP options to opsi hosts. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=efe41516ed9c54f6269c85fb126e3372b92ae1b2;p=gosa.git Added DHCP options to opsi hosts. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14286 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc b/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc index 6aec6c21a..52c4ed89f 100644 --- a/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc +++ b/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc @@ -79,31 +79,6 @@ class opsiGeneric extends plugin /* Try to plugin */ $this->init(); - - // Now fake a valid ldap entry ... this is necessary to avoid - // modifications in the dns/dhcp classes - - // First fake cn - $this->attrs['hostId'][0] = $this->hostId; - $this->attrs['cn'][0] = $this->hostId; - - // Second detect DNS settings. - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $strippedHostId = preg_replace("/\..*$/","",$this->hostId); - $ldap->search("(&(objectClass=dNSZone)(|(relativeDomainName=".$this->hostId.")(relativeDomainName=".$strippedHostId."))(aRecord=*))",array("aRecord")); - if($ldap->count()){ - $attrs = $ldap->fetch(); - $this->attrs['ipHostNumber']['count'] = 0; - $this->attrs['ipHostNumber'][0] = $attrs['aRecord'][0]; - } - - // Initialize DHCP and DNS - $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses, FALSE, "hostId"); - $this->netConfigDNS->set_acl_category("opsi"); - $this->netConfigDNS->set_acl_base($this->config->current['BASE']); - $this->netConfigDNS->IPisMust = FALSE; - $this->netConfigDNS->MACisMust = FALSE; } @@ -222,6 +197,34 @@ class opsiGeneric extends plugin if(empty($this->s_selectedNetbootProduct)){ $this->s_selectedNetbootProduct = key($this->a_availableNetbootProducts); } + + // Now fake a valid ldap entry ... this is necessary to avoid + // modifications in the dns/dhcp classes + + // First fake cn + $this->attrs['hostId'][0] = $this->hostId; + $this->attrs['cn'][0] = $this->hostId; + + // Second detect DNS settings. + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $strippedHostId = preg_replace("/\..*$/","",$this->hostId); + $ldap->search("(&(objectClass=dNSZone)(|(relativeDomainName=".$this->hostId.")(relativeDomainName=".$strippedHostId."))(aRecord=*))",array("aRecord")); + if($ldap->count()){ + $attrs = $ldap->fetch(); + $this->attrs['ipHostNumber']['count'] = 0; + $this->attrs['ipHostNumber'][0] = $attrs['aRecord'][0]; + } + + $this->attrs['macAddress']['count'] = 1; + $this->attrs['macAddress'][0] = &$this->mac; + + // Initialize DHCP and DNS + $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses, FALSE, "hostId"); + $this->netConfigDNS->set_acl_category("opsi"); + $this->netConfigDNS->set_acl_base($this->config->current['BASE']); + $this->netConfigDNS->IPisMust = FALSE; + $this->netConfigDNS->MACisMust = FALSE; } } @@ -617,7 +620,8 @@ class opsiGeneric extends plugin plugin::save_object(); $this->netConfigDNS->save_object(); - + $this->mac = $this->netConfigDNS->macAddress; + /* Get hostId */ if(isset($_POST['hostId']) && $this->standalone && $this->acl_is_writeable("hostId")){ diff --git a/gosa-plugins/opsi/admin/opsi/generic.tpl b/gosa-plugins/opsi/admin/opsi/generic.tpl index 1a40e95ad..7ecf8c37e 100644 --- a/gosa-plugins/opsi/admin/opsi/generic.tpl +++ b/gosa-plugins/opsi/admin/opsi/generic.tpl @@ -22,14 +22,16 @@ {/render} + {else} {t}Name{/t} @@ -39,6 +41,7 @@ {/render} + {/if} {t}Netboot product{/t}