[LON-CAPA-cvs] cvs: loncom /homework grades.pm

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 16 Oct 2002 19:13:57 -0000


matthew		Wed Oct 16 15:13:57 2002 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  &get_fullname now calls &Apache::loncoursedata::ProcessFullName to put
  a full name together.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.54 loncom/homework/grades.pm:1.55
--- loncom/homework/grades.pm:1.54	Fri Oct  4 02:22:12 2002
+++ loncom/homework/grades.pm	Wed Oct 16 15:13:57 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.54 2002/10/04 06:22:12 albertel Exp $
+# $Id: grades.pm,v 1.55 2002/10/16 19:13:57 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -40,6 +40,7 @@
 use Apache::lonnet;
 use Apache::loncommon;
 use Apache::lonhomework;
+use Apache::loncoursedata;
 use Apache::lonmsg qw(:user_normal_msg);
 use Apache::Constants qw(:common);
 
@@ -72,13 +73,16 @@
 sub get_fullname {
     my ($uname,$udom) = @_;
     my %name=&Apache::lonnet::get('environment', ['lastname','generation',
-						  'firstname','middlename'],$udom,$uname);
+						  'firstname','middlename'],
+                                  $udom,$uname);
     my $fullname;
     my ($tmp) = keys(%name);
     if ($tmp !~ /^(con_lost|error|no_such_host)/i) {
-	$fullname=$name{'lastname'}.$name{'generation'};
-	if ($fullname =~ /[^\s]+/) { $fullname.=', '; }
-	$fullname.=$name{'firstname'}.' '.$name{'middlename'};
+        $fullname = &Apache::loncoursedata::ProcessFullName
+            (@name{qw/lastname generation firstname middlename/});
+    } else {
+        &Apache::lonnet::logthis('grades.pm: no name data for '.$uname.
+                                 '@'.$udom.':'.$tmp);
     }
     return $fullname;
 }