plugins: mail, mailto: remove code from global context
parent
71fc6d45bd
commit
e76d1fb995
@ -1,52 +1,56 @@
|
|||||||
function emailArticle(id) {
|
Plugins.Mail = {
|
||||||
if (!id) {
|
send: function(id) {
|
||||||
let ids = Headlines.getSelected();
|
if (!id) {
|
||||||
|
let ids = Headlines.getSelected();
|
||||||
|
|
||||||
|
if (ids.length == 0) {
|
||||||
|
alert(__("No articles selected."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ids.length == 0) {
|
id = ids.toString();
|
||||||
alert(__("No articles selected."));
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
id = ids.toString();
|
if (dijit.byId("emailArticleDlg"))
|
||||||
}
|
dijit.byId("emailArticleDlg").destroyRecursive();
|
||||||
|
|
||||||
if (dijit.byId("emailArticleDlg"))
|
const query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle¶m=" + encodeURIComponent(id);
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
href: query});
|
|
||||||
|
|
||||||
/* var tmph = dojo.connect(dialog, 'onLoad', function() {
|
const dialog = new dijit.Dialog({
|
||||||
dojo.disconnect(tmph);
|
id: "emailArticleDlg",
|
||||||
|
title: __("Forward article by email"),
|
||||||
new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices',
|
style: "width: 600px",
|
||||||
"backend.php?op=pluginhandler&plugin=mail&method=completeEmails",
|
execute: function () {
|
||||||
{ tokens: '', paramName: "search" });
|
if (this.validate()) {
|
||||||
}); */
|
xhrJson("backend.php", this.attr('value'), (reply) => {
|
||||||
|
if (reply) {
|
||||||
dialog.show();
|
const error = reply['error'];
|
||||||
}
|
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
alert(__('Error sending email:') + ' ' + error);
|
||||||
|
} else {
|
||||||
|
Notify.info('Your message has been sent.');
|
||||||
|
dialog.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
href: query
|
||||||
|
});
|
||||||
|
|
||||||
|
/* var tmph = dojo.connect(dialog, 'onLoad', function() {
|
||||||
|
dojo.disconnect(tmph);
|
||||||
|
|
||||||
|
new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices',
|
||||||
|
"backend.php?op=pluginhandler&plugin=mail&method=completeEmails",
|
||||||
|
{ tokens: '', paramName: "search" });
|
||||||
|
}); */
|
||||||
|
|
||||||
|
dialog.show();
|
||||||
|
},
|
||||||
|
onHotkey: function(id) {
|
||||||
|
Plugins.Mail.send(id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@ -1,27 +1,34 @@
|
|||||||
function mailtoArticle(id) {
|
Plugins.Mailto = {
|
||||||
if (!id) {
|
send: function (id) {
|
||||||
const ids = Headlines.getSelected();
|
if (!id) {
|
||||||
|
const ids = Headlines.getSelected();
|
||||||
|
|
||||||
if (ids.length == 0) {
|
if (ids.length == 0) {
|
||||||
alert(__("No articles selected."));
|
alert(__("No articles selected."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
id = ids.toString();
|
id = ids.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dijit.byId("emailArticleDlg"))
|
if (dijit.byId("emailArticleDlg"))
|
||||||
dijit.byId("emailArticleDlg").destroyRecursive();
|
dijit.byId("emailArticleDlg").destroyRecursive();
|
||||||
|
|
||||||
const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle¶m=" + encodeURIComponent(id);
|
const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle¶m=" + encodeURIComponent(id);
|
||||||
|
|
||||||
const dialog = new dijit.Dialog({
|
const dialog = new dijit.Dialog({
|
||||||
id: "emailArticleDlg",
|
id: "emailArticleDlg",
|
||||||
title: __("Forward article by email"),
|
title: __("Forward article by email"),
|
||||||
style: "width: 600px",
|
style: "width: 600px",
|
||||||
href: query});
|
href: query});
|
||||||
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// override default hotkey action if enabled
|
||||||
|
Plugins.Mail = Plugins.Mail || {};
|
||||||
|
|
||||||
|
Plugins.Mail.onHotkey = function(id) {
|
||||||
|
Plugins.Mailto.send(id);
|
||||||
|
};
|
Loading…
Reference in New Issue