diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-02-08 00:35:30 +0100 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-02-08 00:35:30 +0100 |
commit | 7f85d8e57d72ce68752cbf78bc633f00ee8da29a (patch) | |
tree | 9b0fa462bca91469ac4856a29fd9343e8d4b9297 /page.cgi | |
parent | 36b5893ba963132cfcfa394aa1a67badeb3aa53e (diff) | |
download | bugzilla-7f85d8e57d72ce68752cbf78bc633f00ee8da29a.tar.gz bugzilla-7f85d8e57d72ce68752cbf78bc633f00ee8da29a.tar.xz |
Bug 518293: Improve and Simplify the QuickSearch Documentation
r=LpSolit, a=LpSolit
Diffstat (limited to 'page.cgi')
-rwxr-xr-x | page.cgi | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -35,6 +35,29 @@ use lib qw(. lib); use Bugzilla; use Bugzilla::Error; use Bugzilla::Hook; +use Bugzilla::Search::Quicksearch; + +############### +# Subroutines # +############### + +# For quicksearch.html. +sub quicksearch_field_names { + my $fields = Bugzilla::Search::Quicksearch::FIELD_MAP; + my %fields_reverse; + # Put longer names before shorter names. + my @nicknames = sort { length($b) <=> length($a) } (keys %$fields); + foreach my $nickname (@nicknames) { + my $db_field = $fields->{$nickname}; + $fields_reverse{$db_field} ||= []; + push(@{ $fields_reverse{$db_field} }, $nickname); + } + return \%fields_reverse; +} + +############### +# Main Script # +############### Bugzilla->login(); @@ -51,7 +74,9 @@ if ($id) { ThrowCodeError("bad_page_cgi_id", { "page_id" => $id }); } - my %vars; + my %vars = ( + quicksearch_field_names => \&quicksearch_field_names, + ); Bugzilla::Hook::process('page_before_template', { page_id => $id, vars => \%vars }); |