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