version 1.187, 2017/08/09 19:20:50
|
version 1.192, 2017/11/04 20:23:23
|
Line 943 sub print_upload_manager_footer {
|
Line 943 sub print_upload_manager_footer {
|
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
} |
} |
|
|
my ($trustedref,$untrustedref); |
my ($trusted,$untrusted); |
if ($context eq 'course') { |
if ($context eq 'course') { |
($trustedref,$untrustedref) = &Apache::lonnet::trusted_domains('enroll',$defdom); |
($trusted,$untrusted) = &Apache::lonnet::trusted_domains('enroll',$defdom); |
} elsif ($context eq 'author') { |
} elsif ($context eq 'author') { |
($trustedref,$untrustedref) = &Apache::lonnet::trusted_domains('othcoau',$defdom); |
($trusted,$untrusted) = &Apache::lonnet::trusted_domains('othcoau',$defdom); |
} |
} |
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Default domain')) |
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Default domain')) |
.&Apache::loncommon::select_dom_form($defdom,'defaultdomain',undef,1,undef,$trustedref,$untrustedref) |
.&Apache::loncommon::select_dom_form($defdom,'defaultdomain',undef,1,undef,$trusted,$untrusted) |
.&Apache::lonhtmlcommon::row_closure(); |
.&Apache::lonhtmlcommon::row_closure(); |
|
|
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Starting and Ending Dates')) |
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Starting and Ending Dates')) |
Line 1127 sub print_upload_manager_form {
|
Line 1127 sub print_upload_manager_form {
|
if (!$env{'form.datatoken'}) { |
if (!$env{'form.datatoken'}) { |
$datatoken=&Apache::loncommon::upfile_store($r); |
$datatoken=&Apache::loncommon::upfile_store($r); |
} else { |
} else { |
$datatoken=$env{'form.datatoken'}; |
$datatoken=&Apache::loncommon::valid_datatoken($env{'form.datatoken'}); |
&Apache::loncommon::load_tmp_file($r); |
if ($datatoken ne '') { |
|
&Apache::loncommon::load_tmp_file($r,$datatoken); |
|
} |
} |
} |
my @records=&Apache::loncommon::upfile_record_sep(); |
my @records=&Apache::loncommon::upfile_record_sep(); |
if($env{'form.noFirstLine'}){ |
if($env{'form.noFirstLine'}){ |
Line 4114 sub print_first_users_upload_form {
|
Line 4116 sub print_first_users_upload_form {
|
# ================================================= Drop/Add from uploaded file |
# ================================================= Drop/Add from uploaded file |
sub upfile_drop_add { |
sub upfile_drop_add { |
my ($r,$context,$permission,$showcredits) = @_; |
my ($r,$context,$permission,$showcredits) = @_; |
&Apache::loncommon::load_tmp_file($r); |
my $datatoken = &Apache::loncommon::valid_datatoken($env{'form.datatoken'}); |
|
if ($datatoken ne '') { |
|
&Apache::loncommon::load_tmp_file($r,$datatoken); |
|
} |
my @userdata=&Apache::loncommon::upfile_record_sep(); |
my @userdata=&Apache::loncommon::upfile_record_sep(); |
if($env{'form.noFirstLine'}){shift(@userdata);} |
if($env{'form.noFirstLine'}){shift(@userdata);} |
my @keyfields = split(/\,/,$env{'form.keyfields'}); |
my @keyfields = split(/\,/,$env{'form.keyfields'}); |
Line 4128 sub upfile_drop_add {
|
Line 4133 sub upfile_drop_add {
|
$fields{$env{'form.f'.$i}}=$keyfields[$i]; |
$fields{$env{'form.f'.$i}}=$keyfields[$i]; |
} |
} |
} |
} |
if ($env{'form.fullup'} ne 'yes') { |
|
$r->print('<form name="studentform" method="post" action="/adm/createuser">'."\n". |
|
'<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'); |
|
} |
|
# |
# |
# Store the field choices away |
# Store the field choices away |
my @storefields = qw/username names fname mname lname gen id |
my @storefields = qw/username names fname mname lname gen id |
Line 4169 sub upfile_drop_add {
|
Line 4170 sub upfile_drop_add {
|
my $domain; |
my $domain; |
if ($env{'form.defaultdomain'} ne '') { |
if ($env{'form.defaultdomain'} ne '') { |
if (($context eq 'course') || ($setting eq 'course')) { |
if (($context eq 'course') || ($setting eq 'course')) { |
unless ($env{'form.defaultdomain'} eq $crsdom) { |
if ($env{'form.defaultdomain'} eq $crsdom) { |
|
$domain = $env{'form.defaultdomain'}; |
|
} else { |
if (&Apache::lonnet::will_trust('enroll',$crsdom,$env{'form.defaultdomain'})) { |
if (&Apache::lonnet::will_trust('enroll',$crsdom,$env{'form.defaultdomain'})) { |
$domain = $env{'form.defaultdomain'}; |
$domain = $env{'form.defaultdomain'}; |
} else { |
} else { |
$r->print('<span class="LC_error">'.&mt('Error'). |
$r->print('<span class="LC_error">'.&mt('Error').': '. |
&mt('Enrollment of users not permitted for specified default domain: [_1].', |
&mt('Enrollment of users not permitted for specified default domain: [_1].', |
&Apache::lonnet::domain($env{'form.defaultdomain'},'description')).'</span>'); |
&Apache::lonnet::domain($env{'form.defaultdomain'},'description')).'</span>'); |
$r->print(&Apache::loncommon::end_page()); |
return; |
} |
} |
return; |
|
} |
} |
} elsif ($context eq 'author') { |
} elsif ($context eq 'author') { |
unless ($env{'form.defaultdomain'} eq $defdom) { |
if ($env{'form.defaultdomain'} eq $defdom) { |
|
$domain = $env{'form.defaultdomain'}; |
|
} else { |
if ((&Apache::lonnet::will_trust('othcoau',$defdom,$env{'form.defaultdomain'})) && |
if ((&Apache::lonnet::will_trust('othcoau',$defdom,$env{'form.defaultdomain'})) && |
(&Apache::lonnet::will_trust('coaurem',$env{'form.defaultdomain'},$defdom))) { |
(&Apache::lonnet::will_trust('coaurem',$env{'form.defaultdomain'},$defdom))) { |
$domain = $env{'form.defaultdomain'}; |
$domain = $env{'form.defaultdomain'}; |
} else { |
} else { |
$r->print('<span class="LC_error">'.&mt('Error'). |
$r->print('<span class="LC_error">'.&mt('Error').': '. |
&mt('Addition of users not permitted for specified default domain: [_1].', |
&mt('Addition of users not permitted for specified default domain: [_1].', |
&Apache::lonnet::domain($env{'form.defaultdomain'},'description')).'</span>'); |
&Apache::lonnet::domain($env{'form.defaultdomain'},'description')).'</span>'); |
$r->print(&Apache::loncommon::end_page()); |
return; |
} |
} |
return; |
|
} |
} |
} elsif (($context eq 'domain') && ($setting eq 'domain')) { |
} elsif (($context eq 'domain') && ($setting eq 'domain')) { |
unless ($env{'form.defaultdomain'} eq $defdom) { |
if ($env{'form.defaultdomain'} eq $defdom) { |
|
$domain = $env{'form.defaultdomain'}; |
|
} else { |
if (&Apache::lonnet::will_trust('domroles',$defdom,$env{'form.defaultdomain'})) { |
if (&Apache::lonnet::will_trust('domroles',$defdom,$env{'form.defaultdomain'})) { |
$domain = $env{'form.defaultdomain'}; |
$domain = $env{'form.defaultdomain'}; |
} else { |
} else { |
$r->print('<span class="LC_error">'.&mt('Error'). |
$r->print('<span class="LC_error">'.&mt('Error').': '. |
&mt('Addition of users not permitted for specified default domain: [_1].', |
&mt('Addition of users not permitted for specified default domain: [_1].', |
&Apache::lonnet::domain($env{'form.defaultdomain'},'description')).'</span>'); |
&Apache::lonnet::domain($env{'form.defaultdomain'},'description')).'</span>'); |
$r->print(&Apache::loncommon::end_page()); |
return; |
} |
} |
} |
} |
} |
} |
Line 4214 sub upfile_drop_add {
|
Line 4219 sub upfile_drop_add {
|
} else { |
} else { |
my %home_servers = &Apache::lonnet::get_servers($defdom,'library'); |
my %home_servers = &Apache::lonnet::get_servers($defdom,'library'); |
if (! exists($home_servers{$desiredhost})) { |
if (! exists($home_servers{$desiredhost})) { |
$r->print('<span class="LC_error">'.&mt('Error'). |
$r->print('<span class="LC_error">'.&mt('Error').': '. |
&mt('Invalid home server specified').'</span>'); |
&mt('Invalid home server specified').'</span>'); |
$r->print(&Apache::loncommon::end_page()); |
|
return; |
return; |
} |
} |
} |
} |
Line 4244 sub upfile_drop_add {
|
Line 4248 sub upfile_drop_add {
|
} |
} |
if ($amode =~ /^krb/) { |
if ($amode =~ /^krb/) { |
if (! defined($genpwd) || $genpwd eq '') { |
if (! defined($genpwd) || $genpwd eq '') { |
$r->print('<span class="Error">'. |
$r->print('<span class="Error">'.': '. |
&mt('Unable to enroll users').' '. |
&mt('Unable to enroll users').' '. |
&mt('No Kerberos domain was specified.').'</span></p>'); |
&mt('No Kerberos domain was specified.').'</span></p>'); |
$amode = ''; # This causes the loop below to be skipped |
$amode = ''; # This causes the loop below to be skipped |
Line 4892 sub upfile_drop_add {
|
Line 4896 sub upfile_drop_add {
|
"</p>\n"); |
"</p>\n"); |
if ($counts{'role'} > 0) { |
if ($counts{'role'} > 0) { |
$r->print("<p>\n". |
$r->print("<p>\n". |
&mt('Roles added for [quant,_1,user].',$counts{'role'}).' '.&mt('If a user is currently logged-in to LON-CAPA, any new roles which are active will be available when the user next logs in.')."</p>\n"); |
&mt('Roles added for [quant,_1,user].',$counts{'role'}).' '. |
|
&mt('If a user is currently logged-in to LON-CAPA, any new roles which are active will be available when the user next logs in.'). |
|
"</p>\n"); |
} else { |
} else { |
$r->print('<p>'.&mt('No roles added').'</p>'); |
$r->print('<p>'.&mt('No roles added').'</p>'); |
} |
} |
Line 4910 sub upfile_drop_add {
|
Line 4916 sub upfile_drop_add {
|
# Get current classlist |
# Get current classlist |
my $classlist = &Apache::loncoursedata::get_classlist(); |
my $classlist = &Apache::loncoursedata::get_classlist(); |
if (! defined($classlist)) { |
if (! defined($classlist)) { |
$r->print('<form name="studentform" method="post" action="/adm/createuser">'. |
$r->print('<p class="LC_info">'. |
'<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'. |
&mt('There are no students with current/future access to the course.'). |
'<p class="LC_info">'.&mt('There are no students with current/future access to the course.').'</p>'. |
'</p>'."\n"); |
'</form>'."\n"); |
|
} elsif (ref($classlist) eq 'HASH') { |
} elsif (ref($classlist) eq 'HASH') { |
# Remove the students we just added from the list of students. |
# Remove the students we just added from the list of students. |
foreach my $line (@userdata) { |
foreach my $line (@userdata) { |
Line 4929 sub upfile_drop_add {
|
Line 4934 sub upfile_drop_add {
|
} |
} |
} |
} |
} # end of unless |
} # end of unless |
if ($env{'form.fullup'} ne 'yes') { |
|
$r->print('</form>'); |
|
} |
|
} |
} |
|
|
sub print_namespacing_alerts { |
sub print_namespacing_alerts { |