diff options
author | preed%sigkill.com <> | 2002-08-11 23:12:32 +0200 |
---|---|---|
committer | preed%sigkill.com <> | 2002-08-11 23:12:32 +0200 |
commit | 3844d9ddaf6d8a3af296568ed659c3344fd36b6d (patch) | |
tree | 003ddca440479e22889bbfb730617540f9936ae5 /globals.pl | |
parent | 17e3e995f357cf33670436264607a965b38a671d (diff) | |
download | bugzilla-3844d9ddaf6d8a3af296568ed659c3344fd36b6d.tar.gz bugzilla-3844d9ddaf6d8a3af296568ed659c3344fd36b6d.tar.xz |
Bug 160410: defparams.pl support for single/multi pulldown menus; p=preed,r=joel,r2=bbaetz
Diffstat (limited to 'globals.pl')
-rw-r--r-- | globals.pl | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/globals.pl b/globals.pl index 6f7b22d38..9e2311a83 100644 --- a/globals.pl +++ b/globals.pl @@ -1413,36 +1413,40 @@ sub RemoveVotes { } } - sub Param ($) { my ($value) = (@_); - if (defined $::param{$value}) { - return $::param{$value}; + if (! defined $::param{$value}) { + # Um, maybe we haven't sourced in the params at all yet. + if (stat("data/params")) { + # Write down and restore the version # here. That way, we get + # around anyone who maliciously tries to tweak the version number + # by editing the params file. Not to mention that in 2.0, there + # was a bug that wrote the version number out to the params file... + my $v = $::param{'version'}; + require "data/params"; + $::param{'version'} = $v; + } } - # Um, maybe we haven't sourced in the params at all yet. - if (stat("data/params")) { - # Write down and restore the version # here. That way, we get around - # anyone who maliciously tries to tweak the version number by editing - # the params file. Not to mention that in 2.0, there was a bug that - # wrote the version number out to the params file... - my $v = $::param{'version'}; - require "data/params"; - $::param{'version'} = $v; + if (! defined $::param{$value}) { + # Well, that didn't help. Maybe it's a new param, and the user + # hasn't defined anything for it. Try and load a default value + # for it. + require "defparams.pl"; + WriteParams(); } - if (defined $::param{$value}) { - return $::param{$value}; + + # If it's still not defined, we're pimped. + die "Can't find param named $value" if (! defined $::param{$value}); + + if ($::param_type{$value} eq "m") { + my $valueList = eval($::param{$value}); + return $valueList if (!($@) && ref($valueList) eq "ARRAY"); + die "Multi-list param '$value' eval() failure ('$@'); data/params is horked"; } - # Well, that didn't help. Maybe it's a new param, and the user - # hasn't defined anything for it. Try and load a default value - # for it. - require "defparams.pl"; - WriteParams(); - if (defined $::param{$value}) { + else { return $::param{$value}; } - # We're pimped. - die "Can't find param named $value"; } # Take two comma or space separated strings and return what |