summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bbc7385)
raw | patch | inline | side by side (parent: bbc7385)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 13 Oct 2010 11:25:35 +0000 (11:25 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 13 Oct 2010 11:25:35 +0000 (11:25 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20025 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 b98c5be2aed87d7fbec50bad990667c034f087fe..bf04f1b3a5540c00bdd89d116568581fd38f2760 100644 (file)
// effect on the results.
$this->rootBase = $this->fakeCnAttr.$this->rootName;
- $this->accountPrefix = (empty($accountPrefix)) ? "" : rtrim($accountPrefix,$this->pathSeparator).$this->pathSeparator;
+ // Remove trailing / from accountPrefix.
+ $this->accountPrefix = (empty($accountPrefix)) ? "" : rtrim($accountPrefix,$this->pathSeparator);
$this->rootBase = $this->pathToDn($accountPrefix);
// Update the folder list, initially.
*/
function setFolderList($arr)
{
- $this->folderList = $this->buildRecursiveList($arr, $this->pathSeparator);
+ print_a($arr);
+ $this->buildRecursiveList($arr, $this->pathSeparator);
+ print_a($this->folderList);
}
$ret = array();
// Add root Entry
- $data[$this->accountPrefix] = array();
- $data[$this->accountPrefix]['name'] = $this->rootName;
- $data[$this->accountPrefix]['status'] = '';
- $data[$this->accountPrefix]['acls'] = array();
- $data[$this->accountPrefix]['path'] = $this->accountPrefix;
- $data[$this->accountPrefix]['type'] = 'manual';
- $data[$this->accountPrefix]['base'] = $this->rootBase;
- $data[$this->accountPrefix]['parentPath'] = "";
- $data[$this->accountPrefix]['children'] = array();
- $this->baseEntryMap[$this->rootBase] = $this->accountPrefix;
- $ret['linear'][$this->accountPrefix] = &$data[$this->accountPrefix];
-
- $base = &$data[$this->accountPrefix]['children'];
- $last = NULL;
- foreach($arr as $path => $entry){
+ $data['/'] = array();
+ $data['/']['name'] = '/';
+ $data['/']['status'] = '';
+ $data['/']['acls'] = array();
+ $data['/']['path'] = '/';
+ $data['/']['type'] = 'manual';
+ $data['/']['base'] = 'cn=/';
+ $data['/']['parentPath'] = "";
+ $data['/']['children'] = array();
+
+ $this->baseEntryMap = array();
+ $this->baseEntryMap['cn=/'] = '/';
+ $this->folderList = array();
+ $this->folderList['linear']['/'] = &$data['/'];
+ $this->folderList['recursive']['/'] = &$data['/'];
+
+ foreach($arr as $path => $data){
+ $name = $data['name'];
+ $acls = $data['acls'];
+ $status = $data['status'];
+ $this->addPath($path, $name, $acls, $status);
+ }
+ }
+
- // Only add entries that match the accountPrefix
- // e.g. "/user/admin/"
- if(!preg_match("/^".preg_quote($this->accountPrefix,'/')."/", $path)) continue;
+ /*! \brief Adds a new folder entry to the used folderList.
+ */
+ function addPath($path, $name, $acls = array(), $status = "")
+ {
+ $base = &$this->folderList['linear']['/']['children'];
+ $last = NULL;
+ // Only add entries that match the accountPrefix
+ // e.g. "/user/admin/"
+ $path = rtrim($path,$this->pathSeparator);
+ if(!preg_match("/^".preg_quote($this->accountPrefix,'/')."/", $path)){
+ // Skipping not mathing folders.
+ }else{
$current = &$base;
- $pathSteps = preg_split("/".preg_quote($separator,'/')."/", $path);
+ $pathSteps = preg_split("/".preg_quote($this->pathSeparator,'/')."/", $path);
$entryPath = "";
$parentPath = "";
$entryBase = "";
- foreach($pathSteps as $name){
+
+ // Walk through path entries and add missing entries to our folder list
+ foreach($pathSteps as $pathName){
+
+ // The parent path is the last path.
$parentPath = $entryPath;
- $entryPath = (empty($entryPath)) ? $name : "{$entryPath}{$separator}{$name}";
+
+ // Calculate entry path by combining last path and current pathName.
+ $entryPath = (empty($entryPath)) ? $pathName : "{$entryPath}{$this->pathSeparator}{$pathName}";
$entryBase = $this->pathToDn($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'];
+ if(!isset($current[$entryPath])){
+ $current[$entryPath] = array();
+ $current[$entryPath]['children'] = array();
+ $current[$entryPath]['name'] = $pathName;
+ $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]);
+
+ $this->folderList['linear'][$entryPath] = &$current[$entryPath];
+ $this->baseEntryMap[$entryBase] = $entryPath;
}
+
+ // Remeber the last added sub-folder and update the current folder position.
+ $last = &$current[$entryPath];
+ $current = &$current[$entryPath]['children'];
}
- $last['acls'] = $entry['acls'];
- $last['name'] = $entry['name'];
+
+ // Now that we've created all subfolders we can set the folder
+ // paramters of the folder we originally wanted to add.
+ $last['acls'] = $acls;
+ $last['name'] = $name;
$last['type'] = 'real';
- $last['status'] = $entry['status'];
- $ret['linear'][$path] = &$last;
+ $last['status'] = $status;
}
- $ret['recursive'] = $data;
- return($ret);
}
-
-
+
+
/*! \brief Initiates editing of a folder, a sub dialog will be shown on next
* render() call. this sub-dialog allows to edit the ACLs for the folder.
*/