$lnum = 0;
+ $total_unread = 0;
+
while ($line = pg_fetch_assoc($result)) {
$feed = $line["title"];
if ($unread > 0) $class .= "Unread";
+ $total_unread += $unread;
+
print "<tr class=\"$class\" id=\"FEEDR-$feed_id\">";
$feed = "<a href=\"javascript:viewfeed($feed_id, 0);\">$feed</a>";
print "</table>";
+ print "<div class=\"invisible\" id=\"FEEDTU\">$total_unread</div>";
+
}
if ($op == "view") {
EXTRACT(EPOCH FROM NOW()) - EXTRACT(EPOCH FROM last_updated) > " .
MIN_UPDATE_TIME);
+ $num_unread = 0;
+
while ($line = pg_fetch_assoc($result)) {
- update_rss_feed($link, $line["feed_url"], $line["id"]);
+ $num_unread += update_rss_feed($link, $line["feed_url"], $line["id"]);
}
}
function update_rss_feed($link, $feed_url, $feed) {
$rss = fetch_rss($feed_url);
+
+ $num_unread = 0;
if ($rss) {
'$entry_timestamp', '$entry_content', '$feed',
'$content_md5')";
- pg_query($link, $query);
+ $result = pg_query($link, $query);
+
+ if ($result) ++$num_unread;
} else {
$result = pg_query($link, $query);
-
-// print "$entry_guid - $entry_timestamp - $entry_title -
-// $entry_link - $entry_id<br>";
+ if ($result) ++$num_unread;
}
}
- $result = pg_query($link, "UPDATE ttrss_feeds SET last_updated = NOW()");
+ if ($result) {
+ $result = pg_query($link, "UPDATE ttrss_feeds SET last_updated = NOW()");
+ }
}
var xmlhttp = false;
+var total_unread = 0;
+
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
var container = document.getElementById('feeds');
if (xmlhttp.readyState == 4) {
container.innerHTML=xmlhttp.responseText;
+
+ var feedtu = document.getElementById("FEEDTU");
+
+ if (feedtu) {
+ total_unread = feedtu.innerHTML;
+ update_title();
+ }
}
}
var feedr = document.getElementById("FEEDR-" + feed_id);
feedr.className = feedr.className.replace("Unread", "");
}
- }
+
+ total_unread--;
+
+ update_title();
+ }
document.getElementById('content').innerHTML='Loading, please wait...';
}
-function init() {
+function update_title() {
+ //document.title = "Tiny Tiny RSS (" + total_unread + " unread)";
+}
+function init() {
update_feed_list(false, false);
-
setTimeout("timeout()", 1800*1000);
-
-
}