version 1.59, 2008/06/24 16:17:05
|
version 1.65, 2008/09/11 19:42:28
|
Line 169 sub propagate_id_change {
|
Line 169 sub propagate_id_change {
|
} |
} |
|
|
sub update_classlist { |
sub update_classlist { |
my ($cdom,$cnum,$udom,$uname,$user) = @_; |
my ($cdom,$cnum,$udom,$uname,$user,$newend) = @_; |
my ($uid,$classlistentry); |
my ($uid,$classlistentry); |
my $fullname = |
my $fullname = |
&Apache::lonnet::format_name($user->{'firstname'},$user->{'middlename'}, |
&Apache::lonnet::format_name($user->{'firstname'},$user->{'middlename'}, |
Line 180 sub update_classlist {
|
Line 180 sub update_classlist {
|
my @classinfo = split(/:/,$classhash{$uname.':'.$udom}); |
my @classinfo = split(/:/,$classhash{$uname.':'.$udom}); |
my $ididx=&Apache::loncoursedata::CL_ID() - 2; |
my $ididx=&Apache::loncoursedata::CL_ID() - 2; |
my $nameidx=&Apache::loncoursedata::CL_FULLNAME() - 2; |
my $nameidx=&Apache::loncoursedata::CL_FULLNAME() - 2; |
|
my $endidx = &Apache::loncoursedata::CL_END() - 2; |
|
my $startidx = &Apache::loncoursedata::CL_START() - 2; |
for (my $i=0; $i<@classinfo; $i++) { |
for (my $i=0; $i<@classinfo; $i++) { |
if ($i == $ididx) { |
if ($i == $endidx) { |
|
if ($newend ne '') { |
|
$classlistentry .= $newend.':'; |
|
} else { |
|
$classlistentry .= $classinfo[$i].':'; |
|
} |
|
} elsif ($i == $startidx) { |
|
if ($newend ne '') { |
|
if ($classinfo[$i] > $newend) { |
|
$classlistentry .= $newend.':'; |
|
} else { |
|
$classlistentry .= $classinfo[$i].':'; |
|
} |
|
} else { |
|
$classlistentry .= $classinfo[$i].':'; |
|
} |
|
} elsif ($i == $ididx) { |
if (defined($user->{'id'})) { |
if (defined($user->{'id'})) { |
$classlistentry .= $user->{'id'}.':'; |
$classlistentry .= $user->{'id'}.':'; |
} else { |
} else { |
$classlistentry .= $classinfo[$i].':'; |
$classlistentry .= $classinfo[$i].':'; |
} |
} |
} elsif ($i == $nameidx) { |
} elsif ($i == $nameidx) { |
$classlistentry .= $fullname.':'; |
if (defined($user->{'lastname'})) { |
|
$classlistentry .= $fullname.':'; |
|
} else { |
|
$classlistentry .= $classinfo[$i].':'; |
|
} |
} else { |
} else { |
$classlistentry .= $classinfo[$i].':'; |
$classlistentry .= $classinfo[$i].':'; |
} |
} |
Line 558 function verify(vf,sec_caller) {
|
Line 580 function verify(vf,sec_caller) {
|
if (tw==11) { foundrole=1; } |
if (tw==11) { foundrole=1; } |
if (tw==12) { founddomain=1; } |
if (tw==12) { founddomain=1; } |
} |
} |
verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail,foundrole,founddom); |
verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail,foundrole,founddomain); |
} |
} |
|
|
// |
// |
Line 779 sub print_upload_manager_footer {
|
Line 801 sub print_upload_manager_footer {
|
'onClick="javascript:verify(this.form,this.form.csec)" '. |
'onClick="javascript:verify(this.form,this.form.csec)" '. |
'value="'.&mt('Update Users').'" />'."<br />\n"; |
'value="'.&mt('Update Users').'" />'."<br />\n"; |
if ($context eq 'course') { |
if ($context eq 'course') { |
$Str .= &mt('Note: for large courses, this operation may be time '. |
$Str .= &mt('Note: for large courses, this operation may be time consuming'); |
'consuming'); |
|
} |
} |
$Str .= '</div>'; |
$Str .= '</div>'; |
$r->print($Str); |
$r->print($Str); |
Line 790 sub print_upload_manager_footer {
|
Line 811 sub print_upload_manager_footer {
|
sub forceid_change { |
sub forceid_change { |
my ($context) = @_; |
my ($context) = @_; |
my $output = |
my $output = |
"<h3>".&mt('ID/Student Number')."</h3>\n". |
"<h3>".&mt('Student/Employee ID')."</h3>\n". |
"<p>\n".'<label><input type="checkbox" name="forceid" value="yes">'. |
"<p>\n".'<label><input type="checkbox" name="forceid" value="yes">'. |
&mt('Disable ID/Student Number Safeguard and Force Change '. |
&mt('Disable Student/Employee ID Safeguard and force change of conflicting IDs'). |
'of Conflicting IDs').'</label><br />'."\n". |
'</label><br />'."\n". |
&mt('(only do if you know what you are doing.)')."\n"; |
&mt('(only do if you know what you are doing.)')."\n"; |
if ($context eq 'domain') { |
if ($context eq 'domain') { |
$output .= '<br /><label><input type="checkbox" name="recurseid"'. |
$output .= '<br /><label><input type="checkbox" name="recurseid"'. |
' value="yes">'. |
' value="yes">'. |
&mt('Update ID/Student Number in courses in which user is Active/Future student,<br />(if forcing change).'). |
&mt('Update Student/Employee ID in courses in which user is active/future student,[_1](if forcing change).','<br />'). |
'</label>'."\n"; |
'</label>'."\n"; |
} |
} |
$output .= '</p>'; |
$output .= '</p>'; |
Line 865 sub print_upload_manager_form {
|
Line 886 sub print_upload_manager_form {
|
['mname',&mt('Middle Names/Initials'),$env{'form.mname_choice'}], |
['mname',&mt('Middle Names/Initials'),$env{'form.mname_choice'}], |
['lname',&mt('Last Name'), $env{'form.lname_choice'}], |
['lname',&mt('Last Name'), $env{'form.lname_choice'}], |
['gen', &mt('Generation'), $env{'form.gen_choice'}], |
['gen', &mt('Generation'), $env{'form.gen_choice'}], |
['id', &mt('ID/Student Number'),$env{'form.id_choice'}], |
['id', &mt('Student/Employee ID'),$env{'form.id_choice'}], |
['sec', &mt('Section'), $env{'form.sec_choice'}], |
['sec', &mt('Section'), $env{'form.sec_choice'}], |
['ipwd', &mt('Initial Password'),$env{'form.ipwd_choice'}], |
['ipwd', &mt('Initial Password'),$env{'form.ipwd_choice'}], |
['email',&mt('E-mail Address'), $env{'form.email_choice'}], |
['email',&mt('E-mail Address'), $env{'form.email_choice'}], |
Line 2220 END
|
Line 2241 END
|
time.'_'.rand(1000000000).'.csv'; |
time.'_'.rand(1000000000).'.csv'; |
unless ($CSVfile = Apache::File->new('>/home/httpd'.$CSVfilename)) { |
unless ($CSVfile = Apache::File->new('>/home/httpd'.$CSVfilename)) { |
$r->log_error("Couldn't open $CSVfilename for output $!"); |
$r->log_error("Couldn't open $CSVfilename for output $!"); |
$r->print("Problems occured in writing the csv file. ". |
$r->print(&mt('Problems occurred in writing the csv file. ' |
"This error has been logged. ". |
.'This error has been logged. ' |
"Please alert your LON-CAPA administrator."); |
.'Please alert your LON-CAPA administrator.')); |
$CSVfile = undef; |
$CSVfile = undef; |
} |
} |
# |
# |
Line 2538 END
|
Line 2559 END
|
&mt('Your Excel spreadsheet').'</a> '.&mt('is ready for download').'.</p>'."\n"); |
&mt('Your Excel spreadsheet').'</a> '.&mt('is ready for download').'.</p>'."\n"); |
} elsif ($mode eq 'csv') { |
} elsif ($mode eq 'csv') { |
close($CSVfile); |
close($CSVfile); |
$r->print('<a href="'.$CSVfilename.'">'. |
$r->print('<p><a href="'.$CSVfilename.'">'. |
&mt('Your CSV file').'</a> is ready for download.'. |
&mt('Your CSV file').'</a> '.&mt('is ready for download').'.</p>'."\n"); |
"\n"); |
|
$r->rflush(); |
$r->rflush(); |
} |
} |
if ($mode eq 'autoenroll') { |
if ($mode eq 'autoenroll') { |
Line 3593 sub upfile_drop_add {
|
Line 3613 sub upfile_drop_add {
|
'</b>'); |
'</b>'); |
next; |
next; |
} else { |
} else { |
my $baddom = 0; |
|
if ($entries{$fields{'dom'}} |
if ($entries{$fields{'dom'}} |
ne &LONCAPA::clean_domain($entries{$fields{'domain'}})) { |
ne &LONCAPA::clean_domain($entries{$fields{'domain'}})) { |
$baddom = 1; |
|
} else { |
|
if (&Apache::lonnet::domain($entries{$fields{'domain'}}) eq '') { |
|
$baddom = 1; |
|
} |
|
} |
|
if ($baddom) { |
|
$r->print('<br />'. '<b>'.$entries{$fields{'domain'}}. |
$r->print('<br />'. '<b>'.$entries{$fields{'domain'}}. |
'</b>: '.&mt('Unacceptable domain for user [_2] [_3] [_4] [_5]',$fname,$mname,$lname,$gen).'</b>'); |
'</b>: '.&mt('Unacceptable domain for user [_2] [_3] [_4] [_5]',$fname,$mname,$lname,$gen).'</b>'); |
next; |
next; |
Line 4265 sub classlist_drop {
|
Line 4277 sub classlist_drop {
|
my ($scope,$uname,$udom,$now) = @_; |
my ($scope,$uname,$udom,$now) = @_; |
my ($cdom,$cnum) = ($scope=~m{^/($match_domain)/($match_courseid)}); |
my ($cdom,$cnum) = ($scope=~m{^/($match_domain)/($match_courseid)}); |
if (&Apache::lonnet::is_course($cdom,$cnum)) { |
if (&Apache::lonnet::is_course($cdom,$cnum)) { |
my $user = $uname.':'.$udom; |
|
if (!&active_student_roles($cnum,$cdom,$uname,$udom)) { |
if (!&active_student_roles($cnum,$cdom,$uname,$udom)) { |
my $result = |
my %user; |
&Apache::lonnet::cput('classlist', |
my $result = &update_classlist($cdom,$cnum,$udom,$uname,\%user,$now); |
{ $user => $now },$cdom,$cnum); |
|
return &mt('Drop from classlist: [_1]', |
return &mt('Drop from classlist: [_1]', |
'<b>'.$result.'</b>').'<br />'; |
'<b>'.$result.'</b>').'<br />'; |
} |
} |
Line 4573 sub can_modify_userinfo {
|
Line 4583 sub can_modify_userinfo {
|
if (ref($userroles) eq 'ARRAY') { |
if (ref($userroles) eq 'ARRAY') { |
foreach my $role (@{$userroles}) { |
foreach my $role (@{$userroles}) { |
my $testrole; |
my $testrole; |
if ($role =~ /^cr\//) { |
if ($context eq 'selfcreate') { |
$testrole = 'cr'; |
|
} else { |
|
$testrole = $role; |
$testrole = $role; |
|
} else { |
|
if ($role =~ /^cr\//) { |
|
$testrole = 'cr'; |
|
} else { |
|
$testrole = $role; |
|
} |
} |
} |
if (ref($domconfig{'usermodification'}{$context}{$testrole}) eq 'HASH') { |
if (ref($domconfig{'usermodification'}{$context}{$testrole}) eq 'HASH') { |
if ($domconfig{'usermodification'}{$context}{$testrole}{$field}) { |
if ($domconfig{'usermodification'}{$context}{$testrole}{$field}) { |