From 99bec2e52b174c1e8774ebf12da5963330d47af9 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 11 Aug 2015 23:16:38 +0800 Subject: Bug 1160929 - add support for storing attachments in s3 --- editparams.cgi | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'editparams.cgi') diff --git a/editparams.cgi b/editparams.cgi index 28aac9602..8eb117a26 100755 --- a/editparams.cgi +++ b/editparams.cgi @@ -61,13 +61,15 @@ 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(); - my $item = { name => lc($panel), - current => ($current_panel eq lc($panel)) ? 1 : 0, - param_list => \@module_param_list, - sortkey => eval "\$${module}::sortkey;" - }; - defined($item->{'sortkey'}) || ($item->{'sortkey'} = 100000); + my @module_param_list = $module->get_param_list(); + my $item = { + name => lc($panel), + current => ($current_panel eq lc($panel)) ? 1 : 0, + param_list => \@module_param_list, + sortkey => eval "\$${module}::sortkey;", + module => $module, + }; + $item->{sortkey} //= 100000; push(@panels, $item); $current_module = $panel if ($current_panel eq lc($panel)); } @@ -84,6 +86,7 @@ if ($action eq 'save' && $current_module) { my @changes = (); my @module_param_list = @{ $hook_panels{lc($current_module)}->{params} }; + my $any_changed = 0; foreach my $i (@module_param_list) { my $name = $i->{'name'}; my $value = $cgi->param($name); @@ -151,6 +154,21 @@ if ($action eq 'save' && $current_module) { if ($name eq 'duplicate_or_move_bug_status') { Bugzilla::Status::add_missing_bug_status_transitions($value); } + $any_changed = 1; + } + } + + # allow panels to check inter-dependent params + if ($any_changed) { + foreach my $panel (@panels) { + next unless $panel->{name} eq lc($current_module); + my $module = $panel->{module}; + next unless $module->can('check_params'); + my $err = $module->check_params(Bugzilla->params); + if ($err ne '') { + ThrowUserError('invalid_parameters', { err => $err }); + } + last; } } -- cgit v1.2.3-24-g4f1b