--- loncom/interface/loncreateuser.pm 2014/02/28 19:20:06 1.395
+++ loncom/interface/loncreateuser.pm 2014/03/26 18:18:24 1.397
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.395 2014/02/28 19:20:06 bisitz Exp $
+# $Id: loncreateuser.pm,v 1.397 2014/03/26 18:18:24 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -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'),
+ $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.
@@ -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();
@@ -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().'
');
}
- $r->print(&Apache::lonhtmlcommon::end_pick_box().'
');
}
}
}
@@ -7190,8 +7217,9 @@ sub course_level_dc {
&Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
''.$lt{'scc'}.' | '.$lt{'rol'}.' | '."\n".
- ''.$lt{'grs'}.' | '.$lt{'crd'}.' | '."\n".
- ''.$lt{'sta'}.' | '.$lt{'end'}.' | '."\n".
+ ''.$lt{'grs'}.' | '."\n";
+ $header .= ''.$lt{'crd'}.' | '."\n" if ($showcredits);
+ $header .= ''.$lt{'sta'}.' | '.$lt{'end'}.' | '."\n".
&Apache::loncommon::end_data_table_header_row();
my $otheritems = &Apache::loncommon::start_data_table_row()."\n".
' '.
@@ -7221,7 +7249,7 @@ sub course_level_dc {
' | '."\n";
if ($showcredits) {
$otheritems .= ' '."\n".
- ''."\n";
+ ' | '."\n";
}
$otheritems .= <