From ecd01db9021a4fe0c7c6eed9d266d74264ffe2dd Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 7 Oct 2010 14:26:15 +0000 Subject: [PATCH] Fixed parent problem git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19940 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../groupware/FolderWidget/FolderWidget-list.xml | 6 +++--- .../FolderWidget/class_FolderWidget.inc | 12 +++++++++++- .../FolderWidget/class_filterFolderWidget.inc | 16 +++++++++------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/FolderWidget-list.xml b/gosa-plugins/groupware/personal/groupware/FolderWidget/FolderWidget-list.xml index 634409749..66af03389 100644 --- a/gosa-plugins/groupware/personal/groupware/FolderWidget/FolderWidget-list.xml +++ b/gosa-plugins/groupware/personal/groupware/FolderWidget/FolderWidget-list.xml @@ -37,10 +37,10 @@ - - description + + folderType string - %{filter:link(row,dn,"%s",description)} + %{filter:link(row,dn,"%s",folderType)} true diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc index 4a4541eeb..2f8e122f6 100644 --- a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc +++ b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc @@ -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; } diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_filterFolderWidget.inc b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_filterFolderWidget.inc index 083df4fe5..37b6f1854 100644 --- a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_filterFolderWidget.inc +++ b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_filterFolderWidget.inc @@ -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; } -- 2.39.5