Diff for /loncom/interface/lonexttool.pm between versions 1.4 and 1.5

version 1.4, 2016/06/06 17:40:48 version 1.5, 2017/11/30 01:52:14
Line 104  sub handler { Line 104  sub handler {
                                        };                                         };
                 $toolhash{'crslabel'} = $toolsettings{'crslabel'};                  $toolhash{'crslabel'} = $toolsettings{'crslabel'};
                 $toolhash{'crstitle'} = $toolsettings{'crstitle'};                  $toolhash{'crstitle'} = $toolsettings{'crstitle'};
                   $toolhash{'crsappend'} = $toolsettings{'crsappend'};
                 $is_tool = 1;                  $is_tool = 1;
                 if ($target eq 'tex') {                  if ($target eq 'tex') {
                     $r->print(&mt('External Tool'));                      $r->print(&mt('External Tool'));
Line 111  sub handler { Line 112  sub handler {
                     my $submittext = &mt('Launch [_1]',$toolhash{'title'});                      my $submittext = &mt('Launch [_1]',$toolhash{'title'});
                     if (($toolhash{'key'} ne '') && ($toolhash{'secret'} ne '') && ($toolhash{'url'} ne '')) {                      if (($toolhash{'key'} ne '') && ($toolhash{'secret'} ne '') && ($toolhash{'url'} ne '')) {
                         my %lti = &lti_params($r,$cnum,$cdom,$submittext,\%toolhash);                          my %lti = &lti_params($r,$cnum,$cdom,$submittext,\%toolhash);
                         $r->print(&launch_html($toolhash{'url'},$toolhash{'key'},                          my $url = $toolhash{'url'};
                                                $toolhash{'secret'},$submittext,\%lti));                          if ($toolhash{'crsappend'} ne '') {
                               $url .= $toolhash{'crsappend'};
                           }
                           $r->print(&launch_html($url,$toolhash{'key'},$toolhash{'secret'},
                                                  $submittext,\%lti));
                     } else {                      } else {
                         $r->print('<div>'.&mt('External Tool Unavailable').'</div>');                          $r->print('<div>'.&mt('External Tool Unavailable').'</div>');
                     }                      }
Line 245  sub lti_params { Line 250  sub lti_params {
         }           } 
         if ($passback) {          if ($passback) {
             if ($ltirole eq 'Learner') {              if ($ltirole eq 'Learner') {
                 $ltiparams{'lis_outcome_service_url'} = $crsprotocol.'//'.$crshostname.'/adm/ltipassback';                  $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'};
                 $ltiparams{'lis_result_sourcedid'} = ''; #FIXME                  $ltiparams{'lis_result_sourcedid'} = ''; #FIXME
             }              }
         }          }
         if ($roster) {          if ($roster) {
             if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {              if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {
                 $ltiparams{'ext_ims_lis_memberships_url'} = $crsprotocol.'//'.$crshostname.'/adm/ltiroster';                  $ltiparams{'ext_ims_lis_memberships_url'} = $crsprotocol.'//'.$crshostname.'/adm/service/roster';
                 $ltiparams{'ext_ims_lis_memberships_id'} = ''; #FIXME                  $ltiparams{'ext_ims_lis_memberships_id'} = ''; #FIXME
             }              }
         }          }
Line 291  sub lti_params { Line 296  sub lti_params {
     }      }
     if (keys(%custom)) {      if (keys(%custom)) {
         foreach my $key (keys(%custom)) {          foreach my $key (keys(%custom)) {
             $ltiparams{'custom_'.$key} = $custom{$key};              my $value = $custom{$key};
               $value =~ s/^\s+|\s+\$//g;
               if ($value =~ /^\QLONCAPA::env{\E([^\}]+)\}$/) {
                   if (exists($env{$1})) {
                       $value = $env{$1};
                   }
               }
               $ltiparams{'custom_'.$key} = $value;
         }          }
     }      }
     foreach my $key (keys(%ltiparams)) {      foreach my $key (keys(%ltiparams)) {
Line 304  sub lti_params { Line 316  sub lti_params {
 sub launch_html {  sub launch_html {
     my ($url,$key,$secret,$submittext,$paramsref) = @_;      my ($url,$key,$secret,$submittext,$paramsref) = @_;
     my $hashref = &sign_params($url,$key,$secret,$paramsref);      my $hashref = &sign_params($url,$key,$secret,$paramsref);
       my $action = &HTML::Entities::encode($url,'<>&"');
     my $form = <<"END";      my $form = <<"END";
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">  <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <body>  <body>
 <div id="LCltiLaunch">  <div id="LCltiLaunch">
 <form name="LCltiLaunchForm" id="LCltiLaunchFormId" action="$url" method="post" encType="application/x-www-form-urlencoded">  <form name="LCltiLaunchForm" id="LCltiLaunchFormId" action="$action" method="post" encType="application/x-www-form-urlencoded">
 END  END
     if (ref($hashref) eq 'HASH') {      if (ref($hashref) eq 'HASH') {
         foreach my $item (keys(%{$hashref})) {          foreach my $item (keys(%{$hashref})) {

Removed from v.1.4  
changed lines
  Added in v.1.5


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