--- loncom/homework/grades.pm 2025/01/17 03:46:07 1.596.2.12.2.60.2.7
+++ loncom/homework/grades.pm 2017/12/18 23:51:24 1.745
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.596.2.12.2.60.2.7 2025/01/17 03:46:07 raeburn Exp $
+# $Id: grades.pm,v 1.745 2017/12/18 23:51:24 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -44,14 +44,10 @@ use Apache::Constants qw(:common :http);
use Apache::lonlocal;
use Apache::lonenc;
use Apache::lonstathelpers;
+use Apache::lonquickgrades;
use Apache::bridgetask();
-use Apache::lontexconvert();
-use Apache::loncourserespicker;
use String::Similarity;
-use HTML::Parser();
-use File::MMagic;
use LONCAPA;
-use LONCAPA::ltiutils();
use POSIX qw(floor);
@@ -66,7 +62,7 @@ my $ssi_retries = 5;
my $ssi_error;
my $ssi_error_resource;
my $ssi_error_message;
-my $registered_cleanup;
+
sub ssi_with_retries {
my ($resource, $retries, %form) = @_;
@@ -149,7 +145,6 @@ sub nameUserString {
#--- Get the partlist and the response type for a given problem. ---
#--- Indicate if a response type is coded handgraded or not. ---
-#--- Count responseIDs, essayresponse items, and dropbox items ---
#--- Sets response_error pointer to "1" if navmaps object broken ---
sub response_type {
my ($symb,$response_error) = @_;
@@ -167,7 +162,6 @@ sub response_type {
return;
}
my $partlist = $res->parts();
- my ($numresp,$numessay,$numdropbox) = (0,0,0);
my %vPart =
map { $_ => 1 } (&Apache::loncommon::get_env_multiple('form.vPart'));
my (%response_types,%handgrade);
@@ -177,20 +171,13 @@ sub response_type {
my @types = $res->responseType($part);
my @ids = $res->responseIds($part);
for (my $i=0; $i < scalar(@ids); $i++) {
- $numresp ++;
$response_types{$part}{$ids[$i]} = $types[$i];
- if ($types[$i] eq 'essay') {
- $numessay ++;
- if (&Apache::lonnet::EXT("resource.$part".'_'.$ids[$i].".uploadedfiletypes",$symb)) {
- $numdropbox ++;
- }
- }
$handgrade{$part.'_'.$ids[$i]} =
&Apache::lonnet::EXT('resource.'.$part.'_'.$ids[$i].
'.handgrade',$symb);
}
}
- return ($partlist,\%handgrade,\%response_types,$numresp,$numessay,$numdropbox);
+ return ($partlist,\%handgrade,\%response_types);
}
sub flatten_responseType {
@@ -217,129 +204,6 @@ sub get_display_part {
return $display;
}
-#--- Show parts and response type
-sub showResourceInfo {
- my ($symb,$partlist,$responseType,$formname,$checkboxes,$uploads) = @_;
- unless ((ref($partlist) eq 'ARRAY') && (ref($responseType) eq 'HASH')) {
- return '
';
- }
- my $coltitle = &mt('Problem Part Shown');
- if ($checkboxes) {
- $coltitle = &mt('Problem Part');
- } else {
- my $checkedparts = 0;
- foreach my $partid (&Apache::loncommon::get_env_multiple('form.vPart')) {
- if (grep(/^\Q$partid\E$/,@{$partlist})) {
- $checkedparts ++;
- }
- }
- if ($checkedparts == scalar(@{$partlist})) {
- return '
';
- }
- if ($uploads) {
- $coltitle = &mt('Problem Part Selected');
- }
- }
- my $result = '
'. - &mt('No dropbox items or essayresponse items with uploadedfiletypes set.'). - '
'; - } else { - return ''.&keywords_highlight($answer).''; + } elsif ( $response eq 'organic') { my $result=&mt('Smile representation: [_1]', '"'.&HTML::Entities::encode($answer, '"<>&').'"'); @@ -638,7 +502,7 @@ COMMONJSFUNCTIONS #--- Dumps the class list with usernames,list of sections, #--- section, ids and fullnames for each user. sub getclasslist { - my ($getsec,$filterbyaccstatus,$getgroup,$symb,$submitonly,$filterbysubmstatus,$filterbypbid,$possibles) = @_; + my ($getsec,$filterlist,$getgroup) = @_; my @getsec; my @getgroup; my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status')); @@ -666,17 +530,6 @@ sub getclasslist { # my %sections; my %fullnames; - my %passback; - my ($cdom,$cnum,$partlist); - if (($filterbysubmstatus) && ($submitonly ne 'all') && ($symb ne '')) { - $cdom = $env{"course.$env{'request.course.id'}.domain"}; - $cnum = $env{"course.$env{'request.course.id'}.num"}; - my $res_error; - ($partlist) = &response_type($symb,\$res_error); - } elsif ($filterbypbid) { - $cdom = $env{"course.$env{'request.course.id'}.domain"}; - $cnum = $env{"course.$env{'request.course.id'}.num"}; - } foreach my $student (keys(%$classlist)) { my $end = $classlist->{$student}->[&Apache::loncoursedata::CL_END()]; @@ -693,7 +546,7 @@ sub getclasslist { my $group = $classlist->{$student}->[&Apache::loncoursedata::CL_GROUP()]; # filter students according to status selected - if ($filterbyaccstatus && (!($stu_status =~ /Any/))) { + if ($filterlist && (!($stu_status =~ /Any/))) { if (!($stu_status =~ $status)) { delete($classlist->{$student}); next; @@ -710,79 +563,13 @@ sub getclasslist { } } if (($grp eq 'none') && !$group) { - $exclude = 0; + $exclude = 0; } } if ($exclude) { delete($classlist->{$student}); - next; } } - if (($filterbysubmstatus) && ($submitonly ne 'all') && ($symb ne '')) { - my $udom = - $classlist->{$student}->[&Apache::loncoursedata::CL_SDOM()]; - my $uname = - $classlist->{$student}->[&Apache::loncoursedata::CL_SNAME()]; - if (($symb ne '') && ($udom ne '') && ($uname ne '')) { - if ($submitonly eq 'queued') { - my %queue_status = - &Apache::bridgetask::get_student_status($symb,$cdom,$cnum, - $udom,$uname); - if (!defined($queue_status{'gradingqueue'})) { - delete($classlist->{$student}); - next; - } - } else { - my (%status) =&student_gradeStatus($symb,$udom,$uname,$partlist); - my $submitted = 0; - my $graded = 0; - my $incorrect = 0; - foreach (keys(%status)) { - $submitted = 1 if ($status{$_} ne 'nothing'); - $graded = 1 if ($status{$_} =~ /^ungraded/); - $incorrect = 1 if ($status{$_} =~ /^incorrect/); - - my ($foo,$partid,$foo1) = split(/\./,$_); - if ($status{'resource.'.$partid.'.submitted_by'} ne '') { - $submitted = 0; - } - } - if (!$submitted && ($submitonly eq 'yes' || - $submitonly eq 'incorrect' || - $submitonly eq 'graded')) { - delete($classlist->{$student}); - next; - } elsif (!$graded && ($submitonly eq 'graded')) { - delete($classlist->{$student}); - next; - } elsif (!$incorrect && $submitonly eq 'incorrect') { - delete($classlist->{$student}); - next; - } - } - } - } - if ($filterbypbid) { - if (ref($possibles) eq 'HASH') { - unless (exists($possibles->{$student})) { - delete($classlist->{$student}); - next; - } - } - my $udom = - $classlist->{$student}->[&Apache::loncoursedata::CL_SDOM()]; - my $uname = - $classlist->{$student}->[&Apache::loncoursedata::CL_SNAME()]; - if (($udom ne '') && ($uname ne '')) { - my %pbinfo = &Apache::lonnet::get('nohist_'.$cdom.'_'.$cnum.'_linkprot_pb',[$filterbypbid],$udom,$uname); - if (ref($pbinfo{$filterbypbid}) eq 'ARRAY') { - $passback{$student} = $pbinfo{$filterbypbid}; - } else { - delete($classlist->{$student}); - next; - } - } - } $section = ($section ne '' ? $section : 'none'); if (&canview($section)) { if (!@getsec || grep(/^\Q$section\E$/,@getsec)) { @@ -797,8 +584,9 @@ sub getclasslist { delete($classlist->{$student}); } } + my %seen = (); my @sections = sort(keys(%sections)); - return ($classlist,\@sections,\%fullnames,\%passback); + return ($classlist,\@sections,\%fullnames); } sub canmodify { @@ -812,7 +600,7 @@ sub canmodify { #can modify the requested section return 1; } else { - # can't modify the requested section + # can't modify the request section return 0; } } @@ -825,19 +613,19 @@ sub canview { my ($sec)=@_; if ($perm{'vgr'}) { if (!defined($perm{'vgr_section'})) { - # can view whole class + # can modify whole class return 1; } else { if ($sec eq $perm{'vgr_section'}) { - #can view the requested section + #can modify the requested section return 1; } else { - # can't view the requested section + # can't modify the request section return 0; } } } - #can't view + #can't modify return 0; } @@ -978,14 +766,14 @@ sub initialverifyreceipt { #--- Check whether a receipt number is valid.--- sub verifyreceipt { - my ($request,$symb) = @_; + my ($request,$symb) = @_; my $courseid = $env{'request.course.id'}; my $receipt = &Apache::lonnet::recprefix($courseid).'-'. $env{'form.receipt'}; $receipt =~ s/[^\-\d]//g; - my $title = + my $title.= '
'.$output.'
'; - } - return &Apache::loncourserespicker::create_picker($navmap,'passback',$formname,$crstype,undef, - undef,undef,undef,undef,undef,undef, - \%passback,$readonly); -} - -sub passback_filters { - my ($request,$symb) = @_; - my $cdom = $env{"course.$env{'request.course.id'}.domain"}; - my $cnum = $env{"course.$env{'request.course.id'}.num"}; - my $crstype = &Apache::loncommon::course_type(); - my ($launcher,$appname,$setter,$linkuri,$linkprotector,$scope,$chosen); - if ($env{'form.passback'} ne '') { - $chosen = &unescape($env{'form.passback'}); - ($linkuri,$linkprotector,$scope) = split("\0",$chosen); - ($launcher,$appname,$setter) = &get_passback_launcher($cdom,$cnum,$chosen); - } - my $result; - if ($launcher ne '') { - $result = &launcher_info_box($launcher,$appname,$setter,$linkuri,$scope). - '
'.&mt('Set criteria to use to list students for possible passback of scores, then push Next [_1]',
- '→').
- '
'.&mt('Scores sent to launcher CMS').'
'.$outcome.'
'); - } else { - $request->print(''.&mt('No scores sent to launcher CMS').'
'); - } - if (keys(%tosend)) { - $request->print(''.&mt('No scores sent for following')); - my ($zeros,$nopbcreds,$noconfirm,$noscore); - foreach my $student (sort - { - if (lc($$fullname{$a}) ne lc($$fullname{$b})) { - return (lc($$fullname{$a}) cmp lc($$fullname{$b})); - } - return $a cmp $b; - } (keys(%$fullname))) { - next unless ($tosend{$student}); - my ($uname,$udom) = split(/:/,$student); - my $line = '
'.$error.'
'); - } - return; -} - -sub get_passback_launcher { - my ($cdom,$cnum,$chosen) = @_; - my ($linkuri,$linkprotector,$scope) = split("\0",$chosen); - my ($ltinum,$ltitype) = ($linkprotector =~ /^(\d+)(c|d)$/); - my ($appname,$setter); - if ($ltitype eq 'c') { - my %lti = &Apache::lonnet::get_course_lti($cnum,$cdom,'provider'); - if (ref($lti{$ltinum}) eq 'HASH') { - $appname = $lti{$ltinum}{'name'}; - if ($appname) { - $setter = ' (defined in course)'; - } - } - } elsif ($ltitype eq 'd') { - my %lti = &Apache::lonnet::get_domain_lti($cdom,'linkprot'); - if (ref($lti{$ltinum}) eq 'HASH') { - $appname = $lti{$ltinum}{'name'}; - if ($appname) { - $setter = ' (defined in domain)'; - } - } - } - my $launchsymb = &Apache::loncommon::symb_from_tinyurl($linkuri,$cnum,$cdom); - if ($launchsymb eq '') { - my %passback = &Apache::lonnet::dump('nohist_linkprot_passback',$cdom,$cnum); - foreach my $poss_symb (keys(%passback)) { - if (ref($passback{$poss_symb}) eq 'HASH') { - if (exists($passback{$poss_symb}{$chosen})) { - $launchsymb = $poss_symb; - last; - } - } - } - if ($launchsymb ne '') { - return ($launchsymb,$appname,$setter); - } - } else { - my %passback = &Apache::lonnet::get('nohist_linkprot_passback',[$launchsymb],$cdom,$cnum); - if (ref($passback{$launchsymb}) eq 'HASH') { - if (exists($passback{$launchsymb}{$chosen})) { - return ($launchsymb,$appname,$setter); - } - } - } - return (); -} - -sub sections_and_groups { - my (@sections,@groups,$group_display); - @groups = &Apache::loncommon::get_env_multiple('form.group'); - if (grep(/^all$/,@groups)) { - @groups = ('all'); - $group_display = 'all'; - } elsif (grep(/^none$/,@groups)) { - @groups = ('none'); - $group_display = 'none'; - } elsif (@groups > 0) { - $group_display = join(', ',@groups); - } - if ($env{'request.course.sec'} ne '') { - @sections = ($env{'request.course.sec'}); - } else { - @sections = &Apache::loncommon::get_env_multiple('form.section'); - } - my $disabled = ' disabled="disabled"'; - if ($perm{'mgr'}) { - if (grep(/^all$/,@sections)) { - undef($disabled); - } else { - foreach my $sec (@sections) { - if (&canmodify($sec)) { - undef($disabled); - last; - } - } - } - } - if (grep(/^all$/,@sections)) { - @sections = ('all'); - } - return(\@sections,\@groups,$group_display,$disabled); -} - -sub launcher_info_box { - my ($launcher,$appname,$setter,$linkuri,$scope) = @_; - my $shownscope; - if ($scope eq 'res') { - $shownscope = &mt('Resource'); - } elsif ($scope eq 'map') { - $shownscope = &mt('Folder'); - } elsif ($scope eq 'rec') { - $shownscope = &mt('Folder + sub-folders'); - } - return ''. - &Apache::lonhtmlcommon::start_pick_box(). - &Apache::lonhtmlcommon::row_title(&mt('Launch Item Title')). - &Apache::lonnet::gettitle($launcher). - &Apache::lonhtmlcommon::row_closure(). - &Apache::lonhtmlcommon::row_title(&mt('Deep-link')). - $linkuri. - &Apache::lonhtmlcommon::row_closure(). - &Apache::lonhtmlcommon::row_title(&mt('Launcher')). - $appname.' '.$setter. - &Apache::lonhtmlcommon::row_closure(). - &Apache::lonhtmlcommon::row_title(&mt('Score Type')). - $shownscope. - &Apache::lonhtmlcommon::row_closure(1). - &Apache::lonhtmlcommon::end_pick_box().'
'."\n"; -} - -sub passbacks_for_symb { - my ($cdom,$cnum,$symb) = @_; - my %passback = &Apache::lonnet::dump('nohist_linkprot_passback',$cdom,$cnum); - my %needpb; - if (keys(%passback)) { - my $checkpb = 1; - if (exists($passback{$symb})) { - if (keys(%passback) == 1) { - undef($checkpb); - } - if (ref($passback{$symb}) eq 'HASH') { - foreach my $launcher (keys(%{$passback{$symb}})) { - $needpb{$launcher} = $symb; - } - } - } - if ($checkpb) { - my ($map,$id,$url) = &Apache::lonnet::decode_symb($symb); - my $navmap = Apache::lonnavmaps::navmap->new(); - if (ref($navmap)) { - my $mapres = $navmap->getResourceByUrl($map); - if (ref($mapres)) { - my $mapsymb = $mapres->symb(); - if (exists($passback{$mapsymb})) { - if (keys(%passback) == 1) { - undef($checkpb); - } - if (ref($passback{$mapsymb}) eq 'HASH') { - foreach my $launcher (keys(%{$passback{$mapsymb}})) { - $needpb{$launcher} = $mapsymb; - } - } - } - my %posspb; - if ($checkpb) { - my @recurseup = $navmap->recurseup_maps($map,1); - if (@recurseup) { - map { $posspb{$_} = 1; } @recurseup; - } - } - foreach my $key (keys(%passback)) { - if (exists($posspb{$key})) { - if (ref($passback{$key}) eq 'HASH') { - foreach my $launcher (keys(%{$passback{$key}})) { - my ($linkuri,$linkprotector,$scope) = split("\0",$launcher); - next unless ($scope eq 'rec'); - $needpb{$launcher} = $key; - } - } - } - } - } - } - } - } - return %needpb; -} - -sub process_passbacks { - my ($context,$symbs,$cdom,$cnum,$udom,$uname,$usec,$weights,$awardeds,$excuseds,$needpb, - $skip_passback,$pbsave,$pbids) = @_; - if ((ref($needpb) eq 'HASH') && (ref($skip_passback) eq 'HASH') && (ref($pbsave) eq 'HASH')) { - my (%weight,%awarded,%excused); - if ((ref($symbs) eq 'ARRAY') && (ref($weights) eq 'HASH') && (ref($awardeds) eq 'HASH') && - (ref($excuseds) eq 'HASH')) { - %weight = %{$weights}; - %awarded = %{$awardeds}; - %excused = %{$excuseds}; - } - my $uhome = &Apache::lonnet::homeserver($uname,$udom); - my @launchers = keys(%{$needpb}); - my %pbinfo; - if (ref($pbids) eq 'HASH') { - %pbinfo = %{$pbids}; - } else { - %pbinfo = &Apache::lonnet::get('nohist_'.$cdom.'_'.$cnum.'_linkprot_pb',\@launchers,$udom,$uname); - } - my %pbc = &common_passback_info(); - foreach my $launcher (@launchers) { - if (ref($pbinfo{$launcher}) eq 'ARRAY') { - my $pbid = $pbinfo{$launcher}[0]; - my $pburl = $pbinfo{$launcher}[1]; - my (%total_by_symb,%possible_by_symb); - if (($pbid ne '') && ($pburl ne '')) { - next if ($skip_passback->{$launcher}); - my %pb = %pbc; - if ((exists($pbsave->{$launcher})) && - (ref($pbsave->{$launcher}) eq 'HASH')) { - foreach my $item ('lti_in_use','crsdef','ltinum','keynum','scoretype','msgformat', - 'symb','map','pbscope','linkuri','linkprotector','scope') { - $pb{$item} = $pbsave->{$launcher}{$item}; - } - } else { - my $ltitype; - ($pb{'linkuri'},$pb{'linkprotector'},$pb{'scope'}) = split("\0",$launcher); - ($pb{'ltinum'},$ltitype) = ($pb{'linkprotector'} =~ /^(\d+)(c|d)$/); - if ($ltitype eq 'c') { - my %crslti = &Apache::lonnet::get_course_lti($cnum,$cdom,'provider'); - $pb{'lti_in_use'} = $crslti{$pb{'ltinum'}}; - $pb{'crsdef'} = 1; - } else { - my %domlti = &Apache::lonnet::get_domain_lti($cdom,'linkprot'); - $pb{'lti_in_use'} = $domlti{$pb{'ltinum'}}; - } - if (ref($pb{'lti_in_use'}) eq 'HASH') { - $pb{'msgformat'} = $pb{'lti_in_use'}->{'passbackformat'}; - $pb{'keynum'} = $pb{'lti_in_use'}->{'cipher'}; - $pb{'scoretype'} = 'decimal'; - if ($pb{'lti_in_use'}->{'scoreformat'} =~ /^(decimal|ratio|percentage)$/) { - $pb{'scoretype'} = $1; - } - $pb{'symb'} = $needpb->{$launcher}; - if ($pb{'symb'} =~ /\.(page|sequence)$/) { - $pb{'map'} = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($pb{'symb'}))[2]); - } else { - $pb{'map'} = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($pb{'symb'}))[0]); - } - $pb{'map'} = &Apache::lonnet::clutter($pb{'map'}); - if ($pb{'scope'} eq 'res') { - $pb{'pbscope'} = 'resource'; - } elsif ($pb{'scope'} eq 'map') { - $pb{'pbscope'} = 'nonrec'; - } elsif ($pb{'scope'} eq 'rec') { - $pb{'pbscope'} = 'map'; - } - foreach my $item ('lti_in_use','crsdef','ltinum','keynum','scoretype','msgformat', - 'symb','map','pbscope','linkuri','linkprotector','scope') { - $pbsave->{$launcher}{$item} = $pb{$item}; - } - } else { - $skip_passback->{$launcher} = 1; - } - } - if (ref($symbs) eq 'ARRAY') { - foreach my $symb (@{$symbs}) { - if ((ref($weight{$symb}) eq 'HASH') && (ref($awarded{$symb}) eq 'HASH') && - (ref($excused{$symb}) eq 'HASH')) { - foreach my $part (keys(%{$weight{$symb}})) { - if ($excused{$symb}{$part}) { - next; - } - my $partweight = $weight{$symb}{$part} eq '' ? 1 : - $weight{$symb}{$part}; - if ($awarded{$symb}{$part}) { - $total_by_symb{$symb} += $partweight * $awarded{$symb}{$part}; - } - $possible_by_symb{$symb} += $partweight; - } - } - } - } - if ($context eq 'updatebypage') { - my $ltigrade = { - 'ltinum' => $pb{'ltinum'}, - 'lti' => $pb{'lti_in_use'}, - 'crsdef' => $pb{'crsdef'}, - 'cid' => $cdom.'_'.$cnum, - 'uname' => $uname, - 'udom' => $udom, - 'uhome' => $uhome, - 'usec' => $usec, - 'pbid' => $pbid, - 'pburl' => $pburl, - 'pbtype' => $pb{'type'}, - 'pbscope' => $pb{'pbscope'}, - 'pbmap' => $pb{'map'}, - 'pbsymb' => $pb{'symb'}, - 'format' => $pb{'scoretype'}, - 'scope' => $pb{'scope'}, - 'clientip' => $pb{'clientip'}, - 'linkprot' => $pb{'linkprotector'}.':'.$pb{'linkuri'}, - 'total_s' => \%total_by_symb, - 'possible_s' => \%possible_by_symb, - }; - push(@Apache::grades::ltipassback,$ltigrade); - next; - } - my ($total,$possible); - if ($pb{'pbscope'} eq 'resource') { - $total = $total_by_symb{$pb{'symb'}}; - $possible = $possible_by_symb{$pb{'symb'}}; - } elsif (($pb{'pbscope'} eq 'map') || ($pb{'pbscope'} eq 'nonrec')) { - ($total,$possible) = - &Apache::lonhomework::get_lti_score($uname,$udom,$usec,$pb{'map'},$pb{'pbscope'}, - \%total_by_symb,\%possible_by_symb); - } - if (!$possible) { - $total = 0; - $possible = 1; - } - my ($sent,$score,$code,$result) = - &LONCAPA::ltiutils::send_grade($cdom,$cnum,$pb{'crsdef'},$pb{'type'},$pb{'ltinum'}, - $pb{'keynum'},$pbid,$pburl,$pb{'scoretype'},$pb{'sigmethod'}, - $pb{'msgformat'},$total,$possible); - my $no_passback; - if ($sent) { - if ($code == 200) { - my $namespace = $cdom.'_'.$cnum.'_lp_passback'; - my $store = { - 'score' => $score, - 'ip' => $pb{'ip'}, - 'host' => $pb{'lonhost'}, - 'protector' => $pb{'linkprotector'}, - 'deeplink' => $pb{'linkuri'}, - 'scope' => $pb{'scope'}, - 'url' => $pburl, - 'id' => $pbid, - 'clientip' => $pb{'clientip'}, - 'whodoneit' => $env{'user.name'}.':'.$env{'user.domain'}, - }; - my $value=''; - foreach my $key (keys(%{$store})) { - $value.=&escape($key).'='.&Apache::lonnet::freeze_escape($store->{$key}).'&'; - } - $value=~s/\&$//; - &Apache::lonnet::courselog(&escape($pb{'linkuri'}).':'.$uname.':'.$udom.':EXPORT:'.$value); - &Apache::lonnet::cstore({'score' => $score},$launcher,$namespace,$udom,$uname,'',$pb{'ip'},1); - } else { - $no_passback = 1; - } - } else { - $no_passback = 1; - } - if ($no_passback) { - &Apache::lonnet::log($udom,$uname,$uhome,$no_passback." score: $score; total: $total; possible: $possible"); - my $ltigrade = { - 'ltinum' => $pb{'ltinum'}, - 'lti' => $pb{'lti_in_use'}, - 'crsdef' => $pb{'crsdef'}, - 'cid' => $cdom.'_'.$cnum, - 'uname' => $uname, - 'udom' => $udom, - 'uhome' => $uhome, - 'pbid' => $pbid, - 'pburl' => $pburl, - 'pbtype' => $pb{'type'}, - 'pbscope' => $pb{'pbscope'}, - 'pbmap' => $pb{'map'}, - 'pbsymb' => $pb{'symb'}, - 'format' => $pb{'scoretype'}, - 'scope' => $pb{'scope'}, - 'clientip' => $pb{'clientip'}, - 'linkprot' => $pb{'linkprotector'}.':'.$pb{'linkuri'}, - 'total' => $total, - 'possible' => $possible, - 'score' => $score, - }; - &Apache::lonnet::put('linkprot_passback_pending',$ltigrade,$cdom,$cnum); - } - } - } - } - } - return; -} - -sub common_passback_info { - my %pbc = ( - sigmethod => 'HMAC-SHA1', - type => 'linkprot', - clientip => &Apache::lonnet::get_requestor_ip(), - lonhost => $Apache::lonnet::perlvar{'lonHostID'}, - ip => &Apache::lonnet::get_host_ip($Apache::lonnet::perlvar{'lonHostID'}), - ); - return %pbc; -} - #--- This is called by a number of programs. #--- Called from the Grading Menu - View/Grade an individual student #--- Also called directly when one clicks on the subm button # on the problem page. sub listStudents { - my ($request,$symb,$submitonly,$divforres) = @_; + my ($request,$symb,$submitonly) = @_; - my $is_tool = ($symb =~ /ext\.tool$/); + my ($is_tool) = ($symb =~ /ext\.tool$/); my $cdom = $env{"course.$env{'request.course.id'}.domain"}; my $cnum = $env{"course.$env{'request.course.id'}.num"}; my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'}; my $getgroup = $env{'form.group'} eq '' ? 'all' : $env{'form.group'}; unless ($submitonly) { - $submitonly = $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'}; + $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'}; } my $result=''; my $res_error; - my ($partlist,$handgrade,$responseType,$numresp,$numessay) = &response_type($symb,\$res_error); - - my $table; - if (ref($partlist) eq 'ARRAY') { - if (scalar(@$partlist) > 1 ) { - $table = &showResourceInfo($symb,$partlist,$responseType,'gradesub',1); - } elsif ($divforres) { - $table = ''; - } else { - $table = '