forked from extern/egroupware
implement Strg+A on Message deletion per folder
This commit is contained in:
parent
2babf41119
commit
d071e645cd
@ -4446,34 +4446,76 @@ $this->partID = $partID;
|
|||||||
$error = null;
|
$error = null;
|
||||||
if ($_messageList=='all' || !empty($_messageList['msg']))
|
if ($_messageList=='all' || !empty($_messageList['msg']))
|
||||||
{
|
{
|
||||||
if ($_messageList=='all')
|
if (isset($_messageList['all']) && $_messageList['all'])
|
||||||
{
|
{
|
||||||
// we have no folder information
|
// we have both messageIds AND allFlag folder information
|
||||||
$folder=null;
|
$uidA = self::splitRowID($_messageList['msg'][0]);
|
||||||
|
$folder = $uidA['folder']; // all messages in one set are supposed to be within the same folder
|
||||||
|
if (isset($_messageList['activeFilters']) && $_messageList['activeFilters'])
|
||||||
|
{
|
||||||
|
$query = $_messageList['activeFilters'];
|
||||||
|
if (!empty($query['search']) || !empty($query['filter']))
|
||||||
|
{
|
||||||
|
//([filterName] => Schnellsuche[type] => quick[string] => ebay[status] => any
|
||||||
|
if (is_null(emailadmin_imapbase::$supportsORinQuery) || !isset(emailadmin_imapbase::$supportsORinQuery[$this->mail_bo->profileID]))
|
||||||
|
{
|
||||||
|
emailadmin_imapbase::$supportsORinQuery = egw_cache::getCache(egw_cache::INSTANCE,'email','supportsORinQuery'.trim($GLOBALS['egw_info']['user']['account_id']), null, array(), 60*60*10);
|
||||||
|
if (!isset(emailadmin_imapbase::$supportsORinQuery[$this->mail_bo->profileID])) emailadmin_imapbase::$supportsORinQuery[$this->mail_bo->profileID]=true;
|
||||||
|
}
|
||||||
|
$filter = array('filterName' => (emailadmin_imapbase::$supportsORinQuery[$this->mail_bo->profileID]?lang('quicksearch'):lang('subject')),'type' => ($query['filter2']?$query['filter2']:(emailadmin_imapbase::$supportsORinQuery[$this->mail_bo->profileID]?'quick':'subject')),'string' => $query['search'],'status' => 'any');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$filter = array();
|
||||||
|
}
|
||||||
|
$messageList = array();
|
||||||
|
$_sR = $this->mail_bo->getSortedList(
|
||||||
|
$folder,
|
||||||
|
$sort=0,
|
||||||
|
$reverse=1,
|
||||||
|
$filter,
|
||||||
|
$rByUid=true,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
$messageList = $_sR['match']->ids;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$messageList='all';
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//error_log(__METHOD__.__LINE__."->".print_r($messageList,true).' folder:'.$folder.' Method:'.$_forceDeleteMethod);
|
||||||
|
$this->mail_bo->deleteMessages(($messageList=='all' ? 'all':$messageList),$folder,(empty($_forceDeleteMethod)?'no':$_forceDeleteMethod));
|
||||||
|
}
|
||||||
|
catch (egw_exception $e)
|
||||||
|
{
|
||||||
|
$error = str_replace('"',"'",$e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$uidA = self::splitRowID($_messageList['msg'][0]);
|
$uidA = self::splitRowID($_messageList['msg'][0]);
|
||||||
$folder = $uidA['folder']; // all messages in one set are supposed to be within the same folder
|
$folder = $uidA['folder']; // all messages in one set are supposed to be within the same folder
|
||||||
}
|
foreach($_messageList['msg'] as $rowID)
|
||||||
foreach($_messageList['msg'] as $rowID)
|
{
|
||||||
{
|
$hA = self::splitRowID($rowID);
|
||||||
$hA = self::splitRowID($rowID);
|
$messageList[] = $hA['msgUID'];
|
||||||
$messageList[] = $hA['msgUID'];
|
}
|
||||||
}
|
try
|
||||||
try
|
{
|
||||||
{
|
//error_log(__METHOD__.__LINE__."->".print_r($messageList,true).' folder:'.$folder.' Method:'.$_forceDeleteMethod);
|
||||||
//error_log(__METHOD__."->".print_r($messageList,true).' folder:'.$folder.' Method:'.$_forceDeleteMethod);
|
$this->mail_bo->deleteMessages($messageList,$folder,(empty($_forceDeleteMethod)?'no':$_forceDeleteMethod));
|
||||||
$this->mail_bo->deleteMessages(($_messageList=='all' ? 'all':$messageList),$folder,(empty($_forceDeleteMethod)?'no':$_forceDeleteMethod));
|
}
|
||||||
}
|
catch (egw_exception $e)
|
||||||
catch (egw_exception $e)
|
{
|
||||||
{
|
$error = str_replace('"',"'",$e->getMessage());
|
||||||
$error = str_replace('"',"'",$e->getMessage());
|
}
|
||||||
}
|
}
|
||||||
$response = egw_json_response::get();
|
$response = egw_json_response::get();
|
||||||
if (empty($error))
|
if (empty($error))
|
||||||
{
|
{
|
||||||
$response->call('app.mail.mail_deleteMessagesShowResult',array('egw_message'=>lang('deleted %1 messages in %2',count($_messageList['msg']),$folder),'msg'=>$_messageList['msg']));
|
$response->call('app.mail.mail_deleteMessagesShowResult',array('egw_message'=>lang('deleted %1 messages in %2',($messageList=='all'||$_messageList['all']?lang('all'):count($_messageList['msg'])),$folder),'msg'=>$_messageList['msg']));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1270,6 +1270,8 @@ app.classes.mail = AppJS.extend(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var msg = this.mail_getFormData(_elems);
|
var msg = this.mail_getFormData(_elems);
|
||||||
|
msg['all'] = this.mail_checkAllSelected(_action,true);
|
||||||
|
if (msg['all']) msg['activeFilters'] = this.mail_getActiveFilters(_action);
|
||||||
//alert(_action.id+','+ msg);
|
//alert(_action.id+','+ msg);
|
||||||
if (!calledFromPopup) this.mail_setRowClass(_elems,'deleted');
|
if (!calledFromPopup) this.mail_setRowClass(_elems,'deleted');
|
||||||
this.mail_deleteMessages(msg,'no',calledFromPopup);
|
this.mail_deleteMessages(msg,'no',calledFromPopup);
|
||||||
@ -1340,6 +1342,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
message = this.mail_splitRowId(_msg['msg'][0]);
|
message = this.mail_splitRowId(_msg['msg'][0]);
|
||||||
if (message[3]) _foldernode = displayname = jQuery.base64Decode(message[3]);
|
if (message[3]) _foldernode = displayname = jQuery.base64Decode(message[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell server
|
// Tell server
|
||||||
egw.json('mail.mail_ui.ajax_deleteMessages',[_msg,(typeof _action == 'undefined'?'no':_action)])
|
egw.json('mail.mail_ui.ajax_deleteMessages',[_msg,(typeof _action == 'undefined'?'no':_action)])
|
||||||
.sendRequest(true);
|
.sendRequest(true);
|
||||||
@ -1351,7 +1354,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
// ids.push(_msg['msg'][i].replace(/mail::/,''));
|
// ids.push(_msg['msg'][i].replace(/mail::/,''));
|
||||||
//}
|
//}
|
||||||
//this.egw.refresh(this.egw.lang("deleted %1 messages in %2",_msg['msg'].length,(displayname?displayname:egw.lang('current folder'))),'mail',ids,'delete');
|
//this.egw.refresh(this.egw.lang("deleted %1 messages in %2",_msg['msg'].length,(displayname?displayname:egw.lang('current folder'))),'mail',ids,'delete');
|
||||||
this.egw.message(this.egw.lang("deleted %1 messages in %2",_msg['msg'].length,(displayname?displayname:egw.lang('current Folder'))));
|
this.egw.message(this.egw.lang("deleted %1 messages in %2",(_msg['all']?egw.lang('all'):_msg['msg'].length),(displayname?displayname:egw.lang('current Folder'))));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1368,7 +1371,14 @@ app.classes.mail = AppJS.extend(
|
|||||||
ids.push(_msg['msg'][i].replace(/mail::/,''));
|
ids.push(_msg['msg'][i].replace(/mail::/,''));
|
||||||
}
|
}
|
||||||
//this.egw.message(_msg['egw_message']);
|
//this.egw.message(_msg['egw_message']);
|
||||||
this.egw.refresh(_msg['egw_message'],'mail',ids,'delete');
|
if (_msg['all'])
|
||||||
|
{
|
||||||
|
this.egw.refresh(_msg['egw_message'],'mail');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.egw.refresh(_msg['egw_message'],'mail',ids,'delete');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2484,6 +2494,9 @@ app.classes.mail = AppJS.extend(
|
|||||||
//alert('mail_move('+messages.msg.join(',')+' --> '+target+')');
|
//alert('mail_move('+messages.msg.join(',')+' --> '+target+')');
|
||||||
// TODO: Write move/copy function which cares about doing the same stuff
|
// TODO: Write move/copy function which cares about doing the same stuff
|
||||||
// as the "onNodeSelect" function!
|
// as the "onNodeSelect" function!
|
||||||
|
messages['all'] = this.mail_checkAllSelected(_action,true);
|
||||||
|
if (messages['all']) messages['activeFilters'] = this.mail_getActiveFilters(_action);
|
||||||
|
|
||||||
egw.json('mail.mail_ui.ajax_copyMessages',[target, messages, 'move'])
|
egw.json('mail.mail_ui.ajax_copyMessages',[target, messages, 'move'])
|
||||||
.sendRequest();
|
.sendRequest();
|
||||||
var nm = this.et2.getWidgetById(this.nm_index);
|
var nm = this.et2.getWidgetById(this.nm_index);
|
||||||
@ -2505,6 +2518,9 @@ app.classes.mail = AppJS.extend(
|
|||||||
//alert('mail_copy('+messages.msg.join(',')+' --> '+target+')');
|
//alert('mail_copy('+messages.msg.join(',')+' --> '+target+')');
|
||||||
// TODO: Write move/copy function which cares about doing the same stuff
|
// TODO: Write move/copy function which cares about doing the same stuff
|
||||||
// as the "onNodeSelect" function!
|
// as the "onNodeSelect" function!
|
||||||
|
messages['all'] = this.mail_checkAllSelected(_action,true);
|
||||||
|
if (messages['all']) messages['activeFilters'] = this.mail_getActiveFilters(_action);
|
||||||
|
|
||||||
egw.json('mail.mail_ui.ajax_copyMessages',[target, messages])
|
egw.json('mail.mail_ui.ajax_copyMessages',[target, messages])
|
||||||
.sendRequest();
|
.sendRequest();
|
||||||
// Server response contains refresh
|
// Server response contains refresh
|
||||||
|
Loading…
Reference in New Issue
Block a user