';
}
# primary_menu() evaluates @primary_menu and returns XHTML for the menu
@@ -166,34 +160,42 @@ sub prep_menuitem {
# entries from mydesk.tab
sub primary_menu {
my $menu;
+ my $custommenu = &Apache::loncommon::needs_gci_custom();
# each element of @primary contains following array:
# (link url, icon path, alt text, link text, condition)
foreach my $menuitem (@primary_menu) {
# evaluate conditions
+ next if ref($menuitem) ne 'ARRAY'; #
next if $$menuitem[4] eq 'nonewmsg' # show links depending on
- && Apache::lonmsg::mynewmail(); # whether a new msg
+ && &Apache::lonmsg::mynewmail(); # whether a new msg
next if $$menuitem[4] eq 'newmsg' # arrived or not
- && !Apache::lonmsg::mynewmail(); #
+ && !&Apache::lonmsg::mynewmail(); #
next if $$menuitem[4] !~ /public/ ##we've a public user,
&& $env{'user.name'} eq 'public' ##who should not see all
&& $env{'user.domain'} eq 'public'; ##links
next if $$menuitem[4] eq 'onlypublic'# hide links which are
&& $env{'user.name'} ne 'public' # only visible to public
&& $env{'user.domain'} ne 'public'; # users
+ next if $$menuitem[4] eq 'roles' # hide links which are
+ && $custommenu; # not visible when GCI
+ next if $$menuitem[4] eq 'courses' # tabbed interface in use
+ && $custommenu; #
next if $$menuitem[4] eq 'roles' ##show links depending on
- && Apache::loncommon::show_course(); ##term 'Courses' or
+ && &Apache::loncommon::show_course(); ##term 'Courses' or
next if $$menuitem[4] eq 'courses' ##'Roles' wanted
- && !Apache::loncommon::show_course(); ##
-
-
+ && !&Apache::loncommon::show_course(); ##
+
+
if ($$menuitem[3] eq 'Help') { # special treatment for helplink
- $menu .= '
'.Apache::loncommon::top_nav_help('Help').'
';
+ $menu .= '
'.&Apache::loncommon::top_nav_help('Help').'
';
} else {
- $menu .= prep_menuitem(\@$menuitem);
+ my @items = @{$menuitem};
+ $items[0] = 'javascript:'.$menuitem->[0].';';
+ $menu .= &prep_menuitem(\@items);
}
- }
+ }
- return "$menu";
+ return "$menu";
}
@@ -212,6 +214,7 @@ sub secondary_menu {
$env{'course.' . $env{'request.course.id'} . '.num'});
foreach my $menuitem (@secondary_menu) {
# evaluate conditions
+ next if ref($menuitem) ne 'ARRAY';
next if $$menuitem[4] ne 'always'
&& !$env{'request.course.id'};
next if $$menuitem[4] eq 'showreturn'
@@ -227,28 +230,41 @@ sub secondary_menu {
&& $env{'environment.remotenavmap'} ne 'on';
next if $$menuitem[4] =~ /noremotenav/
&& $env{'environment.remotenavmap'} eq 'on';
+ next if $$menuitem[4] =~ /^(no|)remotenav$/
+ && $crstype eq 'Community';
+ next if $$menuitem[4] =~ /^(no|)remotenavCommunity$/
+ && $crstype ne 'Community';
next if $$menuitem[4] =~ /showgroups$/
- && $canviewgrps
+ && !$canviewgrps
&& !%groups;
if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) {
# special treatment for role selector
- my $roles_selector = roles_selector(
+ my $roles_selector = &roles_selector(
$env{'course.' . $env{'request.course.id'} . '.domain'},
$env{'course.' . $env{'request.course.id'} . '.num'} );
$menu .= $roles_selector ? "
$roles_selector
"
: '';
+ } elsif ($env{'environment.remotenavmap'} eq 'on') {
+ # open link using javascript when remote navmap is activated
+ my @items = @{$menuitem};
+ if ($menuitem->[4] eq 'remotenav') {
+ $items[0] = "javascript:gonav('$menuitem->[0]');";
+ } else {
+ $items[0] = "javascript:go('$menuitem->[0]');";
+ }
+ $menu .= &prep_menuitem(\@items);
} else {
- $menu .= prep_menuitem(\@$menuitem);
+ $menu .= &prep_menuitem(\@$menuitem);
}
}
if ($menu =~ /\[url\].*\[symb\]/) {
- my $escurl = escape( Apache::lonenc::check_encrypt(
- $env{'request.noversionuri'}));
+ my $escurl = &escape( &Apache::lonenc::check_encrypt(
+ $env{'request.noversionuri'}));
- my $escsymb = escape( Apache::lonenc::check_encrypt(
- $env{'request.symb'}));
+ my $escsymb = &escape( &Apache::lonenc::check_encrypt(
+ $env{'request.symb'}));
if ( $env{'request.state'} eq 'construct'
and ( $env{'request.noversionuri'} eq ''
@@ -257,7 +273,7 @@ sub secondary_menu {
($escurl = $env{'request.filename'}) =~
s{^/home/([^/]+)/public_html/(.*)$}{/priv/$1/$2};
- $escurl = escape($escurl);
+ $escurl = &escape($escurl);
}
$menu =~ s/\[url\]/$escurl/g;
$menu =~ s/\[symb\]/$escsymb/g;
@@ -266,6 +282,53 @@ sub secondary_menu {
return "