--- loncom/interface/lonnavmaps.pm 2004/12/12 21:17:04 1.309 +++ loncom/interface/lonnavmaps.pm 2004/12/14 15:56:41 1.310 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.309 2004/12/12 21:17:04 albertel Exp $ +# $Id: lonnavmaps.pm,v 1.310 2004/12/14 15:56:41 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1849,7 +1849,26 @@ END # Add part 0 so we display it correctly. unshift @parts, '0'; } - + + { + my ($src,$symb,$anchor,$stack); + if ($args->{'sort'}) { + my $it = $navmap->getIterator(undef, undef, undef, 1); + while ( my $res=$it->next()) { + if (ref($res) && + $res->symb() eq $curRes->symb()) { last; } + } + $stack=$it->getStack(); + } else { + $stack=$it->getStack(); + } + ($src,$symb,$anchor)=getLinkForResource($stack); + if (defined($anchor)) { $anchor='#'.$anchor; } + my $srcHasQuestion = $src =~ /\?/; + $args->{"resourceLink"} = $src. + ($srcHasQuestion?'&':'?') . + 'symb=' . &Apache::lonnet::escape($symb).$anchor; + } # Now, we've decided what parts to show. Loop through them and # show them. foreach my $part (@parts) { @@ -1860,19 +1879,6 @@ END # Set up some data about the parts that the cols might want my $filter = $it->{FILTER}; - my ($src,$symb,$anchor); - if ($args->{'sort'}) { - $src = $curRes->src(); # FIXME this is wrong for .pages - $symb = $curRes->symb(); # FIXME this is wrong for .pages - } else { - my $stack = $it->getStack(); - ($src,$symb,$anchor)=getLinkForResource($stack); - } - if (defined($anchor)) { $anchor='#'.$anchor; } - my $srcHasQuestion = $src =~ /\?/; - $args->{"resourceLink"} = $src. - ($srcHasQuestion?'&':'?') . - 'symb=' . &Apache::lonnet::escape($symb).$anchor; # Now, display each column. foreach my $col (@$cols) {