--- loncom/interface/lonuserutils.pm 2017/11/16 17:05:49 1.184.2.2 +++ loncom/interface/lonuserutils.pm 2017/08/08 15:34:32 1.186 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.184.2.2 2017/11/16 17:05:49 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.186 2017/08/08 15:34:32 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -943,8 +943,14 @@ sub print_upload_manager_footer { &Apache::lonhtmlcommon::row_closure(); } + my ($trustedref,$untrustedref); + if ($context eq 'course') { + ($trustedref,$untrustedref) = &Apache::lonnet::trusted_domains('enroll',$defdom); + } elsif ($context eq 'author') { + ($trustedref,$untrustedref) = &Apache::lonnet::trusted_domains('othcoau',$defdom); + } $Str .= &Apache::lonhtmlcommon::row_title(&mt('Default domain')) - .&Apache::loncommon::select_dom_form($defdom,'defaultdomain',undef,1) + .&Apache::loncommon::select_dom_form($defdom,'defaultdomain',undef,1,undef,$trustedref,$untrustedref) .&Apache::lonhtmlcommon::row_closure(); $Str .= &Apache::lonhtmlcommon::row_title(&mt('Starting and Ending Dates')) @@ -1121,15 +1127,8 @@ sub print_upload_manager_form { if (!$env{'form.datatoken'}) { $datatoken=&Apache::loncommon::upfile_store($r); } else { - $datatoken=&Apache::loncommon::valid_datatoken($env{'form.datatoken'}); - if ($datatoken ne '') { - &Apache::loncommon::load_tmp_file($r,$datatoken); - } - } - if ($datatoken eq '') { - $r->print('
'.&mt('Error').': '. - &mt('Invalid datatoken').'
'); - return 'missingdata'; + $datatoken=$env{'form.datatoken'}; + &Apache::loncommon::load_tmp_file($r); } my @records=&Apache::loncommon::upfile_record_sep(); if($env{'form.noFirstLine'}){ @@ -1213,7 +1212,6 @@ sub print_upload_manager_form { } &print_upload_manager_footer($r,$i,$keyfields,$defdom,$today,$halfyear, $context,$permission,$crstype,$showcredits); - return 'ok'; } sub setup_date_selectors { @@ -4115,10 +4113,7 @@ sub print_first_users_upload_form { # ================================================= Drop/Add from uploaded file sub upfile_drop_add { my ($r,$context,$permission,$showcredits) = @_; - my $datatoken = &Apache::loncommon::valid_datatoken($env{'form.datatoken'}); - if ($datatoken ne '') { - &Apache::loncommon::load_tmp_file($r,$datatoken); - } + &Apache::loncommon::load_tmp_file($r); my @userdata=&Apache::loncommon::upfile_record_sep(); if($env{'form.noFirstLine'}){shift(@userdata);} my @keyfields = split(/\,/,$env{'form.keyfields'}); @@ -4132,6 +4127,10 @@ sub upfile_drop_add { $fields{$env{'form.f'.$i}}=$keyfields[$i]; } } + if ($env{'form.fullup'} ne 'yes') { + $r->print(''."\n"); } elsif (ref($classlist) eq 'HASH') { # Remove the students we just added from the list of students. foreach my $line (@userdata) { @@ -4874,7 +4928,9 @@ sub upfile_drop_add { } } } # end of unless - return 'ok'; + if ($env{'form.fullup'} ne 'yes') { + $r->print(''); + } } sub print_namespacing_alerts {