From: Andrew Dolgov Date: Sat, 17 May 2008 02:52:46 +0000 (+0100) Subject: filter prefs: add search X-Git-Tag: 1.2.23-final~107 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=9c87d75cc0d72669a25f05d5888f055d799e9363;p=tt-rss.git filter prefs: add search --- diff --git a/modules/pref-filters.php b/modules/pref-filters.php index 18c78da6..ac71c96a 100644 --- a/modules/pref-filters.php +++ b/modules/pref-filters.php @@ -219,8 +219,23 @@ $filter_types[$line["id"]] = $line["description"]; } - print " - "; + + $filter_search = db_escape_string($_GET["search"]); + + if (array_key_exists("search", $_GET)) { + $_SESSION["prefs_filter_search"] = $filter_search; + } else { + $filter_search = $_SESSION["prefs_filter_search"]; + } + + print "
+ +   + +
"; + print ""; + if ($filter_search) { + $filter_search = db_escape_string($filter_search); + $filter_search_query = "( + ttrss_filter_actions.description LIKE '%$filter_search%' OR + reg_exp LIKE '%$filter_search%' OR + ttrss_feeds.title LIKE '%$filter_search%' OR + ttrss_filter_types.description LIKE '%$filter_search%') AND"; + } else { + $filter_search_query = ""; + } + $result = db_query($link, "SELECT ttrss_filters.id AS id,reg_exp, ttrss_filter_types.name AS filter_type_name, @@ -251,6 +277,7 @@ ttrss_feeds ON (ttrss_filters.feed_id = ttrss_feeds.id) WHERE filter_type = ttrss_filter_types.id AND + $filter_search_query ttrss_filter_actions.id = action_id AND ttrss_filters.owner_uid = ".$_SESSION["uid"]." ORDER by action_description, $sort"); @@ -368,7 +395,14 @@ } if ($lnum == 0) { - print "".__('No filters defined.').""; + print ""; + if (!$filter_search) { + print __('No filters defined.'); + } else { + print __('No matching filters found.'); + } + + print ""; } print ""; @@ -389,7 +423,15 @@ } else { - print "

".__('No filters defined.')."

"; + print "

"; + + if (!$filter_search) { + print __('No filters defined.'); + } else { + print __('No matching filters found.'); + } + + print "

"; } } diff --git a/prefs.js b/prefs.js index 78ec548a..b207ba2d 100644 --- a/prefs.js +++ b/prefs.js @@ -1228,8 +1228,13 @@ function updateFilterList(sort_key) { return } + var filter_search = document.getElementById("filter_search"); + var search = ""; + if (filter_search) { search = filter_search.value; } + xmlhttp.open("GET", "backend.php?op=pref-filters&sort=" + - param_escape(sort_key), true); + param_escape(sort_key) + + "&search=" + param_escape(search), true); xmlhttp.onreadystatechange=filterlist_callback; xmlhttp.send(null);