Code

Fixed uid/cn bug
[gosa.git] / plugins / admin / systems / class_winGeneric.inc
index 089c096ac955be2fca4c46c40a991efbd500742f..fc0191a72fd502cea2a2735a87e62dd6f55f9571 100644 (file)
@@ -45,9 +45,9 @@ class wingeneric extends plugin
   var $objectclasses= array("posixAccount","person","organizationalPerson","inetOrgPerson","gosaAccount","shadowAccount","sambaSamAccount","top");
 
 
-  function wingeneric ($config, $dn= NULL)
+  function wingeneric ($config, $dn= NULL, $parent= NULL)
   {
-    plugin::plugin ($config, $dn);
+    plugin::plugin ($config, $dn, $parent);
     $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
     /* Set base */
     if ($this->dn == "new"){
@@ -74,6 +74,31 @@ class wingeneric extends plugin
       return($display);
     }
 
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config);
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+        $this->base = $this->dialog->isSelected();
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
     /* Fill templating stuff */
     $smarty= get_smarty();
 
@@ -98,7 +123,7 @@ class wingeneric extends plugin
     $this->netConfigDNS->remove_from_parent();
     $ldap= $this->config->get_ldap_link();
     $ldap->rmdir($this->dn);
-    show_ldap_error($ldap->get_error());
+    show_ldap_error($ldap->get_error(), _("Removing Samba workstation failed"));
     $this->handle_post_events("remove");
 
     /* Delete references to object groups */
@@ -127,7 +152,9 @@ class wingeneric extends plugin
   /* Check supplied data */
   function check()
   {
-    $message=$this->netConfigDNS->check();
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    $message= array_merge($message, $this->netConfigDNS->check());
     $this->dn= "cn=".$this->cn.",ou=netdevices,ou=systems,".$this->base;
 
     $ui= get_userinfo();
@@ -187,14 +214,14 @@ class wingeneric extends plugin
 
       $ldap->cd($this->dn);
       $this->cleanup();
-$ldap->modify ($this->attrs); 
+      $ldap->modify ($this->attrs); 
 
       $this->handle_post_events("modify");
     }
 
     $this->netConfigDNS->cn = $this->cn;
     $this->netConfigDNS->save($this->dn);
-    show_ldap_error($ldap->get_error());
+    show_ldap_error($ldap->get_error(), _("Saving Samba workstation failed"));
 
     /* Optionally execute a command after we're done */
     $this->postcreate();