feedlist: do not show labels folder when there are no labels

This commit is contained in:
Andrew Dolgov 2010-11-21 20:54:25 +03:00
parent dbf8845e3b
commit d4f46bc1fd
1 changed files with 25 additions and 22 deletions

View File

@ -4221,30 +4221,33 @@
$result = db_query($link, "SELECT * FROM $result = db_query($link, "SELECT * FROM
ttrss_labels2 WHERE owner_uid = '$owner_uid' ORDER by caption"); ttrss_labels2 WHERE owner_uid = '$owner_uid' ORDER by caption");
if (get_pref($link, 'ENABLE_FEED_CATS')) { if (db_num_rows($result) > 0) {
$cat_hidden = get_pref($link, "_COLLAPSED_LABELS");
$cat = feedlist_init_cat($link, -2, $cat_hidden);
} else {
$cat['items'] = array();
}
while ($line = db_fetch_assoc($result)) { if (get_pref($link, 'ENABLE_FEED_CATS')) {
$cat_hidden = get_pref($link, "_COLLAPSED_LABELS");
$cat = feedlist_init_cat($link, -2, $cat_hidden);
} else {
$cat['items'] = array();
}
$label_id = -$line['id'] - 11; while ($line = db_fetch_assoc($result)) {
$count = getFeedUnread($link, $label_id);
$feed = feedlist_init_feed($link, $label_id, false, $count); $label_id = -$line['id'] - 11;
$count = getFeedUnread($link, $label_id);
$feed['fg_color'] = $line['fg_color']; $feed = feedlist_init_feed($link, $label_id, false, $count);
$feed['bg_color'] = $line['bg_color'];
array_push($cat['items'], $feed); $feed['fg_color'] = $line['fg_color'];
} $feed['bg_color'] = $line['bg_color'];
if ($enable_cats) { array_push($cat['items'], $feed);
array_push($feedlist['items'], $cat); }
} else {
$feedlist['items'] = array_merge($feedlist['items'], $cat['items']); if ($enable_cats) {
array_push($feedlist['items'], $cat);
} else {
$feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
}
} }
} }