--- loncom/homework/grades.pm 2001/04/17 21:07:38 1.6 +++ loncom/homework/grades.pm 2001/05/01 17:30:18 1.7 @@ -26,12 +26,22 @@ sub moreinfo { } -#FIXME - needs to be much smarter +#FIXME - needs to handle multiple matches sub finduser { my ($name) = @_; + my $domain = ''; if ( $Apache::grades::viewgrades eq 'F' ) { - return ($name,$ENV{'user.domain'}); + #get classlist + my ($cdom,$cnum) = split(/_/,$ENV{'request.course.id'}); + my $chome=$ENV{"course.$ENV{'request.course.id'}.home"}; + #print "Found $cdom:$cnum:$chome
"; + my (%classlist) = &getclasslist($cdom,$cnum,$chome,'0'); + foreach my $student ( sort(@{ $classlist{'allids'} }) ) { + my ($posname,$posdomain) = split(/:/,$student); + if ($posname =~ $name) { $name=$posname; $domain=$posdomain; last; } + } + return ($name,$domain); } else { return ($ENV{'user.name'},$ENV{'user.domain'}); }