--- loncom/interface/lonparmset.pm 2007/10/06 04:32:49 1.382 +++ loncom/interface/lonparmset.pm 2007/10/17 00:27:44 1.383 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.382 2007/10/06 04:32:49 raeburn Exp $ +# $Id: lonparmset.pm,v 1.383 2007/10/17 00:27:44 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2739,30 +2739,11 @@ sub listdata { ''. &date_sanity_info($$resourcedata{$thiskey}) ); - } elsif ($thistype eq 'string_yesno') { - my $showval; - if (defined($$resourcedata{$thiskey})) { - $showval=$$resourcedata{$thiskey}; - } - $r->print(' '); - $r->print(''); + } elsif ($thistype =~ m/^string/) { + $r->print(&string_selector($thistype,$thiskey, + $$resourcedata{$thiskey})); } else { - my $showval; - if (defined($$resourcedata{$thiskey})) { - $showval=$$resourcedata{$thiskey}; - } - $r->print(''); + $r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); } $r->print(''); @@ -2772,6 +2753,43 @@ sub listdata { return $foundkeys; } +sub default_selector { + my ($thiskey, $showval) = @_; + return '' ; +} + +my %strings = + ( + 'string_yesno' + => [[ 'yes', 'Yes' ], + [ 'no', 'No' ]], + 'string_problemstatus' + => [[ 'yes', 'Yes' ], + [ 'no', 'No, don\'t show correct/incorrect feedback.' ], + [ 'no_feedback_ever', 'No, show no feedback at all.' ]], + ); + + +sub string_selector { + my ($thistype, $thiskey, $showval) = @_; + + if (!exists($strings{$thistype})) { + return &default_selector($thiskey,$showval); + } + + my $result; + foreach my $possibilities (@{ $strings{$thistype} }) { + my ($name, $description) = @{ $possibilities }; + $result .= '