Code

Updated remaining attributes
[gosa.git] / gosa-plugins / sudo / admin / sudo / class_target_list_users.inc
index 1640c3d74ebe16c9297d0574fb1e2eea86cbc133..9e8f26248aafd0aa5ec5757a661e504935cc7d0b 100644 (file)
 
 class target_list_users extends MultiSelectWindow
 {
-  var $config;
-  var $list         =array();
-  var $Targets_used =array();
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
+  public $config;
+  private $list         =array();
+  private $Targets_used =array();
 
   /* Regex */
-  var $Regex              = "*";
+  protected $Regex              = "*";
 
   /* CheckBoxes, to change default values modify $this->AddCheckBox */
-  var $user       ;
-  var $group      ;
-
+  protected $user       ;
+  protected $group      ;
 
   /* Subsearch checkbox */
-  var $SubSearch          ;
-  var $parent             ;
-  var $ui                 ;
+  protected $SubSearch          ;
+  protected $parent             ;
+  protected $ui                 ;
+
   function target_list_users(&$config,$Targets_used)
   {
     MultiSelectWindow::MultiSelectWindow($config, "Targetselection", array("users"));
 
-    $this->Targets_used = $Targets_used;
-    
+    $this->Targets_used  = $Targets_used;
+
     $this->SetInformation(  _("Select the target objects"));
-    $this->SetTitle(        _("Available targets"));
-    $this->SetSummary(      _("Available targets"));
+    $this->SetTitle(        _("Available members"));
+    $this->SetSummary(      _("Available members"));
     $this->SetHeadpageMode(FALSE);
-    
+
     /* set Page header */
     $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+      onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
     $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
 
     $this->AddHeader(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"));
@@ -92,7 +86,7 @@ class target_list_users extends MultiSelectWindow
     $tmp = array();
     $tmp[] = array("dn"=>$this->config->current['BASE']);
     $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+          array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
 
     $deps = array();
     foreach($tmp as $tm){
@@ -141,8 +135,8 @@ class target_list_users extends MultiSelectWindow
 
     /* Add department selector */
     $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
-      " <input class='center' type='image' src='images/list_submit.png' align='middle'
-      title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;";
+      " <input class='center' type='image' src='images/lists/submit.png' align='middle'
+      title='"._("Apply")."' name='submit_department' alt='"._("Submit")."'>&nbsp;";
     $listhead .="</div>";
 
     $this->SetListHeader($listhead);
@@ -158,13 +152,12 @@ class target_list_users extends MultiSelectWindow
     return($this->Draw());
   }
 
-  
+
   function SetEntries($list)
   {
-      /* Add Copy & Paste buttons if copy&paste is enabled
+    /* Add Copy & Paste buttons if copy&paste is enabled
      */
     // Defining Links
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
     $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
 
     $ui = get_userinfo();
@@ -181,8 +174,8 @@ class target_list_users extends MultiSelectWindow
         $desc = " - [ ".$val['description'][0]." ]";
       }
 
-      $img1 = "<img src='images/select_user.png'  alt='"._("User")."'  ".$title.">";
-      $img2 = "<img src='images/select_groups.png' alt='"._("Group")."' ".$title.">";
+      $img1 = "<img src='plugins/users/images/select_user.png'  alt='"._("User")."'  ".$title.">";
+      $img2 = "<img src='plugins/groups/images/groups.png' alt='"._("Group")."' ".$title.">";
 
       if(in_array("posixGroup",$val['objectClass'])){
         $img = $img2;
@@ -192,17 +185,17 @@ class target_list_users extends MultiSelectWindow
 
       /* Create each field */
       $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
+          "attach" => "style='width:20px;'");
       $field1 = array("string" => $img, 
-                      "attach" => "style='text-   align:center;width: 20px;'");
+          "attach" => "style='text-   align:center;width: 20px;'");
       $field2 = array("string" => $val['cn'][0].$desc, 
-                      "attach" => "style='border-right:0px;' ".$title);
+          "attach" => "style='border-right:0px;' ".$title);
 
       $this->AddElement(array($field0,$field1,$field2));
     }
   }
 
-  
+
   function save()
   { 
     $ret = array();
@@ -219,45 +212,41 @@ class target_list_users extends MultiSelectWindow
     MultiSelectWindow::save_object();
   }
 
-  
+
   function reload()
   {
     /* Set base for all searches && initialise some vars */
     $this->list= array();
     $base     = $this->selectedBase;
-    $filter   = "(&(objectClass=person)(objectClass=gosaAccount))";
     $Regex    = $this->Regex;
 
     /* Create filter */
-    $filter= "(&(cn=".$Regex.")(|".$filter."))";
 
     if($this->SubSearch){
       $res = array();
       if($this->user){
         $filter   = "(&(objectClass=person)(objectClass=gosaAccount))";
-        $filter= "(&(cn=".$Regex.")(|".$filter."))";
+        $filter= "(&(|(cn=".$Regex.")(uid=".$Regex."))(|".$filter."))";
         $res= array_merge($res,get_sub_list($filter, array("users"), array(get_people_ou()),$base, 
               array("cn","uid","objectClass","description"), GL_SIZELIMIT | GL_SUBSEARCH));
       }
       if($this->group){
         $filter   = "(objectClass=posixGroup)";
-        $filter= "(&(cn=".$Regex.")(|".$filter."))";
+        $filter= "(&(|(cn=".$Regex.")(uid=".$Regex."))(|".$filter."))";
         $res= array_merge($res,get_sub_list($filter, array("groups"), array(get_groups_ou()),$base, 
               array("cn","uid","objectClass","description"), GL_SIZELIMIT | GL_SUBSEARCH));
       }
     }else{
-      $res= get_list($filter, array("users"), get_people_ou().$base, 
-            array("cn","uid","objectClass","description"), GL_SIZELIMIT );
       $res = array();
       if($this->user){
         $filter   = "(&(objectClass=person)(objectClass=gosaAccount))";
-        $filter= "(&(cn=".$Regex.")(|".$filter."))";
+        $filter= "(&(|(cn=".$Regex.")(uid=".$Regex."))(|".$filter."))";
         $res= array_merge($res,get_list($filter, array("users"), get_people_ou().$base, 
               array("cn","uid","objectClass","description"), GL_SIZELIMIT ));
       }
       if($this->group){
         $filter   = "(objectClass=posixGroup)";
-        $filter= "(&(cn=".$Regex.")(|".$filter."))";
+        $filter= "(&(|(cn=".$Regex.")(uid=".$Regex."))(|".$filter."))";
         $res= array_merge($res,get_list($filter, array("groups"), get_groups_ou().$base, 
               array("cn","uid","objectClass","description"), GL_SIZELIMIT ));
       }
@@ -291,6 +280,5 @@ class target_list_users extends MultiSelectWindow
   }
 }
 
-
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>