Code

Some changes for Arp New devices
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 22 Oct 2007 07:48:45 +0000 (07:48 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 22 Oct 2007 07:48:45 +0000 (07:48 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7612 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_ArpNewDevice.inc
plugins/admin/systems/class_termDNS.inc
plugins/admin/systems/tabs_arpnewdevice.inc

index f2d7a754c3b637d907abf5051ae5a536ddc83dda..79009908e9f2a6320c08314d92cb47091178e92a 100644 (file)
@@ -12,7 +12,7 @@ class ArpNewDevice extends plugin
   {
     plugin :: plugin($config,$dn);
     $this->cn ="";
-    $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
+    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
     $this->acl = "#all#";
     $this->netConfigDNS->acl = $this->acl;
     $this->netConfigDNS->force_dns();
index af07e450b4f42bc5d11126ab7d035f13be396dc9..97dbc5bc9e8dab1efa49c47ef6eb443cc343e0a4 100644 (file)
@@ -44,6 +44,7 @@ class termDNS extends plugin
   var $initially_was_account = false;
   var $dnsEntry                 = array();
   var $DNSenabled               = false;
+  var $hide_dns_check_box       = FALSE;
 
   /*  Terminal dns 
    */
@@ -336,6 +337,8 @@ class termDNS extends plugin
 
       /* Assign all needed vars */
       $smarty->assign("DNSAccount",$this->DNS_is_account);
+      $smarty->assign("hide_dns_check_box",$this->hide_dns_check_box);
+  
       $smarty->assign("Zones",$this->Zones);
       $smarty->assign("ZoneCnt",count($this->Zones));
       $smarty->assign("ZoneKeys",($this->Zones));
@@ -450,6 +453,9 @@ class termDNS extends plugin
 
 
       }
+      if($this->hide_dns_check_box){
+        $this->DNS_is_account = true;
+      }
     }
   }
 
@@ -598,6 +604,21 @@ class termDNS extends plugin
         }
       }
 
+      if(count($this->dhcpHostEntry) == 0){
+        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
+        $this->dialog->cn = $this->cn;
+        $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress;
+        if(!empty($this->ipHostNumber)){
+          $this->dialog->statements['fixed-address'] = $this->ipHostNumber;
+        }
+        $this->dialog->execute();
+        $this->dialog->save_object(); 
+        $this->dhcpHostEntry = $this->dialog->save();
+        if(count($this->dhcpHostEntry['dhcpOption']) == 0){
+          $this->dhcpHostEntry['dhcpOption']= array("host-name ".$this->cn);
+        }
+      }
+
       /* Write mac address to dhcp settings */
       if($this->dhcp_is_Account){
         if(!isset($this->dhcpHostEntry['dhcpHWAddress'][0]) || 
@@ -834,6 +855,10 @@ class termDNS extends plugin
         $tmp['plProvidedAcls']["zoneName"]       = _("Zone name");
         $tmp['plProvidedAcls']["dNSTTL"]         = _("TTL");
       }
+
+      /* Handle post event */
+      $tmp2 = new servdns($this->config,$this->dn);
+      $tmp2->handle_post_events("modify");
     }
     return($tmp);
   }
@@ -952,6 +977,14 @@ class termDNS extends plugin
     }
     return($ret);
   }
+
+  function force_dns()
+  {
+    if($this->DNSenabled){
+      $this->DNS_is_account  = TRUE;
+      $this->hide_dns_check_box = TRUE;
+    }
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index f5d7f68305ee81ff9725976fd48b3a95bdc1f5f1..fe12b4090b62747540af2a5d6cbabe093fc3b93c 100644 (file)
@@ -3,9 +3,9 @@
 class ArpNewDeviceTabs extends tabs
 {
 
-  function save()
+  function save($ignore_account= FALSE)
   {
-    tabs::save(TRUE);
+    tabs::save($ignore_account);
   }
 
   function execute()