summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 84c204f)
raw | patch | inline | side by side (parent: 84c204f)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 8 Oct 2010 09:20:27 +0000 (09:20 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 8 Oct 2010 09:20:27 +0000 (09:20 +0000) |
-Allow to add a starting prefix,
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19950 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19950 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc | patch | blob | history |
diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc
index fc94f2818b8c1fa2e8a6ced252926499ec8403ef..eacf21e51a502c99bdc5b5fab5461e7c415988c4 100644 (file)
private $baseEntryMap = array();
- function __construct(&$config)
+ function __construct(&$config, $folderList, $accountPrefix)
{
+ // The rootBase is a dn-like representation of the root path
+ // e.g. rootPath is '/' then is the rootBase 'cn=/'
+ // 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,'/').'/';
+
+ // Update the folder list, initially.
+ $this->setFolderList($folderList);
$this->FolderWidgetListing = new FolderWidgetListing($this->config, get_userinfo(), $this->rootBase, $this);
$this->FolderWidgetListing->setBase($this->rootBase);
$this->FolderWidgetListing->setFolderRoot($this->rootBase);
$base = &$data[$this->rootBase]['children'];
$last = NULL;
foreach($arr as $path => $entry){
+
+ // Only add entries that match the accountPrefix
+ // e.g. "/user/admin/"
+ if(!preg_match("/^".preg_quote($this->accountPrefix,'/')."/", $path)) continue;
+
$current = &$base;
$pathSteps = preg_split("/".preg_quote($seperator,'/')."/", $path);
$entryPath = "";
$parentPath = $entryPath;
$entryPath = (empty($entryPath)) ? $name : "{$entryPath}{$seperator}{$name}";
$entryBase = trim("cn={$name},{$entryBase}", ' ,');
- if(!isset($current[$entryPath])){
- $current[$entryPath] = array();
- $current[$entryPath]['children'] = array();
- $current[$entryPath]['name'] = $name;
- $current[$entryPath]['path'] = $path;
- $current[$entryPath]['status'] = '';
- $current[$entryPath]['acls'] = array();
- $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;
+
+ // Add eventually missing subFolders, to enable the navigation
+ // into these folders via the management lists.
+ if(preg_match("/^".preg_quote($this->accountPrefix,'/')."/", $entryPath)){
+ if(!isset($current[$entryPath])){
+ $current[$entryPath] = array();
+ $current[$entryPath]['children'] = array();
+ $current[$entryPath]['name'] = $name;
+ $current[$entryPath]['path'] = $path;
+ $current[$entryPath]['status'] = '';
+ $current[$entryPath]['acls'] = array();
+ $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;
+ }
+ $last = &$current[$entryPath];
+ $current = &$current[$entryPath]['children'];
}
- $last = &$current[$entryPath];
- $current = &$current[$entryPath]['children'];
}
$last['acls'] = $entry['acls'];
$last['name'] = $entry['name'];