--- loncom/homework/lonsimpleproblemedit.pm 2009/05/11 16:51:22 1.22 +++ 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.22 2009/05/11 16:51:22 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=''; @@ -222,18 +235,14 @@ sub handler { $spell_header)); if ($symb) { $r->print('

'.&Apache::lonnet::gettitle($symb).'

'); - $r->print('

' - .&mt('Note: it can take up to 10 minutes for changes to take effect for all users.') - .&Apache::loncommon::help_open_topic('Caching') - .'

' - ); my $displaylink = &get_parent_uri($symb); if ($displaylink ne '') { - $r->print(&Apache::lontemplate::start_functionslist() - .&Apache::lontemplate::item_functionslist( - ''.&mt('Student View').'') - .&Apache::lontemplate::end_functionslist() - ); + my $functions=&Apache::lonhtmlcommon::start_funclist() + .&Apache::lonhtmlcommon::add_item_funclist( + '' + .&mt('Student View').'') + .&Apache::lonhtmlcommon::end_funclist(); + $r->print(&Apache::loncommon::head_subbox($functions)); } else { $r->print('

' .&mt('An error occurred retrieving the link to this problem.') @@ -243,6 +252,11 @@ sub handler { .'

' ); } + $r->print('

' + .&mt('Note: it can take up to 10 minutes for changes to take effect for all users.') + .&Apache::loncommon::help_open_topic('Caching') + .'

' + ); $r->print('
'. &rawrendering($symb). @@ -253,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'; } @@ -262,6 +277,10 @@ sub handler { ($qtype,'questiontype',%questiontypes). '

 

'); +# Script + if ($qtype eq 'numerical') { + $r->print(&script()); + } # Question Text $r->print(&questiontext()); # Radio, Option === @@ -330,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( '');