mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
WIP mail subject modify action
This commit is contained in:
parent
e259895e2e
commit
8e79ef4dfe
@ -1156,6 +1156,7 @@ class mail_ui
|
|||||||
'group' => $group,
|
'group' => $group,
|
||||||
'onExecute' => 'javaScript:app.mail.modifyMessageSubjectDialog',
|
'onExecute' => 'javaScript:app.mail.modifyMessageSubjectDialog',
|
||||||
'allowOnMultiple' => false,
|
'allowOnMultiple' => false,
|
||||||
|
'shortcut' => array('ctrl' => true, 'keyCode' => 77, 'caption' => 'Ctrl + M'),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$macounter=0;
|
$macounter=0;
|
||||||
@ -3622,6 +3623,54 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message from modified message then sends the original one to
|
||||||
|
* the trash.
|
||||||
|
*
|
||||||
|
* @param string $_rowID row id
|
||||||
|
* @param string $_subject subject to be replaced with old subject
|
||||||
|
*
|
||||||
|
* Sends json response to client with following data:
|
||||||
|
* array (
|
||||||
|
* success => boolean
|
||||||
|
* msg => string
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
function ajax_saveModifiedMessageSubject ($_rowID, $_subject)
|
||||||
|
{
|
||||||
|
$response = Api\Json\Response::get();
|
||||||
|
$idData = self::splitRowID($_rowID);
|
||||||
|
$folder = $idData['folder'];
|
||||||
|
try {
|
||||||
|
$raw = $this->mail_bo->getMessageRawBody($idData['msgUID'],'', $folder);
|
||||||
|
$result = array ('success' => true, 'msg' =>'');
|
||||||
|
if ($raw && $_subject)
|
||||||
|
{
|
||||||
|
$mailer = new Api\Mailer();
|
||||||
|
$this->mail_bo->parseRawMessageIntoMailObject($mailer, $raw);
|
||||||
|
$mailer->removeHeader('subject');
|
||||||
|
$mailer->addHeader('subject', $_subject);
|
||||||
|
$this->mail_bo->openConnection();
|
||||||
|
$delimiter = $this->mail_bo->getHierarchyDelimiter();
|
||||||
|
if($folder == 'INBOX'.$delimiter) $folder='INBOX';
|
||||||
|
if ($this->mail_bo->folderExists($folder,true))
|
||||||
|
{
|
||||||
|
$this->mail_bo->appendMessage($folder, $mailer->getRaw(), null,'\\Seen');
|
||||||
|
$this->mail_bo->deleteMessages($idData['msgUID'], $folder);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result['success'] = false;
|
||||||
|
$result['msg'] = lang('Changing subject failed folder %1 does not exist', $folder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$result['success'] = false;
|
||||||
|
$result['msg'] = lang('Changing subject failed because of %1 ', $e->getMessage());
|
||||||
|
}
|
||||||
|
$response->data($result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* importMessage
|
* importMessage
|
||||||
* @param array $content = null an array of content
|
* @param array $content = null an array of content
|
||||||
|
@ -6057,15 +6057,23 @@ app.classes.mail = AppJS.extend(
|
|||||||
{
|
{
|
||||||
callback: function(_button_id, _value) {
|
callback: function(_button_id, _value) {
|
||||||
var newSubject = null;
|
var newSubject = null;
|
||||||
if (_value.length>0) newSubject = _value;
|
if (_value && _value.value) newSubject = _value.value;
|
||||||
|
|
||||||
if (newSubject && newSubject.length>0)
|
if (newSubject && newSubject.length>0)
|
||||||
{
|
{
|
||||||
switch (_button_id)
|
switch (_button_id)
|
||||||
{
|
{
|
||||||
case "save":
|
case "save":
|
||||||
egw.json('mail.mail_ui.ajax_saveModifiedMessageSubject',[_sender[0].id, newSubject])
|
egw.json('mail.mail_ui.ajax_saveModifiedMessageSubject',[_sender[0].id, newSubject], function(_data){
|
||||||
.sendRequest(true);
|
if (_data && !_data.success)
|
||||||
|
{
|
||||||
|
egw.message(_data.msg, "error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var nm = app.mail.et2.getWidgetById('nm');
|
||||||
|
if (nm) {nm.applyFilters();}
|
||||||
|
|
||||||
|
}).sendRequest(true);
|
||||||
return;
|
return;
|
||||||
case "cancel":
|
case "cancel":
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user