From 005194488e7efbc9507832ed33d1b6a2b95b55ae Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 13 Oct 2010 09:16:07 +0000 Subject: [PATCH] Updated Shared Folder Widget -Added gwFolderList git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20021 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_GroupwareSharedFolder.inc | 45 +++++++++++++++---- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/gosa-plugins/groupware/admin/groups/GroupwareSharedFolder/class_GroupwareSharedFolder.inc b/gosa-plugins/groupware/admin/groups/GroupwareSharedFolder/class_GroupwareSharedFolder.inc index 232f24f43..88c6311e3 100644 --- a/gosa-plugins/groupware/admin/groups/GroupwareSharedFolder/class_GroupwareSharedFolder.inc +++ b/gosa-plugins/groupware/admin/groups/GroupwareSharedFolder/class_GroupwareSharedFolder.inc @@ -110,21 +110,48 @@ class GroupwareSharedFolder extends plugin if($this->cn == "" || $this->dn == "new"){ $is_account = FALSE; }else{ - // DETECT ACCOUNT STATE - } - - // Load list of folder, or in case of a new account set an initial folder list - if($is_account){ - - // Check if account exists + // Load folders for the given folderPrefix $this->folderPrefix = "shared/{$this->cn}"; - $this->folderList = $this->getFolderList(); - }else{ + $folders = $rpc->gwFolderList($this->folderPrefix); + if(!$rpc->success()){ + $this->rpcError = TRUE; + $this->rpcErrorMessage = $rpc->get_error(); + $message = sprintf(_("Failed to folder list! Error was: '%s'."), + $rpc->get_error()); + msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG); + return; + } + + // We've avalid account, if we've received at least one matching folder. + $is_account = count($folders) != 0; + + // Prepare folders to be used in the folderWidget + if($is_account){ + $folderList = array(); + foreach($folders as $path){ + $name = preg_replace("/^.*\//","",$path); + $entry = array(); + $entry['name'] = $name; + $entry['status'] = ''; + $entry['acls'] = array(); + $folderList[$path] = $entry; + } + } + } + + // We do not have a valid account, use an initial set of folders + // to be able to use the folderWidget. + // {%cn} will be replaced by the groups cn when save() is called. + if(!$is_account){ $this->folderPrefix = "shared/{%cn}"; $intialFolderEntry = array('name' => '{%cn}', 'status' => '', 'acls' => array()); + $folderList = array(); + $folderList[$this->folderPrefix] = $intialFolderEntry; } + print_a(array("--------" => $folderList)); + // Store values as current and initial values (saved_attributes) // to be able to keep track och changes. $this->is_account = $this->initially_was_account = $is_account; -- 2.30.2