Code

Added empty lines
[gosa.git] / plugins / admin / users / class_userManagement.inc
index 3e1c08410d35f16ad287dd4d0b763bff53ca335d..a47597dc1ff13145e300fc6ca882aea5c46c5cf3 100644 (file)
@@ -59,6 +59,9 @@ class userManagement extends plugin
 
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
     $smarty       = get_smarty();             // Smarty instance
     $userfilter   = get_global("userfilter"); // contains Filter Settings
     $s_action     = "";                       // Contains the action to proceed
@@ -457,15 +460,26 @@ class userManagement extends plugin
 
     /* Generate template list */
     if (($s_action=="new")||($s_action=="create_user_from_tpl")){
+
       $this->templates= array();
+
       $ldap= $this->config->get_ldap_link();
+
+      /* Create list of tempaltes */
       foreach ($this->config->departments as $key => $value){
+    
+        /* Get acls from different ou's */
         $acl= get_permissions (get_people_ou().$value, $this->ui->subtreeACL);
         $acl= get_module_permission($acl, "user", get_people_ou().$value);
+  
+        /* If creation of a new user is allowed, append this template */
         if (chkacl($acl, "create") == ""){
+          
+          /* Search all templates from the current dn */
           $ldap->cd (get_people_ou().$value);
           $ldap->search ("(objectClass=gosaUserTemplate)", array("uid"));
 
+          /* Append */
           if ($ldap->count() != 0){
             while ($attrs= $ldap->fetch()){
               $this->templates[$ldap->getDN()]=
@@ -475,6 +489,8 @@ class userManagement extends plugin
           }
         }
       }
+
+      /* Sort templates */
       natcasesort ($this->templates);
       reset ($this->templates);
     }
@@ -494,6 +510,7 @@ class userManagement extends plugin
       $this->usertab= new usertabs($this->config,
           $this->config->data['TABS']['USERTABS'], $this->dn);
       $this->usertab->set_acl(array(':all'));
+      $this->usertab->by_object['user']->base= $userfilter['depselect'];
 
       /* Take care about templates */
       if ($s_action=="new_tpl"){
@@ -511,7 +528,7 @@ class userManagement extends plugin
         if ($s_action=="create_user_from_tpl"){
           $smarty->assign("template", $this->dn= $this->list[trim($s_entry)]['dn']);
         } else {
-          $smarty->assign("template", "");
+          $smarty->assign("template", "none");
         }
         $smarty->assign("edit_uid", "");
         return($smarty->fetch(get_template_path('template.tpl', TRUE)));
@@ -593,13 +610,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){
@@ -658,7 +679,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")."'>";
 
 
 
@@ -671,7 +692,7 @@ class userManagement extends plugin
 
 
     $divlist->SetSummary(_("This table displays all users, in the selected tree."));
-    $divlist->SetEntriesPerPage(20);
+    $divlist->SetEntriesPerPage(0);
 
     // Defining Links 
     $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
@@ -705,6 +726,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/smallenv.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")."'     
@@ -745,7 +768,7 @@ class userManagement extends plugin
       /* 
         If you want to disable the status pictures, just comment out the next line
       */
-      $r_con= @mysql_connect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
+      $r_con= @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
       // Check if we are  connected correctly
       if($r_con){
         $r_db  =  @mysql_select_db($a_SETUP['DB'],$r_con);
@@ -777,7 +800,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);
             }
@@ -787,12 +810,20 @@ class userManagement extends plugin
         $fonac=$empty;
       }
 
+    
+
       // Specify Pics for Extensions  
       if(in_array("posixAccount"    ,$val['objectClass'])){ 
         $posix = preg_replace("/%KEY%/", "$key", $posiximg);
       }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);   
@@ -820,7 +851,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"])){
@@ -832,7 +863,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:155px;'");
       $field4 = array("string" => preg_replace("/%KEY%/", "$key", $action),"attach" => "style='border:none; text-align:right;width:48px'");
 
       $add = array($field1,$field2,$field3,$field4);
@@ -882,6 +913,7 @@ class userManagement extends plugin
     $smarty->assign("alphabet", generate_alphabet());
     $smarty->assign("hint", print_sizelimit_warning());
 
+    @mysql_close($r_con);
     return ($smarty->fetch(get_template_path('headpage.tpl', TRUE)));
   }