summaryrefslogtreecommitdiffstats
path: root/page.cgi
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-02-08 00:35:30 +0100
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-02-08 00:35:30 +0100
commit7f85d8e57d72ce68752cbf78bc633f00ee8da29a (patch)
tree9b0fa462bca91469ac4856a29fd9343e8d4b9297 /page.cgi
parent36b5893ba963132cfcfa394aa1a67badeb3aa53e (diff)
downloadbugzilla-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-xpage.cgi27
1 files changed, 26 insertions, 1 deletions
diff --git a/page.cgi b/page.cgi
index d889841b3..cd6cb611e 100755
--- a/page.cgi
+++ b/page.cgi
@@ -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 });