diff options
author | burnus%gmx.de <> | 2003-08-22 22:55:13 +0200 |
---|---|---|
committer | burnus%gmx.de <> | 2003-08-22 22:55:13 +0200 |
commit | 115cc7b700979787e2adbb105832f27de4c89f28 (patch) | |
tree | cf1e927145dec0439e651b92d32c4a7afeafec98 | |
parent | d08d7d95cfb5813b08f4c0bbc50cc435f6cf275c (diff) | |
download | bugzilla-115cc7b700979787e2adbb105832f27de4c89f28.tar.gz bugzilla-115cc7b700979787e2adbb105832f27de4c89f28.tar.xz |
Bug 139011 - Improve buglist colors further
r,a=justdave
-rw-r--r-- | Bugzilla/Template.pm | 4 | ||||
-rw-r--r-- | Bugzilla/Util.pm | 13 | ||||
-rwxr-xr-x | buglist.cgi | 6 | ||||
-rw-r--r-- | t/004template.t | 1 | ||||
-rw-r--r-- | t/008filter.t | 4 | ||||
-rw-r--r-- | template/en/default/filterexceptions.pl | 3 | ||||
-rw-r--r-- | template/en/default/list/table.html.tmpl | 8 |
7 files changed, 30 insertions, 9 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index d5cb1afd7..2cb017d17 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -218,6 +218,10 @@ sub create { # 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 { diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index 511ba2592..c0d671744 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -30,6 +30,7 @@ use strict; 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); @@ -73,6 +74,13 @@ sub url_quote { 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; @@ -260,6 +268,11 @@ replaced with their appropriate HTML entities. 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 diff --git a/buglist.cgi b/buglist.cgi index 5326507c7..f2f5ca610 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -486,8 +486,10 @@ if (!UserInGroup(Param("timetrackinggroup"))) { # 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) { diff --git a/t/004template.t b/t/004template.t index 35965aa11..725241426 100644 --- a/t/004template.t +++ b/t/004template.t @@ -92,6 +92,7 @@ foreach my $include_path (@include_paths) { 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] , diff --git a/t/008filter.t b/t/008filter.t index 0d6ec4b49..3bf7f3fd1 100644 --- a/t/008filter.t +++ b/t/008filter.t @@ -198,8 +198,8 @@ sub directive_ok { # 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; } diff --git a/template/en/default/filterexceptions.pl b/template/en/default/filterexceptions.pl index 60590d4a4..34fc99380 100644 --- a/template/en/default/filterexceptions.pl +++ b/template/en/default/filterexceptions.pl @@ -251,11 +251,8 @@ ], 'list/table.html.tmpl' => [ - 'id', 'abbrev.$id.title || field_descs.$id || column.title', # 'tableheader', - 'bug.bug_severity', # - 'bug.priority', # 'bug.bug_id', ], diff --git a/template/en/default/list/table.html.tmpl b/template/en/default/list/table.html.tmpl index 53eb52b2d..da94b1eb9 100644 --- a/template/en/default/list/table.html.tmpl +++ b/template/en/default/list/table.html.tmpl @@ -76,7 +76,7 @@ <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> @@ -136,7 +136,11 @@ [% 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 %] |