--- loncom/interface/lonmenu.pm 2013/08/06 16:02:31 1.418
+++ loncom/interface/lonmenu.pm 2014/01/06 17:31:09 1.426
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.418 2013/08/06 16:02:31 raeburn Exp $
+# $Id: lonmenu.pm,v 1.426 2014/01/06 17:31:09 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();
@@ -417,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 {
@@ -469,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 '') {
@@ -506,9 +514,17 @@ sub create_submenu {
if ($count == $numsub) {
$borderbot = 'border-bottom:1px solid black;';
}
+ unless (($href eq '') || ($href =~ /^\#/)) {
+ $target = ' target="_top"';
+ }
$menu .= ''.
- &mt($item->[1]).'';
+ $borderbot.'">';
+ if ($translate) {
+ $menu .= &mt($item->[1]);
+ } else {
+ $menu .= $item->[1];
+ }
+ $menu .= '';
}
}
$menu .= '';
@@ -736,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".
+ '