mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 22:55:55 +00:00
move some dialogs to xhr loading
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
class Pref_Feeds extends Handler_Protected {
|
class Pref_Feeds extends Handler_Protected {
|
||||||
function csrf_ignore($method) {
|
function csrf_ignore($method) {
|
||||||
$csrf_ignored = array("index", "getfeedtree", "add", "editcats", "editfeed",
|
$csrf_ignored = array("index", "getfeedtree", "savefeedorder", "uploadicon");
|
||||||
"savefeedorder", "uploadicon", "feedswitherrors", "inactivefeeds",
|
|
||||||
"batchsubscribe");
|
|
||||||
|
|
||||||
return array_search($method, $csrf_ignored) !== false;
|
return array_search($method, $csrf_ignored) !== false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
class Pref_Labels extends Handler_Protected {
|
class Pref_Labels extends Handler_Protected {
|
||||||
|
|
||||||
function csrf_ignore($method) {
|
function csrf_ignore($method) {
|
||||||
$csrf_ignored = array("index", "getlabeltree", "edit");
|
$csrf_ignored = array("index", "getlabeltree");
|
||||||
|
|
||||||
return array_search($method, $csrf_ignored) !== false;
|
return array_search($method, $csrf_ignored) !== false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,8 +185,6 @@ const CommonDialogs = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
showFeedsWithErrors: function() {
|
showFeedsWithErrors: function() {
|
||||||
const query = {op: "pref-feeds", method: "feedsWithErrors"};
|
|
||||||
|
|
||||||
const dialog = new fox.SingleUseDialog({
|
const dialog = new fox.SingleUseDialog({
|
||||||
id: "errorFeedsDlg",
|
id: "errorFeedsDlg",
|
||||||
title: __("Feeds with update errors"),
|
title: __("Feeds with update errors"),
|
||||||
@@ -221,12 +219,15 @@ const CommonDialogs = {
|
|||||||
alert(__("No feeds selected."));
|
alert(__("No feeds selected."));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
execute: function () {
|
content: __("Loading, please wait...")
|
||||||
if (this.validate()) {
|
});
|
||||||
//
|
|
||||||
}
|
const tmph = dojo.connect(dialog, 'onShow', function () {
|
||||||
},
|
dojo.disconnect(tmph);
|
||||||
href: "backend.php?" + dojo.objectToQuery(query)
|
|
||||||
|
xhrPost("backend.php", {op: "pref-feeds", method: "feedsWithErrors"}, (transport) => {
|
||||||
|
dialog.attr('content', transport.responseText);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
@@ -313,7 +314,15 @@ const CommonDialogs = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
href: "backend.php?" + dojo.objectToQuery(query)
|
content: __("Loading, please wait...")
|
||||||
|
});
|
||||||
|
|
||||||
|
const tmph = dojo.connect(dialog, 'onShow', function () {
|
||||||
|
dojo.disconnect(tmph);
|
||||||
|
|
||||||
|
xhrPost("backend.php", {op: "pref-feeds", method: "editfeed", id: feed}, (transport) => {
|
||||||
|
dialog.attr('content', transport.responseText);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
|
|||||||
const bare_id = parseInt(id.substr(id.indexOf(':')+1));
|
const bare_id = parseInt(id.substr(id.indexOf(':')+1));
|
||||||
|
|
||||||
if (id.match("CAT:") && bare_id > 0) {
|
if (id.match("CAT:") && bare_id > 0) {
|
||||||
var menu = new dijit.Menu();
|
const menu = new dijit.Menu();
|
||||||
menu.row_id = bare_id;
|
menu.row_id = bare_id;
|
||||||
menu.item = args.item;
|
menu.item = args.item;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
|
|||||||
menu.bindDomNode(tnode.domNode);
|
menu.bindDomNode(tnode.domNode);
|
||||||
tnode._menu = menu;
|
tnode._menu = menu;
|
||||||
} else if (id.match("FEED:")) {
|
} else if (id.match("FEED:")) {
|
||||||
var menu = new dijit.Menu();
|
const menu = new dijit.Menu();
|
||||||
menu.row_id = bare_id;
|
menu.row_id = bare_id;
|
||||||
menu.item = args.item;
|
menu.item = args.item;
|
||||||
|
|
||||||
@@ -76,6 +76,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
|
|||||||
this.inherited(arguments);
|
this.inherited(arguments);
|
||||||
this.tree.model.store.save();
|
this.tree.model.store.save();
|
||||||
},
|
},
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
getRowClass: function (item, opened) {
|
getRowClass: function (item, opened) {
|
||||||
let rc = (!item.error || item.error == '') ? "dijitTreeRow" :
|
let rc = (!item.error || item.error == '') ? "dijitTreeRow" :
|
||||||
"dijitTreeRow Error";
|
"dijitTreeRow Error";
|
||||||
@@ -85,11 +86,12 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
|
|||||||
return rc;
|
return rc;
|
||||||
},
|
},
|
||||||
getIconClass: function (item, opened) {
|
getIconClass: function (item, opened) {
|
||||||
|
// eslint-disable-next-line no-nested-ternary
|
||||||
return (!item || this.model.store.getValue(item, 'type') == 'category') ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feed-icon";
|
return (!item || this.model.store.getValue(item, 'type') == 'category') ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feed-icon";
|
||||||
},
|
},
|
||||||
reload: function() {
|
reload: function() {
|
||||||
const searchElem = $("feed_search");
|
const searchElem = $("feed_search");
|
||||||
let search = (searchElem) ? searchElem.value : "";
|
const search = (searchElem) ? searchElem.value : "";
|
||||||
|
|
||||||
xhrPost("backend.php", { op: "pref-feeds", search: search }, (transport) => {
|
xhrPost("backend.php", { op: "pref-feeds", search: search }, (transport) => {
|
||||||
dijit.byId('feedsTab').attr('content', transport.responseText);
|
dijit.byId('feedsTab').attr('content', transport.responseText);
|
||||||
@@ -285,7 +287,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
|
|||||||
/* normalize unchecked checkboxes because [] is not serialized */
|
/* normalize unchecked checkboxes because [] is not serialized */
|
||||||
|
|
||||||
Object.keys(query).each((key) => {
|
Object.keys(query).each((key) => {
|
||||||
let val = query[key];
|
const val = query[key];
|
||||||
|
|
||||||
if (typeof val == "object" && val.length == 0)
|
if (typeof val == "object" && val.length == 0)
|
||||||
query[key] = ["off"];
|
query[key] = ["off"];
|
||||||
@@ -395,7 +397,15 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
|
|||||||
alert(__("No feeds selected."));
|
alert(__("No feeds selected."));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
href: 'backend.php?' + dojo.objectToQuery({op: 'pref-feeds', method: 'inactiveFeeds'})
|
content: __("Loading, please wait...")
|
||||||
|
});
|
||||||
|
|
||||||
|
const tmph = dojo.connect(dialog, 'onShow', function () {
|
||||||
|
dojo.disconnect(tmph);
|
||||||
|
|
||||||
|
xhrPost("backend.php", {op: "pref-feeds", method: "inactivefeeds"}, (transport) => {
|
||||||
|
dialog.attr('content', transport.responseText);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/f
|
|||||||
_createTreeNode: function(args) {
|
_createTreeNode: function(args) {
|
||||||
const tnode = this.inherited(arguments);
|
const tnode = this.inherited(arguments);
|
||||||
|
|
||||||
const fg_color = this.model.store.getValue(args.item, 'fg_color');
|
//const fg_color = this.model.store.getValue(args.item, 'fg_color');
|
||||||
const bg_color = this.model.store.getValue(args.item, 'bg_color');
|
//const bg_color = this.model.store.getValue(args.item, 'bg_color');
|
||||||
const type = this.model.store.getValue(args.item, 'type');
|
const type = this.model.store.getValue(args.item, 'type');
|
||||||
const bare_id = this.model.store.getValue(args.item, 'bare_id');
|
//const bare_id = this.model.store.getValue(args.item, 'bare_id');
|
||||||
|
|
||||||
if (type == 'label') {
|
if (type == 'label') {
|
||||||
const label = dojo.doc.createElement('i');
|
const label = dojo.doc.createElement('i');
|
||||||
@@ -59,9 +59,6 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/f
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
editLabel: function(id) {
|
editLabel: function(id) {
|
||||||
const query = "backend.php?op=pref-labels&method=edit&id=" +
|
|
||||||
encodeURIComponent(id);
|
|
||||||
|
|
||||||
const dialog = new fox.SingleUseDialog({
|
const dialog = new fox.SingleUseDialog({
|
||||||
id: "labelEditDlg",
|
id: "labelEditDlg",
|
||||||
title: __("Label Editor"),
|
title: __("Label Editor"),
|
||||||
@@ -114,7 +111,15 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/f
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
href: query
|
content: __("Loading, please wait...")
|
||||||
|
});
|
||||||
|
|
||||||
|
const tmph = dojo.connect(dialog, 'onShow', function () {
|
||||||
|
dojo.disconnect(tmph);
|
||||||
|
|
||||||
|
xhrPost("backend.php", {op: "pref-labels", method: "edit", id: id}, (transport) => {
|
||||||
|
dialog.attr('content', transport.responseText);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|||||||
Reference in New Issue
Block a user