[LON-CAPA-cvs] cvs: loncom /homework externalresponse.pm

www www@source.lon-capa.org
Mon, 20 Dec 2010 20:15:55 -0000


www		Mon Dec 20 20:15:55 2010 EDT

  Modified files:              
    /loncom/homework	externalresponse.pm 
  Log:
  It should show something in show_answer mode.
  
  
Index: loncom/homework/externalresponse.pm
diff -u loncom/homework/externalresponse.pm:1.16 loncom/homework/externalresponse.pm:1.17
--- loncom/homework/externalresponse.pm:1.16	Mon Dec 20 15:54:03 2010
+++ loncom/homework/externalresponse.pm	Mon Dec 20 20:15:55 2010
@@ -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 HTTP::Request::Common;
 use Apache::loncapagrade;
 use Apache::lonnet;
+use Apache::lonlocal;
 
 BEGIN {
     &Apache::lonxml::register('Apache::externalresponse',('externalresponse'));
@@ -56,13 +57,14 @@
     if ($target eq 'edit') {
   	$result .=&Apache::edit::tag_start($target,$token);
 	$result .=&Apache::edit::text_arg('URL:','url',$token,60).'<br />';
-	$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).'<br />';
+        $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 @@
     }
     if ($target eq 'web') {
 	&Apache::response::setup_prior_tries_hash(\&format_prior_response);
+        if (&Apache::response::show_answer()) {
+           $result.='<table border="1"><tr><th>'.&mt('Your answer:').'</th><th>'.&mt("Computer's answer information").'</th></tr><tr><td><pre>'.
+                    $Apache::lonhomework::history{"resource.$part.$id.submission"}.
+                    '</pre></td><td><pre>'.&Apache::lonxml::get_param('answerdisplay',$parstack,$safeeval).
+                    '</pre></td></tr></table>';
+        }
         if ($Apache::externalresponse::message) {
-           $result.='<br />'.$Apache::externalresponse::message;
+           $result.='<br /><table><tr><td bgcolor="#FFFFAA">'.$Apache::externalresponse::message.'</td></tr></table><br />';
         }
         $Apache::externalresponse::message='';
     }