--- loncom/interface/loncommon.pm 2002/08/22 13:39:42 1.56
+++ loncom/interface/loncommon.pm 2002/08/28 14:11:27 1.62
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.56 2002/08/22 13:39:42 matthew Exp $
+# $Id: loncommon.pm,v 1.62 2002/08/28 14:11:27 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -480,7 +480,7 @@ sub help_open_topic {
# Add the graphic
$template .= <<"ENDTEMPLATE";
-
+
ENDTEMPLATE
return $template;
@@ -735,7 +735,7 @@ sub authform_nochange{
my $result='';
$result.=<<"END";
+ onclick="javascript:changed_radio('nochange',$in{'formname'});" />
Do not change login data
END
return $result;
@@ -751,10 +751,12 @@ sub authform_kerberos{
$result.=<<"END";
+ onchange="javascript:changed_radio('krb',$in{'formname'});" />
Kerberos authenticated with domain
+ onchange="javascript:changed_text('krb',$in{'formname'});" />
+Version 4
+Version 5
END
return $result;
}
@@ -769,10 +771,10 @@ sub authform_internal{
$result.=<<"END";
+ onclick="javascript:changed_radio('int',$args{'formname'});" />
Internally authenticated (with initial password
+ onchange="javascript:changed_text('int',$args{'formname'});" />
END
return $result;
}
@@ -787,10 +789,10 @@ sub authform_local{
$result.=<<"END";
+ onclick="javascript:changed_radio('loc',$in{'formname'});" />
Local Authentication with argument
+ onchange="javascript:changed_text('loc',$in{'formname'});" />
END
return $result;
}
@@ -805,7 +807,7 @@ sub authform_filesystem{
$result.=<<"END";
+ onclick="javascript:changed_radio('fsys',$in{'formname'});" />
Filesystem authenticated (with initial password
@@ -930,6 +932,51 @@ 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);
+ my $name=$names{'firstname'}.' '.$names{'middlename'}.' '.
+ $names{'lastname'}.' '.$names{'generation'};
+ $name=~s/\s+$//;
+ $name=~s/\s+/ /g;
+ return $name;
+}
+
+# ------------------------------------------------------------------ Screenname
+
+sub screenname {
+ my ($uname,$udom)=@_;
+ my %names=
+ &Apache::lonnet::get('environment',['screenname'],$udom,$uname);
+ return $names{'screenname'};
+}
+
+# ------------------------------------------------------------- Message Wrapper
+
+sub messagewrapper {
+ my ($link,$un,$do)=@_;
+ return
+"$link";
+}
+# ------------------------------------------------------------- Aboutme Wrapper
+
+sub aboutmewrapper {
+ my ($link,$un,$do)=@_;
+ return "$link";
+}
+
+# ------------------------------------------------------------ Syllabus Wrapper
+
+
+sub syllabuswrapper {
+ my ($link,$un,$do)=@_;
+ return "$link";
+}
+
# ---------------------------------------------------------------- Language IDs
sub languageids {
return sort(keys(%language));
@@ -1146,9 +1193,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
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)/) {
@@ -1208,11 +1315,17 @@ sub bodytag {
}
unless ($realm) { $realm=' '; }
# Set messages
- my $messages=localtime();
+ my $messages=&domainlogo($domain);
# Output
- return(<
+END
+ if ($bodyonly) {
+ return $bodytag;
+ } else {
+ return(<
@@ -1237,6 +1350,7 @@ $addentries>
$realm
ENDBODY
+ }
}
###############################################
@@ -1425,7 +1539,7 @@ return HTML code to select file and spec
sub upfile_select_html {
return (<<'ENDUPFORM');
-
+
Type: