--- loncom/interface/loncreateuser.pm 2007/12/07 23:09:30 1.204 +++ loncom/interface/loncreateuser.pm 2007/12/08 19:19:03 1.205 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.204 2007/12/07 23:09:30 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.205 2007/12/08 19:19:03 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -76,7 +76,7 @@ my $authformfsys; my $authformloc; sub initialize_authen_forms { - my ($dom,$curr_authtype) = @_; + my ($dom,$curr_authtype,$mode) = @_; my ($krbdefdom)=( $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/); $krbdefdom= uc($krbdefdom); my %param = ( formname => 'document.cu', @@ -91,6 +91,9 @@ sub initialize_authen_forms { if ($long_auth =~ /^krb(4|5)$/) { $param{'curr_kerb_ver'} = $1; } + if ($mode eq 'modifyuser') { + $param{'mode'} = $mode; + } } # no longer static due to configurable kerberos defaults # $loginscript = &Apache::loncommon::authform_header(%param); @@ -1197,12 +1200,8 @@ $lt{'uuas'} ($currentauth). $lt{'adcs'}. ENDBADAUTH } } else { # Authentication type is valid - &initialize_authen_forms($ccdomain,$currentauth); - my $authformnop_row; - if (&Apache::lonnet::allowed('mau',$ccdomain)) { - $authformnop_row = &Apache::loncommon::start_data_table_row(); - } - my ($authformcurrent,$authform_other,$can_modify) = + &initialize_authen_forms($ccdomain,$currentauth,'modifyuser'); + my ($authformcurrent,$can_modify,@authform_others) = &modify_login_block($ccdomain,$currentauth); if (&Apache::lonnet::allowed('mau',$ccdomain)) { # Current user has login modification privileges @@ -1217,7 +1216,7 @@ ENDBADAUTH ''."\n". '

'.$lt{'ld'}.'

'. &Apache::loncommon::start_data_table(). - $authformnop_row. + &Apache::loncommon::start_data_table_row(). ''.$authformnop; if ($can_modify) { $outcome .= ''."\n". @@ -1229,11 +1228,12 @@ ENDBADAUTH $outcome .= ' ('.$authformcurrent.')'. &Apache::loncommon::end_data_table_row()."\n"; } - if ($authform_other ne '') { - $outcome .= $authform_other; + foreach my $item (@authform_others) { + $outcome .= &Apache::loncommon::start_data_table_row(). + ''.$item.''. + &Apache::loncommon::end_data_table_row()."\n"; } - $outcome .= &Apache::loncommon::end_data_table_row(). - &Apache::loncommon::end_data_table(); + $outcome .= &Apache::loncommon::end_data_table(); } else { if (&Apache::lonnet::allowed('mau',$env{'request.role.domain'})) { my %lt=&Apache::lonlocal::texthash( @@ -1256,18 +1256,14 @@ sub modify_login_block { my %domconfig = &Apache::lonnet::get_dom('configuration',['usercreation'],$dom); my ($authnum,%can_assign) = &Apache::loncommon::get_assignable_auth($dom); - my ($authformcurrent,$authform_other,$show_override_msg); + my ($authformcurrent,@authform_others,$show_override_msg); if ($currentauth=~/^krb(4|5):/) { $authformcurrent=$authformkrb; if ($can_assign{'int'}) { - $authform_other = &Apache::loncommon::start_data_table_row(). - ''.$authformint.''. - &Apache::loncommon::end_data_table_row()."\n" + push(@authform_others,$authformint); } if ($can_assign{'loc'}) { - $authform_other .= &Apache::loncommon::start_data_table_row(). - ''.$authformloc.''. - &Apache::loncommon::end_data_table_row()."\n"; + push(@authform_others,$authformloc); } if (($can_assign{'krb4'}) || ($can_assign{'krb5'})) { $show_override_msg = 1; @@ -1275,14 +1271,10 @@ sub modify_login_block { } elsif ($currentauth=~/^internal:/) { $authformcurrent=$authformint; if (($can_assign{'krb4'}) || ($can_assign{'krb5'})) { - $authform_other = &Apache::loncommon::start_data_table_row(). - ''.$authformkrb.''. - &Apache::loncommon::end_data_table_row()."\n"; + push(@authform_others,$authformkrb); } if ($can_assign{'loc'}) { - $authform_other .= &Apache::loncommon::start_data_table_row(). - ''.$authformloc.''. - &Apache::loncommon::end_data_table_row()."\n"; + push(@authform_others,$authformloc); } if ($can_assign{'int'}) { $show_override_msg = 1; @@ -1290,19 +1282,13 @@ sub modify_login_block { } elsif ($currentauth=~/^unix:/) { $authformcurrent=$authformfsys; if (($can_assign{'krb4'}) || ($can_assign{'krb5'})) { - $authform_other = &Apache::loncommon::start_data_table_row(). - ''.$authformkrb.''. - &Apache::loncommon::end_data_table_row()."\n"; + push(@authform_others,$authformkrb); } if ($can_assign{'int'}) { - $authform_other .= &Apache::loncommon::start_data_table_row(). - ''.$authformint.''. - &Apache::loncommon::end_data_table_row()."\n" + push(@authform_others,$authformint); } if ($can_assign{'loc'}) { - $authform_other .= &Apache::loncommon::start_data_table_row(). - ''.$authformloc.''. - &Apache::loncommon::end_data_table_row()."\n"; + push(@authform_others,$authformloc); } if ($can_assign{'fsys'}) { $show_override_msg = 1; @@ -1310,25 +1296,25 @@ sub modify_login_block { } elsif ($currentauth=~/^localauth:/) { $authformcurrent=$authformloc; if (($can_assign{'krb4'}) || ($can_assign{'krb5'})) { - $authform_other = &Apache::loncommon::start_data_table_row(). - ''.$authformkrb.''. - &Apache::loncommon::end_data_table_row()."\n"; + push(@authform_others,$authformkrb); } if ($can_assign{'int'}) { - $authform_other .= &Apache::loncommon::start_data_table_row(). - ''.$authformint.''. - &Apache::loncommon::end_data_table_row()."\n" + push(@authform_others,$authformint); } if ($can_assign{'loc'}) { $show_override_msg = 1; } } if ($show_override_msg) { - $authformcurrent.= ' '. + $authformcurrent = ''."\n". + ''. + ''. + '
'.$authformcurrent. + '
   '.&mt('Currently in use').''. &mt('will override current values'). - '
'; + '
'; } - return ($authformcurrent,$authform_other,$show_override_msg); + return ($authformcurrent,$show_override_msg,@authform_others); } sub personal_data_display {