2011-12-21 04:46:39 +00:00
|
|
|
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();
|
|
|
|
|
2012-12-23 10:52:18 +00:00
|
|
|
var query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle¶m=" + param_escape(id);
|
2011-12-21 04:46:39 +00:00
|
|
|
|
|
|
|
dialog = new dijit.Dialog({
|
|
|
|
id: "emailArticleDlg",
|
|
|
|
title: __("Forward article by email"),
|
|
|
|
style: "width: 600px",
|
|
|
|
execute: function() {
|
|
|
|
if (this.validate()) {
|
2018-11-30 12:23:48 +00:00
|
|
|
xhrJson("backend.php", this.attr('value'), (reply) => {
|
|
|
|
if (reply) {
|
|
|
|
const error = reply['error'];
|
2011-12-21 04:46:39 +00:00
|
|
|
|
|
|
|
if (error) {
|
|
|
|
alert(__('Error sending email:') + ' ' + error);
|
|
|
|
} else {
|
|
|
|
notify_info('Your message has been sent.');
|
|
|
|
dialog.hide();
|
|
|
|
}
|
|
|
|
|
2018-11-30 12:23:48 +00:00
|
|
|
}
|
|
|
|
});
|
2011-12-21 04:46:39 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
href: query});
|
|
|
|
|
2014-07-02 06:38:59 +00:00
|
|
|
/* var tmph = dojo.connect(dialog, 'onLoad', function() {
|
2011-12-21 04:46:39 +00:00
|
|
|
dojo.disconnect(tmph);
|
|
|
|
|
|
|
|
new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices',
|
2012-12-23 10:52:18 +00:00
|
|
|
"backend.php?op=pluginhandler&plugin=mail&method=completeEmails",
|
2011-12-21 04:46:39 +00:00
|
|
|
{ tokens: '', paramName: "search" });
|
2014-07-02 06:38:59 +00:00
|
|
|
}); */
|
2011-12-21 04:46:39 +00:00
|
|
|
|
|
|
|
dialog.show();
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
exception_error("emailArticle", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|