--- loncom/interface/loncommon.pm 2002/08/26 12:47:28 1.59 +++ loncom/interface/loncommon.pm 2002/08/26 14:32:29 1.60 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.59 2002/08/26 12:47:28 www Exp $ +# $Id: loncommon.pm,v 1.60 2002/08/26 14:32:29 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1148,22 +1148,69 @@ sub findallcourses { } ############################################### +############################################### + +=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 { -# Determine domain - my $domain=$Apache::lonnet::perlvar{'lonDefDomain'}; - if ($ENV{'user.domain'}) { $domain=$ENV{'user.domain'}; } - if ($ENV{'request.role.domain'}) { $domain=$ENV{'request.role.domain'}; } -# See if there is a logo + my ($domain) = @_; + if (! $domain) { + # Determine domain if we have not been given one + $domain = $Apache::lonnet::perlvar{'lonDefDomain'}; + if ($ENV{'user.domain'}) { $domain=$ENV{'user.domain'}; } + if ($ENV{'request.role.domain'}) { + $domain=$ENV{'request.role.domain'}; + } + } + # See if there is a logo if (-e '/home/httpd/html/adm/lonDomLogos/'.$domain.'.gif') { - return ''; - } else { + return ''; + } elsif(exists($Apache::lonnet::domaindescription{$domain})) { return $Apache::lonnet::domaindescription{$domain}; + } else { + return ''; } } +############################################### +############################################### + +=pod + +=item &bodytag() + +Returns a uniform header for LON-CAPA web pages. + +Inputs: + + $title, A title to be displayed on the page. + $function, the current role (can be undef). + $addentries, extra parameters for the tag. + $bodyonly, if defined, only return the tag. + $domain, if defined, force a given domain. + +Returns: A uniform header for LON-CAPA web pages. +If $bodyonly is nonzero, a string containing a tag will be returned. +If $bodyonly is undef or zero, an html string containing a tag and +other decorations will be returned. + +=cut + +############################################### +############################################### sub bodytag { - my ($title,$function,$addentries)=@_; + my ($title,$function,$addentries,$bodyonly,$domain)=@_; unless ($function) { $function='student'; if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) { @@ -1223,11 +1270,17 @@ sub bodytag { } unless ($realm) { $realm=' '; } # Set messages - my $messages=&domainlogo(); + my $messages=&domainlogo($domain); # Output - return(< +END + if ($bodyonly) { + return $bodytag; + } else { + return(< @@ -1252,6 +1305,7 @@ $addentries> $realm 
ENDBODY + } } ###############################################