--- rat/lonuserstate.pm 2020/07/19 15:24:11 1.149.2.2.2.3 +++ rat/lonuserstate.pm 2020/03/05 22:39:57 1.149.2.3 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Construct and maintain state and binary representation of course for user # -# $Id: lonuserstate.pm,v 1.149.2.2.2.3 2020/07/19 15:24:11 raeburn Exp $ +# $Id: lonuserstate.pm,v 1.149.2.3 2020/03/05 22:39:57 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,7 +42,7 @@ use Safe::Hole; use Opcode; use Apache::lonenc; use Fcntl qw(:flock); -use LONCAPA qw(:DEFAULT :match); +use LONCAPA; use File::Basename; @@ -292,7 +292,15 @@ sub loadmap { # Handle randomization and random selection 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. my $seed; @@ -375,18 +383,6 @@ 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 # @@ -492,8 +488,6 @@ sub parse_resource { } elsif ($turi!~/\.(sequence|page)$/) { $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 my $mapdir=$uri; $mapdir=~s/[^\/]+$//; @@ -569,9 +563,7 @@ sub parse_resource { if (($turi=~/\.sequence$/) || ($turi=~/\.page$/)) { $hash{'is_map_'.$rid}=1; - if ((!$hiddenurl{$rid}) || (&is_advanced($courseid))) { - &loadmap($turi,$rid,$courseid); - } + &loadmap($turi,$rid,$courseid); } return $token->[2]->{'id'}; }