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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 23 Aug 2004 19:34:52 -0000


albertel		Mon Aug 23 15:34:52 2004 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  - instructor can pick a string to have displayed when in SHOW_ANSWER (good for re style answers)
  
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.151 loncom/homework/caparesponse/caparesponse.pm:1.152
--- loncom/homework/caparesponse/caparesponse.pm:1.151	Wed Jun 30 13:32:46 2004
+++ loncom/homework/caparesponse/caparesponse.pm	Mon Aug 23 15:34:52 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.151 2004/06/30 17:32:46 sakharuk Exp $
+# $Id: caparesponse.pm,v 1.152 2004/08/23 19:34:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -563,6 +563,8 @@
 			 [['cs','Case Sensitive'],['ci','Case Insensitive'],
 			  ['mc','Case Insensitive, Any Order'],
 			  ['re','Regular Expression']],$token);
+	$result.=&Apache::edit::text_arg('String to display for answer:',
+					 'answerdisplay',$token);
 	$result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
     } elsif ($target eq 'modified') {
 	my $constructtag;
@@ -575,8 +577,13 @@
 	}
     } elsif ($target eq 'web') {
 	if (  &Apache::response::show_answer() ) {
-	    $Apache::inputtags::answertxt{$id}=
-		&Apache::lonxml::get_param('answer',$parstack,$safeeval);
+	    my $answer=
+	       &Apache::lonxml::get_param('answerdisplay',$parstack,$safeeval);
+	    if (!defined $answer || $answer eq '') {
+		$answer=
+		    &Apache::lonxml::get_param('answer',$parstack,$safeeval);
+	    }
+	    $Apache::inputtags::answertxt{$id}=$answer;
 	} 
     } elsif ($target eq 'answer' || $target eq 'grade') {
 	&Apache::response::reset_params();