]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Document how to add user settings. r,a=mkanat.
authorGervase Markham <gerv@gerv.net>
Wed, 5 Jan 2011 16:59:59 +0000 (16:59 +0000)
committerGervase Markham <gerv@mozilla.org>
Wed, 5 Jan 2011 16:59:59 +0000 (16:59 +0000)
https://bugzilla.mozilla.org/show_bug.cgi?id=616427

Bugzilla/Extension.pm
extensions/Example/Extension.pm
extensions/Example/template/en/default/hook/global/setting-descs-settings.none.tmpl [new file with mode: 0644]

index c7688d90bcac34b18afb9bc9be434f8fe8b19378..857d0d75b8a9924e1b1226db910ebec252380116 100644 (file)
@@ -272,7 +272,8 @@ This is the base class for all Bugzilla extensions.
 
 The L</SYNOPSIS> above gives a pretty good overview of what's basically
 required to write an extension. This section gives more information
-on exactly how extensions work and how you write them.
+on exactly how extensions work and how you write them. There is also a 
+L<wiki page|https://wiki.mozilla.org/Bugzilla:Extension_Notes> with additional HOWTOs, tips and tricks.
 
 =head2 Using F<extensions/create.pl>
 
index 4d379cb30160a1d21add0632b9dad356929f9f7c..0e4cf0d520bb30825c205651405d2d19387a17b9 100644 (file)
@@ -28,6 +28,7 @@ use Bugzilla::Constants;
 use Bugzilla::Error;
 use Bugzilla::Group;
 use Bugzilla::User;
+use Bugzilla::User::Setting;
 use Bugzilla::Util qw(diff_arrays html_quote);
 use Bugzilla::Status qw(is_open_state);
 
@@ -387,6 +388,16 @@ sub group_end_of_update {
 sub install_before_final_checks {
     my ($self, $args) = @_;
     print "Install-before_final_checks hook\n" unless $args->{silent};
+    
+    # Add a new user setting like this:
+    #
+    # add_setting('product_chooser',           # setting name
+    #             ['pretty', 'full', 'small'], # options
+    #             'pretty');                   # default
+    #
+    # To add descriptions for the setting and choices, add extra values to 
+    # the hash defined in global/setting-descs.none.tmpl. Do this in a hook: 
+    # hook/global/setting-descs-settings.none.tmpl .
 }
 
 sub mailer_before_send {
diff --git a/extensions/Example/template/en/default/hook/global/setting-descs-settings.none.tmpl b/extensions/Example/template/en/default/hook/global/setting-descs-settings.none.tmpl
new file mode 100644 (file)
index 0000000..9dc5fc7
--- /dev/null
@@ -0,0 +1,6 @@
+[% 
+    setting_descs.product_chooser = "Product chooser to use when entering $terms.bugs",
+    setting_descs.pretty = "Pretty chooser with common products and icons",
+    setting_descs.full   = "Full chooser with all products",
+    setting_descs.small  = "Product chooser for mobile devices",
+%]
\ No newline at end of file