--- loncom/interface/lonnavmaps.pm 2018/12/27 20:10:31 1.544 +++ loncom/interface/lonnavmaps.pm 2020/03/05 16:45:36 1.549 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.544 2018/12/27 20:10:31 raeburn Exp $ +# $Id: lonnavmaps.pm,v 1.549 2020/03/05 16:45:36 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -592,7 +592,11 @@ sub getLinkForResource { my $anchor; if ($res->is_page()) { foreach my $item (@$stack) { if (defined($item)) { $anchor = $item; } } - $anchor=&escape($anchor->shown_symb()); + if ($anchor->encrypted() && !&advancedUser()) { + $anchor='LC_'.$anchor->id(); + } else { + $anchor=&escape($anchor->shown_symb()); + } return ($res->link(),$res->shown_symb(),$anchor); } # in case folder was skipped over as "only sequence" @@ -1490,10 +1494,13 @@ sub render { if ($args->{'iterator_map'}) { my $map = $args->{'iterator_map'}; $map = $navmap->getResourceByUrl($map); - my $firstResource = $map->map_start(); - my $finishResource = $map->map_finish(); - - $args->{'iterator'} = $it = $navmap->getIterator($firstResource, $finishResource, $filterHash, $condition); + if (ref($map)) { + my $firstResource = $map->map_start(); + my $finishResource = $map->map_finish(); + $args->{'iterator'} = $it = $navmap->getIterator($firstResource, $finishResource, $filterHash, $condition); + } else { + return; + } } else { $args->{'iterator'} = $it = $navmap->getIterator(undef, undef, $filterHash, $condition,undef,$args->{'include_top_level_map'}); } @@ -1828,7 +1835,7 @@ END } } else { my $deeplink = $navmap->get_mapparam(undef,$mapname,"0.deeplink"); - if (($deeplink eq 'absent') || ($deeplink eq 'grades')) { + if ($deeplink =~ /^(absent|grades),/) { if ($userCanSeeHidden) { $args->{'mapUnlisted'} = 1; } else { @@ -1899,10 +1906,10 @@ END } } # If deep-link parameter is set (and is not set to full) suppress link - # unless priviliged user, or calling context is sequence, and parameter + # unless privileged user, or calling context is sequence, and parameter # set at map level if ((!$curRes->deeplink($args->{'caller'})) || - ($curRes->deeplink($args->{'caller'}) eq 'full') || &advancedUser()) { + ($curRes->deeplink($args->{'caller'}) =~ /^full,/) || &advancedUser()) { $args->{'resource_nolink'} = 0; } else { $args->{'resource_nolink'} = 1; @@ -1938,7 +1945,7 @@ END $src = 'http://'.$hostname.$src; } $src .= ($srcHasQuestion? '&' : '?') . 'usehttp=1'; - $srcHasQuestion = 1;a + $srcHasQuestion = 1; } } elsif (($is_ssl) && ($src =~ m{^\Q/adm/wrapper/ext/\E(?!https:)})) { unless (&Apache::lonnet::uses_sts()) { @@ -1985,7 +1992,7 @@ END $currentJumpDelta) { # Jam the anchor after the tag; # necessary for valid HTML (which Mozilla requires) - $colHTML =~ s/\>/\>\/; + $colHTML =~ s/\>/\>\\<\/a\>/; $displayedJumpMarker = 1; } $result .= $colHTML . "\n"; @@ -2991,7 +2998,7 @@ sub recursed_crumbs { my $pc = $map->map_pc(); next if ((!$pc) || ($pc == 1)); push(@links,$map); - push(@revmapinfo,{'href' => $map->link().'?navmap=1','text' => $map->title(),'no_mt' => 1,}); + push(@revmapinfo,{'href' => $env{'request.use_absolute'}.$map->link().'?navmap=1','text' => $map->title(),'no_mt' => 1,}); $totallength += length($map->title()); } my $numlinks = scalar(@links); @@ -3006,7 +3013,7 @@ sub recursed_crumbs { foreach my $map (@links) { my $showntitle = &truncate_crumb_text($map->title(),$avg); if ($showntitle ne '') { - push(@revmapinfo,{'href' => $map->link().'?navmap=1','text' => $showntitle,'no_mt' => 1,}); + push(@revmapinfo,{'href' => $env{'request.use_absolute'}.$map->link().'?navmap=1','text' => $showntitle,'no_mt' => 1,}); } } } @@ -5146,14 +5153,17 @@ sub slot_control { } sub deeplink { my ($self,$caller) = @_; - if ($caller eq 'sequence') { - my @deeplink = $self->parmval("deeplink"); - if ($deeplink[1] eq 'resource') { - return $deeplink[0]; + my $value = $self->parmval("deeplink"); + if ($value) { + my @deeplink = split(/,/,$value); + if ($caller eq 'sequence') { + if ($deeplink[1] ne 'res') { + return; + } } - } else { - return $self->parmval("deeplink"); + return $deeplink[0]; } + return; } # Multiple things need this