</div>\r
\r
<!-- navigation links -->\r
-${navlinks("game_index_paged", games.page, games.last_page)}\r
+${navlinks("game_index", games.page, games.last_page)}\r
% endif\r
\r
% endif\r
\r
<!-- navigation links -->\r
- ${navlinks("map_index_paged", maps.page, maps.last_page)}\r
+ ${navlinks("map_index", maps.page, maps.last_page)}\r
</div> <!-- /span4 -->\r
</div> <!-- /row -->\r
<%def name="navlinks(view, curr, last, **kwargs)">
+<%
+kwargs['_query'] = {'page': None}
+
+if 'search_query' in kwargs.keys():
+ kwargs['_query'] = dict(kwargs['_query'].items() + kwargs['search_query'].items())
+%>
+
% if not (curr == last and curr == 1):
% if curr != 1:
- <a class="pagination" href="${request.route_url(view, page=curr-1, **kwargs)}" name="Previous Page">previous</a>
+ <% kwargs['_query']['page'] = curr-1 %>
+ <a class="pagination" href="${request.route_url(view, **kwargs)}" name="Previous Page">previous</a>
% endif
% if last < 8:
${link_page(view, i, curr, **kwargs)}
% endfor
<span class="pagination">...</span>
- <a class="pagination" href="${request.route_url(view, page=last, **kwargs)}" name="Last Page">${last}</a>
+ <% kwargs['_query']['page'] = last %>
+ <a class="pagination" href="${request.route_url(view, **kwargs)}" name="Last Page">${last}</a>
% elif last-curr < 6:
- <a class="pagination" href="${request.route_url(view, page=1, **kwargs)}" name="First Page">1</a>
+ <% kwargs['_query']['page'] = 1 %>
+ <a class="pagination" href="${request.route_url(view, **kwargs)}" name="First Page">1</a>
<span class="pagination">...</span>
% for i in range(last-5, last+1):
${link_page(view, i, curr, **kwargs)}
% endfor
% else:
- <a class="pagination" href="${request.route_url(view, page=1, **kwargs)}" name="First Page">1</a>
+ <% kwargs['_query']['page'] = 1 %>
+ <a class="pagination" href="${request.route_url(view, **kwargs)}" name="First Page">1</a>
<span class="pagination">...</span>
% for i in range(curr-2, curr+3):
${link_page(view, i, curr, **kwargs)}
% endfor
<span class="pagination">...</span>
- <a class="pagination" href="${request.route_url(view, page=last, **kwargs)}" name="Last Page">${last}</a>
+ <% kwargs['_query']['page'] = last %>
+ <a class="pagination" href="${request.route_url(view, **kwargs)}" name="Last Page">${last}</a>
% endif
% endif
% if curr != last:
- <a class="pagination" href="${request.route_url(view, page=curr+1, **kwargs)}" name="Next Page">next</a>
+ <% kwargs['_query']['page'] = curr+1 %>
+ <a class="pagination" href="${request.route_url(view, **kwargs)}" name="Next Page">next</a>
% endif
% endif
</%def>
% if page_num == curr_page:
<span class="pagination" style="color:#d95b00;">${page_num}</span>
% else:
- <a class="pagination" href="${request.route_url(view, page=page_num, **kwargs)}" name="Go to page ${page_num}">${page_num}</a>
+ <% kwargs['_query']['page'] = page_num %>
+ <a class="pagination" href="${request.route_url(view, **kwargs)}" name="Go to page ${page_num}">${page_num}</a>
% endif
</%def>
</table>\r
% endif\r
\r
- ${navlinks("player_index_paged", players.page, players.last_page)}\r
+ ${navlinks("player_index", players.page, players.last_page)}\r
</div> <!-- /span4 -->\r
</div> <!-- /row -->\r
% endif
<!-- navigation links -->
-${navlinks("search_paged", results.page, results.last_page, _query=query)}
+${navlinks("search", results.page, results.last_page, search_query=query)}
% endif
<%block name="js">
</table>\r
% endif\r
\r
- ${navlinks("server_index_paged", servers.page, servers.last_page)}\r
+ ${navlinks("server_index", servers.page, servers.last_page)}\r
</div> <!-- /span4 -->\r
</div> <!-- /row -->\r
These games are ordered by game_id, with the most current ones first.\r
Paginated.\r
"""\r
- if 'page' in request.matchdict:\r
- current_page = request.matchdict['page']\r
+ if request.params.has_key('page'):\r
+ current_page = request.params['page']\r
else:\r
current_page = 1\r
\r
filter(Game.map_id == Map.map_id).\\r
order_by(Game.game_id.desc())\r
\r
- games = Page(games_q, current_page, url=page_url)\r
+ games = Page(games_q, current_page, items_per_page=10, url=page_url)\r
\r
pgstats = {}\r
for (game, server, map) in games:\r
"""\r
Provides a list of all the current maps. \r
"""\r
- if 'page' in request.matchdict:\r
- current_page = request.matchdict['page']\r
+ if request.params.has_key('page'):\r
+ current_page = request.params['page']\r
else:\r
current_page = 1\r
\r
map_q = DBSession.query(Map).\\r
order_by(Map.map_id.desc())\r
\r
- maps = Page(map_q, current_page, url=page_url)\r
+ maps = Page(map_q, current_page, items_per_page=10, url=page_url)\r
\r
- \r
except Exception as e:\r
maps = None\r
\r
"""\r
Provides a list of all the current players. \r
"""\r
- if 'page' in request.matchdict:\r
- current_page = int(request.matchdict['page'])\r
+ if request.params.has_key('page'):\r
+ current_page = request.params['page']\r
else:\r
current_page = 1\r
\r
\r
players = Page(player_q, current_page, items_per_page=10, url=page_url)\r
\r
- last_linked_page = current_page + 4\r
- if last_linked_page > players.last_page:\r
- last_linked_page = players.last_page\r
-\r
- pages_to_link = range(current_page+1, last_linked_page+1)\r
-\r
except Exception as e:\r
players = None\r
raise e\r
\r
- return {'players':players,\r
- 'pages_to_link':pages_to_link,\r
- }\r
+ return {'players':players\r
+ }\r
\r
\r
def get_games_played(player_id):\r
query = None
_query = {}
- if 'page' in request.matchdict:
- current_page = request.matchdict['page']
+
+ if request.params.has_key('page'):
+ current_page = request.params['page']
else:
current_page = 1
try:
if q != None:
- results = Page(q, current_page, url=page_url)
+ results = Page(q, current_page, items_per_page=10, url=page_url)
except Exception as e:
raise e
result_type = None
"""\r
Provides a list of all the current servers. \r
"""\r
- if 'page' in request.matchdict:\r
- current_page = request.matchdict['page']\r
+ if request.params.has_key('page'):\r
+ current_page = request.params['page']\r
else:\r
current_page = 1\r
\r
server_q = DBSession.query(Server).\\r
order_by(Server.server_id.desc())\r
\r
- servers = Page(server_q, current_page, url=page_url)\r
+ servers = Page(server_q, current_page, items_per_page=10, url=page_url)\r
\r
\r
except Exception as e:\r