--- loncom/interface/lonmenu.pm 2014/01/06 17:31:09 1.426 +++ loncom/interface/lonmenu.pm 2014/02/22 18:12:09 1.427 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.426 2014/01/06 17:31:09 raeburn Exp $ +# $Id: lonmenu.pm,v 1.427 2014/02/22 18:12:09 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1229,7 +1229,10 @@ sub rawconfig { my $pub=($env{'request.state'} eq 'published'); my $con=($env{'request.state'} eq 'construct'); my $rol=$env{'request.role'}; - my $requested_domain = $env{'request.role.domain'}; + my $requested_domain; + if ($rol) { + $requested_domain = $env{'request.role.domain'}; + } foreach my $line (@desklines) { my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc,$cat)=split(/\:/,$line); $prt=~s/\$uname/$uname/g; @@ -1243,7 +1246,13 @@ sub rawconfig { next if ($crstype ne 'Community'); $prt=~s/\$cmty/$crs/g; } - $prt=~s/\$requested_domain/$requested_domain/g; + if ($prt =~ m/\$requested_domain/) { + if ((!$requested_domain) && ($pro eq 'pbre') && ($env{'user.adv'})) { + $prt=~s/\$requested_domain/$env{'user.domain'}/g; + } else { + $prt=~s/\$requested_domain/$requested_domain/g; + } + } if ($category_names{$cat}!~/\w/) { $cat='oth'; } if ($pro eq 'clear') { $output.=&clear($row,$col); @@ -1279,8 +1288,9 @@ sub rawconfig { next; } } - if (&Apache::lonnet::allowed($priv,$prt)) { - $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat); + if ((($priv eq 'bre') && (&Apache::lonnet::allowed($priv,$prt) eq 'F')) || + (($priv ne 'bre') && (&Apache::lonnet::allowed($priv,$prt)))) { + $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat); } } elsif ($pro eq 'course') { if (($env{'request.course.fn'}) && ($crstype ne 'Community')) {