--- loncom/interface/lonnavmaps.pm 2018/11/13 03:59:00 1.543 +++ loncom/interface/lonnavmaps.pm 2019/01/16 21:49:39 1.547 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.543 2018/11/13 03:59:00 raeburn Exp $ +# $Id: lonnavmaps.pm,v 1.547 2019/01/16 21:49:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1490,10 +1490,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 +1831,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 +1902,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,14 +1936,20 @@ 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://})) { - if ($hostname ne '') { - $src = 'http://'.$hostname.$src; + unless (&Apache::lonnet::uses_sts()) { + if ($hostname ne '') { + $src = 'http://'.$hostname.$src; + } + $src .= ($srcHasQuestion? '&' : '?') . 'usehttp=1'; + $srcHasQuestion = 1; } - $src .= ($srcHasQuestion? '&' : '?') . 'usehttp=1'; - $srcHasQuestion = 1; } elsif (($is_ssl) && ($src =~ m{^\Q/adm/wrapper/ext/\E(?!https:)})) { - if ($hostname ne '') { - $src = 'http://'.$hostname.$src; + unless (&Apache::lonnet::uses_sts()) { + if ($hostname ne '') { + $src = 'http://'.$hostname.$src; + } + $src .= ($srcHasQuestion? '&' : '?') . 'usehttp=1'; + $srcHasQuestion = 1; } } } @@ -2985,7 +2994,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); @@ -3000,7 +3009,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,}); } } } @@ -5140,14 +5149,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