--- loncom/interface/lonmenu.pm 2009/10/15 21:00:07 1.287 +++ loncom/interface/lonmenu.pm 2009/10/20 01:57:42 1.293 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.287 2009/10/15 21:00:07 raeburn Exp $ +# $Id: lonmenu.pm,v 1.293 2009/10/20 01:57:42 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->[0].';'; + $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) .''; @@ -519,7 +532,7 @@ sub innerregister { $newmail= 'swmenu.setstatus("you have","messages");'; } - my $breadcrumb; + my ($breadcrumb,$separator); if ($noremote && ($env{'request.symb'}) && ($env{'request.course.id'})) { @@ -529,10 +542,13 @@ sub innerregister { my $maptitle = &Apache::lonnet::gettitle($mapurl); my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread()); - my @crumbs = ({text => "Course Content", - href => "Javascript:gonav('/adm/navmaps')"}, - {text => '...', - no_mt => 1}); + my @crumbs = ({text => "Course Contents", + href => "Javascript:gonav('/adm/navmaps')"}); + + if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { + push(@crumbs, {text => '...', + no_mt => 1}); + } push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle && $maptitle ne 'default.sequence' @@ -540,9 +556,14 @@ 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'})) { + $separator = &Apache::loncommon::head_subbox(); + } # } if ($env{'request.state'} eq 'construct') { @@ -831,6 +852,7 @@ $tablestart $inlinebuttons $tableend $newmail +$separator @@ -1497,6 +1519,11 @@ sub utilityfunctions { return ''; } my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0])); + if ($currenturl =~ m{^/adm/wrapper/ext/}) { + if ($env{'request.external.querystring'}) { + $currenturl .= ($currenturl=~/\?/)?'&':'?'.$env{'request.external.querystring'}; + } + } $currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl)); my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'}); @@ -1614,7 +1641,7 @@ function catalog_info() { } function chat_win() { - lonchat=window.open('/res/adm/pages/chatroom.html',"LONchat",'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no'); + lonchat=window.open('/res/adm/pages/chatroom.html',"LONchat",'height=320,width=480,resizable=yes,location=no,menubar=no,toolbar=no'); } function group_chat(group) {