diff options
author | Andrew Dolgov <[email protected]> | 2018-12-03 13:38:13 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-12-03 13:38:13 +0300 |
commit | 71fc6d45bd761a9d2715faa68f2b8c0271ee7169 (patch) | |
tree | 47677db3e0d147dbe5c3d3cc71a6576a392881f3 /plugins/mail | |
parent | a049b5bd88f3ce07af0e2aa7c21992dc0605eea6 (diff) |
refactor error reporting to AppBase; keep exception_error() for now as a shim
Diffstat (limited to 'plugins/mail')
-rw-r--r-- | plugins/mail/mail.js | 83 |
1 files changed, 39 insertions, 44 deletions
diff --git a/plugins/mail/mail.js b/plugins/mail/mail.js index b72289c2a..87e354b42 100644 --- a/plugins/mail/mail.js +++ b/plugins/mail/mail.js @@ -1,57 +1,52 @@ function emailArticle(id) { - try { - if (!id) { - var ids = Headlines.getSelected(); + if (!id) { + let ids = Headlines.getSelected(); - if (ids.length == 0) { - alert(__("No articles selected.")); - return; - } - - id = ids.toString(); + if (ids.length == 0) { + alert(__("No articles selected.")); + return; } - if (dijit.byId("emailArticleDlg")) - dijit.byId("emailArticleDlg").destroyRecursive(); - - var query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle¶m=" + encodeURIComponent(id); - - dialog = new dijit.Dialog({ - id: "emailArticleDlg", - title: __("Forward article by email"), - style: "width: 600px", - execute: function() { - if (this.validate()) { - xhrJson("backend.php", this.attr('value'), (reply) => { - if (reply) { - const error = reply['error']; - - if (error) { - alert(__('Error sending email:') + ' ' + error); - } else { - Notify.info('Your message has been sent.'); - dialog.hide(); - } + id = ids.toString(); + } + if (dijit.byId("emailArticleDlg")) + dijit.byId("emailArticleDlg").destroyRecursive(); + + const query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle¶m=" + encodeURIComponent(id); + + const dialog = new dijit.Dialog({ + id: "emailArticleDlg", + title: __("Forward article by email"), + style: "width: 600px", + execute: function() { + if (this.validate()) { + xhrJson("backend.php", this.attr('value'), (reply) => { + if (reply) { + const error = reply['error']; + + if (error) { + alert(__('Error sending email:') + ' ' + error); + } else { + Notify.info('Your message has been sent.'); + dialog.hide(); } - }); - } - }, - href: query}); - /* var tmph = dojo.connect(dialog, 'onLoad', function() { - dojo.disconnect(tmph); + } + }); + } + }, + href: query}); - new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices', - "backend.php?op=pluginhandler&plugin=mail&method=completeEmails", - { tokens: '', paramName: "search" }); - }); */ + /* var tmph = dojo.connect(dialog, 'onLoad', function() { + dojo.disconnect(tmph); - dialog.show(); + new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices', + "backend.php?op=pluginhandler&plugin=mail&method=completeEmails", + { tokens: '', paramName: "search" }); + }); */ - } catch (e) { - exception_error("emailArticle", e); - } + dialog.show(); } |