--- loncom/homework/lonhomework.pm 2018/05/15 04:59:14 1.371 +++ loncom/homework/lonhomework.pm 2018/09/20 14:16:51 1.374 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.371 2018/05/15 04:59:14 raeburn Exp $ +# $Id: lonhomework.pm,v 1.374 2018/09/20 14:16:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -242,7 +242,8 @@ sub check_slot_access { $consumed_uniq = $slot{'uniqueperiod'}; if ($slot{'iptied'}) { $ipused = $Apache::lonhomework::history{"$checkin.ip"}; - unless (($ip ne '') && ($ipused eq $ip)) { + unless (($ip ne '') && + (($ipused eq $ip) || ($ENV{'REMOTE_ADDR'} eq '127.0.0.1'))) { $blockip = $slot{'iptied'}; $slot_name = $checkinslot; $returned_slot = \%slot; @@ -256,7 +257,7 @@ sub check_slot_access { } else { return ($status,$datemsg); } - } + } if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS' || @@ -266,7 +267,7 @@ sub check_slot_access { if ($env{'request.state'} eq "construct") { return ($status,$datemsg); } - + if ($type eq 'Task') { if ($checkedin && $Apache::lonhomework::history{"resource.$version.0.status"} eq 'pass') { @@ -276,6 +277,12 @@ sub check_slot_access { return ('SHOW_ANSWER'); } } + } elsif (($type eq 'problem') && + ($Apache::lonhomework::browse eq 'F') && + ($ENV{'REMOTE_ADDR'} eq '127.0.0.1') && + ($env{'form.grade_courseid'} eq $env{'request.course.id'}) && + (&Apache::lonnet::allowed('mgr',$env{'request.course.id'}))) { + return ($status,$datemsg); } my $availablestudent = &Apache::lonnet::EXT("resource.0.availablestudent",$symb); @@ -369,7 +376,7 @@ sub check_slot_access { $earlyout = 1; } } - if (($currtries == $maxtries) || ($is_correct)) { + if ($currtries == $maxtries) { $earlyout = 1; } else { $numgraded ++; @@ -1879,6 +1886,8 @@ sub do_ltipassback { my ($cdom,$cnum) = ($1,$2); my $ckey = $item->{'lti'}->{'key'}; my $secret = $item->{'lti'}->{'secret'}; + my $msgformat = $item->{'lti'}->{'passbackformat'}; + my $sigmethod = 'HMAC-SHA1'; my $id = $item->{'pbid'}; my $url = $item->{'pburl'}; my $scope = $item->{'scope'}; @@ -1897,7 +1906,8 @@ sub do_ltipassback { ($total,$possible) = &get_lti_score($uname,$udom); } if (($ckey ne '') && ($secret ne '') && ($id ne '') && ($url ne '') && ($possible)) { - &LONCAPA::ltiutils::send_grade($id,$url,$ckey,$secret,$scoretype,$total,$possible); + &LONCAPA::ltiutils::send_grade($id,$url,$ckey,$secret,$scoretype,$sigmethod, + $msgformat,$total,$possible); } } }