--- rat/lonwrapper.pm 2016/08/05 21:34:54 1.49.2.1 +++ rat/lonwrapper.pm 2016/10/31 21:31:42 1.49.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Wrapper for external and binary files as standalone resources # -# $Id: lonwrapper.pm,v 1.49.2.1 2016/08/05 21:34:54 raeburn Exp $ +# $Id: lonwrapper.pm,v 1.49.2.2 2016/10/31 21:31:42 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -53,10 +53,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'}; } } @@ -161,11 +165,21 @@ sub handler { if ($is_ext) { &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/))) { + 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'}; + } + } $r->print( &Apache::lonextresedit::display_editor($url,$env{'form.folderpath'}, $env{'form.symb'},