--- loncom/homework/lonsimpleproblemedit.pm 2009/08/17 18:18:35 1.24 +++ loncom/homework/lonsimpleproblemedit.pm 2009/10/16 17:23:51 1.28 @@ -1,7 +1,7 @@ # The LearningOnline Network # Simple Problem Parameter Setting "Editor" # -# $Id: lonsimpleproblemedit.pm,v 1.24 2009/08/17 18:18:35 www Exp $ +# $Id: lonsimpleproblemedit.pm,v 1.28 2009/10/16 17:23:51 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -141,11 +141,11 @@ sub foil { my $spell_link= &Apache::lonhtmlcommon::spelllink('simpleedit',"text$number"); return (< +
$lt{'foil'}
$lt{'value'}: $selectvalue$lt{'pos'}: $selectposition
$lt{'text'}:
- +
$spell_link
@@ -191,6 +191,9 @@ sub handler { # ------------------------------------------------ Prefix for everything stored $prefix=$env{'request.course.id'}.'.'.$symb.'.0.'; +#------------------------------------------------- Prefix for storing weight of Problem Parts + my $weightprefix=$env{'request.course.id'}.'.'.$symb.'.'; + # ---------------------------------------------------------- Anything to store? if (($symb) && (defined($env{'form.questiontype'}))) { @@ -216,11 +219,25 @@ sub handler { $storecontent{$prefix.$parm}=~s/\s+$//s; } } +# ---------------------------------------------------- Set weights of hidden parts to zero +# ------------------------------------------------------ and used part to 1 + $storecontent{$weightprefix.'essay.weight'}=0; + $storecontent{$weightprefix.'numerical.weight'}=0; + $storecontent{$weightprefix.'option.weight'}=0; + $storecontent{$weightprefix.'radio.weight'}=0; + $storecontent{$weightprefix.'string.weight'}=0; + $storecontent{$weightprefix.$env{'form.questiontype'}.'.weight'}=1; + + my $reply=&Apache::lonnet::cput ('resourcedata',\%storecontent, $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); + &Apache::lonnet::devalidatecourseresdata( + $env{'course.'.$env{'request.course.id'}.'.num'}, + $env{'course.'.$env{'request.course.id'}.'.domain'}); + } # ------------------------------------------------------------------- Read Data @@ -301,7 +318,7 @@ sub handler { ':   '. &Apache::loncommon::select_form ($randomize,'randomize',%randomizes). - ''); + ''); # Option Response: Options if ($qtype eq 'option') { my $options=$qparms{$prefix.'options'}; @@ -342,7 +359,7 @@ sub handler { unless ($stringtypes{$stringtype}) { $stringtype='cs'; } $r->print( ''. - '
'.&mt('Correct answer').':   '. + '
  '. &Apache::loncommon::select_form ($stringtype,'stringtype',%stringtypes). '

'); @@ -352,10 +369,18 @@ sub handler { if ($qtype eq 'numerical') { my $numericalanswer=$qparms{$prefix.'numericalanswer'}; unless (defined($numericalanswer)) { $numericalanswer=''; } + my $numericaltolerance=$qparms{$prefix.'numericaltolerance'}; + unless (defined($numericaltolerance)) { $numericaltolerance='5%'; } + my $numericalsigfigs=$qparms{$prefix.'numericalsigfigs'}; + unless (defined($numericalsigfigs)) { $numericalsigfigs='1,15'; } $r->print( ''. - '
'.&mt('Correct answer').': '. + '
  '. + '  '. + '  '. + '  '. + ''. '

'); $r->print(&hint()); }