--- loncom/homework/caparesponse/caparesponse.pm 2008/04/05 15:39:20 1.224 +++ loncom/homework/caparesponse/caparesponse.pm 2008/09/13 02:08:33 1.233 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # caparesponse definition # -# $Id: caparesponse.pm,v 1.224 2008/04/05 15:39:20 www Exp $ +# $Id: caparesponse.pm,v 1.233 2008/09/13 02:08:33 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -310,6 +310,9 @@ sub start_numericalresponse { $safeeval); if ($unit =~ /\S/) { $result.=" (in $unit) "; } } + if (($token->[1] eq 'formularesponse') && + ($Apache::inputtags::status['-1'] eq 'CAN_ANSWER')) { + } if ( &Apache::response::show_answer() ) { &set_answertext($tag_internal_answer_name,$target,$token,$tagstack, $parstack,$parser,$safeeval,-1); @@ -427,8 +430,12 @@ sub check_submission { } } elsif ($tag eq 'numericalresponse') { $$args_ref{'type'}='float'; + } elsif ($tag eq 'stringresponse') { + if ($$args_ref{'type'} eq '') { + $$args_ref{'type'} = 'ci'; + } } - + &add_in_tag_answer($parstack,$safeeval); if (!%answer) { @@ -510,12 +517,12 @@ sub end_numericalresponse { &Apache::lonxml::debug($$parstack[-1] . "\n
"); if ( &Apache::response::submitted('scantron')) { - &add_in_tag_answer($parstack,$safeeval); - my ($values,$display)=&make_numerical_bubbles($partid,$id, - $target,$parstack,$safeeval); - $response=$values->[$response]; - } - $Apache::lonhomework::results{"resource.$partid.$id.submission"}=$response; + &add_in_tag_answer($parstack,$safeeval); + my ($values,$display)=&make_numerical_bubbles($partid,$id, + $target,$parstack,$safeeval); + $response=$values->[$response]; + } + $Apache::lonhomework::results{"resource.$partid.$id.submission"}=$response; my ($ad,$msg,$name)=&check_submission($response,$partid,$id, $tag,$parstack, $safeeval); @@ -602,6 +609,13 @@ sub end_numericalresponse { } } } + if (($target eq 'web') && ($tag eq 'formularesponse') + && ($Apache::lonhomework::type ne 'exam') && ($Apache::inputtags::status['-1'] eq 'CAN_ANSWER') + && (&Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.turnoneditor') ne 'no')){ + $result.=&Apache::response::edit_mathresponse_button($id,"HWVAL_$id"); +#hier + } + &Apache::response::setup_prior_tries_hash(\&format_prior_response_numerical); } elsif ($target eq 'edit') { $result.=''.&Apache::edit::end_table; @@ -1151,7 +1165,9 @@ sub end_stringresponse { my @args = ('type'); my $args_ref = &setup_capa_args($safeeval,$parstack, \@args,$response); - + if ($$args_ref{'type'} eq '') { + $$args_ref{'type'} = 'ci'; + } &add_in_tag_answer($parstack,$safeeval); my (@final_awards,@final_msgs,@names); foreach my $name (keys(%answer)) {