--- loncom/interface/loncreateuser.pm 2007/10/09 17:33:57 1.188 +++ loncom/interface/loncreateuser.pm 2007/10/11 02:16:25 1.189 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.188 2007/10/09 17:33:57 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.189 2007/10/11 02:16:25 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2408,12 +2408,15 @@ sub handler { my $phase = $env{'form.phase'}; my @search = ('srchterm','srchby','srchin','srchtype','srchdomain'); + + &Apache::loncreateuser::restore_prev_selections(); + my $srch; + foreach my $item (@search) { + $srch->{$item} = $env{'form.'.$item}; + } if (($phase eq 'get_user_info') || ($phase eq 'userpicked')) { - my $srch; - foreach my $item (@search) { - $srch->{$item} = $env{'form.'.$item}; - } + if ($env{'form.phase'} eq 'get_user_info') { my ($currstate,$response,$forcenewuser,$results) = &user_search_result($srch); @@ -2456,7 +2459,7 @@ sub handler { } elsif ($env{'form.phase'} eq 'set_custom_roles') { &set_custom_role($r); } else { - &print_username_entry_form($r); + &print_username_entry_form($r,undef,$srch); } } else { $env{'user.error.msg'}= @@ -2466,6 +2469,17 @@ sub handler { return OK; } +sub restore_prev_selections { + my %saveable_parameters = ('srchby' => 'scalar', + 'srchin' => 'scalar', + 'srchtype' => 'scalar', + ); + &Apache::loncommon::store_settings('user','user_picker', + \%saveable_parameters); + &Apache::loncommon::restore_settings('user','user_picker', + \%saveable_parameters); +} + #-------------------------------------------------- functions for &phase_two sub user_search_result { my ($srch) = @_;