prefs RPC optimizations
This commit is contained in:
parent
7726fa023c
commit
0e091d38cf
23
backend.php
23
backend.php
|
@ -207,19 +207,17 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($op == "pref-feeds") {
|
if ($op == "pref-rpc") {
|
||||||
|
|
||||||
$subop = $_GET["subop"];
|
|
||||||
|
|
||||||
if ($subop == "edit") {
|
$subop = $_GET["subop"];
|
||||||
print "<p>[Edit feed placeholder]</p>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($subop == "unread") {
|
if ($subop == "unread") {
|
||||||
$ids = split(",", $_GET["ids"]);
|
$ids = split(",", $_GET["ids"]);
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
pg_query("UPDATE ttrss_entries SET unread = true WHERE feed_id = '$id'");
|
pg_query("UPDATE ttrss_entries SET unread = true WHERE feed_id = '$id'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print "Marked selected feeds as read.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($subop == "read") {
|
if ($subop == "read") {
|
||||||
|
@ -227,6 +225,19 @@
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
pg_query("UPDATE ttrss_entries SET unread = false WHERE feed_id = '$id'");
|
pg_query("UPDATE ttrss_entries SET unread = false WHERE feed_id = '$id'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print "Marked selected feeds as unread.";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($op == "pref-feeds") {
|
||||||
|
|
||||||
|
$subop = $_GET["subop"];
|
||||||
|
|
||||||
|
if ($subop == "edit") {
|
||||||
|
print "<p>[Edit feed placeholder]</p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($subop == "remove") {
|
if ($subop == "remove") {
|
||||||
|
|
19
prefs.js
19
prefs.js
|
@ -32,7 +32,14 @@ function feedlist_callback() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_feeds() {
|
function notify_callback() {
|
||||||
|
var container = document.getElementById('notify');
|
||||||
|
if (xmlhttp.readyState == 4) {
|
||||||
|
container.innerHTML=xmlhttp.responseText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateFeedList() {
|
||||||
|
|
||||||
document.getElementById("feeds").innerHTML = "Loading feeds, please wait...";
|
document.getElementById("feeds").innerHTML = "Loading feeds, please wait...";
|
||||||
|
|
||||||
|
@ -111,9 +118,9 @@ function readSelectedFeeds() {
|
||||||
|
|
||||||
notify("Marking selected feeds as read...");
|
notify("Marking selected feeds as read...");
|
||||||
|
|
||||||
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=unread&ids="+
|
xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=unread&ids="+
|
||||||
param_escape(sel_rows.toString()), true);
|
param_escape(sel_rows.toString()), true);
|
||||||
xmlhttp.onreadystatechange=feedlist_callback;
|
xmlhttp.onreadystatechange=notify_callback;
|
||||||
xmlhttp.send(null);
|
xmlhttp.send(null);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -131,9 +138,9 @@ function unreadSelectedFeeds() {
|
||||||
|
|
||||||
notify("Marking selected feeds as unread...");
|
notify("Marking selected feeds as unread...");
|
||||||
|
|
||||||
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=unread&ids="+
|
xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=unread&ids="+
|
||||||
param_escape(sel_rows.toString()), true);
|
param_escape(sel_rows.toString()), true);
|
||||||
xmlhttp.onreadystatechange=feedlist_callback;
|
xmlhttp.onreadystatechange=notify_callback;
|
||||||
xmlhttp.send(null);
|
xmlhttp.send(null);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -166,7 +173,7 @@ function removeSelectedFeeds() {
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
|
||||||
update_feeds();
|
updateFeedList();
|
||||||
|
|
||||||
notify("");
|
notify("");
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
href="javascript:readSelectedFeeds()">Mark as read</a>
|
href="javascript:readSelectedFeeds()">Mark as read</a>
|
||||||
<a class="button"
|
<a class="button"
|
||||||
href="javascript:unreadSelectedFeeds()">Mark as unread</a>
|
href="javascript:unreadSelectedFeeds()">Mark as unread</a>
|
||||||
|
<a class="button"
|
||||||
|
href="javascript:updateFeedList()">Refresh</a>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue