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 /editparams.cgi | |
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 'editparams.cgi')
-rwxr-xr-x | editparams.cgi | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/editparams.cgi b/editparams.cgi index 40f5ad537..0e1b7161f 100755 --- a/editparams.cgi +++ b/editparams.cgi @@ -19,6 +19,7 @@ # Rights Reserved. # # Contributor(s): Terry Weissman <terry@mozilla.org> +# J. Paul Reed <preed@sigkill.com> use diagnostics; @@ -30,7 +31,8 @@ require "defparams.pl"; # Shut up misguided -w warnings about "used only once": use vars @::param_desc, - @::param_list; + @::param_list, + @::param_default; ConnectToDatabase(); confirm_login(); @@ -87,6 +89,48 @@ foreach my $i (@::param_list) { print "<input type=radio name=$i value=0 $off>Off\n"; last SWITCH; }; + /^m$/ && do { + my $optList = $::param_default{$i}->[0]; #'cause we use it so much + ## 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; + + print "<select multiple size=\"$boxSize\" name=\"$i\">\n"; + + for (my $optNum = 0; $optNum < scalar(@{$optList}); $optNum++) { + my $selected = ""; + + foreach my $selectedVal (@{$value}) { + if ($selectedVal eq $optList->[$optNum]) { + $selected = "selected"; + last; + } + } + + print "<option $selected value=\"$optNum\">" . + "$optList->[$optNum]</option>\n"; + } + + print "</select>\n"; + last SWITCH; + }; + /^s$/ && do { + print "<select name=\"$i\">\n"; + #'cause we use it so much below + my $optList = $::param_default{$i}->[0]; + + for (my $optNum = 0; $optNum < scalar(@{$optList}); $optNum++) { + my $selected = ""; + if ($value eq $optList->[$optNum]) { + $selected = "selected"; + } + + print "<option $selected value=\"$optNum\">" . + "$optList->[$optNum]</option>\n"; + } + print "</select>\n"; + last SWITCH; + }; # DEFAULT print "<font color=red><blink>Unknown param type $::param_type{$i}!!!</blink></font>\n"; } |