]> git.wh0rd.org Git - tt-rss.git/commitdiff
mark feeds with update errors in feedlist (closes #8)
authorAndrew Dolgov <fox@bah.spb.su>
Fri, 16 Dec 2005 17:35:04 +0000 (18:35 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Fri, 16 Dec 2005 17:35:04 +0000 (18:35 +0100)
backend.php
functions.js
functions.php
tt-rss.css

index 8652a1c4301359093c14b60c508181e9be046bf0..974eb0a7e3761928ac337ebc784a634fbaa5b303 100644 (file)
@@ -55,6 +55,8 @@
 
        $fetch = $_GET["fetch"];
 
+       setcookie("ttrss_icons_url", ICONS_URL);
+
        function getAllCounters($link) {
                getLabelCounters($link);
                getFeedCounters($link);
                        $count = $line["count"];
                        $last_error = $line["last_error"];      
 
+                       $has_img = is_file(ICONS_DIR . "/$id.ico");
+
                        if (!$smart_mode || $old_counters[$id] != $count) {
                                $old_counters[$id] = $count;
                                $fctrs_modified = true;
                                } else {
                                        $error_part = "";
                                }
-                               
-                               print "<counter type=\"feed\" id=\"$id\" counter=\"$count\" $error_part/>";
+
+                               if ($has_img) {
+                                       $has_img_part = "hi=\"$has_img\"";
+                               } else {
+                                       $has_img_part = "";
+                               }                               
+
+                               print "<counter type=\"feed\" id=\"$id\" counter=\"$count\" $has_img_part $error_part/>";
                        }
                }
 
                                                AND owner_uid = '$owner_uid') as unread,
                                (SELECT title FROM ttrss_feed_categories 
                                        WHERE id = cat_id) AS category,
-                               cat_id,
+                               cat_id,last_error,
                                (SELECT collapsed FROM ttrss_feed_categories
                                        WHERE id = cat_id) AS collapsed
                                FROM ttrss_feeds WHERE owner_uid = '$owner_uid' ORDER BY $order_by_qpart");                     
                                }
                                
        //                      $class = ($lnum % 2) ? "even" : "odd";
-       
-                               $class = "feed";
+
+                               if ($line["last_error"]) {
+                                       $class = "error";
+                               } else {
+                                       $class = "feed";
+                               }
        
                                if ($unread > 0) $class .= "Unread";
        
index 53cee530918a7b2bf72e496eaa46367f5302565e..9193d9b7ba777e4874f9909aba5f6481bf88a04d 100644 (file)
@@ -361,6 +361,8 @@ function parse_counters(reply, f_document) {
                        var id = reply.childNodes[l].getAttribute("id");
                        var t = reply.childNodes[l].getAttribute("type");
                        var ctr = reply.childNodes[l].getAttribute("counter");
+                       var error = reply.childNodes[l].getAttribute("error");
+                       var has_img = reply.childNodes[l].getAttribute("hi");
        
                        if (id == "global-unread") {
                                parent.global_unread = ctr;
@@ -379,10 +381,25 @@ function parse_counters(reply, f_document) {
                        var feedctr = f_document.getElementById("FEEDCTR-" + id);
                        var feedu = f_document.getElementById("FEEDU-" + id);
                        var feedr = f_document.getElementById("FEEDR-" + id);
-               
+                       var feed_img = f_document.getElementById("FIMG-" + id);
+
                        if (feedctr && feedu && feedr) {
                
                                feedu.innerHTML = ctr;
+
+                               if (has_img && feed_img) {
+                                       if (error) {
+//                                             feed_img.src = "images/update_error.png";
+                                               feedr.className = feedr.className.replace("feed", "error");
+                                       } else if (id > 0) {
+                                               feedr.className = feedr.className.replace("error", "feed");
+//                                             if (has_img) {
+//                                                     feed_img.src = getCookie("ttrss_icons_url") + "/" + id + ".ico";
+//                                             } else {
+//                                                     feed_img.src = "images/blank_icon.gif";
+//                                             }
+                                       }
+                               }
        
                                if (ctr > 0) {                                  
                                        feedctr.className = "odd";
index 5a4683bf974b702a7d42907217ca284ead436896..78238a069e606cc662d1f10f5be59e4ef3713b5b 100644 (file)
        function printFeedEntry($feed_id, $class, $feed_title, $unread, $icon_file, $link) {
 
                if (file_exists($icon_file) && filesize($icon_file) > 0) {
-                               $feed_icon = "<img src=\"$icon_file\">";
+                               $feed_icon = "<img id=\"FIMG-$feed_id\" src=\"$icon_file\">";
                } else {
-                       $feed_icon = "<img src=\"images/blank_icon.gif\">";
+                       $feed_icon = "<img id=\"FIMG-$feed_id\" src=\"images/blank_icon.gif\">";
                }
 
                $feed = "<a href=\"javascript:viewfeed('$feed_id', 0);\">$feed_title</a>";
index 577acbe7b1e67f42b717bda26a5d2167ccaec724..55795e81a2bc4c93d85c5c8e6491d07d9ffcac1c 100644 (file)
@@ -217,12 +217,18 @@ ul.feedlist
 } */
 
 ul.feedlist li.feedUnread, 
+ul.feedlist li.errorUnread, 
 ul.feedlist li.labelUnread, 
 ul.feedlist li.virtUnread,
 ul.feedlist li.tagUnread {
        font-weight : bold;
 }
 
+ul.feedlist li.errorSelected a,
+ul.feedlist li.errorUnread a,
+ul.feedlist li.errorUnreadSelected a {
+       color : #f04040;
+}
 
 ul.feedlist li.feedSelected a,
 ul.feedlist li.labelSelected a,
@@ -238,7 +244,8 @@ ul.feedlist li.tagUnreadSelected a {
        color : #5050aa;
 }
 
-ul.feedlist li.feedUnreadSelected ,
+ul.feedlist li.feedUnreadSelected,
+ul.feedlist li.errorUnreadSelected,
 ul.feedlist li.labelUnreadSelected,
 ul.feedlist li.virtUnreadSelected,
 ul.feedlist li.tagUnreadSelected {