[LON-CAPA-cvs] cvs: loncom /interface loncoursedata.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Mon, 19 May 2003 15:44:15 -0000
matthew Mon May 19 11:44:15 2003 EDT
Modified files:
/loncom/interface loncoursedata.pm
Log:
Added &GetUserName($name,$domain) to wrap around lonnet calls to find out
a users full name.
There probably should be a 'lonuserdata.pm' file for this sort of thing...
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.70 loncom/interface/loncoursedata.pm:1.71
--- loncom/interface/loncoursedata.pm:1.70 Mon Apr 21 11:12:37 2003
+++ loncom/interface/loncoursedata.pm Mon May 19 11:44:15 2003
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursedata.pm,v 1.70 2003/04/21 15:12:37 matthew Exp $
+# $Id: loncoursedata.pm,v 1.71 2003/05/19 15:44:15 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -209,6 +209,39 @@
return \%Discuss;
}
+################################################
+################################################
+
+=pod
+
+=item &GetUserName(username,userdomain)
+
+Returns a hash with the following entries:
+ 'firstname', 'middlename', 'lastname', 'generation', and 'fullname'
+
+ 'fullname' is the result of &Apache::loncoursedata::ProcessFullName.
+
+=cut
+
+################################################
+################################################
+sub GetUserName {
+ my ($username,$userdomain) = @_;
+ $username = $ENV{'user.name'} if (! defined($username));
+ $userdomain = $ENV{'user.domain'} if (! defined($username));
+ my %userenv = &Apache::lonnet::get('environment',
+ ['firstname','middlename','lastname','generation'],
+ $userdomain,$username);
+ $userenv{'fullname'} = &ProcessFullName($userenv{'lastname'},
+ $userenv{'generation'},
+ $userenv{'firstname'},
+ $userenv{'middlename'});
+ return %userenv;
+}
+
+################################################
+################################################
+
=pod
=item &ProcessFullName()
@@ -219,6 +252,8 @@
=cut
+################################################
+################################################
sub ProcessFullName {
my ($lastname, $generation, $firstname, $middlename)=@_;
my $Str = '';