Code

Updated entry listing of the new folder widget and removed hard coded base generation
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Oct 2010 14:15:37 +0000 (14:15 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Oct 2010 14:15:37 +0000 (14:15 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19939 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index e51f4c09eaa95ce959ab811b7b2c06081c244fe5..4a4541eeba9686dc828a883fde4129461c21953d 100644 (file)
@@ -5,6 +5,12 @@
 
 class FolderWidget extends plugin
 {
+
+    private $pathSeperator = "/";
+    private $rootName = "/";
+    private $fakeCnAttr = "cn=";
+    private $rootBase = "";
+
     public $config;
     private $FolderWidgetListing = NULL;
     private $folderList;
@@ -13,7 +19,12 @@ class FolderWidget extends plugin
 
     function __construct(&$config)
     {
-        $this->FolderWidgetListing = new FolderWidgetListing($this->config, get_userinfo());
+        $this->rootBase = $this->fakeCnAttr.$this->rootName;
+        $this->FolderWidgetListing = new FolderWidgetListing($this->config, get_userinfo(), $this->rootBase);
+        $this->FolderWidgetListing->setBase($this->rootBase);
+        $this->FolderWidgetListing->setFolderRoot($this->rootBase);
+
+        
     }
 
 
@@ -21,9 +32,7 @@ class FolderWidget extends plugin
      */
     function setFolderList($arr)
     {
-        $this->folderList = $this->buildRecursiveList($arr, '/');
-        $this->FolderWidgetListing->setBase('cn=/');
-        $this->FolderWidgetListing->setFolderRoot('cn=/');
+        $this->folderList = $this->buildRecursiveList($arr, $this->pathSeperator);
     }
 
 
@@ -39,22 +48,22 @@ class FolderWidget extends plugin
         $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'];
+        $data[$this->rootBase] = array(); 
+        $data[$this->rootBase]['name'] = $this->rootName;
+        $data[$this->rootBase]['status'] = '';
+        $data[$this->rootBase]['path'] = $this->rootName;
+        $data[$this->rootBase]['type'] = 'manual';
+        $data[$this->rootBase]['base'] = $this->rootBase;
+        $data[$this->rootBase]['children'] = array();
+        $ret['linear'][$this->rootBase] = &$data[$this->rootBase];
+
+        $base = &$data[$this->rootBase]['children'];
         $last = NULL;
         foreach($arr as $path => $entry){
             $current = &$base;
             $pathSteps = preg_split("/".preg_quote($seperator,'/')."/", $path);
             $entryPath = "";
-            $entryBase = "cn=/";
+            $entryBase = $this->rootBase;
             foreach($pathSteps as $name){
                 $entryPath = (empty($entryPath)) ? $name : "{$entryPath}{$seperator}{$name}";
                 $entryBase =  trim("cn={$name},{$entryBase}", ' ,');
index 2460a99528282c0c55ae3a41170a5fcb1773d05b..14bdf17fe8f40a62b0613d399ac99a8f6b5f6e58 100644 (file)
@@ -6,13 +6,14 @@ class FolderWidgetListing extends management
     private $folderSelector = NULL; 
     private $folderList = array();
 
-    private $rootBase = 'cn=/';
+    private $rootBase = '';
 
-    function __construct($config,$ui)
+    function __construct($config,$ui, $rootBase)
     {
         $this->config = $config;
         $this->ui = $ui;
         $this->storagePoints = array("");
+        $this->rootBase = $rootBase;
 
         // Build filter
         if (FALSE && session::global_is_set(get_class($this)."_filter")){