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

banghart lon-capa-cvs-allow@mail.lon-capa.org
Tue, 21 Aug 2007 22:21:55 -0000


banghart		Tue Aug 21 18:21:55 2007 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  	Bug 4058. Should now pass selected sections from page to page.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.431 loncom/homework/grades.pm:1.432
--- loncom/homework/grades.pm:1.431	Tue Aug 21 14:48:18 2007
+++ loncom/homework/grades.pm	Tue Aug 21 18:21:54 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.431 2007/08/21 18:48:18 banghart Exp $
+# $Id: grades.pm,v 1.432 2007/08/21 22:21:54 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -723,7 +723,6 @@
 
     my $saveStatus = $env{'form.Status'} eq '' ? 'Active' : $env{'form.Status'};
     $env{'form.Status'} = $saveStatus;
-
     $gradeTable.='<label><input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last submission only </label>'."\n".
 	'<label><input type="radio" name="lastSub" value="last" /> last submission & parts info </label>'."\n".
 	'<label><input type="radio" name="lastSub" value="datesub" /> by dates and submissions </label>'."\n".
@@ -734,8 +733,7 @@
         '<option value=".25">Quarter Points</option>'.
         '<option value=".1">Tenths of a Point</option>'.
         '</select>'.
-
-	'<input type="hidden" name="section"     value="'.$getsec.'" />'."\n".
+        &build_section_inputs().
 	'<input type="hidden" name="submitonly"  value="'.$submitonly.'" />'."\n".
 	'<input type="hidden" name="handgrade"   value="'.$env{'form.handgrade'}.'" /><br />'."\n".
 	'<input type="hidden" name="showgrading" value="'.$env{'form.showgrading'}.'" /><br />'."\n".
@@ -1661,6 +1659,19 @@
     return
 }
 
+sub build_section_inputs {
+    my $section_inputs;
+    if ($env{'form.section'} eq '') {
+        $section_inputs .= '<input type="hidden" name="section" value="all" />'."\n";
+    } else {
+        my @sections = &Apache::loncommon::get_env_multiple('form.section');
+        foreach my $section(@sections) {
+            $section_inputs .= '<input type="hidden" name="section" value="'.$section.'" />'."\n";
+        }
+    }
+    return $section_inputs;
+}
+
 # --------------------------- show submissions of a student, option to grade 
 sub submission {
     my ($request,$counter,$total) = @_;
@@ -1741,7 +1752,6 @@
 	    $env{'form.savemsgN'} = $keyhash{$symb.'_savemsgN'} ne '' ? $keyhash{$symb.'_savemsgN'} : '0';
 	}
 	my $overRideScore = $env{'form.overRideScore'} eq '' ? 'no' : $env{'form.overRideScore'};
-
 	$request->print('<form action="/adm/grades" method="post" name="SCORE" enctype="multipart/form-data">'."\n".
 			'<input type="hidden" name="command"    value="handgrade" />'."\n".
 			'<input type="hidden" name="saveState"  value="'.$env{'form.saveState'}.'" />'."\n".
@@ -1756,7 +1766,7 @@
 			'<input type="hidden" name="vProb"      value="'.$env{'form.vProb'}.'" />'."\n".
 			'<input type="hidden" name="vAns"       value="'.$env{'form.vAns'}.'" />'."\n".
 			'<input type="hidden" name="lastSub"    value="'.$env{'form.lastSub'}.'" />'."\n".
-			'<input type="hidden" name="section"    value="'.$env{'form.section'}.'" />'."\n".
+			&build_section_inputs().
 			'<input type="hidden" name="submitonly" value="'.$env{'form.submitonly'}.'" />'."\n".
 			'<input type="hidden" name="handgrade"  value="'.$env{'form.handgrade'}.'" />'."\n".
 			'<input type="hidden" name="NCT"'.
@@ -2965,7 +2975,7 @@
     $result.= '<form action="/adm/grades" method="post" name="classgrade">'."\n".
 	'<input type="hidden" name="symb"    value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
 	'<input type="hidden" name="command" value="editgrades" />'."\n".
-	'<input type="hidden" name="section" value="'.$env{'form.section'}.'" />'."\n".
+	&build_section_inputs().
 	'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n".
 	'<input type="hidden" name="Status" value="'.$env{'form.Status'}.'" />'."\n".
 	'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n";
@@ -3866,9 +3876,9 @@
 	'<label><input type="radio" name="lastSub" value="none" /> none</label>'."\n".
 	'<label><input type="radio" name="lastSub" value="datesub" checked="checked" /> by dates and submissions</label>'."\n".
 	'<label><input type="radio" name="lastSub" value="all" /> all details</label>'."\n";
-
-    $result.='<input type="hidden" name="section"     value="'.$getsec.'" />'."\n".
-	'<input type="hidden" name="Status"  value="'.$env{'form.Status'}.'" />'."\n".
+    
+    $result.=&build_section_inputs();
+    $result.='<input type="hidden" name="Status"  value="'.$env{'form.Status'}.'" />'."\n".
 	'<input type="hidden" name="command" value="displayPage" />'."\n".
 	'<input type="hidden" name="symb"    value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
 	'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."<br />\n";
@@ -7545,10 +7555,6 @@
 	}
     } else {
 	&init_perm();
-#	&Apache::lonnet::logthis("command is $command");
-#	foreach my $key (keys %perm) {
-#	    &Apache::lonnet::logthis("a key is $key");
-#	}
 	if ($command eq 'submission' && $perm{'vgr'}) {
 	    ($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0));
 	} elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) {