How templates hooks are suppose to work?

Tiago timello at gmail.com
Wed Sep 12 14:24:04 UTC 2007


Hi guys,

I'm experiencing some problems with Bugzilla template hooks.

Here are some points:

1. I cannot make it work as described in the documentation
(http://www.bugzilla.org/docs/tip/html/cust-hooks.html). It says the
templates for the hooks need to be located in
"BUGZILLA_ROOT/extensions/projman/template/en/hook/global/useful-links-edit.html.tmpl",
but it only works if we remove the hook directory from the structure
and looking at the code we really miss the 'hook' in the
Template::Plugin::Hook line:

....

my $extensiontemplate =
$subpath.'/'.$templatename.'-'.$hook_name.'.'.$type.'.tmpl';
my @extensions = glob(bz_locations()->{'extensionsdir'} . "/*");
my @usedlanguages = getLanguages();
foreach my $extension (@extensions) {
    foreach my $language (@usedlanguages) {
        my $file = $extension.'/template/'.$language.'/'.$extensiontemplate;
        if (-e $file) {
.....

Then, it expects something like:
BUGZILLA_ROOT/extensions/my_extension/template/en/global/useful-links-end.html.tmpl,
where 'end' is the name of the hook in the template
useful-links.html.tmpl.

2. If I use the structure in the
BUGZILLA_ROOT/template/en/extension/... the checksetup.pl complains
and show the error message:

file error - hook/global/useful-links.html.tmpl/end/foo.html.tmpl: not found

On this structure it only works if you put it in:
BUGZILLA_ROOT/template/en/default/hook/global/useful-links.html.tmpl/end/foo.html.tmpl
as well as in the custom directory.

My questions are:

1. How exactly the hooks for templates are suppose to work?
2. Why does the directory BUGZILLA_ROOT/template/en/extension exist?
Why checksetup.pl complains if we put something there?
3. Can you help me indentify the bugs we have here?

Thank you very much in advance,

Tiago - timello



More information about the developers mailing list