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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Mon, 16 Apr 2007 23:25:16 -0000


albertel		Mon Apr 16 19:25:16 2007 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  - bug2622 string response
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.524 loncom/interface/loncommon.pm:1.525
--- loncom/interface/loncommon.pm:1.524	Mon Apr 16 19:15:42 2007
+++ loncom/interface/loncommon.pm	Mon Apr 16 19:25:04 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.524 2007/04/16 23:15:42 albertel Exp $
+# $Id: loncommon.pm,v 1.525 2007/04/16 23:25:04 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4320,6 +4320,11 @@
   white-space: pre;
 }
 
+span.LC_prior_string {
+  font-family: monospace;
+  white-space: pre;
+}
+
 table.LC_prior_option {
   width: 100%;
   border-collapse: collapse;
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.210 loncom/homework/caparesponse/caparesponse.pm:1.211
--- loncom/homework/caparesponse/caparesponse.pm:1.210	Wed Mar 14 22:51:29 2007
+++ loncom/homework/caparesponse/caparesponse.pm	Mon Apr 16 19:25:12 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.210 2007/03/15 02:51:29 albertel Exp $
+# $Id: caparesponse.pm,v 1.211 2007/04/16 23:25:12 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1025,6 +1025,19 @@
     return ($sig_ubound,$sig_lbound);
 }
 
+sub setup_prior_tries_hash_string {
+    my $part=$Apache::inputtags::part;
+    my $id=$Apache::inputtags::response[-1];	
+    foreach my $i (1..$Apache::lonhomework::history{'version'}) {
+	my $key = "$i:resource.$part.$id.submission";
+	next if (!exists($Apache::lonhomework::history{"$key"}));
+	$Apache::inputtags::submission_display{$key} =
+	    '<span class="LC_prior_string">'.
+	    &HTML::Entities::encode($Apache::lonhomework::history{$key},
+				    '"<>&').'</span>';
+    }
+}
+
 sub start_stringresponse {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result;
@@ -1202,6 +1215,8 @@
 	}
     } elsif ($target eq 'edit') {
 	$result.='</td></tr>'.&Apache::edit::end_table;
+    } elsif ($target eq 'web' || $target eq 'tex') {
+	&setup_prior_tries_hash_string();
     }
     if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || 
 	$target eq 'tex' || $target eq 'analyze') {