Skip to content
Snippets Groups Projects
Commit 84b0eaae authored by echicken's avatar echicken
Browse files

Don't display deleted or QWK users.

Display users in pages of 100 by default, so as not to be too slow on systems with over 9000 users (eg. Vertrauen.)
With the help of whisky, probably introduced new problems to be dealt with at some later time after they are discovered.
parent 6350abd0
Branches
Tags
No related merge requests found
...@@ -17,9 +17,24 @@ ...@@ -17,9 +17,24 @@
// total_posts : { name : "Posts", type : "number" } // total_posts : { name : "Posts", type : "number" }
}; };
var pageSize = 500;
// Most people won't need to edit below this line // Most people won't need to edit below this line
load("sbbsdefs.js"); load("sbbsdefs.js");
if( typeof http_request.query.offset == "undefined"
||
isNaN(parseInt(http_request.query.offset))
||
http_request.query.offset < 1
) {
var offset = 1;
} else {
var offset = parseInt(http_request.query.offset);
}
var previousOffset = Math.max(1, offset - pageSize);
var nextOffset = Math.min(offset + pageSize, offset + (system.lastuser - offset));
var users = []; var users = [];
var url = format( var url = format(
"http://%s%s", "http://%s%s",
...@@ -81,16 +96,18 @@ ...@@ -81,16 +96,18 @@
var makeSortURLs = function(field, order) { var makeSortURLs = function(field, order) {
return format( return format(
'<a class="ulLink" href="%s&sortby=%s&sortorder=ascending">' '<a class="ulLink" href="%s&sortby=%s&sortorder=ascending&offset=%s">'
+ '<img src="./icons/up-arrow.png">' + '<img src="./icons/up-arrow.png">'
+ '</a>' + '</a>'
+ '<a class="ulLink" href="%s&sortby=%s&sortorder=descending">' + '<a class="ulLink" href="%s&sortby=%s&sortorder=descending&offset=%s">'
+ '<img src="./icons/down-arrow.png">' + '<img src="./icons/down-arrow.png">'
+ '</a>', + '</a>',
url, url,
field, field,
offset,
url, url,
field field,
offset
); );
} }
...@@ -102,8 +119,13 @@ ...@@ -102,8 +119,13 @@
return dest; return dest;
} }
for(var u = 1; u < system.lastuser; u++) { for(var u = offset;
u < ((system.lastuser - offset > pageSize) ? offset + pageSize : system.lastuser);
u++
) {
var usr1 = new User(u); var usr1 = new User(u);
if(usr1.settings&USER_DELETED || usr1.compare_ars("REST Q"))
continue;
var usr2 = copyProperties(usr1, {}); var usr2 = copyProperties(usr1, {});
usr2 = copyProperties(usr1.stats, usr2); usr2 = copyProperties(usr1.stats, usr2);
users.push(usr2); users.push(usr2);
...@@ -137,4 +159,15 @@ for(var u = 0; u < users.length; u++) { ...@@ -137,4 +159,15 @@ for(var u = 0; u < users.length; u++) {
} }
?> ?>
</table> </table>
<?xjs
if(offset > 1)
print(format('<a href="%s&offset=%s">Previous</a>&nbsp;&nbsp;', url, previousOffset));
if(system.lastuser - offset > pageSize)
print(format('<a href="%s&offset=%s">Next</a>', url, nextOffset));
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment