2011-12-21 04:46:39 +00:00
|
|
|
function emailArticle(id) {
|
2018-12-03 10:38:13 +00:00
|
|
|
if (!id) {
|
|
|
|
let ids = Headlines.getSelected();
|
2011-12-21 04:46:39 +00:00
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
if (ids.length == 0) {
|
|
|
|
alert(__("No articles selected."));
|
|
|
|
return;
|
2011-12-21 04:46:39 +00:00
|
|
|
}
|
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
id = ids.toString();
|
|
|
|
}
|
2011-12-21 04:46:39 +00:00
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
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();
|
2018-11-30 12:23:48 +00:00
|
|
|
}
|
2011-12-21 04:46:39 +00:00
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
href: query});
|
2011-12-21 04:46:39 +00:00
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
/* var tmph = dojo.connect(dialog, 'onLoad', function() {
|
|
|
|
dojo.disconnect(tmph);
|
2011-12-21 04:46:39 +00:00
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices',
|
|
|
|
"backend.php?op=pluginhandler&plugin=mail&method=completeEmails",
|
|
|
|
{ tokens: '', paramName: "search" });
|
|
|
|
}); */
|
2011-12-21 04:46:39 +00:00
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
dialog.show();
|
2011-12-21 04:46:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|