| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2006 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2006 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | |
4 | |
| 5 | # $CVSHeader: webwork-modperl/lib/WeBWorK/CGI.pm,v 1.14 2006/07/12 01:14:46 gage Exp $ |
5 | # $CVSHeader: webwork-modperl/lib/WeBWorK/CGI.pm,v 1.15 2006/07/13 15:01:05 gage Exp $ |
| 6 | # |
6 | # |
| 7 | # This program is free software; you can redistribute it and/or modify it under |
7 | # This program is free software; you can redistribute it and/or modify it under |
| 8 | # the terms of either: (a) the GNU General Public License as published by the |
8 | # the terms of either: (a) the GNU General Public License as published by the |
| 9 | # Free Software Foundation; either version 2, or (at your option) any later |
9 | # Free Software Foundation; either version 2, or (at your option) any later |
| 10 | # version, or (b) the "Artistic License" which comes with this package. |
10 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 160 | ## match labels to values |
160 | ## match labels to values |
| 161 | my @text=(); |
161 | my @text=(); |
| 162 | if (defined($labels_key) and $labels_key) { |
162 | if (defined($labels_key) and $labels_key) { |
| 163 | my %labels= %{$inputs{$labels_key}}; |
163 | my %labels= %{$inputs{$labels_key}}; |
| 164 | delete($inputs{$labels_key}) if exists $inputs{$labels_key}; |
164 | delete($inputs{$labels_key}) if exists $inputs{$labels_key}; |
| 165 | @text = map {$labels{$_}.$ret} @values; |
165 | @text = map {( exists($labels{$_}) )? $labels{$_}.$ret: $_.$ret } @values; |
| 166 | } else { # no labels |
166 | } else { # no labels |
| 167 | @text = map {$_ .$ret} @values; |
167 | @text = map {$_ .$ret} @values; |
| 168 | } |
168 | } |
| 169 | @inputs = (-type=>'radio',-value=>\@values, -text=>\@text); |
169 | @inputs = (-type=>'radio',-value=>\@values, -text=>\@text); |
| 170 | }; |
170 | }; |
| … | |
… | |
| 203 | return unless @values; # don't try to call options_group on an empty list |
203 | return unless @values; # don't try to call options_group on an empty list |
| 204 | my @text=(); |
204 | my @text=(); |
| 205 | if (defined($labels_key) and $labels_key) { |
205 | if (defined($labels_key) and $labels_key) { |
| 206 | my %labels= %{$inputs{$labels_key}}; |
206 | my %labels= %{$inputs{$labels_key}}; |
| 207 | delete($inputs{$labels_key}) if exists $inputs{$labels_key}; |
207 | delete($inputs{$labels_key}) if exists $inputs{$labels_key}; |
| 208 | @text = map {$labels{$_}} @values; |
208 | @text = map {( exists($labels{$_}) )? $labels{$_}: $_ } @values; |
| 209 | } else { # no labels |
209 | } else { # no labels |
| 210 | @text = @values; |
210 | @text = @values; |
| 211 | } |
211 | } |
| 212 | delete($inputs{$values_key}); |
212 | delete($inputs{$values_key}); |
| 213 | # end match labels to values |
213 | # end match labels to values |