[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm

bowersj2 lon-capa-cvs@mail.lon-capa.org
Tue, 28 Jan 2003 22:25:54 -0000


bowersj2		Tue Jan 28 17:25:54 2003 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Fixes that hidden problems for random out aborts the map.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.130 loncom/interface/lonnavmaps.pm:1.131
--- loncom/interface/lonnavmaps.pm:1.130	Tue Jan 14 13:47:50 2003
+++ loncom/interface/lonnavmaps.pm	Tue Jan 28 17:25:54 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.130 2003/01/14 18:47:50 www Exp $
+# $Id: lonnavmaps.pm,v 1.131 2003/01/28 22:25:54 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1696,7 +1696,7 @@
     # 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();
     }
 
@@ -2635,16 +2635,7 @@
         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;
 }
@@ -2658,18 +2649,18 @@
         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