From 4c1922a6e893428bfbd43bc41ff4245384d8b543 Mon Sep 17 00:00:00 2001 From: "bbaetz%student.usyd.edu.au" <> Date: Thu, 29 Aug 2002 16:25:41 +0000 Subject: Bug 163829 - move pref code into a separate package r=joel, preed --- editparams.cgi | 69 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 38 deletions(-) (limited to 'editparams.cgi') diff --git a/editparams.cgi b/editparams.cgi index ef9e14946..372eb4d7b 100755 --- a/editparams.cgi +++ b/editparams.cgi @@ -25,13 +25,9 @@ use strict; use lib "."; -require "CGI.pl"; -require "defparams.pl"; +use Bugzilla::Config qw(:DEFAULT :admin); -# Shut up misguided -w warnings about "used only once": -use vars @::param_desc, - @::param_list, - @::param_default; +require "CGI.pl"; ConnectToDatabase(); confirm_login(); @@ -59,18 +55,19 @@ print "
\n"; my $rowbreak = ""; print $rowbreak; -foreach my $i (@::param_list) { - print "\n"; - print "\n"; + print "\n"; print $rowbreak; } print " -"; +What version of Bugzilla this is. This can't be modified. +"; print "

$i:$::param_desc{$i}
Reset\n"; - my $value = Param($i); - SWITCH: for ($::param_type{$i}) { +foreach my $i (GetParamList()) { + my $name = $i->{'name'}; + my $value = Param($name); + print "
$name:$i->{'desc'}
Reset\n"; + SWITCH: for ($i->{'type'}) { /^t$/ && do { - print "\n"; last SWITCH; }; /^l$/ && do { - print "\n"; last SWITCH; }; @@ -84,64 +81,60 @@ foreach my $i (@::param_list) { $on = ""; $off = "checked"; } - print "On\n"; - print "Off\n"; + print "On\n"; + print "Off\n"; last SWITCH; }; /^m$/ && do { - my $optList = $::param_default{$i}->[0]; #'cause we use it so much + 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(@{$optList}) < 5 ? scalar(@{$optList}) : 5; + my $boxSize = scalar(@choices) < 5 ? scalar(@choices) : 5; - print "\n"; - for (my $optNum = 0; $optNum < scalar(@{$optList}); $optNum++) { + foreach my $item (@choices) { my $selected = ""; - foreach my $selectedVal (@{$value}) { - if ($selectedVal eq $optList->[$optNum]) { - $selected = "selected"; - last; - } + if (lsearch($value, $item) >= 0) { + $selected = "selected"; } - print "\n"; + print "\n"; } print "\n"; last SWITCH; }; /^s$/ && do { - print "\n"; + my @choices = @{$i->{'choices'}}; - for (my $optNum = 0; $optNum < scalar(@{$optList}); $optNum++) { + foreach my $item (@choices) { my $selected = ""; - if ($value eq $optList->[$optNum]) { + + if ($value eq $item) { $selected = "selected"; } - print "\n"; + print "\n"; + } print "\n"; last SWITCH; }; # DEFAULT - print "Unknown param type $::param_type{$i}!!!\n"; + print "Unknown param type $i->{'type'}!!!\n"; } print "
version: -What version of Bugzilla this is. This can't be modified here, but -%version% can be used as a parameter in places that understand -such parameters
" . Param('version') . "
" . $Bugzilla::Config::VERSION . "
\n"; -- cgit v1.2.3-24-g4f1b