--- loncom/homework/lonsimpleproblemedit.pm 2009/08/17 18:18:35 1.24 +++ loncom/homework/lonsimpleproblemedit.pm 2009/09/24 00:50:03 1.26 @@ -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.26 2009/09/24 00:50:03 truskell Exp $ # # Copyright Michigan State University Board of Trustees # @@ -40,6 +40,7 @@ use LONCAPA; my %qparms; my $prefix; +my $weightprefix; my $qtype; sub evaloptionhash { @@ -191,6 +192,9 @@ sub handler { # ------------------------------------------------ Prefix for everything stored $prefix=$env{'request.course.id'}.'.'.$symb.'.0.'; +#------------------------------------------------- Prefix for storing weight of Problem Parts + $weightprefix=$env{'request.course.id'}.'.'.$symb.'.'; + # ---------------------------------------------------------- Anything to store? if (($symb) && (defined($env{'form.questiontype'}))) { @@ -216,11 +220,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 @@ -342,7 +360,7 @@ sub handler { unless ($stringtypes{$stringtype}) { $stringtype='cs'; } $r->print( ''. - '
'.&mt('Correct answer').':   '. + '
  '. &Apache::loncommon::select_form ($stringtype,'stringtype',%stringtypes). '

'); @@ -352,10 +370,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()); }