operate on system flags only for filtering; try only calling this. instead of app.mail. whereever possible

This commit is contained in:
Klaus Leithoff 2014-01-09 11:26:40 +00:00
parent 49ef2c538a
commit d28b1d2500
3 changed files with 32 additions and 18 deletions

View File

@ -1572,11 +1572,24 @@ class mail_bo
case 'OLD':
$imapFilter->flag('RECENT', $set=false);
break;
// operate only on system flags
// $systemflags = array(
// 'ANSWERED', 'DELETED', 'DRAFT', 'FLAGGED', 'RECENT', 'SEEN'
// );
case 'UNANSWERED':
$imapFilter->flag('ANSWERED', $set=false);
$queryValid = true;
break;
case 'UNDELETED':
$imapFilter->flag('DELETED', $set=false);
$queryValid = true;
break;
case 'UNFLAGGED':
$imapFilter->flag('FLAGGED', $set=false);
$queryValid = true;
break;
case 'UNSEEN':
$imapFilter->flag($criteria, $set=false);
$imapFilter->flag('SEEN', $set=false);
$queryValid = true;
break;
}

View File

@ -1328,11 +1328,12 @@ unset($query['actions']);
if ($GLOBALS['egw_info']['user']['preferences']['common']['select_mode']=='EGW_SELECTMODE_TOGGLE') unset($cols[0]);
$rows = $this->header2gridelements($sortResult['header'],$cols, $_folderName, $folderType=$toSchema,$previewMessage);
//error_log(__METHOD__.__LINE__.array2string($rows));
$endtime = microtime(true) - $starttime;
//error_log(__METHOD__.__LINE__. " time used: ".$endtime.' for Folder:'.$_folderName.' Start:'.$query['start'].' NumRows:'.$query['num_rows']);
$response = egw_json_response::get();
$response->call('app.mail.mail_refreshFolderStatus',array('_nodeID'=>$_profileID.self::$delimiter.$_folderName,'mode'=>null,'_refreshGridArea'=>false),'mail');
$endtime = microtime(true) - $starttime;
//error_log(__METHOD__.__LINE__. " time used: ".$endtime.' for Folder:'.$_folderName.' Start:'.$query['start'].' NumRows:'.$query['num_rows']);
return $rowsFetched['messages'];
}

View File

@ -799,7 +799,7 @@ app.classes.mail = AppJS.extend(
for (var i in _status)
{
// if olddesc is undefined or #skip# then skip the message, as we process subfolders
if (typeof _status[i]['olddesc'] !== 'undefined' && _status[i]['olddesc'] !== '#skip-user-interaction-message#') app.mail.app_refresh(this.egw.lang("Renamed Folder %1 to %2",_status[i]['olddesc'],_status[i]['desc'], 'mail'));
if (typeof _status[i]['olddesc'] !== 'undefined' && _status[i]['olddesc'] !== '#skip-user-interaction-message#') this.app_refresh(this.egw.lang("Renamed Folder %1 to %2",_status[i]['olddesc'],_status[i]['desc'], 'mail'));
ftree.renameItem(i,_status[i]['id'],_status[i]['desc']);
//alert(i +'->'+_status[i]['id']+'+'+_status[i]['desc']);
if (_status[i]['id']==selectedNode.id)
@ -824,7 +824,7 @@ app.classes.mail = AppJS.extend(
for (var i in _status)
{
// if olddesc is undefined or #skip# then skip the message, as we process subfolders
if (typeof _status[i] !== 'undefined' && _status[i] !== '#skip-user-interaction-message#') app.mail.app_refresh(this.egw.lang("Removed Folder %1 ",_status[i], 'mail'));
if (typeof _status[i] !== 'undefined' && _status[i] !== '#skip-user-interaction-message#') this.app_refresh(this.egw.lang("Removed Folder %1 ",_status[i], 'mail'));
ftree.deleteItem(i,(selectedNode.id==i));
var selectedNodeAfter = ftree.getSelectedNode();
//alert(i +'->'+_status[i]['id']+'+'+_status[i]['desc']);
@ -850,7 +850,7 @@ app.classes.mail = AppJS.extend(
for (var i in _status)
{
// if olddesc is undefined or #skip# then skip the message, as we process subfolders
if (typeof _status[i] !== 'undefined' && _status[i] !== '#skip-user-interaction-message#') app.mail.app_refresh(this.egw.lang("Reloaded Folder %1 ",_status[i], 'mail'));
if (typeof _status[i] !== 'undefined' && _status[i] !== '#skip-user-interaction-message#') this.app_refresh(this.egw.lang("Reloaded Folder %1 ",_status[i], 'mail'));
ftree.refreshItem(i);
var selectedNodeAfter = ftree.getSelectedNode();
//alert(i +'->'+_status[i]['id']+'+'+_status[i]['desc']);
@ -893,7 +893,7 @@ app.classes.mail = AppJS.extend(
app_refresh: function(_msg, _app, _id, _type)
{
var bufferExists = false;
window.clearInterval(app.mail.doStatus); // whatever message was up to be activated
window.clearInterval(this.doStatus); // whatever message was up to be activated
//alert("app_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')");
//myCurrentMsg = mail_getMsg();
//if (myCurrentMsg.length) {
@ -901,9 +901,9 @@ app.classes.mail = AppJS.extend(
myMessageBuffer = ""; //myCurrentMsg;
bufferExists = true;
//}
//app.mail.mail_setMsg('<span style="font-weight: bold;">' +_msg+ '</span>');
//this.mail_setMsg('<span style="font-weight: bold;">' +_msg+ '</span>');
egw_message(_msg,_type);
app.mail.mail_setMsg('');//without that applyFilters is not refreshing the index page
this.mail_setMsg('');//without that applyFilters is not refreshing the index page
if (_app=='mail')
{
//we may want to trigger some actions, like modifying the grid, disable preview and stuff
@ -972,7 +972,7 @@ app.classes.mail = AppJS.extend(
}
var msg = this.mail_getFormData(_elems);
//alert(_action.id+','+ msg);
app.mail.app_refresh(this.egw.lang('delete messages'), 'mail');
this.app_refresh(this.egw.lang('delete messages'), 'mail');
if (!calledFromPopup) this.mail_setRowClass(_elems,'deleted');
this.mail_deleteMessages(msg,'no',calledFromPopup);
if (calledFromPopup && this.mail_isMainWindow==false) window.close();
@ -986,7 +986,7 @@ app.classes.mail = AppJS.extend(
*/
mail_deleteMessages: function(_msg,_action,_calledFromPopup)
{
app.mail.app_refresh(this.egw.lang('delete messages'), 'mail');
this.app_refresh(this.egw.lang('delete messages'), 'mail');
egw.json('mail.mail_ui.ajax_deleteMessages',[_msg,(typeof _action == 'undefined'?'no':_action)])
.sendRequest();
for (var i = 0; i < _msg['msg'].length; i++) egw.dataDeleteUID(_msg['msg'][i]);
@ -1011,7 +1011,7 @@ app.classes.mail = AppJS.extend(
}
else
{
app.mail.app_refresh(this.egw.lang('canceled deletion due to userinteraction'), 'mail');
this.app_refresh(this.egw.lang('canceled deletion due to userinteraction'), 'mail');
this.mail_removeRowClass(messageList,'deleted');
}
this.mail_refreshMessageGrid();
@ -1043,7 +1043,7 @@ app.classes.mail = AppJS.extend(
* mail_emptyTrash
*/
mail_emptyTrash: function() {
app.mail.app_refresh(this.egw.lang('empty trash'), 'mail');
this.app_refresh(this.egw.lang('empty trash'), 'mail');
egw.json('mail.mail_ui.ajax_emptyTrash')
.sendRequest(true);
this.mail_refreshFolderStatus();
@ -1053,7 +1053,7 @@ app.classes.mail = AppJS.extend(
* mail_compressFolder
*/
mail_compressFolder: function() {
app.mail.app_refresh(this.egw.lang('compress folder'), 'mail');
this.app_refresh(this.egw.lang('compress folder'), 'mail');
egw.json('mail.mail_ui.ajax_compressFolder')
.sendRequest(true);
this.mail_refreshFolderStatus();
@ -1081,7 +1081,7 @@ app.classes.mail = AppJS.extend(
mail_changeFolder: function(folder,_widget) {
//alert('change Folder called:'+folder);
var server = folder.split('::');
app.mail.app_refresh(this.egw.lang('change folder')+'...', 'mail');
this.app_refresh(this.egw.lang('change folder')+'...', 'mail');
var img = _widget.getSelectedNode().images[0]; // fetch first image
var profileChange = false;
if (!(img.search(eval('/'+'NoSelect'+'/'))<0) || !(img.search(eval('/'+'thunderbird'+'/'))<0))
@ -1240,7 +1240,7 @@ app.classes.mail = AppJS.extend(
{
//console.log('mail_flagMessages',_flag, _elems);
if (typeof _refreshGrid == 'undefined') _refreshGrid=true;
app.mail.app_refresh(this.egw.lang('flag messages'), 'mail');
this.app_refresh(this.egw.lang('flag messages'), 'mail');
egw.json('mail.mail_ui.ajax_flagMessages',[_flag, _elems])
.sendRequest();
if (_refreshGrid) this.mail_refreshMessageGrid(_isPopup);
@ -2412,11 +2412,11 @@ app.classes.mail = AppJS.extend(
// wrapper functions to call functions within app
function mail_callEmptyTrash()
{
app.mail.mail_emptyTrash();
this.mail_emptyTrash();
}
function mail_callCompressFolder()
{
app.mail.mail_compressFolder();
this.mail_compressFolder();
}