--- loncom/interface/Attic/londropadd.pm 2000/12/27 21:57:10 1.4 +++ loncom/interface/Attic/londropadd.pm 2001/01/01 17:30:00 1.8 @@ -14,7 +14,8 @@ # 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28, # 12/08,12/12 Gerd Kortemeyer) # -# 12/26, 12/27 Gerd Kortemeyer +# 12/26,12/27,12/28, +# 01/01/01 Gerd Kortemeyer package Apache::londropadd; @@ -330,9 +331,10 @@ Kerberos authenticated with domain
Internally authenticated (with initial password -)
+) +
- +
- - +
+
+Note: for large courses, this operation might be time consuming.
ENDPICK
} elsif ($ENV{'form.enroll'}) {
} elsif ($ENV{'form.drop'}) {
@@ -374,8 +379,25 @@ ENDPICK
my $enddate=$ENV{'form.enddate'};
if ($startdate=~/\D/) { $startdate=''; }
if ($enddate=~/\D/) { $enddate=''; }
- my $count=1;
- my @studentdata=();
+ my $domain=$ENV{'form.lcdomain'};
+ my $amode='';
+ my $genpwd='';
+ if ($ENV{'form.login'} eq 'krb') {
+ $amode='krb4';
+ $genpwd=$ENV{'form.krbdom'};
+ } elsif ($ENV{'form.login'} eq 'int') {
+ $amode='internal';
+ if ((defined($ENV{'form.intpwd'})) && ($ENV{'form.intpwd'})) {
+ $genpwd=$ENV{'form.intpwd'};
+ }
+ }
+ unless (($domain=~/\W/) || ($amode eq '')) {
+ $r->print('
Unacceptable username: '. $entries[$fields{'username'}].' for user '. $fname.' '.$mname.' '.$lname.' '.$gen.'
');
- } else {
-$r->print($count.': '.$fname.' - '.$mname.' - '.$lname.' - '.$gen.'
'); $count++;
+ } else {
+ my $sec='';
+ my $username=$entries[$fields{'username'}];
+ if (defined($fields{'sec'})) {
+ if (defined($entries[$fields{'sec'}])) {
+ $sec=$entries[$fields{'sec'}];
+ }
+ }
+ my $id='';
+ if (defined($fields{'id'})) {
+ if (defined($entries[$fields{'id'}])) {
+ $id=$entries[$fields{'id'}];
+ }
+ $id=~tr/A-Z/a-z/;
+ }
+ my $password='';
+ if ($genpwd) {
+ $password=$genpwd;
+ } else {
+ if (defined($fields{'ipwd'})) {
+ if ($entries[$fields{'ipwd'}]) {
+ $password=$entries[$fields{'ipwd'}];
+ }
+ }
+ }
+ if ($password) {
+ my $reply=&Apache::lonnet::modifystudent(
+ $domain,$username,$id,$amode,$password,
+ $fname,$mname,$lname,$gen,$sec,$enddate,$startdate);
+ unless ($reply eq 'ok') {
+ $r->print(
+ "
Error enrolling $username: $reply
"); + } else { + $count++; $flushc++; + $student{$username}=1; + $r->print('. '); + if ($flushc>15) { + $r->rflush; + $flushc=0; + } + } + } else { + $r->print( + "
No password for $username
"); + } } } } @studentdata; + $r->print('
Processed Students: '.$count); +# --------------------------------------------------------------- Drop students + if ($ENV{'form.fullup'} eq 'yes') { + $r->print('