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
06654a46
Commit
06654a46
authored
Apr 15, 2016
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1261679 - Add more examples about how to define new parameters using the config_add_panels hook
r=gerv
parent
90d86a97
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
7 deletions
+70
-7
Common.pm
Bugzilla/Config/Common.pm
+7
-5
Config.pm
extensions/Example/lib/Config.pm
+52
-1
example.html.tmpl
...xample/template/en/default/admin/params/example.html.tmpl
+11
-1
No files found.
Bugzilla/Config/Common.pm
View file @
06654a46
...
...
@@ -401,11 +401,6 @@ sub check_comment_taggers_group {
# &check_multi should always be used as the param verification function
# for list (single and multiple) parameter types.
#
# o -- A list of values, orderable, and with many selectable (shows up as a
# JavaScript-enhanced select box if JavaScript is enabled, and a text
# entry field if not)
# Set up in the same way as type m.
#
# s -- A list of values, with one selectable (shows up as a select box)
# To specify the list of values, make the 'choices' key be an array
# reference of the valid choices. The 'default' key should be one of
...
...
@@ -424,6 +419,13 @@ sub check_comment_taggers_group {
#
# &check_multi should always be used as the param verification function
# for list (single and multiple) parameter types.
#
# o -- A list of values, orderable, and with many selectable (shows up as a
# JavaScript-enhanced select box if JavaScript is enabled, and a text
# entry field if not)
# Set up in the same way as type s. If the default has multiple values,
# then they must be concatenated, separated by a comma.
# For instance: default => 'a,c'.
sub
get_param_list
{
return
;
...
...
extensions/Example/lib/Config.pm
View file @
06654a46
...
...
@@ -22,7 +22,58 @@ sub get_param_list {
{
name
=>
'example_string'
,
type
=>
't'
,
default
=>
'EXAMPLE'
,
default
=>
'Bugzilla is powerful'
},
{
name
=>
'example_constrained_string'
,
type
=>
't'
,
default
=>
'12-xfdd-5'
,
checker
=>
sub
{
$_
[
0
]
=~
/^\d{2}\-[a-zA-Z]{4}\-\d$/
?
''
:
"$_[0] must be of the form NN-XXXX-N"
;
}
},
{
name
=>
'example_number'
,
type
=>
't'
,
default
=>
'905'
,
checker
=>
\&
check_numeric
},
{
name
=>
'example_password'
,
type
=>
'p'
,
default
=>
'1234'
},
{
name
=>
'example_multi_lines'
,
type
=>
'l'
,
default
=>
"This text can be very long.\n\nVery very long!"
},
# Default can only be 0 or 1.
{
name
=>
'example_boolean'
,
type
=>
'b'
,
default
=>
0
},
{
name
=>
'example_single_select'
,
type
=>
's'
,
choices
=>
[
'Monday'
,
'Tuesday'
,
'Wednesday'
,
'Thursday'
,
'Friday'
],
default
=>
'Thursday'
,
checker
=>
\&
check_multi
},
{
name
=>
'example_multi_select'
,
type
=>
'm'
,
choices
=>
[
'Mercury'
,
'Venus'
,
'Mars'
,
'Jupiter'
,
'Saturn'
],
default
=>
[
'Venus'
,
'Saturn'
],
checker
=>
\&
check_multi
},
# This one lets you order selected items.
{
name
=>
'example_multi_ordered'
,
type
=>
'o'
,
choices
=>
[
'Perl'
,
'Python'
,
'PHP'
,
'C++'
,
'Java'
],
default
=>
'Perl,C++'
,
checker
=>
\&
check_multi
},
);
return
@param_list
;
...
...
extensions/Example/template/en/default/admin/params/example.html.tmpl
View file @
06654a46
...
...
@@ -11,6 +11,16 @@
%]
[% param_descs = {
example_string => "Example string",
example_string => "This parameter accepts any text. (type t)",
example_constrained_string => "This parameter accepts only a text of the form " _
"NN-XXXX-N, where N is a digit and X a letter.",
example_number => "This parameter accepts only a positive integer.",
example_password => "Text with all characters replaced by asterisks for " _
"security purposes. (type p)",
example_multi_lines => "Text field permitting multiple lines of text. (type l)",
example_boolean => "You have only two choices: On (1) or Off (0). (type b)",
example_single_select => "Select a single value from a list. (type s)",
example_multi_select => "Select none, one or several values from a list. (type m)",
example_multi_ordered => "Several values can be selected and ordered. (type o)",
}
%]
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