--- loncom/interface/lonnavmaps.pm 2018/12/29 23:24:40 1.545 +++ loncom/interface/lonnavmaps.pm 2021/07/14 03:58:17 1.552 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.545 2018/12/29 23:24:40 raeburn Exp $ +# $Id: lonnavmaps.pm,v 1.552 2021/07/14 03:58:17 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; @@ -1933,7 +1940,7 @@ END if ($env{'request.course.id'}) { if (($is_ssl) && ($src =~ m{^\Q/public/$cdom/$cnum/syllabus\E($|\?)}) && ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) { - unless (&Apache::lonnet::uses_sts()) { + unless ((&Apache::lonnet::uses_sts()) || (&Apache::lonnet::waf_allssl($hostname))) { if ($hostname ne '') { $src = 'http://'.$hostname.$src; } @@ -1941,7 +1948,7 @@ END $srcHasQuestion = 1; } } elsif (($is_ssl) && ($src =~ m{^\Q/adm/wrapper/ext/\E(?!https:)})) { - unless (&Apache::lonnet::uses_sts()) { + unless ((&Apache::lonnet::uses_sts()) || (&Apache::lonnet::waf_allssl($hostname))) { if ($hostname ne '') { $src = 'http://'.$hostname.$src; } @@ -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"; @@ -3236,6 +3243,9 @@ sub get_mapparam { if (defined($$courseopt{$courselevelm})) { return $$courseopt{$courselevelm}; } + if (defined($$courseopt{$courseleveli})) { + return $$courseopt{$courseleveli}; + } unless ($recursed) { @recurseup = $self->recurseup_maps($mapname); $recursed = 1; @@ -4014,7 +4024,8 @@ sub next { # That ends the main iterator logic. Now, do we want to recurse # down this map (if this resource is a map)? if ( ($self->{HERE}->is_sequence() || (!$closeAllPages && $self->{HERE}->is_page())) && - (defined($self->{FILTER}->{$self->{HERE}->map_pc()}) xor $self->{CONDITION})) { + (defined($self->{FILTER}->{$self->{HERE}->map_pc()}) xor $self->{CONDITION}) && + ($env{'request.role.adv'} || !$self->{HERE}->randomout())) { $self->{RECURSIVE_ITERATOR_FLAG} = 1; my $firstResource = $self->{HERE}->map_start(); my $finishResource = $self->{HERE}->map_finish(); @@ -5146,14 +5157,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