version 1.175, 2003/05/30 20:54:28
|
version 1.179, 2003/06/16 19:42:02
|
Line 82 use Text::Query;
|
Line 82 use Text::Query;
|
use GDBM_File; |
use GDBM_File; |
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lonmysql(); |
use Apache::lonmysql(); |
use Apache::lonmenu(); |
|
|
|
# ---------------------------------------- variables used throughout the module |
# ---------------------------------------- variables used throughout the module |
|
|
Line 215 sub handler {
|
Line 214 sub handler {
|
## Initialize global variables |
## Initialize global variables |
## |
## |
my $domain = $r->dir_config('lonDefDomain'); |
my $domain = $r->dir_config('lonDefDomain'); |
$diropendb= "/home/httpd/perl/tmp/".&Apache::lonnet::escape($domain). |
$diropendb= "/home/httpd/perl/tmp/$ENV{'user.domain'}_$ENV{'user.name'}_searchcat.db"; |
"\_".&Apache::lonnet::escape($ENV{'user.name'})."_searchcat.db"; |
|
# |
# |
# set the name of the persistent database |
# set the name of the persistent database |
# $ENV{'form.persistent_db_id'} can only have digits in it. |
# $ENV{'form.persistent_db_id'} can only have digits in it. |
Line 1500 sub parse_basic_search {
|
Line 1498 sub parse_basic_search {
|
} |
} |
# Build SQL query string based on form page |
# Build SQL query string based on form page |
my $query=''; |
my $query=''; |
my $concatarg=join('," ",', |
my $concatarg=join(',', |
('title', 'author', 'subject', 'notes', 'abstract', |
('title', 'author', 'subject', 'notes', 'abstract', |
'keywords')); |
'keywords')); |
$concatarg='title' if $ENV{'form.titleonly'}; |
$concatarg='title' if $ENV{'form.titleonly'}; |
$query=&build_SQL_query('concat('.$concatarg.')',$search_string); |
$query=&build_SQL_query('concat_ws(" ",'.$concatarg.')',$search_string); |
$pretty_search_string .= "<br />\n"; |
$pretty_search_string .= "<br />\n"; |
return 'select * from metadata where '.$query,$pretty_search_string; |
return 'SELECT * FROM metadata WHERE '.$query,$pretty_search_string; |
} |
} |
|
|
|
|
Line 1623 sub recursive_SQL_query_build {
|
Line 1621 sub recursive_SQL_query_build {
|
my ($key,$value)=($1,$2); |
my ($key,$value)=($1,$2); |
my $replacement=''; |
my $replacement=''; |
if ($key eq 'literal') { |
if ($key eq 'literal') { |
$replacement="($dkey like \"\%$value\%\")"; |
$replacement="($dkey LIKE \"\%$value\%\")"; |
} elsif ($key eq 'not') { |
} elsif (lc($key) eq 'not') { |
$value=~s/like/not like/; |
$value=~s/LIKE/NOT LIKE/; |
# $replacement="($dkey not like $value)"; |
# $replacement="($dkey not like $value)"; |
$replacement="$value"; |
$replacement="$value"; |
} elsif ($key eq 'and') { |
} elsif ($key eq 'and') { |
Line 2132 END
|
Line 2130 END
|
my $time_remaining = $max_time - (time - $starttime) ; |
my $time_remaining = $max_time - (time - $starttime) ; |
my $last_time = $time_remaining; |
my $last_time = $time_remaining; |
&update_seconds($r,$time_remaining); |
&update_seconds($r,$time_remaining); |
|
&update_status($r,'contacting '.$Servers_to_contact[0]); |
while (($time_remaining > 0) && |
while (($time_remaining > 0) && |
((@Servers_to_contact) || keys(%Server_status))) { |
((@Servers_to_contact) || keys(%Server_status))) { |
# Send out a search request if it needs to be done. |
# Send out a search request if it needs to be done. |
Line 2370 sub display_results {
|
Line 2369 sub display_results {
|
."</center>\n" |
."</center>\n" |
); |
); |
if ($total_results == 0) { |
if ($total_results == 0) { |
$r->print("There are currently no results.\n". |
$r->print("<h3>There are currently no results.</h3>Please try to reload this page, which will update the display.\n". |
"</form></body></html>"); |
"</form></body></html>"); |
return; |
return; |
} else { |
} else { |
Line 2755 sub print_frames_interface {
|
Line 2754 sub print_frames_interface {
|
"&persistent_db_id=".$ENV{'form.persistent_db_id'}; |
"&persistent_db_id=".$ENV{'form.persistent_db_id'}; |
my $run_search_link = $basic_link."&phase=run_search"; |
my $run_search_link = $basic_link."&phase=run_search"; |
my $results_link = &results_link(); |
my $results_link = &results_link(); |
my $loadevents=&Apache::lonmenu::loadevents(); |
|
my $unloadevents=&Apache::lonmenu::unloadevents(); |
|
my $addscript=&Apache::lonmenu::registerurl(); |
|
my $result = <<"ENDFRAMES"; |
my $result = <<"ENDFRAMES"; |
<html> |
<html> |
<head> |
<head> |
Line 2765 sub print_frames_interface {
|
Line 2761 sub print_frames_interface {
|
var targetwin = opener; |
var targetwin = opener; |
var queue = ''; |
var queue = ''; |
</script> |
</script> |
$addscript |
|
<title>LON-CAPA Digital Library Search Results</title> |
<title>LON-CAPA Digital Library Search Results</title> |
</head> |
</head> |
<frameset rows="150,*" onLoad="$loadevents" onUnload="$unloadevents"> |
<frameset rows="150,*"> |
<frame name="statusframe" src="$run_search_link"> |
<frame name="statusframe" src="$run_search_link"> |
<frame name="resultsframe" src="$results_link"> |
<frame name="resultsframe" src="$results_link"> |
</frameset> |
</frameset> |