--- loncom/interface/lonmenu.pm 2007/10/30 23:46:02 1.230
+++ loncom/interface/lonmenu.pm 2008/01/15 16:53:27 1.233
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.230 2007/10/30 23:46:02 albertel Exp $
+# $Id: lonmenu.pm,v 1.233 2008/01/15 16:53:27 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -54,13 +54,26 @@ my @inlineremote;
# ================================================================ Little texts
+sub show_course {
+ my $course = !$env{'user.adv'};
+ if (!$env{'user.adv'}) {
+ foreach my $env (keys(%env)) {
+ next if ($env !~ m/^user\.priv\./);
+ if ($env !~ m/^user\.priv\.(?:st|cm)/) {
+ $course = 0;
+ last;
+ }
+ }
+ }
+ return $course;
+}
sub initlittle {
return &Apache::lonlocal::texthash('ret' => 'Return to Last Location',
'nav' => 'Navigate Contents',
'main' => 'Main Menu',
- 'roles' => ($env{'user.adv'}?
- 'Roles':'Courses'),
+ 'roles' => (&show_course()?
+ 'Courses':'Roles'),
'docs' => 'Edit Course',
'exit' => 'Exit',
'login' => 'Log In',
@@ -336,16 +349,18 @@ sub innerregister {
} else {
$newmail= 'swmenu.setstatus("you have","messages");';
}
- } elsif (($textual)
+ }
+ if (($textual)
&& ($env{'request.symb'})
&& ($env{'request.course.id'})) {
$newmail.= '
';
my ($mapurl,$rid,$resurl)=
&Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
- $newmail.=$env{'course.'.$env{'request.course.id'}.'.description'};
+ my $coursetitle=$env{'course.'.$env{'request.course.id'}.'.description'};
+ $newmail.=$coursetitle;
my $maptitle=&Apache::lonnet::gettitle($mapurl);
my $restitle=&Apache::lonnet::gettitle(&Apache::lonnet::symbread());
- if ($maptitle && $maptitle ne 'default.sequence') {
+ if ($maptitle && ($maptitle ne 'default.sequence') && ($maptitle ne $coursetitle)) {
$newmail.=', '.$maptitle;
}
if ($restitle) {
@@ -998,6 +1013,7 @@ sub rawconfig {
my $uname=$env{'user.name'};
my $udom=$env{'user.domain'};
my $adv=$env{'user.adv'};
+ my $show_course=&show_course();
my $author=$env{'user.author'};
my $crs='';
if ($env{'request.course.id'}) {
@@ -1037,6 +1053,16 @@ sub rawconfig {
$output.=&secondlevel(
$uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
}
+ } elsif ($pro eq 'shc') {
+ if ($show_course) {
+ $output.=&secondlevel(
+ $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
+ }
+ } elsif ($pro eq 'nsc') {
+ if (!$show_course) {
+ $output.=&secondlevel(
+ $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
+ }
} elsif (($pro=~/^p(\w+)/) && ($prt)) {
if (&Apache::lonnet::allowed($1,$prt)) {
$output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
@@ -1374,7 +1400,8 @@ sub hidden_button_check {
if ($env{'request.role.adv'}) {
return;
}
- return &Apache::lonnet::EXT('resource.0.buttonshide');
+ my $buttonshide = &Apache::lonnet::EXT('resource.0.buttonshide');
+ return $buttonshide;
}
# ================================================================ Main Program
|