diff --git a/plugins/admin/systems/class_glpiSelectUser.inc b/plugins/admin/systems/class_glpiSelectUser.inc
index 085b48a551096ad67b698b745ad56f5342764957..7073b12a40564807837d986f706cd683fb9f518b 100644 (file)
var $PostVarName = "";
- function glpiSelectUser ($config, $dn= NULL,$postvar)
+ function glpiSelectUser (&$config, $dn= NULL,$postvar)
{
plugin::plugin ($config, $dn);
/* Call parent execute */
plugin::execute();
+ if(isset($_POST['depselect'])){
+ $_SESSION['glpi_user_filter']['base'] = $_POST['depselect'];
+ }
+
$filter = $_SESSION['glpi_user_filter'];
/* Filter settings, remove double* */
$display= "";
$divlist = new divlist("glpi users");
+ $divlist->SetPluginMode();
$divlist->SetEntriesPerPage(0);
$divlist->SetHeader(array(
array("string" => " ", "attach" => "style='text-align:center;width:20px;'"),
$useruse = "<a href='?plug=".$_GET['plug']."&act=".$this->PostVarName."&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));
}
+ /* Prepare departments,
+ which are shown in the listbox on top of the listbox
+ */
+
+
+ /* Get all departments within this subtree */
+ $this->base = $_SESSION['glpi_user_filter']['base'];
+ $options ="";
+ $base = $this->config->current['BASE'];
+ $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", "users", $base,
+ array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
+
+ /* Load possible departments */
+ $ui= get_userinfo();
+ $tdeps= $ui->get_module_departments("users");
+ $ids = $this->config->idepartments;
+ foreach($deps as $dep){
+ if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){
+ $value = $ids[$dep['dn']];
+ if ($this->base == $dep['dn']){
+ $options.= "<option selected='selected' value='".$dep['dn']."'>$value</option>";
+ } else {
+ $options.= "<option value='".$dep['dn']."'>$value</option>";
+ }
+ }
+ }
+
$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'> ".
" <input class='center' type='image' src='images/list_root.png'
align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
" <input class='center' type='image' align='middle'
+ src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
+ " <input class='center' type='image' align='middle'
src='images/list_home.png' title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
+ " <input class='center' type='image' src='images/list_reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'> ".
+" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> "._("Base")." ".
+ " <select name='depselect' 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")."'> ".
"</div>";
$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']);
* So we are able to navigate like in konquerer
*/
- $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=*)(description=*))(objectClass=gosaDepartment))",
- TRUE, $base, array("ou", "description"), TRUE);
+ $res3= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))","users",
+ $base, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
$this->departments= array();
$tmp = array();
ksort($tmp);
foreach($tmp as $value){
if(isset($value["description"][0])){
- $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+ $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
}else{
- $this->departments[$value['dn']]=convert_department_dn2($value['dn']);//$value["description"][0];
+ $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0];
}
}
/* END NEW LIST MANAGMENT
*/
$ou = get_people_ou();
- $res2 = get_list($this->ui->subtreeACL, "(&(|(cn=$regex)(sn=$regex))(objectClass=person))",
- TRUE,$ou.$base, array("cn","sn","uid","givenName", "description"), TRUE);
+
+ $res2= get_list("(&(|(cn=$regex)(sn=$regex))(objectClass=person))", "users",
+ $ou.$base, array("cn", "sn", "uid", "givenName", "description"),
+ GL_SUBSEARCH | GL_SIZELIMIT);
$tmp = array();