summaryrefslogtreecommitdiff
path: root/backend.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-09-09 03:47:39 +0100
committerAndrew Dolgov <[email protected]>2005-09-09 03:47:39 +0100
commit8073cce71eb6120bac0e21adb670fdfc6f05fad1 (patch)
treef6985fae6d25130fc829388e14d99077d44cc087 /backend.php
parent392d45635b488073e247f179cdbc8f94d9aa5d04 (diff)
further label/vfeed/feed behaviour unification
Diffstat (limited to 'backend.php')
-rw-r--r--backend.php26
1 files changed, 21 insertions, 5 deletions
diff --git a/backend.php b/backend.php
index 572fb092a..9993d88a9 100644
--- a/backend.php
+++ b/backend.php
@@ -21,7 +21,7 @@
function getLabelCounters($link) {
$result = db_query($link, "SELECT count(id) as count FROM ttrss_entries
- WHERE marked = true");
+ WHERE marked = true AND unread = true");
$count = db_fetch_result($result, 0, "count");
@@ -48,8 +48,19 @@
}
}
- function getFeedCounters($link) {
+ function getFeedCounter($link, $id) {
+
+ $result = db_query($link, "SELECT
+ count(id) as count FROM ttrss_entries
+ WHERE feed_id = '$id' AND unread = true");
+
+ $count = db_fetch_result($result, 0, "count");
+
+ print "<feed id=\"$id\" counter=\"$count\"/>";
+ }
+ function getFeedCounters($link) {
+
$result = db_query($link, "SELECT id,
(SELECT count(id) FROM ttrss_entries WHERE feed_id = ttrss_feeds.id
AND unread = true) as count
@@ -79,7 +90,7 @@
/* virtual feeds */
$result = db_query($link, "SELECT count(id) as num_starred
- FROM ttrss_entries WHERE marked = true");
+ FROM ttrss_entries WHERE marked = true AND unread = true");
$num_starred = db_fetch_result($result, 0, "num_starred");
printFeedEntry(-1, "odd", "Starred articles", $num_starred, "images/mark_set.png");
@@ -172,8 +183,12 @@
$subop = $_GET["subop"];
if ($subop == "getLabelCounters") {
+ $aid = $_GET["aid"];
print "<rpc-reply>";
getLabelCounters($link);
+ if ($aid) {
+ getFeedCounter($link, $aid);
+ }
print "</rpc-reply>";
}
@@ -260,6 +275,7 @@
if ($op == "view") {
$id = $_GET["id"];
+ $feed_id = $_GET["feed"];
$result = db_query($link, "UPDATE ttrss_entries SET unread = false,last_read = NOW() WHERE id = '$id'");
@@ -315,7 +331,7 @@
print "</div>";
print "<script type=\"text/javascript\">
- update_label_counters();
+ update_label_counters($feed_id);
</script>";
}
@@ -587,7 +603,7 @@
feedctr.className = 'invisible';
}
- update_label_counters();
+ update_label_counters($feed);
// p_notify(\"\");