--- loncom/homework/externalresponse.pm 2010/12/20 15:54:03 1.16 +++ loncom/homework/externalresponse.pm 2010/12/20 20:15:55 1.17 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # external style responses # -# $Id: externalresponse.pm,v 1.16 2010/12/20 15:54:03 www Exp $ +# $Id: externalresponse.pm,v 1.17 2010/12/20 20:15:55 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,6 +33,7 @@ use strict; use HTTP::Request::Common; use Apache::loncapagrade; use Apache::lonnet; +use Apache::lonlocal; BEGIN { &Apache::lonxml::register('Apache::externalresponse',('externalresponse')); @@ -56,13 +57,14 @@ sub start_externalresponse { if ($target eq 'edit') { $result .=&Apache::edit::tag_start($target,$token); $result .=&Apache::edit::text_arg('URL:','url',$token,60).'
'; - $result .=&Apache::edit::text_arg('Answer:','answer',$token); - $result .=&Apache::edit::text_arg('Form:','form',$token); + $result .=&Apache::edit::text_arg(&mt('Answer:'),'answer',$token); + $result .=&Apache::edit::text_arg(&mt('Form:'),'form',$token).'
'; + $result .=&Apache::edit::text_arg(&mt('Answer display:'),'answerdisplay',$token,80); $result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); } elsif ($target eq 'modified') { my $constructtag = &Apache::edit::get_new_args($token,$parstack,$safeeval, - 'answer','form','url'); + 'answerdisplay','answer','form','url'); if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); } @@ -127,8 +129,14 @@ sub end_externalresponse { } if ($target eq 'web') { &Apache::response::setup_prior_tries_hash(\&format_prior_response); + if (&Apache::response::show_answer()) { + $result.='
'.&mt('Your answer:').''.&mt("Computer's answer information").'
'.
+                    $Apache::lonhomework::history{"resource.$part.$id.submission"}.
+                    '
'.&Apache::lonxml::get_param('answerdisplay',$parstack,$safeeval).
+                    '
'; + } if ($Apache::externalresponse::message) { - $result.='
'.$Apache::externalresponse::message; + $result.='
'.$Apache::externalresponse::message.'

'; } $Apache::externalresponse::message=''; }