--- loncom/homework/response.pm 2004/03/12 18:41:43 1.94 +++ loncom/homework/response.pm 2004/03/31 05:23:59 1.97 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # various response type definitons response definition # -# $Id: response.pm,v 1.94 2004/03/12 18:41:43 albertel Exp $ +# $Id: response.pm,v 1.97 2004/03/31 05:23:59 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -47,11 +47,11 @@ sub start_response { push (@Apache::inputtags::responselist,$id); @Apache::inputtags::inputlist=(); if ($Apache::inputtags::part eq '') { - &Apache::lonxml::error(&HTML::Entities::encode(&mt("Found a <*response> outside of a in a ed problem"))); + &Apache::lonxml::error(&HTML::Entities::encode(&mt("Found a <*response> outside of a in a ed problem"),'<>&"')); } if ($Apache::inputtags::response_with_no_part && $Apache::inputtags::part ne '0') { - &Apache::lonxml::error(&HTML::Entities::encode(&mt("<*response>s are both inside of and outside of , this is not a valid problem, errors in grading may occur.")).'
'); + &Apache::lonxml::error(&HTML::Entities::encode(&mt("<*response>s are both inside of and outside of , this is not a valid problem, errors in grading may occur."),'<>&"').'
'); } if ($Apache::inputtags::part eq '0') { $Apache::inputtags::response_with_no_part=1; @@ -597,6 +597,15 @@ sub analyze_store_foilgroup { push (@{ $Apache::lonhomework::analyze{"$part_id.shown"} }, @{ $shown }); } +sub check_if_computed { + my ($token,$parstack,$safeeval,$name)=@_; + my $value = &Apache::lonxml::get_param($name,$parstack,$safeeval); + if ($value ne $token->[2]{$name}) { + my $part_id="$Apache::inputtags::part.$Apache::inputtags::response[-1]"; + $Apache::lonhomework::analyze{"$part_id.answercomputed"} = 1; + } +} + sub pick_foil_for_concept { my ($target,$attrs,$hinthash,$parstack,$safeeval)=@_; if (not defined(@{ $Apache::response::conceptgroup{'names'} })) { return; } @@ -632,6 +641,20 @@ sub pick_foil_for_concept { } +sub get_response_param { + my ($id,$name,$default)=@_; + my $parameter; + if ($ENV{'request.state'} eq 'construct' && + defined($Apache::inputtags::params{$name})) { + $parameter=$Apache::inputtags::params{$name}; + } else { + $parameter=&Apache::lonnet::EXT("resource.$id.$name"); + } + if (!defined($parameter) || $parameter eq '') { + $parameter = $default; + } + return $parameter; +} 1; __END__