From 7c2547f8c471b2051d29c56821cb81a87d2a5ad0 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 20 Feb 2018 18:00:30 +0100 Subject: [PATCH] W.I.P. mail subject modify action --- mail/inc/class.mail_ui.inc.php | 8 ++++ mail/js/app.js | 43 +++++++++++++++++++ .../default/modifyMessageSubjectDialog.xet | 25 +++++++++++ 3 files changed, 76 insertions(+) create mode 100644 mail/templates/default/modifyMessageSubjectDialog.xet diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 5b1ae8ac8d..a047359b3b 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -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; diff --git a/mail/js/app.js b/mail/js/app.js index 4bfb0b7e3e..59f05d1441 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -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')); } }); diff --git a/mail/templates/default/modifyMessageSubjectDialog.xet b/mail/templates/default/modifyMessageSubjectDialog.xet new file mode 100644 index 0000000000..f8965735c7 --- /dev/null +++ b/mail/templates/default/modifyMessageSubjectDialog.xet @@ -0,0 +1,25 @@ + + + + + +