--- loncom/homework/grades.pm 2006/09/27 22:09:16 1.377 +++ loncom/homework/grades.pm 2006/10/23 22:32:09 1.381 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.377 2006/09/27 22:09:16 albertel Exp $ +# $Id: grades.pm,v 1.381 2006/10/23 22:32:09 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -588,7 +588,7 @@ sub verifyreceipt { my $receipt = &Apache::lonnet::recprefix($courseid).'-'. $env{'form.receipt'}; $receipt =~ s/[^\-\d]//g; - my $symb = &Apache::lonnet::symbread(); + my ($symb) = &get_symb($request); my $title.='

Verifying Submission Receipt '. $receipt.'

'."\n". @@ -1469,7 +1469,8 @@ sub get_increment { #--- displays the grading box, used in essay type problem and grading by page/sequence sub gradeBox { my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_; - my $checkIcon = ''; my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname); my $wgtmsg = ($wgt > 0 ? '(problem weight)' : @@ -1492,10 +1493,10 @@ sub gradeBox { my $increment = &get_increment(); $result.=''."\n"; # display radio buttons in a nice table 10 across while ($thisweight<=$wgt) { - $result.= '\n"; + ($score eq $thisweight ? 'checked':'').' /> '.$thisweight."\n"; $result.=(($ctr+1)%10 == 0 ? '' : ''); $thisweight += $increment; $ctr++; @@ -1512,14 +1513,14 @@ sub gradeBox { $result.=''."\n"; - $result.="  \n"; + $result.="  \n"; $result.=''."\n". ''."\n". 'dir_config('lonIconsURL'). + my $checkIcon = ''.&mt('Check Mark').
+	''; # header info @@ -2420,17 +2422,8 @@ sub saveHandGrade { } &Apache::lonnet::cstore(\%newrecord,$symb, $env{'request.course.id'},$domain,$stuname); - my @ungraded_parts; - foreach my $part (@parts) { - if ( !defined($record{'resource.'.$part.'.awarded'}) - && !defined($newrecord{'resource.'.$part.'.awarded'}) ) { - push(@ungraded_parts, $part); - } - } - if ( !@ungraded_parts ) { - &Apache::bridgetask::remove_from_queue('gradingqueue',$symb,$cdom, - $cnum,$domain,$stuname); - } + &check_and_remove_from_queue(\@parts,\%record,\%newrecord,$symb, + $cdom,$cnum,$domain,$stuname); } if ($aggregateflag) { &Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, @@ -2439,6 +2432,24 @@ sub saveHandGrade { return ('',$pts,$wgt); } +sub check_and_remove_from_queue { + my ($parts,$record,$newrecord,$symb,$cdom,$cnum,$domain,$stuname) = @_; + my @ungraded_parts; + foreach my $part (@{$parts}) { + if ( $record->{ 'resource.'.$part.'.awarded'} eq '' + && $record->{ 'resource.'.$part.'.solved' } ne 'excused' + && $newrecord->{'resource.'.$part.'.awarded'} eq '' + && $newrecord->{'resource.'.$part.'.solved' } ne 'excused' + ) { + push(@ungraded_parts, $part); + } + } + if ( !@ungraded_parts ) { + &Apache::bridgetask::remove_from_queue('gradingqueue',$symb,$cdom, + $cnum,$domain,$stuname); + } +} + sub handback_files { my ($request,$symb,$stuname,$domain,$newflg,$new_part,$newrecord) = @_; my $portfolio_root = &propath($domain,$stuname).'/userfiles/portfolio'; @@ -3797,8 +3808,8 @@ LISTJAVASCRIPT $studentTable.=($ptr%2 == 0 ? '' : ''); $ptr++; } - $studentTable.='
  ' if ($ptr%2 == 0); - $studentTable.='
'."\n"; + $studentTable.='  ' if ($ptr%2 == 0); + $studentTable.=''."\n"; $studentTable.=''."\n"; @@ -3821,9 +3832,10 @@ sub getSymbMap { 1,0,1); for my $sequence ($navmap->getById('0.0'), @sequences) { if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) { - my $title = $minder.'.'.$sequence->compTitle(); - push @titles, $title; # minder in case two titles are identical - $symbx{$title} = $sequence->symb(); + my $title = $minder.'.'. + &HTML::Entities::encode($sequence->compTitle(),'"\'&'); + push(@titles, $title); # minder in case two titles are identical + $symbx{$title} = &HTML::Entities::encode($sequence->symb(),'"\'&'); $minder++; } } @@ -3883,7 +3895,8 @@ sub displayPage { ''."\n". ''."\n"; - my $checkIcon = ''; $studentTable.=' Note: Problems graded correct by the computer are marked with a '.$checkIcon. @@ -3963,9 +3976,9 @@ sub displayPage { $curRes = $iterator->next(); } - $studentTable.=''."\n". + $studentTable.=''."\n". ''. + 'onClick="javascript:checkSubmitPage(this.form,'.$question.');" />'. ''."\n"; $studentTable.=&show_grading_menu_form($symb); $request->print($studentTable); @@ -4071,7 +4084,7 @@ sub displaySubByDates { if ($displaySub[2]) { $studentTable.='Manually graded by '.$displaySub[2]; } - $studentTable.=' '; + $studentTable.=' 3'; } $studentTable.=''; @@ -4180,9 +4193,8 @@ sub updateGradeByPage { $displayPts[1].=' Part: '.$display_part.' = '. (($score eq 'excused') ? 'excused' : $newpts). ' 
'; - $question++; - next if ($dropMenu eq 'reset status' || ($newpts == $oldpts && $score ne 'excused')); + next if ($dropMenu eq 'reset status' || ($newpts eq $oldpts && $score ne 'excused')); $newrecord{'resource.'.$partid.'.awarded'} = $partial if $partial ne ''; $newrecord{'resource.'.$partid.'.solved'} = $score if $score ne ''; @@ -4194,7 +4206,12 @@ sub updateGradeByPage { if (scalar(keys(%newrecord)) > 0) { &Apache::lonnet::cstore(\%newrecord,$symbx,$env{'request.course.id'}, $udom,$uname); + my %record = &Apache::lonnet::restore($symbx,$env{'request.course.id'}, + $udom,$uname); + &check_and_remove_from_queue($parts,\%record,undef,$symbx, + $cdom,$cnum,$udom,$uname); } + if ($aggregateflag) { &Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, $env{'course.'.$env{'request.course.id'}.'.domain'}, @@ -4308,14 +4325,14 @@ sub scantron_CODElist { } sub scantron_CODEunique { - my $result=' + my $result=' - - + + - '; + '; return $result; } @@ -4434,6 +4451,7 @@ SCANTRONFORM
+ $default_form_data