W.I.P. mail subject modify action

This commit is contained in:
Hadi Nategh 2018-02-20 18:00:30 +01:00
parent 8b88e748f7
commit 7c2547f8c4
3 changed files with 76 additions and 0 deletions

View File

@ -1148,6 +1148,14 @@ class mail_ui
'group' => $group,
'onExecute' => 'javaScript:app.mail.mail_compose',
'allowOnMultiple' => false,
),
'modifysubject' => array(
'caption' => 'Modify Subject',
'icon' => 'edit',
'hint' => 'Modify subject of this message',
'group' => $group,
'onExecute' => 'javaScript:app.mail.modifyMessageSubjectDialog',
'allowOnMultiple' => false,
)
);
$macounter=0;

View File

@ -6034,5 +6034,48 @@ app.classes.mail = AppJS.extend(
nm.header.right_div.addClass('vertical_splitter');
}
return state;
},
/**
* Creates a dialog for changing meesage subject
*
* @param {type} _action
* @param {type} _sender
*/
modifyMessageSubjectDialog: function (_action, _sender)
{
var id = _sender[0].id != 'nm'? _sender[0].id:_sender[1].id;
var data = egw.dataGetUIDdata(id);
var subject = data && data.data? data.data.subject : "";
var buttons = [
{text: this.egw.lang("Save"), id: "save", "class": "ui-priority-primary", "default": true},
{text: this.egw.lang("Cancel"), id:"cancel"}
];
et2_createWidget("dialog",
{
callback: function(_button_id, _value) {
var newSubject = null;
if (_value.length>0) newSubject = _value;
if (newSubject && newSubject.length>0)
{
switch (_button_id)
{
case "save":
egw.json('mail.mail_ui.ajax_saveModifiedMessageSubject',[_sender[0].id, newSubject])
.sendRequest(true);
return;
case "cancel":
}
}
},
title: this.egw.lang("Modify subject"),
buttons: buttons,
value:{content:{value:subject}},
template: egw.webserverUrl+'/mail/templates/default/modifyMessageSubjectDialog.xet?1',
resizable: false
}, et2_dialog._create_parent('mail'));
}
});

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
<!-- $Id$ -->
<overlay>
<template id="mail.modifyMessageSubjectDialog" template="" lang="" group="0" version="17.1">
<hbox class="et2_prompt">
<grid>
<columns>
<column width="120"/>
<column width="400"/>
</columns>
<rows>
<row>
<description label= "%s:" value="Current subject"/>
<description value="@value"/>
</row>
<row>
<description label= "%s:" value="New subject"/>
<textbox multiline="true" id="value" width="400"/>
</row>
</rows>
</grid>
</hbox>
</template>
</overlay>