]> git.wh0rd.org Git - tt-rss.git/commitdiff
rework label counter behaviour
authorAndrew Dolgov <fox@bah.spb.su>
Fri, 9 Sep 2005 01:21:30 +0000 (02:21 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Fri, 9 Sep 2005 01:21:30 +0000 (02:21 +0100)
backend.php
functions.js
tt-rss.js

index 8c566cee4a32305ed81b9caf9d628dac6b789e9c..572fb092ade7845854bf9ac77b36f3af2ad2d38f 100644 (file)
@@ -37,7 +37,7 @@
                        error_reporting (0);
 
                        $tmp_result = db_query($link, "SELECT count(id) as count FROM ttrss_entries
-                               WHERE " . $line["sql_exp"]);
+                               WHERE (" . $line["sql_exp"] . ") AND unread = true");
 
                        $count = db_fetch_result($tmp_result, 0, "count");
 
                                error_reporting (0);
        
                                $tmp_result = db_query($link, "SELECT count(id) as count FROM ttrss_entries
-                                       WHERE " . $line["sql_exp"]);
+                                       WHERE (" . $line["sql_exp"] . ") AND unread = true");
 
                                $count = db_fetch_result($tmp_result, 0, "count");
+
+                               $class = "odd";
+
+                               if ($count > 0) {
+                                       $class .= "Unread";
+                               }
                                
                                error_reporting (E_ERROR | E_WARNING | E_PARSE);
 
                                printFeedEntry(-$line["id"]-11, 
-                                       "odd", $line["description"], $count, "images/label.png");
+                                       $class, $line["description"], $count, "images/label.png");
        
                        }
                }
index 0db4ea307205b6f1bf3273d4cbb34d21d40d6c33..8e7b9995787ba12b1b14d428030e69a8d976c3a4 100644 (file)
@@ -312,14 +312,19 @@ function label_counters_callback() {
 
                        var feedctr = f_document.getElementById("FEEDCTR-" + id);
                        var feedu = f_document.getElementById("FEEDU-" + id);
+                       var feedr = f_document.getElementById("FEEDR-" + id);
 
                        feedu.innerHTML = ctr;
 
                        if (ctr > 0) {
                                feedctr.className = "odd";
+                               if (!feedr.className.match("Unread") && id != -1) {
+                                       feedr.className = feedr.className + "Unread";
+                               }
                        } else {
                                feedctr.className = "invisible";
-                       }
+                               feedr.className = feedr.className.replace("Unread", "");
+                       }                       
                }
        }
 }
index d1bcad69221f9da77ec62b000e981cdb653447dc..ae16052cb05735d8e2bf80a5e324f2793667c1ab 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -70,7 +70,7 @@ function refetch_callback() {
 
                        if (ctr > 0) {
                                feedctr.className = "odd";
-                               if (id > 0 && !feedr.className.match("Unread")) {
+                               if (id != -1 && !feedr.className.match("Unread")) {
                                        feedr.className = feedr.className + "Unread";
                                }
                        } else {