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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Mon, 18 Nov 2002 21:12:39 -0000


bowersj2		Mon Nov 18 16:12:39 2002 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Caches the browse priviledges for a resource, so the multiple calls
  to allowed matter less now.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.113 loncom/interface/lonnavmaps.pm:1.114
--- loncom/interface/lonnavmaps.pm:1.113	Mon Nov 18 15:59:21 2002
+++ loncom/interface/lonnavmaps.pm	Mon Nov 18 16:12:39 2002
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.113 2002/11/18 20:59:21 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.114 2002/11/18 21:12:39 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2460,7 +2460,11 @@
 
         # 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 = &Apache::lonnet::allowed('bre', $self->src);
+        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;
         }
@@ -2479,7 +2483,11 @@
 
         # 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 = &Apache::lonnet::allowed('bre', $self->src);
+        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;
         }