user prefs: add search, misc code cleanup

master
Andrew Dolgov 17 years ago
parent 477402d827
commit a5bd7bf051

@ -396,18 +396,7 @@
++$lnum;
}
if ($lnum == 0) {
print "<tr><td colspan=\"4\" align=\"center\">";
if (!$filter_search) {
print __('No filters defined.');
} else {
print __('No matching filters found.');
}
print "</td></tr>";
}
print "</table>";
print "<p id=\"filterOpToolbar\">";
@ -419,21 +408,14 @@
print "</p>";
/* print "<div class=\"insensitive\" style=\"float : right\">
First matching filter is used, filtering is performed
when importing articles from the feed.</div>"; */
} else {
print "<p>";
if (!$filter_search) {
print __('No filters defined.');
} else {
print __('No matching filters found.');
}
print "</p>";
}

@ -314,11 +314,7 @@
++$lnum;
}
if ($lnum == 0) {
print "<tr><td colspan=\"4\" align=\"center\">".__('No labels defined.')."</td></tr>";
}
print "</table>";
print "<p id=\"labelOpToolbar\">";
@ -329,7 +325,14 @@
onclick=\"javascript:removeSelectedLabels()\" value=\"".__('Remove')."\">";
} else {
print "<p>".__('No labels defined.')."</p>";
print "<p>";
if (!$label_search) {
print __('No labels defined.');
} else {
print __('No matching labels found.');
}
print "</p>";
}
}
?>

@ -184,6 +184,23 @@
set_pref($link, "_PREFS_ACTIVE_TAB", "userConfig");
$user_search = db_escape_string($_GET["search"]);
if (array_key_exists("search", $_GET)) {
$_SESSION["prefs_user_search"] = $user_search;
} else {
$user_search = $_SESSION["prefs_user_search"];
}
print "<div class=\"feedEditSearch\">
<input id=\"user_search\" size=\"20\" type=\"search\"
onfocus=\"javascript:disableHotkeys();\"
onblur=\"javascript:enableHotkeys();\"
onchange=\"javascript:updateUsersList()\" value=\"$user_search\">
<input type=\"submit\" class=\"button\"
onclick=\"javascript:updateUsersList()\" value=\"".__('Search')."\">
</div>";
$sort = db_escape_string($_GET["sort"]);
if (!$sort || $sort == "undefined") {
@ -200,13 +217,24 @@
id=\"user_add_btn\" disabled=\"true\"
onclick=\"javascript:addUser()\" value=\"".__('Create user')."\"></div>";
if ($user_search) {
$user_search_query = "UPPER(login) LIKE UPPER('%$user_search%') AND";
} else {
$user_search_query = "";
}
$result = db_query($link, "SELECT
id,login,access_level,email,
".SUBSTRING_FOR_DATE."(last_login,1,16) as last_login
FROM
ttrss_users
WHERE
$user_search_query
id > 0
ORDER BY $sort");
if (db_num_rows($result) > 0) {
// print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>";
print "<p><table width=\"100%\" cellspacing=\"0\"
@ -326,5 +354,16 @@
<input type=\"submit\" class=\"button\" disabled=\"true\"
onclick=\"javascript:resetSelectedUserPass()\" value=\"".__('Reset password')."\">";
} else {
print "<p>";
if (!$user_search) {
print __('No users defined.');
} else {
print __('No matching users found.');
}
print "</p>";
}
}
?>

@ -285,8 +285,13 @@ function updateUsersList(sort_key) {
return
}
var user_search = document.getElementById("user_search");
var search = "";
if (user_search) { search = user_search.value; }
xmlhttp.open("GET", "backend.php?op=pref-users&sort="
+ param_escape(sort_key), true);
+ param_escape(sort_key) +
"&search=" + param_escape(search), true);
xmlhttp.onreadystatechange=userlist_callback;
xmlhttp.send(null);

Loading…
Cancel
Save