Diff for /loncom/interface/loncommon.pm between versions 1.62 and 1.63

version 1.62, 2002/08/28 14:11:27 version 1.63, 2002/08/28 19:42:49
Line 98  my %cprtag; Line 98  my %cprtag;
 my %fe; my %fd;  my %fe; my %fd;
 my %category_extensions;  my %category_extensions;
   
   # ---------------------------------------------- Designs
   
   my %designhash;
   
 # ---------------------------------------------- Thesaurus variables  # ---------------------------------------------- Thesaurus variables
   
 =pod  =pod
Line 166  BEGIN { Line 170  BEGIN {
     }      }
  }   }
     }      }
   
   # -------------------------------------------------------------- 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  # ------------------------------------------------------------- file categories
     {      {
  my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.   my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
Line 1197  sub findallcourses { Line 1225  sub findallcourses {
   
 =pod  =pod
   
 =item &domainlogo()  =item &determinedomain()
   
 Inputs: $domain (usually will be undef)  Inputs: $domain (usually will be undef)
   
 Returns: A link to a domain logo, if the domain logo exists.  Returns: Determines which domain should be used for designs
 If the domain logo does not exist, a description of the domain.  
   
 =cut  =cut
   
 ###############################################  ###############################################
 ###############################################  sub determinedomain {
 sub domainlogo {      my $domain=shift;
     my ($domain) = @_;         if (! $domain) {
     if (! $domain) {  
         # Determine domain if we have not been given one          # Determine domain if we have not been given one
         $domain = $Apache::lonnet::perlvar{'lonDefDomain'};          $domain = $Apache::lonnet::perlvar{'lonDefDomain'};
         if ($ENV{'user.domain'}) { $domain=$ENV{'user.domain'}; }          if ($ENV{'user.domain'}) { $domain=$ENV{'user.domain'}; }
Line 1218  sub domainlogo { Line 1244  sub domainlogo {
             $domain=$ENV{'request.role.domain'};               $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') {      if (-e '/home/httpd/html/adm/lonDomLogos/'.$domain.'.gif') {
         return '<img src="/adm/lonDomLogos/'.$domain.'.gif" />';          return '<img src="/adm/lonDomLogos/'.$domain.'.gif" />';
     } elsif(exists($Apache::lonnet::domaindescription{$domain})) {      } elsif(exists($Apache::lonnet::domaindescription{$domain})) {
Line 1227  sub domainlogo { Line 1269  sub domainlogo {
         return '';          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};
       }
   }
   
 ###############################################  ###############################################
 ###############################################  ###############################################
Line 1253  other decorations will be returned. Line 1316  other decorations will be returned.
 =cut  =cut
   
 ###############################################  ###############################################
   
   
 ###############################################  ###############################################
 sub bodytag {  sub bodytag {
     my ($title,$function,$addentries,$bodyonly,$domain)=@_;      my ($title,$function,$addentries,$bodyonly,$domain)=@_;
Line 1269  sub bodytag { Line 1334  sub bodytag {
             $function='author';              $function='author';
         }          }
     }      }
     my $img='';      my $img=&designparm($function.'.img',$domain);
     my $pgbg='';      my $pgbg=&designparm($function.'.pgbg',$domain);
     my $tabbg='';      my $tabbg=&designparm($function.'.tabbg',$domain);
     my $font='';      my $font=&designparm($function.'.font',$domain);
     my $link='';      my $link=&designparm($function.'.link',$domain);
     my $alink='#CC0000';      my $alink=&designparm($function.'.alink',$domain);
     my $vlink='';      my $vlink=&designparm($function.'.vlink',$domain);
     if ($function eq 'admin') {      my $sidebg=&designparm($function.'.sidebg',$domain);
         $img='admin';  
         $pgbg='#FFFFCC';   # role and realm
         $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 ($role,$realm)      my ($role,$realm)
        =&Apache::lonnet::plaintext((split(/\./,$ENV{'request.role'}))[0]);         =&Apache::lonnet::plaintext((split(/\./,$ENV{'request.role'}))[0]);
 # realm  # realm
Line 1328  END Line 1366  END
 $bodytag  $bodytag
 <table width="100%" cellspacing="0" border="0" cellpadding="0">  <table width="100%" cellspacing="0" border="0" cellpadding="0">
 <tr><td bgcolor="$font">  <tr><td bgcolor="$font">
 <img src="/adm/lonInterFace/$img.jpg" /></td>  <img src="$img" /></td>
 <td bgcolor="$font"><font color='$pgbg'>$messages</font></td>  <td bgcolor="$font"><font color='$sidebg'>$messages</font></td>
 </tr>  </tr>
 <tr>  <tr>
 <td rowspan="3" bgcolor="$tabbg">  <td rowspan="3" bgcolor="$tabbg">

Removed from v.1.62  
changed lines
  Added in v.1.63


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>