diff options
author | Andrew Dolgov <[email protected]> | 2012-03-05 12:08:39 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-03-05 12:08:39 +0400 |
commit | 5b7bd238eeed1aa83fe47f715c79b16b42ab347f (patch) | |
tree | 85f2fa4e56dd5065f37e95f71d7e67d80ddf0895 /classes/pref_feeds.php | |
parent | d50edb08ba5d4bfe02d13ac09c7409c267689245 (diff) |
pref-feeds: apply patch by gmargo@forum to show/hide empty categories
Diffstat (limited to 'classes/pref_feeds.php')
-rw-r--r-- | classes/pref_feeds.php | 12 |
1 files changed, 10 insertions, 2 deletions
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 "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; print "<div onclick=\"editFeedCats()\" dojoType=\"dijit.MenuItem\">".__('Edit categories')."</div>"; + print "<div onclick=\"toggleHiddenFeedCats()\" + dojoType=\"dijit.MenuItem\">".__('(Un)hide empty categories')."</div>"; print "<div onclick=\"resetCatOrder()\" dojoType=\"dijit.MenuItem\">".__('Reset sort order')."</div>"; print "</div></div>"; |