From f2b64779cc214d6e483aae73ac822f8a9117f9ee Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 17 Jan 2018 18:07:11 +0100 Subject: [PATCH] Display confirmation message when inserting a response or signature --- program/js/app.js | 20 ++++++++++++-------- program/localization/en_US/messages.inc | 2 ++ program/steps/mail/compose.inc | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index eafec7b11..71e907e1e 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -4671,7 +4671,8 @@ function rcube_webmail() // Inserts a predefined response to the compose editor this.insert_response = function(key) { - return this.editor.replace(this.env.textresponses[key]); + this.editor.replace(this.env.textresponses[key]); + this.display_message(rcmail.gettext('responseinserted'), 'confirmation'); }; /** @@ -4990,21 +4991,21 @@ function rcube_webmail() this.local_storage_remove_item('compose.index'); }; - this.change_identity = function(obj, show_sig) + this.change_identity = function(obj, show) { if (!obj || !obj.options) return false; - if (!show_sig) - show_sig = this.env.show_sig; - - var id = obj.options[obj.selectedIndex].value, - sig = this.env.identity; + var id = $(obj).val(), + got_sig = this.env.signatures && this.env.signatures[id], + sig = this.env.identity, + show_sig = show ? show : this.env.show_sig; // enable manual signature insert - if (this.env.signatures && this.env.signatures[id]) { + if (got_sig) { this.enable_command('insert-sig', true); this.env.compose_commands.push('insert-sig'); + got_sig = true; } else this.enable_command('insert-sig', false); @@ -5050,6 +5051,9 @@ function rcube_webmail() if (this.editor) this.editor.change_signature(id, show_sig); + if (show && got_sig) + this.display_message(rcmail.gettext('siginserted'), 'confirmation'); + this.env.identity = id; this.triggerEvent('change_identity'); diff --git a/program/localization/en_US/messages.inc b/program/localization/en_US/messages.inc index 944906458..267f8c4f1 100644 --- a/program/localization/en_US/messages.inc +++ b/program/localization/en_US/messages.inc @@ -217,3 +217,5 @@ $messages['errcomposesession'] = 'Compose session error'; $messages['errcomposesessionexplain'] = 'Requested compose session not found.'; $messages['clicktocompose'] = 'Click here to compose a new message'; $messages['nosupporterror'] = 'This feature is not supported by your web browser.'; +$messages['siginserted'] = 'Signature inserted successfully.'; +$messages['responseinserted'] = 'Response inserted successfully.'; diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 3fd293cf6..775f6160c 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -74,7 +74,7 @@ if (!is_array($COMPOSE)) { // add some labels to client -$OUTPUT->add_label('notuploadedwarning', 'savingmessage', +$OUTPUT->add_label('notuploadedwarning', 'savingmessage', 'siginserted', 'responseinserted', 'messagesaved', 'converting', 'editorwarning', 'uploading', 'uploadingmany', 'fileuploaderror', 'sendmessage', 'newresponse', 'responsename', 'responsetext', 'save', 'savingresponse', 'restoresavedcomposedata', 'restoremessage', 'delete', 'restore', 'ignore',