From b8f2c324a9a4133f264254d61993ff8c7e0233a2 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 12 Oct 2005 15:51:52 +0000 Subject: Bug 46296: Make editparams.cgi be multi-panel by category - Patch by Frédéric Buclin r=joel a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editparams.cgi | 179 ++++++++++++++++++++++++++------------------------------- 1 file changed, 82 insertions(+), 97 deletions(-) (limited to 'editparams.cgi') diff --git a/editparams.cgi b/editparams.cgi index 8924a0edc..4b1db455b 100755 --- a/editparams.cgi +++ b/editparams.cgi @@ -20,126 +20,111 @@ # # Contributor(s): Terry Weissman # J. Paul Reed - +# Frédéric Buclin use strict; use lib "."; use Bugzilla::Constants; -use Bugzilla::Config qw(:DEFAULT :admin); +use Bugzilla::Config qw(:DEFAULT :admin :params $datadir); require "globals.pl"; +use vars qw($vars @parampanels); my $user = Bugzilla->login(LOGIN_REQUIRED); - +my $cgi = Bugzilla->cgi; my $template = Bugzilla->template; -print Bugzilla->cgi->header(); +print $cgi->header(); $user->in_group('tweakparams') || ThrowUserError("auth_failure", {group => "tweakparams", action => "modify", object => "parameters"}); -$template->put_header("Edit parameters"); - -print "This lets you edit the basic operating parameters of bugzilla.\n"; -print "Be careful!\n"; -print "

\n"; -print "Any item you check Reset on will get reset to its default value.\n"; - -print "

\n"; - -my $rowbreak = ""; -print $rowbreak; - -foreach my $i (GetParamList()) { - my $name = $i->{'name'}; - my $value = Param($name); - print "\n"; - print "\n"; - print $rowbreak; -} - -print ""; - -print "

$name:$i->{'desc'}
Reset\n"; - SWITCH: for ($i->{'type'}) { - /^t$/ && do { - print "\n"; - last SWITCH; - }; - /^l$/ && do { - print "\n"; - last SWITCH; - }; - /^b$/ && do { - my $on; - my $off; - if ($value) { - $on = "checked"; - $off = ""; - } else { - $on = ""; - $off = "checked"; - } - print "On\n"; - print "Off\n"; - last SWITCH; - }; - /^m$/ && do { - my @choices = @{$i->{'choices'}}; - ## showing 5 options seems like a nice round number; this should - ## probably be configurable; if you care, file a bug ;-) - my $boxSize = scalar(@choices) < 5 ? scalar(@choices) : 5; - - print "\n"; - last SWITCH; - }; - /^s$/ && do { - print "\n"; - last SWITCH; - }; - # DEFAULT - print "Unknown param type $i->{'type'}!!!\n"; + } else { + $changed = ($value eq Param($name))? 0 : 1; + } + + if ($changed) { + if (exists $i->{'checker'}) { + my $ok = $i->{'checker'}->($value, $i); + if ($ok ne "") { + ThrowUserError('invalid_parameter', { name => $name, err => $ok }); + } + } + push(@changes, $name); + SetParam($name, $value); + if (($name eq "shutdownhtml") && ($value ne "")) { + $vars->{'shutdown_is_active'} = 1; + } + } } - print "
version: -What version of Bugzilla this is. This can't be modified. -
" . $Bugzilla::Config::VERSION . "
\n"; + $vars->{'message'} = 'parameters_updated'; + $vars->{'param_changed'} = \@changes; -print "
\n"; -print "\n"; - -print "
\n"; + WriteParams(); + unlink "$datadir/versioncache"; +} -print "

Skip all this, and go back to the query page\n"; -$template->put_footer(); +$template->process("admin/params/editparams.html.tmpl", $vars) + || ThrowTemplateError($template->error()); -- cgit v1.2.3-24-g4f1b