mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2026-02-05 03:47:49 +00:00
plugins: load dialogs via xhr instead of http
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* global Plugins, Headlines, fox, __ */
|
||||
/* global Plugins, Headlines, xhrPost, dojo, fox, __ */
|
||||
|
||||
Plugins.Mailto = {
|
||||
send: function (id) {
|
||||
@@ -13,12 +13,19 @@ Plugins.Mailto = {
|
||||
id = ids.toString();
|
||||
}
|
||||
|
||||
const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle¶m=" + encodeURIComponent(id);
|
||||
|
||||
const dialog = new fox.SingleUseDialog({
|
||||
id: "emailArticleDlg",
|
||||
title: __("Forward article by email"),
|
||||
href: query});
|
||||
content: __("Loading, please wait...")
|
||||
});
|
||||
|
||||
const tmph = dojo.connect(dialog, 'onShow', function () {
|
||||
dojo.disconnect(tmph);
|
||||
|
||||
xhrPost("backend.php", {op: "pluginhandler", plugin: "mailto", method: "emailArticle", ids: id}, (transport) => {
|
||||
dialog.attr('content', transport.responseText);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class MailTo extends Plugin {
|
||||
}
|
||||
|
||||
function get_js() {
|
||||
return file_get_contents(dirname(__FILE__) . "/init.js");
|
||||
return file_get_contents(__DIR__ . "/init.js");
|
||||
}
|
||||
|
||||
function hook_article_button($line) {
|
||||
@@ -31,7 +31,7 @@ class MailTo extends Plugin {
|
||||
|
||||
function emailArticle() {
|
||||
|
||||
$ids = explode(",", $_REQUEST['param']);
|
||||
$ids = explode(",", clean($_REQUEST['ids']));
|
||||
$ids_qmarks = arr_qmarks($ids);
|
||||
|
||||
$tpl = new Templator();
|
||||
@@ -85,7 +85,7 @@ class MailTo extends Plugin {
|
||||
print "<p>";
|
||||
|
||||
print "<footer class='text-center'>";
|
||||
print "<button dojoType='dijit.form.Button' onclick=\"dijit.byId('emailArticleDlg').hide()\">".__('Close this dialog')."</button>";
|
||||
print \Controls\submit_tag(__('Close this dialog'));
|
||||
print "</footer>";
|
||||
|
||||
//return;
|
||||
|
||||
Reference in New Issue
Block a user