Mercurial > genshi > mirror
comparison examples/trac/templates/report.cs @ 39:93b4dcbafd7b trunk
Copy Trac to main branch.
author | cmlenz |
---|---|
date | Mon, 03 Jul 2006 18:53:27 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
38:ee669cb9cccc | 39:93b4dcbafd7b |
---|---|
1 <?cs include "header.cs" ?> | |
2 <?cs include "macros.cs" ?> | |
3 | |
4 <div id="ctxtnav" class="nav"> | |
5 <h2>Report Navigation</h2> | |
6 <ul><li class="first"><?cs | |
7 if:chrome.links.up.0.href ?><a href="<?cs | |
8 var:chrome.links.up.0.href ?>">Available Reports</a><?cs | |
9 else ?>Available Reports<?cs | |
10 /if ?></li><?cs | |
11 if:report.query_href ?><li class="last"><a href="<?cs | |
12 var:report.query_href ?>">Custom Query</a></li><?cs | |
13 /if ?></ul> | |
14 </div> | |
15 | |
16 <div id="content" class="report"> | |
17 | |
18 <?cs def:report_hdr(header) ?> | |
19 <?cs if $header ?> | |
20 <?cs if idx > 0 ?> | |
21 </table> | |
22 <?cs /if ?> | |
23 <?cs /if ?> | |
24 <?cs if:header ?><h2><?cs var:header ?></h2><?cs /if ?> | |
25 <?cs if $report.id == -1 ?> | |
26 <table class="listing reports"> | |
27 <?cs else ?> | |
28 <table class="listing tickets"> | |
29 <?cs /if ?> | |
30 <thead> | |
31 <tr> | |
32 <?cs set numcols = #0 ?> | |
33 <?cs each header = report.headers ?> | |
34 <?cs if $header.fullrow ?> | |
35 </tr><tr><th colspan="100"><?cs var:header ?></th> | |
36 <?cs else ?> | |
37 <?cs if $report.sorting.enabled ?> | |
38 <?cs set vars='' ?> | |
39 <?cs each arg = report.var ?> | |
40 <?cs set vars = vars + '&' + name(arg) + '=' + arg ?> | |
41 <?cs /each ?> | |
42 <?cs set sortValue = '' ?> | |
43 <?cs if $header.asc == '1' ?> | |
44 <?cs set sortValue = '?sort='+$header.real+'&asc=0' ?> | |
45 <?cs else ?> | |
46 <?cs set sortValue = '?sort='+$header.real+'&asc=1' ?> | |
47 <?cs /if ?> | |
48 <?cs if $header ?> | |
49 <th><a href="<?cs var:sortValue ?><?cs var:vars ?>"><?cs var:header ?></a></th> | |
50 <?cs /if ?> | |
51 <?cs elif $header ?> | |
52 <th><?cs var:header ?></th> | |
53 <?cs /if ?> | |
54 <?cs if $header.breakrow ?> | |
55 </tr><tr> | |
56 <?cs /if ?> | |
57 <?cs /if ?> | |
58 <?cs set numcols = numcols + #1 ?> | |
59 <?cs /each ?> | |
60 </tr> | |
61 </thead> | |
62 <?cs /def ?> | |
63 | |
64 <?cs def:report_cell(class,contents) ?> | |
65 <?cs if $cell.fullrow ?> | |
66 </tr><tr class="<?cs var:row_class ?>" style="<?cs var: row_style ?>;border: none; padding: 0;"> | |
67 <td class="fullrow" colspan="100"> | |
68 <?cs var:$contents ?><hr /> | |
69 </td> | |
70 <?cs else ?> | |
71 <td <?cs if $cell.breakrow || $col == $numcols ?>colspan="100" <?cs /if | |
72 ?>class="<?cs var:$class ?>"><?cs if $contents ?><?cs var:$contents ?><?cs /if ?></td> | |
73 | |
74 <?cs if $cell.breakafter ?> | |
75 </tr><tr class="<?cs var: row_class ?>" style="<?cs var: row_style ?>;border: none; padding: 0"> | |
76 <?cs /if ?> | |
77 <?cs /if ?> | |
78 <?cs set col = $col + #1 ?> | |
79 <?cs /def ?> | |
80 | |
81 <?cs set idx = #0 ?> | |
82 <?cs set group = '' ?> | |
83 | |
84 <?cs if:report.mode == "list" ?> | |
85 <h1><?cs var:title ?><?cs | |
86 if:report.numrows && report.id != -1 ?><span class="numrows"> (<?cs | |
87 var:report.numrows ?> matches)</span><?cs | |
88 /if ?></h1><?cs | |
89 if:report.description ?><div id="description"><?cs | |
90 var:report.description ?></div><?cs | |
91 /if ?><?cs | |
92 if:report.id != -1 ?><?cs | |
93 if:report.can_create || report.can_modify || report.can_delete ?> | |
94 <div class="buttons"><?cs | |
95 if:report.can_modify ?><form action="" method="get"><div> | |
96 <input type="hidden" name="action" value="edit" /> | |
97 <input type="submit" value="Edit report" accesskey="e" /> | |
98 </div></form><?cs /if ?><?cs | |
99 if:report.can_create ?><form action="" method="get"><div> | |
100 <input type="hidden" name="action" value="copy" /> | |
101 <input type="submit" value="Copy report" /> | |
102 </div></form><?cs /if ?><?cs | |
103 if:report.can_delete ?><form action="" method="get"><div> | |
104 <input type="hidden" name="action" value="delete" /> | |
105 <input type="submit" value="Delete report" /> | |
106 </div></form><?cs /if ?> | |
107 </div><?cs | |
108 /if ?><?cs | |
109 /if ?> | |
110 | |
111 <?cs each row = report.items ?> | |
112 <?cs if group != row.__group__ || idx == #0 ?> | |
113 <?cs if:idx != #0 ?></tbody><?cs /if ?> | |
114 <?cs set group = row.__group__ ?> | |
115 <?cs call:report_hdr(group) ?> | |
116 <tbody> | |
117 <?cs /if ?> | |
118 | |
119 <?cs if row.__color__ ?> | |
120 <?cs set rstem='color'+$row.__color__ +'-' ?> | |
121 <?cs else ?> | |
122 <?cs set rstem='' ?> | |
123 <?cs /if ?> | |
124 <?cs if idx % #2 ?> | |
125 <?cs set row_class=$rstem+'even' ?> | |
126 <?cs else ?> | |
127 <?cs set row_class=$rstem+'odd' ?> | |
128 <?cs /if ?> | |
129 | |
130 <?cs set row_style='' ?> | |
131 <?cs if row.__bgcolor__ ?> | |
132 <?cs set row_style='background: ' + row.__bgcolor__ + ';' ?> | |
133 <?cs /if ?> | |
134 <?cs if row.__fgcolor__ ?> | |
135 <?cs set row_style=$row_style + 'color: ' + row.__fgcolor__ + ';' ?> | |
136 <?cs /if ?> | |
137 <?cs if row.__style__ ?> | |
138 <?cs set row_style=$row_style + row.__style__ + ';' ?> | |
139 <?cs /if ?> | |
140 | |
141 <tr class="<?cs var: row_class ?>" style="<?cs var: row_style ?>"> | |
142 <?cs set idx = idx + #1 ?> | |
143 <?cs set col = #0 ?> | |
144 <?cs each cell = row ?> | |
145 <?cs if cell.hidden || cell.hidehtml ?> | |
146 <?cs elif name(cell) == "ticket" || name(cell) == "id" ?> | |
147 <?cs call:report_cell('ticket', | |
148 '<a title="View ticket" href="'+ | |
149 $cell.ticket_href+'">#'+$cell+'</a>') ?> | |
150 <?cs elif name(cell) == "summary" && cell.ticket_href ?> | |
151 <?cs call:report_cell('summary', '<a title="View ticket" href="'+ | |
152 $cell.ticket_href+'">'+$cell+'</a>') ?> | |
153 <?cs elif name(cell) == "report" ?> | |
154 <?cs call:report_cell('report', | |
155 '<a title="View report" href="'+$cell.report_href+'">{'+$cell+'}</a>') ?> | |
156 <?cs set:report_href=$cell.report_href ?> | |
157 <?cs elif name(cell) == "time" ?> | |
158 <?cs call:report_cell('date', $cell.date) ?> | |
159 <?cs elif name(cell) == "date" || name(cell) == "created" || name(cell) == "modified" ?> | |
160 <?cs call:report_cell('date', $cell.date) ?> | |
161 <?cs elif name(cell) == "datetime" ?> | |
162 <?cs call:report_cell('date', $cell.datetime) ?> | |
163 <?cs elif name(cell) == "description" ?> | |
164 <?cs call:report_cell('', $cell.parsed) ?> | |
165 <?cs elif name(cell) == "title" && $report.id == -1 ?> | |
166 <?cs call:report_cell('title', | |
167 '<a title="View report" href="'+ | |
168 $report_href+'">'+$cell+'</a>') ?> | |
169 <?cs else ?> | |
170 <?cs call:report_cell(name(cell), $cell) ?> | |
171 <?cs /if ?> | |
172 <?cs /each ?> | |
173 </tr> | |
174 <?cs /each ?> | |
175 </tbody> | |
176 </table><?cs | |
177 if:report.id == -1 && report.can_create?><div class="buttons"> | |
178 <form action="" method="get"><div> | |
179 <input type="hidden" name="action" value="new" /> | |
180 <input type="submit" value="Create new report" /> | |
181 </div></form></div><?cs | |
182 /if ?><?cs | |
183 if report.message ?> | |
184 <div class="system-message"><?cs var report.message ?></div><?cs | |
185 elif:idx == #0 ?> | |
186 <div id="report-notfound">No matches found.</div><?cs | |
187 /if ?> | |
188 | |
189 <?cs elif:report.mode == "delete" ?> | |
190 | |
191 <h1><?cs var:title ?></h1> | |
192 <form action="<?cs var:report.href ?>" method="post"> | |
193 <input type="hidden" name="id" value="<?cs var:report.id ?>" /> | |
194 <input type="hidden" name="action" value="delete" /> | |
195 <p><strong>Are you sure you want to delete this report?</strong></p> | |
196 <div class="buttons"> | |
197 <input type="submit" name="cancel" value="Cancel" /> | |
198 <input type="submit" value="Delete report" /> | |
199 </div> | |
200 </form> | |
201 | |
202 <?cs elif:report.mode == "edit" ?> | |
203 | |
204 <h1><?cs var:title ?></h1> | |
205 <form action="<?cs var:report.href ?>" method="post"> | |
206 <div> | |
207 <input type="hidden" name="action" value="<?cs var:report.action ?>" /> | |
208 <div class="field"> | |
209 <label for="title">Report Title:</label><br /> | |
210 <input type="text" id="title" name="title" | |
211 value="<?cs var:report.title ?>" size="50" /><br /> | |
212 </div> | |
213 <div class="field"> | |
214 <label for="description"> | |
215 Description:</label> (You may use <a tabindex="42" href="<?cs | |
216 var:$trac.href.wiki ?>/WikiFormatting">WikiFormatting</a> here) | |
217 </label><br /> | |
218 <textarea id="description" name="description" class="wikitext" rows="10" cols="78"> | |
219 <?cs var:report.description ?></textarea> | |
220 </div> | |
221 <div class="field"> | |
222 <label for="query"> | |
223 SQL Query for Report:</label><br /> | |
224 <textarea id="query" name="query" cols="85" rows="20"><?cs | |
225 var:report.sql ?></textarea> | |
226 </div> | |
227 <div class="buttons"> | |
228 <input type="submit" value="Save report" /> | |
229 <input type="submit" name="cancel" value="Cancel" /> | |
230 </div> | |
231 </div> | |
232 <script type="text/javascript" src="<?cs | |
233 var:htdocs_location ?>js/wikitoolbar.js"></script> | |
234 </form> | |
235 <?cs /if?> | |
236 | |
237 <div id="help"> | |
238 <strong>Note:</strong> See <a href="<?cs | |
239 var:trac.href.wiki ?>/TracReports">TracReports</a> for help on using and | |
240 creating reports. | |
241 </div> | |
242 | |
243 </div> | |
244 <?cs include "footer.cs" ?> |