--- loncom/interface/loncreateuser.pm 2007/07/30 00:31:27 1.162 +++ loncom/interface/loncreateuser.pm 2007/07/31 18:58:07 1.164 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.162 2007/07/30 00:31:27 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.164 2007/07/31 18:58:07 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1307,15 +1307,13 @@ sub update_user_data { $r->print($error.&mt('Invalid login mode or password').$end); return; } + + + $r->print('

'.&mt('User [_1] in domain [_2]', + $env{'form.ccuname'}, $env{'form.ccdomain'}).'

'); + if ($env{'form.makeuser'}) { - # Create a new user - my %lt=&Apache::lonlocal::texthash( - 'cru' => "Creating user", - 'id' => "in domain" - ); - $r->print(<$lt{'cru'} "$env{'form.ccuname'}" $lt{'id'} "$env{'form.ccdomain'}" -ENDNEWUSERHEAD + $r->print('

'.&mt('Creating new account.').'

'); # Check for the authentication mode and password if (! $amode || ! $genpwd) { $r->print($error.&mt('Invalid login mode or password').$end); @@ -1348,13 +1346,6 @@ ENDNEWUSERHEAD } elsif (($env{'form.login'} ne 'nochange') && ($env{'form.login'} ne '' )) { # Modify user privileges - my %lt=&Apache::lonlocal::texthash( - 'usr' => "User", - 'id' => "in domain" - ); - $r->print(<$lt{'usr'} "$env{'form.ccuname'}" $lt{'id'} "$env{'form.ccdomain'}" -ENDMODIFYUSERHEAD if (! $amode || ! $genpwd) { $r->print($error.'Invalid login mode or password'.$end); return; @@ -1518,16 +1509,11 @@ END # They did not want to change the users name but we can # still tell them what the name is my %lt=&Apache::lonlocal::texthash( - 'usr' => "User", - 'id' => "in domain", - 'gen' => "Generation", 'mail' => "Permanent e-mail", 'disk' => "Disk space allocated to user's portfolio files", ); $r->print(<<"END"); -

$lt{'usr'} "$env{'form.ccuname'}" $lt{'id'} "$env{'form.ccdomain'}"

-

$userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'}

-

$lt{'gen'}: $userenv{'generation'}

+

$userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'} $userenv{'generation'}

$lt{'mail'}: $userenv{'permanentemail'}

END if ($putresult eq 'ok') { @@ -1755,7 +1741,7 @@ END } # End of foreach (keys(%env)) # Flush the course logs so reverse user roles immediately updated &Apache::lonnet::flushcourselogs(); - $r->print('

Create/Modify Another User

'); + $r->print('

'.&mt('Create/Modify Another User').'

'); $r->print('
'."\n"); foreach my $item ('srchby','srchin','srchtype','srchterm','srchdomain','ccuname','ccdomain') { $r->print(''."\n"); @@ -2136,7 +2122,6 @@ sub handler { if ($env{'form.phase'} eq 'get_user_info') { my ($state,$response,$forcenewuser,$results) = &user_search_result($srch); - print STDERR "Got $state,$response,$forcenewuser\n"; if ($state eq 'select') { &print_user_selection_page($r,$response,$srch,$results); } elsif ($state eq 'modify') { @@ -2183,7 +2168,6 @@ sub handler { #-------------------------------------------------- functions for &phase_two sub user_search_result { my ($srch) = @_; - my @alldomains = sort(&Apache::lonnet::all_domains()); my %allhomes; my %inst_matches; my %srch_results; @@ -2203,7 +2187,7 @@ sub user_search_result { } if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'instd')) { if (($srch->{'srchdomain'} eq '') || - (!(grep/^\Q$srch->{'srchdomain'}\E$/,@alldomains))) { + ! (&Apache::lonnet::domain($srch->{'srchdomain'}))) { $response = &mt('You must specify a valid domain when searching in a domain or institutional directory.') } } @@ -2220,7 +2204,7 @@ sub user_search_result { } } if ($response ne '') { - return ($state,$response); + return ($state,''.$response.''); } if ($srch->{'srchby'} eq 'uname') { if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs')) { @@ -2345,11 +2329,11 @@ sub directorysrch_check { ['directorysrch'],$srch->{'srchdomain'}); if (ref($dom_inst_srch{'directorysrch'}) eq 'HASH') { if (!$dom_inst_srch{'directorysrch'}{'available'}) { - return &mt('Directory search unavailable in domain: [_1]',$srch->{'srchdomain'}); + return &mt('Institutional directory search unavailable in domain: [_1]',$srch->{'srchdomain'}); } if ($dom_inst_srch{'directorysrch'}{'localonly'}) { if ($env{'request.role.domain'} ne $srch->{'srchdomain'}) { - return &mt('Directory search in domain: [_1] is only allowed for users with a current role in the domain.',$srch->{'srchdomain'}); + return &mt('Insitutional directory search in domain: [_1] is only allowed for users with a current role in the domain.',$srch->{'srchdomain'}); } my @usertypes = split(/:/,$env{'environment.inststatus'}); if (!@usertypes) { @@ -2445,7 +2429,7 @@ sub build_search_response { $state = 'modify'; $response = &mt("$single{$srch->{'srchtype'}} was found for this $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}.",$srch->{'srchterm'}); } else { - $response = &mt("$nomatch{$srch->{'srchtype'}} found for this $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}.",$srch->{'srchterm'}); + $response = ''.&mt("$nomatch{$srch->{'srchtype'}} found for this $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}.",$srch->{'srchterm'}).''; if ($srch->{'srchin'} ne 'alc') { $forcenewuser = 1; my $cansrchinst = 0; @@ -2467,7 +2451,7 @@ sub build_search_response { } } } - $response .= '
'.&mt("To add as a new user:").'
  • '.&mt("Enter the proposed username in the 'Search for' box").'
  • '.&mt("Set 'Make new user if no match found' to Yes").'
  • '.&mt("Click 'Search'").'
'.&mt("Note: you can only create new users in the domain of your current role -".$env{'request.role.domain'}).'

'; + $response .= '
'.&mt("To add as a new user:").'
  • '.&mt("Enter the proposed username in the 'Search for' box").'
  • '.&mt("Set 'Make new user if no match found' to Yes").'
  • '.&mt("Click 'Search'").'
'.&mt("Note: you can only create new users in the domain of your current role - [_1]",$env{'request.role.domain'}).'

'; } } }