--- loncom/interface/lonmenu.pm 2016/03/17 13:51:28 1.442
+++ loncom/interface/lonmenu.pm 2016/04/02 04:30:20 1.443
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.442 2016/03/17 13:51:28 raeburn Exp $
+# $Id: lonmenu.pm,v 1.443 2016/04/02 04:30:20 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -238,6 +238,7 @@ sub prep_menuitem {
# @primary_menu is filled within the BEGIN block of this module with
# entries from mydesk.tab
sub primary_menu {
+ my ($crstype) = @_;
my (%menu);
# each element of @primary contains following array:
# (link url, icon path, alt text, link text, condition, position)
@@ -246,6 +247,15 @@ sub primary_menu {
|| (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) {
$public = 1;
}
+ my $rolecount;
+ if (($crstype eq 'Placement') && (!$env{'request.role.adv'})) {
+ my $update=$env{'user.update.time'};
+ if (!$update) {
+ $update = $env{'user.login.time'};
+ }
+ my %roles_in_env;
+ $rolecount = &Apache::lonroles::roles_from_env(\%roles_in_env,$update);
+ }
foreach my $menuitem (@primary_menu) {
# evaluate conditions
next if ref($menuitem) ne 'ARRAY'; #
@@ -263,8 +273,14 @@ sub primary_menu {
&& &Apache::loncommon::show_course(); ##term 'Courses' or
next if $$menuitem[4] eq 'courses' ##'Roles' wanted
&& !&Apache::loncommon::show_course(); ##
-
my $title = $menuitem->[3];
+ if (($crstype eq 'Placement') && (!$env{'request.role.adv'})) {
+ if ($menuitem->[4] eq 'courses') {
+ next unless ($rolecount>1);
+ } else {
+ next unless (($title eq 'Personal') || ($title eq 'Logout'));
+ }
+ }
my $position = $menuitem->[5];
if ($position eq '') {
$position = 'right';
@@ -280,6 +296,7 @@ sub primary_menu {
my @primsub;
if (ref($primary_submenu{$title}) eq 'ARRAY') {
foreach my $item (@{$primary_submenu{$title}}) {
+ next if (($crstype eq 'Placement') && (!$env{'request.role.adv'}));
next if (($item->[2] eq 'wishlist') && (!$env{'user.adv'}));
next if ((($item->[2] eq 'portfolio') ||
($item->[2] eq 'blog')) &&
@@ -287,18 +304,19 @@ sub primary_menu {
undef,'tools')));
push(@primsub,$item);
}
+ if ($title eq 'Personal' && $env{'user.name'} && $env{'user.domain'} ) {
+ $title = &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'});
+ } else {
+ $title = &mt($title);
+ }
if (@primsub > 0) {
- if ($title eq 'Personal' && $env{'user.name'} && $env{'user.domain'} ) {
- $title = &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'});
- } else {
- $title = &mt($title);
- }
$menu{$position} .= &create_submenu($link,$target,$title,\@primsub,1);
} elsif ($link) {
- $menu{$position} .= '
'.&mt($title).'';
+ $menu{$position} .= ''.$title.'';
}
}
} elsif ($$menuitem[3] eq 'Help') { # special treatment for helplink
+ next if ($crstype eq 'Placement');
if ($public) {
my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
my $defdom = &Apache::lonnet::default_login_domain();
@@ -424,6 +442,7 @@ sub secondary_menu {
foreach my $menuitem (@secondary_menu) {
# evaluate conditions
next if ref($menuitem) ne 'ARRAY';
+ next if (($crstype eq 'Placement') && ($$menuitem[3] ne 'Roles') && (!$env{'request.role.adv'}));
next if $$menuitem[4] ne 'always'
&& ($$menuitem[4] ne 'author' && $$menuitem[4] ne 'cca')
&& !$env{'request.course.id'};
@@ -609,25 +628,25 @@ sub innerregister {
undef(@inlineremote);
- my ($mapurl,$resurl);
+ my ($mapurl,$resurl,$crstype);
if ($env{'request.course.id'}) {
+#
+#course_type: Course, Community, or Placement
+#
+ $crstype = &Apache::loncommon::course_type();
if ($env{'request.symb'}) {
($mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};
my $maptitle = &Apache::lonnet::gettitle($mapurl);
my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());
-
-#SD
-#course_type only Course and Community?
-#
my @crumbs;
unless (($forcereg) &&
($env{'request.noversionuri'} eq '/adm/navmaps') &&
- ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {
- @crumbs = ({text => Apache::loncommon::course_type()
- . ' Contents',
+ ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'}) ||
+ (($crstype eq 'Placement') && (!$env{'request.role.adv'}))) {
+ @crumbs = ({text => $crstype.' Contents',
href => "Javascript:gopost('/adm/navmaps','')"});
}
if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {
@@ -635,9 +654,11 @@ sub innerregister {
no_mt => 1});
}
- push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle
- && $maptitle ne 'default.sequence'
- && $maptitle ne $coursetitle);
+ unless (($crstype eq 'Placement') || (!$env{'request.role.adv'})) {
+ push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle
+ && $maptitle ne 'default.sequence'
+ && $maptitle ne $coursetitle);
+ }
push @crumbs, {text => $restitle, no_mt => 1} if $restitle;
my @tools;
@@ -655,7 +676,6 @@ sub innerregister {
} else {
$resurl = $env{'request.noversionuri'};
my $courseurl = &Apache::lonnet::courseid_to_courseurl($env{'request.course.id'});
- my $crstype = &Apache::loncommon::course_type();
my $title = &mt('View Resource');
if ($resurl =~ m{^\Q/uploaded$courseurl/supplemental/\E(default|\d+)/}) {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['folderpath','title']);
@@ -817,9 +837,13 @@ ENDMENUITEMS
# We are in a course and looking at a registered URL
# Should probably be in mydesk.tab
#
- $menuitems=(<