version 1.165, 2006/02/21 20:14:49
|
version 1.174, 2006/04/20 02:58:17
|
Line 40 package Apache::lonmenu;
|
Line 40 package Apache::lonmenu;
|
|
|
use strict; |
use strict; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::Constants qw(:common); |
|
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lonenc(); |
use Apache::lonenc(); |
Line 50 use vars qw(@desklines $readdesk);
|
Line 49 use vars qw(@desklines $readdesk);
|
|
|
|
|
my @inlineremote; |
my @inlineremote; |
my $font; |
|
my $tabbg; |
|
my $pgbg; |
|
|
|
# ================================================================ Little texts |
# ================================================================ Little texts |
|
|
Line 68 sub initlittle {
|
Line 64 sub initlittle {
|
'groups' => 'Groups'); |
'groups' => 'Groups'); |
} |
} |
|
|
|
sub get_colors { |
|
my ($font,$pgbg,$tabbg); |
|
if ($env{'browser.interface'} eq 'textual') { |
|
$pgbg='#FFFFFF'; |
|
$tabbg='#FFFFFF'; |
|
$font='#000000'; |
|
} else { |
|
my $domain =&Apache::loncommon::determinedomain(); |
|
my $function =&Apache::loncommon::get_users_function(); |
|
|
|
$pgbg =&Apache::loncommon::designparm($function.'.pgbg', $domain); |
|
$tabbg =&Apache::loncommon::designparm($function.'.tabbg',$domain); |
|
$font =&Apache::loncommon::designparm($function.'.font', $domain); |
|
} |
|
return ($font,$pgbg,$tabbg); |
|
} |
# ============================= This gets called at the top of the body section |
# ============================= This gets called at the top of the body section |
|
|
sub menubuttons { |
sub menubuttons { |
my $forcereg=shift; |
my $forcereg=shift; |
my $target =shift; |
|
my $registration=shift; |
my $registration=shift; |
my $titletable=shift; |
my $titletable=shift; |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
Line 107 sub menubuttons {
|
Line 118 sub menubuttons {
|
} |
} |
} |
} |
|
|
|
my ($font,$pgbg,$tabbg) = &get_colors(); |
|
|
if ($env{'browser.interface'} eq 'textual') { |
if ($env{'browser.interface'} eq 'textual') { |
# Textual display only |
# Textual display only |
$pgbg='#FFFFFF'; |
|
$tabbg='#FFFFFF'; |
|
$font='#000000'; |
|
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
$navmaps=(<<ENDNAV); |
$navmaps=(<<ENDNAV); |
<a href="/adm/navmaps?postdata=$escurl&postsymb=$escsymb" target="_top">$lt{'nav'}</a> |
<a href="/adm/navmaps?postdata=$escurl&postsymb=$escsymb" target="_top">$lt{'nav'}</a> |
Line 153 $reloadlink $navmaps $docs $groups
|
Line 163 $reloadlink $navmaps $docs $groups
|
</script> |
</script> |
$form |
$form |
ENDMAINMENU |
ENDMAINMENU |
if ($registration) { $output.=&innerregister($forcereg,$target); } |
if ($registration) { $output.=&innerregister($forcereg); } |
return $output."<hr />"; |
return $output."<hr />"; |
} elsif ($env{'environment.remote'} eq 'off') { |
} elsif ($env{'environment.remote'} eq 'off') { |
# Remote Control is switched off |
# Remote Control is switched off |
# figure out colors |
# figure out colors |
my %lt=&initlittle(); |
my %lt=&initlittle(); |
my $function='student'; |
|
if ($env{'request.role'}=~/^(cc|in|ta|ep)/) { |
|
$function='coordinator'; |
|
} |
|
if ($env{'request.role'}=~/^(su|dc|ad|li)/) { |
|
$function='admin'; |
|
} |
|
if (($env{'request.role'}=~/^(au|ca)/) || |
|
($env{'request.noversionuri'}=~/^(\/priv|\~)/)) { |
|
$function='author'; |
|
} |
|
my $domain=&Apache::loncommon::determinedomain(); |
my $domain=&Apache::loncommon::determinedomain(); |
$pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain); |
my $function =&Apache::loncommon::get_users_function(); |
$tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain); |
|
$font=&Apache::loncommon::designparm($function.'.font',$domain); |
|
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 245 ENDCRELOAD
|
Line 243 ENDCRELOAD
|
} |
} |
my $reg=''; |
my $reg=''; |
if ($registration) { |
if ($registration) { |
$reg=&innerregister($forcereg,$target,$titletable); |
$reg=&innerregister($forcereg,$titletable); |
} |
} |
my $form=&serverform(); |
my $form=&serverform(); |
my $utility=&utilityfunctions(); |
my $utility=&utilityfunctions(); |
Line 279 $groups
|
Line 277 $groups
|
<td bgcolor="$tabbg"> |
<td bgcolor="$tabbg"> |
<img align="right" src="$logo" alt="Logo" /> |
<img align="right" src="$logo" alt="Logo" /> |
<b>LON-CAPA</b></td> |
<b>LON-CAPA</b></td> |
$form |
|
</tr> |
</tr> |
</table> |
</table> |
|
$form |
<script type="text/javascript"> |
<script type="text/javascript"> |
// END LON-CAPA Internal |
// END LON-CAPA Internal |
</script> |
</script> |
Line 295 ENDINLINEMENU
|
Line 293 ENDINLINEMENU
|
# ====================================== This gets called in the header section |
# ====================================== This gets called in the header section |
|
|
sub registerurl { |
sub registerurl { |
my $forcereg=shift; |
my ($forcereg) = @_; |
my $target = shift; |
|
my $result = ''; |
my $result = ''; |
if ($env{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } |
if ($env{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } |
my $force_title=''; |
my $force_title=''; |
if ($env{'request.state'} eq 'construct') { |
if ($env{'request.state'} eq 'construct') { |
$force_title=&Apache::lonxml::display_title(); |
$force_title=&Apache::lonxml::display_title(); |
} |
} |
if ($target eq 'edit') { |
|
$result .="<script type=\"text/javascript\">\n". |
|
"if (typeof swmenu != 'undefined') {swmenu.currentURL=null;}\n". |
|
&Apache::loncommon::browser_and_searcher_javascript(). |
|
"\n</script>\n"; |
|
} |
|
if (($env{'browser.interface'} eq 'textual') || |
if (($env{'browser.interface'} eq 'textual') || |
($env{'environment.remote'} eq 'off') || |
($env{'environment.remote'} eq 'off') || |
((($env{'request.publicaccess'}) || |
((($env{'request.publicaccess'}) || |
Line 319 sub registerurl {
|
Line 310 sub registerurl {
|
'<script type="text/javascript">function LONCAPAreg(){;} function LONCAPAstale(){}</script>'.$force_title; |
'<script type="text/javascript">function LONCAPAreg(){;} function LONCAPAstale(){}</script>'.$force_title; |
} |
} |
# Graphical display after login only |
# Graphical display after login only |
if ($Apache::lonxml::registered && !$forcereg) { return ''; } |
if ($env{'request.registered'} && !$forcereg) { return ''; } |
if ($target ne 'edit') { |
$result.=&innerregister($forcereg); |
$result.=&innerregister($forcereg,$target); |
|
} |
|
return $result.$force_title; |
return $result.$force_title; |
} |
} |
|
|
Line 330 sub registerurl {
|
Line 319 sub registerurl {
|
# =========== and in the body of the document |
# =========== and in the body of the document |
|
|
sub innerregister { |
sub innerregister { |
my $forcereg=shift; |
my ($forcereg, $titletable) = @_; |
my $target = shift; |
|
my $titletable = shift; |
|
my $result = ''; |
my $result = ''; |
my ($uname,$thisdisfn); |
my ($uname,$thisdisfn); |
my $const_space = ($env{'request.state'} eq 'construct'); |
my $const_space = ($env{'request.state'} eq 'construct'); |
Line 340 sub innerregister {
|
Line 327 sub innerregister {
|
|
|
if ($env{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } |
if ($env{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } |
|
|
$Apache::lonxml::registered=1; |
$env{'request.registered'} = 1; |
|
|
my $textinter=($env{'browser.interface'} eq 'textual'); |
my $textinter=($env{'browser.interface'} eq 'textual'); |
my $noremote=($env{'environment.remote'} eq 'off'); |
my $noremote=($env{'environment.remote'} eq 'off'); |
Line 352 sub innerregister {
|
Line 339 sub innerregister {
|
|
|
my $reopen=&Apache::lonmenu::reopenmenu(); |
my $reopen=&Apache::lonmenu::reopenmenu(); |
|
|
|
my ($font,$pgbg,$tabbg) = &get_colors(); |
|
|
my $newmail=''; |
my $newmail=''; |
if ($noremote) { |
if ($noremote) { |
$newmail='<table bgcolor="'.$pgbg.'" border="0" cellspacing="1" cellpadding="1" width="100%"><tr><td bgcolor="'.$tabbg.'"><font face="Arial,Helvetica,sans-serif">'; |
$newmail='<table bgcolor="'.$pgbg.'" border="0" cellspacing="1" cellpadding="1" width="100%"><tr><td bgcolor="'.$tabbg.'"><font face="Arial,Helvetica,sans-serif">'; |
Line 838 sub switch {
|
Line 827 sub switch {
|
$bot=&mt($bot); |
$bot=&mt($bot); |
$desc=&mt($desc); |
$desc=&mt($desc); |
$img=&mt($img); |
$img=&mt($img); |
|
|
|
my ($font,$pgbg,$tabbg) = &get_colors(); |
|
|
unless (($env{'browser.interface'} eq 'textual') || |
unless (($env{'browser.interface'} eq 'textual') || |
($env{'environment.remote'} eq 'off')) { |
($env{'environment.remote'} eq 'off')) { |
# Remote |
# Remote |
Line 1177 function catalog_info() {
|
Line 1169 function catalog_info() {
|
function chat_win() { |
function chat_win() { |
lonchat=window.open('/res/adm/pages/chatroom.html',"LONchat",'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no'); |
lonchat=window.open('/res/adm/pages/chatroom.html',"LONchat",'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no'); |
} |
} |
|
|
|
function group_chat(group) { |
|
var url = '/adm/groupchat?group='+group; |
|
var winName = 'LONchat_'+group; |
|
grpchat=window.open(url,winName,'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no'); |
|
} |
ENDUTILITY |
ENDUTILITY |
} |
} |
|
|
sub serverform { |
sub serverform { |
return(<<ENDSERVERFORM); |
return(<<ENDSERVERFORM); |
<form name="server" action="/adm/logout" method="post" target="_top"> |
<form name="server" action="/adm/logout" method="POST" target="_top"> |
<input type="hidden" name="postdata" value="none" /> |
<input type="hidden" name="postdata" value="none" /> |
<input type="hidden" name="command" value="none" /> |
<input type="hidden" name="command" value="none" /> |
<input type="hidden" name="url" value="none" /> |
<input type="hidden" name="url" value="none" /> |
Line 1193 ENDSERVERFORM
|
Line 1191 ENDSERVERFORM
|
|
|
sub constspaceform { |
sub constspaceform { |
return(<<ENDCONSTSPACEFORM); |
return(<<ENDCONSTSPACEFORM); |
<form name="constspace" action="/adm/logout" method="post" target="_top"> |
<form name="constspace" action="/adm/logout" method="POST" target="_top"> |
<input type="hidden" name="filename" value="" /> |
<input type="hidden" name="filename" value="" /> |
</form> |
</form> |
<form name="cstrdelete" action="/adm/cfile" method="post" target="_top"> |
<form name="cstrdelete" action="/adm/cfile" method="POST" target="_top"> |
<input type="hidden" name="action" value="delete" /> |
<input type="hidden" name="action" value="delete" /> |
<input type="hidden" name="filename" value="" /> |
<input type="hidden" name="filename" value="" /> |
</form> |
</form> |
<form name="cstrprint" action="/adm/printout" target="_parent" method="post"> |
<form name="cstrprint" action="/adm/printout" target="_parent" method="POST"> |
<input type="hidden" name="postdata" value="" /> |
<input type="hidden" name="postdata" value="" /> |
<input type="hidden" name="curseed" value="" /> |
<input type="hidden" name="curseed" value="" /> |
<input type="hidden" name="problemtype" value="" /> |
<input type="hidden" name="problemtype" value="" /> |
Line 1220 sub get_nav_status {
|
Line 1218 sub get_nav_status {
|
return $navstatus; |
return $navstatus; |
} |
} |
|
|
# ================================================ Handler when called directly |
|
|
|
|
|
sub handler { |
|
my $r = shift; |
|
&Apache::loncommon::no_cache($r); |
|
&Apache::loncommon::content_type($r,'text/html'); |
|
$r->send_http_header; |
|
return OK if $r->header_only; |
|
|
|
my $form; |
|
if ($env{'environment.remote'} ne 'off' && |
|
$env{'browser.interface'} ne 'textual') { |
|
$form=&serverform(); |
|
} |
|
my $bodytag=&Apache::loncommon::bodytag('Main Menu'); |
|
my $function='student'; |
|
if ($env{'request.role'}=~/^(cc|in|ta|ep)/) { |
|
$function='coordinator'; |
|
} |
|
if ($env{'request.role'}=~/^(su|dc|ad|li)/) { |
|
$function='admin'; |
|
} |
|
if (($env{'request.role'}=~/^(au|ca)/) || |
|
($env{'request.noversionuri'}=~/^(\/priv|\~)/)) { |
|
$function='author'; |
|
} |
|
my $domain=&Apache::loncommon::determinedomain(); |
|
$pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain); |
|
$tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain); |
|
$font=&Apache::loncommon::designparm($function.'.font',$domain); |
|
my $script_tag; |
|
if ($env{'environment.remote'} ne 'off') { |
|
my $utility=&utilityfunctions('/adm/menu'); |
|
$script_tag=(<<ENDSCRIPT); |
|
<script type="text/javascript"> |
|
$utility |
|
</script> |
|
ENDSCRIPT |
|
} |
|
# ---- Print the screen, pretend to be in text mode to generate text-based menu |
|
unless ($env{'browser.interface'} eq 'textual') { |
|
$env{'browser.interface'}='faketextual'; |
|
$env{'environment.remote'}='off'; |
|
} |
|
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print(<<ENDHEADER); |
|
$html |
|
<head> |
|
<title>LON-CAPA Main Menu</title> |
|
$script_tag |
|
</head> |
|
$bodytag |
|
ENDHEADER |
|
$r->print('<table>'.&inlinemenu().'</table>'.$form); |
|
$r->print('</body></html>'); |
|
return OK; |
|
} |
|
|
|
# ================================================================ Main Program |
# ================================================================ Main Program |
|
|
BEGIN { |
BEGIN { |
if (! defined($readdesk)) { |
if (! defined($readdesk)) { |
{ |
{ |
my $tabfile = $Apache::lonnet::perlvar{'lonTabDir'}.'/mydesk.tab'; |
my $tabfile = $Apache::lonnet::perlvar{'lonTabDir'}.'/mydesk.tab'; |
if ( CORE::open( my $config,"<$tabfile") ) { |
if ( CORE::open( my $config,"<$tabfile") ) { |
while (my $configline=<$config>) { |
while (my $configline=<$config>) { |
$configline=(split(/\#/,$configline))[0]; |
$configline=(split(/\#/,$configline))[0]; |
$configline=~s/^\s+//; |
$configline=~s/^\s+//; |
chomp($configline); |
chomp($configline); |
if ($configline) { |
if ($configline) { |
$desklines[$#desklines+1]=$configline; |
push(@desklines,$configline); |
} |
} |
} |
} |
CORE::close($config); |
CORE::close($config); |
|
} |
|
} |
|
$readdesk='done'; |
} |
} |
} |
|
$readdesk='done'; |
|
} |
|
} |
} |
|
|
1; |
1; |