version 1.21, 2001/03/15 18:52:17
|
version 1.31, 2001/03/15 19:38:49
|
Line 424 sub advancedsearch {
|
Line 424 sub advancedsearch {
|
my ($r,$envhash)=@_; |
my ($r,$envhash)=@_; |
my %ENV=%{$envhash}; |
my %ENV=%{$envhash}; |
|
|
|
$r->print(<<END); |
|
Advanced searching is not yet implemented. |
|
END |
|
return OK; |
|
} |
|
|
|
# ---------------------------------------------------- see if a field is filled |
|
sub filled { |
|
my ($field)=@_; |
|
if ($field=~/\S/) { |
|
return 1; |
|
} |
|
else { |
|
return 0; |
|
} |
} |
} |
|
|
# --------------------------------------------------- Performing a basic search |
# --------------------------------------------------- Performing a basic search |
Line 431 sub basicsearch {
|
Line 446 sub basicsearch {
|
my ($r,$envhash)=@_; |
my ($r,$envhash)=@_; |
my %ENV=%{$envhash}; |
my %ENV=%{$envhash}; |
|
|
|
unless (&filled($ENV{'form.basicexp'})) { |
|
&output_blank_field_error($r); |
|
return OK; |
|
} |
|
|
my $query=$ENV{'form.basicexp'}; |
my $query=$ENV{'form.basicexp'}; |
$query="select * from metadata where concat(title,\" \",author) like '\%$ENV{'form.basicexp'}\%'"; |
$query="select * from metadata where concat(title,\" \",author) like '\%$ENV{'form.basicexp'}\%'"; |
my $reply=&Apache::lonnet::metadata_query($query); |
my $reply=&Apache::lonnet::metadata_query($query); |
Line 438 sub basicsearch {
|
Line 458 sub basicsearch {
|
return OK; |
return OK; |
} |
} |
|
|
|
sub output_blank_field_error { |
|
my ($r)=@_; |
|
# make query information persistent to allow for subsequent revision |
|
my $persistent=''; |
|
map { |
|
if (/^form\./ && !/submit/) { |
|
my $name=$_; |
|
my $key=$name; |
|
$name=~s/^form\.//; |
|
$persistent.=<<END; |
|
<INPUT TYPE='hidden' NAME='$name' VALUE='$ENV{$key}'> |
|
END |
|
} |
|
} (keys %ENV); |
|
|
|
$r->print(<<BEGINNING); |
|
<html> |
|
<head> |
|
<title>The LearningOnline Network with CAPA</title> |
|
BEGINNING |
|
$r->print(<<RESULTS); |
|
</head> |
|
<body bgcolor="#ffffff"> |
|
<img align=right src=/adm/lonIcons/lonlogos.gif> |
|
<h1>Search Catalog</h1> |
|
<form method="post" action="/adm/searchcat"> |
|
$persistent |
|
<input type='button' value='Revise search request' |
|
onClick='this.form.submit();'> |
|
<input type='button' value='CLOSE' |
|
onClick='self.close();'> |
|
<hr> |
|
<h3>Helpful Message</h3> |
|
<p> |
|
Incorrect search query due to blank entry fields. |
|
You need to fill in the relevant |
|
fields on the search page in order for a query to be |
|
processed. |
|
</p> |
|
</body> |
|
</html> |
|
RESULTS |
|
} |
|
|
# ----------------------------- format and output results based on a reply list |
# ----------------------------- format and output results based on a reply list |
sub output_results { |
sub output_results { |
my ($r,$envhash,@replylist)=@_; |
my ($r,$envhash,@replylist)=@_; |