From 60288f02e8947282bf9226f63d0ce052f9c9ac61 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 20 Feb 2020 14:14:45 +0300 Subject: 1. feedtree: show counters for marked articles if view-mode == marked 2. hide/show relevant counter nodes using css 3. cleanup some counter-related code 4. compile default css into light theme to prevent cache-related issues --- classes/counters.php | 11 ++++++++--- classes/pref/feeds.php | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'classes') diff --git a/classes/counters.php b/classes/counters.php index 534dfe380..63143a503 100644 --- a/classes/counters.php +++ b/classes/counters.php @@ -175,6 +175,9 @@ class Counters { "auxcounter" => (int) $auxctr ]; + if ($i == -1) + $cv["markedcounter"] = $auxctr; + array_push($ret, $cv); } @@ -205,7 +208,8 @@ class Counters { $sth = $pdo->prepare("SELECT id, caption, - SUM(CASE WHEN u1.unread = true THEN 1 ELSE 0 END) AS unread, + SUM(CASE WHEN u1.unread = true THEN 1 ELSE 0 END) AS count_unread, + SUM(CASE WHEN u1.marked = true THEN 1 ELSE 0 END) AS count_marked, COUNT(u1.unread) AS total FROM ttrss_labels2 LEFT JOIN ttrss_user_labels2 ON (ttrss_labels2.id = label_id) @@ -220,8 +224,9 @@ class Counters { $cv = [ "id" => $id, - "counter" => (int) $line["unread"], - "auxcounter" => (int) $line["total"] + "counter" => (int) $line["count_unread"], + "auxcounter" => (int) $line["total"], + "markedcounter" => (int) $line["count_marked"] ]; if ($descriptions) diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index b3aeec086..6d7295beb 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1393,7 +1393,7 @@ class Pref_Feeds extends Handler_Protected { $obj['items'] = array(); $obj['name'] = Feeds::getCategoryTitle($cat_id); $obj['type'] = 'category'; - $obj['unread'] = (int) Feeds::getCategoryUnread($cat_id); + $obj['unread'] = -1; //(int) Feeds::getCategoryUnread($cat_id); $obj['bare_id'] = $cat_id; return $obj; -- cgit v1.2.3