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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 17 Oct 2006 17:09:44 -0000


albertel		Tue Oct 17 13:09:44 2006 EDT

  Modified files:              
    /loncom/homework	response.pm essayresponse.pm 
  Log:
  - trying to preserve the fix for BUG#4250 but use the normal answer functions to do so
  
  
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.147 loncom/homework/response.pm:1.148
--- loncom/homework/response.pm:1.147	Thu Oct 12 13:16:53 2006
+++ loncom/homework/response.pm	Tue Oct 17 13:09:44 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.147 2006/10/12 17:16:53 albertel Exp $
+# $Id: response.pm,v 1.148 2006/10/17 17:09:44 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -729,19 +729,24 @@
 }
 
 sub answer_part {
-    my ($type,$answer) = @_;
+    my ($type,$answer,$args) = @_;
     my $result;
     if ($env{'form.answer_output_mode'} eq 'tex') {
-	my $to_use='|';
-	foreach my $value (32..126) {
-	    my $char=pack('c',$value);
-	    if ($answer !~ /\Q$char\E/) {
-		$to_use=$char;
-		last;
+	if (!$args->{'no_verbatim'}) {
+	    my $to_use='|';
+	    foreach my $value (32..126) {
+		my $char=pack('c',$value);
+		if ($answer !~ /\Q$char\E/) {
+		    $to_use=$char;
+		    last;
+		}
+	    }
+	    if ($answer ne '') {
+		$answer = '\verb'.$to_use.$answer.$to_use;
 	    }
 	}
 	if ($answer ne '') {
-	    push(@answer_bits,'\verb'.$to_use.$answer.$to_use);
+	    push(@answer_bits,$answer);
 	}
     } else {
 	if ($need_row_start) {
Index: loncom/homework/essayresponse.pm
diff -u loncom/homework/essayresponse.pm:1.77 loncom/homework/essayresponse.pm:1.78
--- loncom/homework/essayresponse.pm:1.77	Tue Oct 17 11:11:11 2006
+++ loncom/homework/essayresponse.pm	Tue Oct 17 13:09:44 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # essay (ungraded) style responses
 #
-# $Id: essayresponse.pm,v 1.77 2006/10/17 15:11:11 albertel Exp $
+# $Id: essayresponse.pm,v 1.78 2006/10/17 17:09:44 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -170,18 +170,11 @@
 	$result .= &Apache::inputtags::exam_score_line($target);
 
     } elsif ($target eq 'answer') {
-	if ($env{'form.answer_output_mode'} eq 'tex') {
-	    $result .= '\begin{tabular}{|l|}';
-	    $result .= '\hline';
-	    $result .= ' Answer for essay will be hand graded \\\\  ';
-	    $result .= '\\hline';
-	    $result .= '\end{tabular}';
-	    $result .= '\vskip 3mm';
-	} else {
-	    $result.=&Apache::response::answer_header($$tagstack[-1]);
-	    $result.=&Apache::response::answer_part($$tagstack[-1],'');
-	    $result.=&Apache::response::answer_footer($$tagstack[-1]);
-	}
+	$result.=&Apache::response::answer_header($$tagstack[-1]);
+	my $answer = &mt('Answer for essay will be hand graded.');
+	$result.=&Apache::response::answer_part($$tagstack[-1],$answer,
+						{'no_verbatim' => 1});
+	$result.=&Apache::response::answer_footer($$tagstack[-1]);
     }
 
     if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||