--- loncom/lonnet/perl/lonnet.pm 2002/10/07 20:24:38 1.293 +++ loncom/lonnet/perl/lonnet.pm 2002/10/09 17:24:06 1.294 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.293 2002/10/07 20:24:38 matthew Exp $ +# $Id: lonnet.pm,v 1.294 2002/10/09 17:24:06 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -86,6 +86,8 @@ use GDBM_File; use Apache::Constants qw(:common :http); use HTML::LCParser; use Fcntl qw(:flock); +use Apache::loncoursedata; + my $readit; # --------------------------------------------------------------------- Logging @@ -2320,10 +2322,24 @@ sub modifystudent { return 'error: no such user'; } # -------------------------------------------------- Add student to course list + if ($first eq '' || $last eq '' || $uid eq '') { + # They did not supply us with enough data to enroll the student, so + # we need to pick up more information. + my %tmp = dump('environment',$udom,$uname, + ['firstname','middlename','lastname', 'generation','id'] + ); + $first = $tmp{'firstname'} if (!defined($first) || $first eq ''); + $middle = $tmp{'middlename'} if (!defined($middle) || $middle eq ''); + $last = $tmp{'lastname'} if (!defined($last) || $last eq ''); + $gene = $tmp{'genename'} if (!defined($gene) || $gene eq ''); + $uid = $tmp{'id'} if (!defined($uid) || $uid eq ''); + } + my $fullname = &Apache::loncoursedata::ProcessFullName($last,$gene, + $first,$middle); $reply=critical('put:'.$ENV{'course.'.$cid.'.domain'}.':'. $ENV{'course.'.$cid.'.num'}.':classlist:'. &escape($uname.':'.$udom).'='. - &escape($end.':'.$start), + &escape(join(':',$end,$start,$uid,$usec,$fullname)), $ENV{'course.'.$cid.'.home'}); unless (($reply eq 'ok') || ($reply eq 'delayed')) { return 'error: '.$reply;