Code

added seperated dns class for network devices
[gosa.git] / plugins / admin / systems / class_componentGeneric.inc
index eedef9cb5b83453faaf99ea9dea936882e3f7377..164b4aa7cd10683407f23e14d2560549414090db 100644 (file)
@@ -9,18 +9,18 @@ class componentGeneric extends plugin
 
   /* Generic terminal attributes */
   var $interfaces= array();
+  var $ignore_account= TRUE;
 
   /* Needed values and lists */
   var $base= "";
   var $cn= "";
-  var $macAddress= "";
-  var $ipHostNumber= "";
   var $description= "";
   var $orig_dn= "";
 
   /* attribute list for save action */
-  var $attributes= array("cn", "description", "macAddress", "ipHostNumber");
+  var $attributes= array("cn", "description");
   var $objectclasses= array("top", "device", "ipHost", "ieee802Device");
+  var $netConfigDNS;
 
   function componentgeneric ($config, $dn= NULL)
   {
@@ -34,13 +34,16 @@ class componentGeneric extends plugin
     } else {
       $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
     }
-
+    $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
     /* Save dn for later references */
     $this->orig_dn= $this->dn;
   }
 
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
     /* Do we represent a valid phone? */
     if (!$this->is_account && $this->parent == NULL){
       $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
@@ -60,7 +63,7 @@ class componentGeneric extends plugin
     $smarty->assign("base_select", $this->base);
 
     /* Show main page */
-    $smarty->assign("netconfig", dirname(__FILE__)."/network.tpl");
+    $smarty->assign("netconfig", $this->netConfigDNS->execute());
     return($smarty->fetch (get_template_path('component.tpl', TRUE)));
   }
 
@@ -79,7 +82,7 @@ class componentGeneric extends plugin
       unset($og->member[$this->dn]);
       $og->save ();
     }
-
+    $this->netConfigDNS->remove_from_parent();
   }
 
 
@@ -88,6 +91,8 @@ class componentGeneric extends plugin
   {
     plugin::save_object();
 
+    $this->netConfigDNS->save_object();
+
     /* Save base, since this is no LDAP attribute */
     if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
       $this->base= $_POST['base'];
@@ -99,14 +104,13 @@ class componentGeneric extends plugin
   function check()
   {
     $message= array();
+
+    $message = array_merge($message,$this->netConfigDNS->check());
+
     $this->dn= "cn=".$this->cn.",ou=netdevices,ou=systems,".$this->base;
 
-    /* must: cn, macAddress */
     if ($this->cn == "" && chkacl ($this->acl, "cn") == ""){
-      $message[]= "The required field 'Component name' is not set.";
-    }
-    if ($this->macAddress == "" && chkacl ($this->acl, "macAddresscn") == ""){
-      $message[]= "The required field 'MAC-address' is not set.";
+      $message[]= _("The required field 'Component name' is not set.");
     }
 
     $ui= get_userinfo();
@@ -168,6 +172,9 @@ class componentGeneric extends plugin
       $ldap->modify($this->attrs);
       $this->handle_post_events("modify");
     }
+
+    $this->netConfigDNS->save($this->dn);
+
     show_ldap_error($ldap->get_error());
 
     /* Optionally execute a command after we're done */