Code

Fixed w3c compatibility
[gosa.git] / plugins / admin / users / tabs_user.inc
index 451d9f973f2f1b84184179214f38b627134d963b..ce7cf00fbc4b33c54b84e9b1cd67895fa7cec1cb 100644 (file)
@@ -6,8 +6,12 @@ class usertabs extends tabs
 
   function usertabs($config, $data, $dn)
   {
-    tabs::tabs($config, $data, $dn);
+    tabs::tabs($config, $data, $dn, 'users');
     $this->base= $this->by_object['user']->base;
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+    $this->set_acl_base();
   }
 
   function save_object($save_current= FALSE)
@@ -27,6 +31,13 @@ class usertabs extends tabs
         $this->by_object[$name]= $obj;
       }
 
+      /* Copy mail if needed */
+      if ($name == "gofaxAccount"){
+        if (isset($this->by_object['mailAccount']) && $this->by_object['mailAccount']->is_account){
+          $obj->mail= $this->by_object['mailAccount']->mail;
+        }
+      }
+
       /* Update parent in base object */
       $this->by_object['user']->parent= &$this;
     }
@@ -59,6 +70,9 @@ class usertabs extends tabs
       $number= key($this->by_object['phoneAccount']->phoneNumbers);
       $this->by_object['user']->telephoneNumber= $number;
     }
+
+    /* Possibly change acl base */
+    $this->set_acl_base();
   }
 
   function save()
@@ -84,7 +98,20 @@ class usertabs extends tabs
         $new_dn= "cn=".$baseobject->givenName." ".$baseobject->sn.','.
           get_people_ou().$baseobject->base;
       }
-
+      
+      /* Hickert: 31.08.2005 
+       * fixed error = Trying to overwrite cn=***  which already exists.
+       * If you changed one of the "Name" / "Givenname" attributes to lower or upper case, like "test" to "Test", (in DNMODE=cn)
+       *  the old_dn and new dn were different. cn=test ... cn=Test ...
+       * The following code decided to move the entry from old_dn to new_dn. (Because they differ)
+       * But the ldap attribute cn is not case sensitive and the function plugin::move() quits with 
+       *  an error, because source and destination dn are both the same (for ldap, but not for php).
+       * This fix allow you to change the givenname or name attributes.
+       */
+      if(strtolower($this->dn)==strtolower($new_dn)){
+        $this->dn=$new_dn;
+      }
+  
       if ($this->dn != $new_dn){
 
         /* Write entry on new 'dn' */
@@ -109,6 +136,16 @@ class usertabs extends tabs
       $this->by_object[$key]->is_template= TRUE;
     }
   }
+  
+  function saveCopyDialog()
+  {
+    tabs::saveCopyDialog();
+    $baseobject= $this->by_object['user'];
+    $uid = $baseobject->uid;
+    foreach($this->by_object as  $name => $obj){
+      $this->by_object[$name]->uid = $uid;
+    }
+  }
 
 }