--- loncom/homework/grades.pm	2010/04/13 10:21:21	1.614
+++ loncom/homework/grades.pm	2010/04/14 00:38:09	1.618
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.614 2010/04/13 10:21:21 www Exp $
+# $Id: grades.pm,v 1.618 2010/04/14 00:38:09 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -808,17 +808,18 @@ sub verifyreceipt {
 #--- Also called directly when one clicks on the subm button 
 #    on the problem page.
 sub listStudents {
-    my ($request,$symb) = @_;
+    my ($request,$symb,$submitonly) = @_;
 
     my $cdom      = $env{"course.$env{'request.course.id'}.domain"};
     my $cnum      = $env{"course.$env{'request.course.id'}.num"};
     my $getsec    = $env{'form.section'} eq '' ? 'all' : $env{'form.section'};
     my $getgroup  = $env{'form.group'} eq '' ? 'all' : $env{'form.group'};
-    my $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'};
-    my $viewgrade = $env{'form.showgrading'} eq 'yes' ? 'View/Grade/Regrade' : 'View';
+    unless ($submitonly) {
+       $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'};
+    }
 
     my $result='<h3><span class="LC_info">&nbsp;'
-	.&mt("$viewgrade Submissions for a Student or a Group of Students")
+	.&mt("View/Grade/Regrade Submissions for a Student or a Group of Students")
 	.'</span></h3>';
 
     my ($partlist,$handgrade,$responseType) = &response_type($symb
@@ -918,11 +919,10 @@ LISTJAVASCRIPT
         &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".
 	'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
 	'<input type="hidden" name="saveStatusOld" value="'.$saveStatus.'" />'."\n";
 
-    if (exists($env{'form.gradingMenu'}) && exists($env{'form.Status'})) {
+    if (exists($env{'form.Status'})) {
 	$gradeTable .= '<input type="hidden" name="Status" value="'.$stu_status.'" />'."\n";
     } else {
         $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Student Status'))
@@ -937,7 +937,7 @@ LISTJAVASCRIPT
                   .&Apache::lonhtmlcommon::end_pick_box();
 
     $gradeTable .= '<p>'
-                  .&mt('To '.lc($viewgrade)." a submission or a group of submissions, click on the check box(es) next to the student's name(s). Then click on the Next button.")."\n"
+                  .&mt("To view/grade/regrade a submission or a group of submissions, click on the check box(es) next to the student's name(s). Then click on the Next button.")."\n"
                   .'<input type="hidden" name="command" value="processGroup" />'
                   .'</p>';
 
@@ -954,9 +954,7 @@ LISTJAVASCRIPT
     while ($loop < 2) {
 	$gradeTable.='<th>'.&mt('No.').'</th><th>'.&mt('Select').'</th>'.
 	    '<th>'.&nameUserString('header').'&nbsp;'.&mt('Section/Group').'</th>';
-	if ($env{'form.showgrading'} eq 'yes' 
-	    && $submitonly ne 'queued'
-	    && $submitonly ne 'all') {
+	if (($submitonly ne 'queued') && ($submitonly ne 'all')) {
 	    foreach my $part (sort(@$partlist)) {
 		my $display_part=
 		    &get_display_part((split(/_/,$part))[0],$symb);
@@ -992,9 +990,7 @@ LISTJAVASCRIPT
 	    $status{'gradingqueue'} = $queue_status{'gradingqueue'};
 	}
 
-	if ($env{'form.showgrading'} eq 'yes' 
-	    && $submitonly ne 'queued'
-	    && $submitonly ne 'all') {
+	if (($submitonly ne 'queued') && ($submitonly ne 'all')) {
 	    (%status) =&student_gradeStatus($symb,$udom,$uname,$partlist);
 	    my $submitted = 0;
 	    my $graded = 0;
@@ -1035,7 +1031,7 @@ LISTJAVASCRIPT
 	       &nameUserString(undef,$$fullname{$student},$uname,$udom).
 	       '&nbsp;'.$section.($group ne '' ?'/'.$group:'').'</td>'."\n";
 
-	    if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
+	    if ($submitonly ne 'all') {
 		foreach (sort(keys(%status))) {
 		    next if ($_ =~ /^resource.*?submitted_by$/);
 		    $gradeTable.='<td align="center">&nbsp;'.&mt($status{$_}).'&nbsp;</td>'."\n";
@@ -1049,9 +1045,7 @@ LISTJAVASCRIPT
     }
     if ($ctr%2 ==1) {
 	$gradeTable.='<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>';
-	    if ($env{'form.showgrading'} eq 'yes' 
-		&& $submitonly ne 'queued'
-		&& $submitonly ne 'all') {
+	    if (($submitonly ne 'queued') && ($submitonly ne 'all')) {
 		foreach (@$partlist) {
 		    $gradeTable.='<td>&nbsp;</td>';
 		}
@@ -1283,7 +1277,6 @@ sub sub_page_js {
 	    
 	}
 	if (val == "Grade Student") {
-	    formname.showgrading.value = "yes";
 	    if (formname.Status.value == "") {
 		formname.Status.value = "Active";
 	    }
@@ -1958,7 +1951,6 @@ sub submission {
 			'<input type="hidden" name="studentNo"  value="" />'."\n".
 			'<input type="hidden" name="gradeOpt"   value="" />'."\n".
 			'<input type="hidden" name="symb"       value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
-			'<input type="hidden" name="showgrading" value="'.$env{'form.showgrading'}.'" />'."\n".
 			'<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".
@@ -1992,7 +1984,7 @@ sub submission {
 	}
 	$request->print($prnmsg);
 
-	if ($env{'form.handgrade'} eq 'yes' && $env{'form.showgrading'} eq 'yes') {
+	if ($env{'form.handgrade'} eq 'yes') {
 #
 # Print out the keyword options line
 #
@@ -2204,9 +2196,7 @@ KEYWORDS
 	}
 	$request->print($lastsubonly);
    } elsif ($env{'form.lastSub'} eq 'datesub') {
-#	my (undef,$responseType,undef,$parts) = &showResourceInfo($symb);
-    my ($parts,$handgrade,$responseType) = &response_type($symb);
-
+        my ($parts,$handgrade,$responseType) = &response_type($symb);
 	$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,
@@ -2218,7 +2208,7 @@ KEYWORDS
     $request->print('<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':'
 	.$udom.'" />'."\n");
     # return if view submission with no grading option
-    if ($env{'form.showgrading'} eq '' || (!&canmodify($usec))) {
+    if (!&canmodify($usec)) {
 	my $toGrade.='<input type="button" value="Grade Student" '.
 	    'onclick="javascript:checksubmit(this.form,\'Grade Student\',\''
 	    .$counter.'\');" target="_self" /> &nbsp;'."\n" if (&canmodify($usec));
@@ -8382,9 +8372,7 @@ sub grading_menu {
     if (!$symb) {return '';}
 
     my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb),
-                  'command'=>'individual',
-                  'gradingMenu'=>1,
-                  'showgrading'=>"yes");
+                  'command'=>'individual');
     
     my $url1a = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
 
@@ -8430,7 +8418,7 @@ sub grading_menu {
                                 icon => 'edit-find-replace.png',
                                 linktitle => 'Grade current resource for all students.'
                         },
-                        {       linktext => 'Grade complete page/sequence/folder for one student',
+                        {       linktext => 'Grade page/folder for one student',
                                 url => $url1d,
                                 permission => 'F',
                                 icon => 'edit-find-replace.png',
@@ -8457,7 +8445,7 @@ sub grading_menu {
                     		icon => 'stat.png',
                     		linktitle => 'Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.'
                 	    },
-                            {   linktext => 'Verify Receipt No.',
+                            {   linktext => 'Verify Receipt Number',
                                 url => $url5,
                                 permission => 'F',
                                 icon => 'edit-find-replace.png',
@@ -8471,9 +8459,7 @@ sub grading_menu {
     my $Str;
     $Str .= '<form method="post" action="" name="gradingMenu">';
     $Str .= '<input type="hidden" name="command" value="" />'.
-    	'<input type="hidden" name="symb"        value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
-	'<input type="hidden" name="gradingMenu" value="1" />'."\n".
-	'<input type="hidden" name="showgrading" value="yes" />'."\n";
+    	'<input type="hidden" name="symb"        value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n";
 
     $Str .= &Apache::lonhtmlcommon::generate_menu(@menu);
     return $Str;    
@@ -8492,13 +8478,10 @@ sub submit_options_sequence {
     my $result;
 
     $result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n".
-        '<input type="hidden" name="symb"        value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
-        '<input type="hidden" name="gradingMenu" value="1" />'."\n".
-        '<input type="hidden" name="showgrading" value="yes" />'."\n";
-
+        '<input type="hidden" name="symb"        value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n";
     $result.='
 <h2>
-  '.&mt('Grade complete page/sequence/folder for one student').'
+  '.&mt('Grade page/folder for one student').'
 </h2>'.
             &selectfield(0).
             '<input type="hidden" name="command" value="pickStudentPage" />
@@ -8517,9 +8500,7 @@ sub submit_options_table {
     my $result;
 
     $result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n".
-        '<input type="hidden" name="symb"        value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
-        '<input type="hidden" name="gradingMenu" value="1" />'."\n".
-        '<input type="hidden" name="showgrading" value="yes" />'."\n";
+        '<input type="hidden" name="symb"        value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n";
 
     $result.='
 <h2>
@@ -8546,10 +8527,7 @@ sub submit_options {
     my $result;
 
     $result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n".
-	'<input type="hidden" name="symb"        value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
-	'<input type="hidden" name="gradingMenu" value="1" />'."\n".
-	'<input type="hidden" name="showgrading" value="yes" />'."\n";
-
+	'<input type="hidden" name="symb"        value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n";
     $result.='
 <h2>
   '.&mt('Select individual students to grade').'
@@ -9194,13 +9172,20 @@ sub handler {
             &startpage($request,$symb,[{href=>"", text=>"Student Submissions"}]);
 	    ($env{'form.student'} eq '' ? &listStudents($request,$symb) : &submission($request,0,0,$symb));
 	} elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>&href_symb_cmd($symb,'all_for_one'),text=>'Grade page/folder for one student'},
+                                       {href=>'',text=>'Select student'}],1,1);
 	    &pickStudentPage($request,$symb);
 	} elsif ($command eq 'displayPage' && $perm{'vgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,
+                                      [{href=>&href_symb_cmd($symb,'all_for_one'),text=>'Grade page/folder for one student'},
+                                       {href=>'',text=>'Select student'},
+                                       {href=>'',text=>'Grade student'}],1,1);
 	    &displayPage($request,$symb);
 	} elsif ($command eq 'gradeByPage' && $perm{'mgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>&href_symb_cmd($symb,'all_for_one'),text=>'Grade page/folder for one student'},
+                                       {href=>'',text=>'Select student'},
+                                       {href=>'',text=>'Grade student'},
+                                       {href=>'',text=>'Store grades'}],1,1);
 	    &updateGradeByPage($request,$symb);
 	} elsif ($command eq 'processGroup' && $perm{'vgr'}) {
             &startpage($request,$symb);
@@ -9209,16 +9194,16 @@ sub handler {
             &startpage($request,$symb);
 	    $request->print(&grading_menu($request,$symb));
 	} elsif ($command eq 'individual' && $perm{'vgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'',text=>'Select individual students to grade'}]);
 	    $request->print(&submit_options($request,$symb));
         } elsif ($command eq 'ungraded' && $perm{'vgr'}) {
-            &startpage($request,$symb);
-            $request->print(&submit_options($request,$symb));
+            &startpage($request,$symb,[{href=>'',text=>'Grade ungraded submissions'}]);
+            $request->print(&listStudents($request,$symb,'graded'));
         } elsif ($command eq 'table' && $perm{'vgr'}) {
             &startpage($request,$symb,[{href=>"", text=>"Grading table"}]);
             $request->print(&submit_options_table($request,$symb));
         } elsif ($command eq 'all_for_one' && $perm{'vgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'',text=>'Grade page/folder for one student'}],1,1);
             $request->print(&submit_options_sequence($request,$symb));
 	} elsif ($command eq 'viewgrades' && $perm{'vgr'}) {
             &startpage($request,$symb,[{href=>&href_symb_cmd($symb,"table"), text=>"Grading table"},{href=>'', text=>"Modify grades"}]);
@@ -9233,32 +9218,36 @@ sub handler {
                                        {href=>'', text=>"Store grades"}]);
 	    $request->print(&editgrades($request,$symb));
         } elsif ($command eq 'initialverifyreceipt' && $perm{'vgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'',text=>'Verify Receipt Number'}]);
             $request->print(&initialverifyreceipt($request,$symb));
 	} elsif ($command eq 'verify' && $perm{'vgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>&href_symb_cmd($symb,"initialverifyreceipt"),text=>'Verify Receipt Number'},
+                                       {href=>'',text=>'Verification Result'}]);
 	    $request->print(&verifyreceipt($request,$symb));
         } elsif ($command eq 'processclicker' && $perm{'mgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'', text=>'Process clicker'}]);
             $request->print(&process_clicker($request,$symb));
         } elsif ($command eq 'processclickerfile' && $perm{'mgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>&href_symb_cmd($symb,'processclicker'), text=>'Process clicker'},
+                                       {href=>'', text=>'Process clicker file'}]);
             $request->print(&process_clicker_file($request,$symb));
         } elsif ($command eq 'assignclickergrades' && $perm{'mgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>&href_symb_cmd($symb,'processclicker'), text=>'Process clicker'},
+                                       {href=>'', text=>'Process clicker file'},
+                                       {href=>'', text=>'Store grades'}]);
             $request->print(&assign_clicker_grades($request,$symb));
 	} elsif ($command eq 'csvform' && $perm{'mgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
 	    $request->print(&upcsvScores_form($request,$symb));
 	} elsif ($command eq 'csvupload' && $perm{'mgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
 	    $request->print(&csvupload($request,$symb));
 	} elsif ($command eq 'csvuploadmap' && $perm{'mgr'} ) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
 	    $request->print(&csvuploadmap($request,$symb));
 	} elsif ($command eq 'csvuploadoptions' && $perm{'mgr'}) {
 	    if ($env{'form.associate'} ne 'Reverse Association') {
-                &startpage($request,$symb);
+                &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
 		$request->print(&csvuploadoptions($request,$symb));
 	    } else {
 		if ( $env{'form.upfile_associate'} ne 'reverse' ) {
@@ -9266,40 +9255,40 @@ sub handler {
 		} else {
 		    $env{'form.upfile_associate'} = 'forward';
 		}
-                &startpage($request,$symb);
+                &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
 		$request->print(&csvuploadmap($request,$symb));
 	    }
 	} elsif ($command eq 'csvuploadassign' && $perm{'mgr'} ) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
 	    $request->print(&csvuploadassign($request,$symb));
 	} elsif ($command eq 'scantron_selectphase' && $perm{'mgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
 	    $request->print(&scantron_selectphase($request,undef,$symb));
  	} elsif ($command eq 'scantron_warning' && $perm{'mgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
  	    $request->print(&scantron_do_warning($request,$symb));
 	} elsif ($command eq 'scantron_validate' && $perm{'mgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
 	    $request->print(&scantron_validate_file($request,$symb));
 	} elsif ($command eq 'scantron_process' && $perm{'mgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
 	    $request->print(&scantron_process_students($request,$symb));
  	} elsif ($command eq 'scantronupload' && 
  		 (&Apache::lonnet::allowed('usc',$env{'request.role.domain'})||
 		  &Apache::lonnet::allowed('usc',$env{'request.course.id'}))) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
  	    $request->print(&scantron_upload_scantron_data($request,$symb)); 
  	} elsif ($command eq 'scantronupload_save' &&
  		 (&Apache::lonnet::allowed('usc',$env{'request.role.domain'})||
 		  &Apache::lonnet::allowed('usc',$env{'request.course.id'}))) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
  	    $request->print(&scantron_upload_scantron_data_save($request,$symb));
  	} elsif ($command eq 'scantron_download' &&
 		 &Apache::lonnet::allowed('usc',$env{'request.course.id'})) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
  	    $request->print(&scantron_download_scantron_data($request,$symb));
         } elsif ($command eq 'checksubmissions' && $perm{'vgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1);
             $request->print(&checkscantron_results($request,$symb));     
 	} elsif ($command) {
             &startpage($request,$symb);