label prefs: add search

master
Andrew Dolgov 17 years ago
parent caf1f12f04
commit 112d2aec27

@ -232,7 +232,8 @@
<input id=\"filter_search\" size=\"20\" type=\"search\" <input id=\"filter_search\" size=\"20\" type=\"search\"
onchange=\"javascript:updateFilterList()\" value=\"$filter_search\"> onchange=\"javascript:updateFilterList()\" value=\"$filter_search\">
<input type=\"submit\" class=\"button\" <input type=\"submit\" class=\"button\"
onclick=\"javascript:updateFilterList()\" value=\"".__('Search')."\"><p<a class='helpLinkPic' href=\"javascript:displayHelpInfobox(2)\"> onclick=\"javascript:updateFilterList()\" value=\"".__('Search')."\">
<p<a class='helpLinkPic' href=\"javascript:displayHelpInfobox(2)\">
<img src='images/sign_quest.gif'></a></p> <img src='images/sign_quest.gif'></a></p>
</div>"; </div>";

@ -216,8 +216,22 @@
$sort = "description"; $sort = "description";
} }
print "<a class='helpLinkPic' href=\"javascript:displayHelpInfobox(1)\"> $label_search = db_escape_string($_GET["search"]);
<img src='images/sign_quest.gif'></a>";
if (array_key_exists("search", $_GET)) {
$_SESSION["prefs_label_search"] = $label_search;
} else {
$label_search = $_SESSION["prefs_label_search"];
}
print "<div class=\"feedEditSearch\">
<input id=\"label_search\" size=\"20\" type=\"search\"
onchange=\"javascript:updateLabelList()\" value=\"$label_search\">
<input type=\"submit\" class=\"button\"
onclick=\"javascript:updateLabelList()\" value=\"".__('Search')."\">
<p><a class='helpLinkPic' href=\"javascript:displayHelpInfobox(1)\">
<img src='images/sign_quest.gif'></a></p>
</div>";
print "<div class=\"prefGenericAddBox\">"; print "<div class=\"prefGenericAddBox\">";
@ -226,11 +240,19 @@
onclick=\"return displayDlg('quickAddLabel', false)\" onclick=\"return displayDlg('quickAddLabel', false)\"
value=\"".__('Create label')."\"></div>"; value=\"".__('Create label')."\"></div>";
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 $result = db_query($link, "SELECT
id,sql_exp,description id,sql_exp,description
FROM FROM
ttrss_labels ttrss_labels
WHERE WHERE
$label_search_query
owner_uid = ".$_SESSION["uid"]." owner_uid = ".$_SESSION["uid"]."
ORDER BY $sort"); ORDER BY $sort");

@ -1247,8 +1247,13 @@ function updateLabelList(sort_key) {
return 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=" + 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.onreadystatechange=labellist_callback;
xmlhttp.send(null); xmlhttp.send(null);
} }

Loading…
Cancel
Save