version 1.220, 2004/05/03 19:24:14
|
version 1.221, 2004/05/04 15:20:17
|
Line 117 sub handler {
|
Line 117 sub handler {
|
|
|
my $loaderror=&Apache::lonnet::overloaderror($r); |
my $loaderror=&Apache::lonnet::overloaderror($r); |
if ($loaderror) { return $loaderror; } |
if ($loaderror) { return $loaderror; } |
|
# |
my $closebutton; # button that closes the search window |
my $closebutton; # button that closes the search window |
# This button is different for the RAT compared to |
# This button is different for the RAT compared to |
# normal invocation. |
# normal invocation. |
Line 185 sub handler {
|
Line 185 sub handler {
|
bug=>'Searching',}); |
bug=>'Searching',}); |
} |
} |
# |
# |
if (! &get_persistent_form_data($persistent_db_file)) { |
if ($ENV{'form.phase'} !~ m/(basic|adv|course)_search/) { |
if ($ENV{'form.phase'} =~ /(run_search|results)/) { |
if (! &get_persistent_form_data($persistent_db_file)) { |
&Apache::lonnet::logthis("lonsearchcat:Unable to recover data ". |
if ($ENV{'form.phase'} =~ /(run_search|results)/) { |
"from $persistent_db_file"); |
&Apache::lonnet::logthis('lonsearchcat:'. |
$r->print(<<END); |
'Unable to recover data from '. |
|
$persistent_db_file); |
|
$r->print(<<END); |
<html> |
<html> |
<head><title>LON-CAPA Search Error</title></head> |
<head><title>LON-CAPA Search Error</title></head> |
$bodytag |
$bodytag |
Line 198 error and has been logged. Please alert
|
Line 200 error and has been logged. Please alert
|
</body> |
</body> |
</html> |
</html> |
END |
END |
return OK; |
return OK; |
|
} |
} |
} |
|
} else { |
|
&clean_up_environment(); |
} |
} |
## |
## |
## Clear out old values from groupsearch database |
## Clear out old values from groupsearch database |
Line 389 END
|
Line 394 END
|
return OK; |
return OK; |
} |
} |
|
|
|
# |
|
# The mechanism used to store values away and retrieve them does not |
|
# handle the case of missing environment variables being significant. |
|
# |
|
# This routine sets non existant checkbox form elements to ''. |
|
# |
|
sub clean_up_environment { |
|
if ($ENV{'form.phase'} eq 'basic_search') { |
|
if (! exists($ENV{'form.related'})) { |
|
$ENV{'form.related'} = ''; |
|
} |
|
if (! exists($ENV{'form.domains'})) { |
|
$ENV{'form.domains'} = ''; |
|
} |
|
} elsif ($ENV{'form.phase'} eq 'adv_search') { |
|
foreach my $field ('title','keywords','notes', |
|
'abstract','standards','mime') { |
|
if (! exists($ENV{'form.'.$field.'_related'})) { |
|
$ENV{'form.'.$field.'_related'} = ''; |
|
} |
|
} |
|
} elsif ($ENV{'form.phase'} eq 'course_search') { |
|
if (! exists($ENV{'form.crsrelated'})) { |
|
$ENV{'form.crsrelated'} = ''; |
|
} |
|
} |
|
} |
|
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
## |
## |
Line 532 sub print_basic_search_form {
|
Line 565 sub print_basic_search_form {
|
my $userelatedwords= |
my $userelatedwords= |
&mt('[_1] use related words', |
&mt('[_1] use related words', |
&Apache::lonhtmlcommon::checkbox |
&Apache::lonhtmlcommon::checkbox |
('related',$ENV{'form.related'})); |
('related',$ENV{'form.related'},'related')); |
my $onlysearchdomain= |
my $onlysearchdomain= |
&mt('[_1] only search domain [_2]', |
&mt('[_1] only search domain [_2]', |
&Apache::lonhtmlcommon::checkbox |
&Apache::lonhtmlcommon::checkbox('domains', |
('domains',$ENV{'form.domains'}), |
$ENV{'form.domains'}, |
$r->dir_config('lonDefDomain')); |
$r->dir_config('lonDefDomain') |
|
), |
|
$r->dir_config('lonDefDomain') |
|
); |
my $adv_search_link = |
my $adv_search_link = |
'<a href="/adm/searchcat?'. |
'<a href="/adm/searchcat?'. |
'phase=disp_adv&'. |
'phase=disp_adv&'. |
Line 1361 sub parse_domain_restrictions {
|
Line 1397 sub parse_domain_restrictions {
|
my $libraries_to_query = undef; |
my $libraries_to_query = undef; |
# $ENV{'form.domains'} can be either a scalar or an array reference. |
# $ENV{'form.domains'} can be either a scalar or an array reference. |
# We need an array. |
# We need an array. |
if (! exists($ENV{'form.domains'})) { |
if (! exists($ENV{'form.domains'}) || $ENV{'form.domains'} eq '') { |
return (undef,''); |
return (undef,''); |
} |
} |
my @allowed_domains; |
my @allowed_domains; |