Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
8762d1e6
Commit
8762d1e6
authored
Jan 08, 2015
by
Albert Ting
Committed by
Dylan William Hardison
Jan 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 832095 - Request new buglist/query hooks
parent
cde1c585
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
2 deletions
+98
-2
Hook.pm
Bugzilla/Hook.pm
+66
-0
buglist.cgi
buglist.cgi
+7
-2
Extension.pm
extensions/Example/Extension.pm
+23
-0
query.cgi
query.cgi
+2
-0
No files found.
Bugzilla/Hook.pm
View file @
8762d1e6
...
...
@@ -533,6 +533,33 @@ table should be joined with the C<bugs> table. If omitted, LEFT is used.
=back
=head2 buglist_format
This happens in F<buglist.cgi>, used to change the template variables before
processing the associated template hook.
Params:
=over
=item C<vars>
This is the entire set of variables that the current template
can see.
=item C<file>
The name of the template file being processed. This is
relative to the main template directory for the language (i.e. for
F<template/en/default/list/list.html.tmpl>, this variable will contain
C<list/list.html.tmpl>).
=item C<params>
A hashref. The set of named parameters extracted from cgi.
=back
=head2 search_operator_field_override
This allows you to modify L<Bugzilla::Search/OPERATOR_FIELD_OVERRIDE>,
...
...
@@ -1417,6 +1444,45 @@ Params:
=back
=head2 query_default_list
This happens in F<query.cgi>, used to include additional cgi params to be
searched for in order to create the set of default values.
Params:
=over
=item C<list>
The current list of cgi params to search for.
=back
=head2 query_format
This happens in F<query.cgi>, used to to add/modify $vars before
processing the template. For example, one could supply or modify the
default values for a custom query format.
Params:
=over
=item C<vars>
This is the entire set of variables that the current template
can see.
=item C<file>
The name of the template file being processed. This is
relative to the main template directory for the language (i.e. for
F<template/en/default/list/list.html.tmpl>, this variable will contain
C<list/list.html.tmpl>).
=back
=head2 quicksearch_map
This hook allows you to alter the Quicksearch syntax to include e.g. special
...
...
buglist.cgi
View file @
8762d1e6
...
...
@@ -25,6 +25,7 @@ use Bugzilla::Product;
use
Bugzilla::
Field
;
use
Bugzilla::
Status
;
use
Bugzilla::
Token
;
use
Bugzilla::
Hook
;
use
Date::
Parse
;
...
...
@@ -447,8 +448,8 @@ if (!$params->param('query_format')) {
# Determine the format in which the user would like to receive the output.
# Uses the default format if the user did not specify an output format;
# otherwise validates the user's choice against the list of available formats.
my
$format
=
$template
->
get_format
(
"list/list"
,
scalar
$
cgi
->
param
(
'format'
),
scalar
$
cgi
->
param
(
'ctype'
));
my
$format
=
$template
->
get_format
(
"list/list"
,
scalar
$
params
->
param
(
'format'
),
scalar
$
params
->
param
(
'ctype'
));
# Use server push to display a "Please wait..." message for the user while
# executing their query if their browser supports it and they are viewing
...
...
@@ -1124,6 +1125,10 @@ $cgi->close_standby_message($contenttype, $disposition, $disp_prefix, $format->{
# Content Generation
################################################################################
Bugzilla::Hook::
process
(
"buglist_format"
,
{
'vars'
=>
$vars
,
'format'
=>
$format
,
'params'
=>
$params
});
# Generate and return the UI (HTML page) from the appropriate template.
$template
->
process
(
$format
->
{
'template'
},
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
...
...
extensions/Example/Extension.pm
View file @
8762d1e6
...
...
@@ -304,6 +304,17 @@ sub buglist_column_joins {
};
}
sub
buglist_format
{
my
(
$self
,
$args
)
=
@_
;
my
$vars
=
$args
->
{
'vars'
};
my
$format
=
$args
->
{
'format'
};
my
$params
=
$args
->
{
'params'
};
if
(
$format
->
{
'template'
}
eq
"list/list-example.html.tmpl"
)
{
$vars
->
{
'example'
}
=
$params
->
param
(
'example'
);
}
}
sub
search_operator_field_override
{
my
(
$self
,
$args
)
=
@_
;
...
...
@@ -856,6 +867,18 @@ sub product_end_of_create {
}
}
sub
query_format
{
my
(
$self
,
$args
)
=
@_
;
my
$vars
=
$args
->
{
'vars'
};
my
$default
=
$vars
->
{
'default'
};
my
$format
=
$args
->
{
'format'
};
# change some default values
if
(
$format
->
{
'template'
}
eq
"search/search-example.html.tmpl"
)
{
$default
->
{
'example'
}[
0
]
=
$default
->
{
'example'
}[
0
]
||
"example"
;
}
}
sub
quicksearch_map
{
my
(
$self
,
$args
)
=
@_
;
my
$map
=
$args
->
{
'map'
};
...
...
query.cgi
View file @
8762d1e6
...
...
@@ -301,6 +301,8 @@ my $format = $template->get_format("search/search",
$vars
->
{
'query_format'
}
||
$vars
->
{
'format'
},
scalar
$cgi
->
param
(
'ctype'
));
Bugzilla::Hook::
process
(
"query_format"
,
{
'vars'
=>
$vars
,
'format'
=>
$format
});
print
$cgi
->
header
(
$format
->
{
'ctype'
});
$template
->
process
(
$format
->
{
'template'
},
$vars
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment