]> git.wh0rd.org Git - tt-rss.git/commitdiff
update feedlist immediately on refetch_callback completion, faster
authorAndrew Dolgov <fox@madoka.spb.ru>
Tue, 23 Aug 2005 06:43:20 +0000 (07:43 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Tue, 23 Aug 2005 06:43:20 +0000 (07:43 +0100)
backend.php
tt-rss.js

index 71dc030cb835b1311aa37b24e429abb686b4e8b3..e34cc4017e3dc2f8ba6507f1c28e8fba8b9d5336 100644 (file)
        $op = $_GET["op"];
        $fetch = $_GET["fetch"];
 
-       if ($op == "rpc") {
-
-               $subop = $_GET["subop"];
-
-               if ($subop == "forceUpdateAllFeeds") {
-                       print "[rpc] forceUpdateAll";
-                       update_all_feeds($link, true);                  
-               }
-
-               if ($subop == "updateAllFeeds") {
-                       print "[rpc] updateAll";
-                       update_all_feeds($link, false);
-               }
-               
-               if ($subop == "catchupPage") {
-
-                       $ids = split(",", $_GET["ids"]);
-
-                       foreach ($ids as $id) {
-
-                               pg_query("UPDATE ttrss_entries SET unread=false,last_read = NOW()
-                                       WHERE id = '$id'");
+       function outputFeedList($link) {
 
-                       }
-
-                       print "Marked active page as read.";
-               }
-
-       }
-       
-       if ($op == "feeds") {
-
-               $subop = $_GET["subop"];
-
-               if ($subop == "catchupAll") {
-                       pg_query("UPDATE ttrss_entries SET last_read = NOW(),unread = false");
-               }
-
-       //      update_all_feeds($link, $fetch);
-               
-               $result = pg_query("SELECT *,
+               $result = pg_query($link, "SELECT *,
                        (SELECT count(id) FROM ttrss_entries 
                                WHERE feed_id = ttrss_feeds.id) AS total,
                        (SELECT count(id) FROM ttrss_entries
 
                print "<div class=\"invisible\" id=\"FEEDTU\">$total_unread</div>";
 
+
+
+       }
+
+
+       if ($op == "rpc") {
+
+               $subop = $_GET["subop"];
+
+               if ($subop == "forceUpdateAllFeeds") {
+                       update_all_feeds($link, true);                  
+                       outputFeedList($link);
+               }
+
+               if ($subop == "updateAllFeeds") {
+                       update_all_feeds($link, false);
+                       outputFeedList($link);
+               }
+               
+               if ($subop == "catchupPage") {
+
+                       $ids = split(",", $_GET["ids"]);
+
+                       foreach ($ids as $id) {
+
+                               pg_query("UPDATE ttrss_entries SET unread=false,last_read = NOW()
+                                       WHERE id = '$id'");
+
+                       }
+
+                       print "Marked active page as read.";
+               }
+
+       }
+       
+       if ($op == "feeds") {
+
+               $subop = $_GET["subop"];
+
+               if ($subop == "catchupAll") {
+                       pg_query("UPDATE ttrss_entries SET last_read = NOW(),unread = false");
+               }
+
+               outputFeedList($link);
+
        }
 
        if ($op == "view") {
index e3f1fc906ab724d160a35b6b5e2e91974473916b..d4660d6243ca7a6ce10125da3f07e738ddd92a2b 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -46,12 +46,11 @@ function feedlist_callback() {
        if (xmlhttp.readyState == 4) {
                container.innerHTML=xmlhttp.responseText;
 
-               var feedtu = document.getElementById("FEEDTU");
-
-               if (feedtu) {
-                       total_unread = feedtu.innerHTML;
-                       update_title();
-               }
+//             var feedtu = document.getElementById("FEEDTU");
+//             if (feedtu) {
+//                     total_unread = feedtu.innerHTML;
+//                     update_title();
+//             }
 
                if (first_run) {
                        scheduleFeedUpdate(false);
@@ -103,7 +102,13 @@ function view_callback() {
 
 function refetch_callback() {
        if (xmlhttp_rpc.readyState == 4) {
-               updateFeedList(true, false);
+               notify("All feeds updated");
+               
+               var container = document.getElementById('feeds');
+
+               container.innerHTML = xmlhttp_rpc.responseText;
+
+               //updateFeedList(true, false);
        }
 }
 
@@ -114,9 +119,9 @@ function scheduleFeedUpdate(force) {
        var query_str = "backend.php?op=rpc&subop=";
 
        if (force) {
-               query_str = query_str = "forceUpdateAllFeeds";
+               query_str = query_str + "forceUpdateAllFeeds";
        } else {
-               query_str = query_str = "updateAllFeeds";
+               query_str = query_str + "updateAllFeeds";
        }
 
        if (xmlhttp_rpc.readyState == 4 || xmlhttp_rpc.readyState == 0) {