--- loncom/interface/lonmenu.pm 2009/10/26 21:19:22 1.295
+++ loncom/interface/lonmenu.pm 2009/10/28 09:01:59 1.296
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.295 2009/10/26 21:19:22 raeburn Exp $
+# $Id: lonmenu.pm,v 1.296 2009/10/28 09:01:59 droeschl Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -164,6 +164,7 @@ sub primary_menu {
# (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
next if $$menuitem[4] eq 'newmsg' # arrived or not
@@ -183,11 +184,9 @@ sub primary_menu {
if ($$menuitem[3] eq 'Help') { # special treatment for helplink
$menu .= '
'.&Apache::loncommon::top_nav_help('Help').'';
} else {
- if (ref($menuitem) eq 'ARRAY') {
- my @items = @{$menuitem};
- $items[0] = 'javascript:'.$menuitem->[0].';';
- $menu .= &prep_menuitem(\@items);
- }
+ my @items = @{$menuitem};
+ $items[0] = 'javascript:'.$menuitem->[0].';';
+ $menu .= &prep_menuitem(\@items);
}
}
@@ -210,6 +209,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'
@@ -241,18 +241,17 @@ sub secondary_menu {
$menu .= $roles_selector ? "$roles_selector"
: '';
- } else {
- if ($env{'environment.remotenavmap'} eq 'on') {
- 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);
+ } 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 {
- $menu .= &prep_menuitem(\@$menuitem);
+ $items[0] = "javascript:go('$menuitem->[0]');";
}
+ $menu .= &prep_menuitem(\@items);
+ } else {
+ $menu .= &prep_menuitem(\@$menuitem);
}
}
if ($menu =~ /\[url\].*\[symb\]/) {
@@ -578,7 +577,7 @@ sub innerregister {
my $tableend = ( $noremote ? '' : '');
# =============================================================================
# ============================ This is for URLs that actually can be registered
- if (($env{'request.noversionuri'}!~m|^/(res/)*adm/|) || ($forcereg)) {
+ if (($env{'request.noversionuri'}!~m{^/(res/)*adm/}) || ($forcereg)) {
# -- This applies to homework problems for users with grading privileges
my $crs='/'.$env{'request.course.id'};
if ($env{'request.course.sec'}) {