From 538f87e41551745a49cacf41c1a5d3772d3581a6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 17 Feb 2021 14:08:06 +0300 Subject: [PATCH] af_psql_trgm: don't load dialog via http --- plugins/af_psql_trgm/init.js | 17 ++++++++++------- plugins/af_psql_trgm/init.php | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/plugins/af_psql_trgm/init.js b/plugins/af_psql_trgm/init.js index a22e673f6..e5bc21885 100644 --- a/plugins/af_psql_trgm/init.js +++ b/plugins/af_psql_trgm/init.js @@ -1,15 +1,18 @@ -/* global dijit, Plugins, __ */ +/* global dijit, dojo, Plugins, xhrPost, __ */ Plugins.Psql_Trgm = { showRelated: function (id) { - const query = "backend.php?op=pluginhandler&plugin=af_psql_trgm&method=showrelated¶m=" + encodeURIComponent(id); - const dialog = new dijit.Dialog({ title: __("Related articles"), - execute: function () { - // - }, - href: query, + content: __("Loading, please wait...") + }); + + const tmph = dojo.connect(dialog, "onShow", null, function (/* e */) { + dojo.disconnect(tmph); + + xhrPost("backend.php", {op: 'pluginhandler', plugin: 'af_psql_trgm', method: 'showrelated', id: id}, (transport) => { + dialog.attr('content', transport.responseText); + }); }); dialog.show(); diff --git a/plugins/af_psql_trgm/init.php b/plugins/af_psql_trgm/init.php index 3662e490a..d1a029adc 100644 --- a/plugins/af_psql_trgm/init.php +++ b/plugins/af_psql_trgm/init.php @@ -46,7 +46,7 @@ class Af_Psql_Trgm extends Plugin { } function showrelated() { - $id = (int) $_REQUEST['param']; + $id = (int) $_REQUEST['id']; $owner_uid = $_SESSION["uid"]; $sth = $this->pdo->prepare("SELECT title FROM ttrss_entries, ttrss_user_entries