--- loncom/interface/loncreateuser.pm 2014/02/16 15:38:52 1.393
+++ loncom/interface/loncreateuser.pm 2014/04/25 17:56:42 1.399
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.393 2014/02/16 15:38:52 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.399 2014/04/25 17:56:42 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1813,7 +1813,7 @@ sub display_existing_roles {
}
} else {
$plaintext=
- &mt('Customrole [_1][_2]defined by [_3]',
+ &mt('Custom role [_1][_2]defined by [_3]',
'"'.$croletitle.'"',
' ',
$croleuname.':'.$croleudom);
@@ -2164,7 +2164,7 @@ sub modify_login_block {
sub personal_data_display {
my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray,
- $now,$captchaform,$emailusername) = @_;
+ $now,$captchaform,$emailusername,$usertype) = @_;
my ($output,%userenv,%canmodify,%canmodify_status);
my @userinfo = ('firstname','middlename','lastname','generation',
'permanentemail','id');
@@ -2206,19 +2206,24 @@ sub personal_data_display {
\@userinfo,$rolesarray);
} elsif ($context eq 'selfcreate') {
if ($newuser eq 'email') {
- if (ref($emailusername) eq 'HASH') {
- my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info();
- @userinfo = ();
- if ((ref($infofields) eq 'ARRAY') && (ref($infotitles) eq 'HASH')) {
- foreach my $field (@{$infofields}) {
- if ($emailusername->{$field}) {
- push(@userinfo,$field);
- $canmodify{$field} = 1;
- unless ($textboxsize{$field}) {
- $textboxsize{$field} = 25;
- }
- unless ($lt{$field}) {
- $lt{$field} = $infotitles->{$field};
+ if (ref($emailusername) eq 'HASH') {
+ if (ref($emailusername->{$usertype}) eq 'HASH') {
+ my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info();
+ @userinfo = ();
+ if ((ref($infofields) eq 'ARRAY') && (ref($infotitles) eq 'HASH')) {
+ foreach my $field (@{$infofields}) {
+ if ($emailusername->{$usertype}->{$field}) {
+ push(@userinfo,$field);
+ $canmodify{$field} = 1;
+ unless ($textboxsize{$field}) {
+ $textboxsize{$field} = 25;
+ }
+ unless ($lt{$field}) {
+ $lt{$field} = $infotitles->{$field};
+ }
+ if ($emailusername->{$usertype}->{$field} eq 'required') {
+ $lt{$field} .= '*';
+ }
}
}
}
@@ -2234,19 +2239,19 @@ sub personal_data_display {
$output = '
'.$lt{'pd'}.'
'.
&Apache::lonhtmlcommon::start_pick_box();
if (($context eq 'selfcreate') && ($newuser eq 'email')) {
- $output .= &Apache::lonhtmlcommon::row_title($lt{'email'},undef,
+ $output .= &Apache::lonhtmlcommon::row_title($lt{'email'}.'*',undef,
'LC_oddrow_value')."\n".
- '';
+ '';
$rowcount ++;
$output .= &Apache::lonhtmlcommon::row_closure(1);
- my $upassone = '';
- my $upasstwo = '';
- $output .= &Apache::lonhtmlcommon::row_title(&mt('Password'),
+ my $upassone = '';
+ my $upasstwo = '';
+ $output .= &Apache::lonhtmlcommon::row_title(&mt('Password').'*',
'LC_pick_box_title',
'LC_oddrow_value')."\n".
$upassone."\n".
&Apache::lonhtmlcommon::row_closure(1)."\n".
- &Apache::lonhtmlcommon::row_title(&mt('Confirm password'),
+ &Apache::lonhtmlcommon::row_title(&mt('Confirm password').'*',
'LC_pick_box_title',
'LC_oddrow_value')."\n".
$upasstwo.
@@ -2266,7 +2271,7 @@ sub personal_data_display {
} else {
if ($context eq 'selfcreate') {
if ($canmodify{$item}) {
- $row .= '';
+ $row .= '';
$editable ++;
} else {
$hiderow = 1;
@@ -2282,9 +2287,9 @@ sub personal_data_display {
} else {
if ($canmodify{$item}) {
if ($newuser eq 'email') {
- $row .= '';
+ $row .= '';
} else {
- $row .= '';
+ $row .= '';
}
$editable ++;
} else {
@@ -2360,6 +2365,7 @@ sub personal_data_display {
$output .= &Apache::lonhtmlcommon::row_title()."\n".
' '.
+ ''.
&Apache::lonhtmlcommon::row_closure(1);
}
$output .= &Apache::lonhtmlcommon::end_pick_box();
@@ -2715,7 +2721,7 @@ sub update_user_data {
$r->print($error.'Invalid login mode or password'.$end.$rtnlink);
return;
}
- # Only allow authentification modification if the person has authority
+ # Only allow authentication modification if the person has authority
if (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'})) {
$r->print('Modifying authentication: '.
&Apache::lonnet::modifyuserauth(
@@ -2725,7 +2731,7 @@ sub update_user_data {
($env{'form.ccuname'},$env{'form.ccdomain'}));
} else {
# Okay, this is a non-fatal error.
- $r->print($error.&mt('You do not have the authority to modify this users authentification information').'.'.$end);
+ $r->print($error.&mt('You do not have the authority to modify this users authentication information.').$end);
}
}
$r->rflush(); # Finish display of header before time consuming actions start
@@ -3150,9 +3156,9 @@ sub update_user_data {
$rolestr = &mt('No roles');
}
if ($context eq 'course') {
- $contextname = &mt('course');
+ $contextname = 'course';
} elsif ($context eq 'author') {
- $contextname = &mt('co-author');
+ $contextname = 'co-author';
}
$r->print(&mt('The following fields were not updated: ').'
');
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles();
@@ -3161,9 +3167,9 @@ sub update_user_data {
}
$r->print('
');
if (@mod_disallowed == 1) {
- $r->print(&mt("You do not have the authority to change this field given the user's current set of active/future [_1] roles:",$contextname));
+ $r->print(&mt("You do not have the authority to change this field given the user's current set of active/future $contextname roles:"));
} else {
- $r->print(&mt("You do not have the authority to change these fields given the user's current set of active/future [_1] roles:",$contextname));
+ $r->print(&mt("You do not have the authority to change these fields given the user's current set of active/future $contextname roles:"));
}
my $helplink = 'javascript:helpMenu('."'display'".')';
$r->print(''.$rolestr.' '
@@ -4816,26 +4822,47 @@ sub handler {
if (ref($domconfig{'usercreation'}) eq 'HASH') {
if (ref($domconfig{'usercreation'}{'cancreate'}) eq 'HASH') {
if (ref($domconfig{'usercreation'}{'cancreate'}{'emailusername'}) eq 'HASH') {
- my $count = scalar(keys(%{$domconfig{'usercreation'}{'cancreate'}{'emailusername'}}));
my %info =
&Apache::lonnet::get('nohist_requestedusernames',[$uname],$dom,$domconfiguser);
if (ref($info{$uname}) eq 'HASH') {
- if ((ref($infofields) eq 'ARRAY') && (ref($infotitles) eq 'HASH')) {
- $r->print('
'.&Apache::lonhtmlcommon::start_pick_box());
- my $num;
- foreach my $field (@{$infofields}) {
- next unless ($domconfig{'usercreation'}{'cancreate'}{'emailusername'}{$field});
- next unless ($infotitles->{$field});
- $r->print(&Apache::lonhtmlcommon::row_title($infotitles->{$field}).
- $info{$uname}{$field});
- $num ++;
- if ($count == $num) {
- $r->print(&Apache::lonhtmlcommon::row_closure(1));
- } else {
- $r->print(&Apache::lonhtmlcommon::row_closure());
+ my $usertype = $info{$uname}{'inststatus'};
+ unless ($usertype) {
+ $usertype = 'default';
+ }
+ if (ref($domconfig{'usercreation'}{'cancreate'}{'emailusername'}{$usertype}) eq 'HASH') {
+ if ((ref($infofields) eq 'ARRAY') && (ref($infotitles) eq 'HASH')) {
+ $r->print('
'.&Apache::lonhtmlcommon::start_pick_box());
+ my ($num,$count,$showstatus);
+ $count = scalar(keys(%{$domconfig{'usercreation'}{'cancreate'}{'emailusername'}{$usertype}}));
+ 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 ++;
+ if ($count == $num) {
+ $r->print(&Apache::lonhtmlcommon::row_closure(1));
+ } else {
+ $r->print(&Apache::lonhtmlcommon::row_closure());
+ }
+ }
+ if ($showstatus) {
+ $r->print(&Apache::lonhtmlcommon::row_title(&mt('Status type (self-reported)')).
+ $showstatus.
+ &Apache::lonhtmlcommon::row_closure(1));
+ }
+ $r->print(&Apache::lonhtmlcommon::end_pick_box().'