--- loncom/interface/lonmenu.pm 2009/10/16 20:22:06 1.290 +++ loncom/interface/lonmenu.pm 2009/10/16 23:35:08 1.291 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.290 2009/10/16 20:22:06 raeburn Exp $ +# $Id: lonmenu.pm,v 1.291 2009/10/16 23:35:08 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -137,21 +137,20 @@ use HTML::Entities(); use vars qw(@desklines %category_names %category_members %category_positions $readdesk @primary_menu @secondary_menu); - my @inlineremote; sub prep_menuitem { - my $menuitem = shift; - return '' unless ref $menuitem eq 'ARRAY'; + my ($menuitem) = @_; + return '' unless(ref($menuitem) eq 'ARRAY'); my $link; if ($$menuitem[1]) { # graphical Link $link = "\"""; + . " src=\"" . &Apache::loncommon::lonhttpdurl($$menuitem[1]) . "\"" + . " alt=\"" . &mt($$menuitem[2]) . "\" />"; } else { # textual Link - $link = mt($$menuitem[3]); - } - return "
  • $link
  • "; + $link = &mt($$menuitem[3]); + } + return '
  • '.$link.'
  • '; } # primary_menu() evaluates @primary_menu and returns XHTML for the menu @@ -166,9 +165,9 @@ sub primary_menu { foreach my $menuitem (@primary_menu) { # evaluate conditions 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 @@ -176,19 +175,23 @@ sub primary_menu { && $env{'user.name'} ne 'public' # only visible to public && $env{'user.domain'} ne 'public'; # users 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); + if (ref($menuitem) eq 'ARRAY') { + my @items = @{$menuitem}; + $items[0] = 'javascript:'.$menuitem; + $menu .= &prep_menuitem(\@items); + } } - } + } - return "
      $menu
    "; + return "
      $menu
    "; } @@ -235,15 +238,25 @@ sub secondary_menu { $menu .= $roles_selector ? "
  • $roles_selector
  • " : ''; } else { - $menu .= prep_menuitem(\@$menuitem); + 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); + } else { + $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 '' @@ -252,7 +265,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; @@ -354,7 +367,7 @@ sub menubuttons { my %lt=&initlittle(); my $domain=&Apache::loncommon::determinedomain(); - my $function =&Apache::loncommon::get_users_function(); + my $function=&Apache::loncommon::get_users_function(); my $link=&Apache::loncommon::designparm($function.'.link',$domain); my $alink=&Apache::loncommon::designparm($function.'.alink',$domain); my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain); @@ -415,7 +428,7 @@ ENDCRELOAD my $utility = &utilityfunctions(); #Prepare the message link that indicates the arrival of new mail - my $messagelink = Apache::lonmsg::mynewmail() ? "Message (new)" : "Message"; + my $messagelink = &Apache::lonmsg::mynewmail() ? "Message (new)" : "Message"; $messagelink = '' . mt($messagelink) .''; @@ -543,9 +556,9 @@ sub innerregister { push @crumbs, {text => $restitle, no_mt => 1} if $restitle; - Apache::lonhtmlcommon::clear_breadcrumbs(); - Apache::lonhtmlcommon::add_breadcrumb(@crumbs); - $breadcrumb .= Apache::lonhtmlcommon::breadcrumbs(undef,undef,0); + &Apache::lonhtmlcommon::clear_breadcrumbs(); + &Apache::lonhtmlcommon::add_breadcrumb(@crumbs); + $breadcrumb .= &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0); unless (($env{'request.state'} eq 'edit') || ($newmail) || ($env{'request.state'} eq 'construct') || ($env{'form.register'})) {