--- loncom/interface/lonmenu.pm 2013/06/26 04:25:41 1.416
+++ loncom/interface/lonmenu.pm 2014/01/06 15:05:50 1.425
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.416 2013/06/26 04:25:41 raeburn Exp $
+# $Id: lonmenu.pm,v 1.425 2014/01/06 15:05:50 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -261,7 +261,7 @@ sub primary_menu {
push(@primsub,$item);
}
if (@primsub > 0) {
- $menu{$position} .= &create_submenu($link,$target,$title,\@primsub);
+ $menu{$position} .= &create_submenu($link,$target,$title,\@primsub,1);
} elsif ($link) {
$menu{$position} .= '
'.&mt($title).'';
}
@@ -283,8 +283,14 @@ sub primary_menu {
$menu{$position} .= prep_menuitem($menuitem);
}
}
- return ("",
- "");
+ my @output = ('','');
+ if ($menu{'left'} ne '') {
+ $output[0] = "";
+ }
+ if ($menu{'right'} ne '') {
+ $output[1] = "";
+ }
+ return @output;
}
#returns hashref {user=>'',dom=>''} containing:
@@ -313,6 +319,7 @@ sub getauthor{
}
sub secondary_menu {
+ my ($httphost) = @_;
my $menu;
my $crstype = &Apache::loncommon::course_type();
@@ -321,6 +328,9 @@ sub secondary_menu {
: '');
my $canedit = &Apache::lonnet::allowed('mdc', $env{'request.course.id'});
my $canviewroster = $env{'course.'.$env{'request.course.id'}.'.student_classlist_view'};
+ if ($canviewroster eq 'disabled') {
+ undef($canviewroster);
+ }
my $canviewgrps = &Apache::lonnet::allowed('vcg', $crs_sec);
my $canmodifyuser = &Apache::lonnet::allowed('cst', $crs_sec);
my $canviewwnew = &Apache::lonnet::allowed('whn', $crs_sec);
@@ -329,7 +339,7 @@ sub secondary_menu {
my $canmgr = &Apache::lonnet::allowed('mgr', $crs_sec);
my $author = &getauthor();
- my ($cdom,$cnum,$showsyllabus,$showfeeds);
+ my ($cdom,$cnum,$showsyllabus,$showfeeds,$showresv);
if ($env{'request.course.id'}) {
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
@@ -349,6 +359,12 @@ sub secondary_menu {
$showfeeds = 1;
}
}
+ unless ($canmgr) {
+ my %slots = &Apache::lonnet::get_course_slots($cnum,$cdom);
+ if (keys(%slots) > 0) {
+ $showresv = 1;
+ }
+ }
}
my ($canmodifycoauthor);
@@ -385,8 +401,8 @@ sub secondary_menu {
&& ($canmodifyuser || !$canviewroster);
next if $$menuitem[4] eq 'mgr'
&& !$canmgr;
- next if $$menuitem[4] eq 'nmgr'
- && $canmgr;
+ next if $$menuitem[4] eq 'showresv'
+ && !$showresv;
next if $$menuitem[4] eq 'whn'
&& !$canviewwnew;
next if $$menuitem[4] eq 'opa'
@@ -408,7 +424,8 @@ sub secondary_menu {
($roleswitcher_js,$roleswitcher_form,my $switcher) =
&roles_selector(
$env{'course.' . $env{'request.course.id'} . '.domain'},
- $env{'course.' . $env{'request.course.id'} . '.num'}
+ $env{'course.' . $env{'request.course.id'} . '.num'},
+ $httphost
);
$menu .= $switcher;
} else {
@@ -460,7 +477,7 @@ sub secondary_menu {
}
sub create_submenu {
- my ($link,$target,$title,$submenu) = @_;
+ my ($link,$target,$title,$submenu,$translate) = @_;
return unless (ref($submenu) eq 'ARRAY');
my $disptarget;
if ($target ne '') {
@@ -497,9 +514,17 @@ sub create_submenu {
if ($count == $numsub) {
$borderbot = 'border-bottom:1px solid black;';
}
+ if ($href ne '') {
+ $target = ' target="_top"';
+ }
$menu .= ''.
- &mt($item->[1]).'';
+ $borderbot.'">';
+ if ($translate) {
+ $menu .= &mt($item->[1]);
+ } else {
+ $menu .= $item->[1];
+ }
+ $menu .= '';
}
}
$menu .= '';
@@ -727,7 +752,7 @@ ENDMENUITEMS
# wishlist is only available for users with access to resource-pool
# and links can only be set for resources within the resource-pool
$menuitems .= (<'."\n".
+ '