--- loncom/homework/grades.pm 2003/07/18 20:14:35 1.119 +++ loncom/homework/grades.pm 2003/07/19 15:11:27 1.120 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.119 2003/07/18 20:14:35 ng Exp $ +# $Id: grades.pm,v 1.120 2003/07/19 15:11:27 ng Exp $ # # Copyright Michigan State University Board of Trustees # @@ -707,9 +707,10 @@ sub sub_page_js { } function checkSolved(formname,id) { - if (eval("formname.solved"+id+".value") == "correct_by_student") { + if (eval("formname.solved"+id+".value") == "correct_by_student" && formname.overRideScore.value == 'no') { var reply = confirm("This problem has been graded correct by the computer. Do you want to change the score?"); if (!reply) {return "noupdate";} + formname.overRideScore.value = 'yes'; } return "update"; } @@ -747,6 +748,14 @@ sub sub_page_js { formname.submit(); } +//======= Process request to show the grading page from SUBM, CHART buttons + function gradeStudent(formname,ptr) { + formname.gradeOpt.value = 'Grade Student'; + formname.showgrading.value = "yes"; + formname.studentNo.value = ptr; + formname.submit(); + } + //======= Check that a score is assigned for all the problems (page/sequence grading only) ========= function checkSubmitPage(formname,total) { noscore = new Array(100); @@ -1160,6 +1169,7 @@ sub submission { (my $url=$ENV{'form.url'})=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; my ($uname,$udom) = ($ENV{'form.student'},$ENV{'form.userdom'}); + $udom = ($udom eq '' ? $ENV{'user.domain'} : $udom); #has form.userdom changed for a student? my $usec = &Apache::lonnet::getsection($udom,$uname,$ENV{'request.course.id'}); $ENV{'form.fullname'} = &get_fullname ($uname,$udom) if $ENV{'form.fullname'} eq ''; @@ -1173,6 +1183,7 @@ sub submission { return; } + $ENV{'form.lastSub'} = ($ENV{'form.lastSub'} eq '' ? 'all' : $ENV{'form.lastSub'}); my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : ''); # header info @@ -1217,13 +1228,17 @@ sub submission { $ENV{'form.savemsgN'} = $keyhash{$symb.'_savemsgN'} ne '' ? $keyhash{$symb.'_savemsgN'} : '0'; } + my $overRideScore = $ENV{'form.overRideScore'} eq '' ? 'no' : $ENV{'form.overRideScore'}; $request->print('
'."\n". ''."\n". ''."\n". ''."\n". + ''."\n". ''."\n". ''."\n". + ''."\n". + ''."\n". ''."\n". ''."\n". ''."\n". @@ -1279,7 +1294,6 @@ KEYWORDS $request->print('


') if ($counter > 0); $request->print(&show_problem($request,$symb,$uname,$udom,1,1)); } - my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); my ($partlist,$handgrade) = &response_type($url); @@ -1426,20 +1440,25 @@ KEYWORDS $last,'.submission', 'Apache::grades::keywords_highlight')); } + + $result=''."\n". + ''."\n". + ''."\n"; + $request->print($result); # return if view submission with no grading option if ($ENV{'form.showgrading'} eq '' || (!&canmodify($usec))) { - $request->print('
'."\n"); - $request->print(&show_grading_menu_form($symb,$url)) + my $toGrade.='  '."\n"; + $toGrade.=''."\n"; + $toGrade.=&show_grading_menu_form($symb,$url) if (($ENV{'form.command'} eq 'submission') || ($ENV{'form.command'} eq 'processGroup' && $counter == $total)); + $request = print($toGrade); return; } - $result=''."\n". - ''."\n". - ''."\n"; # essay grading options if ($ENV{'form.handgrade'} eq 'yes') { my ($lastname,$givenn) = split(/,/,$ENV{'form.fullname'}); @@ -1450,7 +1469,7 @@ KEYWORDS } $msgfor =~ s/\'/\\'/g; #' stupid emacs - no! javascript # $result.=''."\n". - $result.=' '. 'Compose Message to student'.(scalar(@col_fullnames) >= 1 ? 's' : '').'  '. ''. - ''."\n"; + my $endform='
'."\n"; +# ''."\n"; $endform.='  '."\n"; @@ -1554,7 +1573,6 @@ sub processHandGrade { my $button = $ENV{'form.gradeOpt'}; my $ngrade = $ENV{'form.NCT'}; my $ntstu = $ENV{'form.NTSTU'}; - if ($button eq 'Save & Next') { my $ctr = 0; while ($ctr < $ngrade) { @@ -1668,6 +1686,15 @@ sub processHandGrade { return ''; } +# Go directly to grade student - from submission page + if ($button eq 'Grade Student') { + my $processUser = $ENV{'form.unamedom'.$ENV{'form.studentNo'}}; + ($ENV{'form.student'},$ENV{'form.userdom'}) = split(/:/,$processUser); + $ENV{'form.fullname'} = $$fullname{$processUser}; + &submission($request,0,0); + return ''; + } + # Get the next/previous one or group of students my $firststu = $ENV{'form.unamedom0'}; my $laststu = $ENV{'form.unamedom'.($ngrade-1)}; @@ -2779,7 +2806,8 @@ sub displayPage { if($curRes == $iterator->BEGIN_MAP) { $depth++; } if($curRes == $iterator->END_MAP) { $depth--; } - if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) { +# if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) { + if (ref($curRes) && $curRes->is_problem()) { my $parts = $curRes->parts(); my $title = $curRes->compTitle(); my $symbx = $curRes->symb();