[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Wed, 09 Oct 2002 17:24:07 -0000
matthew Wed Oct 9 13:24:07 2002 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
Modifystudent will now record $end:$start:$uid:$sec:$fullname in the
'classlist' db.
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.293 loncom/lonnet/perl/lonnet.pm:1.294
--- loncom/lonnet/perl/lonnet.pm:1.293 Mon Oct 7 16:24:38 2002
+++ loncom/lonnet/perl/lonnet.pm Wed Oct 9 13:24:06 2002
@@ -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 Apache::Constants qw(:common :http);
use HTML::LCParser;
use Fcntl qw(:flock);
+use Apache::loncoursedata;
+
my $readit;
# --------------------------------------------------------------------- Logging
@@ -2320,10 +2322,24 @@
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;