--- loncom/homework/externalresponse.pm 2008/11/20 14:37:37 1.15
+++ loncom/homework/externalresponse.pm 2011/04/29 00:32:08 1.19
@@ -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.19 2011/04/29 00:32:08 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,8 +115,13 @@ 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'});
+ if ($Apache::loncapagrade::results{'awarddetail'} eq 'ASSIGNED_SCORE') {
+ $Apache::lonhomework::results{"resource.$part.$id.awarded"}=
+ 1.*$Apache::loncapagrade::results{"awarded"};
+ }
&Apache::lonxml::debug("response of");
&Apache::lonhomework::showhash(%$res);
&Apache::lonxml::debug("capagrade of");
@@ -126,6 +133,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:').' |
---|
'.
+ $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 +193,4 @@ described at http://www.lon-capa.org.
=back
-=cut
\ No newline at end of file
+=cut