From 5b7bd238eeed1aa83fe47f715c79b16b42ab347f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 5 Mar 2012 12:08:39 +0400 Subject: pref-feeds: apply patch by gmargo@forum to show/hide empty categories --- classes/pref_feeds.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'classes/pref_feeds.php') diff --git a/classes/pref_feeds.php b/classes/pref_feeds.php index ec594522c..a091b735b 100644 --- a/classes/pref_feeds.php +++ b/classes/pref_feeds.php @@ -45,6 +45,7 @@ class Pref_Feeds extends Protected_Handler { $root['type'] = 'category'; if (get_pref($this->link, 'ENABLE_FEED_CATS')) { + $show_empty_cats = get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS'); $result = db_query($this->link, "SELECT id, title FROM ttrss_feed_categories WHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY order_id, title"); @@ -80,7 +81,7 @@ class Pref_Feeds extends Protected_Handler { $cat['param'] = T_sprintf('(%d feeds)', count($cat['items'])); - if (count($cat['items']) > 0) + if (count($cat['items']) > 0 || $show_empty_cats) array_push($root['items'], $cat); $root['param'] += count($cat['items']); @@ -118,7 +119,7 @@ class Pref_Feeds extends Protected_Handler { $cat['param'] = T_sprintf('(%d feeds)', count($cat['items'])); - if (count($cat['items']) > 0) + if (count($cat['items']) > 0 || $show_empty_cats) array_push($root['items'], $cat); $root['param'] += count($cat['items']); @@ -170,6 +171,11 @@ class Pref_Feeds extends Protected_Handler { return; } + function togglehiddenfeedcats() { + set_pref($this->link, '_PREFS_SHOW_EMPTY_CATS', + (get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS') ? 'false' : 'true')); + } + function savefeedorder() { $data = json_decode($_POST['payload'], true); @@ -1328,6 +1334,8 @@ class Pref_Feeds extends Protected_Handler { print "
"; print "
".__('Edit categories')."
"; + print "
".__('(Un)hide empty categories')."
"; print "
".__('Reset sort order')."
"; print "
"; -- cgit v1.2.3