--- loncom/interface/loncommon.pm 2002/08/22 21:05:25 1.58
+++ loncom/interface/loncommon.pm 2002/08/27 16:49:20 1.61
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.58 2002/08/22 21:05:25 albertel Exp $
+# $Id: loncommon.pm,v 1.61 2002/08/27 16:49:20 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -932,6 +932,26 @@ sub get_related_words {
## End Thesaurus Functions ##
###############################################################
+# -------------------------------------------------------------- Plaintext name
+
+sub plainname {
+ my ($uname,$udom)=@_;
+ my %names=&Apache::lonnet::get('environment',
+ ['firstname','middlename','lastname','generation'],
+ $udom,$uname);
+ return $names{'firstname'}.' '.$names{'middlename'}.' '.
+ $names{'lastname'}.' '.$names{'generation'};
+}
+
+# ------------------------------------------------------------------ Screenname
+
+sub screenname {
+ my ($uname,$udom)=@_;
+ my %names=
+ &Apache::lonnet::get('environment',['screenname'],$udom,$uname);
+ return $names{'screenname'};
+}
+
# ---------------------------------------------------------------- Language IDs
sub languageids {
return sort(keys(%language));
@@ -1148,9 +1168,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 {
+ 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 '';
+ } 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