Code

Hide php errors
[gosa.git] / plugins / admin / users / class_userManagement.inc
index 2987d9be1459fa9efbbbf6497764a9ef8ffa3612..b1b1d303da7768fa20c1fa167c94247929ede3b5 100644 (file)
@@ -108,6 +108,7 @@ class userManagement extends plugin
     }
 
     $s_entry  = preg_replace("/_.$/","",$s_entry);
+
     if(preg_match("/.*-.*/",$s_entry)){
       $s_tab   = preg_replace("/^.*-/i","",$s_entry);
       $s_entry = preg_replace("/-.*$/i","",$s_entry);
@@ -455,7 +456,7 @@ class userManagement extends plugin
     }
 
     /* Generate template list */
-    if ($s_action=="new"){
+    if (($s_action=="new")||($s_action=="create_user_from_tpl")){
       $this->templates= array();
       $ldap= $this->config->get_ldap_link();
       foreach ($this->config->departments as $key => $value){
@@ -503,7 +504,7 @@ class userManagement extends plugin
       }
 
       /* Use template if there are any of them */
-      if (count($this->templates) && !isset($_POST['new_template'])){
+      if ((count($this->templates) && !isset($_POST['new_template']))||($s_action=="create_user_from_tpl")){
         foreach(array("sn", "givenName", "uid", "got_uid", "templates") as $attr){
           $smarty->assign("$attr", $this->$attr);
         }
@@ -592,13 +593,17 @@ class userManagement extends plugin
       $this->usertab->givenName = $this->givenName;
       $template_dn              = $_POST['template'];
       $this->usertab->adapt_from_template($template_dn);
-      $template_base            = $userfilter['depselect'];//preg_replace("/^[^,]+,".get_people_ou()."/", '', $template_dn);
+      $template_base            = preg_replace("/^[^,]+,".get_people_ou()."/", '', $template_dn);
       $this->usertab->by_object['user']->base= $template_base;
 
       /* Set up the users ACL's for this 'dn' */
       $acl= get_permissions ($template_base, $this->ui->subtreeACL);
       $this->usertab->set_acl($acl);
     }
+    
+    if (isset($_POST['template_continue']) && ($_POST['template'] == 'none')){
+      $this->usertab->by_object['user']->base= $userfilter['depselect'];
+    }
 
     /* Show tab dialog if object is present */
     if ($this->usertab){
@@ -657,7 +662,7 @@ class userManagement extends plugin
 
     $action= "<input type='image' src='images/edit.png' alt='"._("edit")."'     name='user_edit_%KEY%' title='"._("Edit user")."'>";
     $action.= "<input type='image' src='images/list_password.png' alt='"._("password")."' name='user_chgpw_%KEY%' title='"._("Change password")."'>";
-    $action.= "<input type='image' src='images/editdelete.png' alt='"._("delete")."'   name='user_del_%KEY%' title='"._("Delete user")."'>";
+    $action.= "<input type='image' src='images/edittrash.png' alt='"._("delete")."'   name='user_del_%KEY%' title='"._("Delete user")."'>";
 
 
 
@@ -704,6 +709,8 @@ class userManagement extends plugin
                     name='user_edit_%KEY%-user' title='"._("Edit generic properties")."'>";
     $posiximg = "<input type='image' src='images/select_user.png' alt='"._("Posix")."'  
                     name='user_edit_%KEY%-posixAccount' title='"._("Edit UNIX properties")."'>";
+    $eviroimg = "<input type='image' src='images/network.png' alt='"._("Environment")."'  
+                    name='user_edit_%KEY%-environment' title='"._("Edit environment properties")."'>";
     $mailimg  = "<input type='image' src='images/mailto.png' alt='"._("Mail")."'     
                     name='user_edit_%KEY%-mailAccount' title='"._("Edit mail properties")."'>";
     $fonimg   = "<input type='image' src='images/%image%' alt='"._("Phone")."'     
@@ -776,7 +783,7 @@ class userManagement extends plugin
             }
             if((isset($mysql_entry[0]))&&($mysql_entry[0]==0)){
               $connected = " | "._("Offline");
-              $fonac = preg_replace("/%image%/", "select_phone_notconnected.png", $fonimg);
+              $fonac = preg_replace("/%image%/", "select_phone.png", $fonimg);
               $fonac = preg_replace("/%KEY%/", "$key", $fonac);
               $fonac = preg_replace("/%title%/", $connected, $fonac);
             }
@@ -792,6 +799,12 @@ class userManagement extends plugin
       }else{ 
         $posix=$empty;
       }
+      
+      if(in_array("gotoEnvironment"    ,$val['objectClass'])){ 
+        $enviro = preg_replace("/%KEY%/", "$key", $eviroimg);
+      }else{ 
+        $enviro =$empty;
+      }
    
       if(in_array("gosaMailAccount" ,$val['objectClass'])){ 
         $maila = preg_replace("/%KEY%/", "$key", $mailimg);   
@@ -819,7 +832,7 @@ class userManagement extends plugin
         $tpl=$userimg;
       }
 
-      $usrimg = preg_replace("/%KEY%/", "$key", $usrimg);
+      $usrimg2 = preg_replace("/%KEY%/", "$key", $usrimg);
 
       // Generate caption for rows
       if (isset($val["sn"]) && isset($val["givenName"])){
@@ -831,7 +844,7 @@ class userManagement extends plugin
       /* Create each field */
       $field1 = array("string" => sprintf($tpl,$val['dn']),"attach"=>"style='width:20px;align:middle;'");
       $field2 = array("string" => sprintf($editlink,$key,$display).$ip_port,"attach"=>"title='".$val['dn']."'");
-      $field3 = array("string" => $usrimg."&nbsp;".$posix."&nbsp;".$maila."&nbsp;".$fonac."&nbsp;".$faxac."&nbsp;".$samba."&nbsp;".$s_img_create_from_template, "attach" => "style='width:138px;'");
+      $field3 = array("string" => $usrimg2."&nbsp;".$posix."&nbsp;".$enviro."&nbsp;".$maila."&nbsp;".$fonac."&nbsp;".$faxac."&nbsp;".$samba."&nbsp;".$s_img_create_from_template, "attach" => "style='width:138px;'");
       $field4 = array("string" => preg_replace("/%KEY%/", "$key", $action),"attach" => "style='border:none; text-align:right;width:48px'");
 
       $add = array($field1,$field2,$field3,$field4);