]> git.wh0rd.org Git - tt-rss.git/commitdiff
prefs RPC optimizations
authorAndrew Dolgov <fox@madoka.spb.ru>
Mon, 22 Aug 2005 05:38:07 +0000 (06:38 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Mon, 22 Aug 2005 05:38:07 +0000 (06:38 +0100)
backend.php
prefs.js
prefs.php

index 4a1d52ce752ec114c5d493678caf6084f262c686..d6e45098b8a028721388cb95194f8decee89b91f 100644 (file)
 
        }
 
-       if ($op == "pref-feeds") {
-       
-               $subop = $_GET["subop"];
+       if ($op == "pref-rpc") {
 
-               if ($subop == "edit") {
-                       print "<p>[Edit feed placeholder]</p>";
-               }
+               $subop = $_GET["subop"];
 
                if ($subop == "unread") {
                        $ids = split(",", $_GET["ids"]);
                        foreach ($ids as $id) {
                                pg_query("UPDATE ttrss_entries SET unread = true WHERE feed_id = '$id'");
                        }
+
+                       print "Marked selected feeds as read.";
                }
 
                if ($subop == "read") {
                        foreach ($ids as $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") {
index 001d5b0a85de122388fb3cf05e23fae399da2825..192e194fe2ab05f649b508c18bb4237caaf64e75 100644 (file)
--- a/prefs.js
+++ b/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...";
 
@@ -111,9 +118,9 @@ function readSelectedFeeds() {
 
                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);
-               xmlhttp.onreadystatechange=feedlist_callback;
+               xmlhttp.onreadystatechange=notify_callback;
                xmlhttp.send(null);
 
        } else {
@@ -131,9 +138,9 @@ function unreadSelectedFeeds() {
 
                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);
-               xmlhttp.onreadystatechange=feedlist_callback;
+               xmlhttp.onreadystatechange=notify_callback;
                xmlhttp.send(null);
 
        } else {
@@ -166,7 +173,7 @@ function removeSelectedFeeds() {
 
 function init() {
        
-       update_feeds();
+       updateFeedList();
 
        notify("");
 
index 79ffcf1115a380fc258539b00ad2fce6125eb3a7..1d3755a606c310ecb021c2144fa4dbf179be5880 100644 (file)
--- a/prefs.php
+++ b/prefs.php
@@ -42,6 +42,8 @@
                                href="javascript:readSelectedFeeds()">Mark as read</a>&nbsp;
                        <a class="button" 
                                href="javascript:unreadSelectedFeeds()">Mark as unread</a>&nbsp;
+                       <a class="button" 
+                               href="javascript:updateFeedList()">Refresh</a>&nbsp;
 
                <hr>