From bc43a9910a364cbac0d46d8b787d857870674436 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Fri, 4 Apr 2008 11:47:37 +0000 Subject: Bug 76507: Replace "owner" by "assignee" (and "initial" by "default") - Patch by Tiago R. Mello r=LpSolit a=myk --- docs/en/xml/customization.xml | 371 ++++++++++++++++++++++++++++-------------- 1 file changed, 249 insertions(+), 122 deletions(-) (limited to 'docs/en/xml/customization.xml') diff --git a/docs/en/xml/customization.xml b/docs/en/xml/customization.xml index 67877f9ca..1eef16673 100644 --- a/docs/en/xml/customization.xml +++ b/docs/en/xml/customization.xml @@ -18,45 +18,78 @@ . -
- What to Edit +
+ Template Directory Structure - The template directory structure is that there's a top level directory, - template, which contains a directory for - each installed localization. The default English templates are - therefore in en. Underneath that, there - is the default directory and optionally the - custom directory. The default - directory contains all the templates shipped with Bugzilla, whereas - the custom directory does not exist at first and - must be created if you want to use it. + The template directory structure starts with top level directory + named template, which contains a directory + for each installed localization. The next level defines the + language used in the templates. Bugzilla comes with English + templates, so the directory name is en, + and we will discuss template/en throughout + the documentation. Below template/en is the + default directory, which contains all the + standard templates shipped with Bugzilla. + + + A directory data/templates also exists; + this is where Template Toolkit puts the compiled versions of + the templates from either the default or custom directories. + Do not directly edit the files in this + directory, or all your changes will be lost the next time + Template Toolkit recompiles the templates. + + +
+ +
+ Choosing a Customization Method + + If you want to edit Bugzilla's templates, the first decision + you must make is how you want to go about doing so. There are two + choices, and which you use depends mainly on the scope of your + modifications, and the method you plan to use to upgrade Bugzilla. + + - There are two different ways of editing Bugzilla's templates, - and which you use depends mainly on the method you plan to use to - upgrade Bugzilla. The first method of making customizations is to directly edit the - templates in template/en/default. This is - probably the best method for small changes if you are going to use - the CVS method of upgrading, because if you then execute a - cvs update, any template fixes will get - automagically merged into your modified versions. + templates found in template/en/default. + This is probably the best way to go about it if you are going to + be upgrading Bugzilla through CVS, because if you then execute + a cvs update, any changes you have made will + be merged automagically with the updated versions. + + + If you use this method, and CVS conflicts occur during an + update, the conflicted templates (and possibly other parts + of your installation) will not work until they are resolved. + + + - If you use this method, your installation will break if CVS conflicts - occur. + The second method is to copy the templates to be modified + into a mirrored directory structure under + template/en/custom. Templates in this + directory structure automatically override any identically-named + and identically-located templates in the + default directory. + + + The custom directory does not exist + at first and must be created if you want to use it. + + + - The other method is to copy the templates to be modified into a - mirrored directory - structure under template/en/custom. The templates - in this directory automatically override those in default. - This is the technique you - need to use if you use the overwriting method of upgrade, because - otherwise your changes will be lost. This method is also better if + The second method of customization should be used if you + use the overwriting method of upgrade, because otherwise + your changes will be lost. This method may also be better if you are using the CVS method of upgrading and are going to make major changes, because it is guaranteed that the contents of this directory will not be touched during an upgrade, and you can then decide whether @@ -65,9 +98,9 @@ - If you use this method, your installation may break if incompatible - changes are made to the template interface. If such changes are made - they will be documented in the release notes, provided you are using a + Using this method, your installation may break if incompatible + changes are made to the template interface. Such changes should + be documented in the release notes, provided you are using a stable release of Bugzilla. If you use using unstable code, you will need to deal with this one yourself, although if possible the changes will be mentioned before they occur in the deprecations section of the @@ -76,21 +109,25 @@ - Don't directly edit the compiled templates in - data/template/* - your - changes will be lost when Template Toolkit recompiles them. + Regardless of which method you choose, it is recommended that + you run ./checksetup.pl after creating or + editing any templates in the template/en/default + directory, and after editing any templates in the + custom directory. - - It is recommended that you run ./checksetup.pl - after any template edits, especially if you've created a new file in - the custom directory. + + + It is required that you run + ./checksetup.pl after creating a new + template in the custom directory. Failure + to do so will raise an incomprehensible error message. - +
-
+
How To Edit Templates @@ -98,7 +135,7 @@ If you are making template changes that you intend on submitting back for inclusion in standard Bugzilla, you should read the relevant sections of the - Developers' + Developers' Guide. @@ -132,9 +169,11 @@ - Editing templates is a good way of doing a "poor man's custom fields". + Editing templates is a good way of doing a poor man's custom + fields. For example, if you don't use the Status Whiteboard, but want to have - a free-form text entry box for "Build Identifier", then you can just + a free-form text entry box for Build Identifier, + then you can just edit the templates to change the field labels. It's still be called status_whiteboard internally, but your users don't need to know that. @@ -142,22 +181,29 @@
-
- Template Formats +
+ Template Formats and Types - Some CGIs have the ability to use more than one template. For - example, buglist.cgi can output bug lists as RDF or two - different forms of HTML (complex and simple). (Try this out - by appending &format=simple to a buglist.cgi - URL on your Bugzilla installation.) This - mechanism, called template 'formats', is extensible. + Some CGI's have the ability to use more than one template. For example, + buglist.cgi can output itself as RDF, or as two + formats of HTML (complex and simple). The mechanism that provides this + feature is extensible. + + + + Bugzilla can support different types of output, which again can have + multiple formats. In order to request a certain type, you can append + the &ctype=<contenttype> (such as rdf or html) to the + <cginame>.cgi URL. If you would like to + retrieve a certain format, you can use the &format=<format> + (such as simple or complex) in the URL. - To see if a CGI supports multiple output formats, grep the - CGI for "GetFormat". If it's not present, adding - multiple format support isn't too hard - see how it's done in + To see if a CGI supports multiple output formats and types, grep the + CGI for GetFormat. If it's not present, adding + multiple format/type support isn't too hard - see how it's done in other CGIs, e.g. config.cgi. @@ -176,22 +222,32 @@ You now need to decide what content type you want your template - served as. Open up the localconfig file and find the - $contenttypes - variable. If your content type is not there, add it. Remember - the three- or four-letter tag assigned to you content type. + served as. The content types are defined in the + Bugzilla/Constants.pm file in the + contenttypes + constant. If your content type is not there, add it. Remember + the three- or four-letter tag assigned to your content type. This tag will be part of the template filename. + + + + After adding or changing a content type, it's suitable to edit + Bugzilla/Constants.pm in order to reflect + the changes. Also, the file should be kept up to date after an + upgrade if content types have been customized in the past. + + Save the template as <stubname>-<formatname>.<contenttypetag>.tmpl. Try out the template by calling the CGI as - <cginame>.cgi?format=<formatname> . + <cginame>.cgi?format=<formatname>&ctype=<type> .
-
+
Particular Templates @@ -215,7 +271,8 @@ global/banner.html.tmpl: - This contains the "banner", the part of the header that appears + This contains the banner, the part of the header + that appears at the top of all Bugzilla pages. The default banner is reasonably barren, so you'll probably want to customize this to give your installation a distinctive look and feel. It is recommended you @@ -230,6 +287,26 @@ your Bugzilla installation. + + global/variables.none.tmpl: + This defines a list of terms that may be changed in order to + brand the Bugzilla instance In this way, terms + like bugs can be replaced with issues + across the whole Bugzilla installation. The name + Bugzilla and other words can be customized as well. + + + + list/table.html.tmpl: + This template controls the appearance of the bug lists created + by Bugzilla. Editing this template allows per-column control of + the width and title of a column, the maximum display length of + each entry, and the wrap behaviour of long entries. + For long bug lists, Bugzilla inserts a 'break' every 100 bugs by + default; this behaviour is also controlled by this template, and + that value can be modified here. + + bug/create/user-message.html.tmpl: This is a message that appears near the top of the bug reporting page. @@ -237,51 +314,79 @@ bugs. + + bug/process/midair.html.tmpl: + This is the page used if two people submit simultaneous changes to the + same bug. The second person to submit their changes will get this page + to tell them what the first person did, and ask if they wish to + overwrite those changes or go back and revisit the bug. The default + title and header on this page read "Mid-air collision detected!" If + you work in the aviation industry, or other environment where this + might be found offensive (yes, we have true stories of this happening) + you'll want to change this to something more appropriate for your + environment. + + bug/create/create.html.tmpl and bug/create/comment.txt.tmpl: - You may wish to get bug submitters to give certain bits of structured - information, each in a separate input widget, for which there is not a - field in the database. The bug entry system has been designed in an - extensible fashion to enable you to define arbitrary fields and widgets, - and have their values appear formatted in the initial - Description, rather than in database fields. An example of this - is the mozilla.org - guided - bug submission form. - - - - To make this work, create a custom template for - enter_bug.cgi (the default template, on which you - could base it, is create.html.tmpl), - and either call it create.html.tmpl or use a format and - call it create-<formatname>.html.tmpl. - Put it in the custom/bug/create - directory. In it, add widgets for each piece of information you'd like + You may not wish to go to the effort of creating custom fields in + Bugzilla, yet you want to make sure that each bug report contains + a number of pieces of important information for which there is not + a special field. The bug entry system has been designed in an + extensible fashion to enable you to add arbitrary HTML widgets, + such as drop-down lists or textboxes, to the bug entry page + and have their values appear formatted in the initial comment. + A hidden field that indicates the format should be added inside + the form in order to make the template functional. Its value should + be the suffix of the template filename. For example, if the file + is called create-cust.html.tmpl, then + <input type="hidden" name="format" value="cust"> + should be used inside the form. + + + + An example of this is the mozilla.org + guided + bug submission form. The code for this comes with the Bugzilla + distribution as an example for you to copy. It can be found in the + files + create-guided.html.tmpl and + comment-guided.html.tmpl. + + + + So to use this feature, create a custom template for + enter_bug.cgi. The default template, on which you + could base it, is + custom/bug/create/create.html.tmpl. + Call it create-<formatname>.html.tmpl, and + in it, add widgets for each piece of information you'd like collected - such as a build number, or set of steps to reproduce. Then, create a template like - custom/bug/create/comment.txt.tmpl, also named - after your format if you are using one, which - references the form fields you have created. When a bug report is + custom/bug/create/comment.txt.tmpl, and call it + comment-<formatname>.txt.tmpl. This + template should reference the form fields you have created using + the syntax [% form.<fieldname> %]. When a + bug report is submitted, the initial comment attached to the bug report will be formatted according to the layout of this template. - For example, if your enter_bug template had a field + For example, if your custom enter_bug template had a field <input type="text" name="buildid" size="30"> and then your comment.txt.tmpl had BuildID: [% form.buildid %] - then + then something like BuildID: 20020303 - would appear in the initial checkin comment. - + would appear in the initial comment. +
- +
Configuring Bugzilla to Detect the User's Language @@ -308,6 +413,15 @@
Template Hooks + + + Template Hooks require Template Toolkit version 2.12 or + above, or the application of a patch. See bug + 239112 for details. + + + Template hooks are a way for extensions to Bugzilla to insert code into the standard Bugzilla templates without modifying the template files @@ -541,17 +655,17 @@ allowed to do what. The relevant function is called CheckCanChangeField(), and is found in process_bug.cgi in your - Bugzilla directory. If you open that file and grep for - "sub CheckCanChangeField", you'll find it. + Bugzilla directory. If you open that file and search for + sub CheckCanChangeField, you'll find it. This function has been carefully commented to allow you to see exactly - how it works, and give you an idea of how to make changes to it. Certain - marked sections should not be changed - these are the "plumbing" which - makes the rest of the function work. In between those sections, you'll - find snippets of code like: - # Allow the owner to change anything. + how it works, and give you an idea of how to make changes to it. + Certain marked sections should not be changed - these are + the plumbing which makes the rest of the function work. + In between those sections, you'll find snippets of code like: + # Allow the assignee to change anything. if ($ownerid eq $whoid) { return 1; } @@ -560,11 +674,11 @@ So, how does one go about changing this function? Well, simple changes - can be made just be removing pieces - for example, if you wanted to + can be made just by removing pieces - for example, if you wanted to prevent any user adding a comment to a bug, just remove the lines marked - "Allow anyone to change comments." And if you want the reporter to have - no special rights on bugs they have filed, just remove the entire section - which refers to him. + Allow anyone to change comments. If you don't want the + Reporter to have any special rights on bugs they have filed, just + remove the entire section that deals with the Reporter. @@ -583,8 +697,12 @@ } } This says that only users in the group "quality_assurance" can change - the QA Contact field of a bug. Getting more weird: - if (($field eq "priority") && + the QA Contact field of a bug. + + + + Getting more weird: + user->email =~ /.*\@example\.com$/)) { if ($oldvalue eq "P1") { @@ -593,11 +711,20 @@ else { return 0; } - } + }]]> This says that if the user is trying to change the priority field, and their email address is @example.com, they can only do so if the old value of the field was "P1". Not very useful, but illustrative. + + + + If you are modifying process_bug.cgi in any + way, do not change the code that is bounded by DO_NOT_CHANGE blocks. + Doing so could compromise security, or cause your installation to + stop working entirely. + + For a list of possible field names, look in @@ -608,29 +735,29 @@
- Modifying Your Running System + Modifying Your Running System - Bugzilla optimizes database lookups by storing all relatively - static information in the - versioncache file, located in the - data/ - subdirectory under your installation directory. - - If you make a change to the structural data in your database (the - versions table for example), or to the - constants - - encoded in defparams.pl, you will need to remove - the cached content from the data directory (by doing a - rm data/versioncache + + Bugzilla optimizes database lookups by storing all relatively + static information in the versioncache + file, located in the data/ + subdirectory under your installation directory. + - ), or your changes won't show up. + + If you make a change to the structural data in your database (the + versions table for example), or to the constants + encoded in defparams.pl, you will need to remove + the cached content from the data directory (by doing a + rm data/versioncache), or your changes won't show up. + - versioncache - gets automatically regenerated whenever it's more than - an hour old, so Bugzilla will eventually notice your changes by itself, - but generally you want it to notice right away, so that you can test - things. + + versioncache gets regenerated automatically + whenever it's more than an hour old, so Bugzilla will eventually + notice your changes by itself, but generally you want it to notice + right away, so that you can test things. +
-- cgit v1.2.3-24-g4f1b