From: Andrew Dolgov Date: Sat, 25 Feb 2006 19:41:27 +0000 (+0100) Subject: search by category (closes #29) X-Git-Tag: schema_freeze_for_1.1.4~47 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=b00058235a66d3e3df3fa7a12b0d499563fae05b;p=tt-rss.git search by category (closes #29) --- diff --git a/backend.php b/backend.php index 3dda8d0b..91506880 100644 --- a/backend.php +++ b/backend.php @@ -1244,11 +1244,33 @@ // override query strategy and enable feed display when searching globally if ($search && $search_mode == "All feeds") { $query_strategy_part = "ttrss_entries.id > 0"; - $vfeed_query_part = "ttrss_feeds.title AS feed_title,"; + $vfeed_query_part = "ttrss_feeds.title AS feed_title,"; } else if (sprintf("%d", $feed) == 0) { $query_strategy_part = "ttrss_entries.id > 0"; $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE id = feed_id) as feed_title,"; + } else if ($feed >= 0 && $search && $search_mode == "This category") { + + $vfeed_query_part = "ttrss_feeds.title AS feed_title,"; + + $tmp_result = db_query($link, "SELECT id + FROM ttrss_feeds WHERE cat_id = + (SELECT cat_id FROM ttrss_feeds WHERE id = '$feed') AND id != '$feed'"); + + $cat_siblings = array(); + + if (db_num_rows($tmp_result) > 0) { + while ($p = db_fetch_assoc($tmp_result)) { + array_push($cat_siblings, "feed_id = " . $p["id"]); + } + + $query_strategy_part = sprintf("(feed_id = %d OR %s)", + $feed, implode(" OR ", $cat_siblings)); + + } else { + $query_strategy_part = "ttrss_entries.id > 0"; + } + } else if ($feed >= 0) { $tmp_result = db_query($link, "SELECT id @@ -1264,7 +1286,7 @@ $query_strategy_part = sprintf("(feed_id = %d OR %s)", $feed, implode(" OR ", $parent_ids)); - + $vfeed_query_part = "ttrss_feeds.title AS feed_title,"; } else { $query_strategy_part = "feed_id = '$feed'"; @@ -3199,7 +3221,11 @@ } else { print ""; } - + + if (get_pref($link, 'ENABLE_FEED_CATS')) { + print ""; + } + print " diff --git a/tt-rss.php b/tt-rss.php index 03bbc0f6..b9c74efc 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -153,10 +153,12 @@ window.onload = init; + onblur="javascript:enableHotkeys();" onfocus="javascript:disableHotkeys();">