Show the correct lifetime information in the template.
[xonotic/xonstat.git] / xonstat / templates / server_info.mako
1 <%inherit file="base.mako"/>
2 <%namespace name="nav" file="nav.mako" />
3
4 <%block name="navigation">
5   ${nav.nav('servers')}
6 </%block>
7
8 <%block name="title">
9   % if server:
10     Server Information
11   % endif
12 </%block>
13
14 <%def name="empty_rows(list, max_empty_rows)">
15   % for i in range(max_empty_rows - len(list)):
16     <tr>
17       <td>-</td>
18       <td>-</td>
19       <td>-</td>
20     </tr>
21   % endfor
22 </%def>
23
24 % if server is None:
25   <h2>Sorry, that server wasn't found!</h2>
26
27 % else:
28   <div class="row">
29     <div class="small-12 columns">
30       <h2>${server.name}</h2>
31       <p>
32         IP Address: 
33         % if server.port is not None:
34         ${server.ip_addr}:${server.port}
35         % else:
36         ${server.ip_addr}
37         % endif
38         <br />
39         Revision: ${server.revision} <br />
40         Added <span class="abstime" data-epoch="${server.epoch()}" title="${server.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${server.fuzzy_date()}</span> <br />
41       </p>
42     </div>
43   </div>
44
45
46   <div class="row">
47     <div class="small-12 large-4 columns">
48       <h5>Top Scoring Players</h5>
49       <table class="table-hover table-condensed">
50         <thead>
51           <tr>
52             <th class="small-2">#</th>
53             <th class="small-7">Nick</th>
54             <th class="small-3">Score</th>
55           </tr>
56         </thead>
57         <tbody>
58         % for ts in top_scorers:
59           <tr>
60             <td>${ts.rank}</td>
61             <td class="no-stretch"><a href="${request.route_url('player_info', id=ts.player_id)}" title="Go to the player info page for this player">${ts.nick|n}</a></td>
62             <td>${ts.total_score}</td>
63           </tr>
64         % endfor
65
66         ${empty_rows(top_scorers, 10)}
67
68         </tbody>
69       </table>
70     </div>
71
72     <div class="small-12 large-4 columns">
73       <h5>Most Active Players</h5>
74       <table class="table-hover table-condensed">
75         <thead>
76           <tr>
77             <th class="small-2">#</th>
78             <th class="small-7">Nick</th>
79             <th class="small-3">Time</th>
80           </tr>
81         </thead>
82         <tbody>
83         % for tp in top_players:
84           <tr>
85             <td>${tp.rank}</td>
86             <td class="no-stretch"><a href="${request.route_url('player_info', id=tp.player_id)}" title="Go to the player info page for this player">${tp.nick|n}</a></td>
87             <td>${tp.alivetime}</td>
88           </tr>
89         % endfor
90
91         ${empty_rows(top_players, 10)}
92
93         </tbody>
94       </table>
95     </div>
96
97     <div class="small-12 large-4 columns">
98       <h5>Most Active Maps</h5>
99       <table class="table-hover table-condensed">
100         <thead>
101           <tr>
102             <th class="small-2">#</th>
103             <th class="small-7">Map</th>
104             <th class="small-3">Games</th>
105           </tr>
106         </thead>
107         <tbody>
108         % for tm in top_maps:
109           <tr>
110             <td>${tm.rank}</td>
111             <td class="no-stretch"><a href="${request.route_url('map_info', id=tm.map_id)}" title="Go to the map info page for ${tm.name}">${tm.name}</a></td>
112             <td>${tm.times_played}</td>
113           </tr>
114         % endfor
115
116         ${empty_rows(top_maps, 10)}
117
118         </tbody>
119       </table>
120     </div> 
121   </div>
122
123   <div class="row">
124     <div class="small-12 columns">
125       <small>*Most active stats are from the past ${lifetime} days</small>
126     </div>
127   </div>
128
129
130   % if len(recent_games) > 0:
131     <div class="row">
132       <div class="small-12 columns">
133         <h5>Most Recent Games</h5>
134         <table class="table-hover table-condensed">
135           <thead>
136             <tr>
137               <th class="small-1 text-center"></th>
138               <th class="small-1">Type</th>
139               <th class="show-for-medium-up small-3">Map</th>
140               <th class="show-for-large-up small-3">Time</th>
141               <th class="small-3">Winner</th>
142             </tr>
143           </thead>
144           <tbody>
145             % for rg in recent_games:
146             <tr>
147               <td class="text-center"><a class="tiny button" href="${request.route_url('game_info', id=rg.game_id)}" title="View detailed information about this game">View</a></td>
148               <td class="text-center"><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"></span></td>
149               <td class="show-for-medium-up"><a href="${request.route_url('map_info', id=rg.map_id)}" title="Go to the map detail page for this map">${rg.map_name}</a></td>
150               <td class="show-for-large-up"><span class="abstime" data-epoch="${rg.epoch}" title="${rg.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${rg.fuzzy_date}</span></td>
151               <td class="no-stretch">
152                 % if rg.player_id > 2:
153                 <a href="${request.route_url('player_info', id=rg.player_id)}" title="Go to the player info page for this player">${rg.nick_html_colors|n}</a>
154                 % else:
155                 ${rg.nick_html_colors|n}
156                 % endif
157               </td>
158             </tr>
159             % endfor
160           </tbody>
161         </table>
162         <p><a href="${request.route_url('game_index', _query={'server_id':server.server_id})}">More...</a></p>
163       </div>
164     </div>
165   % endif
166 % endif