Code

Updated Winstation save:
[gosa.git] / plugins / admin / users / tabs_user.inc
index 9569ed3969e3e613fabc64ea47d98c27aa8bab7f..9466dfb520b305375adbbf6652a0e62285f9e016 100644 (file)
@@ -18,13 +18,13 @@ class usertabs extends tabs
     $baseobject= $this->by_object['user'];
     foreach ($this->by_object as $name => $obj){
 
-      /* Don't touch base object */
-      if ($name != 'user'){
-        $obj->parent= &$this;
-        $obj->uid= $baseobject->uid;
-        $obj->sn= $baseobject->uid;
-        $obj->givenName= $baseobject->uid;
-        $this->by_object[$name]= $obj;
+      /* Adding uid to sub plugins of connectivity */
+      if($name == "connectivity"){
+        foreach ($obj->plugin_name as $plg_name){
+          if(isset($obj->plugin[$plg_name]->uid)){
+            $obj->plugin[$plg_name]->uid = $baseobject->uid;
+          }
+        }
       }
 
       /* Copy mail if needed */
@@ -34,6 +34,17 @@ class usertabs extends tabs
         }
       }
 
+      /* Don't touch base object */
+      if ($name != 'user'){
+        $obj->parent= &$this;
+        $obj->uid= $baseobject->uid;
+        $obj->sn= $baseobject->uid;
+        $obj->givenName= $baseobject->uid;
+      }
+
+      /* Store changes */
+      $this->by_object[$name]= $obj;
+
       /* Update parent in base object */
       $this->by_object['user']->parent= &$this;
     }
@@ -73,8 +84,17 @@ class usertabs extends tabs
     /* Check for new 'dn', in order to propagate the
        'dn' to all plugins */
     $baseobject= $this->by_object['user'];
+
+    /* Assemble cn */
+    $pt= "";
+    if(isset($this->config->current['INCLUDE_PERSONAL_TITLE']) && preg_match("/true/i",$this->config->current['INCLUDE_PERSONAL_TITLE'])){
+      if(!empty($baseobject->personalTitle)){
+        $pt = $baseobject->personalTitle." ";
+      }
+    }
+
     if ($this->dn == 'new'){
-      $baseobject->cn= $baseobject->givenName." ".$baseobject->sn;
+      $baseobject->cn= $pt.$baseobject->givenName." ".$baseobject->sn;
       $this->by_object['user']= $baseobject;
       if (isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid"){
         $this->dn= 'uid='.$baseobject->uid.','.get_people_ou().$baseobject->base;
@@ -88,7 +108,7 @@ class usertabs extends tabs
       if (isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid"){
         $new_dn= 'uid='.$baseobject->uid.','.get_people_ou().$baseobject->base;
       } else {
-        $new_dn= "cn=".$baseobject->givenName." ".$baseobject->sn.','.
+        $new_dn= "cn=".$pt.$baseobject->givenName." ".$baseobject->sn.','.
           get_people_ou().$baseobject->base;
       }
       
@@ -108,7 +128,7 @@ class usertabs extends tabs
       if ($this->dn != $new_dn){
 
         /* Write entry on new 'dn' */
-        $baseobject->cn= $baseobject->givenName." ".$baseobject->sn;
+        $baseobject->cn= $pt.$baseobject->givenName." ".$baseobject->sn;
         $baseobject->move($this->dn, $new_dn);
         $this->by_object['user']= $baseobject;
 
@@ -129,6 +149,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;
+    }
+  }
 
 }