--- loncom/interface/loncreateuser.pm 2016/10/22 15:53:55 1.406.2.4 +++ loncom/interface/loncreateuser.pm 2016/01/31 21:25:38 1.407 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.406.2.4 2016/10/22 15:53:55 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.407 2016/01/31 21:25:38 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -813,7 +813,7 @@ sub entry_form { } my $cancreate = &Apache::lonuserutils::can_create_user($dom,$context,$usertype); - my ($userpicker,$cansearch) = + my $userpicker = &Apache::loncommon::user_picker($dom,$srch,$forcenewuser, 'document.crtuser',$cancreate,$usertype); my $srchbutton = &mt('Search'); @@ -822,9 +822,7 @@ sub entry_form { } elsif ($cancreate && $responsemsg ne '' && $inexact) { $srchbutton = &mt('Search or Add New User'); } - my $output; - if ($cansearch) { - $output = <<"ENDBLOCK"; + my $output = <<"ENDBLOCK";
@@ -832,9 +830,6 @@ $userpicker
ENDBLOCK - } else { - $output = '

'.$userpicker.'

'; - } if ($env{'form.phase'} eq '') { my $defdom=$env{'request.role.domain'}; my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain'); @@ -2249,8 +2244,8 @@ sub personal_data_display { ''; $rowcount ++; $output .= &Apache::lonhtmlcommon::row_closure(1); - my $upassone = ''; - my $upasstwo = ''; + my $upassone = ''; + my $upasstwo = ''; $output .= &Apache::lonhtmlcommon::row_title(&mt('Password').'*', 'LC_pick_box_title', 'LC_oddrow_value')."\n". @@ -2356,7 +2351,7 @@ sub personal_data_display { } if (($context eq 'selfcreate') && ($newuser eq 'email')) { if ($captchaform) { - $output .= &Apache::lonhtmlcommon::row_title($lt{'valid'}.'*', + $output .= &Apache::lonhtmlcommon::row_title($lt{'valid'}, 'LC_pick_box_title')."\n". $captchaform."\n".'

'. &Apache::lonhtmlcommon::row_closure(1); @@ -3115,7 +3110,7 @@ sub update_user_data { \%newsettingstext); if ($env{'form.cid'} ne $userenv{'id'}) { &Apache::lonnet::idput($env{'form.ccdomain'}, - ($env{'form.ccuname'} => $env{'form.cid'})); + {$env{'form.ccuname'} => $env{'form.cid'}},$uhome,'ids'); if (($recurseid) && (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}))) { my $idresult = @@ -6828,29 +6823,13 @@ sub user_search_result { } } if ($response ne '') { - $response = ''.$response.'
'; + $response = ''.$response.''; } if ($srch->{'srchin'} eq 'instd') { - my $instd_chk = &instdirectorysrch_check($srch); + my $instd_chk = &directorysrch_check($srch); if ($instd_chk ne 'ok') { - my $domd_chk = &domdirectorysrch_check($srch); - $response .= ''.$instd_chk.'
'; - if ($domd_chk eq 'ok') { - $response .= &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.'); - } - $response .= '

'; - } - } else { - unless (($context eq 'requestcrs') && ($srch->{'srchtype'} eq 'exact')) { - my $domd_chk = &domdirectorysrch_check($srch); - if ($domd_chk ne 'ok') { - my $instd_chk = &instdirectorysrch_check($srch); - $response .= ''.$domd_chk.'
'; - if ($instd_chk eq 'ok') { - $response .= &mt('You may want to search in the institutional directory instead of the LON-CAPA domain.'); - } - $response .= '

'; - } + $response = ''.$instd_chk.''. + '
'.&mt('You may want to search in the LON-CAPA domain instead of the institutional directory.').'

'; } } if ($response ne '') { @@ -7025,26 +7004,7 @@ sub user_search_result { return ($currstate,$response,$forcenewuser,\%srch_results); } -sub domdirectorysrch_check { - my ($srch) = @_; - my $response; - my %dom_inst_srch = &Apache::lonnet::get_dom('configuration', - ['directorysrch'],$srch->{'srchdomain'}); - my $showdom = &display_domain_info($srch->{'srchdomain'}); - if (ref($dom_inst_srch{'directorysrch'}) eq 'HASH') { - if ($dom_inst_srch{'directorysrch'}{'lcavailable'} eq '0') { - return &mt('LON-CAPA directory search is not available in domain: [_1]',$showdom); - } - if ($dom_inst_srch{'directorysrch'}{'lclocalonly'}) { - if ($env{'request.role.domain'} ne $srch->{'srchdomain'}) { - return &mt('LON-CAPA directory search in domain: [_1] is only allowed for users with a current role in the domain.',$showdom); - } - } - } - return 'ok'; -} - -sub instdirectorysrch_check { +sub directorysrch_check { my ($srch) = @_; my $can_search = 0; my $response;