Diff for /loncom/homework/lonhomework.pm between versions 1.371 and 1.374

version 1.371, 2018/05/15 04:59:14 version 1.374, 2018/09/20 14:16:51
Line 242  sub check_slot_access { Line 242  sub check_slot_access {
         $consumed_uniq = $slot{'uniqueperiod'};          $consumed_uniq = $slot{'uniqueperiod'};
         if ($slot{'iptied'}) {          if ($slot{'iptied'}) {
             $ipused = $Apache::lonhomework::history{"$checkin.ip"};              $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'};                  $blockip = $slot{'iptied'};
                 $slot_name = $checkinslot;                  $slot_name = $checkinslot;
                 $returned_slot = \%slot;                  $returned_slot = \%slot;
Line 256  sub check_slot_access { Line 257  sub check_slot_access {
         } else {          } else {
             return ($status,$datemsg);              return ($status,$datemsg);
         }          }
     }       }
   
     if ($status eq 'CLOSED' ||      if ($status eq 'CLOSED' ||
  $status eq 'INVALID_ACCESS' ||   $status eq 'INVALID_ACCESS' ||
Line 266  sub check_slot_access { Line 267  sub check_slot_access {
     if ($env{'request.state'} eq "construct") {      if ($env{'request.state'} eq "construct") {
  return ($status,$datemsg);   return ($status,$datemsg);
     }      }
       
     if ($type eq 'Task') {      if ($type eq 'Task') {
  if ($checkedin &&   if ($checkedin &&
     $Apache::lonhomework::history{"resource.$version.0.status"} eq 'pass') {      $Apache::lonhomework::history{"resource.$version.0.status"} eq 'pass') {
Line 276  sub check_slot_access { Line 277  sub check_slot_access {
         return ('SHOW_ANSWER');          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);      my $availablestudent = &Apache::lonnet::EXT("resource.0.availablestudent",$symb);
Line 369  sub check_slot_access { Line 376  sub check_slot_access {
                         $earlyout = 1;                          $earlyout = 1;
                     }                      }
                 }                  }
                 if (($currtries == $maxtries) || ($is_correct)) {                  if ($currtries == $maxtries) {
                     $earlyout = 1;                      $earlyout = 1;
                 } else {                   } else { 
                     $numgraded ++;                      $numgraded ++;
Line 1879  sub do_ltipassback { Line 1886  sub do_ltipassback {
                     my ($cdom,$cnum) = ($1,$2);                      my ($cdom,$cnum) = ($1,$2);
                     my $ckey = $item->{'lti'}->{'key'};                      my $ckey = $item->{'lti'}->{'key'};
                     my $secret = $item->{'lti'}->{'secret'};                      my $secret = $item->{'lti'}->{'secret'};
                       my $msgformat = $item->{'lti'}->{'passbackformat'};
                       my $sigmethod = 'HMAC-SHA1';
                     my $id = $item->{'pbid'};                      my $id = $item->{'pbid'};
                     my $url = $item->{'pburl'};                      my $url = $item->{'pburl'};
                     my $scope = $item->{'scope'};                      my $scope = $item->{'scope'};
Line 1897  sub do_ltipassback { Line 1906  sub do_ltipassback {
                         ($total,$possible) = &get_lti_score($uname,$udom);                          ($total,$possible) = &get_lti_score($uname,$udom);
                     }                      }
                     if (($ckey ne '') && ($secret ne '') && ($id ne '') && ($url ne '') && ($possible)) {                      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);
                     }                      }
                 }                  }
             }              }

Removed from v.1.371  
changed lines
  Added in v.1.374


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>