# a full URL that may have characters that need encoding.
url_quote => \&Bugzilla::Util::url_quote ,
+ # This filter is similar to url_quote but used a \ instead of a %
+ # as prefix. In addition it replaces a ' ' by a '_'.
+ css_class_quote => \&Bugzilla::Util::css_class_quote ,
+
quoteUrls => \&::quoteUrls ,
bug_link => [ sub {
use base qw(Exporter);
@Bugzilla::Util::EXPORT = qw(is_tainted trick_taint detaint_natural
html_quote url_quote value_quote xml_quote
+ css_class_quote
lsearch max min
trim format_time);
return $toencode;
}
+sub css_class_quote {
+ my ($toencode) = (@_);
+ $toencode =~ s/ /_/g;
+ $toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("&#x%x;",ord($1))/eg;
+ return $toencode;
+}
+
sub value_quote {
my ($var) = (@_);
$var =~ s/\&/\&/g;
Quotes characters so that they may be included as part of a url.
+=item C<css_class_quote($val)>
+
+Quotes characters so that they may be used as CSS class names. Spaces
+are replaced by underscores.
+
=item C<value_quote($val)>
As well as escaping html like C<html_quote>, this routine converts newlines
# Generate the list of columns that will be selected in the SQL query.
# The bug ID is always selected because bug IDs are always displayed.
-# Severity and Priority are required for buglist CSS classes.
-my @selectcolumns = ("bug_id", "bug_severity", "priority");
+# Severity, priority, resolution and status are required for buglist
+# CSS classes.
+my @selectcolumns = ("bug_id", "bug_severity", "priority", "bug_status",
+ "resolution");
# remaining and actual_time are required for precentage_complete calculation:
if (lsearch(\@displaycolumns, "percentage_complete") >= 0) {
js => sub { return $_ } ,
strike => sub { return $_ } ,
url_quote => sub { return $_ } ,
+ css_class_quote => sub { return $_ } ,
xml => sub { return $_ } ,
quoteUrls => sub { return $_ } ,
bug_link => [ sub { return sub { return $_; } }, 1] ,
# Things which are already filtered
# Note: If a single directive prints two things, and only one is
# filtered, we may not catch that case.
- return 1 if $directive =~ /FILTER\ (html|csv|js|url_quote|quoteUrls|
- time|uri|xml|lower)/x;
+ return 1 if $directive =~ /FILTER\ (html|csv|js|url_quote|css_class_quote|
+ quoteUrls|time|uri|xml|lower)/x;
return 0;
}
],
'list/table.html.tmpl' => [
- 'id',
'abbrev.$id.title || field_descs.$id || column.title', #
'tableheader',
- 'bug.bug_severity', #
- 'bug.priority', #
'bug.bug_id',
],
<colgroup>
<col class="bz_id_column">
[% FOREACH id = displaycolumns %]
- <col class="bz_[% id %]_column">
+ <col class="bz_[% id FILTER css_class_quote %]_column">
[% END %]
</colgroup>
[% tableheader %]
[% END %]
- <tr class="bz_[% bug.bug_severity %] bz_[% bug.priority %] [%+ "bz_secure" IF bug.isingroups %]">
+ <tr class="bz_[% bug.bug_severity FILTER css_class_quote %]
+ bz_[% bug.priority FILTER css_class_quote %]
+ bz_[% bug.bug_status FILTER css_class_quote %]
+ bz_[% bug.resolution FILTER css_class_quote %]
+ [%+ "bz_secure" IF bug.isingroups %]">
<td>
[% IF dotweak %]<input type="checkbox" name="id_[% bug.bug_id %]">[% END %]