diff --git a/mail/inc/class.mail_tree.inc.php b/mail/inc/class.mail_tree.inc.php index 5589a4682a..ac18621350 100644 --- a/mail/inc/class.mail_tree.inc.php +++ b/mail/inc/class.mail_tree.inc.php @@ -383,11 +383,12 @@ class mail_tree $data[tree::IMAGE_LEAF] = self::$leafImages['folderHome']; $data[tree::IMAGE_FOLDER_OPEN] = self::$leafImages['folderHome']; $data[tree::IMAGE_FOLDER_CLOSED] = self::$leafImages['folderHome']; + $data[tree::LABEL] = lang($folderName); + $data[tree::TOOLTIP] = lang($folderName); } - // User defined folders may get different icons // plus they need to be translated too - if (array_search($data['folderarray']['MAILBOX'], $definedFolders, true) !== false) + elseif (array_search($data['folderarray']['MAILBOX'], $definedFolders, true) !== false) { $data[tree::LABEL] = lang($folderName); $data[tree::TOOLTIP] = lang($folderName); @@ -461,4 +462,33 @@ class mail_tree } return $roots; } + + /** + * Initialization tree for index sidebox menu + * + * This function gets all accounts root nodes and then + * fill the active accounts with its children. + * + * @param string $_parent = null no parent node means root with the first level of folders + * @param string $_profileID = '' icServer id + * @param int|boolean $_openTopLevel = 1 Open top level folders on load if it's set to 1|true, + * false|0 leaves them in closed state + * @param boolean $_subscribedOnly = false get only subscribed folders + * @param boolean $_allInOneGo = false, true will get all folders (dependes on subscribedOnly option) of the account in one go + * @return type an array of tree + */ + function getInitialIndexTree ($_parent = null, $_profileID = '', $_openTopLevel = 1, $_subscribedOnly= false, $_allInOneGo = false) + { + $tree = $this->getTree($_parent, $_profileID, $_openTopLevel, false, $_subscribedOnly, $_allInOneGo); + $activeAccount = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']; + $branches = $this->getTree($activeAccount, $activeAccount,1,false,$_subscribedOnly,$_allInOneGo); + foreach ($tree[tree::CHILDREN] as &$account) + { + if ($account[tree::ID] == $activeAccount) + { + $account = $branches; + } + } + return $tree; + } } diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index a48021a4c1..13f8c42100 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -482,7 +482,7 @@ class mail_ui $content[self::$nm_index]['vacationrange'] = $sel_options[self::$nm_index]['vacationrange'] = ''; } //$zstarttime = microtime (true); - $sel_options[self::$nm_index]['foldertree'] = $this->mail_tree->getTree(null, null, null, false, true,true ); + $sel_options[self::$nm_index]['foldertree'] = $this->mail_tree->getInitialIndexTree(null, null, null, true,!$this->mail_bo->mailPreferences['showAllFoldersInFolderPane']); //$zendtime = microtime(true) - $zstarttime; //error_log(__METHOD__.__LINE__. " time used: ".$zendtime); $content[self::$nm_index]['selectedFolder'] = $this->mail_bo->profileID.self::$delimiter.(!empty($this->mail_bo->sessionData['mailbox'])?$this->mail_bo->sessionData['mailbox']:'INBOX');