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
183719ad
Commit
183719ad
authored
May 06, 2008
by
bbaetz%acm.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 430909 - add hook for parameters
r=mkanat, r/a=lpsolit
parent
82361875
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
113 additions
and
11 deletions
+113
-11
Config.pm
Bugzilla/Config.pm
+10
-6
editparams.cgi
editparams.cgi
+8
-5
config.pl
extensions/example/code/config.pl
+26
-0
ConfigExample.pm
extensions/example/lib/ConfigExample.pm
+41
-0
example.html.tmpl
...xample/template/en/default/admin/params/example.html.tmpl
+28
-0
No files found.
Bugzilla/Config.pm
View file @
183719ad
...
...
@@ -53,9 +53,11 @@ use vars qw(@param_list);
our
%
params
;
# Load in the param definitions
sub
_load_params
{
foreach
my
$module
(
param_panels
())
{
eval
(
"require Bugzilla::Config::$module"
)
||
die
$@
;
my
@new_param_list
=
"Bugzilla::Config::$module"
->
get_param_list
();
my
$panels
=
param_panels
();
foreach
my
$panel
(
keys
%
$panels
)
{
my
$module
=
$panels
->
{
$panel
};
eval
(
"require $module"
)
||
die
$@
;
my
@new_param_list
=
"$module"
->
get_param_list
();
foreach
my
$item
(
@new_param_list
)
{
$params
{
$item
->
{
'name'
}}
=
$item
;
}
...
...
@@ -67,14 +69,16 @@ sub _load_params {
# Subroutines go here
sub
param_panels
{
my
@param_panels
;
my
$param_panels
=
{}
;
my
$libpath
=
bz_locations
()
->
{
'libpath'
};
foreach
my
$item
((
glob
"$libpath/Bugzilla/Config/*.pm"
))
{
$item
=~
m
#/([^/]+)\.pm$#;
my
$module
=
$1
;
push
(
@param_panels
,
$module
)
unless
$module
eq
'Common'
;
$param_panels
->
{
$module
}
=
"Bugzilla::Config::$module"
unless
$module
eq
'Common'
;
}
return
@param_panels
;
# Now check for any hooked params
Bugzilla::Hook::
process
(
'config'
,
{
config
=>
$param_panels
});
return
$param_panels
;
}
sub
SetParam
{
...
...
editparams.cgi
View file @
183719ad
...
...
@@ -29,6 +29,7 @@ use Bugzilla;
use
Bugzilla::
Constants
;
use
Bugzilla::
Config
qw(:admin)
;
use
Bugzilla::Config::
Common
;
use
Bugzilla::
Hook
;
use
Bugzilla::
Util
;
use
Bugzilla::
Error
;
use
Bugzilla::
Token
;
...
...
@@ -56,13 +57,15 @@ $current_panel = $1;
my
$current_module
;
my
@panels
=
();
foreach
my
$panel
(
Bugzilla::Config::
param_panels
())
{
eval
(
"require Bugzilla::Config::$panel"
)
||
die
$@
;
my
@module_param_list
=
"Bugzilla::Config::${panel}"
->
get_param_list
(
1
);
my
$param_panels
=
Bugzilla::Config::
param_panels
();
foreach
my
$panel
(
keys
%
$param_panels
)
{
my
$module
=
$param_panels
->
{
$panel
};
eval
(
"require $module"
)
||
die
$@
;
my
@module_param_list
=
"$module"
->
get_param_list
(
1
);
my
$item
=
{
name
=>
lc
(
$panel
),
current
=>
(
$current_panel
eq
lc
(
$panel
))
?
1
:
0
,
param_list
=>
\
@module_param_list
,
sortkey
=>
eval
"\$
Bugzilla::Config::${panel
}::sortkey;"
sortkey
=>
eval
"\$
${module
}::sortkey;"
};
push
(
@panels
,
$item
);
$current_module
=
$panel
if
(
$current_panel
eq
lc
(
$panel
));
...
...
@@ -73,7 +76,7 @@ $vars->{panels} = \@panels;
if
(
$action
eq
'save'
&&
$current_module
)
{
check_token_data
(
$token
,
'edit_parameters'
);
my
@changes
=
();
my
@module_param_list
=
"
Bugzilla::Config::${
current_module}"
->
get_param_list
(
1
);
my
@module_param_list
=
"
$param_panels->{$
current_module}"
->
get_param_list
(
1
);
foreach
my
$i
(
@module_param_list
)
{
my
$name
=
$i
->
{
'name'
};
...
...
extensions/example/code/config.pl
0 → 100644
View file @
183719ad
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Example Plugin.
#
# The Initial Developer of the Original Code is Canonical Ltd.
# Portions created by Canonical Ltd. are Copyright (C) 2008
# Canonical Ltd. All Rights Reserved.
#
# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org>
# Bradley Baetz <bbaetz@acm.org>
use
strict
;
use
warnings
;
use
Bugzilla
;
my
$config
=
Bugzilla
->
hook_args
->
{
config
};
$config
->
{
Example
}
=
"extensions::example::lib::ConfigExample"
;
extensions/example/lib/ConfigExample.pm
0 → 100644
View file @
183719ad
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Example Plugin.
#
# The Initial Developer of the Original Code is Canonical Ltd.
# Portions created by Canonical Ltd. are Copyright (C) 2008
# Canonical Ltd. All Rights Reserved.
#
# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org>
# Bradley Baetz <bbaetz@acm.org>
package
extensions::example::lib::
ConfigExample
;
use
strict
;
use
warnings
;
use
Bugzilla::Config::
Common
;
sub
get_param_list
{
my
(
$class
)
=
@_
;
my
@param_list
=
(
{
name
=>
'example_string'
,
type
=>
't'
,
default
=>
'EXAMPLE'
,
},
);
return
@param_list
;
}
1
;
extensions/example/template/en/default/admin/params/example.html.tmpl
0 → 100644
View file @
183719ad
[%#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Example Plugin.
#
# The Initial Developer of the Original Code is Canonical Ltd.
# Portions created by Canonical Ltd. are Copyright (C) 2008
# Canonical Ltd. All Rights Reserved.
#
# Contributor(s): Bradley Baetz <bbaetz@acm.org>
#%]
[%
title = "Example Extension"
desc = "Configure example extension"
%]
[% param_descs = {
example_string => "Example string",
}
%]
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