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

raeburn raeburn at source.lon-capa.org
Mon Aug 25 18:17:55 EDT 2014


raeburn		Mon Aug 25 22:17:55 2014 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/homework	grades.pm 
  Log:
  - For 2.11
    - Backport 1.724, 1.725
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.596.2.12.2.29 loncom/homework/grades.pm:1.596.2.12.2.30
--- loncom/homework/grades.pm:1.596.2.12.2.29	Thu Feb 27 02:52:22 2014
+++ loncom/homework/grades.pm	Mon Aug 25 22:17:54 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.596.2.12.2.29 2014/02/27 02:52:22 raeburn Exp $
+# $Id: grades.pm,v 1.596.2.12.2.30 2014/08/25 22:17:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -465,7 +465,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') {
         my $result=&mt('Smile representation: [_1]',
@@ -2308,7 +2307,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);
@@ -2377,9 +2376,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>';
@@ -2634,9 +2641,8 @@
                 }
             }
 	    my ($partid,$foo) = split(/submission$/,$key);
-	    my $draft  = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ?
-		'<span class="LC_warning">'.&mt('Draft Copy').'</span> ' : '';
-            push(@string, join(':', $key, $hide, $draft.(
+	    my $draft  = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? 1: 0;
+            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