]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 139011 - Improve buglist colors further
authorburnus%gmx.de <>
Fri, 22 Aug 2003 20:55:13 +0000 (20:55 +0000)
committerburnus%gmx.de <>
Fri, 22 Aug 2003 20:55:13 +0000 (20:55 +0000)
r,a=justdave

Bugzilla/Template.pm
Bugzilla/Util.pm
buglist.cgi
t/004template.t
t/008filter.t
template/en/default/filterexceptions.pl
template/en/default/list/table.html.tmpl

index d5cb1afd790689b927d1a2e9d16033af8021c0b0..2cb017d1764d79357c10bf1723277b741a83b4e5 100644 (file)
@@ -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 {
index 511ba2592c5c69d0e1dd1de2b78d1dd1f62d3b44..c0d671744cb6d524e26290e11f1b499eedfff20c 100644 (file)
@@ -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/\&/\&amp;/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
index 5326507c78990b46dc0c3d1035216d30264129bd..f2f5ca61081aad88bf2f068488419e29de699285 100755 (executable)
@@ -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) {
index 35965aa1153affc7da54390dc7df4a8302e933ab..7252414265d27eb3e2a5586c8fc1462c6f0a3283 100644 (file)
@@ -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] ,
index 0d6ec4b49543b101aa076ed17a71a254e4f23edf..3bf7f3fd13ed2bf2b3e6e3f24a130ef7810f82b4 100644 (file)
@@ -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;
 }
index 60590d4a4c372a9887505bacdf21153c05e74cb5..34fc99380913b2b4f5a89f18dfe6c9c49166ee47 100644 (file)
 ],
 
 'list/table.html.tmpl' => [
-  'id', 
   'abbrev.$id.title || field_descs.$id || column.title', #
   'tableheader',
-  'bug.bug_severity', #
-  'bug.priority', #
   'bug.bug_id', 
 ],
 
index 53eb52b2d896a3ab32ee3a847f14ed13e836ed64..da94b1eb9aff45cfd218c30d39088115b4293655 100644 (file)
@@ -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>
 
     [% 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 %]