2011-12-21 04:46:39 +00:00
|
|
|
function emailArticle(id) {
|
|
|
|
try {
|
|
|
|
if (!id) {
|
2018-12-02 05:32:13 +00:00
|
|
|
var ids = Headlines.getSelected();
|
2011-12-21 04:46:39 +00:00
|
|
|
|
|
|
|
if (ids.length == 0) {
|
2018-12-02 13:30:32 +00:00
|
|
|
alert(__("No articles selected."));
|
2011-12-21 04:46:39 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
id = ids.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dijit.byId("emailArticleDlg"))
|
|
|
|
dijit.byId("emailArticleDlg").destroyRecursive();
|
|
|
|
|
2018-12-02 17:07:57 +00:00
|
|
|
var query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle¶m=" + encodeURIComponent(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 {
|
2018-12-02 17:56:30 +00:00
|
|
|
Notify.info('Your message has been sent.');
|
2011-12-21 04:46:39 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|