--- loncom/homework/grades.pm 2003/07/17 22:08:25 1.118 +++ loncom/homework/grades.pm 2003/07/21 13:32:49 1.121 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.118 2003/07/17 22:08:25 ng Exp $ +# $Id: grades.pm,v 1.121 2003/07/21 13:32:49 ng Exp $ # # Copyright Michigan State University Board of Trustees # @@ -140,7 +140,6 @@ sub showResourceInfo { #--- Currently filters option response type only. sub cleanRecord { my ($answer,$response) = @_; - $answer =~ s|^
||; if ($response eq 'option') { my (@IDs,@ans); foreach (split(/\&/,&Apache::lonnet::unescape($answer))) { @@ -198,6 +197,7 @@ COMMONJSFUNCTIONS #--- section, ids and fullnames for each user. sub getclasslist { my ($getsec,$filterlist) = @_; + $getsec = $getsec eq '' ? 'all' : $getsec; my $classlist=&Apache::loncoursedata::get_classlist(); # Bail out if we were unable to get the classlist return if (! defined($classlist)); @@ -471,8 +471,7 @@ LISTJAVASCRIPT $request->print($result); my $checkhdgrade = ($ENV{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1 ) ? 'checked' : ''; - my $checklastsub = ($ENV{'form.handgrade'} eq 'no') ? 'checked' : ''; - $checklastsub = 'checked' if ($checkhdgrade eq '' && $checklastsub eq ''); + my $checklastsub = $checkhdgrade eq '' ? 'checked' : ''; my $gradeTable='
'."\n". ' View Problem Text: no '."\n". ' one student '."\n". @@ -709,9 +708,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"; } @@ -722,9 +722,9 @@ sub sub_page_js { return; } -//=========== Check that a point is assigned for all the parts (essay grading only) ============ +//=========== Check that a point is assigned for all the parts ============ function checksubmit(formname,val,total,parttot) { - document.SCORE.gradeOpt.value = val; + formname.gradeOpt.value = val; if (val == "Save & Next") { for (i=0;i<=total;i++) { for (j=0;j"); @@ -1172,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 ''; @@ -1185,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 @@ -1229,12 +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". @@ -1290,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); @@ -1377,8 +1380,7 @@ KEYWORDS $$fullname{$ENV{'form.'.$uname.':'.$udom.':submitted_by'}}.''; $request->print($submitby); } else { - my ($string,$timestamp)= - &get_last_submission (%record); + my ($string,$timestamp)= &get_last_submission (\%record); my $lastsubonly=''. ($$timestamp eq '' ? '' : 'Date Submitted: '. $$timestamp)."\n"; @@ -1416,9 +1418,11 @@ KEYWORDS '"> File uploaded by student '. 'Like all files provided by users, '. 'this file may contain virusses
':''). - 'Submitted Answer: '.($responsetype eq 'essay' ? '
' : ''). + 'Submitted Answer: '.($responsetype =~ /^(essay|option)$/ ? + '
' : ''). &cleanRecord(&keywords_highlight($subval),$responsetype). - ($responsetype eq 'essay' ? '

' : '

').$similar."\n" + ($responsetype =~ /^(essay|option)$/ ? '

' : + '

').$similar."\n" if ($ENV{'form.lastSub'} eq 'lastonly' || ($ENV{'form.lastSub'} eq 'hdgrade' && $$handgrade{$part} =~ /:yes$/)); @@ -1436,23 +1440,25 @@ KEYWORDS $last,'.submission', 'Apache::grades::keywords_highlight')); } + + $request->print(''."\n"); # return if view submission with no grading option if ($ENV{'form.showgrading'} eq '' || (!&canmodify($usec))) { -# if (!&canmodify($usec)) { - $request->print(''."\n"); - $request->print(&show_grading_menu_form($symb,$url)) + my $toGrade.='  '."\n" if (&canmodify($usec)); + $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; } - # essay grading options + # essay grading message center if ($ENV{'form.handgrade'} eq 'yes') { - $result=''."\n". - ''."\n". - ''."\n"; my ($lastname,$givenn) = split(/,/,$ENV{'form.fullname'}); my $msgfor = $givenn.' '.$lastname; if (scalar(@col_fullnames) > 0) { @@ -1461,6 +1467,8 @@ KEYWORDS } $msgfor =~ s/\'/\\'/g; #' stupid emacs - no! javascript # $result.=''."\n". + $result=''."\n". + ''."\n"; $result.=' '. 'Compose Message to student'.(scalar(@col_fullnames) >= 1 ? 's' : '').'  '. @@ -1494,28 +1502,22 @@ KEYWORDS # print end of form if ($counter == $total) { - my $endform='
'. - ''."\n"; -# if ($ENV{'form.handgrade'} eq 'yes') { - $endform.='  '."\n"; - my $ntstu =''."\n"; - my $nsel = ($ENV{'form.NTSTU'} ne '' ? $ENV{'form.NTSTU'} : '1'); - $ntstu =~ s/