]> git.wh0rd.org Git - tt-rss.git/commitdiff
rework auto-refresh method if number of subscriptions changed
authorAndrew Dolgov <fox@bah.spb.su>
Sun, 13 Aug 2006 09:45:30 +0000 (10:45 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sun, 13 Aug 2006 09:45:30 +0000 (10:45 +0100)
functions.js
functions.php

index 4ab997d80b74af77c28ab93e376f6fd98019797d..269093022f82e9a8aad616ed348abde95f8cbe81 100644 (file)
@@ -490,15 +490,16 @@ function parse_counters(reply, scheduled_call) {
                        var has_img = reply.childNodes[l].getAttribute("hi");
                        var updated = reply.childNodes[l].getAttribute("updated");
        
-                       if (t == "feed") {
-                               feeds_found++;
-                       }
-
                        if (id == "global-unread") {
                                title_obj.global_unread = ctr;
                                title_obj.updateTitle();
                                continue;
                        }
+
+                       if (id == "subscribed-feeds") {
+                               feeds_found = ctr;
+                               continue;
+                       }
        
                        if (t == "category") {
                                var catctr = f_document.getElementById("FCATCTR-" + id);
@@ -573,10 +574,9 @@ function parse_counters(reply, scheduled_call) {
                debug("Feed counters, C: " + feeds_found + ", S:" + feeds_stored);
 
                if (feeds_stored != feeds_found) {
-                       if (feeds_found != 0) {
-                               getMainContext().number_of_feeds = feeds_found;
-                       }
-                       if (feeds_stored != 0 && feeds_found != 0) {
+                       getMainContext().number_of_feeds = feeds_found;
+
+                       if (feeds_stored != 0) {
                                debug("Subscribed feed number changed, refreshing feedlist");
                                updateFeedList();
                        }
index a46061bda64bc10ebaf2235c0d73c9ee6ba0d882..4ca5582d3093d1b03463bc8ceff8b1af221e0cae 100644 (file)
                if ($global_unread == -1) {     
                        $global_unread = getGlobalUnread($link);
                }
-               print "<counter type=\"global\" id='global-unread' counter='$global_unread'/>";
+               print "<counter type=\"global\" id='global-unread' 
+                       counter='$global_unread'/>";
+
+               $result = db_query($link, "SELECT COUNT(id) AS fn FROM 
+                       ttrss_feeds WHERE owner_uid = " . $_SESSION["uid"]);
+
+               $subscribed_feeds = db_fetch_result($result, 0, "fn");
+
+               print "<counter type=\"global\" id='subscribed-feeds' 
+                       counter='$subscribed_feeds'/>";
+
        }
 
        function getTagCounters($link, $smart_mode = SMART_RPC_COUNTERS) {