--- loncom/interface/lonmenu.pm 2010/10/07 15:39:27 1.309.2.17
+++ loncom/interface/lonmenu.pm 2010/12/02 16:44:09 1.309.2.21
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.309.2.17 2010/10/07 15:39:27 raeburn Exp $
+# $Id: lonmenu.pm,v 1.309.2.21 2010/12/02 16:44:09 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -151,10 +151,10 @@ sub prep_menuitem {
} else { # textual Link
$link = &mt($$menuitem[3]);
}
- if($$menuitem[4] eq 'newmsg'){ #special style for New Messages
- return '
'.$link.'';
- }
- return ''.$link.'';
+ return '$link|;
}
# primary_menu() evaluates @primary_menu and returns XHTML for the menu
@@ -165,8 +165,14 @@ sub prep_menuitem {
sub primary_menu {
my $menu;
my $custommenu = &Apache::loncommon::needs_gci_custom();
+ my $numdc = &Apache::loncommon::check_for_gci_dc();
# each element of @primary contains following array:
# (link url, icon path, alt text, link text, condition)
+ my $public;
+ if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))
+ || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) {
+ $public = 1;
+ }
foreach my $menuitem (@primary_menu) {
# evaluate conditions
next if ref($menuitem) ne 'ARRAY'; #
@@ -175,15 +181,16 @@ sub primary_menu {
next if $$menuitem[4] eq 'newmsg' # arrived or not
&& !&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
+ && $public; ##who should not see all
+ ##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
+ && !$public; # only visible to public
+ # users
next if $$menuitem[4] eq 'gci'
&& (!$custommenu || $env{'request.role'} =~ m{^st\./gcitest/});
next if $$menuitem[4] eq 'home'
- && (($custommenu) || ($env{'user.domain'} eq 'gcitest'));
+ && (($custommenu) || ($env{'user.domain'} eq 'gcitest') ||
+ (($env{'user.domain'} eq 'gci') && !$numdc));
next if $$menuitem[4] eq 'gcitest'
&& (($env{'user.domain'} eq 'gci') || ($env{'request.role'} eq 'cm'));
next if $$menuitem[4] eq 'roles' # hide links which are
@@ -197,11 +204,20 @@ sub primary_menu {
if ($$menuitem[3] eq 'Help') { # special treatment for helplink
- $menu .= ''.&Apache::loncommon::top_nav_help('Help').'';
+ if ($public) {
+ my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
+ my $defdom = &Apache::lonnet::default_login_domain();
+ my $to = &Apache::loncommon::build_recipient_list(undef,
+ 'helpdeskmail',
+ $defdom,$origmail);
+ if ($to ne '') {
+ $menu .= &prep_menuitem($menuitem);
+ }
+ } else {
+ $menu .= ''.&Apache::loncommon::top_nav_help('Help').'';
+ }
} else {
- my @items = @{$menuitem};
- $items[0] = 'javascript:'.$menuitem->[0].';';
- $menu .= &prep_menuitem(\@items);
+ $menu .= &prep_menuitem($menuitem);
}
}
@@ -321,7 +337,11 @@ sub gci_secondary_menu {
foreach my $key (keys(%courses)) {
$links{$key} = "javascript:switchpage('$key');";
if ($env{'request.course.id'} eq $courses{$key}) {
- $links{$key} = '/adm/navmaps';
+ if ($env{'environment.remotenavmap'} eq 'on') {
+ $links{$key} = "javascript:gonav('/adm/navmaps')";
+ } else {
+ $links{$key} = '/adm/navmaps';
+ }
$current = $key;
$links{'managetest'} = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2fmenu';
}
@@ -330,10 +350,10 @@ sub gci_secondary_menu {
my $tabs;
foreach my $item (@menutabs) {
if ($item eq $current) {
- $tabs .= ' '.
+ $tabs .= ''.
$linktext{$item}.'';
} else {
- $tabs .= ' '.
+ $tabs .= ''.
$linktext{$item}.'';
}
}
@@ -622,9 +642,13 @@ sub innerregister {
my @crumbs;
unless (($forcereg) && ($env{'request.noversionuri'} eq '/adm/navmaps')
&& ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {
+ my $link = "javascript:gopost('/adm/navmaps','')";
+ if ($env{'environment.remotenavmap'} eq 'on') {
+ $link = "javascript:gonav('/adm/navmaps','')"
+ }
@crumbs = ({text => Apache::loncommon::course_type()
. ' Contents',
- href => "Javascript:gopost('/adm/navmaps','')"});
+ href => $link});
}
if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {
push(@crumbs, {text => '...',
@@ -1443,13 +1467,19 @@ ENDSCRIPT
}
if ($env{'request.course.id'}) {
if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
+ my $navlink;
+ if ($env{'environment.remotenavmap'} eq 'on') {
+ $navlink = "javascript:gonav('/adm/navmaps')";
+ } else {
+ $navlink = '/adm/navmaps';
+ }
$output .=
- '