Code

Updated dns and dhcp integration
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 29 Aug 2007 09:00:07 +0000 (09:00 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 29 Aug 2007 09:00:07 +0000 (09:00 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7162 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_servDNSeditZoneEntries.inc.rej [deleted file]
plugins/admin/systems/class_termDNS.inc
plugins/admin/systems/network.tpl

diff --git a/plugins/admin/systems/class_servDNSeditZoneEntries.inc.rej b/plugins/admin/systems/class_servDNSeditZoneEntries.inc.rej
deleted file mode 100644 (file)
index 191a87c..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-***************
-*** 24,29 ****
-      /* Initialise class
-       */
-      $this->RecordTypes  = getDnsRecordTypes();
-      $this->dn           = "zoneName=".getNameFromMix($zoneObject['InitialzoneName']).",".$dn; 
-      $this->zoneName     = $zoneObject['InitialzoneName'];
-      $this->reverseName  = $zoneObject['InitialReverseZone'];
---- 24,35 ----
-      /* Initialise class
-       */
-      $this->RecordTypes  = getDnsRecordTypes();
-+ 
-+     /* Remove nSRecord from listed types */
-+     if(isset($this->RecordTypes['nSRecord'])){
-+       unset($this->RecordTypes['nSRecord']);
-+     }
-+ 
-      $this->dn           = "zoneName=".getNameFromMix($zoneObject['InitialzoneName']).",".$dn; 
-      $this->zoneName     = $zoneObject['InitialzoneName'];
-      $this->reverseName  = $zoneObject['InitialReverseZone'];
index f12666aa6b269b24b783d5832297070b543769c5..721287f045fa66a8664871a7f0f351ae1fd1871e 100644 (file)
@@ -17,6 +17,20 @@ class termDNS extends plugin
   var $OrigCn         = "";    // Initial cn
   var $IPisMust       = false;
   var $MACisMust      = false;
+  var $dialog;
+
+  /* DCHP Attributes 
+   */
+  var $dhcpAttributes           = array("dhcpParentNode");
+  var $dhcpEnabled              = FALSE;
+  var $dhcp_is_Account          = FALSE;
+  var $dhcpParentNodes          = array();
+  var $dhcpParentNode           = "";
+  var $dhcpHostEntry            = array();
+  var $initial_dhcpParentNode   = "";
+  var $initial_dhcpHostEntry    = array();
+  var $initial_dhcp_is_Account  = FALSE;
+
 
   /* DNS attributes  
    */
@@ -42,12 +56,46 @@ class termDNS extends plugin
       $this->OrigCn = preg_replace("/\\\$\$/","",$this->attrs['cn'][0]);
       $this->cn = preg_replace("/\\\$\$/","",$this->attrs['cn'][0]);
     }
-  
+
+    /************
+     * DHCP 
+     ************/
+
+    /* Hide all dhcp specific code, if dhcp plugin is not present in config */
+    $dhcpEnabled = FALSE;
+    foreach($this->config->data['TABS']['SERVTABS'] as $tab){
+      if(preg_match("/^servdhcp$/",$tab['CLASS'])){
+        $this->dhcpEnabled = TRUE;
+      }
+    }
+    if($this->dhcpEnabled){
+      $this->dhcpParentNodes = $this->get_dhcp_parent_nodes();
+      $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;
+      $this->initial_dhcpParentNode= $this->dhcpParentNode;
+    }
+
+
+    /************
+     * Autonetwork hook 
+     ************/
     /* Do we have autonet support? */
     if (isset($this->config->data['MAIN']['AUTO_NETWORK_HOOK'])){
       $this->autonet= true;
     }
 
+
+    /************
+     * DNS
+     ************/
     /* Hide all dns specific code, if dns is not available 
      */
     $DNSenabled = false;
@@ -73,10 +121,14 @@ class termDNS extends plugin
 
       /* Remove A record which equals $this->ipHostNumber
        */
+      $ptr = $this->get_pTRRecord();
       foreach($this->dnsEntry['RECORDS'] as $key => $rec){
         if(($rec['type'] == "aRecord") && ($rec['value'] == $this->ipHostNumber)){
           unset($this->dnsEntry['RECORDS'][$key]);
         }
+        if(($rec['type'] == "pTRRecord") && ($rec['value'] == $ptr)){
+          unset($this->dnsEntry['RECORDS'][$key]);
+        }
       }
 
       /* Get Record types 
@@ -157,102 +209,135 @@ class termDNS extends plugin
       }
     }
 
-    /* There is no dns available 
+    
+  
+    /**********
+     * DHCP Handling
+     **********/
+    if(isset($_POST['dhcpEditOptions'])){
+
+      if(count($this->dhcpHostEntry) == 0){
+        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
+      }else{
+        $this->dialog = new dhcpHost($this->dhcpHostEntry,TRUE);
+      }
+      $this->dialog->cn = $this->cn; 
+      $this->dialog->dhcpHWAddress = $this->macAddress; 
+      if(!empty($this->ipHostNumber)){
+        $this->dialog->statements['fixed-address'] = $this->ipHostNumber; 
+      }
+    }
+
+    if(isset($_POST['cancel_dhcp'])){
+      $this->dialog = FALSE; 
+    }
+
+    if(isset($_POST['save_dhcp'])){
+      $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());
+    }
+    $smarty->assign("dhcpEnabled",    $this->dhcpEnabled);
+    $smarty->assign("dhcp_is_Account",$this->dhcp_is_Account);
+    $smarty->assign("dhcpParentNode", $this->dhcpParentNode);
+    $smarty->assign("dhcpParentNodes",$this->dhcpParentNodes);
+
+    /* There is no dns available
      */
     if($this->DNSenabled == false){
-       
-      /* Is IP address must ? */ 
-      $smarty->assign("DNS_enabled",false);  
+
+      /* Is IP address must ? */
+      $smarty->assign("DNS_is_account",false);
       $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
-    
+
       /* Assign smarty all non DNs attributes */
       foreach($this->attributes as $attr){
         $smarty->assign($attr,$this->$attr);
       }
       $smarty->assign("staticAddress","<font class=\"must\">*</font>");
 
-      if ($this->autonet){
-        $smarty->assign("autonet", "true");
-      } else {
-        $smarty->assign("autonet", "");
-      }
       $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
-      return($display);
     }else{
-      $smarty->assign("DNS_enabled",true); 
-    }
+      $smarty->assign("DNS_is_account",true);
 
-    $accountACL = false; 
-    if($this->DNS_is_account && $this->acl_is_removeable()){
-      $accountACL = true;
-    }elseif(!$this->DNS_is_account && $this->acl_is_createable()){
-      $accountACL = true;
-    }
-    $smarty->assign("accountACL",$accountACL);
+      /* Add new empty array to our record list */
+      if(isset($_POST['AddNewRecord'])){
+        $this->dnsEntry['RECORDS'][]  =array("type"=>"aRecord","value"=>"");
+      }
 
-    /* Add new empty array to our record list */
-    if(isset($_POST['AddNewRecord'])){
-      $this->dnsEntry['RECORDS'][]  =array("type"=>"aRecord","value"=>"");
-    }
-   
-    /* Handle all posts */ 
-    $only_once =true;
-    foreach($_POST as $name => $value){
+      /* Handle all posts */
+      $only_once =true;
+      foreach($_POST as $name => $value){
 
-      /* Check if we have to delete a record entry */
-      if((preg_match("/RemoveRecord_/",$name))&&($only_once)) {
-      
-        /* Avoid performing this once again */
-        $only_once = false;
+        /* Check if we have to delete a record entry */
+        if((preg_match("/RemoveRecord_/",$name))&&($only_once)) {
 
-        /* Extract id for specified entry */
-        $id = preg_replace("/RemoveRecord_/","",$name);
-        $id = preg_replace("/_.*$/","",$id);
-    
-        /* Delete this record, mark edited entries to be able to delete them */
-        if(isset($this->dnsEntry['RECORDS'][$id])){
-          unset($this->dnsEntry['RECORDS'][$id]);
+          /* Avoid performing this once again */
+          $only_once = false;
+
+          /* Extract id for specified entry */
+          $id = preg_replace("/RemoveRecord_/","",$name);
+          $id = preg_replace("/_.*$/","",$id);
+
+          /* Delete this record, mark edited entries to be able to delete them */
+          if(isset($this->dnsEntry['RECORDS'][$id])){
+            unset($this->dnsEntry['RECORDS'][$id]);
+          }
         }
       }
-    }
+      /* Assign smarty all non DNs attributes */
+      foreach($this->attributes as $attr){
+        $smarty->assign($attr,$this->$attr);
+      }
 
-    /* Assign smarty all non DNs attributes */
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
+      /* Assign smarty all DNS attributes */
+      foreach($this->DNSattributes as $attr){
+        $smarty->assign($attr,$this->dnsEntry[$attr]);
+      }
 
-    /* Assign smarty all DNS attributes */
-    foreach($this->DNSattributes as $attr){
-      $smarty->assign($attr,$this->dnsEntry[$attr]);
-    }
-    
-    /* Assign all needed vars */
-    $smarty->assign("DNS_is_account",$this->DNS_is_account);
-    $smarty->assign("Zones",$this->Zones);
-    $smarty->assign("ZoneKeys",($this->Zones));
-    $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
-    /* Create zone array */
-    $idZones = array();
-    foreach($this->Zones as $id => $zone){
-      if($this->netmaskIsCoherent($id)) {
-        $idZones[$id] = $zone;
-      }else{
-        $idZones[$id] = $zone."&nbsp;("._("Not matching").")";
+      /* Assign all needed vars */
+      $smarty->assign("DNSAccount",$this->DNS_is_account);
+      $smarty->assign("Zones",$this->Zones);
+      $smarty->assign("ZoneKeys",($this->Zones));
+      $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
+
+      /* Create zone array */
+      $idZones = array();
+      foreach($this->Zones as $id => $zone){
+        if($this->netmaskIsCoherent($id)) {
+          $idZones[$id] = $zone;
+        }else{
+          $idZones[$id] = $zone."&nbsp;("._("Not matching").")";
+        }
       }
-    }    
-    $smarty->assign("Zones",$idZones);
-    $smarty->assign("ZoneKeys", $this->Zones);
+      $smarty->assign("Zones",$idZones);
+      $smarty->assign("ZoneKeys", $this->Zones);
 
-    $tmp = $this->generateRecordsList();
-    
-    $changeStateForRecords = $tmp['changeStateForRecords'];
+      $tmp = $this->generateRecordsList();
 
-    $smarty->assign("records",$tmp['str']);
-    $smarty->assign("changeStateForRecords",$changeStateForRecords);
-    $smarty->assign("staticAddress","<font class=\"must\">*</font>");
+      $changeStateForRecords = $tmp['changeStateForRecords'];
 
-    $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
+      $smarty->assign("records",$tmp['str']);
+      $smarty->assign("changeStateForRecords",$changeStateForRecords);
+      $smarty->assign("staticAddress","<font class=\"must\">*</font>");
+
+      $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
+    }
     return($display);
   }
 
@@ -280,11 +365,26 @@ class termDNS extends plugin
   /* Save data to object */
   function save_object()
   {
-    /* Save all posted vars */
-    plugin::save_object();
 
     if(isset($_POST['network_tpl_posted'])){
 
+      /* Save all posted vars */
+      plugin::save_object();
+
+      /* Handle DHCP Posts*/
+      if($this->dhcpEnabled && isset($_POST['network_tpl_posted'])){
+        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;
+        }
+      }
+
       /* Ge all non dns attributes (IP/MAC)*/
       foreach($this->attributes as $attr){
         if(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
@@ -335,6 +435,10 @@ class termDNS extends plugin
     /* 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)){
@@ -433,6 +537,70 @@ class termDNS extends plugin
     $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);
+#        print_a($attrs);
+#        print("cn=".$this->cn.",".$this->dhcpParentNode);
+        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) || 
+           ($this->cn != $this->OrigCn)){
+          $attrs = $this->dhcpHostEntry;
+          $attrs['cn'] = $this->cn;
+          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."));
+          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 */
     /****************/ 
@@ -447,7 +615,13 @@ class termDNS extends plugin
       /* Add ipHostNumber to aRecords
        */
       $backup_dnsEntry = $this->dnsEntry;
-      $this->dnsEntry['RECORDS'][] = array("type"=>"aRecord","value"=>$this->ipHostNumber);
+      if(!empty($this->ipHostNumber)){
+        $this->dnsEntry['RECORDS'][] = array("type"=>"aRecord","value"=>$this->ipHostNumber);
+        $ptr = $this->get_pTRRecord();
+        if(!empty($ptr)){
+          $this->dnsEntry['RECORDS'][] = array("type"=>"pTRRecord","value"=>$ptr);
+        } 
+      }
 
       /* Create diff and follow instructions 
        * If Account was disabled, remove account by setting exists to false
@@ -580,6 +754,121 @@ class termDNS extends plugin
     }
     return($tmp);
   }
+
+  
+  function get_dhcp_host_entry()
+  {
+    $attrs = array();
+    $dn = $this->get_dhcp_host_entry_dn();
+    if($dn){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->cat($dn,array("*"));
+      if($ldap->count()){
+        $attrs = $ldap->fetch();
+        foreach($attrs as $key => $value){
+          if(is_numeric($key) || ($key == "count")){
+            unset($attrs[$key]);
+          }
+          if(is_array($value) && isset($value['count'])){
+            unset($attrs[$key]['count']);
+          }
+        }
+      }
+    }
+    return($attrs);
+  }
+
+
+  function get_dhcp_host_entry_dn()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=dhcpHost)(cn=".$this->cn."))",array("cn","dn"));
+
+    if($ldap->count()){
+      $attr = $ldap->fetch();
+      return($attr['dn']);
+    }else{
+      return("");
+    }
+  }  
+
+
+  function get_dhcp_parent_node()
+  {
+    return(preg_replace("/^cn=".normalizePreg($this->cn).",/","",$this->get_dhcp_host_entry_dn()));
+  }
+
+
+  function get_dhcp_parent_nodes()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(objectClass=dhcpService)",array("dhcpPrimaryDN"));
+    
+    $dhcp_dns = array();
+    while($attr = $ldap->fetch()){
+      $dhcp_dns[$attr['dn']] = $attr['dhcpPrimaryDN'][0];
+    }
+    foreach($dhcp_dns as $key => $pri_dns){
+      $ldap->cat($pri_dns,array("cn"));
+      $tmp = $ldap->fetch();
+      if(isset($tmp['cn'][0])){
+        $dhcp_dns[$key] = $tmp['cn'][0];
+      }else{
+        unset($dhcp_dns[$key]);
+      }
+    }
+
+    $tmp = $tmp2 = array();
+    foreach($dhcp_dns as $dn => $cn){
+      $ldap->cd($dn);
+      $ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpGroup)".
+                    "(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork))",array("cn"));
+      while($attr = $ldap->fetch()){
+        $tmp[$attr['dn']] = $attr['cn'][0];
+      }
+      $tmp2 = array_merge($tmp2,$this->create_tree($tmp,preg_replace("/^[^,]+,/i","",$dn),"(".$cn.")&nbsp;"));
+    }
+    return($tmp2);
+  }
+
+  
+  /* this function returns the default ptr record entry */
+  function get_pTRRecord()
+  {
+    if(!empty($this->ipHostNumber) && isset($this->dnsEntry['zoneName']) && !empty($this->dnsEntry['zoneName'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cat(getDNSZoneDN($this->config,$this->dnsEntry['zoneName']));
+      $attrs = $ldap->fetch();
+      $tmp = array_flip($this->Zones);
+      $tmp = preg_replace("/^[^\/]*+\//","",$tmp[$this->dnsEntry['zoneName']]);
+      $tmp = trim(preg_replace("/\.in-addr.arpa$/","",$tmp));
+      $ptr = preg_replace("/^".normalizePreg(FlipIp($tmp))."\./","",$this->ipHostNumber);
+      return($ptr);
+    }else{
+      return(FALSE);
+    }
+  }
+
+  
+  function create_tree($arr,$base,$current = "")
+  {
+    $ret = array();
+    foreach($arr as $r => $name){
+      $base_part = str_replace($base,"",$r);
+      if(preg_match("/^[a-z]*=".normalizePreg($name)."(|,)$/i",$base_part)){
+        $ret[$r] = $current.$name;
+        $tmp = $this->create_tree($arr,$r,$current.".&nbsp;");
+        foreach($tmp as $sub_key => $sub_name){
+          $ret[$sub_key] = $sub_name;
+        }
+      } 
+    }
+    return($ret);
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 436e363210014ee7ded6370a97c743f8fd2262b4..a6c88361943fc20ae13cc75e6cb322eb16d4f05f 100644 (file)
@@ -7,47 +7,61 @@
                        <table  summary="">
                                <tr>
                                        <td><LABEL      for="ipHostNumber">{t}IP-address{/t}{if $IPisMust}{$staticAddress}{/if}</LABEL></td>
-                                       <td>
-{render acl=$ipHostNumberACL}
-            <input     id="ipHostNumber"       name="ipHostNumber"     size=25 maxlength=80    value="{$ipHostNumber}">
-{/render}
-          </td>
+                                       <td><input      id="ipHostNumber"       name="ipHostNumber"     size=25 maxlength=80    value="{$ipHostNumber}" {$ipHostNumberACL}></td>
                                </tr>
                                <tr>
                                        <td><LABEL      for="macAddress">{t}MAC-address{/t}</LABEL>{$staticAddress}</td>
                                        <td>
-{render acl=$macAddressACL}
-            <input     name="macAddress"       id="macAddress" size=25 maxlength=80    value="{$macAddress}">
-{/render}
+            <input     name="macAddress"       id="macAddress" size=25 maxlength=80    value="{$macAddress}" {$macAddressACL}>
+            {if $autonet==true}
+                                           <input type="submit" name="autonet" value="{t}Autodetect{/t}" 
+                {if ($ipHostNumberACL !="" || $macAddressACL!= "")} disabled {/if}>
+            {/if}
           </td>
                                </tr>
-        {if $autonet==true}
-                               <tr>
-                                       <td>&nbsp;</td>
-                                       <td>
-{render acl=$macAddressACL.$ipHostNumberACL}
-            <input type="submit" name="autonet" value="{t}Autodetect{/t}">
-{/render}
+        {if $dhcpEnabled}
+        <tr>
+          <td colspan=2 style='padding-top:12px;'>
+            <table>
+              <tr>
+                <td>
+                  <input onClick='document.mainform.submit();'
+                    {if $dhcp_is_Account} checked {/if} type='checkbox' name='dhcp_is_Account' class='center'>
+                </td>
+                <td>
+                  {t}Enable DHCP for this device{/t}
+                  <input type='image' src='images/list_reload.png' class='center'>
+                </td>
+              </tr>
+              {if $dhcp_is_Account}
+              <tr>
+                <td>&nbsp;</td>
+                <td>
+                  {t}Parent node{/t}
+                  <select name='dhcpParentNode'>      
+                    {html_options options=$dhcpParentNodes selected=$dhcpParentNode}
+                  </select>
+                  &nbsp;
+                  <input type='submit' name='dhcpEditOptions' value='{t}Edit settings{/t}'>
+                </td>
+              </tr>
+              {/if}
+            </table>
           </td>
-                               </tr>
+        </tr>
         {/if}
       </table> 
     </td>
-    {if $DNS_enabled==true}
+    {if $DNS_is_account==true}
                <td     style="width:50%;vertical-align:top;border-left:1px solid #b0b0b0;" valign="top">
-      <input type="checkbox" name="DNS_is_account" value="1" 
-
-        {if !$accountACL}  
-          disabled
-        {/if}
-
-        {if $DNS_is_account == true}checked="checked"
+      <input type="checkbox" name="DNS_is_account" value="1"  
+        {if $DNSAccount == true}checked="checked"
         onclick="toggle('test2');
           changeState('zoneName');
           changeState('dNSTTL');
           changeState('AddNewRecord');
           {$changeStateForRecords}
-      ">
+      "/>
         {else}
         onclick="toggle('test2');
           changeState('zoneName');
@@ -56,8 +70,8 @@
       "/>
         {/if}
       {t}Enable DNS for this device{/t}
-      <input type="submit" name="reloadThisDNSStuff" value="{t}Refresh{/t}"/>
-      {if $DNS_is_account == true}
+      <input type='image' src='images/list_reload.png' class='center' name="reloadThisDNSStuff" />
+      {if $DNSAccount == true}
       <div style="padding-left:20px;visibility:visible;" id="test2">
       {else}
       <div style="padding-left:20px;visibility:hidden;" id="test2">
               </select>
 {/render}
           </td>
-                               </tr>
-                               <tr>
+        </tr>
+        <tr>
           <td>{t}TTL{/t}</td>
           <td>
 {render acl=$dNSTTLACL}
             <input type="text" name="dNSTTL" value="{$dNSTTL}" id="dNSTTL" {if $DNS_is_account == false} disabled {/if}>
 {/render}
-          </td> 
-                               </tr>
-                               <tr>
+          </td>
+        </tr>
+        <tr>
           <td valign="top">{t}Dns records{/t}</td>
           <td>
             {if $DNS_is_account == true}
               {$records}
 {/render}
             {/if}
-            </td>
+          </td>
                                </tr>
                        </table>
       </div>