Code

Prevent multiple categories of the same type in userFilterEditor
[gosa.git] / gosa-core / include / class_config.inc
index 52b22958330de79d5cc734492635314902891040..64995adaccc80e487f2f38ca4820d03437a501b2 100644 (file)
@@ -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;
 
@@ -246,6 +247,10 @@ class config  {
                   }
                   break;
 
+      case 'PATHMENU':
+                  $this->data['PATHMENU']= array(); ;
+                  break;
+
                   /* Inser plugins */
       case 'PLUGIN':
                   if ($this->tags[$this->level-3] == 'MENU' &&
@@ -253,6 +258,9 @@ class config  {
 
                     $this->data['MENU'][$this->section][$this->gpc++]= $attrs;
                   }
+                  if ($this->tags[$this->level-2] == 'PATHMENU'){
+                    $this->data['PATHMENU'][$this->gpc++]= $attrs;
+                  }
                   if ($this->tags[$this->level-2] == 'SERVICEMENU'){
                     $this->data['SERVICE'][$attrs['CLASS']]= $attrs;
                   }
@@ -390,8 +398,8 @@ class config  {
       $bases= array();
       $servers= array();
       foreach ($this->current['REFERRAL'] as $ref){
-        $server= preg_replace('%^(.*)/[^/]+$%', '\\1', $ref['URI']);
-        $base= preg_replace('%^.*/([^/]+)$%', '\\1', $ref['URI']);
+        $server= preg_replace('%^(.*://[^/]+)/.*$%', '\\1', $ref['URI']);
+        $base= preg_replace('%^.*://[^/]+/(.*)$%', '\\1', $ref['URI']);
         $bases[$base]= strlen($base);
         $servers[$base]= $server;
       }
@@ -720,7 +728,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 +751,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']) &&