Commit 115cc7b7 authored by burnus%gmx.de's avatar burnus%gmx.de

Bug 139011 - Improve buglist colors further

r,a=justdave
parent d08d7d95
......@@ -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 {
......
......@@ -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
......
......@@ -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) {
......
......@@ -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] ,
......
......@@ -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;
}
......
......@@ -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',
],
......
......@@ -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 %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment