[LON-CAPA-cvs] cvs: loncom /auth lonlogin.pm /html/adm/lonDomColors annarbor.tab default.tab worf.tab /interface loncommon.pm doc/loncapafiles loncapafiles.lpml

www lon-capa-cvs@mail.lon-capa.org
Wed, 28 Aug 2002 19:42:49 -0000


This is a MIME encoded message

--www1030563769
Content-Type: text/plain

www		Wed Aug 28 15:42:49 2002 EDT

  Added files:                 
    /loncom/html/adm/lonDomColors	annarbor.tab default.tab worf.tab 

  Modified files:              
    /doc/loncapafiles	loncapafiles.lpml 
    /loncom/auth	lonlogin.pm 
    /loncom/interface	loncommon.pm 
  Log:
  To save Guy's eyes - at least in his domain.
  
  Colors and logos can now be configured by domain for the LON-CAPA-header pages 
  and the login screen. 
  
  The configuration tables are in /home/httpd/lonTabs/lonDomColors.
  default.tab has the default definitions. [domainname].tab (if present) can 
  override any of these settings.
  
  
--www1030563769
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20020828154249.txt"

Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.167 doc/loncapafiles/loncapafiles.lpml:1.168
--- doc/loncapafiles/loncapafiles.lpml:1.167	Tue Aug 27 08:48:46 2002
+++ doc/loncapafiles/loncapafiles.lpml	Wed Aug 28 15:42:48 2002
@@ -3,7 +3,7 @@
 <!-- loncapafiles.lpml -->
 <!-- Scott Harrison -->
 
-<!-- $Id: loncapafiles.lpml,v 1.167 2002/08/27 12:48:46 www Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.168 2002/08/28 19:42:48 www Exp $ -->
 
 <!--
 
@@ -522,6 +522,11 @@
   <description>Logos for LON-CAPA domains</description>
 </directory>
 <directory dist='default'>
+  <targetdir dist='default'>home/httpd/lonTabs/lonDomColors</targetdir>
+  <categoryname>server readonly</categoryname>
+  <description>Designs for LON-CAPA domains</description>
+</directory>
+<directory dist='default'>
   <targetdir dist='default'>home/httpd/html/adm/lonInterFace</targetdir>
   <categoryname>server readonly</categoryname>
   <description>Page headers and graphical interface files</description>
@@ -3578,6 +3583,15 @@
 <targetdir dist='default'>home/httpd/html/adm/lonDomLogos/</targetdir>
 <categoryname>graphic file</categoryname>
 <description>Logos of LON-CAPA domains</description>
+<filenames>
+</filenames>
+</fileglob>
+<fileglob>
+<glob>*.tab</glob>
+<sourcedir>loncom/html/adm/lonDomColors/</sourcedir>
+<targetdir dist='default'>home/httpd/lonTabs/lonDomColors/</targetdir>
+<categoryname>conf</categoryname>
+<description>Designs of LON-CAPA domains</description>
 <filenames>
 </filenames>
 </fileglob>
Index: loncom/auth/lonlogin.pm
diff -u loncom/auth/lonlogin.pm:1.20 loncom/auth/lonlogin.pm:1.21
--- loncom/auth/lonlogin.pm:1.20	Mon Aug 26 08:47:28 2002
+++ loncom/auth/lonlogin.pm	Wed Aug 28 15:42:48 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Login Screen
 #
-# $Id: lonlogin.pm,v 1.20 2002/08/26 12:47:28 www Exp $
+# $Id: lonlogin.pm,v 1.21 2002/08/28 19:42:48 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -117,10 +117,23 @@
 	my $jsh=Apache::File->new($include."/londes.js");
         $r->print(<$jsh>);
     }
+
+# ----------------------------------------------------------- Front page design
+    my $pgbg=&Apache::loncommon::designparm('login.pgbg');
+    my $font=&Apache::loncommon::designparm('login.font');
+    my $link=&Apache::loncommon::designparm('login.link');
+    my $vlink=&Apache::loncommon::designparm('login.vlink');
+    my $alink=&Apache::loncommon::designparm('login.alink');
+    my $mainbg=&Apache::loncommon::designparm('login.mainbg');
+    my $sidebg=&Apache::loncommon::designparm('login.sidebg');
+    my $logo=&Apache::loncommon::designparm('login.logo');
+    my $img=&Apache::loncommon::designparm('login.img');
+
+
 # ---------------------------------------------------------- Serve rest of page
     $r->print(<<ENDSCRIPT);
 
-<body bgcolor="#006600" text="#000000" link="#999999" vlink="#999999"
+<body bgcolor="$pgbg" text="$font" link="$link" vlink="$vlink" alink="$alink"
  onLoad="init();" topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>
 
  <script language="JavaScript">
@@ -165,14 +178,14 @@
   <tr>
 
    <!-- Row 1 Columns 2-4 -->
-   <td width="100%" height=75 colspan=4 align="left" valign="top" bgcolor="#006600"><img src="$iconpath/header.gif" border=0 alt="The Learning Online Network with CAPA" /></td>
+   <td width="100%" height=75 colspan=4 align="left" valign="top" bgcolor="#006600"><img src="$img" border=0 alt="The Learning Online Network with CAPA" /></td>
   </tr>
 
   <!-- The gray bar that starts the two table frames -->
   <tr>
 
    <!-- Row 2 Column 1 -->
-   <td width=182 height=27 bgcolor="#cccccc">&nbsp;</td>
+   <td width=182 height=27 bgcolor="$sidebg">&nbsp;</td>
 
    <!-- Row 2 Column 2 -->
    <td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td>
@@ -187,7 +200,7 @@
    
    <!-- A cell that will hold the 'access' and 'about' buttons -->
    <!-- Row 3 Column 1 -->
-   <td valign="top" height=60 align="center" bgcolor="#cccccc">
+   <td valign="top" height=60 align="center" bgcolor="$sidebg">
     <a href="/adm/login?interface=textual"><img src="$iconpath/accessbutton.gif" border=0 alt="Accessibility Options" /></a>
     <br />
     <a href="/adm/about.html"><img src="$iconpath/aboutlon.gif" border=0 alt="About LON-CAPA" /></a>
@@ -199,9 +212,9 @@
 
    <!-- The right main column holding the large LON-CAPA logo-->
    <!-- Rows 3-4 Column 3 -->
-   <td align="center" valign="top" width="100%" height="100%" rowspan=2 bgcolor="#ffffff">
+   <td align="center" valign="top" width="100%" height="100%" rowspan=2 bgcolor="$mainbg">
     <center>
-     <img src="$iconpath/loncapalogo.gif" alt="" />
+     <img src="$logo" alt="" />
     </center>
    </td>
 
@@ -212,7 +225,7 @@
 
    <!-- The entry form -->
    <!-- Row 4 Column 1 -->
-   <td align="center" valign="middle" bgcolor="#cccccc">
+   <td align="center" valign="middle" bgcolor="$sidebg">
 ENDTOP
 }
     $r->print(<<ENDLOGIN);
@@ -222,21 +235,21 @@
 
      <!-- Start the sub-table for text and input alignment -->
      <table border=0 cellspacing=0 cellpadding=0>
-      <tr><td bgcolor="#cccccc" colspan=2><img src="$iconpath/userauthentication.gif" alt="User Authentication" /></td></tr>
+      <tr><td bgcolor="$sidebg" colspan=2><img src="$iconpath/userauthentication.gif" alt="User Authentication" /></td></tr>
       <tr>
-       <td bgcolor="#ffffff"><br /><font size=-1><b>&nbsp;&nbsp;&nbsp;User Name:</b></font></td>
-       <td bgcolor="#ffffff"><br /><input type="text" name="uname" size="10" /></td>
+       <td bgcolor="$mainbg"><br /><font size=-1><b>&nbsp;&nbsp;&nbsp;User Name:</b></font></td>
+       <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" /></td>
       </tr>
       <tr>
-       <td bgcolor="#ffffff"><font size=-1><b>&nbsp;&nbsp;&nbsp;Password:</b></font></td>
-       <td bgcolor="#ffffff"><input type="password" name="upass" size="10" /></td>
+       <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;Password:</b></font></td>
+       <td bgcolor="$mainbg"><input type="password" name="upass" size="10" /></td>
       </tr>
       <tr>
-       <td bgcolor="#ffffff"><font size=-1><b>&nbsp;&nbsp;&nbsp;Domain:</b></font></td>
-       <td bgcolor="#ffffff"><input type="text" name="udom" size="10" value=$domain /></td>
+       <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;Domain:</b></font></td>
+       <td bgcolor="$mainbg"><input type="text" name="udom" size="10" value=$domain /></td>
       </tr>
       <tr>
-       <td bgcolor="#ffffff" valign="bottom" align="center" colspan=2>
+       <td bgcolor="$mainbg" valign="bottom" align="center" colspan=2>
         <br />
         <input type="submit" value="Log In" />
        </td>
@@ -258,30 +271,30 @@
   <tr>
 
    <!-- Row 5 Column 1 -->
-   <td bgcolor="#cccccc" valign="middle" align="left">
+   <td bgcolor="$sidebg" valign="middle" align="left">
      <br />
      <table border=0 cellspacing=0 cellpadding=0>
       <tr>
-       <td bgcolor="#cccccc" align="left" valign="top">
+       <td bgcolor="$sidebg" align="left" valign="top">
         <small><b>&nbsp;&nbsp;&nbsp;Domain:&nbsp;</b></small>
        </td>
-       <td bgcolor="#cccccc" align="left" valign="top">
+       <td bgcolor="$sidebg" align="left" valign="top">
         <small><tt>&nbsp;$domain</tt></small>
        </td>
       </tr>
       <tr>
-       <td bgcolor="#cccccc" align="left" valign="top">
+       <td bgcolor="$sidebg" align="left" valign="top">
         <small><b>&nbsp;&nbsp;&nbsp;Server:&nbsp;</b></small>
        </td>
-       <td bgcolor="#cccccc" align="left" valign="top">
+       <td bgcolor="$sidebg" align="left" valign="top">
         <small><tt>&nbsp;$lonhost ($role)</tt></small>
        </td>
       </tr>
       <tr>
-       <td bgcolor="#cccccc" align="left" valign="top">
+       <td bgcolor="$sidebg" align="left" valign="top">
         <small><b>&nbsp;&nbsp;&nbsp;Load:&nbsp;</b></small>
        </td>
-       <td bgcolor="#cccccc" align="left" valign="top">
+       <td bgcolor="$sidebg" align="left" valign="top">
         <small><tt>&nbsp;$loadpercent percent</tt></small>
        </td>
       </tr>
@@ -299,7 +312,7 @@
    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
 
    <!-- Row 5 Column 3 -->
-   <td width="100%" valign="bottom" bgcolor="#ffffff">
+   <td width="100%" valign="bottom" bgcolor="$mainbg">
 $domainlogo
 </td>
 
@@ -309,7 +322,7 @@
   <tr>
 
    <!-- Row 6 Column 1 -->
-   <td bgcolor="#cccccc">&nbsp;</td>
+   <td bgcolor="$sidebg">&nbsp;</td>
 
    <!-- Row 6 Column 2 -->
    <td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td>
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.62 loncom/interface/loncommon.pm:1.63
--- loncom/interface/loncommon.pm:1.62	Wed Aug 28 10:11:27 2002
+++ loncom/interface/loncommon.pm	Wed Aug 28 15:42:49 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.62 2002/08/28 14:11:27 www Exp $
+# $Id: loncommon.pm,v 1.63 2002/08/28 19:42:49 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -98,6 +98,10 @@
 my %fe; my %fd;
 my %category_extensions;
 
+# ---------------------------------------------- Designs
+
+my %designhash;
+
 # ---------------------------------------------- Thesaurus variables
 
 =pod
@@ -166,6 +170,30 @@
 	    }
 	}
     }
+
+# -------------------------------------------------------------- domain designs
+
+    my $filename;
+    my $designdir=$Apache::lonnet::perlvar{'lonTabDir'}.'/lonDomColors';
+    opendir(DIR,$designdir);
+    while ($filename=readdir(DIR)) {
+	my ($domain)=($filename=~/^(\w+)\./);
+    {
+	my $fh=Apache::File->new($designdir.'/'.$filename);
+	if ($fh) {
+	    while (<$fh>) {
+		next if /^\#/;
+		chomp;
+		my ($key,$val)=(split(/\=/,$_));
+		if ($val) { $designhash{$domain.'.'.$key}=$val; }
+	    }
+	}
+    }
+
+    }
+    closedir(DIR);
+
+
 # ------------------------------------------------------------- file categories
     {
 	my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
@@ -1197,20 +1225,18 @@
 
 =pod
 
-=item &domainlogo()
+=item &determinedomain()
 
 Inputs: $domain (usually will be undef)
 
-Returns: A link to a domain logo, if the domain logo exists.
-If the domain logo does not exist, a description of the domain.
+Returns: Determines which domain should be used for designs
 
 =cut
 
 ###############################################
-###############################################
-sub domainlogo {
-    my ($domain) = @_;    
-    if (! $domain) {
+sub determinedomain {
+    my $domain=shift;
+   if (! $domain) {
         # Determine domain if we have not been given one
         $domain = $Apache::lonnet::perlvar{'lonDefDomain'};
         if ($ENV{'user.domain'}) { $domain=$ENV{'user.domain'}; }
@@ -1218,7 +1244,23 @@
             $domain=$ENV{'request.role.domain'}; 
         }
     }
-    # See if there is a logo
+    return $domain;
+}
+###############################################
+=pod
+
+=item &domainlogo()
+
+Inputs: $domain (usually will be undef)
+
+Returns: A link to a domain logo, if the domain logo exists.
+If the domain logo does not exist, a description of the domain.
+
+=cut
+###############################################
+sub domainlogo {
+    my $domain = &determinedomain(shift);    
+     # See if there is a logo
     if (-e '/home/httpd/html/adm/lonDomLogos/'.$domain.'.gif') {
         return '<img src="/adm/lonDomLogos/'.$domain.'.gif" />';
     } elsif(exists($Apache::lonnet::domaindescription{$domain})) {
@@ -1227,6 +1269,27 @@
         return '';
     }
 }
+##############################################
+
+=pod
+
+=item &designparm()
+
+Inputs: $which parameter; $domain (usually will be undef)
+
+Returns: value of designparamter $which
+
+=cut
+##############################################
+sub designparm {
+    my ($which,$domain)=@_;
+    $domain=&determinedomain($domain);
+    if ($designhash{$domain.'.'.$which}) {
+	return $designhash{$domain.'.'.$which};
+    } else {
+        return $designhash{'default.'.$which};
+    }
+}
 
 ###############################################
 ###############################################
@@ -1253,6 +1316,8 @@
 =cut
 
 ###############################################
+
+
 ###############################################
 sub bodytag {
     my ($title,$function,$addentries,$bodyonly,$domain)=@_;
@@ -1269,43 +1334,16 @@
             $function='author';
         }
     }
-    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='#000044';
-        $link='#003333';
-        $vlink='#006633';
-   } elsif ($function eq 'author') {
-        $img='author';
-        $pgbg='#CCFFFF';
-        $tabbg='#CCFFCC';
-        $font='#004400';
-        $link='#003333';
-        $vlink='#006666';
-    } else {
-        $img='student';
-        $pgbg='#FFFFAA';
-        $tabbg='#FF9900';
-        $font='#991100';
-        $link='#993300';
-        $vlink='#996600';
-    }
-# role and realm
+    my $img=&designparm($function.'.img',$domain);
+    my $pgbg=&designparm($function.'.pgbg',$domain);
+    my $tabbg=&designparm($function.'.tabbg',$domain);
+    my $font=&designparm($function.'.font',$domain);
+    my $link=&designparm($function.'.link',$domain);
+    my $alink=&designparm($function.'.alink',$domain);
+    my $vlink=&designparm($function.'.vlink',$domain);
+    my $sidebg=&designparm($function.'.sidebg',$domain);
+
+ # role and realm
     my ($role,$realm)
        =&Apache::lonnet::plaintext((split(/\./,$ENV{'request.role'}))[0]);
 # realm
@@ -1328,8 +1366,8 @@
 $bodytag
 <table width="100%" cellspacing="0" border="0" cellpadding="0">
 <tr><td bgcolor="$font">
-<img src="/adm/lonInterFace/$img.jpg" /></td>
-<td bgcolor="$font"><font color='$pgbg'>$messages</font></td>
+<img src="$img" /></td>
+<td bgcolor="$font"><font color='$sidebg'>$messages</font></td>
 </tr>
 <tr>
 <td rowspan="3" bgcolor="$tabbg">

Index: loncom/html/adm/lonDomColors/annarbor.tab
+++ loncom/html/adm/lonDomColors/annarbor.tab
admin.pgbg=#FFFFFF
admin.font=#000000
coordinator.pgbg=#FFFFFF
coordinator.font=#000000
author.pgbg=#FFFFFF
author.font=#000000
student.pgbg=#FFFFFF
student.font=#000000

Index: loncom/html/adm/lonDomColors/default.tab
+++ loncom/html/adm/lonDomColors/default.tab
login.img=/adm/lonIcons/header.gif
login.logo=/adm/lonIcons/loncapalogo.gif
login.pgbg=#006600
login.mainbg=#FFFFFF
login.sidebg=#CCCCCC
login.link=#999999
login.vlink=#999999
login.alink=#CC0000
login.font=#000000
admin.img=/adm/lonInterFace/admin.jpg
admin.pgbg=#FFFFCC
admin.tabbg=#CCCC99
admin.font=#772200
admin.sidebg=#772200
admin.link=#663300
admim.vlink=#666600
admin.alink=#CC0000
coordinator.img=/adm/lonInterFace/coordinator.jpg
coordinator.pgbg=#CCFFFF
coordinator.tabbg=#CCCCFF
coordinator.font=#000044
coordinator.sidebg=#000044
coordinator.link=#003333
coordinator.vlink=#006633
coordinator.alink=#CC0000
author.img=/adm/lonInterFace/author.jpg
author.pgbg=#CCFFFF
author.tabbg=#CCFFCC
author.font=#004400
author.sidebg=#004400
author.link=#003333
author.vlink=#006666
author.alink=#CC0000
student.img=/adm/lonInterFace/student.jpg
student.pgbg=#FFFFCC
student.tabbg=#FF9900
student.font=#991100
student.sidebg=#991100
student.link=#993300
student.vlink=#996600
student.alink=#CC0000

Index: loncom/html/adm/lonDomColors/worf.tab
+++ loncom/html/adm/lonDomColors/worf.tab
login.sidebg=#AACCAA
login.link=#005500
login.vlink=#006600
login.font=#004400

--www1030563769--