106 lines
3.5 KiB
Cheetah
106 lines
3.5 KiB
Cheetah
[%# 1.0@bugzilla.org %]
|
|
[%# 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): Jouni Heikniemi <jouni@heikniemi.net>
|
|
#
|
|
#%]
|
|
|
|
[%# INTERFACE:
|
|
#
|
|
# columns:
|
|
# array of hashes representing the columns in the table.
|
|
# Each hash contains data for a single column. Hash keys:
|
|
# name: Name of the field in the data param
|
|
# heading: The text to print at the header cell
|
|
# contentlink: URI to which the content of a data cell shall be linked to.
|
|
# Expressions of format %%xxx%% are replaced with value
|
|
# with the key xxx in data hash of the current row.
|
|
# content: If specified, the content of this variable is used
|
|
# instead of the data pulled from the current row.
|
|
# NOTE: This value is not HTML filtered at output!
|
|
# align: left/center/right. Controls the horizontal alignment of the
|
|
# text in the column.
|
|
# allow_html_content: if defined, then this column allows html content
|
|
# so it will not be filtered
|
|
#
|
|
# data:
|
|
# array of hashes representing the data for the table.
|
|
# Each hash contains data for a single row of data. The
|
|
# keys are column names from columns subhashes name field.
|
|
#
|
|
#%]
|
|
|
|
[%################### TABLE HEADER ######################%]
|
|
|
|
<table border="1" cellpadding="4" cellspacing="0">
|
|
<tr bgcolor="#6666FF">
|
|
[% FOREACH c = columns %]
|
|
[%# Default to align left for headers %]
|
|
<th align="[% (c.align || 'left') FILTER html %]">
|
|
[% c.heading FILTER html %]
|
|
</th>
|
|
[% END %]
|
|
</tr>
|
|
|
|
|
|
[%################### TABLE CONTENT ######################%]
|
|
|
|
[% FOREACH row = data %]
|
|
<tr>
|
|
[% FOREACH c = columns %]
|
|
<td [% IF c.align %] align="[% c.align FILTER html %]" [% END %]>
|
|
|
|
[% IF c.contentlink %]
|
|
[% link_uri = c.contentlink %]
|
|
[% FOREACH m = link_uri.match('%%(.+?)%%'); %]
|
|
[% IF row.$m %]
|
|
[% replacement_value = FILTER url_quote; row.$m; END %]
|
|
[% link_uri = link_uri.replace("%%$m%%", replacement_value) %]
|
|
[% END %]
|
|
[% END %]
|
|
<a href="[% link_uri %]">
|
|
[% END %]
|
|
|
|
[% IF c.content %]
|
|
[% c.content %]
|
|
[% ELSE %]
|
|
[% IF c.allow_html_content %]
|
|
[% row.${c.name} FILTER none %]
|
|
[% ELSE %]
|
|
[% row.${c.name} FILTER html %]
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF c.contentlink %]
|
|
</a>
|
|
[% END %]
|
|
|
|
</td>
|
|
[% END %]
|
|
</tr>
|
|
[% END %]
|
|
|
|
[% IF data.size == 0 %]
|
|
<tr><td colspan="[% columns.size %]" align="center"><i><none></i></td></tr>
|
|
[% END %]
|
|
|
|
|
|
[%################### TABLE FOOTER ######################%]
|
|
|
|
</table>
|