[LON-CAPA-cvs] cvs: loncom /interface lonmainmenu.pm lonmenu.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 10 Apr 2006 18:49:57 -0000


albertel		Mon Apr 10 14:49:57 2006 EDT

  Modified files:              
    /loncom/interface	lonmainmenu.pm lonmenu.pm 
  Log:
  - eliminating the font/pgbg/tabbg globals
  
  
Index: loncom/interface/lonmainmenu.pm
diff -u loncom/interface/lonmainmenu.pm:1.2 loncom/interface/lonmainmenu.pm:1.3
--- loncom/interface/lonmainmenu.pm:1.2	Mon Apr 10 14:35:04 2006
+++ loncom/interface/lonmainmenu.pm	Mon Apr 10 14:49:56 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # displays the main menu
 #
-# $Id: lonmainmenu.pm,v 1.2 2006/04/10 18:35:04 albertel Exp $
+# $Id: lonmainmenu.pm,v 1.3 2006/04/10 18:49:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -56,23 +56,7 @@
 	$env{'browser.interface'} ne 'textual') {
 	$form=&Apache::lonmenu::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();
-    # FIXME these don't have the effect on the vars in lonmenu
-    # that they used to have
-    my $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain);
-    my $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain);
-    my $font=&Apache::loncommon::designparm($function.'.font',$domain);
+
     my $script_tag;
     if ($env{'environment.remote'} ne 'off') {
         my $utility=&Apache::lonmenu::utilityfunctions('/adm/menu');
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.171 loncom/interface/lonmenu.pm:1.172
--- loncom/interface/lonmenu.pm:1.171	Fri Apr  7 18:28:40 2006
+++ loncom/interface/lonmenu.pm	Mon Apr 10 14:49:56 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.171 2006/04/07 22:28:40 albertel Exp $
+# $Id: lonmenu.pm,v 1.172 2006/04/10 18:49:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -49,9 +49,6 @@
 
 
 my @inlineremote;
-my $font;
-my $tabbg;
-my $pgbg;
 
 # ================================================================ Little texts
 
@@ -67,6 +64,22 @@
                                        '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 {
@@ -106,11 +119,10 @@
         }
     }
 
+    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=(<<ENDNAV);
 <a href="/adm/navmaps?postdata=$escurl&postsymb=$escsymb" target="_top">$lt{'nav'}</a>
@@ -158,21 +170,9 @@
 # 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);
@@ -329,9 +329,7 @@
 # =========== 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');
@@ -351,6 +349,8 @@
 
     my $reopen=&Apache::lonmenu::reopenmenu();
 
+    my ($font,$pgbg,$tabbg) = &get_colors();
+
     my $newmail='';
     if ($noremote) {
 	$newmail='<table bgcolor="'.$pgbg.'" border="0" cellspacing="1" cellpadding="1" width="100%"><tr><td bgcolor="'.$tabbg.'"><font face="Arial,Helvetica,sans-serif">';
@@ -837,6 +837,9 @@
     $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