Code

Added DHCP options to opsi hosts.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 18 Sep 2009 07:26:18 +0000 (07:26 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 18 Sep 2009 07:26:18 +0000 (07:26 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14286 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc
gosa-plugins/opsi/admin/opsi/generic.tpl

index 6aec6c21a421b1de0c3fedd4b3a55ee6c411dfe9..52c4ed89f2433ec20f802e8168c7e04cb5126c59 100644 (file)
@@ -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")){
index 1a40e95ad4c6883bb68a6c91ddcc452e65012570..7ecf8c37e1d1cfd78ce27e56cd44253fb8a2d901 100644 (file)
 {/render}
         </td>
     </tr>
+<!--
     <tr>
      <td>{t}MAC address{/t}{$must}</td>
      <td>
 {render acl=$macACL}
-               <input type='text' name="mac" value="{$mac}">
+               <input type='text' name="dummy" value="{$mac}" disabled>
 {/render}
         </td>
        </tr>
+-->
        {else}
     <tr>
      <td>{t}Name{/t}</td>
@@ -39,6 +41,7 @@
 {/render}
         </td>
     </tr>
+<!--
     <tr>
      <td>{t}MAC address{/t}{$must}</td>
      <td>
@@ -47,6 +50,7 @@
 {/render}
         </td>
     </tr>
+-->
     {/if}
     <tr>
      <td>{t}Netboot product{/t}</td>