--- loncom/homework/grades.pm 2016/10/14 17:33:34 1.596.2.12.2.37 +++ loncom/homework/grades.pm 2017/11/01 03:27:19 1.596.2.12.2.41.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.596.2.12.2.37 2016/10/14 17:33:34 raeburn Exp $ +# $Id: grades.pm,v 1.596.2.12.2.41.2.1 2017/11/01 03:27:19 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -354,7 +354,7 @@ sub reset_caches { } sub scantron_partids_tograde { - my ($resource,$cid,$uname,$udom,$check_for_randomlist,$bubbles_per_row) = @_; + my ($resource,$cid,$uname,$udom,$check_for_randomlist,$bubbles_per_row,$scancode) = @_; my (%analysis,@parts); if (ref($resource)) { my $symb = $resource->symb(); @@ -362,6 +362,13 @@ sub reset_caches { if ($check_for_randomlist) { $add_to_form = { 'check_parts_withrandomlist' => 1,}; } + if ($scancode) { + if (ref($add_to_form) eq 'HASH') { + $add_to_form->{'code_for_randomlist'} = $scancode; + } else { + $add_to_form = { 'code_for_randomlist' => $scancode,}; + } + } my $analyze = &get_analyze($symb,$uname,$udom,undef,$add_to_form, undef,undef,undef,$bubbles_per_row); @@ -3756,7 +3763,7 @@ sub viewgrades { #retrieve selected groups my (@groups,$group_display); - @groups = &Apache::loncommon::get_env_multiple(form.group'); + @groups = &Apache::loncommon::get_env_multiple('form.group'); if (grep(/^all$/,@groups)) { @groups = ('all'); } elsif (grep(/^none$/,@groups)) { @@ -3973,7 +3980,7 @@ sub viewgrades { $result .= &mt('There are no students in section(s) [_1] with enrollment status [_2] to modify or grade.', $section_display,$stu_status); } elsif (grep(/^none$/,@groups)) { - $result .= &mt('There are no students in section(s) [_1] nd no group with enrollment status [_2] to modify or grade.', + $result .= &mt('There are no students in section(s) [_1] and no group with enrollment status [_2] to modify or grade.', $section_display,$stu_status); } else { $result .= &mt('There are no students in section(s) [_1] and group(s) [_2] with enrollment status [_3] to modify or grade.', @@ -4598,8 +4605,10 @@ sub csvuploadmap { if (!$env{'form.datatoken'}) { $datatoken=&Apache::loncommon::upfile_store($request); } else { - $datatoken=$env{'form.datatoken'}; - &Apache::loncommon::load_tmp_file($request); + $datatoken=&Apache::loncommon::valid_datatoken($env{'form.datatoken'}); + if ($datatoken ne '') { + &Apache::loncommon::load_tmp_file($request,$datatoken); + } } my @records=&Apache::loncommon::upfile_record_sep(); if ($env{'form.noFirstLine'}) { shift(@records); } @@ -4703,7 +4712,10 @@ sub csvuploadassign { my ($symb)=&get_symb($request); if (!$symb) {return '';} my $error_msg = ''; - &Apache::loncommon::load_tmp_file($request); + my $datatoken = &Apache::loncommon::valid_datatoken($env{'form.datatoken'}); + if ($datatoken ne '') { + &Apache::loncommon::load_tmp_file($request,$datatoken); + } my @gradedata = &Apache::loncommon::upfile_record_sep(); if ($env{'form.noFirstLine'}) { shift(@gradedata); } my %fields=&get_fields(); @@ -8783,9 +8795,14 @@ SCANTRONFORM } if ((exists($grader_randomlists_by_symb{$ressymb})) || (ref($grader_partids_by_symb{$ressymb}) ne 'ARRAY')) { + my $currcode; + if (exists($grader_randomlists_by_symb{$ressymb})) { + $currcode = $scancode; + } my ($analysis,$parts) = &scantron_partids_tograde($resource,$env{'request.course.id'}, - $uname,$udom,undef,$bubbles_per_row); + $uname,$udom,undef,$bubbles_per_row, + $currcode); $partids_by_symb{$ressymb} = $parts; } else { $partids_by_symb{$ressymb} = $grader_partids_by_symb{$ressymb}; @@ -9455,10 +9472,14 @@ sub checkscantron_results { my $ressymb = $resource->symb(); if ((exists($grader_randomlists_by_symb{$ressymb})) || (ref($grader_partids_by_symb{$ressymb}) ne 'ARRAY')) { + my $currcode; + if (exists($grader_randomlists_by_symb{$ressymb})) { + $currcode = $scancode; + } (my $analysis,$parts) = &scantron_partids_tograde($resource,$env{'request.course.id'}, $username,$domain,undef, - $bubbles_per_row); + $bubbles_per_row,$currcode); } else { $parts = $grader_partids_by_symb{$ressymb}; } @@ -10008,7 +10029,8 @@ sub substatus_options { 'queued' => 'in grading queue', 'graded' => 'with ungraded submissions', 'incorrect' => 'with incorrect submissions', - 'all' => 'with any status'); + 'all' => 'with any status', + ); } sub reset_perm {