ttrss/plugins/mail/mail.js

58 lines
1.3 KiB
JavaScript
Raw Normal View History

2011-12-21 04:46:39 +00:00
function emailArticle(id) {
try {
if (!id) {
var ids = Headlines.getSelectedArticleIds2();
2011-12-21 04:46:39 +00:00
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&param=" + 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});
/* 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" });
}); */
2011-12-21 04:46:39 +00:00
dialog.show();
} catch (e) {
exception_error("emailArticle", e);
}
}