plugins: mail, mailto: remove code from global context
This commit is contained in:
parent
71fc6d45bd
commit
e76d1fb995
|
@ -124,12 +124,12 @@ class Feeds extends Handler_Protected {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PluginHost::getInstance()->get_plugin("mail")) {
|
if (PluginHost::getInstance()->get_plugin("mail")) {
|
||||||
$reply .= "<option value=\"emailArticle(false)\">".__('Forward by email').
|
$reply .= "<option value=\"Plugins.Mail.send()\">".__('Forward by email').
|
||||||
"</option>";
|
"</option>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PluginHost::getInstance()->get_plugin("mailto")) {
|
if (PluginHost::getInstance()->get_plugin("mailto")) {
|
||||||
$reply .= "<option value=\"mailtoArticle(false)\">".__('Forward by email').
|
$reply .= "<option value=\"Plugins.Mailto.send()\">".__('Forward by email').
|
||||||
"</option>";
|
"</option>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,12 +302,10 @@ require(["dojo/_base/kernel",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.hotkey_actions["email_article"] = function () {
|
this.hotkey_actions["email_article"] = function () {
|
||||||
if (typeof emailArticle != "undefined") {
|
if (typeof Plugins.Mail != "undefined") {
|
||||||
emailArticle();
|
Plugins.Mail.onHotkey(Headlines.getSelected());
|
||||||
} else if (typeof mailtoArticle != "undefined") {
|
|
||||||
mailtoArticle();
|
|
||||||
} else {
|
} else {
|
||||||
alert(__("Please enable mail plugin first."));
|
alert(__("Please enable mail or mailto plugin first."));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.hotkey_actions["select_all"] = function () {
|
this.hotkey_actions["select_all"] = function () {
|
||||||
|
|
|
@ -72,7 +72,7 @@ class Mail extends Plugin {
|
||||||
function hook_article_button($line) {
|
function hook_article_button($line) {
|
||||||
return "<img src=\"plugins/mail/mail.png\"
|
return "<img src=\"plugins/mail/mail.png\"
|
||||||
class='tagsPic' style=\"cursor : pointer\"
|
class='tagsPic' style=\"cursor : pointer\"
|
||||||
onclick=\"emailArticle(".$line["id"].")\"
|
onclick=\"Plugins.Mail.send(".$line["id"].")\"
|
||||||
alt='Zoom' title='".__('Forward by email')."'>";
|
alt='Zoom' title='".__('Forward by email')."'>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
if (ids.length == 0) {
|
||||||
alert(__("No articles selected."));
|
alert(__("No articles selected."));
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
id = ids.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
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'];
|
||||||
|
|
||||||
const dialog = new dijit.Dialog({
|
if (error) {
|
||||||
id: "emailArticleDlg",
|
alert(__('Error sending email:') + ' ' + error);
|
||||||
title: __("Forward article by email"),
|
} else {
|
||||||
style: "width: 600px",
|
Notify.info('Your message has been sent.');
|
||||||
execute: function() {
|
dialog.hide();
|
||||||
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() {
|
||||||
});
|
dojo.disconnect(tmph);
|
||||||
}
|
|
||||||
},
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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"))
|
||||||
|
dijit.byId("emailArticleDlg").destroyRecursive();
|
||||||
|
|
||||||
|
const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle¶m=" + encodeURIComponent(id);
|
||||||
|
|
||||||
|
const dialog = new dijit.Dialog({
|
||||||
|
id: "emailArticleDlg",
|
||||||
|
title: __("Forward article by email"),
|
||||||
|
style: "width: 600px",
|
||||||
|
href: query});
|
||||||
|
|
||||||
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (dijit.byId("emailArticleDlg"))
|
// override default hotkey action if enabled
|
||||||
dijit.byId("emailArticleDlg").destroyRecursive();
|
Plugins.Mail = Plugins.Mail || {};
|
||||||
|
|
||||||
const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle¶m=" + encodeURIComponent(id);
|
|
||||||
|
|
||||||
const dialog = new dijit.Dialog({
|
|
||||||
id: "emailArticleDlg",
|
|
||||||
title: __("Forward article by email"),
|
|
||||||
style: "width: 600px",
|
|
||||||
href: query});
|
|
||||||
|
|
||||||
dialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
Plugins.Mail.onHotkey = function(id) {
|
||||||
|
Plugins.Mailto.send(id);
|
||||||
|
};
|
|
@ -21,7 +21,7 @@ class MailTo extends Plugin {
|
||||||
function hook_article_button($line) {
|
function hook_article_button($line) {
|
||||||
return "<img src=\"plugins/mailto/mail.png\"
|
return "<img src=\"plugins/mailto/mail.png\"
|
||||||
class='tagsPic' style=\"cursor : pointer\"
|
class='tagsPic' style=\"cursor : pointer\"
|
||||||
onclick=\"mailtoArticle(".$line["id"].")\"
|
onclick=\"Plugins.Mailto.send(".$line["id"].")\"
|
||||||
alt='Zoom' title='".__('Forward by email')."'>";
|
alt='Zoom' title='".__('Forward by email')."'>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue