mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
[ticket/10737] Avoid hard-coding table row and use case-insensitive search.
PHPBB3-10737
This commit is contained in:
parent
e644c67dcf
commit
aa23cf64ca
5 changed files with 36 additions and 13 deletions
|
@ -515,26 +515,34 @@ phpbb.timezonePreselectSelect = function(forceSelector) {
|
|||
// Listen live search box events
|
||||
$('.liveinput').keyup(function() {
|
||||
var str = this.value;
|
||||
var j = 0;
|
||||
if (str.length < 3) {
|
||||
$("#livesearch").innerHTML="";
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
var link, name;
|
||||
var clone = $("#user-search-row-tpl").clone();
|
||||
$("#livesearch").html("");
|
||||
clone.appendTo("#livesearch");
|
||||
$.ajax({
|
||||
url:'memberlist.php?mode=livesearch&'+"&q="+str,
|
||||
success:function(result) {
|
||||
$.each(result, function(idx, elem) {
|
||||
j = (idx%2)+1;
|
||||
$("#livesearch").append("<tr class='bg" + j + " row" + j + "'><td><a href='memberlist.php?mode=viewprofile&u=" + elem.id + "' target='_blank'>" + elem.name + "</a></td></tr>");
|
||||
})
|
||||
}
|
||||
link = "memberlist.php?mode=viewprofile&u=" + elem.id;
|
||||
name = elem.name;
|
||||
clone = $("#user-search-row-tpl").clone();
|
||||
clone.find(".user-search-link").attr("href", link);
|
||||
clone.find(".user-search-name").html(name);
|
||||
clone.attr("style", "");
|
||||
clone.appendTo("#livesearch");
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.liveinput').blur(function() {
|
||||
setTimeout(function () {
|
||||
document.getElementById("livesearch").innerHTML="";
|
||||
var clone = $("#user-search-row-tpl").clone();
|
||||
$("#livesearch").html("");
|
||||
clone.appendTo("#livesearch");
|
||||
}, 500);
|
||||
});
|
||||
|
||||
|
|
|
@ -983,11 +983,12 @@ switch ($mode)
|
|||
|
||||
case 'livesearch':
|
||||
$username_chars = $request->variable('q', '', true);
|
||||
$username_chars = strtolower($username_chars);
|
||||
|
||||
$sql = 'SELECT username, user_id
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('user_type', array(USER_NORMAL, USER_FOUNDER)) . '
|
||||
AND username ' . $db->sql_like_expression($username_chars . $db->any_char);
|
||||
AND LOWER(username) ' . $db->sql_like_expression($username_chars . $db->any_char);
|
||||
$result = $db->sql_query_limit($sql, 10);
|
||||
|
||||
$user_list = array();
|
||||
|
|
|
@ -9,7 +9,13 @@
|
|||
<fieldset class="fields1 column1">
|
||||
<dl>
|
||||
<dt><label for="username">{L_USERNAME}{L_COLON}</label></dt>
|
||||
<dd><input type="text" name="username" id="username" value="{USERNAME}" class="inputbox liveinput" autocomplete="off" /> <table class="table1" id="livesearch"></table></dd>
|
||||
<dd><input type="text" name="username" id="username" value="{USERNAME}" class="inputbox liveinput" autocomplete="off" />
|
||||
<table class="table1 zebra-list" id="livesearch">
|
||||
<tr id="user-search-row-tpl" style="display: none;">
|
||||
<td><a class="user-search-link user-search-name" target='_blank'></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- IF S_EMAIL_SEARCH_ALLOWED -->
|
||||
<dl>
|
||||
|
|
|
@ -75,7 +75,14 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="row1"><b class="genmed">{L_USERNAME}{L_COLON}</b></td>
|
||||
<td class="row2"><input class="post liveinput" type="text" name="username" value="{USERNAME}" autocomplete="off" /> <table class="tablebg" id="livesearch"></table></td>
|
||||
<td class="row2">
|
||||
<input class="post liveinput" type="text" name="username" value="{USERNAME}" autocomplete="off" />
|
||||
<table class="tablebg" id="livesearch">
|
||||
<tr id="user-search-row-tpl" style="display: none;">
|
||||
<td><a class="user-search-link user-search-name" target='_blank'></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<!-- IF S_EMAIL_SEARCH_ALLOWED -->
|
||||
<td class="row1"><b class="genmed">{L_EMAIL}{L_COLON}</b></td>
|
||||
<td class="row2"><input class="post" type="email" name="email" value="{EMAIL}" /></td>
|
||||
|
|
|
@ -708,6 +708,7 @@ pre {
|
|||
margin: 0px;
|
||||
position: absolute;
|
||||
box-shadow: 1px 2px 5px rgb(175,167,167);
|
||||
border-spacing: 0px;
|
||||
z-index: 999;
|
||||
overflow: auto;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue