--- loncom/lontrans.pm 2016/08/16 20:17:54 1.16 +++ loncom/lontrans.pm 2017/11/30 15:14:58 1.17 @@ -1,7 +1,7 @@ # The LearningOnline Network # URL translation for User Files # -# $Id: lontrans.pm,v 1.16 2016/08/16 20:17:54 raeburn Exp $ +# $Id: lontrans.pm,v 1.17 2017/11/30 15:14:58 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -38,7 +38,34 @@ sub handler { my $r = shift; # FIXME line remove when mod_perl fixes BUG#4948 $r->notes->set('error-notes' => ''); - if ($r->uri=~m{^/raw/}) { + if ($r->uri =~ m{^/adm/lti/(.+)$}) { + my $realuri = $1; + my %user; + my $handle = &Apache::lonnet::check_for_valid_session($r,undef,\%user); + if (($handle ne '') && ($user{'lti'})) { + if ($realuri =~ m{^uploaded/$match_domain/$match_courseid/(default|supplemental)(|_\d+)\.(?:sequence|page)___\d+___.+$}) { + my ($map,$resid,$url) = split(/___/,$realuri); + $realuri = &Apache::lonnet::clutter($url).'?symb='.$realuri; + } elsif ($realuri =~ m{($match_domain)/($match_courseid)$}) { + $realuri = '/adm/navmaps'; + } else { + $realuri = '/'.$realuri; + if ($realuri =~ m{/default_\d+\.sequence$}) { + $realuri .= (($realuri =~/\?/)?'&':'?').'navmap=1'; + } + } + my $host = $r->headers_in->get('Host'); + if ($host) { + my $protocol = 'http'; + if ($r->get_server_port == 443) { + $protocol = 'https'; + } + my $location = $protocol.'://'.$host.$realuri; + $r->headers_out->set(Location => $location); + return REDIRECT; + } + } + } elsif ($r->uri=~m{^/raw/}) { my $host = $r->headers_in->get('Host'); if ($host) { unless ($host =~ /^internal\-/) {