--- loncom/interface/Attic/londropadd.pm 2003/06/23 14:38:53 1.69
+++ loncom/interface/Attic/londropadd.pm 2003/07/05 10:07:11 1.73
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.69 2003/06/23 14:38:53 matthew Exp $
+# $Id: londropadd.pm,v 1.73 2003/07/05 10:07:11 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -79,13 +79,16 @@ sub modifystudent {
# We are in this course
my $section=$1;
$section='' if ($course eq $courseid.'_st');
- if ( ((!$section) && (!$csec)) || ($section ne $csec) ) {
+ if ($section eq $csec) {
+ $result .= 'ok:';
+ } elsif ( ((!$section) && (!$csec)) || ($section ne $csec) ) {
my (undef,$end,$start)=split(/\_/,$roles{$course});
my $now=time;
# if this is an active role
if (!($start && ($now<$start)) || !($end && ($now>$end))) {
my $reply=&Apache::lonnet::modifystudent
- ($udom,$unam,'','','','','','','',
+ # dom name id mode pass f m l g
+ ($udom,$unam,'', '', '',undef,undef,undef,undef,
$section,time,undef,undef,$desiredhost);
$result .= $reply.':';
}
@@ -215,7 +218,7 @@ sub javascript_validations {
my $authheader = &Apache::loncommon::authform_header(%param);
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
return (< ');
my $count=0;
my $flushc=0;
my %student=();
@@ -1492,9 +1500,9 @@ sub upfile_drop_add {
}
}
if ($entries{$fields{'username'}}=~/\W/) {
- $r->print(' Unacceptable username: '.
+ $r->print(' ');
+ $fname.' '.$mname.' '.$lname.' '.$gen.'');
} else {
# determine section number
my $sec='';
@@ -1512,6 +1520,14 @@ sub upfile_drop_add {
}
$id=~tr/A-Z/a-z/;
}
+ # determine email address
+ my $email='';
+ if (defined($fields{'email'})) {
+ if (defined($entries{$fields{'email'}})) {
+ $email=$entries{$fields{'email'}};
+ unless ($email=~/^[^\@]+\@[^\@]+$/) { $email=''; }
+ }
+ }
# determine student password
my $password='';
if ($genpwd) {
@@ -1534,11 +1550,12 @@ sub upfile_drop_add {
my $reply=&Apache::lonnet::modifystudent
($domain,$username,$id,$amode,$password,
$fname,$mname,$lname,$gen,$sec,$enddate,
- $startdate,$ENV{'form.forceid'},$desiredhost);
+ $startdate,$ENV{'form.forceid'},$desiredhost,
+ $email);
if ($reply ne 'ok') {
- $r->print(' '.
- 'Error enrolling '.$username.': '.
- $reply.' No password for $username ");
+ $r->print(' Processed Students: '.$count.'Enrolling Students
');
+ $r->print('Enrolling Students
'."\n".'
Unacceptable username: '.
$entries{$fields{'username'}}.' for user '.
- $fname.' '.$mname.' '.$lname.' '.$gen.'
'.$username.':'.
+ ' Unable to enroll: '.$reply);
} else {
$count++; $flushc++;
$student{$username}=1;
@@ -1549,12 +1566,13 @@ sub upfile_drop_add {
}
}
} else {
- $r->print("
'.$username.':'.
+ ' Unable to enroll: No password specified.');
}
}
}
} # end of foreach (@studentdata)
- $r->print('
Processed Students: '.$count.'
'); $r->print("If active, the new role will be available when the ". "students next log in to LON-CAPA.
"); #####################################