From 91ff844a863a374a00e1604348943f1815e7e4e0 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 23 Nov 2005 08:07:04 +0100 Subject: [PATCH] feed categories --- NEWS | 1 + backend.php | 285 ++++++++++++++++++++++++++++++++-- functions.js | 24 +++ prefs.js | 165 ++++++++++++++------ schema/ttrss_schema_mysql.sql | 2 +- schema/ttrss_schema_pgsql.sql | 2 +- tt-rss.css | 30 +++- 7 files changed, 438 insertions(+), 71 deletions(-) diff --git a/NEWS b/NEWS index b06ef3a59..2922fb8a1 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ v1.1 (Dec xy, 2005) * Interactive user preferences editor * Per-feed content filters * Support for user stylesheets + * Feed categories v1.0.7 (Nov 14, 2005) diff --git a/backend.php b/backend.php index 1dcfd4deb..f0ad01499 100644 --- a/backend.php +++ b/backend.php @@ -172,6 +172,11 @@ /* virtual feeds */ + if (get_pref($link, 'ENABLE_FEED_CATS')) { + print "
  • Special
  • "; + print ""; + } + if (get_pref($link, 'ENABLE_LABELS')) { $result = db_query($link, "SELECT id,sql_exp,description FROM ttrss_labels WHERE owner_uid = '$owner_uid' ORDER by description"); if (db_num_rows($result) > 0) { - print "

  • "; + if (get_pref($link, 'ENABLE_FEED_CATS')) { + print "
  • Labels
  • "; + print ""; + } + } + + } + +// if (!get_pref($link, 'ENABLE_FEED_CATS')) { + print "

  • "; +// } + + if (get_pref($link, 'ENABLE_FEED_CATS')) { + $order_by_qpart = "category,title"; + } else { + $order_by_qpart = "title"; } - - print "

  • "; $result = db_query($link, "SELECT *, (SELECT count(id) FROM ttrss_entries,ttrss_user_entries @@ -230,8 +259,10 @@ (SELECT count(id) FROM ttrss_entries,ttrss_user_entries WHERE feed_id = ttrss_feeds.id AND unread = true AND ttrss_user_entries.ref_id = ttrss_entries.id - AND owner_uid = '$owner_uid') as unread - FROM ttrss_feeds WHERE owner_uid = '$owner_uid' ORDER BY title"); + AND owner_uid = '$owner_uid') as unread, + (SELECT title FROM ttrss_feed_categories + WHERE id = cat_id) AS category + FROM ttrss_feeds WHERE owner_uid = '$owner_uid' ORDER BY $order_by_qpart"); $actid = $_GET["actid"]; @@ -240,6 +271,8 @@ $lnum = 0; $total_unread = 0; + + $category = ""; while ($line = db_fetch_assoc($result)) { @@ -250,6 +283,12 @@ $total = $line["total"]; $unread = $line["unread"]; + + $tmp_category = $line["category"]; + + if (!$tmp_category) { + $tmp_category = "Uncategorized"; + } // $class = ($lnum % 2) ? "even" : "odd"; @@ -262,11 +301,25 @@ } $total_unread += $unread; + + if ($category != $tmp_category && get_pref($link, 'ENABLE_FEED_CATS')) { + + if ($category) { + print ""; + } + + $category = $tmp_category; + + print "
  • $category
  • "; + print "