Code

Updated folder listing
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Oct 2010 14:02:59 +0000 (14:02 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Oct 2010 14:02:59 +0000 (14:02 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19936 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc
gosa-plugins/groupware/personal/groupware/FolderWidget/class_filterFolderWidget.inc

index 904714ff74997c07458b6087c4cc9ab977a8d6e9..e51f4c09eaa95ce959ab811b7b2c06081c244fe5 100644 (file)
@@ -36,13 +36,23 @@ class FolderWidget extends plugin
     function buildRecursiveList($arr, $seperator)
     {
         $data = array();
-        $base = &$data;
-        $last = NULL;
         $ret = array();
+
+        // Add root Entry
+        $data['cn=/'] = array(); 
+        $data['cn=/']['name'] = '/';
+        $data['cn=/']['status'] = '';
+        $data['cn=/']['path'] = '/';
+        $data['cn=/']['type'] = 'manual';
+        $data['cn=/']['base'] = 'cn=/';
+        $data['cn=/']['children'] = array();
+        $ret['linear']['cn=/'] = &$data['cn=/'];
+
+        $base = &$data['cn=/']['children'];
+        $last = NULL;
         foreach($arr as $path => $entry){
             $current = &$base;
             $pathSteps = preg_split("/".preg_quote($seperator,'/')."/", $path);
-    
             $entryPath = "";
             $entryBase = "cn=/";
             foreach($pathSteps as $name){
@@ -56,9 +66,7 @@ class FolderWidget extends plugin
                     $current[$entryPath]['status'] = '';
                     $current[$entryPath]['type'] = 'manual';
                     $current[$entryPath]['base'] = $entryBase;
-
                     $ret['linear'][$entryPath] = &$current[$entryPath];
-
                     $this->baseEntryMap[$entryBase] = $entryPath;
                 }
                 $last = &$current[$entryPath];
@@ -68,9 +76,7 @@ class FolderWidget extends plugin
             $last['name'] = $entry['name'];
             $last['type'] = 'real';
             $last['status'] = $entry['status'];
-    
             $ret['linear'][$path] = &$last;
-            
         }
         $ret['recursive'] = $data;
         return($ret);
index 17af6b550bbac1a9c46a485604da6913ce4ddb63..aba8249bfad6f7de686ef800b587eb01f3134efa 100644 (file)
@@ -13,10 +13,13 @@ class filterFolderWidget {
 
         // Detect starting position in folder tree.
         $items = $data['recursive'];
+        $parent = NULL;
         foreach($data['linear'] as $item){
             if($item['base'] == $base){
                 $items = $item['children'];
+                break;
             }
+            $parent = $item;
         }
 
         // Add entries