--- loncom/interface/lonuserutils.pm 2009/02/17 10:12:37 1.80
+++ loncom/interface/lonuserutils.pm 2009/04/22 17:42:36 1.89
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.80 2009/02/17 10:12:37 weissno Exp $
+# $Id: lonuserutils.pm,v 1.89 2009/04/22 17:42:36 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -86,7 +86,7 @@ sub modifystudent {
sub modifyuserrole {
my ($context,$setting,$changeauth,$cid,$udom,$uname,$uid,$umode,$upass,
$first,$middle,$last,$gene,$sec,$forceid,$desiredhome,$email,$role,
- $end,$start,$checkid) = @_;
+ $end,$start,$checkid,$inststatus) = @_;
my ($scope,$userresult,$authresult,$roleresult,$idresult);
if ($setting eq 'course' || $context eq 'course') {
$scope = '/'.$cid;
@@ -124,7 +124,7 @@ sub modifyuserrole {
$userresult =
&Apache::lonnet::modifyuser($udom,$uname,$uid,$umode,$upass,$first,
$middle,$last,$gene,$forceid,$desiredhome,
- $email,$role,$start,$end);
+ $email,$inststatus);
if ($userresult eq 'ok') {
if ($role ne '') {
$role =~ s/_/\//g;
@@ -341,7 +341,7 @@ sub print_upload_manager_header {
&hidden_input('fileupload',$env{'form.fileupload'}).
&hidden_input('upfiletype',$env{'form.upfiletype'}).
&hidden_input('upfile_associate',$env{'form.upfile_associate'}));
- $r->print('
+
+
+
+
+
+
+
END
return;
}
@@ -3375,10 +3414,13 @@ END
sub print_first_users_upload_form {
my ($r,$context) = @_;
my $str;
- $str = '';
+ $str = '';
$str .= '';
$str .= '';
- $str .= "".&mt('Upload a file containing information about users')."
\n";
+ $str .= ''.&mt('Upload a file containing information about users').'
'."\n";
+ $str .= ''
+ .&mt('Please upload an UTF8 encoded file to ensure a correct character encoding in your classlist.')
+ .'
'."\n";
$str .= &Apache::loncommon::upfile_select_html();
$str .= '';
$str .= &Apache::loncommon::help_open_topic("Course_Create_Class_List",
@@ -3391,7 +3433,7 @@ sub print_first_users_upload_form {
$str .= ' '.
&mt('Ignore First Line')."
\n";
$str .= ''."
\n";
+ &mt('Next').'" />'."
\n";
$str .= &Apache::loncommon::end_page();
$r->print($str);
return;
@@ -3436,7 +3478,8 @@ sub upfile_drop_add {
'ipwd_choice' => 'scalar',
'email_choice' => 'scalar',
'role_choice' => 'scalar',
- 'domain_choice' => 'scalar'});
+ 'domain_choice' => 'scalar',
+ 'inststatus_choice' => 'scalar'});
#
my ($startdate,$enddate) = &get_dates_from_form();
if ($env{'form.makedatesdefault'}) {
@@ -3519,6 +3562,7 @@ sub upfile_drop_add {
'permanentemail','id');
my %canmodify;
if (&Apache::lonnet::allowed('mau',$domain)) {
+ push(@userinfo,'inststatus');
foreach my $field (@userinfo) {
$canmodify{$field} = 1;
}
@@ -3567,6 +3611,8 @@ sub upfile_drop_add {
} else {
$r->print(''.&mt('Adding/Modifying Users')."
\n\n");
}
+ $r->rflush;
+
my %counts = (
user => 0,
auth => 0,
@@ -3706,7 +3752,15 @@ sub upfile_drop_add {
if (defined($fields{'email'})) {
if (defined($entries{$fields{'email'}})) {
$email=$entries{$fields{'email'}};
- unless ($email=~/^[^\@]+\@[^\@]+$/) { $email=''; } }
+ unless ($email=~/^[^\@]+\@[^\@]+$/) { $email=''; }
+ }
+ }
+ # determine affiliation
+ my $inststatus='';
+ if (defined($fields{'inststatus'})) {
+ if (defined($entries{$fields{'inststatus'}})) {
+ $inststatus=$entries{$fields{'inststatus'}};
+ }
}
# determine user password
my $password = $genpwd;
@@ -3789,7 +3843,7 @@ sub upfile_drop_add {
}
}
my @newinfo = (\$fname,\$mname,\$lname,\$gen,\$email,\$id);
- for (my $i=0; $i<@userinfo; $i++) {
+ for (my $i=0; $i<@newinfo; $i++) {
if (${$newinfo[$i]} ne '') {
if (!$canmodify{$userinfo[$i]}) {
${$newinfo[$i]} = '';
@@ -3838,7 +3892,7 @@ sub upfile_drop_add {
$fname,$mname,$lname,$gen,$sec,$enddate,
$startdate,$env{'form.forceid'},
$desiredhost,$email,'manual','',$cid,
- '',$context);
+ '',$context,$inststatus);
$userresult = $roleresult;
} else {
if ($role ne '') {
@@ -3858,7 +3912,7 @@ sub upfile_drop_add {
$mname,$lname,$gen,$sec,
$env{'form.forceid'},$desiredhost,
$email,$role,$enddate,
- $startdate,$checkid);
+ $startdate,$checkid,$inststatus);
}
} elsif (@secs > 0) {
$singlesec = $secs[0];
@@ -3873,7 +3927,8 @@ sub upfile_drop_add {
$id,$amode,$password,$fname,
$mname,$lname,$gen,$singlesec,
$env{'form.forceid'},$desiredhost,
- $email,$role,$enddate,$startdate,$checkid);
+ $email,$role,$enddate,$startdate,
+ $checkid,$inststatus);
}
}
if ($multiple) {