version 1.372, 2012/05/21 16:24:14
|
version 1.377, 2012/05/25 03:22:43
|
Line 115 entries from mydesk.tab
|
Line 115 entries from mydesk.tab
|
|
|
Same as primary_menu() but operates on @secondary_menu. |
Same as primary_menu() but operates on @secondary_menu. |
|
|
|
=item create_submenu() |
|
|
|
Creates XHTML for unordered list of sub-menu items which belong to a |
|
particular top-level menu item. Uses hover pseudo class in css to display |
|
dropdown list when mouse hovers over top-level item. Support for IE6 |
|
(no hover psuedo class) via LC_hoverable class for <li> tag for top- |
|
level item, which employs jQuery to handle behavior on mouseover. |
|
|
|
Inputs: 4 - (a) link and (b) target for anchor href in top level item, |
|
(c) title for text wrapped by anchor tag in top level item. |
|
(d) reference to array of arrays of sub-menu items. |
|
|
=item innerregister() |
=item innerregister() |
|
|
This gets called in order to register a URL in the body of the document |
This gets called in order to register a URL in the body of the document |
Line 225 sub primary_menu {
|
Line 237 sub primary_menu {
|
|
|
my $title = $menuitem->[3]; |
my $title = $menuitem->[3]; |
if (defined($primary_submenu{$title})) { |
if (defined($primary_submenu{$title})) { |
my ($link,$target,$numsub); |
my ($link,$target); |
if ($menuitem->[0] ne '') { |
if ($menuitem->[0] ne '') { |
$link = $menuitem->[0]; |
$link = $menuitem->[0]; |
$target = '_top'; |
$target = '_top'; |
} else { |
} else { |
$link = '#'; |
$link = '#'; |
} |
} |
|
my @primsub; |
if (ref($primary_submenu{$title}) eq 'ARRAY') { |
if (ref($primary_submenu{$title}) eq 'ARRAY') { |
$numsub = @{$primary_submenu{$title}}; |
foreach my $item (@{$primary_submenu{$title}}) { |
if ($numsub) { |
next if (($item->[2] eq 'wishlist') && |
$title = |
((!&Apache::lonnet::allowed('bre',"/res/$env{'user.domain'}/")) && |
'<span class="LC_nobreak">'.$title. |
(!&Apache::lonnet::allowed('bro',"/res/$env{'user.domain'}/")))); |
'<span class="LC_fontsize_small">'. |
next if (($item->[2] eq 'reqcrs') && (!&check_for_rcrs())); |
'▼</span></span>'; |
next if ((($item->[2] eq 'portfolio') || |
} |
($item->[2] eq 'blog')) && |
} |
(!&Apache::lonnet::usertools_access('','',$item->[2], |
$menu .= '<li class="LC_hoverable">'. |
undef,'tools'))); |
'<a href="'.$link.'" target="'.$target.'">'.$title.'</a>'; |
push(@primsub,$item); |
if ($numsub) { |
} |
$menu .= '<ul>'; |
if (@primsub > 0) { |
foreach my $item (@{$primary_submenu{$menuitem->[3]}}) { |
$menu .= &create_submenu($link,$target,$title,\@primsub); |
if (ref($item) eq 'ARRAY') { |
} elsif ($link) { |
if ($item->[2] eq 'wishlist') { |
$menu .= '<li><a href="'.$link.'" target="'.$target.'">'.&mt($title).'</a></li>'; |
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 |
} 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'}; |
Line 326 sub secondary_menu {
|
Line 319 sub secondary_menu {
|
? "/$env{'request.course.sec'}" |
? "/$env{'request.course.sec'}" |
: ''); |
: ''); |
my $canedit = &Apache::lonnet::allowed('mdc', $env{'request.course.id'}); |
my $canedit = &Apache::lonnet::allowed('mdc', $env{'request.course.id'}); |
|
my $canviewroster = $env{'course.'.$env{'request.course.id'}.'.student_classlist_view'}; |
my $canviewgrps = &Apache::lonnet::allowed('vcg', $crs_sec); |
my $canviewgrps = &Apache::lonnet::allowed('vcg', $crs_sec); |
my $canmodifyuser = &Apache::lonnet::allowed('cst', $crs_sec); |
my $canmodifyuser = &Apache::lonnet::allowed('cst', $crs_sec); |
my $canviewwnew = &Apache::lonnet::allowed('whn', $crs_sec); |
my $canviewwnew = &Apache::lonnet::allowed('whn', $crs_sec); |
Line 354 sub secondary_menu {
|
Line 348 sub secondary_menu {
|
next if $$menuitem[4] eq 'cst' |
next if $$menuitem[4] eq 'cst' |
&& !$canmodifyuser; |
&& !$canmodifyuser; |
next if $$menuitem[4] eq 'ncst' |
next if $$menuitem[4] eq 'ncst' |
&& $canmodifyuser; |
&& ($canmodifyuser || !$canviewroster); |
next if $$menuitem[4] eq 'mgr' |
next if $$menuitem[4] eq 'mgr' |
&& !$canmgr; |
&& !$canmgr; |
next if $$menuitem[4] eq 'nmgr' |
next if $$menuitem[4] eq 'nmgr' |
Line 405 sub secondary_menu {
|
Line 399 sub secondary_menu {
|
return "<ul id=\"LC_secondary_menu\">$menu</ul>"; |
return "<ul id=\"LC_secondary_menu\">$menu</ul>"; |
} |
} |
|
|
|
sub create_submenu { |
|
my ($link,$target,$title,$submenu) = @_; |
|
return unless (ref($submenu) eq 'ARRAY'); |
|
my $menu = '<li class="LC_hoverable">'. |
|
'<a href="'.$link.'" target="'.$target.'">'. |
|
'<span class="LC_nobreak">'.&mt($title). |
|
'<span class="LC_fontsize_small" style="font-weight:normal;">'. |
|
' ▼</span></span></a>'. |
|
'<ul>'; |
|
my $count = 0; |
|
my $numsub = scalar(@{$submenu}); |
|
foreach my $item (@{$submenu}) { |
|
$count ++; |
|
if (ref($item) eq 'ARRAY') { |
|
my $borderbot; |
|
if ($count == $numsub) { |
|
$borderbot = 'border-bottom:1px solid black;'; |
|
} |
|
$menu .= '<li style="margin:0;padding:0;'. |
|
$borderbot.'"><a href="'.$item->[0].'">'. |
|
&mt($item->[1]).'</a></li>'; |
|
} |
|
} |
|
$menu .= '</ul></li>'; |
|
return $menu; |
|
} |
|
|
sub innerregister { |
sub innerregister { |
my ($forcereg,$bread_crumbs) = @_; |
my ($forcereg,$bread_crumbs) = @_; |
my $const_space = ($env{'request.state'} eq 'construct'); |
my $const_space = ($env{'request.state'} eq 'construct'); |
Line 725 ENDMENUITEMS
|
Line 746 ENDMENUITEMS
|
if (&Apache::lonnet::allowed('bre', $env{'request.course.id'}) eq 'F') { |
if (&Apache::lonnet::allowed('bre', $env{'request.course.id'}) eq 'F') { |
# wishlist is only available for users with access to resource-pool |
# wishlist is only available for users with access to resource-pool |
$menuitems .= (<<ENDMENUITEMS); |
$menuitems .= (<<ENDMENUITEMS); |
s&9&1&wishlist-link.png&Stored Links&wishlistlink[_2]&set_wishlistlink()&Save a link for this resource in in your personal Stored Links repository&&1 |
s&9&1&wishlist-link.png&Stored Links&wishlistlink[_2]&set_wishlistlink()&Save a link for this resource in your personal Stored Links repository&&1 |
ENDMENUITEMS |
ENDMENUITEMS |
} |
} |
} |
} |