diff options
author | Andrew Dolgov <[email protected]> | 2011-12-21 08:46:39 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2011-12-21 08:50:37 +0400 |
commit | 1baac2803c1dee2fc2005c1039d349f4759d20e3 (patch) | |
tree | fd0594b0c7ff9e7032e6ee09c3ed85d3ce4ee11d /js/mail_button.js | |
parent | 8e70d965a8e60aecd17073f71e9646bb0f6a4839 (diff) |
add mail and share plugins
Diffstat (limited to 'js/mail_button.js')
-rw-r--r-- | js/mail_button.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/js/mail_button.js b/js/mail_button.js new file mode 100644 index 000000000..0fcb0d80f --- /dev/null +++ b/js/mail_button.js @@ -0,0 +1,61 @@ +function emailArticle(id) { + try { + if (!id) { + var ids = getSelectedArticleIds2(); + + if (ids.length == 0) { + alert(__("No articles are selected.")); + return; + } + + id = ids.toString(); + } + + if (dijit.byId("emailArticleDlg")) + dijit.byId("emailArticleDlg").destroyRecursive(); + + var query = "backend.php?op=rpc&method=buttonPlugin&plugin=mail&plugin_method=emailArticle¶m=" + param_escape(id); + + dialog = new dijit.Dialog({ + id: "emailArticleDlg", + title: __("Forward article by email"), + style: "width: 600px", + execute: function() { + if (this.validate()) { + + new Ajax.Request("backend.php", { + parameters: dojo.objectToQuery(this.attr('value')), + onComplete: function(transport) { + + var reply = JSON.parse(transport.responseText); + + var 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); + + new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices', + "backend.php?op=rpc&method=buttonPlugin&plugin=mail&plugin_method=completeEmails", + { tokens: '', paramName: "search" }); + }); + + dialog.show(); + + } catch (e) { + exception_error("emailArticle", e); + } +} + + |