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

index 5a37258617296f033d7865b348e682507e62a35a..fc36d2e039965090f08d552a2b94d8c80a6dfdd5 100644 (file)
                        }
                }
 
+               $sort = db_escape_string($_GET["sort"]);
+
+               if (!$sort || $sort == "undefined") {
+                       $sort = "login";
+               }
+
                print "<div class=\"prefGenericAddBox\">
                        <input id=\"uadd_box\"                  
                                onkeyup=\"toggleSubmitNotEmpty(this, 'user_add_btn')\"
                                SUBSTRING(last_login,1,16) as last_login
                        FROM 
                                ttrss_users
-                       ORDER by login");
+                       ORDER BY $sort");
 
 //             print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>";
 
 
                print "<tr class=\"title\">
                                        <td align='center' width=\"5%\">&nbsp;</td>
-                                       <td width='40%'>Login</td>
-                                       <td width='40%'>Access Level</td>
-                                       <td width='30%'>Last login</td></tr>";
+                                       <td width='40%'><a href=\"javascript:updateUsersList('login')\">Login</a></td>
+                                       <td width='40%'><a href=\"javascript:updateUsersList('access_level')\">Access Level</a></td>
+                                       <td width='30%'><a href=\"javascript:updateUsersList('last_login')\">Last login</a></td></tr>";
                
                $lnum = 0;
                
index a91d430cb7034bd9d8a1c658b222717961a427da..c6daa6b6b6e1b8eda3a25a994647aa4797d2721c 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -157,7 +157,7 @@ function updateFeedList(sort_key) {
 
 }
 
-function updateUsersList() {
+function updateUsersList(sort_key) {
 
        if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
@@ -168,7 +168,8 @@ function updateUsersList() {
 
 //     p_notify("Loading, please wait...");
 
-       xmlhttp.open("GET", "backend.php?op=pref-users", true);
+       xmlhttp.open("GET", "backend.php?op=pref-users&sort="
+               + param_escape(sort_key), true);
        xmlhttp.onreadystatechange=userlist_callback;
        xmlhttp.send(null);