Diff for /loncom/interface/lonmenu.pm between versions 1.290 and 1.291

version 1.290, 2009/10/16 20:22:06 version 1.291, 2009/10/16 23:35:08
Line 137  use HTML::Entities(); Line 137  use HTML::Entities();
 use vars qw(@desklines %category_names %category_members %category_positions   use vars qw(@desklines %category_names %category_members %category_positions 
             $readdesk @primary_menu @secondary_menu);              $readdesk @primary_menu @secondary_menu);
   
   
 my @inlineremote;  my @inlineremote;
   
 sub prep_menuitem {  sub prep_menuitem {
     my $menuitem = shift;      my ($menuitem) = @_;
     return '' unless ref $menuitem eq 'ARRAY';      return '' unless(ref($menuitem) eq 'ARRAY');
     my $link;      my $link;
     if ($$menuitem[1]) { # graphical Link      if ($$menuitem[1]) { # graphical Link
         $link = "<img class=\"LC_noBorder\""          $link = "<img class=\"LC_noBorder\""
               . " src=\"" . Apache::loncommon::lonhttpdurl($$menuitem[1]) . "\""                . " src=\"" . &Apache::loncommon::lonhttpdurl($$menuitem[1]) . "\"" 
               . " alt=\"" . mt($$menuitem[2]) . "\" />";                . " alt=\"" . &mt($$menuitem[2]) . "\" />";
     } else {             # textual Link      } else {             # textual Link
         $link = mt($$menuitem[3]);          $link = &mt($$menuitem[3]);
     }           }
     return "<li><a href=\"javascript:$$menuitem[0]\">$link</a></li>";      return '<li><a href="'.$$menuitem[0].'">'.$link.'</a></li>';
 }  }
   
 # primary_menu() evaluates @primary_menu and returns XHTML for the menu  # primary_menu() evaluates @primary_menu and returns XHTML for the menu
Line 166  sub primary_menu { Line 165  sub primary_menu {
     foreach my $menuitem (@primary_menu) {      foreach my $menuitem (@primary_menu) {
         # evaluate conditions           # evaluate conditions 
         next if    $$menuitem[4]        eq 'nonewmsg'  # show links depending on          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          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,           next if    $$menuitem[4]        !~ /public/    ##we've a public user, 
                 && $env{'user.name'}    eq 'public'    ##who should not see all                   && $env{'user.name'}    eq 'public'    ##who should not see all 
                 && $env{'user.domain'}  eq 'public';   ##links                  && $env{'user.domain'}  eq 'public';   ##links
Line 176  sub primary_menu { Line 175  sub primary_menu {
                 && $env{'user.name'}    ne 'public'    # only visible to public                  && $env{'user.name'}    ne 'public'    # only visible to public
                 && $env{'user.domain'}  ne 'public';   # users                  && $env{'user.domain'}  ne 'public';   # users
         next if    $$menuitem[4]        eq 'roles'     ##show links depending on          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          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          if ($$menuitem[3] eq 'Help') { # special treatment for helplink
             $menu .= '<li>'.Apache::loncommon::top_nav_help('Help').'</li>';              $menu .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>';
         } else {          } else {
             $menu .= prep_menuitem(\@$menuitem);              if (ref($menuitem) eq 'ARRAY') { 
                   my @items = @{$menuitem};
                   $items[0] = 'javascript:'.$menuitem;
                   $menu .= &prep_menuitem(\@items);
               }
         }          }
      }      }
   
      return "<ol class=\"LC_primary_menu LC_right\">$menu</ol>";      return "<ol class=\"LC_primary_menu LC_right\">$menu</ol>";
 }  }
   
   
Line 235  sub secondary_menu { Line 238  sub secondary_menu {
             $menu .= $roles_selector ? "<li>$roles_selector</li>"              $menu .= $roles_selector ? "<li>$roles_selector</li>"
                                      : '';                                       : '';
         } else {          } 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\]/) {      if ($menu =~ /\[url\].*\[symb\]/) {
         my $escurl  = escape( Apache::lonenc::check_encrypt(          my $escurl  = &escape( &Apache::lonenc::check_encrypt(
                             $env{'request.noversionuri'}));                               $env{'request.noversionuri'}));
   
         my $escsymb = escape( Apache::lonenc::check_encrypt(          my $escsymb = &escape( &Apache::lonenc::check_encrypt(
                             $env{'request.symb'}));                                $env{'request.symb'})); 
   
         if (    $env{'request.state'} eq 'construct'          if (    $env{'request.state'} eq 'construct'
             and (   $env{'request.noversionuri'} eq ''               and (   $env{'request.noversionuri'} eq '' 
Line 252  sub secondary_menu { Line 265  sub secondary_menu {
             ($escurl = $env{'request.filename'}) =~               ($escurl = $env{'request.filename'}) =~ 
                 s{^/home/([^/]+)/public_html/(.*)$}{/priv/$1/$2};                  s{^/home/([^/]+)/public_html/(.*)$}{/priv/$1/$2};
   
             $escurl  = escape($escurl);              $escurl  = &escape($escurl);
         }              }    
         $menu =~ s/\[url\]/$escurl/g;          $menu =~ s/\[url\]/$escurl/g;
         $menu =~ s/\[symb\]/$escsymb/g;          $menu =~ s/\[symb\]/$escsymb/g;
Line 354  sub menubuttons { Line 367  sub menubuttons {
         my %lt=&initlittle();          my %lt=&initlittle();
   
         my $domain=&Apache::loncommon::determinedomain();          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 $link=&Apache::loncommon::designparm($function.'.link',$domain);
         my $alink=&Apache::loncommon::designparm($function.'.alink',$domain);          my $alink=&Apache::loncommon::designparm($function.'.alink',$domain);
         my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);          my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);
Line 415  ENDCRELOAD Line 428  ENDCRELOAD
     my $utility = &utilityfunctions();      my $utility = &utilityfunctions();
   
     #Prepare the message link that indicates the arrival of new mail      #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 = '<a href="javascript:go(\'/adm/communicate\');">'         $messagelink = '<a href="javascript:go(\'/adm/communicate\');">'
                       . mt($messagelink) .'</a>';                        . mt($messagelink) .'</a>';
   
Line 543  sub innerregister { Line 556  sub innerregister {
   
         push @crumbs, {text => $restitle, no_mt => 1} if $restitle;           push @crumbs, {text => $restitle, no_mt => 1} if $restitle; 
   
         Apache::lonhtmlcommon::clear_breadcrumbs();          &Apache::lonhtmlcommon::clear_breadcrumbs();
         Apache::lonhtmlcommon::add_breadcrumb(@crumbs);          &Apache::lonhtmlcommon::add_breadcrumb(@crumbs);
         $breadcrumb .= Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);          $breadcrumb .= &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);
  unless (($env{'request.state'} eq 'edit') || ($newmail) ||   unless (($env{'request.state'} eq 'edit') || ($newmail) ||
  ($env{'request.state'} eq 'construct') ||   ($env{'request.state'} eq 'construct') ||
  ($env{'form.register'})) {   ($env{'form.register'})) {

Removed from v.1.290  
changed lines
  Added in v.1.291


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>