--- loncom/interface/loncreateuser.pm 2007/08/31 03:21:27 1.180
+++ loncom/interface/loncreateuser.pm 2007/08/31 12:33:32 1.181
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.180 2007/08/31 03:21:27 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.181 2007/08/31 12:33:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -699,12 +699,14 @@ ENDFORMINFO
if (($instsrch->{'srchterm'} ne '') && ($instsrch->{'srchdomain'} ne '')) {
$newuser = $instsrch->{'srchterm'}.':'.$instsrch->{'srchdomain'};
}
- my (%dirsrch_results,%inst_results);
+ my (%dirsrch_results,%inst_results,$dirsrchres);
if ($newuser) {
if (&directorysrch_check($instsrch) eq 'ok') {
- %dirsrch_results = &Apache::lonnet::inst_directory_query($instsrch);
- if (ref($dirsrch_results{$newuser}) eq 'HASH') {
- %inst_results = %{$dirsrch_results{$newuser}};
+ ($dirsrchres,%dirsrch_results) = &Apache::lonnet::inst_directory_query($instsrch);
+ if ($dirsrchres eq 'ok') {
+ if (ref($dirsrch_results{$newuser}) eq 'HASH') {
+ %inst_results = %{$dirsrch_results{$newuser}};
+ }
}
}
}
@@ -2211,7 +2213,7 @@ sub user_search_result {
my %allhomes;
my %inst_matches;
my %srch_results;
- my ($response,$currstate,$forcenewuser);
+ my ($response,$currstate,$forcenewuser,$dirsrchres);
$srch->{'srchterm'} =~ s/^\s+//;
$srch->{'srchterm'} =~ s/\s+$//;
@@ -2324,9 +2326,18 @@ sub user_search_result {
} elsif ($srch->{'srchin'} eq 'alc') {
$currstate = 'query';
} elsif ($srch->{'srchin'} eq 'instd') {
- %srch_results = &Apache::lonnet::inst_directory_query($srch);
- ($currstate,$response,$forcenewuser) =
- &build_search_response($srch,%srch_results);
+ ($dirsrchres,%srch_results) = &Apache::lonnet::inst_directory_query($srch);
+ if ($dirsrchres eq 'ok') {
+ ($currstate,$response,$forcenewuser) =
+ &build_search_response($srch,%srch_results);
+ } else {
+ my $showdom = &display_domain_info($srch->{'srchdomain'});
+ $response = ''.
+ &mt('Institutional directory search is not available in domain: [_1]',$showdom).
+ '
'.
+ &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.').
+ '
';
+ }
}
} else {
if ($srch->{'srchin'} eq 'dom') {
@@ -2388,9 +2399,17 @@ sub user_search_result {
} elsif ($srch->{'srchin'} eq 'alc') {
$currstate = 'query';
} elsif ($srch->{'srchin'} eq 'instd') {
- %srch_results = &Apache::lonnet::inst_directory_query($srch);
- ($currstate,$response,$forcenewuser) =
- &build_search_response($srch,%srch_results);
+ ($dirsrchres,%srch_results) = &Apache::lonnet::inst_directory_query($srch);
+ if ($dirsrchres eq 'ok') {
+ ($currstate,$response,$forcenewuser) =
+ &build_search_response($srch,%srch_results);
+ } else {
+ my $showdom = &display_domain_info($srch->{'srchdomain'}); $response = ''.
+ &mt('Institutional directory search is not available in domain: [_1]',$showdom).
+ '
'.
+ &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.').
+ '
';
+ }
}
}
return ($currstate,$response,$forcenewuser,\%srch_results);