--- loncom/interface/loncommon.pm 2007/03/20 15:36:14 1.516
+++ loncom/interface/loncommon.pm 2007/04/03 18:47:23 1.517
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.516 2007/03/20 15:36:14 albertel Exp $
+# $Id: loncommon.pm,v 1.517 2007/04/03 18:47:23 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -68,8 +68,12 @@ use Apache::lontexconvert();
use Apache::lonclonecourse();
use LONCAPA qw(:DEFAULT :match);
+# ---------------------------------------------- Designs
+use vars qw(%defaultdesign);
+
my $readit;
+
##
## Global Variables
##
@@ -82,10 +86,6 @@ my %scprtag;
my %fe; my %fd; my %fm;
my %category_extensions;
-# ---------------------------------------------- Designs
-
-my %designhash;
-
# ---------------------------------------------- Thesaurus variables
#
# %Keywords:
@@ -151,30 +151,18 @@ BEGIN {
}
}
-# -------------------------------------------------------------- domain designs
-
- my $filename;
+# -------------------------------------------------------------- default domain designs
my $designdir=$Apache::lonnet::perlvar{'lonTabDir'}.'/lonDomColors';
- opendir(DIR,$designdir);
- while ($filename=readdir(DIR)) {
- if ($filename!~/\.tab$/) { next; }
- my ($domain)=($filename=~/^($match_domain)\./);
- {
- my $designfile = $designdir.'/'.$filename;
- if ( open (my $fh,"<$designfile") ) {
- while (my $line = <$fh>) {
- next if ($line =~ /^\#/);
- chomp($line);
- my ($key,$val)=(split(/\=/,$line));
- if ($val) { $designhash{$domain.'.'.$key}=$val; }
- }
- close($fh);
- }
- }
-
+ my $designfile = $designdir.'/default.tab';
+ if ( open (my $fh,"<$designfile") ) {
+ while (my $line = <$fh>) {
+ next if ($line =~ /^\#/);
+ chomp($line);
+ my ($key,$val)=(split(/\=/,$line));
+ if ($val) { $defaultdesign{$key}=$val; }
+ }
+ close($fh);
}
- closedir(DIR);
-
# ------------------------------------------------------------- file categories
{
@@ -3184,6 +3172,7 @@ sub determinedomain {
return $domain;
}
###############################################
+
=pod
=item * &domainlogo()
@@ -3197,11 +3186,12 @@ If the domain logo does not exist, a des
###############################################
sub domainlogo {
- my $domain = &determinedomain(shift);
- # See if there is a logo
- if (-e '/home/httpd/html/adm/lonDomLogos/'.$domain.'.gif') {
- my $logo=&lonhttpdurl("/adm/lonDomLogos/$domain.gif");
- return '';
+ my $domain = &determinedomain(shift);
+ my %designhash = &Apache::lonnet::get_domainconf($domain);
+ # See if there is a logo
+ if ($designhash{$domain.'.login.domlogo'} ne '') {
+ return '';
} elsif (defined(&Apache::lonnet::domain($domain,'description'))) {
return &Apache::lonnet::domain($domain,'description');
} else {
@@ -3239,10 +3229,11 @@ sub designparm {
return $env{'environment.color.'.$which};
}
$domain=&determinedomain($domain);
- if (exists($designhash{$domain.'.'.$which})) {
- return $designhash{$domain.'.'.$which};
+ my %domdesign = &Apache::lonnet::get_domainconf($domain);
+ if ($domdesign{$domain.'.'.$which} ne '') {
+ return $domdesign{$domain.'.'.$which};
} else {
- return $designhash{'default.'.$which};
+ return $defaultdesign{$which};
}
}
@@ -3462,8 +3453,11 @@ ENDROLE
# Top frame rendering, Remote is up
#
- my $upperleft='';
+ my $imgsrc = $img;
+ if ($img =~ /^\/adm/) {
+ $imgsrc = 'http://'.$ENV{'HTTP_HOST'}.':'.$lonhttpdPort.$img;
+ }
+ my $upperleft='';
# Explicit link to get inline menu
my $menu= ($no_inline_link?''