diff --git a/mail/inc/class.mail_bo.inc.php b/mail/inc/class.mail_bo.inc.php index 3088d3fbeb..0320a51e44 100644 --- a/mail/inc/class.mail_bo.inc.php +++ b/mail/inc/class.mail_bo.inc.php @@ -1731,7 +1731,7 @@ class mail_bo */ function getFolderObjects($_subscribedOnly=false, $_getCounters=false, $_alwaysGetDefaultFolders=false,$_useCacheIfPossible=true) { - if (self::$debug) error_log(__METHOD__.__LINE__.' '."subscribedOnly:$_subscribedOnly, getCounters:$_getCounters, alwaysGetDefaultFolders:$_alwaysGetDefaultFolders"); + if (self::$debug) error_log(__METHOD__.__LINE__.' ServerID:'.$this->icServer->ImapServerId.", subscribedOnly:$_subscribedOnly, getCounters:$_getCounters, alwaysGetDefaultFolders:$_alwaysGetDefaultFolders, _useCacheIfPossible:$_useCacheIfPossible"); static $folders2return; if ($_subscribedOnly && $_getCounters===false) { @@ -2048,8 +2048,14 @@ class mail_bo if (is_array($folders)) uasort($folders,array($this,"sortByDisplayName")); //$folders2return = array_merge($autoFolderObjects,$folders); //_debug_array($folders2return); #exit; - $folders2return[$this->icServer->ImapServerId] = array_merge($inboxFolderObject,$autoFolderObjects,(array)$folders); - if ($_subscribedOnly && $_getCounters===false) egw_cache::setCache(egw_cache::INSTANCE,'email','folderObjects'.trim($GLOBALS['egw_info']['user']['account_id']),$folders2return,$expiration=60*60*1); + $folders2return[$this->icServer->ImapServerId] = array_merge((array)$inboxFolderObject,(array)$autoFolderObjects,(array)$folders); + if (($_subscribedOnly && $_getCounters===false) || + ($_subscribedOnly == false && $_getCounters===false && + isset($this->mailPreferences['showAllFoldersInFolderPane']) && + $this->mailPreferences['showAllFoldersInFolderPane']==1)) + { + egw_cache::setCache(egw_cache::INSTANCE,'email','folderObjects'.trim($GLOBALS['egw_info']['user']['account_id']),$folders2return,$expiration=60*60*1); + } return $folders2return[$this->icServer->ImapServerId]; } diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index e29dae9c4b..58e3ed5c4c 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -183,7 +183,7 @@ class mail_ui */ function index(array $content=null,$msg=null) { - //$starttime = microtime (true); + $starttime = microtime (true); $this->mail_bo->restoreSessionData(); $sessionFolder = $this->mail_bo->sessionData['mailbox']; if ($this->mail_bo->folderExists($sessionFolder)) @@ -261,7 +261,10 @@ class mail_ui $content[self::$nm_index]['quotanotsupported'] = $sel_options[self::$nm_index]['quotanotsupported'] = "mail_DisplayNone"; } + //$zstarttime = microtime (true); $sel_options[self::$nm_index]['foldertree'] = $this->getFolderTree(false); + //$zendtime = microtime(true) - $zstarttime; + //error_log(__METHOD__.__LINE__. " time used: ".$zendtime); //$sessionFolder = $this->mail_bo->sessionData['mailbox'];// already set and tested this earlier //if ($this->mail_bo->folderExists($sessionFolder)) @@ -349,7 +352,7 @@ class mail_ui if (empty($content[self::$nm_index]['filter2']) || empty($content[self::$nm_index]['search'])) $content[self::$nm_index]['filter2']='quick'; $readonlys = $preserv = $sel_options; - //$endtime = microtime(true) - $starttime; + $endtime = microtime(true) - $starttime; //error_log(__METHOD__.__LINE__. " time used: ".$endtime); return $etpl->exec('mail.mail_ui.index',$content,$sel_options,$readonlys,$preserv); @@ -549,7 +552,10 @@ class mail_ui } } } - $folderObjects = $this->mail_bo->getFolderObjects(true,false,true); + //$starttime = microtime(true); + $folderObjects = $this->mail_bo->getFolderObjects(true,false,false,true); + //$endtime = microtime(true) - $starttime; + //error_log(__METHOD__.__LINE__.' Fetching folderObjects took: '.$endtime); $trashFolder = $this->mail_bo->getTrashFolder(); $templateFolder = $this->mail_bo->getTemplateFolder(); $draftFolder = $this->mail_bo->getDraftFolder(); @@ -1087,7 +1093,7 @@ class mail_ui unset($query['actions']); //_debug_array($query); //error_log(__METHOD__.__LINE__.array2string($query['order']).'->'.array2string($query['sort'])); -error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Start:'.$query['start'].' NumRows:'.$query['num_rows']); +//error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Start:'.$query['start'].' NumRows:'.$query['num_rows']); $starttime = microtime(true); //error_log(__METHOD__.__LINE__.array2string($query['search'])); //$query['search'] is the phrase in the searchbox @@ -1209,7 +1215,7 @@ error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Star $rows = $this->header2gridelements($sortResult['header'],$cols, $_folderName, $folderType,$previewMessage); //error_log(__METHOD__.__LINE__.array2string($rows)); $endtime = microtime(true) - $starttime; - error_log(__METHOD__.__LINE__. " time used: ".$endtime.' for Folder:'.$_folderName); + //error_log(__METHOD__.__LINE__. " time used: ".$endtime.' for Folder:'.$_folderName.' Start:'.$query['start'].' NumRows:'.$query['num_rows']); return $rowsFetched['messages']; } diff --git a/mail/js/app.js b/mail/js/app.js index 2787838f2e..d4aa63756b 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -97,7 +97,7 @@ app.classes.mail = AppJS.extend( this.mail_startTimerFolderStatusUpdate(this.mail_refreshTimeOut); //inital call of refresh folderstatus var self = this; - window.setTimeout(function() {self.mail_refreshFolderStatus.apply(self);},1000); + window.setTimeout(function() {self.mail_refreshFolderStatus.call(self,undefined,undefined,false);},1000); } if (isDisplay) { @@ -500,7 +500,7 @@ app.classes.mail = AppJS.extend( this.mail_disablePreviewArea(true); return; } - //console.log("mail_preview",dataElem); + console.log("mail_preview",dataElem); this.mail_selectedMails.push(_id); var subject =dataElem.data.subject; this.mail_disablePreviewArea(false); @@ -551,7 +551,7 @@ app.classes.mail = AppJS.extend( if(_refreshTimeOut > 9999) {//we do not set _refreshTimeOut's less than 10 seconds var self = this; this.mail_doTimedRefresh = window.setInterval(function() { - self.mail_refreshFolderStatus.apply(self); + self.mail_refreshFolderStatus.call(self,undefined,undefined,true); }, _refreshTimeOut); } }, @@ -562,9 +562,10 @@ app.classes.mail = AppJS.extend( * @param _nodeID * @param mode */ - mail_refreshFolderStatus: function(_nodeID,mode) { + mail_refreshFolderStatus: function(_nodeID,mode,_refreshGridArea) { var nodeToRefresh = 0; var mode2use = "none"; + if (typeof _refreshGridArea == 'undefined') _refreshGridArea=true; if (_nodeID) nodeToRefresh = _nodeID; if (mode) { if (mode == "forced") {mode2use = mode;} @@ -576,11 +577,14 @@ app.classes.mail = AppJS.extend( var activeFolders = tree_wdg.getTreeNodeOpenItems(nodeToRefresh,mode2use); //alert(activeFolders.join('#,#')); this.mail_queueRefreshFolderList(activeFolders); - this.mail_refreshQuotaDisplay(); - // maybe to use the mode forced as trigger for grid reload and using the grids own autorefresh - // would solve the refresh issue more accurately - //if (mode == "forced") this.mail_refreshMessageGrid(); - this.mail_refreshMessageGrid(); + if (_refreshGridArea) + { + this.mail_refreshQuotaDisplay(); + // maybe to use the mode forced as trigger for grid reload and using the grids own autorefresh + // would solve the refresh issue more accurately + //if (mode == "forced") this.mail_refreshMessageGrid(); + this.mail_refreshMessageGrid(); + } } catch(e) { } // ignore the error; maybe the template is not loaded yet },