--- loncom/interface/lonnavmaps.pm 2003/01/10 18:45:30 1.124 +++ loncom/interface/lonnavmaps.pm 2003/02/01 19:55:00 1.129.2.1 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.124 2003/01/10 18:45:30 bowersj2 Exp $ +# $Id: lonnavmaps.pm,v 1.129.2.1 2003/02/01 19:55:00 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -686,10 +686,10 @@ sub real_handler { $r->print(''); } - $r->print(""); - $navmap->untieHashes(); + $r->print(""); + return OK; } @@ -999,11 +999,11 @@ sub new { return undef; } + $self->{HASH_TIED} = 1; $self->{NAV_HASH} = \%navmaphash; $self->{PARM_HASH} = \%parmhash; bless($self); - $self->untieHashes(); return $self; } @@ -1155,7 +1155,7 @@ sub DESTROY { $self->untieHashes(); } -# Does the given resource (as a symb string) have +# Private method: Does the given resource (as a symb string) have # current discussion? Returns 0 if chat/mail data not extracted. sub hasDiscussion { my $self = shift; @@ -1167,7 +1167,7 @@ sub hasDiscussion { $self->{LAST_CHECK}; } -# Does the given resource (as a symb string) have +# Private method: Does the given resource (as a symb string) have # current feedback? Returns the string in the feedback hash, which # will be false if it does not exist. sub getFeedback { @@ -1179,6 +1179,7 @@ sub getFeedback { return $self->{FEEDBACK}->{$symb}; } +# Private method: Get the errors for that resource (by source). sub getErrors { my $self = shift; my $src = shift; @@ -1678,7 +1679,7 @@ sub next { # If this is a blank resource, don't actually return it. # Should you ever find you need it, make sure to add an option to the code # that you can use; other things depend on this behavior. - if (!$self->{HERE}->src()) { + if (!$self->{HERE}->src() || !$self->{HERE}->browsePriv()) { return $self->next(); } @@ -2253,7 +2254,7 @@ sub hasDiscussion { sub getFeedback { my $self = shift; my $source = $self->src(); - if ($source !~ /^\/res\//) { $source = substr $source, 5; } + if ($source =~ /^\/res\//) { $source = substr $source, 5; } return $self->{NAV_MAP}->getFeedback($source); } @@ -2617,16 +2618,7 @@ sub getNext { my $next = $choice->goesto(); $next = $self->{NAV_MAP}->getById($next); - # Don't remember it if the student doesn't have browse priviledges - # future note: this may properly belong in the client of the resource - my $browsePriv = $self->{BROWSE_PRIV}; - if (!defined($browsePriv)) { - $browsePriv = &Apache::lonnet::allowed('bre', $self->src); - $self->{BROWSE_PRIV} = $browsePriv; - } - if (!($browsePriv ne '2' && $browsePriv ne 'F')) { - push @branches, $next; - } + push @branches, $next; } return \@branches; } @@ -2640,20 +2632,20 @@ sub getPrevious { my $prev = $choice->comesfrom(); $prev = $self->{NAV_MAP}->getById($prev); - # Don't remember it if the student doesn't have browse priviledges - # future note: this may properly belong in the client of the resource - my $browsePriv = $self->{BROWSE_PRIV}; - if (!defined($browsePriv)) { - $browsePriv = &Apache::lonnet::allowed('bre', $self->src); - $self->{BROWSE_PRIV} = $browsePriv; - } - if (!($browsePriv ne '2' && $browsePriv ne 'F')) { - push @branches, $prev; - } + push @branches, $prev; } return \@branches; } +sub browsePriv { + my $self = shift; + if (defined($self->{BROWSE_PRIV})) { + return $self->{BROWSE_PRIV}; + } + + $self->{BROWSE_PRIV} = &Apache::lonnet::allowed('bre', $self->src()); +} + =pod =back