Mercurial > treepkg
comparison contrib/sawmill/web/templates/details.html @ 452:333232953771
Initial check-in of sawmill a simple mod_python based
web application to render build reports of treepkg.
author | Sascha Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 20 Aug 2010 16:15:29 +0000 |
parents | |
children | 10d4cbffcc07 |
comparison
equal
deleted
inserted
replaced
451:eacfd3744d16 | 452:333232953771 |
---|---|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
2 "http://www.w3.org/TR/html4/loose.dtd"> | |
3 <% | |
4 from cgi import escape | |
5 from xml.sax.saxutils import quoteattr | |
6 | |
7 from datetime import date | |
8 %> | |
9 <html> | |
10 <head> | |
11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
12 <link rel="stylesheet" href="styles/style.css" type="text/css" media="screen" /> | |
13 <title>Sägewerker - Free Software forestry</title> | |
14 </head> | |
15 | |
16 <body> | |
17 <table border="0" width="100%" cellspacing="0" cellpadding="0"> | |
18 <tr> | |
19 <td> | |
20 <a href="/"><img src="img/logo.jpg" border="0" alt="" width="533" height="94" /></a> | |
21 </td> | |
22 </tr> | |
23 </table> | |
24 <table border="0" width="100%" cellspacing="0" cellpadding="0"> | |
25 | |
26 <tr> | |
27 <td align="left" bgcolor="#E0E0E0" width="9"> | |
28 <img src="img/topleft.png" height="9" width="9" alt="" /> | |
29 </td> | |
30 <td bgcolor="#E0E0E0" width="30"> | |
31 <img src="img/clear.png" width="30" height="1" alt="" /> | |
32 </td> | |
33 <td bgcolor="#E0E0E0"> | |
34 <img src="img/clear.png" width="1" height="1" alt="" /> | |
35 | |
36 </td> | |
37 <td bgcolor="#E0E0E0" width="30"> | |
38 <img src="img/clear.png" width="30" height="1" alt="" /> | |
39 </td> | |
40 <td align="right" bgcolor="#E0E0E0" width="9"> | |
41 <img src="img/topright.png" height="9" width="9" alt="" /> | |
42 </td> | |
43 </tr> | |
44 | |
45 <tr> | |
46 <!-- Outer body row --> | |
47 <td bgcolor="#E0E0E0"> | |
48 <img src="img/clear.png" width="10" height="1" alt="" /> | |
49 </td> | |
50 <td valign="top" width="99%" bgcolor="#E0E0E0" colspan="3"> | |
51 <!-- Inner Tabs / Shell --> | |
52 <table border="0" width="100%" cellspacing="0" cellpadding="0"> | |
53 <tr> | |
54 | |
55 <td align="left" bgcolor="#ffffff" width="9"> | |
56 <img src="img/topleft-inner.png" height="9" width="9" alt="" /> | |
57 </td> | |
58 <td bgcolor="#ffffff"> | |
59 <img src="img/clear.png" width="1" height="1" alt="" /> | |
60 </td> | |
61 <td align="right" bgcolor="#ffffff" width="9"> | |
62 <img src="img/topright-inner.png" height="9" width="9" alt="" /> | |
63 </td> | |
64 | |
65 </tr> | |
66 <tr> | |
67 <td bgcolor="#ffffff"> | |
68 <img src="img/clear.png" width="10" height="1" alt="" /> | |
69 </td> | |
70 <td valign="top" width="99%" bgcolor="white" class="css_prison"> | |
71 <!-- end main body row --> | |
72 <h1><%= escape(description) %></h1> | |
73 <%= header %> | |
74 <table class="statustable"> | |
75 <tr> | |
76 <th class="statustablehead">Status</th> | |
77 <th class="statustablehead">Package</th> | |
78 <th class="statustablehead">Revision</th> | |
79 <th class="statustablehead">Start</th> | |
80 <th class="statustablehead">Stop</th> | |
81 <th class="statustablehead">Notes</th> | |
82 </tr> | |
83 <% | |
84 | |
85 def nn(s, d=""): | |
86 if not s: return d | |
87 return escape(s) | |
88 | |
89 def pretty_time(t, format="%Y-%m-%d %H:%M:%S"): | |
90 if not t: return "<unknown>" | |
91 return t.strftime(format) | |
92 | |
93 | |
94 def date_from_datetime(x): | |
95 if not x: return None | |
96 return date(x.year, x.month, x.day) | |
97 | |
98 def sort_by_start(a, b): | |
99 a_start = a.build_start | |
100 b_start = b.build_start | |
101 if not a_start and not b_start: return 0 | |
102 if not a_start: return 1 | |
103 if not b_start: return -1 | |
104 return cmp(a_start, b_start) | |
105 | |
106 track_items = sorted(track_items, cmp=sort_by_start, reverse=True) | |
107 | |
108 last_date = None | |
109 | |
110 STATUS2CLASS = { | |
111 'creating_binary_package': 'inprogress', | |
112 'binary_package_created': 'finished' | |
113 } | |
114 | |
115 STATUS2MSG = { | |
116 'creating_binary_package': 'building binary packages', | |
117 'binary_package_created': 'build successful' | |
118 } | |
119 | |
120 for track_item in track_items: | |
121 # for all track items | |
122 curr_date = date_from_datetime(track_item.build_start) | |
123 if curr_date != last_date: | |
124 last_date = curr_date | |
125 %> | |
126 <tr class="date_row"><td colspan="6"><%= pretty_time(last_date, "%Y-%m-%d") %></td></tr> | |
127 <% | |
128 # date changed | |
129 %> | |
130 <tr class="<%= STATUS2CLASS.get(track_item.build_status, 'error') %>"> | |
131 <td><%= STATUS2MSG.get(track_item.build_status, 'error') %></td> | |
132 <td style="font-weight:bold;"><%= nn(track_item.track) %></td> | |
133 <td align="right"><%= nn(track_item.revision) %></td> | |
134 <td><%= pretty_time(track_item.build_start) %></td> | |
135 <td><%= pretty_time(track_item.build_stop) %></td> | |
136 <td> | |
137 <% | |
138 for log_desc, log_path in track_item.build_logs: | |
139 # for all logs | |
140 %> | |
141 [<a href=<%= quoteattr("%s/%s" % (base_dir, log_path)) %>><%= nn(log_desc) %></a>] | |
142 | |
143 <% | |
144 # for all logs | |
145 %> | |
146 </td> | |
147 </tr> | |
148 | |
149 <% | |
150 # for all track itemes | |
151 %> | |
152 | |
153 </table> | |
154 | |
155 | |
156 <!-- end main body row --> | |
157 </td> | |
158 <td width="10" bgcolor="#ffffff"> | |
159 <img src="img/clear.png" width="2" height="1" alt="" /> | |
160 </td> | |
161 </tr> | |
162 | |
163 <tr> | |
164 <td align="left" bgcolor="#E0E0E0" width="9"> | |
165 <img src="img/bottomleft-inner.png" height="11" width="11" alt="" /> | |
166 </td> | |
167 <td bgcolor="#ffffff"> | |
168 <img src="img/clear.png" width="1" height="1" alt="" /> | |
169 </td> | |
170 <td align="right" bgcolor="#E0E0E0" width="9"> | |
171 <img src="img/bottomright-inner.png" height="11" width="11" alt="" /> | |
172 | |
173 </td> | |
174 </tr> | |
175 </table> | |
176 | |
177 <!-- end inner body row --> | |
178 | |
179 </td> | |
180 <td width="10" bgcolor="#E0E0E0"> | |
181 <img src="img/clear.png" width="2" height="1" alt="" /> | |
182 </td> | |
183 | |
184 </tr> | |
185 <tr> | |
186 <td align="left" bgcolor="#E0E0E0" width="9"> | |
187 <img src="img/bottomleft.png" height="9" width="9" alt="" /> | |
188 </td> | |
189 <td bgcolor="#E0E0E0" colspan="3"> | |
190 <img src="img/clear.png" width="1" height="1" alt="" /> | |
191 </td> | |
192 <td align="right" bgcolor="#E0E0E0" width="9"> | |
193 | |
194 <img src="img/bottomright.png" height="9" width="9" alt="" /> | |
195 </td> | |
196 </tr> | |
197 </table> | |
198 <br /> | |
199 <center> | |
200 <b style="color:white; font-size:13px;"> | |
201 This site is hosted by the <a href="http://www.intevation.de">Intevation GmbH</a> | |
202 </b> | |
203 </center> | |
204 | |
205 </body> | |
206 </html> |