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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
8 deletions
+38
-8
Hook.pm
Bugzilla/Hook.pm
+0
-0
buglist.cgi
buglist.cgi
+7
-2
Extension.pm
extensions/Example/Extension.pm
+23
-0
query.cgi
query.cgi
+8
-6
No files found.
Bugzilla/Hook.pm
View file @
8762d1e6
This diff is collapsed.
Click to expand it.
buglist.cgi
View file @
8762d1e6
...
@@ -25,6 +25,7 @@ use Bugzilla::Product;
...
@@ -25,6 +25,7 @@ use Bugzilla::Product;
use
Bugzilla::
Field
;
use
Bugzilla::
Field
;
use
Bugzilla::
Status
;
use
Bugzilla::
Status
;
use
Bugzilla::
Token
;
use
Bugzilla::
Token
;
use
Bugzilla::
Hook
;
use
Date::
Parse
;
use
Date::
Parse
;
...
@@ -447,8 +448,8 @@ if (!$params->param('query_format')) {
...
@@ -447,8 +448,8 @@ if (!$params->param('query_format')) {
# Determine the format in which the user would like to receive the output.
# 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;
# 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.
# otherwise validates the user's choice against the list of available formats.
my
$format
=
$template
->
get_format
(
"list/list"
,
scalar
$
cgi
->
param
(
'format'
),
my
$format
=
$template
->
get_format
(
"list/list"
,
scalar
$
params
->
param
(
'format'
),
scalar
$
cgi
->
param
(
'ctype'
));
scalar
$
params
->
param
(
'ctype'
));
# Use server push to display a "Please wait..." message for the user while
# 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
# 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->{
...
@@ -1124,6 +1125,10 @@ $cgi->close_standby_message($contenttype, $disposition, $disp_prefix, $format->{
# Content Generation
# Content Generation
################################################################################
################################################################################
Bugzilla::Hook::
process
(
"buglist_format"
,
{
'vars'
=>
$vars
,
'format'
=>
$format
,
'params'
=>
$params
});
# Generate and return the UI (HTML page) from the appropriate template.
# Generate and return the UI (HTML page) from the appropriate template.
$template
->
process
(
$format
->
{
'template'
},
$vars
)
$template
->
process
(
$format
->
{
'template'
},
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
||
ThrowTemplateError
(
$template
->
error
());
...
...
extensions/Example/Extension.pm
View file @
8762d1e6
...
@@ -304,6 +304,17 @@ sub buglist_column_joins {
...
@@ -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
{
sub
search_operator_field_override
{
my
(
$self
,
$args
)
=
@_
;
my
(
$self
,
$args
)
=
@_
;
...
@@ -856,6 +867,18 @@ sub product_end_of_create {
...
@@ -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
{
sub
quicksearch_map
{
my
(
$self
,
$args
)
=
@_
;
my
(
$self
,
$args
)
=
@_
;
my
$map
=
$args
->
{
'map'
};
my
$map
=
$args
->
{
'map'
};
...
...
query.cgi
View file @
8762d1e6
...
@@ -95,7 +95,7 @@ my $userdefaultquery;
...
@@ -95,7 +95,7 @@ my $userdefaultquery;
if
(
$userid
)
{
if
(
$userid
)
{
$userdefaultquery
=
$dbh
->
selectrow_array
(
$userdefaultquery
=
$dbh
->
selectrow_array
(
"SELECT query FROM namedqueries "
.
"SELECT query FROM namedqueries "
.
"WHERE userid = ? AND name = ?"
,
"WHERE userid = ? AND name = ?"
,
undef
,
(
$userid
,
DEFAULT_QUERY_NAME
));
undef
,
(
$userid
,
DEFAULT_QUERY_NAME
));
}
}
...
@@ -128,7 +128,7 @@ sub PrefillForm {
...
@@ -128,7 +128,7 @@ sub PrefillForm {
next
if
grep
{
$_
eq
$name
}
@skip
;
next
if
grep
{
$_
eq
$name
}
@skip
;
$foundone
=
1
;
$foundone
=
1
;
my
@values
=
$buf
->
param
(
$name
);
my
@values
=
$buf
->
param
(
$name
);
# If the name is a single letter followed by numbers, it's part
# If the name is a single letter followed by numbers, it's part
# of Custom Search. We store these as an array of hashes.
# of Custom Search. We store these as an array of hashes.
if
(
$name
=~
/^([[:lower:]])(\d+)$/
)
{
if
(
$name
=~
/^([[:lower:]])(\d+)$/
)
{
...
@@ -158,9 +158,9 @@ if (!PrefillForm($buffer)) {
...
@@ -158,9 +158,9 @@ if (!PrefillForm($buffer)) {
}
}
}
}
# if using groups for entry, then we don't want people to see products they
# if using groups for entry, then we don't want people to see products they
# don't have access to. Remove them from the list.
# don't have access to. Remove them from the list.
my
@selectable_products
=
sort
{
lc
(
$a
->
name
)
cmp
lc
(
$b
->
name
)}
my
@selectable_products
=
sort
{
lc
(
$a
->
name
)
cmp
lc
(
$b
->
name
)}
@
{
$user
->
get_selectable_products
};
@
{
$user
->
get_selectable_products
};
Bugzilla::Product::
preload
(
\
@selectable_products
);
Bugzilla::Product::
preload
(
\
@selectable_products
);
$vars
->
{
'product'
}
=
\
@selectable_products
;
$vars
->
{
'product'
}
=
\
@selectable_products
;
...
@@ -297,10 +297,12 @@ if (defined($vars->{'format'}) && IsValidQueryType($vars->{'format'})) {
...
@@ -297,10 +297,12 @@ if (defined($vars->{'format'}) && IsValidQueryType($vars->{'format'})) {
# If we submit back to ourselves (for e.g. boolean charts), we need to
# If we submit back to ourselves (for e.g. boolean charts), we need to
# preserve format information; hence query_format taking priority over
# preserve format information; hence query_format taking priority over
# format.
# format.
my
$format
=
$template
->
get_format
(
"search/search"
,
my
$format
=
$template
->
get_format
(
"search/search"
,
$vars
->
{
'query_format'
}
||
$vars
->
{
'format'
},
$vars
->
{
'query_format'
}
||
$vars
->
{
'format'
},
scalar
$cgi
->
param
(
'ctype'
));
scalar
$cgi
->
param
(
'ctype'
));
Bugzilla::Hook::
process
(
"query_format"
,
{
'vars'
=>
$vars
,
'format'
=>
$format
});
print
$cgi
->
header
(
$format
->
{
'ctype'
});
print
$cgi
->
header
(
$format
->
{
'ctype'
});
$template
->
process
(
$format
->
{
'template'
},
$vars
)
$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