Code

updated tempalte
[gosa.git] / plugins / admin / systems / class_winGeneric.inc
index 82b5a25c9fe92876db53931c8b5b820a45f5e590..4fc4ab92e44123b194729f50189e631c33096344 100644 (file)
@@ -13,8 +13,6 @@ class wingeneric extends plugin
   /* Needed values and lists */
   var $base= "";
   var $cn= "";
-  var $macAddress= "";
-  var $ipHostNumber= "";
   var $description= "";
   var $orig_dn= "";
   var $shadowLastChange="";
@@ -32,26 +30,25 @@ class wingeneric extends plugin
   var $sambaSID="";
   var $sambaPrimaryGroupSID="";
   var $displayName="";
-  var $sambaPwdCanChange2="";
   var $sambaPwdMustChange="";
   var $sambaNTPassword="";
   var $sambaPwdLastSet="";
   var $sambaAcctFlags="";
-
+  var $netConfigDNS;
   /* attribute list for save action */
   var $ignore_account= TRUE;
-  var $attributes   = array("cn", "description", "macAddress", "ipHostNumber","shadowLastChange",
+  var $attributes   = array("cn", "description","shadowLastChange",
                             "uidNumber","gidNumber","loginShell","gecos","shadowMin","shadowWarning",
                             "shadowInactive","uid","cn","sn","givenName","homeDirectory","sambaSID",
-                            "sambaPrimaryGroupSID","displayName", "sambaPwdCanChange2","sambaPwdMustChange",
+                            "sambaPrimaryGroupSID","displayName", "sambaPwdMustChange",
                             "sambaNTPassword","sambaPwdLastSet","sambaAcctFlags");
-  var $objectclasses= array("posixAccount","person","organizationalPerson","inetOrgPerson","gosaAccount","shadowAccount","sambaSamAccount","top", "device", "ipHost", "ieee802Device");
+  var $objectclasses= array("posixAccount","person","organizationalPerson","inetOrgPerson","gosaAccount","shadowAccount","sambaSamAccount","top");
 
 
   function wingeneric ($config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
-
+    $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
     /* Set base */
     if ($this->dn == "new"){
       $ui= get_userinfo();
@@ -67,6 +64,9 @@ class wingeneric extends plugin
 
   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>".
@@ -76,6 +76,8 @@ class wingeneric extends plugin
 
     /* Fill templating stuff */
     $smarty= get_smarty();
+
+    // Undefined index in wingeneric.tpl ... 
     $smarty->assign("bases", $this->config->idepartments);
 
     /* Assign attributes */
@@ -84,11 +86,10 @@ class wingeneric extends plugin
       $smarty->assign("$attr", $this->$attr);
     }
     
-    
     $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('wingeneric.tpl', TRUE)));
   }
 
@@ -107,7 +108,7 @@ class wingeneric extends plugin
       unset($og->member[$this->dn]);
       $og->save ();
     }
-
+    $this->netConfigDNS->remove_from_parent();
   }
 
 
@@ -115,7 +116,7 @@ class wingeneric extends plugin
   function save_object()
   {
     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'];
@@ -126,20 +127,9 @@ class wingeneric extends plugin
   /* Check supplied data */
   function check()
   {
-    $message= array();
+    $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, "macAddress") == ""){
-      $message[]= _("The required field 'MAC-address' is not set.");
-    }
-    if ($this->ipHostNumber == "" && chkacl ($this->acl, "ipHostNumber") == ""){
-      $message[]= _("The required field 'IP-address' is not set.");
-    }
-
     $ui= get_userinfo();
     $acl= get_permissions ($this->dn, $ui->subtreeACL);
     $acl= get_module_permission($acl, "component", $this->dn);
@@ -199,6 +189,7 @@ class wingeneric 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 */