version 1.157, 2018/11/13 03:59:17
|
version 1.159, 2020/04/22 14:52:56
|
Line 293 sub loadmap {
|
Line 293 sub loadmap {
|
# Handle randomization and random selection |
# Handle randomization and random selection |
|
|
if ($randomize) { |
if ($randomize) { |
my $advanced; |
unless (&is_advanced($courseid)) { |
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 384 sub loadmap {
|
Line 376 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 470 sub parse_resource {
|
Line 474 sub parse_resource {
|
# is not a page. If the resource is a page then it must be |
# is not a page. If the resource is a page then it must be |
# assembled (at fetch time?). |
# assembled (at fetch time?). |
|
|
unless ($ispage) { |
if ($ispage) { |
|
if ($token->[2]->{'external'} eq 'true') { # external |
|
$turi=~s{^http\://}{/ext/}; |
|
} |
|
} else { |
$turi=~/\.(\w+)$/; |
$turi=~/\.(\w+)$/; |
my $embstyle=&Apache::loncommon::fileembstyle($1); |
my $embstyle=&Apache::loncommon::fileembstyle($1); |
if ($token->[2]->{'external'} eq 'true') { # external |
if ($token->[2]->{'external'} eq 'true') { # external |
Line 562 sub parse_resource {
|
Line 570 sub parse_resource {
|
if (($turi=~/\.sequence$/) || |
if (($turi=~/\.sequence$/) || |
($turi=~/\.page$/)) { |
($turi=~/\.page$/)) { |
$hash{'is_map_'.$rid}=1; |
$hash{'is_map_'.$rid}=1; |
&loadmap($turi,$rid,$courseid); |
if ((&is_advanced($courseid)) || (!$hiddenurl{$rid})) { |
|
&loadmap($turi,$rid,$courseid); |
|
} |
} |
} |
return $token->[2]->{'id'}; |
return $token->[2]->{'id'}; |
} |
} |