user prefs: add search, misc code cleanup
This commit is contained in:
parent
477402d827
commit
a5bd7bf051
|
@ -397,17 +397,6 @@
|
||||||
++$lnum;
|
++$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 "</table>";
|
||||||
|
|
||||||
print "<p id=\"filterOpToolbar\">";
|
print "<p id=\"filterOpToolbar\">";
|
||||||
|
@ -419,21 +408,14 @@
|
||||||
|
|
||||||
print "</p>";
|
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 {
|
} else {
|
||||||
|
|
||||||
print "<p>";
|
print "<p>";
|
||||||
|
|
||||||
if (!$filter_search) {
|
if (!$filter_search) {
|
||||||
print __('No filters defined.');
|
print __('No filters defined.');
|
||||||
} else {
|
} else {
|
||||||
print __('No matching filters found.');
|
print __('No matching filters found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</p>";
|
print "</p>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,10 +315,6 @@
|
||||||
++$lnum;
|
++$lnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($lnum == 0) {
|
|
||||||
print "<tr><td colspan=\"4\" align=\"center\">".__('No labels defined.')."</td></tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print "<p id=\"labelOpToolbar\">";
|
print "<p id=\"labelOpToolbar\">";
|
||||||
|
@ -329,7 +325,14 @@
|
||||||
onclick=\"javascript:removeSelectedLabels()\" value=\"".__('Remove')."\">";
|
onclick=\"javascript:removeSelectedLabels()\" value=\"".__('Remove')."\">";
|
||||||
|
|
||||||
} else {
|
} 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");
|
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"]);
|
$sort = db_escape_string($_GET["sort"]);
|
||||||
|
|
||||||
if (!$sort || $sort == "undefined") {
|
if (!$sort || $sort == "undefined") {
|
||||||
|
@ -200,13 +217,24 @@
|
||||||
id=\"user_add_btn\" disabled=\"true\"
|
id=\"user_add_btn\" disabled=\"true\"
|
||||||
onclick=\"javascript:addUser()\" value=\"".__('Create user')."\"></div>";
|
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
|
$result = db_query($link, "SELECT
|
||||||
id,login,access_level,email,
|
id,login,access_level,email,
|
||||||
".SUBSTRING_FOR_DATE."(last_login,1,16) as last_login
|
".SUBSTRING_FOR_DATE."(last_login,1,16) as last_login
|
||||||
FROM
|
FROM
|
||||||
ttrss_users
|
ttrss_users
|
||||||
|
WHERE
|
||||||
|
$user_search_query
|
||||||
|
id > 0
|
||||||
ORDER BY $sort");
|
ORDER BY $sort");
|
||||||
|
|
||||||
|
if (db_num_rows($result) > 0) {
|
||||||
|
|
||||||
// print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>";
|
// print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>";
|
||||||
|
|
||||||
print "<p><table width=\"100%\" cellspacing=\"0\"
|
print "<p><table width=\"100%\" cellspacing=\"0\"
|
||||||
|
@ -326,5 +354,16 @@
|
||||||
<input type=\"submit\" class=\"button\" disabled=\"true\"
|
<input type=\"submit\" class=\"button\" disabled=\"true\"
|
||||||
onclick=\"javascript:resetSelectedUserPass()\" value=\"".__('Reset password')."\">";
|
onclick=\"javascript:resetSelectedUserPass()\" value=\"".__('Reset password')."\">";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<p>";
|
||||||
|
if (!$user_search) {
|
||||||
|
print __('No users defined.');
|
||||||
|
} else {
|
||||||
|
print __('No matching users found.');
|
||||||
|
}
|
||||||
|
print "</p>";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
7
prefs.js
7
prefs.js
|
@ -285,8 +285,13 @@ function updateUsersList(sort_key) {
|
||||||
return
|
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="
|
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.onreadystatechange=userlist_callback;
|
||||||
xmlhttp.send(null);
|
xmlhttp.send(null);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue