53
our %params;
53
our %params;
54
# Load in the param definitions
54
# Load in the param definitions
55
sub _load_params {
55
sub _load_params {
56
foreach my $module (param_panels()) {
56
my $panels = param_panels();
57
eval("require Bugzilla::Config::$module") || die $@;
57
foreach my $panel (keys %$panels) {
58
my @new_param_list = "Bugzilla::Config::$module"->get_param_list();
58
my $module = $panels->{$panel};
59
eval("require $module") || die $@;
60
my @new_param_list = "$module"->get_param_list();
59
foreach my $item (@new_param_list) {
61
foreach my $item (@new_param_list) {
60
$params{$item->{'name'}} = $item;
62
$params{$item->{'name'}} = $item;
67
# Subroutines go here
69
# Subroutines go here
69
sub param_panels {
71
sub param_panels {
70
my @param_panels;
72
my $param_panels = {};
71
my $libpath = bz_locations()->{'libpath'};
73
my $libpath = bz_locations()->{'libpath'};
72
foreach my $item ((glob "$libpath/Bugzilla/Config/*.pm")) {
74
foreach my $item ((glob "$libpath/Bugzilla/Config/*.pm")) {
73
$item =~ m#/([^/]+)\.pm$#;
75
$item =~ m#/([^/]+)\.pm$#;
74
my $module = $1;
76
my $module = $1;
75
push(@param_panels, $module) unless $module eq 'Common';
77
$param_panels->{$module} = "Bugzilla::Config::$module" unless $module eq 'Common';
77
return @param_panels;
79
# Now check for any hooked params
80
Bugzilla::Hook::process('config', { config => $param_panels });
80
sub SetParam {
84
sub SetParam {
29
use Bugzilla::Constants;
29
use Bugzilla::Constants;
30
use Bugzilla::Config qw(:admin);
30
use Bugzilla::Config qw(:admin);
31
use Bugzilla::Config::Common;
31
use Bugzilla::Config::Common;
32
use Bugzilla::Util;
33
use Bugzilla::Util;
33
use Bugzilla::Error;
34
use Bugzilla::Error;
34
use Bugzilla::Token;
35
use Bugzilla::Token;
57
my $current_module;
58
my $current_module;
58
my @panels = ();
59
my @panels = ();
59
foreach my $panel (Bugzilla::Config::param_panels()) {
60
my $param_panels = Bugzilla::Config::param_panels();
60
eval("require Bugzilla::Config::$panel") || die $@;
61
foreach my $panel (keys %$param_panels) {
61
my @module_param_list = "Bugzilla::Config::${panel}"->get_param_list(1);
62
my $module = $param_panels->{$panel};
63
eval("require $module") || die $@;
64
my @module_param_list = "$module"->get_param_list(1);
62
my $item = { name => lc($panel),
65
my $item = { name => lc($panel),
63
current => ($current_panel eq lc($panel)) ? 1 : 0,
66
current => ($current_panel eq lc($panel)) ? 1 : 0,
64
param_list => \@module_param_list,
67
param_list => \@module_param_list,
65
sortkey => eval "\$Bugzilla::Config::${panel}::sortkey;"
68
sortkey => eval "\$${module}::sortkey;"
67
push(@panels, $item);
70
push(@panels, $item);
68
$current_module = $panel if ($current_panel eq lc($panel));
71
$current_module = $panel if ($current_panel eq lc($panel));
73
if ($action eq 'save' && $current_module) {
76
if ($action eq 'save' && $current_module) {
74
check_token_data($token, 'edit_parameters');
77
check_token_data($token, 'edit_parameters');
75
my @changes = ();
78
my @changes = ();
76
my @module_param_list = "Bugzilla::Config::${current_module}"->get_param_list(1);
79
my @module_param_list = "$param_panels->{$current_module}"->get_param_list(1);
78
foreach my $i (@module_param_list) {
81
foreach my $i (@module_param_list) {
79
my $name = $i->{'name'};
82
my $name = $i->{'name'};