version 1.68, 2003/06/20 20:57:44
|
version 1.73, 2003/07/05 10:07:11
|
Line 79 sub modifystudent {
|
Line 79 sub modifystudent {
|
# We are in this course |
# We are in this course |
my $section=$1; |
my $section=$1; |
$section='' if ($course eq $courseid.'_st'); |
$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 (undef,$end,$start)=split(/\_/,$roles{$course}); |
my $now=time; |
my $now=time; |
# if this is an active role |
# if this is an active role |
if (!($start && ($now<$start)) || !($end && ($now>$end))) { |
if (!($start && ($now<$start)) || !($end && ($now>$end))) { |
my $reply=&Apache::lonnet::modifystudent |
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); |
$section,time,undef,undef,$desiredhost); |
$result .= $reply.':'; |
$result .= $reply.':'; |
} |
} |
Line 215 sub javascript_validations {
|
Line 218 sub javascript_validations {
|
my $authheader = &Apache::loncommon::authform_header(%param); |
my $authheader = &Apache::loncommon::authform_header(%param); |
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); |
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); |
return (<<ENDPICK); |
return (<<ENDPICK); |
function verify_message (vf,founduname,foundpwd,foundname,foundid,foundsec) { |
function verify_message (vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail) { |
var foundatype=0; |
var foundatype=0; |
var message=''; |
var message=''; |
if (founduname==0) { |
if (founduname==0) { |
Line 251 function verify_message (vf,founduname,f
|
Line 254 function verify_message (vf,founduname,f
|
} |
} |
} |
} |
|
|
if (foundname==0) { message='No name fields specified. '; } |
if (foundname==0) { message='name fields'; } |
if (foundid==0) { message+='No ID or student number field specified. '; } |
if (foundid==0) { if (message!='') { message+=', '; } message+='student number field'; } |
if (foundsec==0) { message+='No section or group field specified. '; } |
if (foundsec==0) { if (message!='') { message+=', '; } message+='section or group field'; } |
|
if (foundemail==0) { if (message!='') { message+=', '; } message+='email address field'; } |
if (message!='') { |
if (message!='') { |
message+='Continue enrollment?'; |
message='Not specified (optional): '+message+'. Continue enrollment?'; |
if (confirm(message)) { |
if (confirm(message)) { |
vf.state.value='enrolling'; |
vf.state.value='enrolling'; |
vf.submit(); |
vf.submit(); |
Line 281 function verify(vf) {
|
Line 285 function verify(vf) {
|
var foundname=0; |
var foundname=0; |
var foundid=0; |
var foundid=0; |
var foundsec=0; |
var foundsec=0; |
|
var foundemail=0; |
var tw; |
var tw; |
for (i=0;i<=vf.nfields.value;i++) { |
for (i=0;i<=vf.nfields.value;i++) { |
tw=eval('vf.f'+i+'.selectedIndex'); |
tw=eval('vf.f'+i+'.selectedIndex'); |
Line 289 function verify(vf) {
|
Line 294 function verify(vf) {
|
if (tw==7) { foundid=1; } |
if (tw==7) { foundid=1; } |
if (tw==8) { foundsec=1; } |
if (tw==8) { foundsec=1; } |
if (tw==9) { foundpwd=1; } |
if (tw==9) { foundpwd=1; } |
|
if (tw==10) { foundemail=1; } |
} |
} |
verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec); |
verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail); |
} |
} |
|
|
// |
// |
Line 309 function verify(vf) {
|
Line 315 function verify(vf) {
|
// 7 = id |
// 7 = id |
// 8 = section |
// 8 = section |
// 9 = ipwd (password) |
// 9 = ipwd (password) |
// |
// 10 = email address |
|
|
function flip(vf,tf) { |
function flip(vf,tf) { |
var nw=eval('vf.f'+tf+'.selectedIndex'); |
var nw=eval('vf.f'+tf+'.selectedIndex'); |
var i; |
var i; |
Line 496 sub print_upload_manager_form {
|
Line 503 sub print_upload_manager_form {
|
['gen','Generation'], |
['gen','Generation'], |
['id','ID/Student Number'], |
['id','ID/Student Number'], |
['sec','Group/Section'], |
['sec','Group/Section'], |
['ipwd','Initial Password']); |
['ipwd','Initial Password'], |
|
['email','EMail Address']); |
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
&Apache::loncommon::csv_print_samples($r,\@records); |
&Apache::loncommon::csv_print_samples($r,\@records); |
$i=&Apache::loncommon::csv_print_select_table($r,\@records,\@d); |
$i=&Apache::loncommon::csv_print_select_table($r,\@records,\@d); |
Line 660 sub make_dates_default {
|
Line 668 sub make_dates_default {
|
'default_enrollment_end_date' =>$enddate},$dom,$crs); |
'default_enrollment_end_date' =>$enddate},$dom,$crs); |
if ($put_result eq 'ok') { |
if ($put_result eq 'ok') { |
$result .= "Set default start and end dates for course<br />"; |
$result .= "Set default start and end dates for course<br />"; |
|
# |
|
# Refresh the course environment |
|
&Apache::lonnet::coursedescription($ENV{'request.course.id'}); |
} else { |
} else { |
$result .= "Unable to set default dates for course:".$put_result. |
$result .= "Unable to set default dates for course:".$put_result. |
'<br />'; |
'<br />'; |
Line 1460 sub upfile_drop_add {
|
Line 1471 sub upfile_drop_add {
|
####################################### |
####################################### |
## Enroll Students ## |
## Enroll Students ## |
####################################### |
####################################### |
$r->print('<h3>Enrolling Students</h3>'); |
$r->print('<h3>Enrolling Students</h3>'."\n".'<p>'); |
my $count=0; |
my $count=0; |
my $flushc=0; |
my $flushc=0; |
my %student=(); |
my %student=(); |
Line 1489 sub upfile_drop_add {
|
Line 1500 sub upfile_drop_add {
|
} |
} |
} |
} |
if ($entries{$fields{'username'}}=~/\W/) { |
if ($entries{$fields{'username'}}=~/\W/) { |
$r->print('<p><b>Unacceptable username: '. |
$r->print('<br /><b>Unacceptable username: '. |
$entries{$fields{'username'}}.' for user '. |
$entries{$fields{'username'}}.' for user '. |
$fname.' '.$mname.' '.$lname.' '.$gen.'</b><p>'); |
$fname.' '.$mname.' '.$lname.' '.$gen.'</b>'); |
} else { |
} else { |
# determine section number |
# determine section number |
my $sec=''; |
my $sec=''; |
Line 1509 sub upfile_drop_add {
|
Line 1520 sub upfile_drop_add {
|
} |
} |
$id=~tr/A-Z/a-z/; |
$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 |
# determine student password |
my $password=''; |
my $password=''; |
if ($genpwd) { |
if ($genpwd) { |
Line 1531 sub upfile_drop_add {
|
Line 1550 sub upfile_drop_add {
|
my $reply=&Apache::lonnet::modifystudent |
my $reply=&Apache::lonnet::modifystudent |
($domain,$username,$id,$amode,$password, |
($domain,$username,$id,$amode,$password, |
$fname,$mname,$lname,$gen,$sec,$enddate, |
$fname,$mname,$lname,$gen,$sec,$enddate, |
$startdate,$ENV{'form.forceid'},$desiredhost); |
$startdate,$ENV{'form.forceid'},$desiredhost, |
|
$email); |
if ($reply ne 'ok') { |
if ($reply ne 'ok') { |
$r->print('<p><b>'. |
$reply =~ s/^error://; |
'Error enrolling '.$username.': '. |
$r->print('<br /><b>'.$username.'</b>:'. |
$reply.'</b></p>'); |
' Unable to enroll: '.$reply); |
} else { |
} else { |
$count++; $flushc++; |
$count++; $flushc++; |
$student{$username}=1; |
$student{$username}=1; |
Line 1546 sub upfile_drop_add {
|
Line 1566 sub upfile_drop_add {
|
} |
} |
} |
} |
} else { |
} else { |
$r->print("<p><b>No password for $username</b><p>"); |
$r->print('<br /><b>'.$username.'</b>:'. |
|
' Unable to enroll: No password specified.'); |
} |
} |
} |
} |
} |
} |
} # end of foreach (@studentdata) |
} # end of foreach (@studentdata) |
$r->print('<p>Processed Students: '.$count.'</p>'); |
$r->print('</p><p>Processed Students: '.$count.'</p>'); |
$r->print("<p>If active, the new role will be available when the ". |
$r->print("<p>If active, the new role will be available when the ". |
"students next log in to LON-CAPA.</p>"); |
"students next log in to LON-CAPA.</p>"); |
##################################### |
##################################### |