--- loncom/interface/lonnavmaps.pm 2004/02/13 20:31:40 1.247 +++ loncom/interface/lonnavmaps.pm 2004/03/09 21:26:59 1.253 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.247 2004/02/13 20:31:40 albertel Exp $ +# $Id: lonnavmaps.pm,v 1.253 2004/03/09 21:26:59 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -290,8 +290,16 @@ sub getLinkForResource { # Check to see if there are any pages in the stack foreach $res (@$stack) { - if (defined($res) && $res->is_page()) { - return $res->src(); + if (defined($res)) { + if ($res->is_page()) { + return $res->src(); + } + # in case folder was skipped over as "only sequence" + my ($map,$id,$src)=&Apache::lonnet::decode_symb($res->symb()); + if ($map=~/\.page$/) { + return &Apache::lonnet::clutter($map).'#'. + &Apache::lonnet::escape(&Apache::lonnet::declutter($src)); + } } } @@ -306,9 +314,9 @@ sub getLinkForResource { return $res->src(); } -# Convenience function: This seperates the logic of how to create +# Convenience function: This separates the logic of how to create # the problem text strings ("Due: DATE", "Open: DATE", "Not yet assigned", -# etc.) into a seperate function. It takes a resource object as the +# etc.) into a separate function. It takes a resource object as the # first parameter, and the part number of the resource as the second. # It's basically a big switch statement on the status of the resource. @@ -373,7 +381,7 @@ sub getDescription { # Convenience function, so others can use it: Is the problem due in less then # 24 hours, and still can be done? -sub dueInLessThen24Hours { +sub dueInLessThan24Hours { my $res = shift; my $part = shift; my $status = $res->status($part); @@ -1056,7 +1064,7 @@ sub render_long_status { if ($resource->is_problem()) { $color = $colormap{$resource->status}; - if (dueInLessThen24Hours($resource, $part) || + if (dueInLessThan24Hours($resource, $part) || lastTry($resource, $part)) { $color = $hurryUpColor; } @@ -1118,7 +1126,7 @@ sub render_parts_summary_status { # If there is a single part, just show the simple status if ($resource->singlepart()) { - my $status = $resource->simpleStatus('0'); + my $status = $resource->simpleStatus(${$resource->parts}[0]); return $td . "" . $statusStrings{$status} . "" . $endtd; } @@ -1532,11 +1540,15 @@ sub render { my $filter = $it->{FILTER}; my $stack = $it->getStack(); my $src = getLinkForResource($stack); - + my $anchor=''; + if ($src=~s/(\#.*$)//) { + $anchor=$1; + } my $srcHasQuestion = $src =~ /\?/; $args->{"resourceLink"} = $src. ($srcHasQuestion?'&':'?') . - 'symb=' . &Apache::lonnet::escape($curRes->symb()); + 'symb=' . &Apache::lonnet::escape($curRes->symb()). + $anchor; # Now, display each column. foreach my $col (@$cols) { @@ -2730,7 +2742,7 @@ package Apache::lonnavmaps::DFSiterator; # useful for pre-processing of some kind, and is in fact used by the main # iterator that way, but that's about it. # One could imagine merging this into the init routine of the main iterator, -# but this might as well be left seperate, since it is possible some other +# but this might as well be left separate, since it is possible some other # use might be found for it. - Jeremy # Unlike the main iterator, this DOES return all resources, even blank ones. @@ -3163,7 +3175,7 @@ sub is_page { sub is_problem { my $self=shift; my $src = $self->src(); - return ($src =~ /problem$/); + return ($src =~ /\.(problem|exam|quiz|assess|survey|form|library)$/); } sub is_sequence { my $self=shift; @@ -3838,7 +3850,7 @@ sub getCompletionStatus { my $status = $self->queryRestoreHash('solved', shift); - # Left as seperate if statements in case we ever do more with this + # Left as separate if statements in case we ever do more with this if ($status eq 'correct_by_student') {return $self->CORRECT;} if ($status eq 'correct_by_override') {return $self->CORRECT_BY_OVERRIDE; } if ($status eq 'incorrect_attempted') {return $self->INCORRECT; }