version 1.4, 2000/12/27 21:57:10
|
version 1.7, 2001/01/01 15:43:46
|
Line 14
|
Line 14
|
# 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28, |
# 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28, |
# 12/08,12/12 Gerd Kortemeyer) |
# 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; |
package Apache::londropadd; |
|
|
Line 330 Kerberos authenticated with domain
|
Line 331 Kerberos authenticated with domain
|
<input type=text size=10 name=krbdom onChange="setkrb(this.form);"><p> |
<input type=text size=10 name=krbdom onChange="setkrb(this.form);"><p> |
<input type=radio name=login value=int onClick="clickint(this.form);"> |
<input type=radio name=login value=int onClick="clickint(this.form);"> |
Internally authenticated (with initial password |
Internally authenticated (with initial password |
<input type=text size=10 name=intpwd onChange="setint(this.form);">)<p> |
<input type=text size=10 name=intpwd onChange="setint(this.form);">) |
|
<h3>LON-CAPA Domain for Students</h3> |
LON-CAPA domain: <input type=text size=10 value=$defdom name=lcdomain><p> |
LON-CAPA domain: <input type=text size=10 value=$defdom name=lcdomain><p> |
|
<h3>Starting and Ending Dates</h3> |
<input type="hidden" value='' name="pres_value"> |
<input type="hidden" value='' name="pres_value"> |
<input type="hidden" value='' name="pres_type"> |
<input type="hidden" value='' name="pres_type"> |
<input type="hidden" value='' name="pres_marker"> |
<input type="hidden" value='' name="pres_marker"> |
Line 345 LON-CAPA domain: <input type=text size=1
|
Line 347 LON-CAPA domain: <input type=text size=1
|
<a |
<a |
href="javascript:pjump('date_end','Enrollment Ending Date',document.studentform.enddate.value,'end','studentform.pres','dateset');" |
href="javascript:pjump('date_end','Enrollment Ending Date',document.studentform.enddate.value,'end','studentform.pres','dateset');" |
>Set Ending Date</a><p> |
>Set Ending Date</a><p> |
|
<h3>Full Update</h3> |
<input type=button onClick="verify(this.form)" value="Submit Selection"> |
<input type=checkbox name=fullup value=yes> Full update |
|
(also dropping students)<p> |
|
<input type=button onClick="verify(this.form)" value="Update Courselist"><br> |
|
Note: for large courses, this operation might be time consuming. |
ENDPICK |
ENDPICK |
} elsif ($ENV{'form.enroll'}) { |
} elsif ($ENV{'form.enroll'}) { |
} elsif ($ENV{'form.drop'}) { |
} elsif ($ENV{'form.drop'}) { |
Line 374 ENDPICK
|
Line 379 ENDPICK
|
my $enddate=$ENV{'form.enddate'}; |
my $enddate=$ENV{'form.enddate'}; |
if ($startdate=~/\D/) { $startdate=''; } |
if ($startdate=~/\D/) { $startdate=''; } |
if ($enddate=~/\D/) { $enddate=''; } |
if ($enddate=~/\D/) { $enddate=''; } |
my $count=1; |
my $domain=$ENV{'form.lcdomain'}; |
my @studentdata=(); |
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('<h3>Enrolling Students</h3>'); |
|
my $count=0; |
|
my $flushc=0; |
|
my %student=(); |
|
# ----------------------------------------------------------- Get new classlist |
|
my @studentdata=(); |
{ |
{ |
my $fh; |
my $fh; |
if ($fh=Apache::File->new($r->dir_config('lonDaemons'). |
if ($fh=Apache::File->new($r->dir_config('lonDaemons'). |
Line 383 ENDPICK
|
Line 405 ENDPICK
|
@studentdata=<$fh>; |
@studentdata=<$fh>; |
} |
} |
} |
} |
|
# --------------------------------------------------------- Enroll new students |
map { |
map { |
my $line=$_; |
my $line=$_; |
chomp($line); |
chomp($line); |
Line 413 ENDPICK
|
Line 436 ENDPICK
|
$r->print('<p><b>Unacceptable username: '. |
$r->print('<p><b>Unacceptable username: '. |
$entries[$fields{'username'}].' for user '. |
$entries[$fields{'username'}].' for user '. |
$fname.' '.$mname.' '.$lname.' '.$gen.'</b><p>'); |
$fname.' '.$mname.' '.$lname.' '.$gen.'</b><p>'); |
} else { |
} else { |
$r->print($count.': '.$fname.' - '.$mname.' - '.$lname.' - '.$gen.'<br>'); $count++; |
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( |
|
"<p><b>Error enrolling $username: $reply</b><p>"); |
|
} else { |
|
$count++; $flushc++; |
|
$student{$username}=1; |
|
$r->print('. '); |
|
if ($flushc>15) { |
|
$r->rflush; |
|
$flushc=0; |
|
} |
|
} |
|
} else { |
|
$r->print( |
|
"<p><b>No password for $username</b><p>"); |
|
} |
} |
} |
} |
} |
} @studentdata; |
} @studentdata; |
|
$r->print('<p>Processed Students: '.$count); |
|
# --------------------------------------------------------------- Drop students |
|
if ($ENV{'form.fullup'} eq 'yes') { |
|
$r->print('<h3>Dropping Students</h3>'); |
|
# ------------------------------------------------------- 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\:/) { |
|
map { |
|
my ($name,$value)=split(/\=/,$_); |
|
my ($end,$start)=split(/\_/, |
|
&Apache::lonnet::unescape($value)); |
|
my $active=1; |
|
if (($end) && ($now>$end)) { $active=0; } |
|
if ($active) { |
|
$currentlist{&Apache::lonnet::unescape($name)}=1; |
|
} |
|
} split(/\&/,$classlst); |
|
|
|
} else { |
|
$r->print( |
|
'<font color=red><h3>Could not access classlist: '.$classlst. |
|
'</h3></font>'); |
|
} |
|
} |
|
# ------------------------------------------------------------------------ Done |
} |
} |
|
} |
} |
} |
# ------------------------------------------------------------------------- End |
# ------------------------------------------------------------------------- End |
$r->print('</form></body></html>'); |
$r->print('</form></body></html>'); |