--- loncom/interface/lonpickuser.pm 2009/08/19 19:57:53 1.3 +++ loncom/interface/lonpickuser.pm 2009/09/06 19:09:54 1.4 @@ -1,7 +1,7 @@ # The LearningOnline Network # Search for a user # -# $Id: lonpickuser.pm,v 1.3 2009/08/19 19:57:53 raeburn Exp $ +# $Id: lonpickuser.pm,v 1.4 2009/09/06 19:09:54 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -71,7 +71,7 @@ sub handler { # Get parameters from query string &Apache::loncommon::get_unprocessed_cgi ($ENV{'QUERY_STRING'},['srchdom','form','udomelement','unameelement','ulastelement', - 'ufirstelement','uemailelement','hideudomelement','coursedom']); + 'ufirstelement','uemailelement','hideudomelement','coursedom','caller']); my $js; if (($env{'form.phase'} eq 'get_user_info') || @@ -89,6 +89,77 @@ function setphase(caller) { // ]]> ENDSP + } elsif ($env{'form.caller'} eq 'checkusername') { + $js = <<"ENDCHK"; + +ENDCHK + } elsif ($env{'form.phase'} eq '') { + $js = <<"ENDSET"; + +ENDSET } my $startargs = {'no_nav_bar' => 1, }; if ($env{'form.phase'} eq 'store_newuser') { @@ -98,9 +169,18 @@ ENDSP my $newlast = $env{'form.newlast'}; my $newemail = $env{'form.newemail'}; $startargs->{'add_entries'} = { onload => 'javascript:gochoose('."'$uname','$udom','$newfirst','$newlast','$newemail'".');' }; + } elsif ($env{'form.caller'} eq 'checkusername') { + $startargs->{'add_entries'} = { onload => 'javascript:checkUser();' }; + } elsif ($env{'form.phase'} eq '') { + $startargs->{'add_entries'} = { onload => 'javascript:setUserSearch();' }; } $r->print(&Apache::loncommon::start_page('Selecting course personnel', $js,$startargs)); + if ($env{'form.caller'} eq 'checkusername') { + $r->print(&check_user_form(). + &Apache::loncommon::end_page()); + return OK; + } my %toset = ( uname => 'unameelement', udom => 'udomelement', @@ -142,12 +222,8 @@ ENDSP my $opener_elems = ''."\n". ''."\n"; - foreach my $item (keys(%toset)) { - if (exists($env{'form.'.$toset{$item}})) { - $opener_elems .= ''."\n"; - } - } + $env{'form.coursedom'}.'" />'."\n". + &set_opener_elems(); unless ($env{'form.phase'} eq 'define_newuser') { $r->print(<<"ENDBLOCK");