diff options
author | Andrew Dolgov <[email protected]> | 2018-12-03 15:46:54 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-12-03 15:46:54 +0300 |
commit | 4cb3a601a0fbeb0bf98c932bd5af8a3cffa8ab64 (patch) | |
tree | ed3dae8894591be12287b3cce3ff5b4cc6d1ce0e /plugins/mail | |
parent | cd0a39ea4cb7137aef5b225bdc4472d207a48e62 (diff) | |
parent | 98986ce066764158c045c3e23b69e98183b94236 (diff) |
Merge branch 'js-objects' into weblate-integration
Diffstat (limited to 'plugins/mail')
-rw-r--r-- | plugins/mail/init.php | 4 | ||||
-rw-r--r-- | plugins/mail/mail.js | 31 |
2 files changed, 17 insertions, 18 deletions
diff --git a/plugins/mail/init.php b/plugins/mail/init.php index 5294931c7..1609a05c3 100644 --- a/plugins/mail/init.php +++ b/plugins/mail/init.php @@ -45,7 +45,7 @@ class Mail extends Plugin { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify_info(transport.responseText); + Notify.info(transport.responseText); } }); //this.reset(); @@ -72,7 +72,7 @@ class Mail extends Plugin { function hook_article_button($line) { return "<img src=\"plugins/mail/mail.png\" class='tagsPic' style=\"cursor : pointer\" - onclick=\"emailArticle(".$line["id"].")\" + onclick=\"Plugins.Mail.send(".$line["id"].")\" alt='Zoom' title='".__('Forward by email')."'>"; } diff --git a/plugins/mail/mail.js b/plugins/mail/mail.js index 929b35243..eb7b7e6b6 100644 --- a/plugins/mail/mail.js +++ b/plugins/mail/mail.js @@ -1,10 +1,10 @@ -function emailArticle(id) { - try { +Plugins.Mail = { + send: function(id) { if (!id) { - var ids = getSelectedArticleIds2(); + let ids = Headlines.getSelected(); if (ids.length == 0) { - alert(__("No articles are selected.")); + alert(__("No articles selected.")); return; } @@ -14,13 +14,13 @@ function emailArticle(id) { if (dijit.byId("emailArticleDlg")) dijit.byId("emailArticleDlg").destroyRecursive(); - var query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle¶m=" + param_escape(id); + const query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle¶m=" + encodeURIComponent(id); - dialog = new dijit.Dialog({ + const dialog = new dijit.Dialog({ id: "emailArticleDlg", title: __("Forward article by email"), style: "width: 600px", - execute: function() { + execute: function () { if (this.validate()) { xhrJson("backend.php", this.attr('value'), (reply) => { if (reply) { @@ -29,7 +29,7 @@ function emailArticle(id) { if (error) { alert(__('Error sending email:') + ' ' + error); } else { - notify_info('Your message has been sent.'); + Notify.info('Your message has been sent.'); dialog.hide(); } @@ -37,10 +37,11 @@ function emailArticle(id) { }); } }, - href: query}); + href: query + }); /* var tmph = dojo.connect(dialog, 'onLoad', function() { - dojo.disconnect(tmph); + dojo.disconnect(tmph); new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices', "backend.php?op=pluginhandler&plugin=mail&method=completeEmails", @@ -48,10 +49,8 @@ function emailArticle(id) { }); */ dialog.show(); - - } catch (e) { - exception_error("emailArticle", e); + }, + onHotkey: function(id) { + Plugins.Mail.send(id); } -} - - +}; |