Diff for /loncom/interface/lonmenu.pm between versions 1.370 and 1.371

version 1.370, 2012/05/15 01:41:27 version 1.371, 2012/05/18 14:27:11
Line 26 Line 26
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
 #  #
 # There is one parameter controlling the action of this module:  
 #  
   
 =head1 NAME  =head1 NAME
   
Line 35  Apache::lonmenu Line 33  Apache::lonmenu
   
 =head1 SYNOPSIS  =head1 SYNOPSIS
   
 Coordinates the response to clicking an image.  Loads contents of /home/httpd/lonTabs/mydesk.tab, 
   used to generate inline menu, and Main Menu page. 
   
 This is part of the LearningOnline Network with CAPA project  This is part of the LearningOnline Network with CAPA project
 described at http://www.lon-capa.org.  described at http://www.lon-capa.org.
Line 74  It is set to 'done' in the BEGIN block o Line 73  It is set to 'done' in the BEGIN block o
 =item @primary_menu  =item @primary_menu
   
 The elements of this array reference arrays that are made up of the components  The elements of this array reference arrays that are made up of the components
 of those lines of mydesk.tab that start with prim.  of those lines of mydesk.tab that start with prim:.
 It is used by primary_menu() to generate the corresponding menu.  It is used by primary_menu() to generate the corresponding menu.
 It gets filled in the BEGIN block of this module.  It gets filled in the BEGIN block of this module.
   
   =item %primary_sub_menu
   
   The keys of this hash reference are the names of items in the primary_menu array 
   which have sub-menus.  For each key, the corresponding value is a reference to
   an array containing components extracted from lines in mydesk.tab which begin
   with primsub:.
   This hash, which is used by primary_menu to generate sub-menus, is populated in
   the BEGIN block.
   
 =item @secondary_menu  =item @secondary_menu
   
 The elements of this array reference arrays that are made up of the components  The elements of this array reference arrays that are made up of the components
Line 129  The javascript is usually similar to "go Line 137  The javascript is usually similar to "go
   
 =item utilityfunctions()  =item utilityfunctions()
   
   Output from this routine is a number of javascript functions called by
   items in the inline menu, and in some cases items in the Main Menu page. 
   
 =item serverform()  =item serverform()
   
 =item constspaceform()  =item constspaceform()
Line 159  use HTML::Entities(); Line 170  use HTML::Entities();
 use Apache::lonwishlist();  use Apache::lonwishlist();
   
 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 %primary_submenu @secondary_menu);
   
 my @inlineremote;  my @inlineremote;
   
Line 182  sub prep_menuitem { Line 193  sub prep_menuitem {
   
 # primary_menu() evaluates @primary_menu and returns XHTML for the menu  # primary_menu() evaluates @primary_menu and returns XHTML for the menu
 # that contains following links:  # that contains following links:
 # About, Message, Roles, Help, Logout  # About, Message, Personal, Roles, Help, Logout
 # @primary_menu is filled within the BEGIN block of this module with   # @primary_menu is filled within the BEGIN block of this module with 
 # entries from mydesk.tab  # entries from mydesk.tab
 sub primary_menu {  sub primary_menu {
Line 212  sub primary_menu { Line 223  sub primary_menu {
         next if    $$menuitem[4]        eq 'courses'   ##'Roles' wanted          next if    $$menuitem[4]        eq 'courses'   ##'Roles' wanted
                 && !&Apache::loncommon::show_course(); ##                  && !&Apache::loncommon::show_course(); ##
                   
                       my $title = $menuitem->[3];
         if ($$menuitem[3] eq 'Help') { # special treatment for helplink          if (defined($primary_submenu{$title})) {
               my ($link,$target,$numsub);
               if ($menuitem->[0] ne '') {
                   $link = $menuitem->[0];
                   $target = '_top';
               } else {
                   $link = '#';
               }
               if (ref($primary_submenu{$title}) eq 'ARRAY') {
                   $numsub = @{$primary_submenu{$title}};
                   if ($numsub) {
                       $title =
                           '<span class="LC_nobreak">'.$title.
                           '<span class="LC_fontsize_small">'.
                           '&#9660;</span></span>';
                   }
               }
               $menu .= '<li><a href="'.$link.'" target="'.$target.'">'.$title.'</a>';
               if ($numsub) {
                   $menu .= '<ul>';
                   foreach my $item (@{$primary_submenu{$menuitem->[3]}}) {
                       if (ref($item) eq 'ARRAY') {
                           if ($item->[2] eq 'wishlist') {
                               next unless ((&Apache::lonnet::allowed('bre',"/res/$env{'user.domain'}/")) ||
                                            (&Apache::lonnet::allowed('bro',"/res/$env{'user.domain'}/")));
                           } elsif ($item->[2] eq 'reqcrs') {
                               next unless(&check_for_rcrs());
                           } elsif (($item->[2] eq 'portfolio') ||
                                    ($item->[2] eq 'blog')) {
                               if (!&Apache::lonnet::usertools_access(
                                       $env{'user.name'},
                                       $env{'user.domain'},
                                       $item->[2],undef,'tools')) {
                                   next;
                               }
                           }
                           $menu .= '<li style="margin:0;padding:0">'.
                                    '<a href="'.$item->[0].
                                    '" style="padding:0 0 0 10px">'.
                                    $item->[1].'</a></li>';
                       }
                   }
                   $menu .= '</ul>';
               }
               $menu .= '</li>';
           } elsif ($$menuitem[3] eq 'Help') { # special treatment for helplink
             if ($public) {              if ($public) {
                 my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};                  my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
                 my $defdom = &Apache::lonnet::default_login_domain();                  my $defdom = &Apache::lonnet::default_login_domain();
Line 1687  BEGIN { Line 1743  BEGIN {
                     } elsif ($configline=~/^prim\:/) {                      } elsif ($configline=~/^prim\:/) {
                         my @entries = (split(/\:/, $configline))[1..5];                          my @entries = (split(/\:/, $configline))[1..5];
                         push @primary_menu, \@entries;                          push @primary_menu, \@entries;
                       } elsif ($configline=~/^primsub\:/) {
                           my ($parent,@entries) = (split(/\:/, $configline))[1..4];
                           push (@{$primary_submenu{$parent}},\@entries);
                     } elsif ($configline=~/^scnd\:/) {                      } elsif ($configline=~/^scnd\:/) {
                         my @entries = (split(/\:/, $configline))[1..5];                          my @entries = (split(/\:/, $configline))[1..5];
                         push @secondary_menu, \@entries;                           push @secondary_menu, \@entries; 

Removed from v.1.370  
changed lines
  Added in v.1.371


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