Code

Updated
[gosa.git] / plugins / admin / systems / class_glpiSelectUser.inc
index 27cd281cca0b529b8afcea9a7db1dd1a7296ece0..85de38d3e3ab4b6ffb5fe8cbc24fb7a2a9c30143 100644 (file)
@@ -17,10 +17,14 @@ class glpiSelectUser extends plugin
 
   var $ui;
 
-  function glpiSelectUser ($config, $dn= NULL)
+  var $PostVarName      = "";
+
+  function glpiSelectUser ($config, $dn= NULL,$postvar)
   {
     plugin::plugin ($config, $dn);
 
+    $this->PostVarName = $postvar;
+
     if(!isset($_SESSION['glpi_user_filter'])){
       $tmp['users_regex'] = "*";
       $tmp['base']       = $this->config->current['BASE'];
@@ -37,8 +41,18 @@ class glpiSelectUser extends plugin
 
     $filter = $_SESSION['glpi_user_filter'];
 
-    $s_action="";
+    /* Filter settings, remove double* */
+    if(isset($_GET['search'])){
+      $filter['users_regex'] = preg_replace("/\*\**/","*",$_GET['search']."*");
+    }elseif(isset($_POST['regex'])){
+      $filter['users_regex'] = preg_replace("/\*\**/","*",$_POST['regex']);
+    }
+    if(empty($filter['users_regex'])) {
+      $filter = "*";
+    }
+
 
+    $s_action="";
     /* Test Posts */
     foreach($_POST as $key => $val){
       // Post for delete
@@ -114,25 +128,17 @@ class glpiSelectUser extends plugin
       $divlist->AddEntry(array($field1,$field2,$field3));
     }
 
-    $useruse = "<a href='?plug=".$_GET['plug']."&amp;act=user_tech_num&amp;id=%s'>%s</a>";
+    $useruse = "<a href='?plug=".$_GET['plug']."&amp;act=".$this->PostVarName."&amp;id=%s'>%s</a>";
     
     foreach($this->users as $key=>$user){
-      $field1 = array("string" => "<img src='images/select_user.png' alt='user'>", "attach" => "style='text-align:center;width:20px;'");
+      $field1 = array("string" => "<img src='images/select_user.png' alt='user' >", "attach" => "style='text-align:center;width:20px;'");
       $field2 = array("string" => sprintf($useruse,base64_encode($key),$user), "attach" => "style=''");
-      $field3 = array("string" => sprintf($useruse,base64_encode($key),"<img border=0 src='images/crossref.png' alt='"._("use")."'>"), 
+      $field3 = array("string" => sprintf($useruse,base64_encode($key),"<img title='"._("Use")."' border=0 src='images/crossref.png' alt='"._("use")."'>"), 
         "attach" => "style='width:60px;border-right:0px;text-align:right;'");
       $divlist->AddEntry(array($field1,$field2,$field3));
       
     }
 
-
-
-
-
-
-
-
-
     $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
       " <input class='center' type='image' align='middle' 
       src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
@@ -149,8 +155,8 @@ class glpiSelectUser extends plugin
     $smarty->assign("search_image", get_template_path('images/search.png'));
     $smarty->assign("searchu_image", get_template_path('images/search_user.png'));
     $smarty->assign("tree_image", get_template_path('images/tree.png'));
-    $smarty->assign("infoimage", get_template_path('images/info.png'));
-    $smarty->assign("launchimage", get_template_path('images/launch.png'));
+    $smarty->assign("infoimage", get_template_path('images/info_small.png'));
+    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
     $smarty->assign("apply", apply_filter());
     $smarty->assign("alphabet", generate_alphabet());
     $smarty->assign("users_regex", $filter['users_regex']);
@@ -181,7 +187,7 @@ class glpiSelectUser extends plugin
      * So we are able to navigate like in konquerer
      */
 
-    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=*)(description=*))(objectClass=gosaDepartment))",
         TRUE, $base, array("ou", "description"), TRUE);
 
     $this->departments= array();