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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 16 May 2002 00:01:09 -0000


albertel		Wed May 15 20:01:09 2002 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - lonnet::reply -> lonnet::get transition
  - Fixes BUG#435
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.24 loncom/homework/grades.pm:1.25
--- loncom/homework/grades.pm:1.24	Wed May 15 19:47:49 2002
+++ loncom/homework/grades.pm	Wed May 15 20:01:09 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.24 2002/05/15 23:47:49 albertel Exp $
+# $Id: grades.pm,v 1.25 2002/05/16 00:01:09 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -118,15 +118,18 @@
   foreach my $student ( sort(@{ $classlist{'allids'} }) ) {
       my ($sname,$sdom) = split(/:/,$student);
 
-      my $reply=&Apache::lonnet::reply('get:'.$sdom.':'.$sname.
-		     ':environment:lastname&generation&firstname&middlename',
-		      &Apache::lonnet::homeserver($sname,$sdom));
-      #print "reply=$reply<br>";
-      my (@nameparts) = split /&/,$reply;
-#      my $sfullname = $Apache::lonnet::unescape($nameparts[0]);
-
+      my %name=&Apache::lonnet::get('environment', ['lastname','generation',
+						    'firstname','middlename'],
+				    $sdom,$sname);
+      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'};
+      }
       if ( $Apache::grades::viewgrades eq 'F' ) {
-	  $request->print("\n".'<tr>'."<td>$sname</td><td>$sdom</td><td>@nameparts</td><td>".
+	  $request->print("\n".'<tr>'."<td>$sname</td><td>$sdom</td><td>$fullname</td><td>".
 			  '<form action="/adm/grades" method="post">');
 	  if ($ENV{'form.url'}) {
 	    $request->print(