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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 01 Mar 2007 02:33:29 -0000


albertel		Wed Feb 28 21:33:29 2007 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
    /loncom/homework	optionresponse.pm 
  Log:
  - previous submission display mode of optionresponse
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.509 loncom/interface/loncommon.pm:1.510
--- loncom/interface/loncommon.pm:1.509	Wed Feb 28 16:45:43 2007
+++ loncom/interface/loncommon.pm	Wed Feb 28 21:33:04 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.509 2007/02/28 21:45:43 albertel Exp $
+# $Id: loncommon.pm,v 1.510 2007/03/01 02:33:04 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3675,9 +3675,20 @@
     return <<END;
 h1, h2, h3, th { font-family: $sans }
 a:focus { color: red; background: yellow } 
-table.thinborder { border-collapse: collapse; }
-table.thinborder tr th {  border-style: solid; border-width: 1px; background: $tabbg;}
-table.thinborder tr td { border-style: solid; border-width: 1px}
+table.thinborder,
+table.LC_optres_prior {
+  border-collapse: collapse;
+}
+table.thinborder tr th {
+  border-style: solid;
+  border-width: 1px;
+  background: $tabbg;
+}
+table.thinborder tr td, 
+table.LC_optres_prior tr td {
+  border-style: solid;
+  border-width: 1px
+}
 
 form, .inline { display: inline; }
 .center { text-align: center; }
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.137 loncom/homework/optionresponse.pm:1.138
--- loncom/homework/optionresponse.pm:1.137	Wed Feb 21 20:25:31 2007
+++ loncom/homework/optionresponse.pm	Wed Feb 28 21:33:28 2007
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.137 2007/02/22 01:25:31 albertel Exp $
+# $Id: optionresponse.pm,v 1.138 2007/03/01 02:33:28 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -355,6 +355,27 @@
     }
 }
 
+sub setup_prior_tries_hash {
+    my ($whichopt) = @_;
+    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"}));
+	my %lastresponse=
+	    &Apache::lonnet::str2hash($Apache::lonhomework::history{$key});
+	my $output;
+	foreach my $name (@$whichopt) {
+	    next if (!defined($lastresponse{$name}));
+	    $output .= '<td>'.$lastresponse{$name}.'</td>';
+	}
+	next if (!defined($output));
+	$output =
+	    '<table class="LC_optres_prior"><tr>'.$output.'</tr></table>';
+	$Apache::inputtags::submission_display{$key} = $output;
+    }
+}
+
 sub displayfoils {
   my ($target,$max,$randomize,$TeXlayout,@opt)=@_;
   if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
@@ -475,6 +496,11 @@
       }
     }
   }
+
+  if ($target eq 'web') {
+      &setup_prior_tries_hash(\@whichopt);
+  }
+
   if ($target ne 'tex') {
       return $result.$break;
   } else {