diff --git a/plugins/admin/departments/class_divListDepartment.inc b/plugins/admin/departments/class_divListDepartment.inc
index f031451082f1f0092623cc05f0170a4f2b389782..5bb5c9d6e3f0c3ecfd1207f65d9220dc7324e6c0 100755 (executable)
function divListDepartment ($config,$parent)
{
- MultiSelectWindow::MultiSelectWindow($config,"Department");
+ MultiSelectWindow::MultiSelectWindow($config, "Department", "department");
$this->parent = $parent;
$this->ui = get_userinfo();
/* Result page will look like a headpage */
$this->SetHeadpageMode();
- $this->SetInformation(_("This menu allows you to create, delete and edit selected departments. Having a large size of departments, you might prefer the range selectors on top of the department list."));
+ $this->SetInformation(_("This menu allows you to create, delete and edit selected departments. Having a large number of departments, you might prefer the range selectors on top of the department list."));
/* Disable buttonsm */
$this->EnableCloseButton(false);
$this->EnableSaveButton (false);
- /* Dynamic action col, depending on snapshot icons */
- $action_col_size = 50;
- if($this->parent->snapshotEnabled()){
- $action_col_size += 20;
- }
-
/* set Page header */
$this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
$this->AddHeader(array("string"=>_("Department name"), "attach" => "style=''"));
- $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
+ $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'"));
+
/* Add SubSearch checkbox */
$this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), false);
/* Name ,Text ,Default , Connect with alphabet */
- $this->AddRegex ("Regex", _("Regular expression for matching group names"), "*" , true);
+ $this->AddRegex ("Regex", _("Regular expression for matching department names"), "*" , true);
}
}
/* Generate list head */
+ $ui = get_userinfo();
+ $acl = $ui->get_permissions("ou=dummy,",$this->selectedBase ,"department/department");
+
$listhead = "<div style='background:#F0F0F9;padding:5px;'>".
- " <input type='image' class='center' src='images/list_root.png' align='middle'
- title='"._("Go to root department")."' name='dep_root' alt='". _("Root")."'> ".
- " <input type='image' class='center' src='images/list_up.png' align='middle'
- title='"._("Go up one department")."' name='dep_back' alt='"._("Up"). "'> ".
- " <input type='image' class='center' src='images/list_home.png' align='middle'
- title='"._("Go to users home department")."' name='dep_home' alt='". _("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'> ";
-
- if($this->parent->snapshotEnabled()){
- $listhead .= " <input class='center' type='image' align='middle' src='images/restore.png'
- title='"._("Restore snapshopts of already deleted objects")."' alt='"._("Restore")."' name='RestoreDeletedSnapShot'>".
- " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
+ " <input type='image' class='center' src='images/list_root.png' align='middle' ".
+ " title='"._("Go to root department")."' name='dep_root' alt='". _("Root")."'> ".
+ " <input type='image' class='center' src='images/list_up.png' align='middle' ".
+ " title='"._("Go up one department")."' name='dep_back' alt='"._("Up"). "'> ".
+ " <input type='image' class='center' src='images/list_home.png' align='middle' ".
+ " title='"._("Go to users home department")."' name='dep_home' alt='". _("Home")."'> ".
+ " <input class='center' type='image' src='images/list_reload.png' align='middle' ".
+ " title='"._("Reload list")."' name='submit_department' alt='". _("Submit")."'> ";
+
+ if(preg_match("/c/",$acl)){
+ $listhead .= " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
+ " <input class='center' type='image' src='images/list_new_department.png' ".
+ " align='middle' alt='"._("Create new department")."' name='dep_new'> ";
}
+
- $listhead .= " <input class='center' type='image' src='images/list_new_department.png'
- align='middle' alt='"._("Create new department")."' name='dep_new'> ".
- " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
- _("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")."'> ".
+ $listhead .= " <img class='center' src='images/list_seperator.png' align='middle' ".
+ " alt='' height='16' width='1'> ".
+ " "._("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")."'> ".
"</div>";
$this->SetListHeader($listhead);
function setEntries($list)
{
-
$linkopen = "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
- /* Dynamic action col, depending on snapshot icons */
- $action_col_size = 50;
- if($this->parent->snapshotEnabled()){
- $action_col_size += 20;
- }
-
+ $ui = get_userinfo();
foreach($list as $key => $val) {
-
- $cdn= convert_department_dn($val['dn']);
- if(isset($val["description"][0])) {
- $disp = get_sub_department($cdn)." - [".$val["description"][0]."]";
- }else{
- $disp = get_sub_department($cdn);
+
+ $actions= "";
+
+ $acl = $ui->get_permissions($this->config->departments[$key] ,"department/department");
+ if(preg_match("/r/",$acl)){
+ $actions.= "<input class='center' type='image' src='images/edit.png'
+ alt='"._("edit")."' name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
+ }
+
+ if(preg_match("/c/",$acl)){
+ $actions.= "<input class='center' type='image' src='images/edittrash.png'
+ alt='"._("delete")."' name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
}
-
- $actions = $this->GetSnapShotActions($val['dn']);
- $actions.= "<input class='center' type='image' src='images/edit.png'
- alt='"._("edit")."' name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
- $actions.= "<input class='center' type='image' src='images/edittrash.png'
- alt='"._("delete")."' name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
if(!isset($this->config->departments[trim($key)])){
$this->config->departments[trim($key)]="";
$title = preg_replace('/ /', ' ', @LDAP::fix($this->config->departments[$key]));
$field0 = array("string" => "<img src='images/".$non_empty."folder.png' title='"._("department")."' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
- $field1 = array("string" => sprintf($linkopen,base64_encode($cdn),$disp), "attach" => "style='' title='".$title."'");
- $field2 = array("string" => preg_replace("/%KEY%/", base64_encode($key), $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:
+ $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style='' title='".$title."'");
+ $field2 = array("string" => preg_replace("/%KEY%/", base64_encode($key), $actions), "attach" => "style='width:60px;border-right:0px;text-align:
right;'");
$this->AddElement( array($field0,$field1,$field2));