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

index d9a4fe72dd7fe667ee5c3660de6932ada648c135..5a37258617296f033d7865b348e682507e62a35a 100644 (file)
                        } 
                }
 
+               $sort = db_escape_string($_GET["sort"]);
+
+               if (!$sort || $sort == "undefined") {
+                       $sort = "description";
+               }
+
                print "<div class=\"prefGenericAddBox\">";
 
                print"<input type=\"submit\" class=\"button\" 
                                ttrss_labels 
                        WHERE 
                                owner_uid = ".$_SESSION["uid"]."
-                       ORDER by description");
+                       ORDER BY $sort");
 
 //             print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>";
 
 
                        print "<tr class=\"title\">
                                                <td width=\"5%\">&nbsp;</td>
-                                               <td width=\"30%\">Caption</td>
-                                               <td width=\"50%\">SQL Expression
+                                               <td width=\"30%\"><a href=\"javascript:updateLabelList('description')\">Caption</a></td>
+                                               <td width=\"50%\"><a href=\"javascript:updateLabelList('sql_exp')\">SQL Expression</a>
                                                <a class=\"helpLink\" href=\"javascript:displayHelpInfobox(1)\">(?)</a>
                                                </td>
                                                </tr>";
index 626d216a6d9c7892945f9808671bf8f0ac1b3367..a91d430cb7034bd9d8a1c658b222717961a427da 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -1083,13 +1083,14 @@ function updateFilterList(sort_key) {
 
 //     p_notify("Loading, please wait...");
 
-       xmlhttp.open("GET", "backend.php?op=pref-filters&sort=" + param_escape(sort_key), true);
+       xmlhttp.open("GET", "backend.php?op=pref-filters&sort=" + 
+               param_escape(sort_key), true);
        xmlhttp.onreadystatechange=filterlist_callback;
        xmlhttp.send(null);
 
 }
 
-function updateLabelList() {
+function updateLabelList(sort_key) {
 
        if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
@@ -1100,7 +1101,8 @@ function updateLabelList() {
 
 //     document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
 
-       xmlhttp.open("GET", "backend.php?op=pref-labels", true);
+       xmlhttp.open("GET", "backend.php?op=pref-labels&sort=" + 
+               param_escape(sort_key), true);
        xmlhttp.onreadystatechange=labellist_callback;
        xmlhttp.send(null);
 }