Diff for /rat/lonuserstate.pm between versions 1.149.2.2.2.3 and 1.149.2.3

version 1.149.2.2.2.3, 2020/07/19 15:24:11 version 1.149.2.3, 2020/03/05 22:39:57
Line 42  use Safe::Hole; Line 42  use Safe::Hole;
 use Opcode;  use Opcode;
 use Apache::lonenc;  use Apache::lonenc;
 use Fcntl qw(:flock);  use Fcntl qw(:flock);
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA;
 use File::Basename;  use File::Basename;
   
     
Line 292  sub loadmap { Line 292  sub loadmap {
     # Handle randomization and random selection      # Handle randomization and random selection
   
     if ($randomize) {      if ($randomize) {
         unless (&is_advanced($courseid)) {          my $advanced;
           if ($env{'request.course.id'}) {
               $advanced = (&Apache::lonnet::allowed('adv') eq 'F');
           } else {
               $env{'request.course.id'} = $courseid;
               $advanced = (&Apache::lonnet::allowed('adv') eq 'F');
               $env{'request.course.id'} = '';
           }
           unless ($advanced) {
             # Order of resources is not randomized if user has and advanced role in the course.              # Order of resources is not randomized if user has and advanced role in the course.
     my $seed;      my $seed;
   
Line 375  sub loadmap { Line 383  sub loadmap {
     }      }
 }  }
   
 sub is_advanced {  
     my ($courseid) = @_;  
     my $advanced;  
     if ($env{'request.course.id'}) {  
         $advanced = (&Apache::lonnet::allowed('adv') eq 'F');  
     } else {  
         $env{'request.course.id'} = $courseid;  
         $advanced = (&Apache::lonnet::allowed('adv') eq 'F');  
         $env{'request.course.id'} = '';  
     }  
     return $advanced;  
 }  
   
 # -------------------------------------------------------------------- Resource  # -------------------------------------------------------------------- Resource
 #  #
Line 492  sub parse_resource { Line 488  sub parse_resource {
     } elsif ($turi!~/\.(sequence|page)$/) {      } elsif ($turi!~/\.(sequence|page)$/) {
  $turi='/adm/coursedocs/showdoc'.$turi;   $turi='/adm/coursedocs/showdoc'.$turi;
     }      }
         } elsif ($turi=~ m{^/adm/$match_domain/$match_courseid/\d+/ext\.tool$}) {  
             $turi='/adm/wrapper'.$turi;  
  } elsif ($turi=~/\S/) { # normal non-empty internal resource   } elsif ($turi=~/\S/) { # normal non-empty internal resource
     my $mapdir=$uri;      my $mapdir=$uri;
     $mapdir=~s/[^\/]+$//;      $mapdir=~s/[^\/]+$//;
Line 569  sub parse_resource { Line 563  sub parse_resource {
     if (($turi=~/\.sequence$/) ||      if (($turi=~/\.sequence$/) ||
  ($turi=~/\.page$/)) {   ($turi=~/\.page$/)) {
  $hash{'is_map_'.$rid}=1;   $hash{'is_map_'.$rid}=1;
  if ((!$hiddenurl{$rid}) || (&is_advanced($courseid))) {   &loadmap($turi,$rid,$courseid);
     &loadmap($turi,$rid,$courseid);  
  }  
     }       } 
     return $token->[2]->{'id'};      return $token->[2]->{'id'};
 }  }

Removed from v.1.149.2.2.2.3  
changed lines
  Added in v.1.149.2.3


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