--- loncom/homework/lonsimpleproblemedit.pm 2009/06/11 16:48:28 1.23 +++ loncom/homework/lonsimpleproblemedit.pm 2009/08/17 18:18:35 1.24 @@ -1,7 +1,7 @@ # The LearningOnline Network # Simple Problem Parameter Setting "Editor" # -# $Id: lonsimpleproblemedit.pm,v 1.23 2009/06/11 16:48:28 bisitz Exp $ +# $Id: lonsimpleproblemedit.pm,v 1.24 2009/08/17 18:18:35 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -95,6 +95,19 @@ sub hint { ENDHINT } +sub script { + my $text=$qparms{$prefix.'numericalscript'}; + my $ht=&mt('Scripting (optional)'); + return (< +$ht
+ + + +
+ENDSCRIPT +} + sub foil { my $number=shift; my %values=''; @@ -254,7 +267,8 @@ sub handler { '1 out of N multiple choice (radio button)', 'option' => 'Option response', 'string' => 'Short string response', - 'essay' => 'Essay, open end'); + 'essay' => 'Essay, open end', + 'numerical' => 'Numerical response'); $qtype=$qparms{$prefix.'questiontype'}; unless (defined($qtype)) { $qtype='radio'; } unless ($questiontypes{$qtype}) { $qtype='radio'; } @@ -263,6 +277,10 @@ sub handler { ($qtype,'questiontype',%questiontypes). '

 

'); +# Script + if ($qtype eq 'numerical') { + $r->print(&script()); + } # Question Text $r->print(&questiontext()); # Radio, Option === @@ -331,6 +349,16 @@ sub handler { # Hint $r->print(&hint()); } + if ($qtype eq 'numerical') { + my $numericalanswer=$qparms{$prefix.'numericalanswer'}; + unless (defined($numericalanswer)) { $numericalanswer=''; } + + $r->print( + ''. + '
'.&mt('Correct answer').': '. + '

'); + $r->print(&hint()); + } # Store Button $r->print( '');