]> git.wh0rd.org Git - tt-rss.git/commitdiff
sortable filter list
authorAndrew Dolgov <fox@bah.spb.su>
Sun, 20 Aug 2006 13:40:03 +0000 (14:40 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sun, 20 Aug 2006 13:40:03 +0000 (14:40 +0100)
backend.php
prefs.js

index 9b38303d57ec30e272b5cb9fcbc20a18068183df..d9a4fe72dd7fe667ee5c3660de6932ada648c135 100644 (file)
 
                if ($quiet) return;
 
+               $sort = db_escape_string($_GET["sort"]);
+
+               if (!$sort || $sort == "undefined") {
+                       $sort = "reg_exp";
+               }
+
 //             print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>";
 
                $result = db_query($link, "SELECT id,description 
                                filter_type = ttrss_filter_types.id AND
                                ttrss_filter_actions.id = action_id AND
                                ttrss_filters.owner_uid = ".$_SESSION["uid"]."
-                       ORDER by reg_exp");
+                       ORDER by $sort");
 
                if (db_num_rows($result) != 0) {
 
 
                        print "<tr class=\"title\">
                                                <td align='center' width=\"5%\">&nbsp;</td>
-                                               <td width=\"20%\">Filter expression</td>
-                                               <td width=\"20%\">Feed</td>
-                                               <td width=\"15%\">Match</td>
-                                               <td width=\"15%\">Action</td>";
+                                               <td width=\"20%\"><a href=\"javascript:updateFilterList('reg_exp')\">Filter expression</a></td>
+                                               <td width=\"20%\"><a href=\"javascript:updateFilterList('feed_title')\">Feed</a></td>
+                                               <td width=\"15%\"><a href=\"javascript:updateFilterList('filter_type')\">Match</a></td>
+                                               <td width=\"15%\"><a href=\"javascript:updateFilterList('action_description')\">Action</a></td>";
 
                        $lnum = 0;
                        
index eabdd3016d377ff94113345d3b5552a8d49a2af4..626d216a6d9c7892945f9808671bf8f0ac1b3367 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -1072,7 +1072,7 @@ function validateOpmlImport() {
        }
 }
 
-function updateFilterList() {
+function updateFilterList(sort_key) {
 
        if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
@@ -1083,7 +1083,7 @@ function updateFilterList() {
 
 //     p_notify("Loading, please wait...");
 
-       xmlhttp.open("GET", "backend.php?op=pref-filters", true);
+       xmlhttp.open("GET", "backend.php?op=pref-filters&sort=" + param_escape(sort_key), true);
        xmlhttp.onreadystatechange=filterlist_callback;
        xmlhttp.send(null);