-
-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…2998) * Working on #2972 Template Conversion to Twig Format (memberlist.php) Part 1 - Member list * Working on #2972 Template Conversion to Twig Format (memberlist.php) Part 2 - Member search * Coding improvements * Updated formatting
- Loading branch information
1 parent
b8b0e40
commit ecdc797
Showing
5 changed files
with
503 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
{% extends 'layouts/master.twig' %} | ||
|
||
{% block head %} | ||
<title>{{ mybb.settings.bbname }} - {{ lang.member_list }}</title> | ||
{% endblock head %} | ||
|
||
{% block body %} | ||
{{ multipage|raw }} | ||
<table border="0" cellspacing="{{ theme.borderwidth }}" cellpadding="{{ theme.tablespace }}" class="tborder"> | ||
<tr> | ||
<td class="thead" colspan="{{ memberlist.colspan }}"> | ||
<div class="float_right"> | ||
{% for letter in 'A'..'Z' %} | ||
<a href="memberlist.php?letter={{ letter }}" style="padding: 5px;">{{ letter }}</a> | ||
{% endfor %} | ||
</div> | ||
<div><strong>{{ lang.member_list }}</strong></div> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td class="tcat" width="1%"> | ||
<span class="smalltext"><strong>{{ lang.avatar }}</strong></span> | ||
</td> | ||
<td class="tcat"> | ||
<span class="smalltext"> | ||
<a href="memberlist.php?perpage={{ mybb.input.perpage }}{{ memberlist.search_url }}&sort=username&order=ascending"><strong>{{ lang.username }}</strong></a> | ||
{% if memberlist.orderarrow.username %} | ||
<span class="smalltext">[<a href="memberlist.php?perpage={{ mybb.input.perpage }}{{ memberlist.search_url }}&sort=username&order={{ memberlist.oppsortnext }}">{{ memberlist.oppsort }}</a>]</span> | ||
{% endif %} | ||
</span> | ||
</td> | ||
<td class="tcat" width="15%" align="center"> | ||
<span class="smalltext"> | ||
<a href="memberlist.php?perpage={{ mybb.input.perpage }}{{ memberlist.search_url }}&sort=regdate&order=ascending"><strong>{{ lang.joined }}</strong></a> | ||
{% if memberlist.orderarrow.regdate %} | ||
<span class="smalltext">[<a href="memberlist.php?perpage={{ mybb.input.perpage }}{{ memberlist.search_url }}&sort=regdate&order={{ memberlist.oppsortnext }}">{{ memberlist.oppsort }}</a>]</span> | ||
{% endif %} | ||
</span> | ||
</td> | ||
<td class="tcat" width="15%" align="center"> | ||
<span class="smalltext"> | ||
<a href="memberlist.php?perpage={{ mybb.input.perpage }}{{ memberlist.search_url }}&sort=lastvisit&order=descending"><strong>{{ lang.lastvisit }}</strong></a> | ||
{% if memberlist.orderarrow.lastvisit %} | ||
<span class="smalltext">[<a href="memberlist.php?perpage={{ mybb.input.perpage }}{{ memberlist.search_url }}&sort=lastvisit&order={{ memberlist.oppsortnext }}">{{ memberlist.oppsort }}</a>]</span> | ||
{% endif %} | ||
</span> | ||
</td> | ||
<td class="tcat" width="10%" align="center"> | ||
<span class="smalltext"> | ||
<a href="memberlist.php?perpage={{ mybb.input.perpage }}{{ memberlist.search_url }}&sort=postnum&order=descending"><strong>{{ lang.posts }}</strong></a> | ||
{% if memberlist.orderarrow.postnum %} | ||
<span class="smalltext">[<a href="memberlist.php?perpage={{ mybb.input.perpage }}{{ memberlist.search_url }}&sort=postnum&order={{ memberlist.oppsortnext }}">{{ memberlist.oppsort }}</a>]</span> | ||
{% endif %} | ||
</span> | ||
</td> | ||
<td class="tcat" width="10%" align="center"> | ||
<span class="smalltext"> | ||
<a href="memberlist.php?perpage={{ mybb.input.perpage }}{{ memberlist.search_url }}&sort=threadnum&order=descending"><strong>{{ lang.threads }}</strong></a> | ||
{% if memberlist.orderarrow.threadnum %} | ||
<span class="smalltext">[<a href="memberlist.php?perpage={{ mybb.input.perpage }}{{ memberlist.search_url }}&sort=threadnum&order={{ memberlist.oppsortnext }}">{{ memberlist.oppsort }}</a>]</span> | ||
{% endif %} | ||
</span> | ||
</td> | ||
{% if mybb.settings.usereferrals %} | ||
<td class="tcat" width="10%" align="center"> | ||
<span class="smalltext"> | ||
<a href="memberlist.php?perpage={{ mybb.input.perpage }}{{ memberlist.search_url }}&sort=referrals&order=descending"><strong>{{ lang.referrals }}</strong></a> | ||
{% if memberlist.orderarrow.referrals %} | ||
<span class="smalltext">[<a href="memberlist.php?perpage={{ mybb.input.perpage }}{{ memberlist.search_url }}&sort=referrals&order={{ memberlist.oppsortnext }}">{{ memberlist.oppsort }}</a>]</span> | ||
{% endif %} | ||
</span> | ||
</td> | ||
{% endif %} | ||
</tr> | ||
{% for user in users %} | ||
{% include 'memberlist/memberlist_row.twig' %} | ||
{% else %} | ||
<tr> | ||
<td colspan="{{ memberlist.colspan }}" align="center" class="trow1">{{ lang.error_no_members|raw }}</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
<div class="float_right" style="padding-top: 4px;"> | ||
<a href="showteam.php"><strong>{{ lang.forumteam }}</strong></a> | ||
</div> | ||
{{ multipage|raw }} | ||
<br class="clear" /> | ||
<br /> | ||
<form method="post" action="memberlist.php"> | ||
<table border="0" cellspacing="{{ theme.borderwidth }}" cellpadding="{{ theme.tablespace }}" class="tborder"> | ||
<tr> | ||
<td class="thead" colspan="3"> | ||
<div class="float_right"> | ||
<strong><a href="memberlist.php?action=search">{{ lang.advanced_search }}</a></strong> | ||
</div> | ||
<div><strong>{{ lang.search_members }}</strong></div> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td class="tcat"><strong><label for="username">{{ lang.username }}</label></strong></td> | ||
<td class="tcat"><strong><label for="website">{{ lang.website }}</label></strong></td> | ||
<td class="tcat"><strong><label for="sort">{{ lang.sort_by }}</label></strong></td> | ||
</tr> | ||
<tr> | ||
<td class="trow1" width="33%" style="vertical-align: top;"> | ||
{{ lang.contains }}<br /> | ||
<input type="text" class="textbox" name="username" id="username" style="width: 99%; margin-top: 4px;" value="{{ memberlist.username }}" /> | ||
</td> | ||
<td class="trow1" width="33%" style="vertical-align: top;"> | ||
{{ lang.contains }}<br /> | ||
<input type="text" class="textbox" name="website" id="website" style="width: 99%; margin-top: 4px;" value="{{ memberlist.website }}" /> | ||
</td> | ||
<td class="trow1" width="33%"> | ||
<div class="smalltext" style="margin-bottom: 3px;"> | ||
<input type="radio" class="radio" name="order" id="order_asc" value="ascending"{% if memberlist.order.ascending %} checked="checked"{% endif %} /> <label for="order_asc">{{ lang.order_asc }}</label> | ||
<input type="radio" class="radio" name="order" id="order_desc" value="descending"{% if memberlist.order.descending %} checked="checked"{% endif %} /> <label for="order_desc">{{ lang.order_desc }}</label> | ||
</div> | ||
<select name="sort" id="sort" style="width: 99%;"> | ||
<option value="username"{% if memberlist.sort.username %} selected="selected"{% endif %}>{{ lang.sort_by_username }}</option> | ||
<option value="regdate"{% if memberlist.sort.regdate %} selected="selected"{% endif %}>{{ lang.sort_by_regdate }}</option> | ||
<option value="lastvisit"{% if memberlist.sort.lastvisit %} selected="selected"{% endif %}>{{ lang.sort_by_lastvisit }}</option> | ||
<option value="postnum"{% if memberlist.sort.postnum %} selected="selected"{% endif %}>{{ lang.sort_by_posts }}</option> | ||
<option value="threadnum"{% if memberlist.sort.threadnum %} selected="selected"{% endif %}>{{ lang.sort_by_threads }}</option> | ||
{% if mybb.settings.usereferrals %} | ||
<option value="referrals"{% if memberlist.sort.referrals %} selected="selected"{% endif %}>{{ lang.sort_by_referrals }}</option> | ||
{% endif %} | ||
</select> | ||
</td> | ||
</tr> | ||
</table> | ||
<div align="center"><br /><input type="submit" class="button" name="submit" value="{{ lang.search }}" /></div> | ||
</form> | ||
|
||
<link rel="stylesheet" href="{{ asset_url('jscripts/select2/select2.css') }}"> | ||
<script type="text/javascript" src="{{ asset_url('jscripts/select2/select2.min.js') }}"></script> | ||
<script type="text/javascript"> | ||
<!-- | ||
if({{ mybb.settings.use_xmlhttprequest }}) | ||
{ | ||
MyBB.select2(); | ||
$("#username").select2({ | ||
placeholder: "{{ lang.search_user }}", | ||
minimumInputLength: 2, | ||
multiple: false, | ||
ajax: { // instead of writing the function to execute the request we use Select2's convenient helper | ||
url: "xmlhttp.php?action=get_users", | ||
dataType: 'json', | ||
data: function (term, page) { | ||
return { | ||
query: term, // search term | ||
}; | ||
}, | ||
results: function (data, page) { // parse the results into the format expected by Select2. | ||
// since we are using custom formatting functions we do not need to alter remote JSON data | ||
return {results: data}; | ||
} | ||
}, | ||
initSelection: function(element, callback) { | ||
var value = $(element).val(); | ||
if (value !== "") { | ||
callback({ | ||
id: value, | ||
text: value | ||
}); | ||
} | ||
}, | ||
// Allow the user entered text to be selected as well | ||
createSearchChoice:function(term, data) { | ||
if ( $(data).filter( function() { | ||
return this.text.localeCompare(term)===0; | ||
}).length===0) { | ||
return {id:term, text:term}; | ||
} | ||
}, | ||
}); | ||
$('[for=username]').click(function(){ | ||
$("#username").select2('open'); | ||
return false; | ||
}); | ||
} | ||
// --> | ||
</script> | ||
{% endblock body %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{% set row = alt_trow() %} | ||
<tr> | ||
<td class="{{ row }}" align="center"> | ||
{% if user.avatar %} | ||
<img src="{{ user.avatar_image }}" alt="" {{ user.avatar_width_height }} /> | ||
{% endif %} | ||
</td> | ||
<td class="{{ row }}"> | ||
{{ user.profilelink|raw }}<br /> | ||
<span class="smalltext"> | ||
{{ user.usertitle }}<br /> | ||
{% if user.groupimage %} | ||
<img src="{{ user.groupimage }}" alt="{{ user.groupimage_title }}" title="{{ user.groupimage_title }}" /> | ||
<br /> | ||
{% endif %} | ||
{% if user.starimage and user.stars %} | ||
{% spaceless %} | ||
{% for star in range(1, user.stars) %} | ||
<img src="{{ user.starimage }}" border="0" alt="*" /> | ||
{% endfor %} | ||
{% endspaceless %} | ||
<br /> | ||
{% endif %} | ||
</span> | ||
</td> | ||
<td class="{{ row }}" align="center"> | ||
{{ user.regdate|raw }} | ||
</td> | ||
<td class="{{ row }}" align="center"> | ||
{{ user.lastvisit|raw }} | ||
</td> | ||
<td class="{{ row }}" align="center"> | ||
{{ user.postnum }} | ||
</td> | ||
<td class="{{ row }}" align="center"> | ||
{{ user.threadnum }} | ||
</td> | ||
{% if mybb.settings.usereferrals %} | ||
<td class="{{ row }}" align="center"> | ||
{{ user.referrals }} | ||
</td> | ||
{% endif %} | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
{% extends 'layouts/master.twig' %} | ||
|
||
{% block head %} | ||
<title>{{ mybb.settings.bbname }} - {{ lang.search_member_list }}</title> | ||
{% endblock head %} | ||
|
||
{% block body %} | ||
<form method="post" action="memberlist.php"> | ||
<table border="0" cellspacing="{{ theme.borderwidth }}" cellpadding="{{ theme.tablespace }}" class="tborder"> | ||
<tr> | ||
<td class="thead" colspan="2"><strong>{{ lang.search_member_list }}</strong></td> | ||
</tr> | ||
<tr> | ||
<td class="tcat" colspan="2"><strong>{{ lang.search_criteria }}</strong></td> | ||
</tr> | ||
<tr> | ||
<td class="trow1" style="vertical-align: top;" width="20%"><strong><label for="username">{{ lang.username }}</label></strong></td> | ||
<td class="trow1"> | ||
<select name="username_match"> | ||
<option value="begins">{{ lang.begins_with }}</option> | ||
<option value="contains">{{ lang.username_contains }}</option> | ||
</select> | ||
| ||
<input type="text" class="textbox" name="username" id="username" /> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td class="trow2" width="20%"><strong><label for="website">{{ lang.search_website }}</label></strong></td> | ||
<td class="trow2"> | ||
<input type="text" class="textbox" name="website" id="website" /> | ||
</td> | ||
</tr> | ||
{% for contact_field in contact_fields %} | ||
<tr> | ||
<td class="{{ contact_field.bgcolors }}" width="20%"><strong><label for="{{ contact_field.field }}">{{ contact_field.lang_string }}</label></strong></td> | ||
<td class="{{ contact_field.bgcolors }}"><input type="text" class="textbox" name="{{ contact_field.field }}" id="{{ contact_field.field }}" /></td> | ||
</tr> | ||
{% endfor %} | ||
<tr> | ||
<td class="tcat" colspan="2"><strong>{{ lang.search_options }}</strong></td> | ||
</tr> | ||
<tr> | ||
<td class="trow1" width="20%"><strong><label for="sort">{{ lang.sort_by }}</label></strong></td> | ||
<td class="trow1"> | ||
<select name="sort" id="sort"> | ||
<option value="username">{{ lang.sort_by_username }}</option> | ||
<option value="regdate">{{ lang.sort_by_regdate }}</option> | ||
<option value="lastvisit">{{ lang.sort_by_lastvisit }}</option> | ||
<option value="postnum">{{ lang.sort_by_posts }}</option> | ||
<option value="threadnum">{{ lang.sort_by_threads }}</option> | ||
<option value="referrals">{{ lang.sort_by_referrals }}</option> | ||
</select><br /> | ||
<span class="smalltext"> | ||
<input type="radio" class="radio" name="order" id="order_asc" value="asc" /> <label for="order_asc">{{ lang.order_asc }}</label><br /> | ||
<input type="radio" class="radio" name="order" id="order_desc" value="desc" checked="checked" /> <label for="order_desc">{{ lang.order_desc }}</label> | ||
</span> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td class="trow1" width="20%"><strong><label for="perpage">{{ lang.per_page }}</label></strong></td> | ||
<td class="trow1"> | ||
<input type="text" class="textbox" size="4" name="perpage" id="perpage" value="15" /> | ||
</td> | ||
</tr> | ||
</table> | ||
<div align="center"><br /><input type="submit" class="button" name="submit" value="{{ lang.search }}" /></div> | ||
</form> | ||
|
||
<link rel="stylesheet" href="{{ asset_url('jscripts/select2/select2.css') }}"> | ||
<script type="text/javascript" src="{{ asset_url('jscripts/select2/select2.min.js') }}"></script> | ||
<script type="text/javascript"> | ||
<!-- | ||
if({{ mybb.settings.use_xmlhttprequest }}) | ||
{ | ||
MyBB.select2(); | ||
$("#username").select2({ | ||
placeholder: "{{ lang.search_user }}", | ||
minimumInputLength: 2, | ||
multiple: false, | ||
ajax: { // instead of writing the function to execute the request we use Select2's convenient helper | ||
url: "xmlhttp.php?action=get_users", | ||
dataType: 'json', | ||
data: function (term, page) { | ||
return { | ||
query: term, // search term | ||
}; | ||
}, | ||
results: function (data, page) { // parse the results into the format expected by Select2. | ||
// since we are using custom formatting functions we do not need to alter remote JSON data | ||
return {results: data}; | ||
} | ||
}, | ||
initSelection: function(element, callback) { | ||
var value = $(element).val(); | ||
if (value !== "") { | ||
callback({ | ||
id: value, | ||
text: value | ||
}); | ||
} | ||
}, | ||
// Allow the user entered text to be selected as well | ||
createSearchChoice:function(term, data) { | ||
if ( $(data).filter( function() { | ||
return this.text.localeCompare(term)===0; | ||
}).length===0) { | ||
return {id:term, text:term}; | ||
} | ||
}, | ||
}); | ||
$('[for=username]').click(function(){ | ||
$("#username").select2('open'); | ||
return false; | ||
}); | ||
} | ||
// --> | ||
</script> | ||
{% endblock body %} |
Oops, something went wrong.