--- loncom/interface/lonmenu.pm 2006/03/29 20:07:00 1.169 +++ loncom/interface/lonmenu.pm 2006/04/10 18:49:56 1.172 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.169 2006/03/29 20:07:00 raeburn Exp $ +# $Id: lonmenu.pm,v 1.172 2006/04/10 18:49:56 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -40,7 +40,6 @@ package Apache::lonmenu; use strict; use Apache::lonnet; -use Apache::Constants qw(:common); use Apache::lonhtmlcommon(); use Apache::loncommon(); use Apache::lonenc(); @@ -50,9 +49,6 @@ use vars qw(@desklines $readdesk); my @inlineremote; -my $font; -my $tabbg; -my $pgbg; # ================================================================ Little texts @@ -68,6 +64,22 @@ sub initlittle { '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 sub menubuttons { @@ -107,11 +119,10 @@ sub menubuttons { } } + my ($font,$pgbg,$tabbg) = &get_colors(); + if ($env{'browser.interface'} eq 'textual') { # Textual display only - $pgbg='#FFFFFF'; - $tabbg='#FFFFFF'; - $font='#000000'; if ($env{'request.course.id'}) { $navmaps=(<$lt{'nav'} @@ -159,21 +170,9 @@ ENDMAINMENU # Remote Control is switched off # figure out colors 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(); - $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain); - $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain); - $font=&Apache::loncommon::designparm($function.'.font',$domain); + my $function =&Apache::loncommon::get_users_function(); my $link=&Apache::loncommon::designparm($function.'.link',$domain); my $alink=&Apache::loncommon::designparm($function.'.alink',$domain); my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain); @@ -330,9 +329,7 @@ sub registerurl { # =========== and in the body of the document sub innerregister { - my $forcereg=shift; - my $target = shift; - my $titletable = shift; + my ($forcereg, $target, $titletable) = @_; my $result = ''; my ($uname,$thisdisfn); my $const_space = ($env{'request.state'} eq 'construct'); @@ -352,6 +349,8 @@ sub innerregister { my $reopen=&Apache::lonmenu::reopenmenu(); + my ($font,$pgbg,$tabbg) = &get_colors(); + my $newmail=''; if ($noremote) { $newmail='
'; @@ -838,6 +837,9 @@ sub switch { $bot=&mt($bot); $desc=&mt($desc); $img=&mt($img); + + my ($font,$pgbg,$tabbg) = &get_colors(); + unless (($env{'browser.interface'} eq 'textual') || ($env{'environment.remote'} eq 'off')) { # Remote @@ -1188,7 +1190,7 @@ ENDUTILITY sub serverform { return(< +
@@ -1199,14 +1201,14 @@ ENDSERVERFORM sub constspaceform { return(< + -
+
-
+ @@ -1226,56 +1228,6 @@ sub get_nav_status { 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 $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=(< -$utility - -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'; - } - $r->print(&Apache::loncommon::start_page('Main Menu',$script_tag)); - $r->print(''.&inlinemenu().'
'.$form); - $r->print(&Apache::loncommon::end_page()); - return OK; -} - # ================================================================ Main Program BEGIN {