--- rat/lonwrapper.pm 2017/04/25 22:19:03 1.60 +++ rat/lonwrapper.pm 2017/05/07 13:58:04 1.61 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Wrapper for external and binary files as standalone resources # -# $Id: lonwrapper.pm,v 1.60 2017/04/25 22:19:03 raeburn Exp $ +# $Id: lonwrapper.pm,v 1.61 2017/05/07 13:58:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -183,17 +183,26 @@ sub handler { if ($url =~ /\.pdf$/i) { $is_pdf = 1; - } elsif ($url =~ m{^/adm/($match_domain)/($match_courseid)/(\d+)/exttools?$}) { + } elsif ($url =~ m{^/adm/($match_domain)/($match_courseid)/(\d+)/exttool$}) { $cdom = $1; $cnum = $2; my $marker = $3; $exttool = 'iframe'; - my %toolhash = &Apache::lonnet::get('exttool_'.$marker,['target','linktext','explanation'], + my $exttoolremote; + my %toolhash = &Apache::lonnet::get('exttool_'.$marker,['target','linktext','explanation','id'], $cdom,$cnum); + if ($toolhash{'id'}) { + my %ltitools = &Apache::lonnet::get_domain_ltitools($cdom); + if (ref($ltitools{$toolhash{'id'}}) eq 'HASH') { + $exttoolremote = $ltitools{$toolhash{'id'}}{'url'}; + } + } if ($toolhash{'target'} eq 'window') { $exttool = 'window'; $linktext = $toolhash{'linktext'}; $explanation = $toolhash{'explanation'}; + } elsif (($exttoolremote =~ /^http:/) && ($ENV{'SERVER_PORT'} == 443)) { + $exttool = 'window'; } } if (($is_ext) || ($exttool)) {