Diff for /loncom/interface/lonmenu.pm between versions 1.414 and 1.415

version 1.414, 2013/05/09 05:24:36 version 1.415, 2013/05/26 12:39:23
Line 106  secondary_menu(). Line 106  secondary_menu().
   
 =item primary_menu()  =item primary_menu()
   
 This routine evaluates @primary_menu and returns XHTML for the menu  This routine evaluates @primary_menu and returns a two item array, 
 that contains following links: About, Message, Roles, Help, Logout  with the array elements containing XHTML for the left and right sides of 
   the menu that contains the following links: About, Message, 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
   
 =item secondary_menu()  =item secondary_menu()
   
Line 203  sub prep_menuitem { Line 204  sub prep_menuitem {
            . qq| href="$$menuitem[0]" target="_top">$link</a></li>|;             . qq| href="$$menuitem[0]" target="_top">$link</a></li>|;
 }  }
   
 # primary_menu() evaluates @primary_menu and returns XHTML for the menu  # primary_menu() evaluates @primary_menu and returns a two item array,
 # that contains following links:  # with the array elements containing XHTML for the left and right sides of 
 # About, Message, Personal, Roles, Help, Logout  # the menu that contains the following links:
   # Personal, About, Message, 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 {
     my $menu;      my (%menu);
     # each element of @primary contains following array:      # each element of @primary contains following array:
     # (link url, icon path, alt text, link text, condition)      # (link url, icon path, alt text, link text, condition, position)
     my $public;      my $public;
     if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))      if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))
         || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) {          || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) {
Line 236  sub primary_menu { Line 238  sub primary_menu {
                 && !&Apache::loncommon::show_course(); ##                  && !&Apache::loncommon::show_course(); ##
                   
         my $title = $menuitem->[3];          my $title = $menuitem->[3];
           my $position = $menuitem->[5];
           if ($position eq '') {
               $position = 'right';
           }
         if (defined($primary_submenu{$title})) {          if (defined($primary_submenu{$title})) {
             my ($link,$target);              my ($link,$target);
             if ($menuitem->[0] ne '') {              if ($menuitem->[0] ne '') {
Line 255  sub primary_menu { Line 261  sub primary_menu {
                     push(@primsub,$item);                      push(@primsub,$item);
                 }                  }
                 if (@primsub > 0) {                  if (@primsub > 0) {
                     $menu .= &create_submenu($link,$target,$title,\@primsub);                      $menu{$position} .= &create_submenu($link,$target,$title,\@primsub);
                 } elsif ($link) {                  } elsif ($link) {
                     $menu .= '<li><a href="'.$link.'" target="'.$target.'">'.&mt($title).'</a></li>';                      $menu{$position} .= '<li><a href="'.$link.'" target="'.$target.'">'.&mt($title).'</a></li>';
                 }                  }
             }              }
         } elsif ($$menuitem[3] eq 'Help') { # special treatment for helplink          } elsif ($$menuitem[3] eq 'Help') { # special treatment for helplink
Line 268  sub primary_menu { Line 274  sub primary_menu {
                                                                   'helpdeskmail',                                                                    'helpdeskmail',
                                                                   $defdom,$origmail);                                                                    $defdom,$origmail);
                 if ($to ne '') {                  if ($to ne '') {
                     $menu .= &prep_menuitem($menuitem);                       $menu{$position} .= &prep_menuitem($menuitem); 
                 }                  }
             } else {              } else {
                 $menu .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>';                  $menu{$position} .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>';
             }              }
         } else {          } else {
             $menu .= prep_menuitem($menuitem);              $menu{$position} .= prep_menuitem($menuitem);
         }          }
     }      }
     $menu =~ s/\[domain\]/$env{'user.domain'}/g;      return ("<ol class=\"LC_primary_menu LC_floatleft\">$menu{'left'}</ol>",
     $menu =~ s/\[user\]/$env{'user.name'}/g;              "<ol class=\"LC_primary_menu LC_floatright LC_right\">$menu{'right'}</ol>");
   
     return "<ol class=\"LC_primary_menu LC_right\">$menu</ol>";  
 }  }
   
 #returns hashref {user=>'',dom=>''} containing:  #returns hashref {user=>'',dom=>''} containing:
Line 462  sub create_submenu { Line 466  sub create_submenu {
     if ($target ne '') {      if ($target ne '') {
         $disptarget = ' target="'.$target.'"';          $disptarget = ' target="'.$target.'"';
     }      }
       my $name;
       if ($title eq 'Personal') {
           if ($env{'user.name'} && $env{'user.domain'}) {
               $name = &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'});
           } else {
               $name = &mt($title);
           }
       } else {
           $name = &mt($title);
       }
     my $menu = '<li class="LC_hoverable">'.      my $menu = '<li class="LC_hoverable">'.
                '<a href="'.$link.'"'.$disptarget.'>'.                 '<a href="'.$link.'"'.$disptarget.'>'.
                '<span class="LC_nobreak">'.&mt($title).                 '<span class="LC_nobreak">'.$name.
                '<span class="LC_fontsize_small" style="font-weight:normal;">'.                 '<span class="LC_fontsize_small" style="font-weight:normal;">'.
                ' &#9660;</span></span></a>'.                 ' &#9660;</span></span></a>'.
                '<ul>';                 '<ul>';
Line 477  sub create_submenu { Line 491  sub create_submenu {
             if ($count == $numsub) {              if ($count == $numsub) {
                 $borderbot = 'border-bottom:1px solid black;';                  $borderbot = 'border-bottom:1px solid black;';
             }              }
               if ($item->[0] =~ /(aboutme|rss\.html)$/) {
                   $item->[0] =~ s/\[domain\]/$env{'user.domain'}/g;
                   $item->[0] =~ s/\[user\]/$env{'user.name'}/g;
               }
             $menu .= '<li style="margin:0;padding:0;'.              $menu .= '<li style="margin:0;padding:0;'.
                      $borderbot.'"><a href="'.$item->[0].'">'.                       $borderbot.'"><a href="'.$item->[0].'">'.
                      &mt($item->[1]).'</a></li>';                       &mt($item->[1]).'</a></li>';
Line 947  sub prepare_functions { Line 965  sub prepare_functions {
             unless (&Apache::lonnet::is_course($sdom,$sname)) {              unless (&Apache::lonnet::is_course($sdom,$sname)) {
                 &switch('','',6,4,'mail-message-new-22x22.png','Message to user',                  &switch('','',6,4,'mail-message-new-22x22.png','Message to user',
                         '',                          '',
                         "go('/adm/email?compose=individual&recname=$sname&recdom=$sdom')",                          "go('/adm/email?compose=individual&amp;recname=$sname&amp;recdom=$sdom')",
                             'Send message to specific user');                              'Send message to specific user');
             }              }
             my $hideprivileged = 1;              my $hideprivileged = 1;
Line 969  sub prepare_functions { Line 987  sub prepare_functions {
                 if ($perms{'vgr'}) {                  if ($perms{'vgr'}) {
                     &switch('','',6,6,'rsrv-22x22.png','Reservations',                      &switch('','',6,6,'rsrv-22x22.png','Reservations',
                             '',                              '',
                             "go('/adm/slotrequest?command=showresv&origin=aboutme&uname=$sname&udom=$sdom')",                              "go('/adm/slotrequest?command=showresv&amp;origin=aboutme&amp;uname=$sname&amp;udom=$sdom')",
                             'Slot reservation history');                              'Slot reservation history');
                 }                  }
                 if ($perms{'srm'}) {                  if ($perms{'srm'}) {
                     &switch('','',6,7,'contact-new-22x22.png','Records',                      &switch('','',6,7,'contact-new-22x22.png','Records',
                             '',                              '',
                             "go('/adm/email?recordftf=retrieve&recname=$sname&recdom=$sdom')",                              "go('/adm/email?recordftf=retrieve&amp;recname=$sname&amp;recdom=$sdom')",
                             'Add records');                              'Add records');
                 }                  }
             }              }
Line 991  sub prepare_functions { Line 1009  sub prepare_functions {
             if ((@folders > 2) || ($resurl ne '/adm/supplemental')) {              if ((@folders > 2) || ($resurl ne '/adm/supplemental')) {
                 my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"'));                  my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"'));
                 &switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]',                  &switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]',
                         "location.href='/adm/coursedocs?command=direct&forcesupplement=1&supppath=$esc_path'",                          "location.href='/adm/coursedocs?command=direct&amp;forcesupplement=1&amp;supppath=$esc_path'",
                         'Folder/Page Content');                          'Folder/Page Content');
             }              }
         }          }
Line 2100  BEGIN { Line 2118  BEGIN {
                         $category_positions{$entries[2]}=$entries[1];                          $category_positions{$entries[2]}=$entries[1];
                         $category_names{$entries[2]}=$entries[3];                          $category_names{$entries[2]}=$entries[3];
                     } elsif ($configline=~/^prim\:/) {                      } elsif ($configline=~/^prim\:/) {
                         my @entries = (split(/\:/, $configline))[1..5];                          my @entries = (split(/\:/, $configline))[1..6];
                         push(@primary_menu,\@entries);                          push(@primary_menu,\@entries);
                     } elsif ($configline=~/^primsub\:/) {                      } elsif ($configline=~/^primsub\:/) {
                         my ($parent,@entries) = (split(/\:/, $configline))[1..4];                          my ($parent,@entries) = (split(/\:/, $configline))[1..4];

Removed from v.1.414  
changed lines
  Added in v.1.415


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