being able to conditionally trigger quotaDisplayRefresh on mail_refreshFolderStatus; use new lock_tree/unlock_tree on changeFolder

This commit is contained in:
Klaus Leithoff 2014-01-21 11:28:43 +00:00
parent 93ae56a9f2
commit 2eb18c1d4e
2 changed files with 16 additions and 38 deletions

View File

@ -534,40 +534,7 @@ class mail_ui
_debug_array($preferences);
//error_log(__METHOD__.__LINE__.' ImapServerId:'.$imapServer->ImapServerId.' Prefs:'.array2string($preferences->preferences));
//error_log(__METHOD__.__LINE__.' ImapServerObject:'.array2string($imapServer));
if (is_object($preferences)) $activeIdentity =& $preferences->getIdentity($icServerID, true);
//_debug_array($activeIdentity);
$maxMessages = 50;
// retrieve data for/from user defined accounts
$selectedID = 0;
if (count($preferences->ic_server)) {
foreach ($preferences->ic_server as $tmpkey => $accountData)
{
if ($tmpkey==0) continue;
$identity =& $preferences->identities[$tmpkey];
$icServer =& $accountData;
//_debug_array($identity);
//_debug_array($icServer);
//error_log(__METHOD__.__LINE__.' Userdefined Profiles ImapServerId:'.$icServer->ImapServerId);
if (empty($icServer->host)) continue;
$identities[$identity->id]=$identity->realName.' '.$identity->organization.' <'.$identity->emailAddress.'>';
if (!empty($identity->default)) $identities[$identity->id] = $identities[$identity->id].'<b>('.lang('selected').')</b>';
}
}
if (count($identities)>0)
{
echo "<hr /><h3 style='color:red'>".lang('available personal EMail-Accounts/Profiles')."</h3>";
_debug_array($identities);
}
if (empty($imapServer->host) && count($identities)==0 && $preferences->userDefinedAccounts)
{
// redirect to new personal account
egw::redirect_link('/index.php',array('menuaction'=>'felamimail.uipreferences.editAccountData',
'accountID'=>"new",
'msg' => lang("There is no IMAP Server configured.")." - ".lang("Please configure access to an existing individual IMAP account."),
));
}
common::egw_footer();
}
@ -1372,7 +1339,13 @@ unset($query['actions']);
$endtime = microtime(true) - $starttime;
//error_log(__METHOD__.__LINE__. " time used: ".$endtime.' for Folder:'.$_folderName.' Start:'.$query['start'].' NumRows:'.$query['num_rows']);
//ajax_get_rows
//error_log(__METHOD__.__LINE__.' MenuactionCalled:'.$_GET['menuaction'].'->'.function_backtrace());
if (stripos($_GET['menuaction'],'ajax_get_rows')!==false)
{
$response = egw_json_response::get();
$response->call('app.mail.unlock_tree');
}
return $rowsFetched['messages'];
}

View File

@ -697,7 +697,7 @@ app.classes.mail = AppJS.extend(
* @param _nodeID
* @param mode
*/
mail_refreshFolderStatus: function(_nodeID,mode,_refreshGridArea) {
mail_refreshFolderStatus: function(_nodeID,mode,_refreshGridArea,_refreshQuotaDisplay) {
if (typeof _nodeID != 'undefined' && typeof _nodeID[_nodeID] != 'undefined' && _nodeID[_nodeID])
{
_refreshGridArea = _nodeID[_refreshGridArea];
@ -707,6 +707,7 @@ app.classes.mail = AppJS.extend(
var nodeToRefresh = 0;
var mode2use = "none";
if (typeof _refreshGridArea == 'undefined') _refreshGridArea=true;
if (typeof _refreshQuotaDisplay == 'undefined') _refreshQuotaDisplay=true;
if (_nodeID) nodeToRefresh = _nodeID;
if (mode) {
if (mode == "forced") {mode2use = mode;}
@ -720,12 +721,15 @@ app.classes.mail = AppJS.extend(
this.mail_queueRefreshFolderList(activeFolders);
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();
}
if (_refreshQuotaDisplay)
{
this.mail_refreshQuotaDisplay();
}
//the two lines below are not working yet.
//var no =tree_wdg.getSelectedNode();
//tree_wdg.focusItem(no.id);
@ -1054,7 +1058,7 @@ app.classes.mail = AppJS.extend(
.sendRequest(true);
// since the json reply is using egw_refresh, we should not need to call refreshFolderStatus
// as the actions thereof are now bound to run after grid refresh
//this.mail_refreshFolderStatus();
//this.mail_g();
},
/**
@ -1102,6 +1106,7 @@ app.classes.mail = AppJS.extend(
var nm = _widget.getRoot().getWidgetById(this.nm_index);
if(nm)
{
this.lock_tree();
// Changing dataset entirely, force a reset
nm.controller.reset();
nm.applyFilters({'selectedFolder': folder});
@ -1122,7 +1127,7 @@ app.classes.mail = AppJS.extend(
if (profileChange == false) egw_message(myMsg);
//mail_refreshMessageGrid();// its done in refreshFolderStatus already
this.mail_refreshFolderStatus(folder,'forced');
this.mail_refreshFolderStatus(folder,'forced',false,false);
this.mail_refreshQuotaDisplay(server[0]);
this.mail_fetchCurrentlyFocussed(null,true);
this.mail_preview();