print pagination links at the bottom of the page.

highlight the current page between []
This commit is contained in:
Elián Hanisch 2011-12-22 21:03:33 -03:00
parent 7f104934ab
commit 9c4c948a7f

View File

@ -451,12 +451,15 @@ if haveQuery:
# Pagination # Pagination
if bans: if bans:
print '<div style="clear: both">' pagination = '<div style="clear: both">\n&middot;\n'
print '&middot;'
num_pages = int(math.ceil(ban_count / float(num_per_page))) num_pages = int(math.ceil(ban_count / float(num_per_page)))
for i in range(num_pages): for i in range(num_pages):
print '<a href="?%s">%d</a> &middot;' % (urlencode(page=i), i + 1) if page == i:
print '</div>' pagination += '<a href="?%s">[%d]</a> &middot;\n' % (urlencode(page=i), i + 1)
else:
pagination += '<a href="?%s">%d</a> &middot;\n' % (urlencode(page=i), i + 1)
pagination += '</div>\n'
print pagination
else: else:
# nothign to show # nothign to show
print '<div style="clear: both"></div>' # if I don't print this the page is messed up. print '<div style="clear: both"></div>' # if I don't print this the page is messed up.
@ -556,6 +559,8 @@ for b in bans:
print '</table>' print '</table>'
if bans:
print pagination
t2 = time.time() t2 = time.time()