--- loncom/homework/grades.pm 2010/04/13 13:48:48 1.616 +++ loncom/homework/grades.pm 2010/04/14 15:04:58 1.619 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.616 2010/04/13 13:48:48 www Exp $ +# $Id: grades.pm,v 1.619 2010/04/14 15:04:58 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='

 ' - .&mt("$viewgrade Submissions for a Student or a Group of Students") + .&mt("View/Grade/Regrade Submissions for a Student or a Group of Students") .'

'; my ($partlist,$handgrade,$responseType) = &response_type($symb @@ -918,11 +919,10 @@ LISTJAVASCRIPT &build_section_inputs(). ''."\n". '
'."\n". - '
'."\n". ''."\n". ''."\n"; - if (exists($env{'form.gradingMenu'}) && exists($env{'form.Status'})) { + if (exists($env{'form.Status'})) { $gradeTable .= ''."\n"; } else { $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Student Status')) @@ -937,7 +937,7 @@ LISTJAVASCRIPT .&Apache::lonhtmlcommon::end_pick_box(); $gradeTable .= '

' - .&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" .'' .'

'; @@ -954,9 +954,7 @@ LISTJAVASCRIPT while ($loop < 2) { $gradeTable.=''.&mt('No.').''.&mt('Select').''. ''.&nameUserString('header').' '.&mt('Section/Group').''; - 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). ' '.$section.($group ne '' ?'/'.$group:'').''."\n"; - if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') { + if ($submitonly ne 'all') { foreach (sort(keys(%status))) { next if ($_ =~ /^resource.*?submitted_by$/); $gradeTable.=' '.&mt($status{$_}).' '."\n"; @@ -1049,9 +1045,7 @@ LISTJAVASCRIPT } if ($ctr%2 ==1) { $gradeTable.='   '; - if ($env{'form.showgrading'} eq 'yes' - && $submitonly ne 'queued' - && $submitonly ne 'all') { + if (($submitonly ne 'queued') && ($submitonly ne 'all')) { foreach (@$partlist) { $gradeTable.=' '; } @@ -1135,7 +1129,7 @@ sub check_buttons { # Displays the submissions for one student or a group of students sub processGroup { - my ($request) = shift; + my ($request,$symb) = @_; my $ctr = 0; my @stuchecked = &Apache::loncommon::get_env_multiple('form.stuinfo'); my $total = scalar(@stuchecked)-1; @@ -1145,7 +1139,7 @@ sub processGroup { $env{'form.student'} = $uname; $env{'form.userdom'} = $udom; $env{'form.fullname'} = $fullname; - &submission($request,$ctr,$total); + &submission($request,$ctr,$total,$symb); $ctr++; } return ''; @@ -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 { ''."\n". ''."\n". ''."\n". - ''."\n". ''."\n". ''."\n". ''."\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,8 @@ KEYWORDS $request->print(''."\n"); # return if view submission with no grading option - if ($env{'form.showgrading'} eq '' || (!&canmodify($usec))) { +# FIXME: the logic seems off here. Why show the grade button if you cannot grade? + if (!&canmodify($usec)) { my $toGrade.='  '."\n" if (&canmodify($usec)); @@ -8382,9 +8373,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); @@ -8471,9 +8460,7 @@ sub grading_menu { my $Str; $Str .= '
'; $Str .= ''. - ''."\n". - ''."\n". - ''."\n"; + ''."\n"; $Str .= &Apache::lonhtmlcommon::generate_menu(@menu); return $Str; @@ -8492,10 +8479,7 @@ sub submit_options_sequence { my $result; $result.=''."\n". - ''."\n". - ''."\n". - ''."\n"; - + ''."\n"; $result.='

'.&mt('Grade page/folder for one student').' @@ -8517,9 +8501,7 @@ sub submit_options_table { my $result; $result.=''."\n". - ''."\n". - ''."\n". - ''."\n"; + ''."\n"; $result.='

@@ -8546,10 +8528,7 @@ sub submit_options { my $result; $result.=''."\n". - ''."\n". - ''."\n". - ''."\n"; - + ''."\n"; $result.='

'.&mt('Select individual students to grade').' @@ -9210,17 +9189,18 @@ sub handler { {href=>'',text=>'Store grades'}],1,1); &updateGradeByPage($request,$symb); } elsif ($command eq 'processGroup' && $perm{'vgr'}) { - &startpage($request,$symb); + &startpage($request,$symb,[{href=>'',text=>'...'}, + {href=>'',text=>'Modify grades'}]); &processGroup($request,$symb); } elsif ($command eq 'gradingmenu' && $perm{'vgr'}) { &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));