New version of S5: "addcss" attribute, refactored styles (common part moved to s5-base.css), style debug

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@713 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2010-04-21 18:46:02 +00:00
parent 6ef010a415
commit 4d1cdd81a5
1 changed files with 45 additions and 49 deletions

View File

@ -174,55 +174,32 @@ sub quicksearch {
my (%states, %resolutions); my (%states, %resolutions);
foreach (@$legal_statuses) { foreach (@$legal_statuses) {
push(@closedStates, $_) unless is_open_state($_); push @closedStates, $_ unless is_open_state($_);
} }
foreach (@openStates) { $states{$_} = 1 }
if ($words[0] eq 'OPEN') { if ($words[0] eq 'OPEN')
{
shift @words; shift @words;
%states = map { $_ => 1 } @openStates;
} }
elsif ($words[0] =~ /^\+[A-Z]+(,[A-Z]+)*$/) { elsif ($words[0] =~ /^[A-Z]+(,[A-Z]+)*$/)
# e.g. +DUP,FIX {
if (matchPrefixes(\%states,
\%resolutions,
[split(/,/, substr($words[0], 1))],
\@closedStates,
$legal_resolutions)) {
shift @words;
# Allowing additional resolutions means we need to keep
# the "no resolution" resolution.
$resolutions{'---'} = 1;
}
else {
# Carry on if no match found.
}
}
elsif ($words[0] =~ /^[A-Z]+(,[A-Z]+)*$/) {
# e.g. NEW,ASSI,REOP,FIX # e.g. NEW,ASSI,REOP,FIX
undef %states; my (%st, %res);
if (matchPrefixes(\%states, if (matchPrefixes(\%st, \%res, [split(/,/, $words[0])],
\%resolutions, $legal_statuses, $legal_resolutions))
[split(/,/, $words[0])], {
$legal_statuses,
$legal_resolutions)) {
shift @words; shift @words;
} %states = %st;
else { %resolutions = %res;
# Carry on if no match found
foreach (@openStates) { $states{$_} = 1 }
} }
} }
else { else
{
# Default: search for ALL BUGS! (Vitaliy Filippov <vfilippov@custis.ru> 2009-01-30) # Default: search for ALL BUGS! (Vitaliy Filippov <vfilippov@custis.ru> 2009-01-30)
foreach (@$legal_statuses) { $states{$_} = 1 } %states = map { $_ => 1 } @$legal_statuses;
} }
# If we have wanted resolutions, allow closed states
if (keys(%resolutions)) {
foreach (@closedStates) { $states{$_} = 1 }
}
$cgi->param('bug_status', keys(%states));
$cgi->param('resolution', keys(%resolutions));
my $content = ''; my $content = '';
# Loop over all main-level QuickSearch words. # Loop over all main-level QuickSearch words.
@ -275,7 +252,18 @@ sub quicksearch {
# generic field1,field2,field3:value1,value2 notation # generic field1,field2,field3:value1,value2 notation
my @fields = split(/,/, $1); my @fields = split(/,/, $1);
my @values = split(/,/, $2); my @values = split(/,/, $2);
foreach my $field (@fields) { foreach my $field (@fields)
{
if ($field eq 'status')
{
my (%st, %res);
if (matchPrefixes(\%st, \%res, \@values, $legal_statuses, $legal_resolutions))
{
%states = %st;
%resolutions = %res;
}
last;
}
# Skip and record any unknown fields # Skip and record any unknown fields
if (!defined(MAPPINGS->{$field})) { if (!defined(MAPPINGS->{$field})) {
push(@unknownFields, $field); push(@unknownFields, $field);
@ -336,6 +324,14 @@ sub quicksearch {
} # foreach (@words) } # foreach (@words)
$cgi->param('content', $content); $cgi->param('content', $content);
# If we have wanted resolutions, allow closed states
if (keys %resolutions) {
foreach (@closedStates) { $states{$_} = 1 }
}
$cgi->param('bug_status', keys(%states));
$cgi->param('resolution', keys(%resolutions));
# Inform user about any unknown fields # Inform user about any unknown fields
if (scalar(@unknownFields)) { if (scalar(@unknownFields)) {
ThrowUserError("quicksearch_unknown_field", ThrowUserError("quicksearch_unknown_field",
@ -375,7 +371,7 @@ sub splitString {
my $i = 0; my $i = 0;
# Now split on quote sign; be tolerant about unclosed quotes # Now split on quote sign; be tolerant about unclosed quotes
@quoteparts = split(/"/, $string); @quoteparts = split(/\"/, $string, -1);
foreach my $part (@quoteparts) { foreach my $part (@quoteparts) {
# After every odd quote, quote special chars # After every odd quote, quote special chars
$part = url_quote($part) if $i++ % 2; $part = url_quote($part) if $i++ % 2;
@ -385,14 +381,14 @@ sub splitString {
# Now split on unescaped whitespace # Now split on unescaped whitespace
@parts = split(/\s+/, $string); @parts = split(/\s+/, $string);
foreach (@parts) { foreach (@parts)
# Protect plus signs from becoming a blank. {
# If "+" appears as the first character, leave it alone if (/^".*"$/s)
# as it has a special meaning. Strings which start with {
# "+" must be quoted. # Decode previously encoded strings
s/(?<!^)\+/%2B/g; $_ = url_decode($_);
# Remove quotes Encode::_utf8_on($_);
s/"//g; }
} }
return @parts; return @parts;
} }