diff --git a/gosa-plugins/sudo/admin/sudo/class_target_list_users.inc b/gosa-plugins/sudo/admin/sudo/class_target_list_users.inc
index 227e328bd0fc914109e0cd333fd511b2723e41bc..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 ;
-
+ 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" => " ", "attach" => "style='text-align:center;width:20px;'"));
$this->AddHeader(array("string" => _("Object name"), "attach" => "style=''"));
+ $this->AddCheckBox("user", _("Select to see users") ,_("Show users"), true);
+ $this->AddCheckBox("group", _("Select to see groups"),_("Show groups"), true);
+
+ /* Add SubSearch checkbox */
+ $this->AddCheckBox(SEPERATOR);
+
/* Add SubSearch checkbox */
$this->AddCheckBox("SubSearch", msgPool::selectToView("","subsearch"), msgPool::selectToView("","subsearch_small"), false);
$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){
/* Add department selector */
$listhead .= _("Base")." <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")."'> ";
+ " <input class='center' type='image' src='images/lists/submit.png' align='middle'
+ title='"._("Apply")."' name='submit_department' alt='"._("Submit")."'> ";
$listhead .="</div>";
$this->SetListHeader($listhead);
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']."&act=dep_open&dep_id=%s'>%s</a>";
$editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
$ui = get_userinfo();
$desc = " - [ ".$val['description'][0]." ]";
}
- $img = "<img src='images/select_user.png' alt='"._("Use")."' ".$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;
+ }else{
+ $img = $img1;
+ }
/* 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();
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= get_sub_list($filter, array("users"), array(get_people_ou()),$base,
- array("cn","uid","objectClass","description"), GL_SIZELIMIT | GL_SUBSEARCH);
+ $res = array();
+ if($this->user){
+ $filter = "(&(objectClass=person)(objectClass=gosaAccount))";
+ $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.")(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.")(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.")(uid=".$Regex."))(|".$filter."))";
+ $res= array_merge($res,get_list($filter, array("groups"), get_groups_ou().$base,
+ array("cn","uid","objectClass","description"), GL_SIZELIMIT ));
+ }
}
$this->list= $res;
}
}
-
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>