]> git.tokkee.org Git - gosa.git/commitdiff

Code

Fixed parent problem
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Oct 2010 14:26:15 +0000 (14:26 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Oct 2010 14:26:15 +0000 (14:26 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19940 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 6344097491c0faf0c7431c77fb4f406fb7f7b94e..66af0338957201411490d28143f123dcc45a05cb 100644 (file)
     </column>
 
     <column>
-      <label>Description</label>
-      <sortAttribute>description</sortAttribute>
+      <label>Type</label>
+      <sortAttribute>folderType</sortAttribute>
       <sortType>string</sortType>
-      <value>%{filter:link(row,dn,"%s",description)}</value>
+      <value>%{filter:link(row,dn,"%s",folderType)}</value>
       <export>true</export>
     </column>
 
index 4a4541eeba9686dc828a883fde4129461c21953d..2f8e122f6c0b2e0a6c038c99562d3ac75437681e 100644 (file)
@@ -23,8 +23,12 @@ class FolderWidget extends plugin
         $this->FolderWidgetListing = new FolderWidgetListing($this->config, get_userinfo(), $this->rootBase);
         $this->FolderWidgetListing->setBase($this->rootBase);
         $this->FolderWidgetListing->setFolderRoot($this->rootBase);
+    }
 
-        
+    function getFolderType($item)
+    {
+        if(preg_match("/^user\//", $item['path'])) return('userFolder');
+        if(preg_match("/^shared\//", $item['path'])) return('sharedFolder');
     }
 
 
@@ -54,6 +58,7 @@ class FolderWidget extends plugin
         $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];
 
@@ -63,8 +68,10 @@ class FolderWidget extends plugin
             $current = &$base;
             $pathSteps = preg_split("/".preg_quote($seperator,'/')."/", $path);
             $entryPath = "";
+            $parentPath = "";
             $entryBase = $this->rootBase;
             foreach($pathSteps as $name){
+                $parentPath = $entryPath;
                 $entryPath = (empty($entryPath)) ? $name : "{$entryPath}{$seperator}{$name}";
                 $entryBase =  trim("cn={$name},{$entryBase}", ' ,');
                 if(!isset($current[$entryPath])){
@@ -75,6 +82,9 @@ class FolderWidget extends plugin
                     $current[$entryPath]['status'] = '';
                     $current[$entryPath]['type'] = 'manual';
                     $current[$entryPath]['base'] = $entryBase;
+                    $current[$entryPath]['parentPath'] = $entryPath;
+                    $current[$entryPath]['folderType'] = $this->getFolderType($current[$entryPath]);
+                    
                     $ret['linear'][$entryPath] = &$current[$entryPath];
                     $this->baseEntryMap[$entryBase] = $entryPath;
                 }
index 083df4fe5301fe79e4f1eb9feac81b1d16f927e8..37b6f1854a141edf27df34be188a3be05dcf5989 100644 (file)
@@ -17,17 +17,17 @@ class filterFolderWidget {
         foreach($data['linear'] as $item){
             if($item['base'] == $base){
                 $items = $item['children'];
+                $parent = $item['parentPath'];
                 break;
             }
-            $parent = $item;
         }
 
-
         // Add entries
         $ret = array();
-        if($parent != NULL){
-            $parent['name'] = '..';
-            filterFolderWidget::addEntry($ret, $parent, FALSE, $filter);
+        if(isset($data['linear'][$parent])){
+            $item = $data['linear'][$parent];
+            $item['name'] = '.';
+            filterFolderWidget::addEntry($ret, $item, FALSE, $filter);
         }
         foreach($items as $item){
             filterFolderWidget::addEntry($ret, $item, $scope == 'sub', $filter);
@@ -43,9 +43,11 @@ class filterFolderWidget {
             $entry[] = 'dn';
             $entry['cn'] = array($item['name'], 'count' => 1);
             $entry[] = 'cn';
-            $entry['objectClass'] = array('FAKE_OC_GroupwareFolder','count' => 1);
+            $entry['folderType'] = array($item['folderType'], 'count' => 1);
+            $entry[] = 'folderType';
+            $entry['objectClass'] = array('FAKE_OC_Groupware_'.$item['folderType'],'count' => 1);
             $entry[] = 'objectClass';
-            $entry['count'] = 3;
+            $entry['count'] = 4;
             $ret[] = $entry;
         }