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

raeburn raeburn at source.lon-capa.org
Mon Aug 25 16:23:02 EDT 2014


raeburn		Mon Aug 25 20:23:02 2014 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - Bug 6726.
    - Delay adding "Draft Copy" text, if draft, and conversion of line feeds
      to <br /> when showing Submitted Answer in grading interface, for 
      essayresponsa,e until after entity encoding (grades.pm rev. 1.720 change). 
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.723 loncom/homework/grades.pm:1.724
--- loncom/homework/grades.pm:1.723	Thu Feb 27 02:28:51 2014
+++ loncom/homework/grades.pm	Mon Aug 25 20:23:01 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.723 2014/02/27 02:28:51 raeburn Exp $
+# $Id: grades.pm,v 1.724 2014/08/25 20:23:01 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -406,7 +406,6 @@
 	    $env{'form.kwstyle'}  = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : '';
 	    $env{'form.'.$symb} = 1; # so that we don't have to read it from disk for multiple sub of the same prob.
 	}
-	$answer =~ s-\n-<br />-g;
 	return '<br /><br /><blockquote><tt>'.&keywords_highlight(&HTML::Entities::encode($answer, '"<>&')).'</tt></blockquote>';
 
     } elsif ( $response eq 'organic') {
@@ -2227,7 +2226,7 @@
 	    foreach my $submission (@$string) {
 		my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/);
 		if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; }
-		my ($ressub,$hide,$subval) = split(/:/,$submission,3);
+		my ($ressub,$hide,$draft,$subval) = split(/:/,$submission,4);
 		# Similarity check
                 my $similar='';
                 my ($type,$trial,$rndseed);
@@ -2296,9 +2295,17 @@
                     if ($hide eq 'anon') {
                         $lastsubonly.='<br /><b>'.&mt('Anonymous Survey').'</b>'; 
                     } else {
-             	        $lastsubonly.='<br /><b>'.&mt('Submitted Answer:').' </b>'.
+             	        $lastsubonly.='<br /><b>'.&mt('Submitted Answer:').' </b>';
+                        if ($draft) {
+                            $lastsubonly.= ' <span class="LC_warning">'.&mt('Draft Copy').'</span>';
+                        }
+                        $subval =
 			    &cleanRecord($subval,$responsetype,$symb,$partid,
 					 $respid,\%record,$order,undef,$uname,$udom,$type,$trial,$rndseed);
+                        if ($responsetype eq 'essay') {
+                            $subval =~ s{\n}{<br />}g;
+                        }
+                        $lastsubonly.=$subval."\n";
                     }
 	            if ($similar) {$lastsubonly.="<br /><br />$similar\n";}
 		    $lastsubonly.='</div>';
@@ -2545,10 +2552,9 @@
                 }
             }
 	    my ($partid,$foo) = split(/submission$/,$key);
-	    my $draft  = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ?
-		'<span class="LC_warning">'.&mt('Draft Copy').'</span> ' : '';
+	    my $draft  = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? 1 : 0;
 	    #push(@string, join(':', $key, $hide, $draft.$lasthash{$key}));
-            push(@string, join(':', $key, $hide, $draft.(
+            push(@string, join(':', $key, $hide, $draft, (
                 ref($lasthash{$key}) eq 'ARRAY' ?
                     join(',', @{$lasthash{$key}}) : $lasthash{$key}) ));
 	}




More information about the LON-CAPA-cvs mailing list