]> git.wh0rd.org Git - tt-rss.git/commitdiff
label prefs: add search
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 17 May 2008 03:07:39 +0000 (04:07 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 17 May 2008 03:07:39 +0000 (04:07 +0100)
modules/pref-filters.php
modules/pref-labels.php
prefs.js

index 9d39258a421a75fc2e918c9878443593cfaa1bcd..60fec2174b8612e56b7a69f2dbb14459a95787e7 100644 (file)
                        <input id=\"filter_search\" size=\"20\" type=\"search\"
                                onchange=\"javascript:updateFilterList()\" value=\"$filter_search\">
                        <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>
                        </div>";
 
index 3582f42eb533fa92908addab24b351a3593833ac..7cdde4832966a469a23f7dc358ac3f8aa3c8e123 100644 (file)
                        $sort = "description";
                }
 
-               print "<a class='helpLinkPic' href=\"javascript:displayHelpInfobox(1)\">
-                       <img src='images/sign_quest.gif'></a>";
+               $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 "<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\">";
 
                        onclick=\"return displayDlg('quickAddLabel', false)\" 
                        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 
                                id,sql_exp,description
                        FROM 
                                ttrss_labels 
                        WHERE 
+                               $label_search_query
                                owner_uid = ".$_SESSION["uid"]."
                        ORDER BY $sort");
 
index b207ba2d5e420fa0c5ac0c1f75eb4cb7d5c3ebdc..1e84d7a2e3f0f80ae5f99dc751056cddd6143d14 100644 (file)
--- 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);
 }