--- loncom/interface/lonmenu.pm 2013/08/08 02:31:11 1.369.2.45
+++ loncom/interface/lonmenu.pm 2015/05/28 12:49:30 1.369.2.55
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.369.2.45 2013/08/08 02:31:11 raeburn Exp $
+# $Id: lonmenu.pm,v 1.369.2.55 2015/05/28 12:49:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -281,7 +281,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).'';
}
@@ -303,8 +303,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:
@@ -333,6 +339,7 @@ sub getauthor{
}
sub secondary_menu {
+ my ($httphost) = @_;
my $menu;
my $crstype = &Apache::loncommon::course_type();
@@ -455,7 +462,7 @@ sub secondary_menu {
}
}
if (@scndsub > 0) {
- $menu .= &create_submenu($link,$target,$title,\@scndsub);
+ $menu .= &create_submenu($link,$target,$title,\@scndsub,1);
} elsif ($link ne '#') {
$menu .= ''.&mt($title).'';
}
@@ -465,7 +472,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 {
@@ -517,7 +525,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 '') {
@@ -554,9 +562,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 .= '';
@@ -797,6 +813,9 @@ sub innerregister {
my $currdir = '/priv/'.$udom.'/'.$uname.'/'.$thisdisfn;
if ($currdir =~ m-/$-) {
$is_const_dir = 1;
+ if ($thisdisfn eq '') {
+ $is_const_dir = 2;
+ }
} else {
$currdir =~ s|[^/]+$||;
my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
@@ -844,7 +863,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 .= (< 0){
}
$menuitems.="&$swtext{'anot'}&tations[_1]&annotate()&";
$menuitems.="Make notes and annotations about this resource&&1\n";
+my $is_mobile;
+if ($env{'browser.mobile'}) {
+ $is_mobile = 1;
+}
unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) {
if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/}) && ($env{'request.noversionuri'} !~ m{^/uploaded/$match_domain/$match_courseid/docs/})) {
$menuitems.=(<'."\n".
+ '