Closed Bug 1261679 Opened 9 years ago Closed 9 years ago

Add more examples about how to define new parameters using the config_add_panels hook

Categories

(Bugzilla :: Extensions, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 6.0

People

(Reporter: LpSolit, Assigned: LpSolit)

Details

Attachments

(1 file, 1 obsolete file)

Bugzilla supports 7 different types for parameters, but only the most trivial type is used in the Example extension. Each of the types should be described. This would also let us check that they all work as expected.
Attached patch patch, v1 (obsolete) — Splinter Review
Someone will have to explain to me why default values for type 'o' have to be a concatenated string instead of an arrayref. This prevents these values to contain a comma. :( But the goal of this patch is to reflect how things currently work, not to break how parameters are stored in data/params.json.
Attachment #8737606 - Flags: review?(gerv)
Comment on attachment 8737606 [details] [diff] [review] patch, v1 Review of attachment 8737606 [details] [diff] [review]: ----------------------------------------------------------------- r-, but fix these and r+ will follow swiftly. Gerv ::: extensions/Example/lib/Config.pm @@ +24,5 @@ > type => 't', > + default => 'Bugzilla is powerful' > + }, > + { > + name => 'example_constraigned_string', "constrained" @@ +37,5 @@ > + default => '905', > + checker => \&check_numeric > + }, > + { > + name => 'example_pwd', Call it "example_password" to be clear. @@ +75,1 @@ > }, I think you need a comment here to explain the difference between the last two, even if it's explained elsewhere. You are right that the default should be an array! ::: extensions/Example/template/en/default/admin/params/example.html.tmpl @@ +11,5 @@ > %] > > [% param_descs = { > + example_string => "This parameter accepts any string. (type t)", > + example_constraigned_string => "This parameter accepts only a string of the form " _ "constrained" @@ +16,5 @@ > + "NN-XXXX-N, where N is a digit and X a letter.", > + example_number => "This parameter accepts only a positive integer.", > + example_pwd => "Text with all characters replaced by asterisks for " _ > + "security purposes. (type p)", > + example_multi_lines => "Multi-lines text is allowed. (type l)", "Text field permitting multiple lines of text. (type l)" Although actually, above we talk about "string" and here we talk about "text". We should use one or the other. @@ +17,5 @@ > + example_number => "This parameter accepts only a positive integer.", > + example_pwd => "Text with all characters replaced by asterisks for " _ > + "security purposes. (type p)", > + example_multi_lines => "Multi-lines text is allowed. (type l)", > + example_boolean => "You have only two choices: On or Off. (type b)", You should note that the actual values are 1 and 0. @@ +18,5 @@ > + example_pwd => "Text with all characters replaced by asterisks for " _ > + "security purposes. (type p)", > + example_multi_lines => "Multi-lines text is allowed. (type l)", > + example_boolean => "You have only two choices: On or Off. (type b)", > + example_single_select => "Only one value can be selected. (type s)", "Select a single value from a list" @@ +19,5 @@ > + "security purposes. (type p)", > + example_multi_lines => "Multi-lines text is allowed. (type l)", > + example_boolean => "You have only two choices: On or Off. (type b)", > + example_single_select => "Only one value can be selected. (type s)", > + example_multi_select => "You can select none, one or several options. (type m)", "Select none, one or several values from a list."
Attachment #8737606 - Flags: review?(gerv) → review+
Attached patch patch, v2Splinter Review
Attachment #8737606 - Attachment is obsolete: true
Attachment #8739612 - Flags: review?(gerv)
Comment on attachment 8739612 [details] [diff] [review] patch, v2 Review of attachment 8739612 [details] [diff] [review]: ----------------------------------------------------------------- Excellent. Gerv
Attachment #8739612 - Flags: review?(gerv) → review+
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git 90d86a9..06654a4 master -> master
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: