--- loncom/interface/lonexttool.pm 2018/08/14 18:20:17 1.20 +++ loncom/interface/lonexttool.pm 2023/07/05 18:42:48 1.22.2.3 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Launch External Tool Provider (LTI) # -# $Id: lonexttool.pm,v 1.20 2018/08/14 18:20:17 raeburn Exp $ +# $Id: lonexttool.pm,v 1.22.2.3 2023/07/05 18:42:48 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -96,13 +96,20 @@ sub handler { my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; - my ($idx,$is_tool,%toolhash,%toolsettings); + my ($idx,$crstool,$is_tool,%toolhash,%toolsettings); if ($r->uri eq "/adm/$cdom/$cnum/$marker/$exttool") { %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum); if ($toolsettings{'id'}) { - $idx = $toolsettings{'id'}; - my %ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer'); + my %ltitools; + if ($toolsettings{'id'} =~ /^c(\d+)$/) { + $idx = $1; + $crstool = 1; + %ltitools = &Apache::lonnet::get_course_lti($cnum,$cdom,'consumer'); + } else { + $idx = $toolsettings{'id'}; + %ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer'); + } if (ref($ltitools{$idx}) eq 'HASH') { %toolhash = %{$ltitools{$idx}}; $toolhash{'display'} = { @@ -204,17 +211,19 @@ sub handler { } } my $submittext = &mt('Launch [_1]',$toolhash{'title'}); - if (($toolhash{'key'} ne '') && ($toolhash{'secret'} ne '') && - ($toolhash{'url'} ne '') && ($launchok)) { + if (($toolhash{'url'} ne '') && ($launchok)) { my %lti = <i_params($r,$cnum,$cdom,$idx,$submittext,\%toolhash); my $url = $toolhash{'url'}; if ($toolhash{'crsappend'} ne '') { $url .= $toolhash{'crsappend'}; } - $r->print(&launch_html($url,$toolhash{'key'},$toolhash{'secret'}, - $toolhash{'sigmethod'},$submittext,\%lti)); + my %info = ( + method => $toolhash{'sigmethod'}, + ); + $r->print(&launch_html($cdom,$cnum,$crstool,$url,$idx, + $toolhash{'cipher'},$submittext,\%lti,\%info)); } else { - $r->print('