mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 13:45:56 +00:00
plugins: load dialogs via xhr instead of http
This commit is contained in:
@@ -27,17 +27,17 @@ class Note extends Plugin {
|
||||
}
|
||||
|
||||
function edit() {
|
||||
$param = $_REQUEST['param'];
|
||||
$id = clean($_REQUEST['id']);
|
||||
|
||||
$sth = $this->pdo->prepare("SELECT note FROM ttrss_user_entries WHERE
|
||||
ref_id = ? AND owner_uid = ?");
|
||||
$sth->execute([$param, $_SESSION['uid']]);
|
||||
$sth->execute([$id, $_SESSION['uid']]);
|
||||
|
||||
if ($row = $sth->fetch()) {
|
||||
|
||||
$note = $row['note'];
|
||||
|
||||
print \Controls\hidden_tag("id", "$param");
|
||||
print \Controls\hidden_tag("id", $id);
|
||||
print \Controls\hidden_tag("op", "pluginhandler");
|
||||
print \Controls\hidden_tag("method", "setNote");
|
||||
print \Controls\hidden_tag("plugin", "note");
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/* global Plugins, xhrJson, Notify, fox, __ */
|
||||
/* global dojo, xhrPost, Plugins, xhrJson, Notify, fox, __ */
|
||||
|
||||
Plugins.Note = {
|
||||
edit: function(id) {
|
||||
const query = "backend.php?op=pluginhandler&plugin=note&method=edit¶m=" + encodeURIComponent(id);
|
||||
|
||||
const dialog = new fox.SingleUseDialog({
|
||||
id: "editNoteDlg",
|
||||
title: __("Edit article note"),
|
||||
execute: function () {
|
||||
if (this.validate()) {
|
||||
@@ -30,7 +27,15 @@ Plugins.Note = {
|
||||
});
|
||||
}
|
||||
},
|
||||
href: query,
|
||||
content: __("Loading, please wait...")
|
||||
});
|
||||
|
||||
const tmph = dojo.connect(dialog, 'onShow', function () {
|
||||
dojo.disconnect(tmph);
|
||||
|
||||
xhrPost("backend.php", {op: "pluginhandler", plugin: "note", method: "edit", id: id}, (transport) => {
|
||||
dialog.attr('content', transport.responseText);
|
||||
});
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
Reference in New Issue
Block a user