From 4d1cdd81a580997bb0b57068ad26947bc35a7fab Mon Sep 17 00:00:00 2001 From: vfilippov Date: Wed, 21 Apr 2010 18:46:02 +0000 Subject: [PATCH] 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 --- Bugzilla/Search/Quicksearch.pm | 94 ++++++++++++++++------------------ 1 file changed, 45 insertions(+), 49 deletions(-) diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index 968283546..0c920a9e0 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -174,55 +174,32 @@ sub quicksearch { my (%states, %resolutions); 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; + %states = map { $_ => 1 } @openStates; } - 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]+)*$/) { + elsif ($words[0] =~ /^[A-Z]+(,[A-Z]+)*$/) + { # e.g. NEW,ASSI,REOP,FIX - undef %states; - if (matchPrefixes(\%states, - \%resolutions, - [split(/,/, $words[0])], - $legal_statuses, - $legal_resolutions)) { + my (%st, %res); + if (matchPrefixes(\%st, \%res, [split(/,/, $words[0])], + $legal_statuses, $legal_resolutions)) + { shift @words; - } - else { - # Carry on if no match found - foreach (@openStates) { $states{$_} = 1 } + %states = %st; + %resolutions = %res; } } - else { + else + { # Default: search for ALL BUGS! (Vitaliy Filippov 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 = ''; # Loop over all main-level QuickSearch words. @@ -275,7 +252,18 @@ sub quicksearch { # generic field1,field2,field3:value1,value2 notation my @fields = split(/,/, $1); 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 if (!defined(MAPPINGS->{$field})) { push(@unknownFields, $field); @@ -336,6 +324,14 @@ sub quicksearch { } # foreach (@words) $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 if (scalar(@unknownFields)) { ThrowUserError("quicksearch_unknown_field", @@ -375,7 +371,7 @@ sub splitString { my $i = 0; # Now split on quote sign; be tolerant about unclosed quotes - @quoteparts = split(/"/, $string); + @quoteparts = split(/\"/, $string, -1); foreach my $part (@quoteparts) { # After every odd quote, quote special chars $part = url_quote($part) if $i++ % 2; @@ -385,14 +381,14 @@ sub splitString { # Now split on unescaped whitespace @parts = split(/\s+/, $string); - foreach (@parts) { - # Protect plus signs from becoming a blank. - # If "+" appears as the first character, leave it alone - # as it has a special meaning. Strings which start with - # "+" must be quoted. - s/(?