--- loncom/interface/lonnavmaps.pm 2003/04/22 17:54:27 1.178 +++ loncom/interface/lonnavmaps.pm 2003/04/25 18:54:36 1.183 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.178 2003/04/22 17:54:27 bowersj2 Exp $ +# $Id: lonnavmaps.pm,v 1.183 2003/04/25 18:54:36 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -171,7 +171,7 @@ sub real_handler { # See if there's only one map in the top-level, if we don't # already have a filter... if so, automatically display it - if (!defined($ENV{'form.filter'})) { + if ($ENV{QUERY_STRING} !~ /filter/) { my $iterator = $navmap->getIterator(undef, undef, undef, 0); my $depth = 1; $iterator->next(); @@ -185,7 +185,7 @@ sub real_handler { if (ref($curRes) && $curRes->is_sequence()) { $sequenceCount++; $sequenceId = $curRes->map_pc(); - } + } $curRes = $iterator->next(); } @@ -271,7 +271,9 @@ sub getDescription { my $part = shift; my $status = $res->status($part); - if ($status == $res->NETWORK_FAILURE) { return ""; } + if ($status == $res->NETWORK_FAILURE) { + return "Having technical difficulties; please check status later"; + } if ($status == $res->NOTHING_SET) { return "Not currently assigned."; } @@ -1472,15 +1474,13 @@ sub init { unless ((time-$courserdatas{$cid.'.last_cache'})<240) { my $reply=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum. ':resourcedata',$chome); - if ($reply!~/^error\:/) { + # Check for network failure + if ( $reply =~ /no.such.host/i || $reply =~ /con_lost/i) { + $self->{NETWORK_FAILURE} = 1; + } elsif ($reply!~/^error\:/) { $courserdatas{$cid}=$reply; $courserdatas{$cid.'.last_cache'}=time; } - # check to see if network failed - elsif ( $reply=~/no.such.host/i || $reply=~/con.*lost/i ) - { - $self->{NETWORK_FAILURE} = 1; - } } foreach (split(/\&/,$courserdatas{$cid})) { my ($name,$value)=split(/\=/,$_); @@ -3078,6 +3078,8 @@ sub extractParts { $self->{PARTS} = []; + my %parts; + # Retrieve part count, if this is a problem if ($self->is_problem()) { my $metadata = &Apache::lonnet::metadata($self->src(), 'packages'); @@ -3089,15 +3091,21 @@ sub extractParts { foreach (split(/\,/,$metadata)) { if ($_ =~ /^part_(.*)$/) { my $part = $1; + # This floods the logs if it blows up + if (defined($parts{$part})) { + Apache::lonnet::logthis("$part multiply defined in metadata for " . $self->symb()); + } + # check to see if part is turned off. - if (! Apache::loncommon::check_if_partid_hidden($part, $self->symb())) { - push @{$self->{PARTS}}, $1; + + if (!Apache::loncommon::check_if_partid_hidden($part, $self->symb())) { + $parts{$part} = 1; } } } - my @sortedParts = sort @{$self->{PARTS}}; + my @sortedParts = sort keys %parts; $self->{PARTS} = \@sortedParts; }