Bug 70605 - Fix select-field.html.tmpl

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1309 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2011-07-25 13:35:57 +00:00
parent fa82659c5a
commit b3cd02a492
3 changed files with 45 additions and 51 deletions

View File

@ -56,7 +56,7 @@
}
{name => 'what'
heading => 'What'
content_use_field => 1
content_values => field_descs
}
{name => 'removed'
heading => 'Removed'

View File

@ -27,9 +27,8 @@
[% columns = [
{
name => "name"
name => "description"
heading => "Edit field values for..."
content_use_field = 1
contentlink => "editvalues.cgi?field=%%name%%"
}
]

View File

@ -21,27 +21,28 @@
[%# INTERFACE:
#
# columns:
# array of hashes representing the columns in the table.
# 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 only partially HTML filtered!
# content_use_field: If defined and true, then each value in the
# column corresponds with a key in the
# field_descs field, and that value from the
# field_descs hash will be used instead of "content."
# See fieldvalues/select-field for an example of use.
# This content WILL be HTML-filtered in this case.
# align: left/center/right. Controls the horizontal alignment of the
# text in the column.
# allow_html_content: if defined, then this column allows some html content
# and so it will be only partially filtered.
# 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 only partially HTML filtered!
# content_values:
# If specified, then each value of the column is translated
# using content_values hash.
# This content WILL be HTML-filtered in this case.
# align:
# left/center/right. Controls the horizontal alignment of the text in the column.
# allow_html_content:
# If defined, then this column allows some html content
# and so it will be only partially filtered.
# yesno_field: Turn the data from 0/!0 into Yes/No
#
# data:
@ -69,7 +70,7 @@
# against. The second hash then again points to another hash. Within this
# third hash (3), the keys represent values to match against. The item
# contains a fourth hash (4) specifying overridden values.
#
#
# Each column value mentioned in the 'columns' documentation above
# can be overwritten (apart from name and heading). To override a
# table-cell value 'xxx', specify a new 'xxx' value, and specify a
@ -78,6 +79,8 @@
#
#%]
[%# FIXME move away from templates %]
[%################### TABLE HEADER ######################%]
<table id="admin_table" cellpadding="4" cellspacing="0">
@ -90,7 +93,6 @@
[% END %]
</tr>
[%################### TABLE CONTENT ######################%]
[% count = 0 %]
@ -103,7 +105,7 @@
[%# Copy to local variables, as we may update these %]
[% contentlink = c.contentlink
content = c.content
content_use_field = c.content_use_field
content_values = c.content_values
align = c.align
class = c.class
allow_html_content = c.allow_html_content
@ -114,26 +116,20 @@
[% SET important = overrides.${c.name}.name.${row.name} %]
[% IF important %]
[% FOREACH key IN important.keys %]
[% SET ${key} = important.${key} %]
[% END %]
[% FOREACH key IN important.keys %]
[% SET ${key} = important.${key} %]
[% END %]
[% ELSE %]
[%# Are there any specific overrides for this column? %]
[% FOREACH match_field = overrides.${c.name}.keys %]
[% override = overrides.${c.name}.${match_field}.${row.$match_field} %]
[% NEXT UNLESS override %]
[%# Are there any specific overrides for this column? %]
[% FOREACH match_field = overrides.${c.name}.keys %]
[% override = overrides.${c.name}.${match_field}.${row.$match_field} %]
[% NEXT UNLESS override %]
[% FOREACH key IN override.keys %]
[% SET ${key} = override.${key} %]
[% END %]
[% LAST %]
[% FOREACH key IN override.keys %]
[% SET ${key} = override.${key} %]
[% END %]
[% LAST %]
[% END %]
[% END %]
<td [% IF align %] align="[% align FILTER html %]" [% END %]
@ -153,12 +149,12 @@
[% END %]
<a href="[% link_uri %]">
[% END %]
[% IF content_use_field %]
[% colname = row.${c.name} %]
[% field_descs.${colname} FILTER html %]
[% IF content_values %]
[% colname = row.${c.name} %]
[% content_values.${colname} FILTER html %]
[% ELSIF content %]
[% content FILTER html_light %]
[% content FILTER html_light %]
[% ELSE %]
[% IF yesno_field %]
[% IF row.${c.name} %]
@ -174,11 +170,11 @@
[% END %]
[% END %]
[% END %]
[% IF contentlink %]
</a>
[% END %]
</td>
[% END %]
</tr>
@ -188,7 +184,6 @@
<tr><td colspan="[% columns.size %]" align="center"><i>&lt;none&gt;</i></td></tr>
[% END %]
[%################### TABLE FOOTER ######################%]
</table>