--- loncom/homework/grades.pm 2009/12/09 19:41:10 1.583
+++ loncom/homework/grades.pm 2010/02/22 23:08:16 1.595
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.583 2009/12/09 19:41:10 raeburn Exp $
+# $Id: grades.pm,v 1.595 2010/02/22 23:08:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -160,6 +160,10 @@ sub response_type {
return;
}
my $res = $navmap->getBySymb($symb);
+ unless (ref($res)) {
+ $$response_error = 1;
+ return;
+ }
my $partlist = $res->parts();
my %vPart =
map { $_ => 1 } (&Apache::loncommon::get_env_multiple('form.vPart'));
@@ -207,8 +211,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 +218,41 @@ sub showResourceInfo {
return;
}
}
- $result .=''."\n";
+ $result.=&Apache::loncommon::end_data_table();
return $result,$responseType,$hdgrade,$partlist,$handgrade;
}
@@ -772,7 +783,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 +843,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.
@@ -934,10 +948,18 @@ LISTJAVASCRIPT
my $saveStatus = $stu_status eq '' ? 'Active' : $stu_status;
$env{'form.Status'} = $saveStatus;
$submission_options.=
- ' '.&mt('last submission only').' '."\n".
- ' '.&mt('last submission & parts info').' '."\n".
- ' '.&mt('by dates and submissions').' '."\n".
- ' '.&mt('all details').' ';
+ ''.
+ ' '.
+ &mt('last submission only').' '."\n".
+ ''.
+ ' '.
+ &mt('last submission & parts info').' '."\n".
+ ''.
+ ' '.
+ &mt('by dates and submissions').' '."\n".
+ ''.
+ ' '.
+ &mt('all details').' ';
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Submissions'))
.$submission_options
.&Apache::lonhtmlcommon::row_closure();
@@ -983,8 +1005,8 @@ LISTJAVASCRIPT
# checkall buttons
$gradeTable.=&check_script('gradesub', 'stuinfo');
$gradeTable.=' '."\n";
+ 'onclick="javascript:checkSelect(this.form.stuinfo);" '."\n".
+ 'value="'.&mt('Next').' →" /> '."\n";
$gradeTable.=&check_buttons();
my ($classlist, undef, $fullname) = &getclasslist($getsec,'1',$getgroup);
$gradeTable.= &Apache::loncommon::start_data_table().
@@ -1101,9 +1123,9 @@ LISTJAVASCRIPT
}
$gradeTable.=&Apache::loncommon::end_data_table()."\n".
- ' '."\n";
+ ' '."\n";
if ($ctr == 0) {
my $num_students=(scalar(keys(%$fullname)));
if ($num_students eq 0) {
@@ -1607,8 +1629,8 @@ INNERJS
pDoc = pWin.document;
pDoc.write("<\\/table>");
pDoc.write("<\\/td><\\/tr><\\/table> ");
- pDoc.write(" ");
- pDoc.write(" ");
+ pDoc.write(" ");
+ pDoc.write(" ");
pDoc.write("<\\/form>");
pDoc.write('$end_page_msg_central');
pDoc.close();
@@ -1681,8 +1703,8 @@ INNERJS
var hDoc = hwdWin.document;
hDoc.write("<\\/table>");
hDoc.write("<\\/td><\\/tr><\\/table> ");
- hDoc.write(" ");
- hDoc.write(" ");
+ hDoc.write(" ");
+ hDoc.write(" ");
hDoc.write("<\\/form>");
hDoc.write('$end_page_highlight_central');
hDoc.close();
@@ -1701,6 +1723,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 +1761,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();
@@ -1728,7 +1769,7 @@ sub gradeBox {
my $radio.=''."\n";
+ ''.$display_part.' '.$radio.' '.&mt('or').' '.$line.' ';
+ $result.=&Apache::loncommon::end_data_table_row();
$result.=' '."\n".
' '."\n".
''.
- &mt('View of the problem').
- ''.
- $rendered.
- '
';
+ ''
+ .'
'.&mt('View of the problem').' '
+ .$rendered
+ .'';
$companswer=
- ''.
- $companswer.
- '
';
+ ''
+ .'
'.&mt('Correct answer').' '
+ .$companswer
+ .'';
my $result;
if ($mode eq 'both') {
- $result=$rendered.$companswer;
+ $result=$rendered.$companswer;
} elsif ($mode eq 'text') {
- $result=$rendered;
+ $result=$rendered;
} elsif ($mode eq 'answer') {
- $result=$companswer;
+ $result=$companswer;
}
- $result=''.$result.'
';
return $result;
}
@@ -2037,7 +2075,7 @@ sub submission {
$request->print(<Keyword Options:
List
-Paste Selection to List
Highlight Attribute
KEYWORDS
@@ -2053,12 +2091,31 @@ KEYWORDS
}
# This is where output for one specific student would start
- my $add_class = ($counter%2) ? 'LC_grade_show_user_odd_row' : '';
- $request->print("\n\n".
- ''.
- '
'.&nameUserString(undef,$env{'form.fullname'},$uname,$udom).'
'.
- '
'."\n");
+ my $add_class = ($counter%2) ? ' LC_grade_show_user_odd_row' : '';
+ $request->print(
+ "\n\n"
+ .'
'
+ .'
'.&nameUserString(undef,$env{'form.fullname'},$uname,$udom).' '
+ ."\n"
+ );
+
+ # Show additional functions if allowed
+ if ($perm{'vgr'}) {
+ $request->print(
+ &Apache::loncommon::track_student_link(
+ &mt('View recent activity'),
+ $uname,$udom,'check')
+ .' '
+ );
+ }
+ if ($perm{'opa'}) {
+ $request->print(
+ &Apache::loncommon::pprmlink(
+ &mt('Set/Change parameters'),
+ $uname,$udom,$symb,'check'));
+ }
+ # Show Problem
if ($env{'form.vProb'} eq 'all' or $env{'form.vAns'} eq 'all') {
my $mode;
if ($env{'form.vProb'} eq 'all' && $env{'form.vAns'} eq 'all') {
@@ -2082,20 +2139,17 @@ KEYWORDS
# Display student info
$request->print(($counter == 0 ? '' : '
'));
- my $result='
';
-
- $result.=''."\n";
if (($env{'form.command'} eq 'submission') ||
@@ -2271,11 +2327,11 @@ KEYWORDS
my @partlist;
my @gradePartRespid;
my @part_response_id = &flatten_responseType($responseType);
- $request->print('
'.
-
- ''.
- '
');
+ $request->print(
+ '
'
+ .'
'.&mt('Assign Grades').' '
+ );
+ $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,19 +2343,10 @@ 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'}) {
- $request->print(
- &Apache::loncommon::track_student_link(&mt('View recent activity'),
- $uname,$udom,'check'));
- }
- if ($perm{'opa'}) {
- $request->print(
- &Apache::loncommon::pprmlink(&mt('Set/Change parameters'),
- $uname,$udom,$symb,'check'));
- }
$request->print('
');
$result='
'."\n";
+ my $endform=' ';
@@ -3325,11 +3373,11 @@ sub viewgrades {
}
$radio.='
';
my $line = ' /'.
$weight{$partid}.' '.&mt('(problem weight)').''."\n";
$line.= ''.&mt('Grade Status').': '.
' '.
''.&mt('excused').' '.
@@ -3350,7 +3398,7 @@ sub viewgrades {
$result.=&Apache::loncommon::end_data_table()."\n".
' ';
$result.=' ';
+ 'onclick="javascript:resetEntry('.$ctsparts.');" />';
#table listing all the students in a section/class
#header of table
@@ -3414,7 +3462,7 @@ sub viewgrades {
$result.=&Apache::loncommon::end_data_table();
$result.=' '."\n";
$result.=' '."\n";
+ 'onclick="javascript:submit();" target="_self" />'."\n";
if (scalar(%$fullname) eq 0) {
my $colspan=3+scalar(@parts);
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section'));
@@ -3466,7 +3514,7 @@ sub viewstudentgrade {
'GD_'.$student.'_'.$part.'_awarded_s" value="'.$pts.'" />'."\n";
$result.=' '."\n";
} elsif ($type eq 'solved') {
my ($status,$foo)=split(/_/,$score,2);
@@ -3475,7 +3523,7 @@ sub viewstudentgrade {
$part.'_solved_s" value="'.$status.'" />'."\n";
$result.=' '."\n";
+ 'onchange="javascript:changeOneScore(\''.$part.'\',\''.$student.'\')" >'."\n";
$result.= (($status eq 'excused') ? ' '.&mt('excused').' '
: ' '.&mt('excused').' ')."\n";
$result.=''.&mt('reset status').' ';
@@ -3835,7 +3883,7 @@ $result
Total number of records found in file: $distotal
Enter as many fields as you can. The system will inform you and bring you back
to this page if the data selected is insufficient to run your class.
-
+
$ignore
@@ -3890,7 +3938,7 @@ sub csvuploadmap_footer {
-
+
ENDPICK
}
@@ -3935,7 +3983,7 @@ sub upcsvScores_form {
$upfile_select
-
+
$ignore
ENDUPFORM
@@ -4258,7 +4306,7 @@ LISTJAVASCRIPT
$result.=' '.&mt('Use CODE').': '."\n";
$result.=' '."\n";
+ 'onclick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' →" /> '."\n";
$request->print($result);
@@ -4297,7 +4345,7 @@ LISTJAVASCRIPT
}
$studentTable.=&Apache::loncommon::end_data_table()."\n";
$studentTable.=' '."\n";
+ 'onclick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' →" />'."\n";
$studentTable.=&show_grading_menu_form($symb);
$request->print($studentTable);
@@ -4404,7 +4452,9 @@ sub displayPage {
my $checkIcon = ' ';
- $studentTable.=' '.&mt('Note: Problems graded correct by the computer are marked with a [_1] symbol.',$checkIcon)."\n".
+ $studentTable.=' '.
+ &mt('Problems graded correct by the computer are marked with a [_1] symbol.',$checkIcon).
+ ' '."\n".
&Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
' Prob. '.
@@ -4475,11 +4525,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.='';
@@ -4488,10 +4540,11 @@ sub displayPage {
$curRes = $iterator->next();
}
- $studentTable.=''."\n".
- ' '.
- ''."\n";
+ $studentTable.=
+ ''."\n".
+ ' '.
+ ''."\n";
$studentTable.=&show_grading_menu_form($symb);
$request->print($studentTable);
@@ -5237,7 +5290,7 @@ sub scantron_selectphase {
'.&mt('File to upload: [_1]',' ').'
-
+
');
@@ -7424,6 +7477,7 @@ sub scantron_get_maxbubble {
if (ref($nav_error)) {
$$nav_error = 1;
}
+ return;
}
my $map=$navmap->getResourceByUrl($sequence);
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
@@ -7587,8 +7641,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);
@@ -7600,6 +7661,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) =
@@ -7683,6 +7754,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);
@@ -7906,7 +7983,7 @@ sub scantron_upload_scantron_data {
&Apache::lonhtmlcommon::end_pick_box().'
-
+
');
return '';
@@ -8465,7 +8542,7 @@ sub grading_menu {
icon => 'addClickerInfoFile.png',
linktitle => 'Specify a file containing the clicker information for this resource.'
},
- { linktext => 'Grade/Manage/Review Bubblesheet Forms',
+ { linktext => 'Grade/Manage/Review Bubblesheets',
url => $url4,
permission => 'F',
icon => 'stat.png',
@@ -8491,11 +8568,11 @@ sub grading_menu {
$Str .= Apache::lonhtmlcommon::generate_menu(@menu);
#$menudata->{'jscript'}
- $Str .=' '.
&Apache::lonnet::recprefix($env{'request.course.id'}).
- '- ';
+ '- ';
$Str .="\n";
my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box.");
@@ -8678,7 +8755,7 @@ GRADINGMENUJS
-
+
@@ -8695,7 +8772,7 @@ GRADINGMENUJS
-
+
';
@@ -8875,17 +8952,17 @@ function sanitycheck() {
$type: $selectform
- $attendance
- $personnel
- $specific
+ $attendance
+ $personnel
+ $specific
- $given
+ $given
-$pcorrect:
-$pincorrect:
-
+$pcorrect:
+$pincorrect:
+
ENDUPFORM
$result.=''."\n".
@@ -9245,7 +9322,7 @@ ENDHEADER
sub navmap_errormsg {
return ''.
&mt('An error occurred retrieving information about resources in the course.').'
'.
- &mt('It is recommended that you [_1]re-initialize the course[_2] and then return to this grading page..','
',' ').
+ &mt('It is recommended that you [_1]re-initialize the course[_2] and then return to this grading page.','
',' ').
'
';
}