ttrss/plugins/mail/mail.js

58 lines
1.3 KiB
JavaScript
Raw Normal View History

2011-12-21 05:46:39 +01:00
function emailArticle(id) {
try {
if (!id) {
var ids = Headlines.getSelected();
2011-12-21 05:46:39 +01:00
if (ids.length == 0) {
2018-12-02 14:30:32 +01:00
alert(__("No articles selected."));
2011-12-21 05:46:39 +01:00
return;
}
id = ids.toString();
}
if (dijit.byId("emailArticleDlg"))
dijit.byId("emailArticleDlg").destroyRecursive();
var query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle&param=" + encodeURIComponent(id);
2011-12-21 05:46:39 +01:00
dialog = new dijit.Dialog({
id: "emailArticleDlg",
title: __("Forward article by email"),
style: "width: 600px",
execute: function() {
if (this.validate()) {
2018-11-30 13:23:48 +01:00
xhrJson("backend.php", this.attr('value'), (reply) => {
if (reply) {
const error = reply['error'];
2011-12-21 05:46:39 +01:00
if (error) {
alert(__('Error sending email:') + ' ' + error);
} else {
2018-12-02 18:56:30 +01:00
Notify.info('Your message has been sent.');
2011-12-21 05:46:39 +01:00
dialog.hide();
}
2018-11-30 13:23:48 +01:00
}
});
2011-12-21 05:46:39 +01:00
}
},
href: query});
/* var tmph = dojo.connect(dialog, 'onLoad', function() {
2011-12-21 05:46:39 +01:00
dojo.disconnect(tmph);
new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices',
2012-12-23 11:52:18 +01:00
"backend.php?op=pluginhandler&plugin=mail&method=completeEmails",
2011-12-21 05:46:39 +01:00
{ tokens: '', paramName: "search" });
}); */
2011-12-21 05:46:39 +01:00
dialog.show();
} catch (e) {
exception_error("emailArticle", e);
}
}