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