bugzilla-4intranet/template/en/default/reports/report-table.html.tmpl

179 lines
6.2 KiB
Cheetah

[%# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Gervase Markham <gerv@gerv.net>
# <rdean@cambianetworks.com>
#%]
[%# INTERFACE:
# buglistbase: The base query for this table, in URL form
# col_field: string. Name of the field being plotted as columns.
# row_field: string. Name of the field being plotted as rows.
# tbl_field: string. Name of the field being plotted as tables.
# col_names: array. List of values for the field being plotted as columns.
# row_names: array. List of values for the field being plotted as rows.
# data: <depends on format>. Data to plot. Only data.$tbl is accessed.
# tbl: Name of a hash in data which is the table to be plotted.
#%]
[% col_field_disp = report_columns.$col_field.title || col_field %]
[% row_field_disp = report_columns.$row_field.title || row_field %]
[% urlbase = buglistbase;
IF row_field;
urlbase = urlbase.replace(row_field _ '_type=[^&]*&?', '');
END;
IF col_field;
urlbase = urlbase.replace(col_field _ '_type=[^&]*&?', '');
END; %]
[% IF tbl == "-total-" %]
[% urlbase = BLOCK %]buglist.cgi?[% urlbase | html %]
[% "&amp;$tbl_vals" IF tbl_vals %][% END %]
[% ELSE %]
[% urlbase = BLOCK %]buglist.cgi?[% urlbase | html %]&amp;
[% tbl_field | url_quote %]=[% tbl | url_quote %][% END %]
[% END %]
[% IF tbl_field %]
<h2>[% tbl_disp FILTER email FILTER html %]</h2>
[% END %]
[% classes = [ [ "t1", "t2" ] , [ "t3", "t4" ] ] %]
[% col_idx = 0 %]
[% row_idx = 0 %]
[% mlist = (measure == 'times' ? [ 'etime', 'wtime', 'rtime' ] : [ measure ]) %]
<table class="report" border="1" style="border-collapse: collapse">
[% IF col_field %]
<tr>
<td class="[% classes.$row_idx.$col_idx %]"><div style="position: relative; height: 100%">
<img style="position: absolute; left: 0; top: 0; width: 100%; height: 100%" src="skins/standard/global/diag.svg" />
<table>
<tr><td></td><td><strong>[% col_field_disp FILTER html %]</strong></td></tr>
<tr><td><strong>[% row_field_disp FILTER html %]</strong></td><td></td></tr>
</table>
</div></td>
[% FOREACH col = col_names %]
[% col_idx = 1 - col_idx %]
<td class="[% classes.$row_idx.$col_idx %]"[% ' colspan="3"' IF measure == 'times' %]>
[% PROCESS value_display value = col field = col_field %]
</td>
[% END %]
[% IF col_names.size > 1 %]
<td class="ttotal"[% ' colspan="3"' IF measure == 'times' %]>
Total
</td>
[% END %]
</tr>
[% ELSE %]
<tr>
<td class="[% classes.$row_idx.$col_idx %]">
<strong>[% row_field_disp FILTER html %]</strong>
</td>
<td class="ttotal"[% ' colspan="3"' IF measure == 'times' %]>
Total
</td>
</tr>
[% END %]
[% col_totals = {} %]
[% grand_total = {} %]
[% FOREACH row = row_names %]
[% row_total = {} %]
[% row_idx = 1 - row_idx %]
<tr>
<td class="[% classes.$row_idx.$col_idx %]">
[% PROCESS value_display value = row field = row_field %]
</td>
[% col_n = 0 %]
[% FOREACH col = col_names %]
[% col_idx = 1 - col_idx %]
[% FOR m = mlist %]
[%# Use numeric keys because fu*king Template::Stash produces double UTF-8 %]
[% col_totals.$col_n.$m = col_totals.$col_n.$m + data.$tbl.$col.$row.$m %]
[% row_total.$m = row_total.$m + data.$tbl.$col.$row.$m %]
<td class="[% classes.$row_idx.$col_idx %]" align="center">
[% IF data.$tbl.$col.$row.$m AND data.$tbl.$col.$row.$m > 0 %]
<a href="[% urlbase %]&amp;
[% PROCESS value_url value=row field=row_field %]&amp;
[% PROCESS value_url value=col field=col_field %]">
[% data.$tbl.$col.$row.$m %]</a>
[% END %]
</td>
[% END %]
[% col_n = col_n + 1 %]
[% END %]
[% IF col_names.size > 1 %]
[% FOR m = mlist %]
<td class="ttotal" align="right">
<a href="[% urlbase %]&amp;
[% PROCESS value_url value=row field=row_field %]
[% "&amp;$col_vals" IF col_vals %]">
[% row_total.$m %]</a>
[% grand_total.$m = grand_total.$m + row_total.$m %]
</td>
[% END %]
[% END %]
</tr>
[% END %]
<tr>
[% row_idx = 1 - row_idx %]
<td class="ttotal">Total</td>
[% col_n = 0 %]
[% FOREACH col = col_names %]
[% FOR m = mlist %]
<td class="ttotal" align="center">
<a href="[% urlbase %]&amp;
[% PROCESS value_url value=col field=col_field %]
[% "&amp;$row_vals" IF row_vals %]">
[% col_totals.$col_n.$m %]</a>
</td>
[% END %]
[% col_n = col_n + 1 %]
[% END %]
[% IF col_names.size > 1 %]
[% FOR m = mlist %]
<td class="ttotal" align="right">
<strong>
<a href="[% urlbase %]
[% "&amp;$row_vals" IF row_vals %]
[% "&amp;$col_vals" IF col_vals %]">[% grand_total.$m %]</a>
</strong>
</td>
[% END %]
[% END %]
</tr>
</table>
[% BLOCK value_display %]
[% SET disp_value = value %]
[% IF field == 'assigned_to' OR field == 'reporter' OR field == 'qa_contact' %]
[% disp_value = value FILTER email %]
[% END %]
[% disp_value FILTER html FILTER replace('^\s*$','&nbsp;') %]
[% END %]
[% BLOCK value_url %]
[% IF NOT value %]
[% field | url_quote %]_type=regexp&amp;[% field | url_quote %]=[% '^$' | url_quote %]
[% ELSE %]
[% field | url_quote %]_type=equals&amp;[% field | url_quote %]=[% value | url_quote %]
[% END %]
[% END %]