--- loncom/homework/grades.pm 2009/12/09 17:53:55 1.582
+++ loncom/homework/grades.pm 2009/12/27 01:25:26 1.586
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.582 2009/12/09 17:53:55 raeburn Exp $
+# $Id: grades.pm,v 1.586 2009/12/27 01:25:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -207,8 +207,6 @@ sub get_display_part {
#--- and parts and response type
sub showResourceInfo {
my ($symb,$probTitle,$checkboxes,$res_error) = @_;
- my $col=3;
- if ($checkboxes) { $col=4; }
my $result = '
'.&mt('Current Resource').': '.$probTitle.' '."\n";
my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error);
if (ref($res_error)) {
@@ -216,32 +214,41 @@ sub showResourceInfo {
return;
}
}
- $result .=''."\n";
+ $result.=&Apache::loncommon::end_data_table();
return $result,$responseType,$hdgrade,$partlist,$handgrade;
}
@@ -772,7 +779,7 @@ sub verifyreceipt {
my $title.=
''.
- &mt('Verifying Receipt No. [_1]',$receipt).
+ &mt('Verifying Receipt No. [_1]',$receipt).
' '."\n".
''.&mt('Resource: [_1]',$env{'form.probTitle'}).
' '."\n";
@@ -832,11 +839,14 @@ sub verifyreceipt {
}
}
if ($matches == 0) {
- $string = $title.&mt('No match found for the above receipt.');
+ $string = $title
+ .''
+ .&mt('No match found for the above receipt number.')
+ .'
';
} else {
$string = &jscriptNform($symb).$title.
''.
- &mt('The above receipt matches the following [numerate,_1,student].',$matches).
+ &mt('The above receipt number matches the following [quant,_1,student].',$matches).
'
'.
$header.
$contents.
@@ -1701,6 +1711,25 @@ sub get_increment {
return $increment;
}
+sub gradeBox_start {
+ return (
+ &Apache::loncommon::start_data_table()
+ .&Apache::loncommon::start_data_table_header_row()
+ .''.&mt('Part').' '
+ .''.&mt('Points').' '
+ .' '
+ .''.&mt('Assign Grade').' '
+ .''.&mt('Weight').' '
+ .''.&mt('Grade Status').' '
+ .&Apache::loncommon::end_data_table_header_row()
+ );
+}
+
+sub gradeBox_end {
+ return (
+ &Apache::loncommon::end_data_table()
+ );
+}
#--- displays the grading box, used in essay type problem and grading by page/sequence
sub gradeBox {
my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_;
@@ -1720,7 +1749,7 @@ sub gradeBox {
if ($last_resets{$partid}) {
$aggtries = &get_num_tries($record,$last_resets{$partid},$partid);
}
- $result.='';
+ $result.=&Apache::loncommon::start_data_table_row();
my $ctr = 0;
my $thisweight = 0;
my $increment = &get_increment();
@@ -1743,8 +1772,8 @@ sub gradeBox {
$wgt.')" />'."\n";
$line.='/'.$wgt.' '.$wgtmsg.
($$record{'resource.'.$partid.'.solved'} eq 'correct_by_student' ? ' '.$checkIcon : '').
- ' '.&mt('Grade Status').': '."\n";
- $line.=''."\n";
+ $line.=''."\n";
if ($$record{'resource.'.$partid.'.solved'} eq 'excused') {
$line.=' '.
@@ -1758,8 +1787,8 @@ sub gradeBox {
#&mt('Part: [_1] Points: [_2] or [_3] ',$display_part,$radio,$line);
$result .=
- ''.&mt('Part:').' '.$display_part.' '.&mt('Points:').' '.$radio.' '.&mt('or').' '.$line.' ';
- $result.='
'."\n";
+ ''.$display_part.' '.$radio.' '.&mt('or').' '.$line.' ';
+ $result.=&Apache::loncommon::end_data_table_row();
$result.=' '."\n".
' '."\n".
' '.
-
- ''.
- '');
+ $request->print(
+ '
'
+ .''
+ );
+ $request->print(&gradeBox_start()); #
foreach my $part_response_id (@part_response_id) {
my ($partid,$respid) = @{ $part_response_id };
my $part_resp = join('_',@{ $part_response_id });
@@ -2287,7 +2317,8 @@ KEYWORDS
push(@gradePartRespid,$partid.'.'.$respid);
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record));
}
- $request->print('
');
+ $request->print(&gradeBox_end()); #
+ $request->print('');
$request->print('');
if ($perm{'vgr'}) {
@@ -4475,11 +4506,13 @@ sub displayPage {
}
if (&canmodify($usec)) {
+ $studentTable.=&gradeBox_start();
foreach my $partid (@{$parts}) {
$studentTable.=&gradeBox($request,$symbx,$uname,$udom,$question,$partid,\%record);
$studentTable.=' '."\n";
$question++;
}
+ $studentTable.=&gradeBox_end();
$prob++;
}
$studentTable.='';
@@ -7386,7 +7419,12 @@ sub scantron_validate_doublebubble {
#get scantron line setup
my %scantron_config=&get_scantron_config($env{'form.scantron_format'});
my ($scanlines,$scan_data)=&scantron_getfile();
- &scantron_get_maxbubble(); # parse needs the bubble line array.
+ my $nav_error;
+ &scantron_get_maxbubble(\$nav_error); # parse needs the bubble line array.
+ if ($nav_error) {
+ $r->print(&navmap_errormsg());
+ return(1,$currentphase);
+ }
for (my $i=0;$i<=$scanlines->{'count'};$i++) {
my $line=&scantron_get_line($scanlines,$scan_data,$i);
@@ -7582,8 +7620,15 @@ sub scantron_process_students {
my (%grader_partids_by_symb,%grader_randomlists_by_symb);
&graders_resources_pass(\@resources,\%grader_partids_by_symb,
\%grader_randomlists_by_symb);
+ my $resource_error;
foreach my $resource (@resources) {
- my $ressymb = $resource->symb();
+ my $ressymb;
+ if (ref($resource)) {
+ $ressymb = $resource->symb();
+ } else {
+ $resource_error = 1;
+ last;
+ }
my ($analysis,$parts) =
&scantron_partids_tograde($resource,$env{'request.course.id'},
$env{'user.name'},$env{'user.domain'},1);
@@ -7595,6 +7640,10 @@ sub scantron_process_students {
}
}
}
+ if ($resource_error) {
+ $r->print(&navmap_errormsg());
+ return '';
+ }
my ($uname,$udom);
my $result= <symb();
+ my $ressymb;
+ if (ref($resource)) {
+ $ressymb = $resource->symb();
+ } else {
+ $res_error = 1;
+ last;
+ }
if ((exists($grader_randomlists_by_symb{$ressymb})) ||
(ref($grader_partids_by_symb{$ressymb}) ne 'ARRAY')) {
my ($analysis,$parts) =
@@ -7681,6 +7733,12 @@ SCANTRONFORM
}
}
+ if ($res_error) {
+ &scantron_add_delay(\@delayqueue,$line,
+ 'An error occurred while grading student '.$uname,2);
+ next;
+ }
+
&Apache::lonxml::clear_problem_counter();
&Apache::lonnet::appenv($scan_record);
@@ -8489,7 +8547,7 @@ sub grading_menu {
$Str .= Apache::lonhtmlcommon::generate_menu(@menu);
#$menudata->{'jscript'}
- $Str .=' '.
&Apache::lonnet::recprefix($env{'request.course.id'}).