From 112d2aec273278dae9ff0f715af836df09163a91 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 17 May 2008 04:07:39 +0100 Subject: [PATCH] label prefs: add search --- modules/pref-filters.php | 3 ++- modules/pref-labels.php | 26 ++++++++++++++++++++++++-- prefs.js | 7 ++++++- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/modules/pref-filters.php b/modules/pref-filters.php index 9d39258a..60fec217 100644 --- a/modules/pref-filters.php +++ b/modules/pref-filters.php @@ -232,7 +232,8 @@ + onclick=\"javascript:updateFilterList()\" value=\"".__('Search')."\"> +

"; diff --git a/modules/pref-labels.php b/modules/pref-labels.php index 3582f42e..7cdde483 100644 --- a/modules/pref-labels.php +++ b/modules/pref-labels.php @@ -216,8 +216,22 @@ $sort = "description"; } - print " - "; + $label_search = db_escape_string($_GET["search"]); + + if (array_key_exists("search", $_GET)) { + $_SESSION["prefs_label_search"] = $label_search; + } else { + $label_search = $_SESSION["prefs_label_search"]; + } + + print "
+ + +

+

+
"; print "
"; @@ -226,11 +240,19 @@ onclick=\"return displayDlg('quickAddLabel', false)\" value=\"".__('Create label')."\">
"; + if ($label_search) { + $label_search_query = "(sql_exp LIKE '%$label_search%' OR + description LIKE '%$label_search%') AND"; + } else { + $label_search_query = ""; + } + $result = db_query($link, "SELECT id,sql_exp,description FROM ttrss_labels WHERE + $label_search_query owner_uid = ".$_SESSION["uid"]." ORDER BY $sort"); diff --git a/prefs.js b/prefs.js index b207ba2d..1e84d7a2 100644 --- a/prefs.js +++ b/prefs.js @@ -1247,8 +1247,13 @@ function updateLabelList(sort_key) { return } + var label_search = document.getElementById("label_search"); + var search = ""; + if (label_search) { search = label_search.value; } + xmlhttp.open("GET", "backend.php?op=pref-labels&sort=" + - param_escape(sort_key), true); + param_escape(sort_key) + + "&search=" + param_escape(search), true); xmlhttp.onreadystatechange=labellist_callback; xmlhttp.send(null); } -- 2.39.5