--- loncom/interface/Attic/londropadd.pm 2000/12/27 21:57:10 1.4 +++ loncom/interface/Attic/londropadd.pm 2000/12/28 16:32:10 1.5 @@ -14,7 +14,7 @@ # 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 Gerd Kortemeyer package Apache::londropadd; @@ -330,9 +330,10 @@ Kerberos authenticated with domain

Internally authenticated (with initial password -)

+) +

LON-CAPA Domain for Students

LON-CAPA domain:

- +

Starting and Ending Dates

@@ -345,7 +346,9 @@ LON-CAPA domain: Set Ending Date

- +

Full Update

+ Full update +(also dropping students)

ENDPICK } elsif ($ENV{'form.enroll'}) { @@ -374,8 +377,23 @@ 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('

Enrolling Students

'); + my $count=1; +# ----------------------------------------------------------- Get new classlist + my @studentdata=(); { my $fh; if ($fh=Apache::File->new($r->dir_config('lonDaemons'). @@ -383,6 +401,7 @@ ENDPICK @studentdata=<$fh>; } } +# --------------------------------------------------------- Enroll new students map { my $line=$_; chomp($line); @@ -413,12 +432,67 @@ ENDPICK $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 { + $r->print( + "

No password for $username

"); + } } } } @studentdata; +# --------------------------------------------------------------- Drop students + if ($ENV{'form.fullup'} eq 'yes') { + $r->print('

Dropping Students

'); +# ------------------------------------------------------- Get current classlist + my $cid=$ENV{'request.course.id'}; + my $classlst=&Apache::lonnet::reply + ('dump:'.$ENV{'course.'.$cid.'.domain'}.':'. + $ENV{'course.'.$cid.'.num'}.':classlist', + $ENV{'course.'.$cid.'.home'}); + my %currentlist=(); + my $now=time; + unless ($classlst=~/^error\:/) { + } else { + $r->print( + '

Could not access classlist: '.$classlst. + '

'); + } + } +# ------------------------------------------------------------------------ Done } + } } # ------------------------------------------------------------------------- End $r->print('');