version 1.239.4.1, 2008/12/13 15:51:51
|
version 1.249, 2008/12/09 04:49:01
|
Line 36
|
Line 36
|
# browser.interface is 'textual' |
# browser.interface is 'textual' |
# |
# |
|
|
|
=head1 NAME |
|
|
|
Apache::lonmenu |
|
|
|
=head1 SYNOPSIS |
|
|
|
Coordinates the response to clicking an image. |
|
|
|
This is part of the LearningOnline Network with CAPA project |
|
described at http://www.lon-capa.org. |
|
|
|
=head1 SUBROUTINES |
|
|
|
=over |
|
|
|
=item show_course() |
|
|
|
Little texts |
|
|
|
=item initlittle() |
|
|
|
=item menubuttons() |
|
|
|
This gets called at the top of the body section |
|
|
|
=item show_return_link() |
|
|
|
=item registerurl() |
|
|
|
This gets called in the header section |
|
|
|
=item innerregister() |
|
|
|
This gets called in order to register a URL, both with the Remote |
|
and in the body of the document |
|
|
|
=item loadevents() |
|
|
|
=item unloadevents() |
|
|
|
=item startupremote() |
|
|
|
=item setflags() |
|
|
|
=item maincall() |
|
|
|
=item load_remote_msg() |
|
|
|
=item get_menu_name() |
|
|
|
=item reopenmenu() |
|
|
|
=item open() |
|
|
|
Open the menu |
|
|
|
=item clear() |
|
|
|
=item switch() |
|
|
|
Switch a button or create a link |
|
Switch acts on the javascript that is executed when a button is clicked. |
|
The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)". |
|
|
|
=item secondlevel() |
|
|
|
=item openmenu() |
|
|
|
=item inlinemenu() |
|
|
|
=item rawconfig() |
|
|
|
=item close() |
|
|
|
=item footer() |
|
|
|
=item utilityfunctions() |
|
|
|
=item serverform() |
|
|
|
=item constspaceform() |
|
|
|
=item get_nav_status() |
|
|
|
=item convert_menu_function() |
|
|
|
FIXME this needs to move into mydesktab and the other locations |
|
the text is generated |
|
|
|
=item hidden_button_check() |
|
|
|
=item roles_selector() |
|
|
|
=item jump_to_role() |
|
|
|
=back |
|
|
|
=cut |
|
|
package Apache::lonmenu; |
package Apache::lonmenu; |
|
|
use strict; |
use strict; |
Line 53 my @inlineremote;
|
Line 152 my @inlineremote;
|
|
|
|
|
|
|
# ================================================================ Little texts |
|
sub show_course { |
sub show_course { |
my $course = !$env{'user.adv'}; |
my $course = !$env{'user.adv'}; |
if (!$env{'user.adv'}) { |
if (!$env{'user.adv'}) { |
Line 84 sub initlittle {
|
Line 182 sub initlittle {
|
); |
); |
} |
} |
|
|
# ============================= This gets called at the top of the body section |
|
|
|
sub menubuttons { |
sub menubuttons { |
my $forcereg=shift; |
my $forcereg=shift; |
my $registration=shift; |
my $registration=shift; |
Line 111 sub menubuttons {
|
Line 207 sub menubuttons {
|
|
|
my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif"); |
my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif"); |
$logo = '<td class="LC_top_nav_logo"><a href="/adm/about.html"><img src="'. |
$logo = '<td class="LC_top_nav_logo"><a href="/adm/about.html"><img src="'. |
$logo.'" alt="LON-CAPA Logo" /></a></td>'; |
$logo.'" alt="LON-CAPA Logo" class="noBorder" /></a></td>'; |
|
|
if ($env{'request.state'} eq 'construct') { |
if ($env{'request.state'} eq 'construct') { |
if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) { |
if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) { |
Line 203 ENDMAINMENU
|
Line 299 ENDMAINMENU
|
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
</font> |
|
ENDINLINEMENU |
ENDINLINEMENU |
} |
} |
$roles = '<td><a href="/adm/roles" target="_top">'.$lt{'roles'}.'</a></td>'; |
$roles = '<td><a href="/adm/roles" target="_top">'.$lt{'roles'}.'</a></td>'; |
Line 269 $navmaps
|
Line 364 $navmaps
|
$docs |
$docs |
$groups |
$groups |
$roles |
$roles |
<td class="LC_top_nav_help">$helplink</td> |
<td style="width: 2.0em;">$helplink</td> |
<td class="LC_top_nav_exit"><a href="/adm/logout" target="_top">$lt{'exit'}</a></td> |
<td style="width: 2.0em;"><a href="/adm/logout" target="_top">$lt{'exit'}</a></td> |
</tr> |
</tr> |
</table> |
</table> |
$form |
$form |
Line 297 sub show_return_link {
|
Line 392 sub show_return_link {
|
)); |
)); |
} |
} |
|
|
# ====================================== This gets called in the header section |
|
|
|
sub registerurl { |
sub registerurl { |
my ($forcereg) = @_; |
my ($forcereg) = @_; |
Line 322 sub registerurl {
|
Line 416 sub registerurl {
|
return $result.$force_title; |
return $result.$force_title; |
} |
} |
|
|
# =========== This gets called in order to register a URL, both with the Remote |
|
# =========== and in the body of the document |
|
|
|
sub innerregister { |
sub innerregister { |
my ($forcereg, $titletable) = @_; |
my ($forcereg, $titletable) = @_; |
my $result = ''; |
my $result = ''; |
Line 514 c&8&1
|
Line 605 c&8&1
|
c&8&2 |
c&8&2 |
s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document |
s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document |
s&9&1&sbkm.gif&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&&1 |
s&9&1&sbkm.gif&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&&1 |
s&9&3&anot.gif&anno-[_1]&tations[_1]&annotate()&Make notes and annotations about this resource&&1 |
|
ENDMENUITEMS |
ENDMENUITEMS |
|
|
|
my $currentURL = &Apache::loncommon::get_symb(); |
|
my ($symb_old,$symb_old_enc) = &Apache::loncommon::clean_symb($currentURL); |
|
my $annotation = &Apache::loncommon::get_annotation($symb_old,$symb_old_enc); |
|
$menuitems.="s&9&3&"; |
|
if(length($annotation) > 0){ |
|
$menuitems.="anot2.gif"; |
|
}else{ |
|
$menuitems.="anot.gif"; |
|
} |
|
$menuitems.="&anno-[_1]&tations[_1]&annotate()&"; |
|
$menuitems.="Make notes and annotations about this resource&&1\n"; |
|
|
unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) { |
unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) { |
if (!$env{'request.enc'}) { |
if (!$env{'request.enc'}) { |
$menuitems.=(<<ENDREALRES); |
$menuitems.=(<<ENDREALRES); |
Line 716 sub unloadevents() {
|
Line 818 sub unloadevents() {
|
return 'LONCAPAstale();'; |
return 'LONCAPAstale();'; |
} |
} |
|
|
# ============================================================= Start up remote |
|
|
|
sub startupremote { |
sub startupremote { |
my ($lowerurl)=@_; |
my ($lowerurl)=@_; |
Line 830 sub get_menu_name {
|
Line 931 sub get_menu_name {
|
return 'LCmenu'.$hostid; |
return 'LCmenu'.$hostid; |
} |
} |
|
|
# ================================================================= Reopen menu |
|
|
|
sub reopenmenu { |
sub reopenmenu { |
if (($env{'browser.interface'} eq 'textual') || |
if (($env{'browser.interface'} eq 'textual') || |
Line 840 sub reopenmenu {
|
Line 940 sub reopenmenu {
|
return('window.open('.$nothing.',"'.$menuname.'","",false);'); |
return('window.open('.$nothing.',"'.$menuname.'","",false);'); |
} |
} |
|
|
# =============================================================== Open the menu |
|
|
|
sub open { |
sub open { |
my $returnval=''; |
my $returnval=''; |
Line 928 sub switch {
|
Line 1027 sub switch {
|
my $pic= |
my $pic= |
'<img alt="'.$text.'" src="'. |
'<img alt="'.$text.'" src="'. |
&Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$img). |
&Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$img). |
'" align="'.($nobreak==3?'right':'left').'" />'; |
'" align="'.($nobreak==3?'right':'left').'" class="noBorder" />'; |
if ($env{'browser.interface'} eq 'faketextual') { |
if ($env{'browser.interface'} eq 'faketextual') { |
# Accessibility |
# Accessibility |
if ($nobreak==3) { |
if ($nobreak==3) { |
$inlineremote[$idx]="\n". |
$inlineremote[$idx]="\n". |
'<td class="LC_menubuttons_text" align="right">'.$text. |
'<td class="LC_menubuttons_text" align="right">'.$text. |
'</td><td class="LC_menubuttons_img" align="left">'. |
'</td><td align="left">'. |
'<a href="javascript:'.$act.';">'.$pic.'</a></td></tr>'; |
'<a href="javascript:'.$act.';">'.$pic.'</a></td></tr>'; |
} elsif ($nobreak) { |
} elsif ($nobreak) { |
$inlineremote[$idx]="\n<tr>". |
$inlineremote[$idx]="\n<tr>". |
'<td class="LC_menubuttons_img" align="left">'. |
'<td align="left">'. |
'<a href="javascript:'.$act.';">'.$pic.'</a></td> |
'<a href="javascript:'.$act.';">'.$pic.'</a></td> |
<td class="LC_menubuttons_text" align="left"><a class="LC_menubuttons_link" href="javascript:'.$act.';"><span class="LC_menubuttons_inline_text">'.$text.'</span></a></td>'; |
<td class="LC_menubuttons_text" align="left"><a class="LC_menubuttons_link" href="javascript:'.$act.';"><span class="LC_menubuttons_inline_text">'.$text.'</span></a></td>'; |
} else { |
} else { |
$inlineremote[$idx]="\n<tr>". |
$inlineremote[$idx]="\n<tr>". |
'<td class="LC_menubuttons_img" align="left">'. |
'<td align="left">'. |
'<a href="javascript:'.$act.';">'.$pic. |
'<a href="javascript:'.$act.';">'.$pic. |
'</a></td><td class="LC_menubuttons_text" colspan="3">'. |
'</a></td><td class="LC_menubuttons_text" colspan="3">'. |
'<a class="LC_menubuttons_link" href="javascript:'.$act.';"><span class="LC_menubuttons_inline_text">'.$desc.'</span></a></td></tr>'; |
'<a class="LC_menubuttons_link" href="javascript:'.$act.';"><span class="LC_menubuttons_inline_text">'.$desc.'</span></a></td></tr>'; |
Line 990 sub inlinemenu {
|
Line 1089 sub inlinemenu {
|
&rawconfig(1); |
&rawconfig(1); |
my $output='<table id="LC_mainmenu"><tr>'; |
my $output='<table id="LC_mainmenu"><tr>'; |
for (my $col=1; $col<=2; $col++) { |
for (my $col=1; $col<=2; $col++) { |
$output.='<td class="LC_mainmenu_column">'; |
$output.='<td class="LC_mainmenu_col_fieldset">'; |
for (my $row=1; $row<=8; $row++) { |
for (my $row=1; $row<=8; $row++) { |
foreach my $cat (keys(%category_members)) { |
foreach my $cat (keys(%category_members)) { |
if ($category_positions{$cat} ne "$col,$row") { next; } |
if ($category_positions{$cat} ne "$col,$row") { next; } |
$output.='<table id="LC_menubuttons_mainmenu"><tr><td colspan="4" class="LC_menubuttons_category">'.&mt($category_names{$cat}).'</td></tr>'; |
#$output.='<table><tr><td colspan="4" class="LC_menubuttons_category">'.&mt($category_names{$cat}).'</td></tr>'; |
|
$output.='<div class="ContentBoxSpecial">'; |
|
$output.='<h4 class="hcell">'.&mt($category_names{$cat}).'</h4>'; |
|
$output.='<table>'; |
my %active=(); |
my %active=(); |
foreach my $menu_item (split(/\:/,$category_members{$cat})) { |
foreach my $menu_item (split(/\:/,$category_members{$cat})) { |
if ($inlineremote[$menu_item]) { |
if ($inlineremote[$menu_item]) { |
Line 1005 sub inlinemenu {
|
Line 1107 sub inlinemenu {
|
$output.=$inlineremote[$item]; |
$output.=$inlineremote[$item]; |
} |
} |
$output.='</table>'; |
$output.='</table>'; |
|
$output.='</div>'; |
} |
} |
} |
} |
$output.="</td>"; |
$output.="</td>"; |
Line 1121 sub rawconfig {
|
Line 1224 sub rawconfig {
|
} |
} |
} |
} |
} |
} |
|
} elsif ($pro eq 'tools') { |
|
my @tools = ('aboutme','blog','portfolio'); |
|
if (grep(/^\Q$prt\E$/,@tools)) { |
|
if (!&Apache::lonnet::usertools_access($env{'user.name'}, |
|
$env{'user.domain'},$prt)) { |
|
$output.=&clear($row,$col); |
|
next; |
|
} |
|
} |
|
$prt='any'; |
|
$output.=&secondlevel( |
|
$uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat); |
} |
} |
} |
} |
unless (($env{'browser.interface'} eq 'textual') || |
unless (($env{'browser.interface'} eq 'textual') || |