fix not opened tree with new tree-code, if you have only one account and fix state-handling to also store ActiveProfileID pref for a single account

This commit is contained in:
Ralf Becker 2015-08-21 08:01:42 +00:00
parent 8f214e1e9a
commit 3748005f8b
2 changed files with 49 additions and 50 deletions

View File

@ -490,7 +490,7 @@ class mail_tree
* 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 string $_profileID = '' active profile / acc_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
@ -499,12 +499,11 @@ class mail_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);
$tree = $this->getTree($_parent, '', $_openTopLevel, false, $_subscribedOnly, $_allInOneGo);
$branches = $this->getTree($_profileID, $_profileID,1,false,$_subscribedOnly,$_allInOneGo);
foreach ($tree[tree::CHILDREN] as &$account)
{
if ($account[tree::ID] == $activeAccount)
if ($account[tree::ID] == $_profileID)
{
$account = $branches;
}

View File

@ -483,7 +483,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->getInitialIndexTree(null, null, null, true,!$this->mail_bo->mailPreferences['showAllFoldersInFolderPane']);
$sel_options[self::$nm_index]['foldertree'] = $this->mail_tree->getInitialIndexTree(null, $this->mail_bo->profileID, 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');