--- loncom/interface/loncommon.pm 2007/07/25 23:20:38 1.554 +++ loncom/interface/loncommon.pm 2007/07/28 21:38:29 1.555 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.554 2007/07/25 23:20:38 albertel Exp $ +# $Id: loncommon.pm,v 1.555 2007/07/28 21:38:29 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -5532,6 +5532,120 @@ sub get_secgrprole_info { return (\@sections,\@groups,$allroles,$rolehash,$accesshash); } +sub user_picker { + my ($dom,$srch,$forcenewuser) = @_; + my $currdom = $dom; + my %curr_selected = ( + srchin => 'dom', + srchby => 'uname', + ); + my $srchterm; + if (ref($srch) eq 'HASH') { + if ($srch->{'srchby'} ne '') { + $curr_selected{'srchby'} = $srch->{'srchby'}; + } + if ($srch->{'srchin'} ne '') { + $curr_selected{'srchin'} = $srch->{'srchin'}; + } + if ($srch->{'srchtype'} ne '') { + $curr_selected{'srchtype'} = $srch->{'srchtype'}; + } + if ($srch->{'srchdomain'} ne '') { + $currdom = $srch->{'srchdomain'}; + } + $srchterm = $srch->{'srchterm'}; + } + + my %lt=&Apache::lonlocal::texthash( + 'usr' => 'Search for', + 'or' => 'or', + 'in' => 'in', + 'doma' => 'domain', + 'uname' => 'username', + 'lastname' => 'last name', + 'lastfirst' => 'last name, first name', + 'crs' => 'this course', + 'dom' => 'this domain', + 'alc' => 'all LON-CAPA', + 'instd' => 'institutional directory', + 'exact' => 'as exact match to', + 'contains' => 'contained in', + ); + my $domform = &select_dom_form($currdom,'srchdomain',1); + + my $srchinsel = ' \n"; + + my $srchbysel = ' \n"; + + my $srchtypesel = ' \n"; + + my $output = <<"END_BLOCK"; + + + + + + + + + + + + + +
$lt{'usr'}: +$srchtypesel + +$srchbysel +
$lt{'in'}: +$srchinsel +
$lt{'doma'}:$domform
+
+END_BLOCK + if ($forcenewuser) { + $output .= ''.&mt('Make new user if no match found: ').''.&mt('Yes').'  '.&mt('No').'
'; + } + return $output; +} + =pod =back