Diff for /loncom/interface/lonexttool.pm between versions 1.15 and 1.17

version 1.15, 2017/12/30 19:51:30 version 1.17, 2018/01/04 12:37:49
Line 110  sub handler { Line 110  sub handler {
                                            width  => $toolsettings{'width'},                                             width  => $toolsettings{'width'},
                                            height => $toolsettings{'height'},                                             height => $toolsettings{'height'},
                                        };                                         };
                 $toolhash{'crslabel'} = $toolsettings{'crslabel'};                  foreach my $item (qw(crslabel crstitle crsappend gradable incdom)) {
                 $toolhash{'crstitle'} = $toolsettings{'crstitle'};                      $toolhash{$item} = $toolsettings{$item};
                 $toolhash{'crsappend'} = $toolsettings{'crsappend'};                  }
                 $toolhash{'gradable'} = $toolsettings{'gradable'};  
                 $is_tool = 1;                  $is_tool = 1;
             }              }
         }          }
Line 225  sub lti_params { Line 224  sub lti_params {
     my ($r,$cnum,$cdom,$idx,$submittext,$toolsref) = @_;      my ($r,$cnum,$cdom,$idx,$submittext,$toolsref) = @_;
     my ($version,$context_type,$msgtype,$toolname,$passback,$roster,$locale,      my ($version,$context_type,$msgtype,$toolname,$passback,$roster,$locale,
         $crslabel,$crstitle,$gradesecret,$rostersecret,%fields,%rolesmap,          $crslabel,$crstitle,$gradesecret,$rostersecret,%fields,%rolesmap,
         %display,%custom,@userlangs);          %display,%custom,@userlangs,$incdom);
     if (ref($toolsref) eq 'HASH') {      if (ref($toolsref) eq 'HASH') {
         $version = $toolsref->{'version'};          $version = $toolsref->{'version'};
         $toolname = $toolsref->{'title'};          $toolname = $toolsref->{'title'};
Line 234  sub lti_params { Line 233  sub lti_params {
         $roster = $toolsref->{'roster'};          $roster = $toolsref->{'roster'};
         $rostersecret = $toolsref->{'rostersecret'};          $rostersecret = $toolsref->{'rostersecret'};
         $msgtype = $toolsref->{'messagetype'};          $msgtype = $toolsref->{'messagetype'};
           $incdom = $toolsref->{'incdom'};
         if (ref($toolsref->{'fields'}) eq 'HASH') {          if (ref($toolsref->{'fields'}) eq 'HASH') {
             %fields = %{$toolsref->{'fields'}};              %fields = %{$toolsref->{'fields'}};
         }          }
Line 274  sub lti_params { Line 274  sub lti_params {
     unless (grep(/^\Q$ltirole\E$/,@possroles)) {      unless (grep(/^\Q$ltirole\E$/,@possroles)) {
         $ltirole = 'Learner';          $ltirole = 'Learner';
     }      }
       my @possdigest;
     my $digest_user = &Encode::decode_utf8($uname.':'.$udom);      my $digest_user = &Encode::decode_utf8($uname.':'.$udom);
     $digest_user = &Digest::SHA::sha1_hex($digest_user);      $digest_user = &Digest::SHA::sha1_hex($digest_user);
       push(@possdigest,$digest_user);
     if ($env{'course.'.$env{'request.course.id'}.'.languages'} ne '') {      if ($env{'course.'.$env{'request.course.id'}.'.languages'} ne '') {
         @userlangs=(@userlangs,split(/\s*(\,|\;|\:)\s*/,          @userlangs=(@userlangs,split(/\s*(\,|\;|\:)\s*/,
                     $env{'course.'.$env{'request.course.id'}.'.languages'}));                      $env{'course.'.$env{'request.course.id'}.'.languages'}));
Line 298  sub lti_params { Line 300  sub lti_params {
     if ($symb) {      if ($symb) {
         $digest_symb = &Encode::decode_utf8($symb);          $digest_symb = &Encode::decode_utf8($symb);
         $digest_symb = &Digest::SHA::sha1_hex($digest_symb);          $digest_symb = &Digest::SHA::sha1_hex($digest_symb);
           push(@possdigest,$digest_symb);
         my $navmap = Apache::lonnavmaps::navmap->new();          my $navmap = Apache::lonnavmaps::navmap->new();
         if (ref($navmap)) {          if (ref($navmap)) {
             my $res = $navmap->getBySymb($symb);              my $res = $navmap->getBySymb($symb);
Line 338  sub lti_params { Line 341  sub lti_params {
             $crsprotocol = 'http';              $crsprotocol = 'http';
         }          }
         if (($passback) || ($roster)) {          if (($passback) || ($roster)) {
               my (%currdigest,%digesthash);
               if (@possdigest) {
                   %currdigest = &Apache::lonnet::get('exttools',\@possdigest,
                                                      $cdom,$cnum);
               }
             if ($passback) {              if ($passback) {
                 $ltiparams{'lis_outcome_service_url'} = $crsprotocol.'://'.$crshostname.'/adm/service/passback';                  $ltiparams{'lis_outcome_service_url'} = $crsprotocol.'://'.$crshostname.'/adm/service/passback';
                 $ltiparams{'ext_ims_lis_basic_outcome_url'} = $ltiparams{'lis_outcome_service_url'};                  $ltiparams{'ext_ims_lis_basic_outcome_url'} = $ltiparams{'lis_outcome_service_url'};
Line 355  sub lti_params { Line 363  sub lti_params {
                     }                      }
                 }                  }
             }              }
             my %digesthash;  
             if ($ltiparams{'lis_result_sourcedid'}) {  
                 $digesthash{$ltiparams{'lis_result_sourcedid'}} = "$idx\0".time;   
             }  
             if ($ltiparams{'ext_ims_lis_memberships_id'}) {  
                 $digesthash{$ltiparams{'ext_ims_lis_memberships_id'}} = "$idx\0".time;   
             }  
             if (($digest_symb) && ($gradesecret || $rostersecret)) {              if (($digest_symb) && ($gradesecret || $rostersecret)) {
                 $digesthash{$digest_symb} = $symb;                  unless ((exists($currdigest{$digest_symb})) && ($currdigest{$digest_symb} eq $symb)) {
                       $digesthash{$digest_symb} = $symb;
                   }
             }              }
             if (($passback) && ($gradesecret)) {              if (($passback) && ($gradesecret)) {
                 $digesthash{$digest_user} = $uname.':'.$udom;                  unless ((exists($currdigest{$digest_user})) && ($currdigest{$digest_user} eq $uname.':'.$udom)) {
                       $digesthash{$digest_user} = $uname.':'.$udom;
                   }
             }              }
             if (keys(%digesthash)) {              if (keys(%digesthash)) {
                 &Apache::lonnet::put('exttools',\%digesthash,$cdom,$cnum);                  &Apache::lonnet::put('exttools',\%digesthash,$cdom,$cnum);
Line 403  sub lti_params { Line 408  sub lti_params {
         $ltiparams{'lis_person_contact_email_primary'} = $contact_email;          $ltiparams{'lis_person_contact_email_primary'} = $contact_email;
     }      }
     if ($fields{'user'}) {      if ($fields{'user'}) {
         $ltiparams{'lis_person_sourcedid'} = $uname.':'.$udom;          if ($incdom) {
               $ltiparams{'lis_person_sourcedid'} = $uname.':'.$udom;
           } else {
               $ltiparams{'lis_person_sourcedid'} = $uname;
           }
     }      }
     if (keys(%custom)) {      if (keys(%custom)) {
         foreach my $key (keys(%custom)) {          foreach my $key (keys(%custom)) {

Removed from v.1.15  
changed lines
  Added in v.1.17


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