]> git.wh0rd.org - tt-rss.git/commitdiff
disable btnCatchupPage when there is nothing to catchup
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 26 Aug 2005 06:18:48 +0000 (07:18 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 26 Aug 2005 06:18:48 +0000 (07:18 +0100)
backend.php
tt-rss.js

index 1ae88917e6721102b72f9ea5e8e6743850406fdb..83d86458fd21e577e8afcf9f3e29c47c266617bb 100644 (file)
                        feed_id = '$feed' ORDER BY updated DESC LIMIT ".HEADLINES_PER_PAGE." OFFSET $skip");
 
                $lnum = 0;
+               
+               $num_unread = 0;
 
                while ($line = pg_fetch_assoc($result)) {
 
 
                        if ($line["last_read_ts"] < $line["updated_ts"] && $line["unread"] == "f") {
                                $update_pic = "<img src=\"images/updated.png\" alt=\"Updated\">";
+                               ++$num_unread;
                        } else {
                                $update_pic = "&nbsp;";
                        }
 
-                       if ($line["unread"] == "t") 
+                       if ($line["unread"] == "t") {
                                $class .= "Unread";
+                               ++$num_unread;
+                       }
 
                        $id = $line["id"];
                        $feed_id = $line["feed_id"];
                
                print "&nbsp;&nbsp;Mark as read: ";
                
-               print "<a class=\"button\" 
-                       href=\"javascript:catchupPage($feed);\">This Page</a>";
-               print "&nbsp;";
+               if ($num_unread > 0) {
+                       print "<a class=\"button\" id=\"btnCatchupPage\" 
+                               href=\"javascript:catchupPage($feed);\">This Page</a>";
+                       print "&nbsp;";
+               } else {
+                       print "<a class=\"disabledButton\">This Page</a>";
+                       print "&nbsp;";
+               }
+               
                print "<a class=\"button\" 
                        href=\"javascript:viewfeed($feed, $skip, 'MarkAllRead');\">All Posts</a>";
 
index 422d14d0d47a5482e2c31e8b26ee581a7c961b7f..a8766ad28f7cc6657c7819a3ce7b994489fa6048 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -210,6 +210,11 @@ function catchupPage(feed) {
                        param_escape(rows.toString());
        
                notify("Marking this page as read...");
+
+               var button = document.getElementById("btnCatchupPage");
+
+               button.className = "disabledButton";
+               button.href = "";
        
                xmlhttp.open("GET", query_str, true);
                xmlhttp.onreadystatechange=notify_callback;