--- loncom/homework/grades.pm	2013/07/16 17:17:33	1.695
+++ loncom/homework/grades.pm	2013/09/22 18:16:46	1.706
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.695 2013/07/16 17:17:33 bisitz Exp $
+# $Id: grades.pm,v 1.706 2013/09/22 18:16:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -908,17 +908,17 @@ LISTJAVASCRIPT
     $submission_options.=
         '<span class="LC_nobreak">'.
         '<label><input type="radio" name="lastSub" value="lastonly" /> '.
-        &mt('last submission only').' </label></span>'."\n".
+        &mt('last submission').' </label></span>'."\n".
         '<span class="LC_nobreak">'.
         '<label><input type="radio" name="lastSub" value="last" /> '.
-        &mt('last submission &amp; parts info').' </label></span>'."\n".
+        &mt('last submission with details').' </label></span>'."\n".
         '<span class="LC_nobreak">'.
         '<label><input type="radio" name="lastSub" value="datesub" checked="checked" /> '.
-        &mt('by dates and submissions').'</label></span>'."\n".
+        &mt('all submissions').'</label></span>'."\n".
         '<span class="LC_nobreak">'.
         '<label><input type="radio" name="lastSub" value="all" /> '.
-        &mt('all details').'</label></span>';
-    $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Submissions'))
+        &mt('all submissions with details').'</label></span>';
+    $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Submissions'))
                   .$submission_options
                   .&Apache::lonhtmlcommon::row_closure();
 
@@ -1976,7 +1976,7 @@ sub submission {
 	    $request->print(&show_problem($request,$symb,$uname,$udom,0,1,$mode));
 	}
 
-	# kwclr is the only variable that is guaranteed to be non blank 
+	# kwclr is the only variable that is guaranteed not to be blank 
         # if this subroutine has been called once.
 	my %keyhash = ();
 #	if ($env{'form.kwclr'} eq '' && $env{'form.handgrade'} eq 'yes') {
@@ -2139,138 +2139,146 @@ KEYWORDS
 	$result.=$sub_result;
     }
     $request->print($result."\n");
-
+    
     # print student answer/submission
     # Options are (1) Handgraded submission only
     #             (2) Last submission, includes submission that is not handgraded 
     #                  (for multi-response type part)
     #             (3) Last submission plus the parts info
     #             (4) The whole record for this student
-    if ($env{'form.lastSub'} =~ /^(lastonly|hdgrade)$/) {
-	my ($string,$timestamp)= &get_last_submission(\%record);
+    
+    my ($string,$timestamp)= &get_last_submission(\%record);
 	
-	my $lastsubonly;
+    my $lastsubonly;
 
-        if ($$timestamp eq '') {
-            $lastsubonly.='<div class="LC_grade_submissions_body">'.$$string[0].'</div>'; 
-        } else {
-            $lastsubonly =
-                '<div class="LC_grade_submissions_body">'
-               .'<b>'.&mt('Date Submitted:').'</b> '.$$timestamp."\n";
-
-	    my %seenparts;
-	    my @part_response_id = &flatten_responseType($responseType);
-	    foreach my $part (@part_response_id) {
-		next if ($env{'form.lastSub'} eq 'hdgrade' 
+    if ($$timestamp eq '') {
+        $lastsubonly.='<div class="LC_grade_submissions_body">'.$$string[0].'</div>'; 
+    } else {
+        $lastsubonly =
+            '<div class="LC_grade_submissions_body">'
+           .'<b>'.&mt('Date Submitted:').'</b> '.$$timestamp."\n";
+
+	my %seenparts;
+	my @part_response_id = &flatten_responseType($responseType);
+	foreach my $part (@part_response_id) {
+	    next if ($env{'form.lastSub'} eq 'hdgrade' 
 			 && $$handgrade{$$part[0].'_'.$$part[1]} ne 'yes');
 
-		my ($partid,$respid) = @{ $part };
-		my $display_part=&get_display_part($partid,$symb);
-		if ($env{"form.$uname:$udom:$partid:submitted_by"}) {
-		    if (exists($seenparts{$partid})) { next; }
-		    $seenparts{$partid}=1;
-                    $request->print(
-                        '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
-                        ' <b>'.&mt('Collaborative submission by: [_1]',
-                                   '<a href="javascript:viewSubmitter(\''.
-                                   $env{"form.$uname:$udom:$partid:submitted_by"}.
-                                   '\');" target="_self">'.
-                                   $$fullname{$env{"form.$uname:$udom:$partid:submitted_by"}}.'</a>').
-                        '<br />');
-		    next;
-		}
-		my $responsetype = $responseType->{$partid}->{$respid};
-		if (!exists($record{"resource.$partid.$respid.submission"})) {
-                    $lastsubonly.="\n".'<div class="LC_grade_submission_part">'.
-                        '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
-                        ' <span class="LC_internal_info">'.
-                        '('.&mt('Response ID: [_1]',$respid).')'.
-                        '</span>&nbsp; &nbsp;'.
-			'<span class="LC_warning">'.&mt('Nothing submitted - no attempts.').'</span><br /><br /></div>';
-		    next;
-		}
-		foreach my $submission (@$string) {
-		    my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/);
-		    if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; }
-		    my ($ressub,$hide,$subval) = split(/:/,$submission,3);
-		    # Similarity check
-		    my $similar='';
-                    my ($type,$trial,$rndseed);
-                    if ($hide eq 'rand') {
-                        $type = 'randomizetry';
-                        $trial = $record{"resource.$partid.tries"};
-                        $rndseed = $record{"resource.$partid.rndseed"};
-                    }
-		    if($env{'form.checkPlag'}){
-			my ($oname,$odom,$ocrsid,$oessay,$osim)=
-			    &most_similar($uname,$udom,$symb,$subval);
-			if ($osim) {
-			    $osim=int($osim*100.0);
-			    my %old_course_desc = 
-				&Apache::lonnet::coursedescription($ocrsid,
-								   {'one_time' => 1});
-
-                            if ($hide eq 'anon') {
-                                $similar='<hr /><span class="LC_warning">'.&mt("Essay was found to be similar to another essay submitted for this assignment.").'<br />'.
-                                         &mt('As the current submission is for an anonymous survey, no other details are available.').'</span><hr />';
-                            } else {
-			        $similar="<hr /><h3><span class=\"LC_warning\">".
-				    &mt('Essay is [_1]% similar to an essay by [_2] in course [_3] (course id [_4]:[_5])',
-				        $osim,
-				        &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')',
+	    my ($partid,$respid) = @{ $part };
+	    my $display_part=&get_display_part($partid,$symb);
+	    if ($env{"form.$uname:$udom:$partid:submitted_by"}) {
+		if (exists($seenparts{$partid})) { next; }
+		$seenparts{$partid}=1;
+                $request->print(
+                    '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
+                    ' <b>'.&mt('Collaborative submission by: [_1]',
+                               '<a href="javascript:viewSubmitter(\''.
+                               $env{"form.$uname:$udom:$partid:submitted_by"}.
+                               '\');" target="_self">'.
+                               $$fullname{$env{"form.$uname:$udom:$partid:submitted_by"}}.'</a>').
+                    '<br />');
+		next;
+		}
+	    my $responsetype = $responseType->{$partid}->{$respid};
+	    if (!exists($record{"resource.$partid.$respid.submission"})) {
+                $lastsubonly.="\n".'<div class="LC_grade_submission_part">'.
+                    '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
+                    ' <span class="LC_internal_info">'.
+                    '('.&mt('Response ID: [_1]',$respid).')'.
+                    '</span>&nbsp; &nbsp;'.
+	       	    '<span class="LC_warning">'.&mt('Nothing submitted - no attempts.').'</span><br /><br /></div>';
+		next;
+	    }
+	    foreach my $submission (@$string) {
+		my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/);
+		if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; }
+		my ($ressub,$hide,$subval) = split(/:/,$submission,3);
+		# Similarity check
+                my $similar='';
+                my ($type,$trial,$rndseed);
+                if ($hide eq 'rand') {
+                    $type = 'randomizetry';
+                    $trial = $record{"resource.$partid.tries"};
+                    $rndseed = $record{"resource.$partid.rndseed"};
+                }
+	        if ($env{'form.checkPlag'}) {
+    		    my ($oname,$odom,$ocrsid,$oessay,$osim)=
+		        &most_similar($uname,$udom,$symb,$subval);
+		    if ($osim) {
+			$osim=int($osim*100.0);
+			my %old_course_desc = 
+			    &Apache::lonnet::coursedescription($ocrsid,
+							{'one_time' => 1});
+
+                        if ($hide eq 'anon') {
+                            $similar='<hr /><span class="LC_warning">'.&mt("Essay was found to be similar to another essay submitted for this assignment.").'<br />'.
+                                     &mt('As the current submission is for an anonymous survey, no other details are available.').'</span><hr />';
+                        } else {
+			    $similar="<hr /><h3><span class=\"LC_warning\">".
+				&mt('Essay is [_1]% similar to an essay by [_2] in course [_3] (course id [_4]:[_5])',
+				    $osim,
+				    &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')',
 				        $old_course_desc{'description'},
 				        $old_course_desc{'num'},
 				        $old_course_desc{'domain'}).
 				    '</span></h3><blockquote><i>'.
 				    &keywords_highlight($oessay).
 				    '</i></blockquote><hr />';
-                            }
-			}
-		    }
-		    my $order=&get_order($partid,$respid,$symb,$uname,$udom,
-                                         undef,$type,$trial,$rndseed);
-		    if ($env{'form.lastSub'} eq 'lastonly' || 
-			($env{'form.lastSub'} eq 'hdgrade' && 
+                        }
+	            }
+		}
+		my $order=&get_order($partid,$respid,$symb,$uname,$udom,
+                                     undef,$type,$trial,$rndseed);
+                if ($env{'form.lastSub'} eq 'lastonly' || $env{'form.lastSub'} eq 'datesub' || $env{'form.lastSub'} =~ /^(last|all)$/ || ($env{'form.lastSub'} eq 'hdgrade' && 
 			 $$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) {
-			my $display_part=&get_display_part($partid,$symb);
-                        $lastsubonly.='<div class="LC_grade_submission_part">'.
-                            '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
-                            ' <span class="LC_internal_info">'.
-                            '('.&mt('Response ID: [_1]',$respid).')'.
-                            '</span>&nbsp; &nbsp;';
-			my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);
-			if (@$files) {
-                            if ($hide eq 'anon') {
-                                $lastsubonly.='<br />'.&mt('[quant,_1,file] uploaded to this anonymous survey',scalar(@{$files}));
-                            } else {
-                                $lastsubonly.='<br /><span class="LC_warning">'.&mt('Like all files provided by users, this file may contain viruses').'</span><br />';
-                                foreach my $file (@$files) {
-                                    &Apache::lonnet::allowuploaded('/adm/grades',$file);
-                                    $lastsubonly.='<br /><a href="'.$file.'?rawmode=1" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border="0" alt="" /> '.$file.'</a>';
-                                }
-                            }
-			    $lastsubonly.='<br />';
-			}
+		    my $display_part=&get_display_part($partid,$symb);
+                    $lastsubonly.='<div class="LC_grade_submission_part">'.
+                        '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
+                        ' <span class="LC_internal_info">'.
+                        '('.&mt('Response ID: [_1]',$respid).')'.
+                        '</span>&nbsp; &nbsp;';
+		    my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);
+                        
+		    if (@$files) {
                         if ($hide eq 'anon') {
-                            $lastsubonly.='<b>'.&mt('Anonymous Survey').'</b>'; 
+                            $lastsubonly.='<br />'.&mt('[quant,_1,file] uploaded to this anonymous survey',scalar(@{$files}));
                         } else {
-			    $lastsubonly.='<b>'.&mt('Submitted Answer:').' </b>'.
-			        &cleanRecord($subval,$responsetype,$symb,$partid,
-					     $respid,\%record,$order,undef,$uname,$udom,$type,$trial,$rndseed);
+                            $lastsubonly.='<br /><br />'.'<b>'.&mt('Submitted Files:').'</b>'
+                                        .'<br /><span class="LC_warning">';
+                            if(@$files == 1) {
+                                $lastsubonly .= &mt('Like all files provided by users, this file may contain viruses!');
+                            } else {
+                                $lastsubonly .= &mt('Like all files provided by users, these files may contain viruses!');
+                            }
+                            $lastsubonly .= '</span>';                         
+                            foreach my $file (@$files) {
+                                &Apache::lonnet::allowuploaded('/adm/grades',$file);
+                                $lastsubonly.='<br /><a href="'.$file.'?rawmode=1" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border="0" alt="" /> '.$file.'</a>';
+                            }
                         }
-			if ($similar) {$lastsubonly.="<br /><br />$similar\n";}
-			$lastsubonly.='</div>';
-		    }
+			$lastsubonly.='<br />';
+                    }
+                    if ($hide eq 'anon') {
+                        $lastsubonly.='<br /><b>'.&mt('Anonymous Survey').'</b>'; 
+                    } else {
+             	        $lastsubonly.='<br /><b>'.&mt('Submitted Answer:').' </b>'.
+			    &cleanRecord($subval,$responsetype,$symb,$partid,
+					 $respid,\%record,$order,undef,$uname,$udom,$type,$trial,$rndseed);
+                    }
+	            if ($similar) {$lastsubonly.="<br /><br />$similar\n";}
+		    $lastsubonly.='</div>';
 		}
-	    }
-	    $lastsubonly.='</div>'."\n"; # End: LC_grade_submissions_body
+            }
 	}
-	$request->print($lastsubonly);
-   } elsif ($env{'form.lastSub'} eq 'datesub') {
+	$lastsubonly.='</div>'."\n"; # End: LC_grade_submissions_body
+    }
+    $request->print($lastsubonly);
+    if ($env{'form.lastSub'} eq 'datesub') {
         my ($parts,$handgrade,$responseType) = &response_type($symb,\$res_error);
 	$request->print(&displaySubByDates($symb,\%record,$parts,$responseType,$checkIcon,$uname,$udom));
-    } elsif ($env{'form.lastSub'} =~ /^(last|all)$/) {
-	$request->print(&Apache::loncommon::get_previous_attempt($symb,$uname,$udom,
+    } 
+    if ($env{'form.lastSub'} =~ /^(last|all)$/) {
+        $request->print(&Apache::loncommon::get_previous_attempt($symb,$uname,$udom,
 								 $env{'request.course.id'},
 								 $last,'.submission',
 								 'Apache::grades::keywords_highlight'));
@@ -3587,9 +3595,10 @@ sub viewgrades {
 	    $partid.'" size="4" '.'onchange="javascript:writePoint(\''.
 		$partid.'\','.$weight{$partid}.',\'textval\')" /> /'.
 	    $weight{$partid}.' '.&mt('(problem weight)').'</td>'."\n";
-	$line.= '<td><b>'.&mt('Grade Status').':</b><select name="SELVAL_'.$partid.'"'.
-	    'onchange="javascript:writeRadText(\''.$partid.'\','.
-		$weight{$partid}.')"> '.
+        $line.= '<td><b>'.&mt('Grade Status').':</b>'.
+            '<select name="SELVAL_'.$partid.'" '.
+            'onchange="javascript:writeRadText(\''.$partid.'\','.
+                $weight{$partid}.')"> '.
 	    '<option selected="selected"> </option>'.
 	    '<option value="excused">'.&mt('excused').'</option>'.
 	    '<option value="reset status">'.&mt('reset status').'</option>'.
@@ -3638,8 +3647,8 @@ sub viewgrades {
 	my $display_part=&get_display_part($partid,$symb);
 	if ($display =~ /^Partial Credit Factor/) {
 	    $result.='<th>'.
-		&mt('Score Part: [_1]<br /> (weight = [_2])',
-		    $display_part,$weight{$partid}).'</th>'."\n";
+		&mt('Score Part: [_1][_2](weight = [_3])',
+		    $display_part,'<br />',$weight{$partid}).'</th>'."\n";
 	    next;
 	    
 	} else {
@@ -4134,11 +4143,12 @@ sub csvupload_fields {
 
 sub csvuploadmap_footer {
     my ($request,$i,$keyfields) =@_;
+    my $buttontext = &mt('Assign Grades');
     $request->print(<<ENDPICK);
 </table>
 <input type="hidden" name="nfields" value="$i" />
 <input type="hidden" name="keyfields" value="$keyfields" />
-<input type="button" onclick="javascript:verify(this.form)" value="Assign Grades" /><br />
+<input type="button" onclick="javascript:verify(this.form)" value="$buttontext" /><br />
 </form>
 ENDPICK
 }
@@ -4259,7 +4269,7 @@ ENDPICK
     }
     # FIXME do a check for any duplicated user ids...
     # FIXME do a check for any invalid user ids?...
-    $request->print('<input type="submit" value="Assign Grades" /><br />
+    $request->print('<input type="submit" value="'.&mt('Assign Grades').'" /><br />
 <hr /></form>'."\n");
     return '';
 }
@@ -4447,48 +4457,68 @@ LISTJAVASCRIPT
     my ($curpage) =&Apache::lonnet::decode_symb($symb); 
 #    my ($curpage,$mapId) =&Apache::lonnet::decode_symb($symb); 
 #    my $type=($curpage =~ /\.(page|sequence)/);
-    my $select = '<select name="selectpage">'."\n";
+
+    # Collection of hidden fields
     my $ctr=0;
     foreach (@$titles) {
-	my ($minder,$showtitle) = ($_ =~ /(\d+)\.(.*)/);
-	$select.='<option value="'.$ctr.'" '.
-	    ($$symbx{$_} =~ /$curpage$/ ? 'selected="selected"' : '').
-	    '>'.$showtitle.'</option>'."\n";
-	$ctr++;
+        my ($minder,$showtitle) = ($_ =~ /(\d+)\.(.*)/);
+        $result.='<input type="hidden" name="page'.$ctr.'" value="'.$$symbx{$_}.'" />'."\n";
+        $result.='<input type="hidden" name="title'.$ctr.'" value="'.$showtitle.'" />'."\n";
+        $ctr++;
     }
-    $select.= '</select>';
-    $result.='&nbsp;<b>'.&mt('Problems from').':</b> '.$select."<br />\n";
+    $result.='<input type="hidden" name="page" />'."\n".
+        '<input type="hidden" name="title" />'."\n";
+
+    $result.=&build_section_inputs();
+    my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status'));
+    $result.='<input type="hidden" name="Status"  value="'.$stu_status.'" />'."\n".
+	'<input type="hidden" name="command" value="displayPage" />'."\n".
+	'<input type="hidden" name="symb"    value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n";
 
+    # Show grading options
+    $result.=&Apache::lonhtmlcommon::start_pick_box();
+    my $select = '<select name="selectpage">'."\n";
     $ctr=0;
     foreach (@$titles) {
 	my ($minder,$showtitle) = ($_ =~ /(\d+)\.(.*)/);
-	$result.='<input type="hidden" name="page'.$ctr.'" value="'.$$symbx{$_}.'" />'."\n";
-	$result.='<input type="hidden" name="title'.$ctr.'" value="'.$showtitle.'" />'."\n";
+	$select.='<option value="'.$ctr.'"'.
+	    ($$symbx{$_} =~ /$curpage$/ ? ' selected="selected"' : '').
+	    '>'.$showtitle.'</option>'."\n";
 	$ctr++;
     }
-    $result.='<input type="hidden" name="page" />'."\n".
-	'<input type="hidden" name="title" />'."\n";
+    $select.= '</select>';
 
-    my $options =
-	'<label><input type="radio" name="vProb" value="no" checked="checked" /> '.&mt('no').' </label>'."\n".
-	'<label><input type="radio" name="vProb" value="yes" /> '.&mt('yes').' </label>'."<br />\n";
-    $result.='&nbsp;<b>'.&mt('View Problem Text').': </b>'.$options;
-
-    $options =
-	'<label><input type="radio" name="lastSub" value="none" /> '.&mt('none').' </label>'."\n".
-	'<label><input type="radio" name="lastSub" value="datesub" checked="checked" /> '.&mt('by dates and submissions').'</label>'."\n".
-	'<label><input type="radio" name="lastSub" value="all" /> '.&mt('all details').' </label>'."\n";
-    $result.='&nbsp;<b>'.&mt('Submissions').': </b>'.$options;
+    $result.=
+        &Apache::lonhtmlcommon::row_title(&mt('Problems from'))
+       .$select
+       .&Apache::lonhtmlcommon::row_closure();
+
+    $result.=
+        &Apache::lonhtmlcommon::row_title(&mt('View Problem Text'))
+       .'<label><input type="radio" name="vProb" value="no"'
+           .' checked="checked" /> '.&mt('no').' </label>'."\n"
+       .'<label><input type="radio" name="vProb" value="yes" />'
+           .&mt('yes').'</label>'."\n"
+       .&Apache::lonhtmlcommon::row_closure();
+
+    $result.=
+        &Apache::lonhtmlcommon::row_title(&mt('View Submissions'))
+       .'<label><input type="radio" name="lastSub" value="none" /> '
+           .&mt('none').' </label>'."\n"
+       .'<label><input type="radio" name="lastSub" value="datesub"'
+           .' checked="checked" /> '.&mt('all submissions').'</label>'."\n"
+       .'<label><input type="radio" name="lastSub" value="all" /> '
+           .&mt('all submissions with details').' </label>'
+       .&Apache::lonhtmlcommon::row_closure();
     
-    $result.=&build_section_inputs();
-    my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status'));
-    $result.='<input type="hidden" name="Status"  value="'.$stu_status.'" />'."\n".
-	'<input type="hidden" name="command" value="displayPage" />'."\n".
-	'<input type="hidden" name="symb"    value="'.&Apache::lonenc::check_encrypt($symb).'" />'."<br />\n";
+    $result.=
+        &Apache::lonhtmlcommon::row_title(&mt('Use CODE'))
+       .'<input type="text" name="CODE" value="" />'
+       .&Apache::lonhtmlcommon::row_closure(1)
+       .&Apache::lonhtmlcommon::end_pick_box();
 
-    $result.='&nbsp;<b>'.&mt('Use CODE').': </b> <input type="text" name="CODE" value="" /> <br />'."\n";
-
-    $result.='&nbsp;<input type="button" '.
+    # Show list of students to select for grading
+    $result.='<br /><input type="button" '.
              'onclick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' &rarr;" /><br />'."\n";
 
     $request->print($result);
@@ -4633,7 +4663,7 @@ sub displayPage {
         '</span>'."\n".
 	&Apache::loncommon::start_data_table().
 	&Apache::loncommon::start_data_table_header_row().
-	'<th align="center">&nbsp;Prob.&nbsp;</th>'.
+	'<th>'.&mt('Prob.').'</th>'.
 	'<th>&nbsp;'.($env{'form.vProb'} eq 'no' ? &mt('Title') : &mt('Problem Text')).'/'.&mt('Grade').'</th>'.
 	&Apache::loncommon::end_data_table_header_row();
 
@@ -5057,7 +5087,7 @@ like.
 Next each scanline is checked for any errors of either 'missing
 bubbles' (it's an error because it may have been mis-scanned
 because too light bubbling), 'double bubble' (each bubble line should
-have no more that one letter picked), invalid or duplicated CODE,
+have no more than one letter picked), invalid or duplicated CODE,
 invalid student/employee ID
 
 If the CODE option is used that determines the randomization of the
@@ -6411,7 +6441,11 @@ sub scantron_process_corrections {
 	}
     }
     if ($err) {
-	$r->print("<span class=\"LC_warning\">Unable to accept last correction, an error occurred :$errmsg:</span>");
+        $r->print(
+            '<p class="LC_error">'
+           .&mt('Unable to accept last correction, an error occurred: [_1]',
+                $errmsg)
+           .'</p>');
     } else {
 	&scantron_put_line($scanlines,$scan_data,$which,$line,$skip);
 	&scantron_putfile($scanlines,$scan_data);
@@ -6547,7 +6581,7 @@ sub scantron_warning_screen {
     return ('
 <p>
 <span class="LC_warning">
-'.&mt('Please double check the information below before clicking on \'[_1]\'',&mt($button_text)).'</span>
+'.&mt("Please double check the information below before clicking on '[_1]'",&mt($button_text)).'</span>
 </p>
 <table>
 <tr><td><b>'.&mt('Sequence to be Graded:').'</b></td><td>'.$title.'</td></tr>
@@ -6659,7 +6693,7 @@ sub scantron_validate_file {
     if (!$symb) {return '';}
     my $default_form_data=&defaultFormData($symb);
     
-    # do the detection of only doing skipped records first befroe we delete
+    # do the detection of only doing skipped records first before we delete
     # them when doing the corrections reset
     if ($env{'form.scantron_options_redo'} ne 'redo_skipped_ready') {
 	&reset_skipping_status();
@@ -8859,7 +8893,7 @@ sub checkscantron_results {
 
     my $count=&get_todo_count($scanlines,$scan_data);
     my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,$count);
-    my ($username,$domain,$started,%ordered);
+    my ($username,$domain,$started);
     &scantron_get_maxbubble(\$nav_error,\%scantron_config); # Need the bubble lines array to parse.
     if ($nav_error) {
         $r->print(&navmap_errormsg());
@@ -9782,7 +9816,7 @@ ENDHEADER
              &mt('Found [_1] registered and [_2] unregistered clickers.',$student_count,$unknown_count);
     if (($env{'form.gradingmechanism'} ne 'attendance') && ($env{'form.gradingmechanism'} ne 'given')) {
        if ($correct_count==0) {
-          $errormsg.="Found no correct answers answers for grading!";
+          $errormsg.="Found no correct answers for grading!";
        } elsif ($correct_count>1) {
           $result.='<br /><span class="LC_warning">'.&mt("Found [_1] entries for grading!",$correct_count).'</span>';
        }
@@ -9954,7 +9988,7 @@ sub assign_clicker_grades {
        if ($user) {
           if ($users{$user}) {
              $result.='<br /><span class="LC_warning">'.
-                      &mt("More than one entry found for <tt>[_1]</tt>!",$user).
+                      &mt('More than one entry found for [_1]!','<tt>'.$user.'</tt>').
                       '</span><br />';
           }
           $users{$user}=1;