--- rat/lonuserstate.pm 2020/04/22 14:52:56 1.159 +++ rat/lonuserstate.pm 2021/04/29 14:54:36 1.163 @@ -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.159 2020/04/22 14:52:56 raeburn Exp $ +# $Id: lonuserstate.pm,v 1.163 2021/04/29 14:54:36 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -570,7 +570,7 @@ sub parse_resource { if (($turi=~/\.sequence$/) || ($turi=~/\.page$/)) { $hash{'is_map_'.$rid}=1; - if ((&is_advanced($courseid)) || (!$hiddenurl{$rid})) { + if ((!$hiddenurl{$rid}) || (&is_advanced($courseid))) { &loadmap($turi,$rid,$courseid); } } @@ -1211,7 +1211,7 @@ sub mapcrumbs { # ---------------------------------------------------- Read map and all submaps sub readmap { - my $short=shift; + my ($short,$critmsg_check) = @_; $short=~s/^\///; # TODO: Hidden dependency on current user: @@ -1450,12 +1450,16 @@ sub readmap { # Depends on user must parameterize this as well..or separate as this is: # more part of determining what someone sees on entering a course? +# When lonuserstate::readmap() is called from lonroles.pm, i.e., +# after selecting a role in a course, critical_redirect will be called, +# unless the course has a blocking event in effect, which suppresses +# critical message checking (users without evb priv). +# - my @what=&Apache::lonnet::dump('critical',$env{'user.domain'}, - $env{'user.name'}); - if ($what[0]) { - if (($what[0] ne 'con_lost') && ($what[0]!~/^error\:/)) { - $retfurl='/adm/email?critical=display'; + if ($critmsg_check) { + my ($redirect,$url) = &Apache::loncommon::critical_redirect(); + if ($redirect) { + $retfurl = $url; } } return ($retfurl,$errtext);