[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lontest.pm

www lon-capa-cvs@mail.lon-capa.org
Tue, 20 Aug 2002 21:29:34 -0000


www		Tue Aug 20 17:29:34 2002 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lontest.pm 
  Log:
  New header routines in the making
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.53 loncom/interface/loncommon.pm:1.54
--- loncom/interface/loncommon.pm:1.53	Mon Aug 12 14:21:42 2002
+++ loncom/interface/loncommon.pm	Tue Aug 20 17:29:34 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.53 2002/08/12 18:21:42 albertel Exp $
+# $Id: loncommon.pm,v 1.54 2002/08/20 21:29:34 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1192,6 +1192,74 @@
     return keys %courses;
 }
 
+###############################################
+
+sub bodytag {
+    my ($function,$title,$addentries)=@_;
+    my $img='';
+    my $pgbg='';
+    my $tabbg='';
+    my $font='';
+    my $link='';
+    my $alink='#CC0000';
+    my $vlink='';
+    if ($function eq 'admin') {
+        $img='admin';
+        $pgbg='#FFFFCC';
+        $tabbg='#CCCC99';
+        $font='#772200';
+        $link='#663300';
+        $vlink='#666600';
+    } elsif ($function eq 'coordinator') {
+        $img='coordinator';
+        $pgbg='#CCFFFF';
+        $tabbg='#CCCCFF';
+        $font='#000033';
+        $link='#003333';
+        $vlink='#006633';
+   } elsif ($function eq 'author') {
+        $img='author';
+        $pgbg='#CCFFFF';
+        $tabbg='#CCFFCC';
+        $font='#003300';
+        $link='#003333';
+        $vlink='#006666';
+    } else {
+        $img='student';
+        $pgbg='#FFFF99';
+        $tabbg='#FF9900';
+        $font='#991100';
+        $link='#993300';
+        $vlink='#996600';
+    }
+    my $role=&Apache::lonnet::plaintext((split(/\./,$ENV{'request.role'}))[0]);
+    if ($ENV{'request.course.id'}) {
+	$role.='<br>'.$ENV{'course.'.$ENV{'request.course.id'}.'.description'};
+    }
+    return(<<ENDBODY);
+<body bgcolor="$pgbg" text="$font" alink="$alink" vlink="$vlink" link="$link"
+$addentries>
+<table cellspacing="0" border="0" cellpadding="2">
+<tr><td colspan="2" bgcolor="$tabbg">
+<img src="/adm/lonInterFace/$img.jpg" /></td></tr>
+<tr>
+<td rowspan="2" bgcolor="$tabbg">
+<font size="5"><b>$title</b></font>
+<td bgcolor="$tabbg"  align="right">
+<font size="2">
+    $ENV{'environment.firstname'}
+    $ENV{'environment.middlename'}
+    $ENV{'environment.lastname'}
+    $ENV{'environment.generation'}
+</font>
+</td>
+</tr>
+<tr><td bgcolor="$tabbg" align="right">
+<font size="2">$role</font>
+</td></tr>
+</table><br>
+ENDBODY
+}
 ###############################################
 
 sub get_unprocessed_cgi {
Index: loncom/interface/lontest.pm
diff -u loncom/interface/lontest.pm:1.6 loncom/interface/lontest.pm:1.7
--- loncom/interface/lontest.pm:1.6	Mon Aug 12 14:21:42 2002
+++ loncom/interface/lontest.pm	Tue Aug 20 17:29:34 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # A debugging harness.
 #
-# $Id: lontest.pm,v 1.6 2002/08/12 18:21:42 albertel Exp $
+# $Id: lontest.pm,v 1.7 2002/08/20 21:29:34 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -32,6 +32,7 @@
 use strict;
 use Apache::Constants qw(:common :http);
 use GDBM_File;
+use Apache::loncommon;
 
 # section takes one env var name as input, and returns
 # what section the given env var is in, which is the part
@@ -51,8 +52,9 @@
      $r->send_http_header;
      return OK if $r->header_only;
 
-     $r->print('<html><body>');
-
+     my $bodytag=&Apache::loncommon::bodytag("admin","List Environment");
+     $r->print('<html>'.$bodytag);
+     
      my $envkey;
  
      $->print("<hr><h1>Debugging</h1><hr>\n");