diff --git a/gosa-core/plugins/admin/departments/class_divListDepartment.inc b/gosa-core/plugins/admin/departments/class_divListDepartment.inc
index 2022c38bf46a810156a6af750f10490709f83974..469b0163bc93a34d4c6c0f1d270874bcc1686db4 100644 (file)
/* Toggle all selected / deselected */
- $chk = "<input type='checkbox' id='select_all' name='select_all'
+ $chk = "<input type='checkbox' id='select_all' name='select_all' title='"._("Select all")."'
onClick='toggle_all_(\"^item_selected_[a-zA-Z0-9\\/\=]*$\",\"select_all\");' >";
/* set Page header */
/* Add SubSearch checkbox */
- $this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Search in subtrees"), false);
+ $this->AddCheckBox("SubSearch", msgPool::selectToView("","subsearch"), msgPool::selectToView("","subsearch_small"), false);
/* Name ,Text ,Default , Connect with alphabet */
$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");
/* Add default header */
$listhead = MultiSelectWindow::get_default_header();
$listhead .=
" "._("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
- " <input class='center' type='image' src='images/list_submit.png' align='middle' ".
+ " <input class='center' type='image' src='images/lists/submit.png' align='middle' ".
" title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ";
/* Create Layers menu */
$s = ".|"._("Actions")."|\n";
- $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
- " "._("Create")."|\n";
/* Append create options */
- if(preg_match("/c/",$acl)) {
- $s.= "...|<input class='center' type='image' src='images/list_new_department' alt=''>".
- " "._("Department")."|dep_new|\n";
+ $s .= "..|<img src='images/lists/new.png' alt='' border='0' class='center'>".
+ " "._("Create")."|\n";
+
+ if(preg_match("/c/",$ui->get_permissions("ou=dummy,".$this->selectedBase ,"department/department"))) {
+ $s.= "...|<input class='center' type='image' src='plugins/departments/images/department.png' alt=''>".
+ " "._("Department")." (ou)|dep_new_ou|\n";
+
}
+
+ if(preg_match("/c/",$ui->get_permissions("ou=dummy,".$this->selectedBase ,"department/organization"))) {
+ $s.= "...|<input class='center' type='image' src='plugins/departments/images/organization.png' alt=''>".
+ " "._("Organization")." (o)|dep_new_o|\n";
+ }
+
+ if(preg_match("/c/",$ui->get_permissions("ou=dummy,".$this->selectedBase ,"department/country"))) {
+ $s.= "...|<input class='center' type='image' src='plugins/departments/images/country.png' alt=''>".
+ " "._("Country")." (c)"."|dep_new_c|\n";
+ }
+
+ if(preg_match("/c/",$ui->get_permissions("ou=dummy,".$this->selectedBase ,"department/locality"))) {
+ $s.= "...|<input class='center' type='image' src='plugins/departments/images/locality.png' alt=''>".
+ " "._("Locality")." (l)|dep_new_l|\n";
+ }
+
+ if(preg_match("/c/",$ui->get_permissions("ou=dummy,".$this->selectedBase ,"department/alias"))) {
+ $s.= "...|<input class='center' type='image' src='plugins/departments/images/department_alias.png' alt=''>".
+ " "._("Alias")."|dep_new_alias|\n";
+ }
+
+ if(preg_match("/c/",$ui->get_permissions("ou=dummy,".$this->selectedBase ,"department/referal"))) {
+ $s.= "...|<input class='center' type='image' src='plugins/departments/images/department_referal.png' alt=''>".
+ " "._("Referal")."|dep_new_referal|\n";
+ }
+
$s.= "..|---|\n";
- $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+ $s.= "..|<img src='images/lists/trash.png' alt='' border='0' class='center'>".
" "._("Remove")."|"."remove_multiple|\n";
{
$linkopen = "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
+
+ /* Possible department types
+ */
+ $types['country'] = array("ACL" => "country", "ATTR" => "c",
+ "TITLE" => _("Department"),
+ "IMG_FULL" => "plugins/departments/images/country.png",
+ "IMG" => "plugins/departments/images/country.png", "ABBR" => "c");
+ $types['locality'] = array("ACL" => "locality", "ATTR" => "l",
+ "TITLE" => _("Department"),
+ "IMG" => "plugins/departments/images/locality.png", "ABBR" => "l");
+ $types['organizationalUnit'] = array("ACL" => "department", "ATTR" => "ou",
+ "TITLE" => _("Department"),
+ "IMG_FULL" => "images/lists/folder-full.png",
+ "IMG" => "images/lists/folder.png", "ABBR" => "ou");
+ $types['organization'] = array("ACL" => "organization", "ATTR" => "o",
+ "TITLE" => _("Department"),
+ "IMG" => "plugins/departments/images/organization.png", "ABBR" => "o");
+ $types['Alias??'] = array("ACL" => "alias" , "ATTR" => "alias?",
+ "TITLE" => _("Department"),
+ "IMG" => "plugins/departments/images/department_alias.png", "ABBR" => "alias");
+ $types['Referal??'] = array("ACL" => "referal", "ATTR" => "referal?",
+ "TITLE" => _("Department"),
+ "IMG" => "plugins/departments/images/department_referal.png", "ABBR" => "referal");
+
+ $this->departments = $list;
+
$ui = get_userinfo();
foreach($list as $key => $val) {
$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")."'>";
+ /* Detect department type
+ */
+ $dep_data = array();
+ foreach($types as $type => $data){
+ if(in_array($type,$val['objectClass'])){
+ $dep_data = $data;
+ break;
+ }
}
-
- 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")."'>";
+
+ /* Warn if there was an unknown department type found
+ */
+ if(!count($dep_data)) {
+ trigger_error("Unknown department type given. Skipped '".$val['dn']."'.");
+ continue;
}
- if(!isset($this->config->departments[trim($key)])){
- $this->config->departments[trim($key)]="";
+ /* Get permissions
+ */
+ $acl = $ui->get_permissions($val['dn'],"department/".$dep_data['ACL']);
+ $acl_all = $ui->has_complete_category_acls($val['dn'],"department");
+
+ /* Create actions
+ */
+ $actions.= "<input class='center' type='image' src='images/lists/edit.png'
+ alt='"._("edit")."' name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
+ if(preg_match("/d/",$acl)){
+ $actions.= "<input class='center' type='image' src='images/lists/trash.png'
+ alt='"._("delete")."' name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
}
- /* check if this department contains sub-departments
+ /* Check if this department contains sub-departments
Display different image in this case
*/
- $non_empty="";
- $nkey= normalizePreg($key);
- foreach($this->config->departments as $keyd=>$vald ){
- if(preg_match('/$nkey\/.*/',$keyd)){
- $non_empty="full";
+ $sub_folders= FALSE;
+ foreach($this->config->departments as $keyd){
+ if(preg_match("/,".normalizePreg($val['dn'])."$/",$keyd)){
+ $sub_folders = TRUE;
}
}
- $title = preg_replace('/ /', ' ', @LDAP::fix($this->config->departments[$key]));
+ /* Create entry name
+ */
+ $name = $val[$dep_data['ATTR']][0];
+ if(isset($val['description'])){
+ $name .= " - [".$val["description"][0]."]";
+ }
+
+ /* Create title
+ */
+ $title = preg_replace('/ /', ' ', @LDAP::fix($val['dn']));
- if($val == "."){
+ /* Create checkboxes infront of the entry
+ */
+ if($name == "."){
$field01 = array("string" => " ",
"attach" => "style='width:20px;'");
}else{
- $field01 = array("string" => "<input type='checkbox' id='item_selected_".base64_encode($key)."'
- name='item_selected_".base64_encode($key)."'>" ,
+ $field01 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
"attach" => "style='width:20px;'");
}
- $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($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;'");
+ /* Create image
+ */
+ if($sub_folders){
+ $img = "<img src='".$dep_data['IMG_FULL']."' class='center' title='".$dep_data['TITLE']."'>";
+ }else{
+ $img = "<img src='".$dep_data['IMG']."' class='center' title='".$dep_data['TITLE']."'>";
+ }
+
+ /* Append data to the listing
+ */
+ $field0 = array("string" => $img, "attach" => "style='text-align:center;width:20px;'");
+ $field1 = array("string" => sprintf($linkopen,$key,$name),
+ "attach" => "style='' title='".$title."'");
+ $field2 = array("string" => preg_replace("/%KEY%/", $key, $actions),
+ "attach" => "style='width:60px;border-right:0px;text-align:right;'");
$this->AddElement( array($field01,$field0,$field1,$field2));
}
/* Create summary string for list footer */
$num_deps=count($list);
$num_dep_str = _("Number of listed departments");
- $str = "<img class='center' src='images/folder.png'
+ $str = "<img class='center' src='images/lists/folder.png'
title='".$num_dep_str."' alt='".$num_dep_str."'> ".$num_deps." ";
$this->set_List_Bottom_Info($str);