2021-02-19 11:44:56 +01:00
|
|
|
/* global Plugins, Headlines, xhr, dojo, fox, __ */
|
2021-02-12 13:22:10 +01:00
|
|
|
|
2018-12-03 12:21:50 +01:00
|
|
|
Plugins.Mailto = {
|
|
|
|
send: function (id) {
|
|
|
|
if (!id) {
|
|
|
|
const ids = Headlines.getSelected();
|
2013-03-19 15:32:49 +01:00
|
|
|
|
2018-12-03 12:21:50 +01:00
|
|
|
if (ids.length == 0) {
|
|
|
|
alert(__("No articles selected."));
|
|
|
|
return;
|
|
|
|
}
|
2013-03-19 15:32:49 +01:00
|
|
|
|
2018-12-03 12:21:50 +01:00
|
|
|
id = ids.toString();
|
|
|
|
}
|
2013-03-19 15:32:49 +01:00
|
|
|
|
2021-02-12 13:22:10 +01:00
|
|
|
const dialog = new fox.SingleUseDialog({
|
2021-02-17 13:53:00 +01:00
|
|
|
title: __("Forward article by email (mailto:)"),
|
2021-02-17 12:56:36 +01:00
|
|
|
content: __("Loading, please wait...")
|
|
|
|
});
|
|
|
|
|
|
|
|
const tmph = dojo.connect(dialog, 'onShow', function () {
|
|
|
|
dojo.disconnect(tmph);
|
|
|
|
|
2021-02-19 11:44:56 +01:00
|
|
|
xhr.post("backend.php", App.getPhArgs("mailto", "emailArticle", {ids: id}), (reply) => {
|
|
|
|
dialog.attr('content', reply);
|
2021-02-17 12:56:36 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2013-03-19 15:32:49 +01:00
|
|
|
|
2018-12-03 12:21:50 +01:00
|
|
|
dialog.show();
|
|
|
|
}
|
|
|
|
};
|
2013-03-19 15:32:49 +01:00
|
|
|
|
2018-12-03 12:21:50 +01:00
|
|
|
// override default hotkey action if enabled
|
|
|
|
Plugins.Mail = Plugins.Mail || {};
|
2013-03-19 15:32:49 +01:00
|
|
|
|
2018-12-03 12:21:50 +01:00
|
|
|
Plugins.Mail.onHotkey = function(id) {
|
|
|
|
Plugins.Mailto.send(id);
|
2021-02-12 13:22:10 +01:00
|
|
|
};
|