--- loncom/interface/londocs.pm 2018/12/29 23:24:39 1.658 +++ loncom/interface/londocs.pm 2019/04/11 14:22:35 1.660 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.658 2018/12/29 23:24:39 raeburn Exp $ +# $Id: londocs.pm,v 1.660 2019/04/11 14:22:35 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1819,14 +1819,7 @@ sub do_paste_from_buffer { # Retrieve information about all course maps in main content area my $allmaps = {}; - if ($folder =~ /^default/) { - $allmaps = - &Apache::loncommon::allmaps_incourse($coursedom,$coursenum, - $env{"course.$env{'request.course.id'}.home"}, - $env{'request.course.id'}); - } - - my (@toclear,%mapurls,%lockerrs,%msgerrs,%results); + my (@toclear,%mapurls,%lockerrs,%msgerrs,%results,$donechk); # Loop over the items to paste foreach my $suffix (@dopaste) { @@ -1844,6 +1837,13 @@ sub do_paste_from_buffer { if ($is_map{$suffix}) { # If pasting a map, check if map contains other maps my (%hierarchy,%titles); + if (($folder =~ /^default/) && (!$donechk)) { + $allmaps = + &Apache::loncommon::allmaps_incourse($coursedom,$coursenum, + $env{"course.$env{'request.course.id'}.home"}, + $env{'request.course.id'}); + $donechk = 1; + } &contained_map_check($url,$folder,$coursenum,$coursedom, \%removefrommap,\%removeparam,\%addedmaps, \%hierarchy,\%titles,$allmaps); @@ -4183,9 +4183,8 @@ END if ($url =~ /^([^#]+)#([^#]+)$/) { $url = $1; $anchor = $2; - if ($symb =~ m{^([^#]+)\Q#$anchor\E$}) { - $shownsymb = $1.&escape('#').$anchor; - } + my $escan = &escape('#'); + $shownsymb =~ s/^([^\#]+)#([^\#]+)$/$1$escan$2/; } } unless ($env{'request.role.adv'}) { @@ -4437,8 +4436,7 @@ $form_end; } else { $link = $url; } - $link = &js_escape($link.(($url=~/\?/)?'&':'?').'inhibitmenu=yes'. - (($anchor ne '')?$anchor:'')); + $link = &js_escape($link.(($url=~/\?/)?'&':'?').'inhibitmenu=yes'.$anchor); if ($nomodal) { $line.=''. '';