--- rat/lonuserstate.pm 2020/03/05 22:39:57 1.149.2.3 +++ rat/lonuserstate.pm 2020/05/02 21:28:08 1.149.2.4 @@ -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.3 2020/03/05 22:39:57 raeburn Exp $ +# $Id: lonuserstate.pm,v 1.149.2.4 2020/05/02 21:28:08 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -292,15 +292,7 @@ sub loadmap { # Handle randomization and random selection if ($randomize) { - 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) { + unless (&is_advanced($courseid)) { # Order of resources is not randomized if user has and advanced role in the course. my $seed; @@ -383,6 +375,18 @@ 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 # @@ -563,7 +567,9 @@ sub parse_resource { if (($turi=~/\.sequence$/) || ($turi=~/\.page$/)) { $hash{'is_map_'.$rid}=1; - &loadmap($turi,$rid,$courseid); + if ((!$hiddenurl{$rid}) || (&is_advanced($courseid))) { + &loadmap($turi,$rid,$courseid); + } } return $token->[2]->{'id'}; }