--- loncom/homework/externalresponse.pm 2008/11/20 14:37:37 1.15
+++ 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.15 2008/11/20 14:37:37 jms 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);
}
@@ -113,6 +115,7 @@ sub end_externalresponse {
$Apache::lonhomework::results{"resource.$part.$id.$key"}=
$Apache::loncapagrade::results{$key};
}
+ $Apache::externalresponse::message=$Apache::loncapagrade::results{'message'};
&Apache::response::handle_previous(\%previous,
$Apache::loncapagrade::results{'awarddetail'});
&Apache::lonxml::debug("response of");
@@ -126,6 +129,16 @@ 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.' |
';
+ }
+ $Apache::externalresponse::message='';
}
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
@@ -176,4 +189,4 @@ described at http://www.lon-capa.org.
=back
-=cut
\ No newline at end of file
+=cut