--- loncom/homework/grades.pm	2005/01/10 18:56:19	1.237
+++ loncom/homework/grades.pm	2005/01/29 00:09:54	1.239
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.237 2005/01/10 18:56:19 albertel Exp $
+# $Id: grades.pm,v 1.239 2005/01/29 00:09:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3796,25 +3796,49 @@ sub scantron_parse_scanline {
 	my $currentquest=substr($questions,0,$$scantron_config{'Qlength'});
 	substr($questions,0,$$scantron_config{'Qlength'})='';
 	if (length($currentquest) < $$scantron_config{'Qlength'}) { next; }
-	my @array=split($$scantron_config{'Qon'},$currentquest,-1);
-	if (length($array[0]) eq $$scantron_config{'Qlength'}) {
-	    $record{"scantron.$questnum.answer"}='';
-	    if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {
-		push(@{$record{"scantron.missingerror"}},$questnum);
- 	    }
+	if ($$scantron_config{'Qon'} eq 'letter') {
+	    if (!$currentquest || $currentquest eq $$scantron_config{'Qoff'} ||
+		$currentquest !~ /^[A-Z]$/) {
+		$record{"scantron.$questnum.answer"}='';
+		if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {
+		    push(@{$record{"scantron.missingerror"}},$questnum);
+		}
+	    } else {
+		$record{"scantron.$questnum.answer"}=$currentquest;
+	    }
+	} elsif ($$scantron_config{'Qon'} eq 'number') {
+	    if (!$currentquest || $currentquest eq $$scantron_config{'Qoff'} ||
+		$currentquest !~ /^\d$/) {
+		$record{"scantron.$questnum.answer"}='';
+		if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {
+		    push(@{$record{"scantron.missingerror"}},$questnum);
+		}
+	    } else {
+		$record{"scantron.$questnum.answer"}=
+		    $alphabet[$currentquest-1];
+	    }
 	} else {
-	    $record{"scantron.$questnum.answer"}=$alphabet[length($array[0])];
+	    my @array=split($$scantron_config{'Qon'},$currentquest,-1);
+	    if (length($array[0]) eq $$scantron_config{'Qlength'}) {
+		$record{"scantron.$questnum.answer"}='';
+		if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {
+		    push(@{$record{"scantron.missingerror"}},$questnum);
+		}
+	    } else {
+		$record{"scantron.$questnum.answer"}=
+		    $alphabet[length($array[0])];
+	    }
+	    if (scalar(@array) gt 2) {
+		push(@{$record{'scantron.doubleerror'}},$questnum);
+		my @ans=@array;
+		my $i=length($ans[0]);shift(@ans);
+		while ($#ans) {
+		    $i+=length($ans[0])+1;
+		    $record{"scantron.$questnum.answer"}.=$alphabet[$i];
+		    shift(@ans);
+		}
+	    }
 	}
- 	if (scalar(@array) gt 2) {
- 	    push(@{$record{'scantron.doubleerror'}},$questnum);
- 	    my @ans=@array;
- 	    my $i=length($ans[0]);shift(@ans);
-	    while ($#ans) {
- 		$i+=length($ans[0])+1;
- 		$record{"scantron.$questnum.answer"}.=$alphabet[$i];
- 		shift(@ans);
- 	    }
- 	}
     }
     $record{'scantron.maxquest'}=$questnum;
     return \%record;
@@ -4824,7 +4848,6 @@ DOWNLOAD
 #
 #-------------------------------------------------------------------
 
-
 #-------------------------- Menu interface -------------------------
 #
 #--- Show a Grading Menu button - Calls the next routine ---
@@ -4877,6 +4900,7 @@ sub gradingmenu {
 	    if (!checkReceiptNo(formname,'notOK')) { return false;}
 	    formname.submit();
 	}
+	if (val < 7) formname.submit();
     }
 
     function checkReceiptNo(formname,nospace) {
@@ -4929,7 +4953,7 @@ GRADINGMENUJS
 		($saveSec eq $_ ? 'selected="on"':'').'>'.$_.'</option>'."\n";
 	}
     }
-    $result.= '<option value="all" '.($saveSec eq 'all' ? 'selected="on"' : ''). '>all</select> &nbsp; ';
+    $result.= '<option value="all" '.($saveSec eq 'all' ? 'selected="on"' : ''). '>all</option></select> &nbsp; ';
 
     $result.=&mt('Student Status').':</b>'.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,undef);
 
@@ -4981,6 +5005,9 @@ GRADINGMENUJS
 	    '-<input type="text" name="receipt" size="4" onChange="javascript:checkReceiptNo(this.form,\'OK\')">'.
 	    '</td></tr>'."\n";
     } 
+    $result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'.
+	'<input type="button" onClick="javascript:this.form.action=\'/adm/helper/resettimes.helper\';this.form.submit();'.
+	'" value="'.&mt('Manage').'" /> access times.</td></tr>'."\n";
 
     $result.='</form></td></tr></table>'."\n".
 	'</td></tr></table>'."\n".