--- loncom/interface/loncreateuser.pm 2008/07/13 00:15:14 1.252 +++ loncom/interface/loncreateuser.pm 2008/07/18 02:12:39 1.258 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.252 2008/07/13 00:15:14 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.258 2008/07/18 02:12:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1397,21 +1397,12 @@ sub modify_login_block { sub personal_data_display { my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray) = @_; - my ($output,$showforceid,%userenv,%canmodify,@inststatuses); + my ($output,$showforceid,%userenv,%canmodify); my @userinfo = ('firstname','middlename','lastname','generation', 'permanentemail','id'); my $rowcount = 0; my $editable = 0; - if ($context eq 'selfcreate') { - if (ref($inst_results) eq 'HASH') { - @inststatuses = &get_inststatuses($inst_results); - if (@inststatuses == 0) { - @inststatuses = ('default'); - } - $rolesarray = \@inststatuses; - } - } - if (!$newuser || $context eq 'selfcreate') { + if (!$newuser) { # Get the users information %userenv = &Apache::lonnet::get('environment', ['firstname','middlename','lastname','generation', @@ -1419,6 +1410,9 @@ sub personal_data_display { %canmodify = &Apache::lonuserutils::can_modify_userinfo($context,$ccdomain, \@userinfo,$rolesarray); + } elsif ($context eq 'selfcreate') { + %canmodify = &selfcreate_canmodify($context,$ccdomain,\@userinfo, + $inst_results,$rolesarray); } my %lt=&Apache::lonlocal::texthash( 'pd' => "Personal Data", @@ -1460,6 +1454,8 @@ sub personal_data_display { } else { $hiderow = 1; } + } else { + $row .= ''; } } } else { @@ -1470,6 +1466,8 @@ sub personal_data_display { } else { $hiderow = 1; } + } else { + $row .= ''; } } } else { @@ -1500,6 +1498,21 @@ sub personal_data_display { } } +sub selfcreate_canmodify { + my ($context,$dom,$userinfo,$inst_results,$rolesarray) = @_; + if (ref($inst_results) eq 'HASH') { + my @inststatuses = &get_inststatuses($inst_results); + if (@inststatuses == 0) { + @inststatuses = ('default'); + } + $rolesarray = \@inststatuses; + } + my %canmodify = + &Apache::lonuserutils::can_modify_userinfo($context,$dom,$userinfo, + $rolesarray); + return %canmodify; +} + sub get_inststatuses { my ($insthashref) = @_; my @inststatuses = (); @@ -3394,14 +3407,32 @@ function getIndexByName(item) { return -1; } ENDSCRIPT + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $output = ''."\n". - '