--- loncom/interface/lonnavmaps.pm 2017/08/21 21:29:56 1.533 +++ loncom/interface/lonnavmaps.pm 2017/09/03 18:52:27 1.534 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.533 2017/08/21 21:29:56 raeburn Exp $ +# $Id: lonnavmaps.pm,v 1.534 2017/09/03 18:52:27 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2886,37 +2886,17 @@ sub recursed_crumbs { my (@revmapinfo,@revmapres); my $mapres = $self->getResourceByUrl($mapurl); if (ref($mapres)) { - @revmapres = map { $self->getByMapPc($_); } split(/,/,$mapres->map_hierarchy()); + @revmapres = map { $self->getByMapPc($_); } split(/,/,$mapres->map_breadcrumbs()); shift(@revmapres); - push(@revmapres,$mapres); } - my %toplevel; foreach my $map (@revmapres) { my $pc = $map->map_pc(); next if ((!$pc) || ($pc == 1)); - my $func = sub { return ($_[0]->src() ne $map->src); }; - my @resources = $self->retrieveResources($map->src,$func,0); - my $count = 0; - my $notmap = 0; - foreach my $res (@resources) { - next unless (ref($res)); - my $symb = $res->symb(); - unless ($toplevel{$symb}) { - $toplevel{$symb} = $res->src; - $count ++; - unless ($res->is_map()) { - $notmap ++; - } - } - } - if (($count > 1) || ($count && $notmap)) { - push(@revmapinfo,{'href' => $map->link().'?navmap=1','text' => $map->title(),'no_mt' => 1,}); - } + push(@revmapinfo,{'href' => $map->link().'?navmap=1','text' => $map->title(),'no_mt' => 1,}); } return @revmapinfo; } - # # Determines the open/close dates for printing a map that # encloses a resource. @@ -4564,6 +4544,12 @@ Returns a string with a comma-separated for the hierarchy of maps containing a map, with the top level map first, then descending to deeper levels, with the enclosing map last. +=item * B: + +Same as map_hierarchy, except maps containing only a single itemm if +it's a map, or containing no items are omitted, unless it's the top +level map (map_pc = 1), which is always included. + =back =cut @@ -4599,6 +4585,11 @@ sub map_hierarchy { my $pc = $self->map_pc(); return $self->navHash("map_hierarchy_$pc", 0); } +sub map_breadcrumbs { + my $self = shift; + my $pc = $self->map_pc(); + return $self->navHash("map_breadcrumbs_$pc", 0); +} ##### # Property queries