Code

Repaired folder listing.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 8 Oct 2010 09:49:21 +0000 (09:49 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 8 Oct 2010 09:49:21 +0000 (09:49 +0000)
-Thing were messed up

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19951 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index eacf21e51a502c99bdc5b5fab5461e7c415988c4..488e761dd204186caf8e8691c8f78b7902b2fcff 100644 (file)
@@ -1,8 +1,5 @@
 <?php
 
-
-
-
 class FolderWidget extends plugin
 {
 
@@ -24,8 +21,9 @@ class FolderWidget extends plugin
         // These are just internally used variables and should not have an 
         //  effect on the results.
         $this->rootBase = $this->fakeCnAttr.$this->rootName;
-        
+
         $this->accountPrefix = rtrim($accountPrefix,'/').'/';
+        $this->rootBase = $this->pathToDn($accountPrefix);
 
         // Update the folder list, initially.
         $this->setFolderList($folderList);
@@ -34,6 +32,16 @@ class FolderWidget extends plugin
         $this->FolderWidgetListing->setFolderRoot($this->rootBase);
     }
 
+    function pathToDn($path)
+    {
+        $dn ="";
+        $list = preg_split("/".preg_quote($this->pathSeperator,'/')."/", $path,0,PREG_SPLIT_NO_EMPTY);
+        foreach($list as $entry){
+            $dn ="cn={$entry},{$dn}"; 
+        }
+        return(rtrim($dn, ','));
+    }
+
     function getFolderType($item)
     {
         if(preg_match("/^user\//", $item['path'])) return('userFolder');
@@ -46,6 +54,7 @@ class FolderWidget extends plugin
     function setFolderList($arr)
     {
         $this->folderList = $this->buildRecursiveList($arr, $this->pathSeperator);
+        print_a($this->folderList);
     }
 
 
@@ -61,18 +70,18 @@ class FolderWidget extends plugin
         $ret = array();
 
         // Add root Entry
-        $data[$this->rootBase] = array(); 
-        $data[$this->rootBase]['name'] = $this->rootName;
-        $data[$this->rootBase]['status'] = '';
-        $data[$this->rootBase]['acls'] = array();
-        $data[$this->rootBase]['path'] = $this->rootName;
-        $data[$this->rootBase]['type'] = 'manual';
-        $data[$this->rootBase]['base'] = $this->rootBase;
-        $data[$this->rootBase]['parentPath'] = "";
-        $data[$this->rootBase]['children'] = array();
-        $ret['linear'][$this->rootBase] = &$data[$this->rootBase];
-
-        $base = &$data[$this->rootBase]['children'];
+        $data[$this->accountPrefix] = array(); 
+        $data[$this->accountPrefix]['name'] = $this->rootName;
+        $data[$this->accountPrefix]['status'] = '';
+        $data[$this->accountPrefix]['acls'] = array();
+        $data[$this->accountPrefix]['path'] = $this->rootName;
+        $data[$this->accountPrefix]['type'] = 'manual';
+        $data[$this->accountPrefix]['base'] = $this->rootBase;
+        $data[$this->accountPrefix]['parentPath'] = "";
+        $data[$this->accountPrefix]['children'] = array();
+        $ret['linear'][$this->accountPrefix] = &$data[$this->accountPrefix];
+
+        $base = &$data[$this->accountPrefix]['children'];
         $last = NULL;
         foreach($arr as $path => $entry){
 
@@ -84,11 +93,11 @@ class FolderWidget extends plugin
             $pathSteps = preg_split("/".preg_quote($seperator,'/')."/", $path);
             $entryPath = "";
             $parentPath = "";
-            $entryBase = $this->rootBase;
+            $entryBase = "";
             foreach($pathSteps as $name){
                 $parentPath = $entryPath;
                 $entryPath = (empty($entryPath)) ? $name : "{$entryPath}{$seperator}{$name}";
-                $entryBase =  trim("cn={$name},{$entryBase}", ' ,');
+                $entryBase =  $this->pathToDn($entryPath);
 
                 // Add eventually missing subFolders, to enable the navigation 
                 //  into these folders via the management lists.