--- loncom/homework/caparesponse/caparesponse.pm 2002/11/06 17:58:27 1.68 +++ loncom/homework/caparesponse/caparesponse.pm 2002/11/27 16:50:09 1.74 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # caparesponse definition # -# $Id: caparesponse.pm,v 1.68 2002/11/06 17:58:27 sakharuk Exp $ +# $Id: caparesponse.pm,v 1.74 2002/11/27 16:50:09 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -89,7 +89,8 @@ sub start_numericalresponse { $result.=&Apache::edit::text_arg('Format:','format',$token,4); } elsif ($token->[1] eq 'stringresponse') { $result.=&Apache::edit::select_arg('Type:','type', - ['cs','ci','mc'],$token); + [['cs','Case Sensitive'],['ci','Case Insensitive'], + ['mc','Case Insensitive, Any Order']],$token); } elsif ($token->[1] eq 'formularesponse') { $result.=&Apache::edit::text_arg('Sample Points:','samples',$token,40); } @@ -112,6 +113,8 @@ sub start_numericalresponse { } } elsif ($target eq 'meta') { $result=&Apache::response::meta_package_write('numericalresponse'); + } elsif ($target eq 'answer' || $target eq 'grade') { + &Apache::response::reset_params(); } return $result; } @@ -119,6 +122,9 @@ sub start_numericalresponse { sub end_numericalresponse { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; my $result = ''; + if (!$Apache::lonxml::default_homework_loaded) { + &Apache::lonxml::default_homework_load($safeeval); + } if ( $target eq 'grade' ) { if ( defined $ENV{'form.submitted'}) { &Apache::response::setup_params($$tagstack[-1]); @@ -198,6 +204,7 @@ sub end_numericalresponse { $result.="}. \\vskip 0 mm "; } } + if ($Apache::lonhomework::type eq 'exam') { my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval); my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,$safeeval); my $unit=&Apache::lonxml::get_param_var('unit',$parstack,$safeeval); @@ -221,6 +228,7 @@ sub end_numericalresponse { my @alphabet = ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', 'Q','R','S','T','U','V','W','X','Y','Z'); if ($target eq 'web') { + my $id=$Apache::inputtags::response[-1]; $result.= ''; for ($ind=0;$ind<$number_of_bubbles;$ind++) { my $ans; @@ -239,7 +247,7 @@ sub end_numericalresponse { } $ans = sprintf('%.'.$format,$bubbles_values[$ind]); } - $result.=''; + $result.=''; } $result.='
'.$alphabet[$ind].': '.$ans.''.$alphabet[$ind].': '.$ans.'
'; } elsif ($target eq 'tex') { @@ -308,6 +316,7 @@ sub end_numericalresponse { $result.='\end{enumerate}'; &Apache::lonxml::increment_counter(); } + } } elsif ($target eq 'edit') { $result.=''.&Apache::edit::end_table; } elsif ($target eq 'answer' || $target eq 'analyze') { @@ -351,8 +360,8 @@ sub end_numericalresponse { } } if ($target eq 'answer') { - if ($high) { $ans.=' ['.$low.','.$high.'] '; } - if ($sighigh) { $ans.= "Sig $siglow - $sighigh"; } + if ($high) { $ans.=' ['.$low.','.$high.']'; } + if ($sighigh) { $ans.= " Sig $siglow - $sighigh"; } $result.=&Apache::response::answer_part($$tagstack[-1],$ans); } elsif ($target eq 'analyze') { push (@{ $Apache::lonhomework::analyze{"$part_id.answer"} },