--- loncom/interface/loncreateuser.pm 2017/08/15 23:42:33 1.406.2.14.2.1
+++ loncom/interface/loncreateuser.pm 2018/09/14 14:57:52 1.406.2.15
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.406.2.14.2.1 2017/08/15 23:42:33 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.406.2.15 2018/09/14 14:57:52 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2345,7 +2345,7 @@ sub modify_login_block {
sub personal_data_display {
my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray,
- $now,$captchaform,$emailusername,$usertype,$usernameset,$condition,$excluded) = @_;
+ $now,$captchaform,$emailusername,$usertype) = @_;
my ($output,%userenv,%canmodify,%canmodify_status);
my @userinfo = ('firstname','middlename','lastname','generation',
'permanentemail','id');
@@ -2372,7 +2372,6 @@ sub personal_data_display {
'inststatus' => "Affiliation",
'email' => 'E-mail address',
'valid' => 'Validation',
- 'username' => 'Username',
);
%canmodify_status =
@@ -2391,7 +2390,7 @@ sub personal_data_display {
if (ref($emailusername) eq 'HASH') {
if (ref($emailusername->{$usertype}) eq 'HASH') {
my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info();
- @userinfo = ();
+ @userinfo = ();
if ((ref($infofields) eq 'ARRAY') && (ref($infotitles) eq 'HASH')) {
foreach my $field (@{$infofields}) {
if ($emailusername->{$usertype}->{$field}) {
@@ -2421,38 +2420,9 @@ sub personal_data_display {
$output = '
'.$lt{'pd'}.'
'.
&Apache::lonhtmlcommon::start_pick_box();
if (($context eq 'selfcreate') && ($newuser eq 'email')) {
- my $size = 25;
- if ($condition) {
- if ($condition =~ /^\@[^\@]+$/) {
- $size = 10;
- } else {
- undef($condition);
- }
- }
- if ($excluded) {
- unless ($excluded =~ /^\@[^\@]+$/) {
- undef($condition);
- }
- }
$output .= &Apache::lonhtmlcommon::row_title($lt{'email'}.'*',undef,
'LC_oddrow_value')."\n".
- '';
- if ($condition) {
- $output .= $condition;
- } elsif ($excluded) {
- $output .= '
'.&mt('You must use an e-mail address that does not end with [_1]',
- $excluded).'';
- }
- if ($usernameset eq 'first') {
- $output .= '
';
- if ($condition) {
- $output .= &mt('Your username in LON-CAPA will be the part of your e-mail address before [_1]',
- $condition);
- } else {
- $output .= &mt('Your username in LON-CAPA will be the part of your e-mail address before the @');
- }
- $output .= '';
- }
+ '';
$rowcount ++;
$output .= &Apache::lonhtmlcommon::row_closure(1);
my $upassone = '';
@@ -2467,19 +2437,6 @@ sub personal_data_display {
'LC_oddrow_value')."\n".
$upasstwo.
&Apache::lonhtmlcommon::row_closure()."\n";
- if ($usernameset eq 'free') {
- my $onclick = "toggleUsernameDisp(this,'selfcreateusername');";
- $output .= &Apache::lonhtmlcommon::row_title($lt{'username'},undef,'LC_oddrow_value')."\n".
- &mt('Use e-mail address: ').
- ''."\n".
- (' 'x2).
- ''."\n".
- ''.
- '
'.&mt('Preferred username').
- ' '.
- '
'."\n".&Apache::lonhtmlcommon::row_closure(1);
- $rowcount ++;
- }
}
foreach my $item (@userinfo) {
my $rowtitle = $lt{$item};
@@ -4722,16 +4679,41 @@ sub handler {
if (! exists($env{'form.state'})) {
&Apache::lonuserutils::print_first_users_upload_form($r,$context);
} elsif ($env{'form.state'} eq 'got_file') {
- &Apache::lonuserutils::print_upload_manager_form($r,$context,$permission,
- $crstype,$showcredits);
+ my $result =
+ &Apache::lonuserutils::print_upload_manager_form($r,$context,
+ $permission,
+ $crstype,$showcredits);
+ if ($result eq 'missingdata') {
+ delete($env{'form.state'});
+ &Apache::lonuserutils::print_first_users_upload_form($r,$context);
+ }
} elsif ($env{'form.state'} eq 'enrolling') {
if ($env{'form.datatoken'}) {
- &Apache::lonuserutils::upfile_drop_add($r,$context,$permission,
- $showcredits);
+ my $result = &Apache::lonuserutils::upfile_drop_add($r,$context,
+ $permission,
+ $showcredits);
+ if ($result eq 'missingdata') {
+ delete($env{'form.state'});
+ &Apache::lonuserutils::print_first_users_upload_form($r,$context);
+ } elsif ($result eq 'invalidhome') {
+ $env{'form.state'} = 'got_file';
+ delete($env{'form.lcserver'});
+ my $result =
+ &Apache::lonuserutils::print_upload_manager_form($r,$context,$permission,
+ $crstype,$showcredits);
+ if ($result eq 'missingdata') {
+ delete($env{'form.state'});
+ &Apache::lonuserutils::print_first_users_upload_form($r,$context);
+ }
+ }
+ } else {
+ delete($env{'form.state'});
+ &Apache::lonuserutils::print_first_users_upload_form($r,$context);
}
} else {
&Apache::lonuserutils::print_first_users_upload_form($r,$context);
}
+ $r->print('');
} elsif (((($env{'form.action'} eq 'singleuser') || ($env{'form.action'}
eq 'singlestudent')) && ($permission->{'cusr'})) ||
(($env{'form.action'} eq 'singleuser') && ($permission->{'view'})) ||
@@ -4953,77 +4935,47 @@ sub handler {
unless ($usertype) {
$usertype = 'default';
}
- my ($showstatus,$showemail,$pickstart);
- my $numextras = 0;
- my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
- if ((ref($types) eq 'ARRAY') && (@{$types} > 0)) {
- if (ref($usertypes) eq 'HASH') {
- if ($usertypes->{$usertype}) {
- $showstatus = $usertypes->{$usertype};
- } else {
- $showstatus = $othertitle;
- }
- if ($showstatus) {
- $numextras ++;
- }
- }
- }
- if (($info{$uname}{'email'} ne '') && ($info{$uname}{'email'} ne $uname)) {
- $showemail = $info{$uname}{'email'};
- $numextras ++;
- }
if (ref($domconfig{'usercreation'}{'cancreate'}{'emailusername'}{$usertype}) eq 'HASH') {
if ((ref($infofields) eq 'ARRAY') && (ref($infotitles) eq 'HASH')) {
- $pickstart = 1;
$r->print(''.&Apache::lonhtmlcommon::start_pick_box());
- my ($num,$count);
+ my ($num,$count,$showstatus);
$count = scalar(keys(%{$domconfig{'usercreation'}{'cancreate'}{'emailusername'}{$usertype}}));
- $count += $numextras;
+ unless ($usertype eq 'default') {
+ my ($othertitle,$usertypes,$types) =
+ &Apache::loncommon::sorted_inst_types($dom);
+ if (ref($usertypes) eq 'HASH') {
+ if ($usertypes->{$usertype}) {
+ $showstatus = $usertypes->{$usertype};
+ $count ++;
+ }
+ }
+ }
foreach my $field (@{$infofields}) {
next unless ($domconfig{'usercreation'}{'cancreate'}{'emailusername'}{$usertype}{$field});
next unless ($infotitles->{$field});
$r->print(&Apache::lonhtmlcommon::row_title($infotitles->{$field}).
$info{$uname}{$field});
$num ++;
- unless ($count == $num) {
+ if ($count == $num) {
+ $r->print(&Apache::lonhtmlcommon::row_closure(1));
+ } else {
$r->print(&Apache::lonhtmlcommon::row_closure());
}
}
- }
- }
- if ($numextras) {
- unless ($pickstart) {
- $r->print('
'.&Apache::lonhtmlcommon::start_pick_box());
- $pickstart = 1;
- }
- if ($showemail) {
- my $closure = '';
- unless ($showstatus) {
- $closure = 1;
+ if ($showstatus) {
+ $r->print(&Apache::lonhtmlcommon::row_title(&mt('Status type (self-reported)')).
+ $showstatus.
+ &Apache::lonhtmlcommon::row_closure(1));
}
- $r->print(&Apache::lonhtmlcommon::row_title(&mt('E-mail address')).
- $showemail.
- &Apache::lonhtmlcommon::row_closure($closure));
- }
- if ($showstatus) {
- $r->print(&Apache::lonhtmlcommon::row_title(&mt('Status type[_1](self-reported)','
')).
- $showstatus.
- &Apache::lonhtmlcommon::row_closure(1));
+ $r->print(&Apache::lonhtmlcommon::end_pick_box().'
');
}
}
- if ($pickstart) {
- $r->print(&Apache::lonhtmlcommon::end_pick_box().'
');
- } else {
- $r->print(''.&mt('No information to display for this account request.').'
');
- }
- } else {
- $r->print(''.&mt('No information available for this account request.').'
');
}
}
}
}
+ $r->print(&close_popup_form());
}
- $r->print(&close_popup_form());
} elsif (($env{'form.action'} eq 'listusers') &&
($permission->{'view'} || $permission->{'cusr'})) {
my $helpitem = 'Course_View_Class_List';