--- rat/lonwrapper.pm 2016/10/31 12:59:11 1.52 +++ rat/lonwrapper.pm 2016/10/31 19:49:05 1.53 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Wrapper for external and binary files as standalone resources # -# $Id: lonwrapper.pm,v 1.52 2016/10/31 12:59:11 raeburn Exp $ +# $Id: lonwrapper.pm,v 1.53 2016/10/31 19:49:05 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -54,10 +54,14 @@ sub wrapper { ); my $anchor; - if (($is_ext) && ($env{'form.symb'})) { - (undef,undef,my $res) = &Apache::lonnet::decode_symb($env{'form.symb'}); - if ($res =~ /(#[^#]+)$/) { - $anchor = $1; + if ($is_ext) { + if ($env{'form.symb'}) { + (undef,undef,my $res) = &Apache::lonnet::decode_symb($env{'form.symb'}); + if ($res =~ /(#[^#]+)$/) { + $anchor = $1; + } + } elsif ($env{'form.anchor'} ne '') { + $anchor = '#'.$env{'form.anchor'}; } } @@ -176,14 +180,20 @@ sub handler { } if (($is_ext) || ($exttool)) { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, - ['forceedit','register','folderpath','symb','idx','title']); + ['forceedit','register','folderpath','symb','idx','title','anchor']); if (($env{'form.forceedit'}) && (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) && (($env{'form.folderpath'} =~ /^supplemental/) || ($env{'form.symb'} =~ /^uploaded/))) { - (undef,undef,my $res) = &Apache::lonnet::decode_symb($env{'form.symb'}); - if ($res =~ /(#[^#]+)$/) { - $url .= $1; + if ($env{'form.symb'}) { + (undef,undef,my $res) = &Apache::lonnet::decode_symb($env{'form.symb'}); + if ($res =~ /(#[^#]+)$/) { + $url .= $1; + } + } elsif ($env{'form.folderpath'} =~ /^supplemental/) { + if ($env{'form.anchor'} ne '') { + $url .= '#'.$env{'form.anchor'}; + } } my $type = 'ext'; my %ltitools;