From d1f634b654ad6c8f7904f44c4a0d61c34598ac43 Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 3 Feb 2010 17:41:59 +0000 Subject: [PATCH] Added icons and descriptions to tree lists git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15582 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_baseSelector.inc | 14 +++++--------- gosa-core/include/class_config.inc | 9 ++++++--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/gosa-core/include/class_baseSelector.inc b/gosa-core/include/class_baseSelector.inc index 1d35ea4fb..4a41a8dc0 100644 --- a/gosa-core/include/class_baseSelector.inc +++ b/gosa-core/include/class_baseSelector.inc @@ -31,14 +31,6 @@ class baseSelector { protected $pathMapping; protected $lastState; - // It would be better to get a dn -> [name, description, type] array - // to avoid these tasks be done several times. Skipping for the moment. - #'dc' => 'plugins/departments/images/domain.png', - #'dc' => 'plugins/departments/images/dc.png', - #'l' => 'plugins/departments/images/locality.png', - #'c' => 'plugins/departments/images/country.png', - #'o' => 'plugins/departments/images/organization.png', - #'ou' => 'plugins/departments/images/folder.png', function __construct($bases, $base= "") { @@ -193,7 +185,11 @@ class baseSelector { } $selected= $this->base == $base?" class='treeListSelected'":""; $link= "onclick=\"\$('bs_rebase_".$this->pid."').value='".base64_encode($base)."';$('submit_tree_base_".$this->pid."').click();\""; - $this->tree.= "
  • ".str_replace('-', '‑', str_replace(' ', ' ', ldap::fix(preg_replace('/^[a-z0-9]+=([^,]+),.*$/i', '$1', $base)))).""; + $this->tree.= "
  • ". + " ". + str_replace('-', '‑', str_replace(' ', ' ', $config->department_info[$base]['name']. + ($config->department_info[$base]['description']==''?'':' ['.$config->department_info[$base]['description'].']'))). + ""; $last_indent= $indent; $first= false; diff --git a/gosa-core/include/class_config.inc b/gosa-core/include/class_config.inc index 52b229583..8a87aa3f9 100644 --- a/gosa-core/include/class_config.inc +++ b/gosa-core/include/class_config.inc @@ -60,6 +60,7 @@ class config { var $idepartments= array(); var $adepartments= array(); var $tdepartments= array(); + var $department_info= array(); var $filename = ""; var $last_modified = 0; @@ -720,7 +721,7 @@ class config { $types = departmentManagement::get_support_departments(); /* Create a list of attributes to fetch */ - $ldap_values = array("objectClass","gosaUnitTag"); + $ldap_values = array("objectClass","gosaUnitTag", "description"); $filter = ""; foreach($types as $type){ $ldap_values[] = $type['ATTR']; @@ -743,12 +744,14 @@ class config { } } - /* Unknown department type -> skip - */ + /* Unknown department type -> skip */ if(!count($type_data)) continue; $dn= $ldap->getDN(); $this->tdepartments[$dn]= ""; + $this->department_info[$dn]= array("img" => $type_data['IMG'], + "description" => isset($attrs['description'][0])?$attrs['description'][0]:"", + "name" => $attrs[$type_data['ATTR']][0]); /* Save administrative departments */ if (in_array_ics("gosaAdministrativeUnit", $attrs['objectClass']) && -- 2.30.2