From 8a415f64b87c2a9af413ba69c201ada15908f61f Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 7 Oct 2010 14:15:37 +0000 Subject: [PATCH] Updated entry listing of the new folder widget and removed hard coded base generation git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19939 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../FolderWidget/class_FolderWidget.inc | 39 ++++++++++++------- .../class_FolderWidgetListing.inc | 5 ++- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc index e51f4c09e..4a4541eeb 100644 --- a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc +++ b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc @@ -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}", ' ,'); diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidgetListing.inc b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidgetListing.inc index 2460a9952..14bdf17fe 100644 --- a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidgetListing.inc +++ b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidgetListing.inc @@ -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")){ -- 2.30.2