From: burnus%gmx.de <> Date: Fri, 22 Aug 2003 20:55:13 +0000 (+0000) Subject: Bug 139011 - Improve buglist colors further X-Git-Tag: bugzilla-2.17.5~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=115cc7b700979787e2adbb105832f27de4c89f28;p=thirdparty%2Fbugzilla.git Bug 139011 - Improve buglist colors further r,a=justdave --- diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index d5cb1afd79..2cb017d176 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 511ba2592c..c0d671744c 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 + +Quotes characters so that they may be used as CSS class names. Spaces +are replaced by underscores. + =item C As well as escaping html like C, this routine converts newlines diff --git a/buglist.cgi b/buglist.cgi index 5326507c78..f2f5ca6108 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 35965aa115..7252414265 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 0d6ec4b495..3bf7f3fd13 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 60590d4a4c..34fc993809 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 53eb52b2d8..da94b1eb9a 100644 --- a/template/en/default/list/table.html.tmpl +++ b/template/en/default/list/table.html.tmpl @@ -76,7 +76,7 @@ [% FOREACH id = displaycolumns %] - + [% END %] @@ -136,7 +136,11 @@ [% tableheader %] [% END %] - + [% IF dotweak %][% END %]