mark feeds with update errors in feedlist (closes #8)

This commit is contained in:
Andrew Dolgov 2005-12-16 18:35:04 +01:00
parent da47161fbd
commit 023fe0377d
4 changed files with 47 additions and 9 deletions

View file

@ -55,6 +55,8 @@
$fetch = $_GET["fetch"]; $fetch = $_GET["fetch"];
setcookie("ttrss_icons_url", ICONS_URL);
function getAllCounters($link) { function getAllCounters($link) {
getLabelCounters($link); getLabelCounters($link);
getFeedCounters($link); getFeedCounters($link);
@ -264,6 +266,8 @@
$count = $line["count"]; $count = $line["count"];
$last_error = $line["last_error"]; $last_error = $line["last_error"];
$has_img = is_file(ICONS_DIR . "/$id.ico");
if (!$smart_mode || $old_counters[$id] != $count) { if (!$smart_mode || $old_counters[$id] != $count) {
$old_counters[$id] = $count; $old_counters[$id] = $count;
$fctrs_modified = true; $fctrs_modified = true;
@ -274,7 +278,13 @@
$error_part = ""; $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/>";
} }
} }
@ -407,7 +417,7 @@
AND owner_uid = '$owner_uid') as unread, AND owner_uid = '$owner_uid') as unread,
(SELECT title FROM ttrss_feed_categories (SELECT title FROM ttrss_feed_categories
WHERE id = cat_id) AS category, WHERE id = cat_id) AS category,
cat_id, cat_id,last_error,
(SELECT collapsed FROM ttrss_feed_categories (SELECT collapsed FROM ttrss_feed_categories
WHERE id = cat_id) AS collapsed WHERE id = cat_id) AS collapsed
FROM ttrss_feeds WHERE owner_uid = '$owner_uid' ORDER BY $order_by_qpart"); FROM ttrss_feeds WHERE owner_uid = '$owner_uid' ORDER BY $order_by_qpart");
@ -442,7 +452,11 @@
// $class = ($lnum % 2) ? "even" : "odd"; // $class = ($lnum % 2) ? "even" : "odd";
$class = "feed"; if ($line["last_error"]) {
$class = "error";
} else {
$class = "feed";
}
if ($unread > 0) $class .= "Unread"; if ($unread > 0) $class .= "Unread";

View file

@ -361,6 +361,8 @@ function parse_counters(reply, f_document) {
var id = reply.childNodes[l].getAttribute("id"); var id = reply.childNodes[l].getAttribute("id");
var t = reply.childNodes[l].getAttribute("type"); var t = reply.childNodes[l].getAttribute("type");
var ctr = reply.childNodes[l].getAttribute("counter"); 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") { if (id == "global-unread") {
parent.global_unread = ctr; parent.global_unread = ctr;
@ -379,11 +381,26 @@ function parse_counters(reply, f_document) {
var feedctr = f_document.getElementById("FEEDCTR-" + id); var feedctr = f_document.getElementById("FEEDCTR-" + id);
var feedu = f_document.getElementById("FEEDU-" + id); var feedu = f_document.getElementById("FEEDU-" + id);
var feedr = f_document.getElementById("FEEDR-" + id); var feedr = f_document.getElementById("FEEDR-" + id);
var feed_img = f_document.getElementById("FIMG-" + id);
if (feedctr && feedu && feedr) { if (feedctr && feedu && feedr) {
feedu.innerHTML = ctr; 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) { if (ctr > 0) {
feedctr.className = "odd"; feedctr.className = "odd";
if (!feedr.className.match("Unread")) { if (!feedr.className.match("Unread")) {

View file

@ -596,9 +596,9 @@
function printFeedEntry($feed_id, $class, $feed_title, $unread, $icon_file, $link) { function printFeedEntry($feed_id, $class, $feed_title, $unread, $icon_file, $link) {
if (file_exists($icon_file) && filesize($icon_file) > 0) { 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 { } 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>"; $feed = "<a href=\"javascript:viewfeed('$feed_id', 0);\">$feed_title</a>";

View file

@ -217,12 +217,18 @@ ul.feedlist
} */ } */
ul.feedlist li.feedUnread, ul.feedlist li.feedUnread,
ul.feedlist li.errorUnread,
ul.feedlist li.labelUnread, ul.feedlist li.labelUnread,
ul.feedlist li.virtUnread, ul.feedlist li.virtUnread,
ul.feedlist li.tagUnread { ul.feedlist li.tagUnread {
font-weight : bold; 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.feedSelected a,
ul.feedlist li.labelSelected a, ul.feedlist li.labelSelected a,
@ -238,7 +244,8 @@ ul.feedlist li.tagUnreadSelected a {
color : #5050aa; color : #5050aa;
} }
ul.feedlist li.feedUnreadSelected , ul.feedlist li.feedUnreadSelected,
ul.feedlist li.errorUnreadSelected,
ul.feedlist li.labelUnreadSelected, ul.feedlist li.labelUnreadSelected,
ul.feedlist li.virtUnreadSelected, ul.feedlist li.virtUnreadSelected,
ul.feedlist li.tagUnreadSelected { ul.feedlist li.tagUnreadSelected {