--- loncom/interface/londocs.pm 2016/10/31 12:59:03 1.609 +++ loncom/interface/londocs.pm 2016/10/31 19:48:59 1.610 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.609 2016/10/31 12:59:03 raeburn Exp $ +# $Id: londocs.pm,v 1.610 2016/10/31 19:48:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3927,6 +3927,13 @@ END $url=''; } } + } elsif ($supplementalflag) { + if ($isexternal) { + if ($url =~ /^([^#]+)#([^#]+)$/) { + $url = $1; + $anchor = $2; + } + } } my ($rand_pick_text,$rand_order_text); if ($isfolder || $ispage || $extension eq 'sequence' || $extension eq 'page') { @@ -3999,6 +4006,9 @@ $form_end; if ((($isexternal) || ($isexttool)) && $orderidx) { $url .= '&idx='.$orderidx; } + if ($anchor ne '') { + $url .= '&anchor='.&HTML::Entities::encode($anchor,'"<>&'); + } } my ($tdalign,$tdwidth); if ($allowed) { @@ -4016,13 +4026,17 @@ $form_end; my ($cfile,$home,$switchserver,$forceedit,$forceview) = &Apache::lonnet::can_edit_resource($fileloc,$coursenum,$coursedom,$orig_url); if (($cfile ne '') && ($symb ne '' || $supplementalflag)) { + my $suppanchor; + if ($supplementalflag) { + $suppanchor = $anchor; + } my $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home, $switchserver, $forceedit, undef,$symb, &escape($env{'form.folderpath'}), - $renametitle,'','',1); + $renametitle,'','',1,$suppanchor); if ($jscall) { $editlink = ''.&mt('Edit').' '."\n"; @@ -4042,8 +4056,15 @@ $form_end; if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { $line.=''; } elsif ($url) { + if ($anchor ne '') { + if ($supplementalflag) { + $anchor = '&anchor='.&HTML::Entities::encode($anchor,'"<>&'); + } else { + $anchor = '#'.&HTML::Entities::encode($anchor,'"<>&'); + } + } $line.=&Apache::loncommon::modal_link($url.(($url=~/\?/)?'&':'?').'inhibitmenu=yes'. - (($anchor ne '')?'#'.&HTML::Entities::encode($anchor,'"<>&'):''), + (($anchor ne '')?$anchor:''), '',600,500); } else { $line.=''; @@ -4053,7 +4074,7 @@ $form_end; $line.=''.$title.''; } elsif ($url) { $line.=&Apache::loncommon::modal_link($url.(($url=~/\?/)?'&':'?').'inhibitmenu=yes'. - (($anchor ne '')?'#'.&HTML::Entities::encode($anchor,'"<>&'):''), + (($anchor ne '')?$anchor:''), $title,600,500); } else { $line.=$title.' '.$reinit.'';