Diff for /loncom/interface/loncommon.pm between versions 1.517 and 1.518

version 1.517, 2007/04/03 18:47:23 version 1.518, 2007/04/04 00:10:01
Line 3173  sub determinedomain { Line 3173  sub determinedomain {
 }  }
 ###############################################  ###############################################
   
   sub devalidate_domconfig_cache {
       my ($udom)=@_;
       &Apache::lonnet::devalidate_cache_new('domainconfig',$udom);
   }
   
   # ---------------------- Get domain configuration for a domain
   sub get_domainconf {
       my ($udom) = @_;
       my $cachetime=1800;
       my ($result,$cached)=&Apache::lonnet::is_cached_new('domainconfig',$udom);
       if (defined($cached)) { return %{$result}; }
   
       my %domconfig = &Apache::lonnet::get_dom('configuration',
        ['login','rolecolors'],$udom);
       my %designhash;
       if (keys(%domconfig) > 0) {
           if (ref($domconfig{'login'}) eq 'HASH') {
               foreach my $key (keys(%{$domconfig{'login'}})) {
                   $designhash{$udom.'.login.'.$key}=$domconfig{'login'}{$key};
               }
           }
           if (ref($domconfig{'rolecolors'}) eq 'HASH') {
               foreach my $role (keys(%{$domconfig{'rolecolors'}})) {
                   if (ref($domconfig{'rolecolors'}{$role}) eq 'HASH') {
                       foreach my $item (keys(%{$domconfig{'rolecolors'}{$role}})) {
                           $designhash{$udom.'.'.$role.'.'.$item}=$domconfig{'rolecolors'}{$role}{$item};
                       }
                   }
               }
           }
       } else {
           my $designdir=$Apache::lonnet::perlvar{'lonTabDir'}.'/lonDomColors';
           my $designfile =  $designdir.'/'.$udom.'.tab';
           if (-e $designfile) {
               if ( open (my $fh,"<$designfile") ) {
                   while (my $line = <$fh>) {
                       next if ($line =~ /^\#/);
                       chomp($line);
                       my ($key,$val)=(split(/\=/,$line));
                       if ($val) { $designhash{$udom.'.'.$key}=$val; }
                   }
                   close($fh);
               }
           }
           if (-e '/home/httpd/html/adm/lonDomLogos/'.$udom.'.gif') {
               $designhash{$udom.'.login.domlogo'} = 
                   &lonhttpdurl("/adm/lonDomLogos/$udom.gif"); 
           }
       }
       &Apache::lonnet::do_cache_new('domainconfig',$udom,\%designhash,
     $cachetime);
       return %designhash;
   }
   
 =pod  =pod
   
 =item * &domainlogo()  =item * &domainlogo()
Line 3187  If the domain logo does not exist, a des Line 3241  If the domain logo does not exist, a des
 ###############################################  ###############################################
 sub domainlogo {  sub domainlogo {
     my $domain = &determinedomain(shift);      my $domain = &determinedomain(shift);
     my %designhash = &Apache::lonnet::get_domainconf($domain);          my %designhash = &get_domainconf($domain);    
     # See if there is a logo      # See if there is a logo
     if ($designhash{$domain.'.login.domlogo'} ne '') {      if ($designhash{$domain.'.login.domlogo'} ne '') {
         return '<img src="'.$designhash{$domain.'.login.domlogo'}.          return '<img src="'.$designhash{$domain.'.login.domlogo'}.
Line 3229  sub designparm { Line 3283  sub designparm {
  return $env{'environment.color.'.$which};   return $env{'environment.color.'.$which};
     }      }
     $domain=&determinedomain($domain);      $domain=&determinedomain($domain);
     my %domdesign = &Apache::lonnet::get_domainconf($domain);      my %domdesign = &get_domainconf($domain);
     if ($domdesign{$domain.'.'.$which} ne '') {      if ($domdesign{$domain.'.'.$which} ne '') {
  return $domdesign{$domain.'.'.$which};   return $domdesign{$domain.'.'.$which};
     } else {      } else {

Removed from v.1.517  
changed lines
  Added in v.1.518


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