From 023fe0377d698287c25e59da0f282b108957540e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 16 Dec 2005 18:35:04 +0100 Subject: [PATCH] mark feeds with update errors in feedlist (closes #8) --- backend.php | 24 +++++++++++++++++++----- functions.js | 19 ++++++++++++++++++- functions.php | 4 ++-- tt-rss.css | 9 ++++++++- 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/backend.php b/backend.php index 8652a1c43..974eb0a7e 100644 --- a/backend.php +++ b/backend.php @@ -55,6 +55,8 @@ $fetch = $_GET["fetch"]; + setcookie("ttrss_icons_url", ICONS_URL); + function getAllCounters($link) { getLabelCounters($link); getFeedCounters($link); @@ -264,6 +266,8 @@ $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; @@ -273,8 +277,14 @@ } else { $error_part = ""; } - - print ""; + + if ($has_img) { + $has_img_part = "hi=\"$has_img\""; + } else { + $has_img_part = ""; + } + + print ""; } } @@ -407,7 +417,7 @@ 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"); @@ -441,8 +451,12 @@ } // $class = ($lnum % 2) ? "even" : "odd"; - - $class = "feed"; + + if ($line["last_error"]) { + $class = "error"; + } else { + $class = "feed"; + } if ($unread > 0) $class .= "Unread"; diff --git a/functions.js b/functions.js index 53cee5309..9193d9b7b 100644 --- a/functions.js +++ b/functions.js @@ -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"; diff --git a/functions.php b/functions.php index 5a4683bf9..78238a069 100644 --- a/functions.php +++ b/functions.php @@ -596,9 +596,9 @@ function printFeedEntry($feed_id, $class, $feed_title, $unread, $icon_file, $link) { if (file_exists($icon_file) && filesize($icon_file) > 0) { - $feed_icon = ""; + $feed_icon = ""; } else { - $feed_icon = ""; + $feed_icon = ""; } $feed = "$feed_title"; diff --git a/tt-rss.css b/tt-rss.css index 577acbe7b..55795e81a 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -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 {