Diff for /loncom/interface/lonnavmaps.pm between versions 1.129.2.1 and 1.130

version 1.129.2.1, 2003/02/01 19:55:00 version 1.130, 2003/01/14 18:47:50
Line 46  use Apache::Constants qw(:common :http); Line 46  use Apache::Constants qw(:common :http);
 use Apache::loncommon();  use Apache::loncommon();
 use POSIX qw (floor strftime);  use POSIX qw (floor strftime);
   
   my %navmaphash;
   my %parmhash;
   
   sub cleanup {
       if (tied(%navmaphash)){
    &Apache::lonnet::logthis('Cleanup navmaps: navmaphash');
           unless (untie(%navmaphash)) {
       &Apache::lonnet::logthis('Failed cleanup navmaps: navmaphash');
           }
       }
       if (tied(%parmhash)){
    &Apache::lonnet::logthis('Cleanup navmaps: parmhash');
           unless (untie(%parmhash)) {
       &Apache::lonnet::logthis('Failed cleanup navmaps: parmhash');
           }
       }
   }
   
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
     real_handler($r);      real_handler($r);
Line 985  sub new { Line 1003  sub new {
     $self->{NETWORK_FAILURE} = 0;      $self->{NETWORK_FAILURE} = 0;
   
     # tie the nav hash      # tie the nav hash
     my %navmaphash;  
     if (!(tie(%navmaphash, 'GDBM_File', $self->{NAV_HASH_FILE},      if (!(tie(%navmaphash, 'GDBM_File', $self->{NAV_HASH_FILE},
               &GDBM_READER(), 0640))) {                &GDBM_READER(), 0640))) {
         return undef;          return undef;
     }      }
           
     my %parmhash;  
     if (!(tie(%parmhash, 'GDBM_File', $self->{PARM_HASH_FILE},      if (!(tie(%parmhash, 'GDBM_File', $self->{PARM_HASH_FILE},
               &GDBM_READER(), 0640)))                &GDBM_READER(), 0640)))
     {      {
Line 1679  sub next { Line 1696  sub next {
     # If this is a blank resource, don't actually return it.      # 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      # 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.      #  that you can use; other things depend on this behavior.
     if (!$self->{HERE}->src() || !$self->{HERE}->browsePriv()) {      if (!$self->{HERE}->src()) {
         return $self->next();          return $self->next();
     }      }
   
Line 2618  sub getNext { Line 2635  sub getNext {
         my $next = $choice->goesto();          my $next = $choice->goesto();
         $next = $self->{NAV_MAP}->getById($next);          $next = $self->{NAV_MAP}->getById($next);
   
         push @branches, $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;
           }
     }      }
     return \@branches;      return \@branches;
 }  }
Line 2632  sub getPrevious { Line 2658  sub getPrevious {
         my $prev = $choice->comesfrom();          my $prev = $choice->comesfrom();
         $prev = $self->{NAV_MAP}->getById($prev);          $prev = $self->{NAV_MAP}->getById($prev);
   
         push @branches, $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;
           }
     }      }
     return \@branches;      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  =pod
   
 =back  =back

Removed from v.1.129.2.1  
changed lines
  Added in v.1.130


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>