--- loncom/homework/grades.pm	2004/09/29 05:45:34	1.204.2.7
+++ loncom/homework/grades.pm	2004/08/06 22:06:14	1.207
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.204.2.7 2004/09/29 05:45:34 albertel Exp $
+# $Id: grades.pm,v 1.207 2004/08/06 22:06:14 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -365,27 +365,36 @@ sub getclasslist {
     #
     my %sections;
     my %fullnames;
-    foreach (keys(%$classlist)) {
-        # the following undefs are for 'domain', and 'username' respectively.
-	my (undef,undef,$end,$start,$id,$section,$fullname,$status)=
-            @{$classlist->{$_}};
+    foreach my $student (keys(%$classlist)) {
+        my $end      = 
+            $classlist->{$student}->[&Apache::loncoursedata::CL_END()];
+        my $start    = 
+            $classlist->{$student}->[&Apache::loncoursedata::CL_START()];
+        my $id       = 
+            $classlist->{$student}->[&Apache::loncoursedata::CL_ID()];
+        my $section  = 
+            $classlist->{$student}->[&Apache::loncoursedata::CL_SECTION()];
+        my $fullname = 
+            $classlist->{$student}->[&Apache::loncoursedata::CL_FULLNAME()];
+        my $status   = 
+            $classlist->{$student}->[&Apache::loncoursedata::CL_STATUS()];
 	# filter students according to status selected
 	if ($filterlist && $ENV{'form.Status'} ne 'Any') {
 	    if ($ENV{'form.Status'} ne $status) {
-		delete ($classlist->{$_});
+		delete ($classlist->{$student});
 		next;
 	    }
 	}
-	$section = ($section ne '' ? $section : 'no');
+	$section = ($section ne '' ? $section : 'none');
 	if (&canview($section)) {
 	    if ($getsec eq 'all' || $getsec eq $section) {
 		$sections{$section}++;
-		$fullnames{$_}=$fullname;
+		$fullnames{$student}=$fullname;
 	    } else {
-		delete($classlist->{$_});
+		delete($classlist->{$student});
 	    }
 	} else {
-	    delete($classlist->{$_});
+	    delete($classlist->{$student});
 	}
     }
     my %seen = ();
@@ -2320,7 +2329,7 @@ sub viewgrades {
     my $sectionClass;
     if ($ENV{'form.section'} eq 'all') {
 	$sectionClass='Class </h3>';
-    } elsif ($ENV{'form.section'} eq 'no') {
+    } elsif ($ENV{'form.section'} eq 'none') {
 	$sectionClass='Students in no Section </h3>';
     } else {
 	$sectionClass='Students in Section '.$ENV{'form.section'}.'</h3>';
@@ -3846,8 +3855,7 @@ sub scantron_find_student {
 
 sub scantron_filter {
     my ($curres)=@_;
-                        # randomout is dysfunctional at best for this purpose
-    if (ref($curres) && $curres->is_problem()) { #&& !$curres->randomout) {
+    if (ref($curres) && $curres->is_problem() && !$curres->randomout) {
 	return 1;
     }
     return 0;
@@ -3999,7 +4007,7 @@ sub scantron_form_start {
   <input type="hidden" name="selectpage" value="$ENV{'form.selectpage'}" />
   <input type="hidden" name="scantron_format" value="$ENV{'form.scantron_format'}" />
   <input type="hidden" name="scantron_selectfile" value="$ENV{'form.scantron_selectfile'}" />
-  <input type="hidden" name="scantron_maxbubble" value="$max_bubble" />
+  <input type="hidden" name="scantron_maxbubble" value="$max_bubble'" />
   <input type="hidden" name="scantron_CODElist" value="$ENV{'form.scantron_CODElist'}" />
   <input type="hidden" name="scantron_CODEunique" value="$ENV{'form.scantron_CODEunique'}" />
   <input type="hidden" name="scantron_options_redo" value="$ENV{'form.scantron_options_redo'}" />
@@ -4472,8 +4480,7 @@ sub scantron_validate_CODE {
 				     $line,'incorrectCODE',\%allcodes);
 	    return(1,$currentphase);
 	}
-	if (exists($usedCODEs{$CODE}) 
-	    && $ENV{'form.scantron_CODEunique'} eq 'yes'
+	if (exists($usedCODEs{$CODE}) && $ENV{'form.scantron_CODEunique'}
 	    && !$$scan_record{'scantron.CODE_ignore_dup'}) {
 	    &scantron_get_correction($r,$i,$scan_record,
 				     \%scantron_config,
@@ -4640,10 +4647,9 @@ SCANTRONFORM
 		$form{'CODE'}=$scan_record->{'scantron.CODE'};
 	    }
 	    my $result=&Apache::lonnet::ssi($resource->src(),%form);
-	    if (&Apache::loncommon::connection_aborted($r)) { last; }
+
 	}
 	$completedstudents{$uname}={'line'=>$line};
-	if (&Apache::loncommon::connection_aborted($r)) { last; }
     } continue {
 	&Apache::lonnet::delenv('form.counter');
 	&Apache::lonnet::delenv('scantron\.');
@@ -4907,9 +4913,6 @@ GRADINGMENUJS
 
     $result.=&mt('Student Status').':</b>'.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,undef);
 
-    if (ref($sections) && (grep /no/,@$sections)) {
-	$result.='&nbsp;(Section "no" implies the students were not assigned a section.)<br />';
-    }
     $result.='</td></tr>';
 
     $result.='<tr bgcolor="#ffffe6"valign="top"><td>'.
@@ -5109,7 +5112,8 @@ sub send_header {
 
 sub send_footer {
     my ($request)= @_;
-    $request->print('</body></html>');
+    $request->print('</body>');
+    $request->print(&Apache::lontexconvert::footer());
 }
 
 1;