--- loncom/interface/lonsearchcat.pm 2001/03/15 14:31:05 1.15
+++ loncom/interface/lonsearchcat.pm 2001/03/15 19:16:42 1.22
@@ -77,7 +77,10 @@ END
}
if ($ENV{'form.basicsubmit'} eq 'SEARCH') {
- return &basicsearch($r,$ENV{'form.basicexp'});
+ return &basicsearch($r,\%ENV);
+ }
+ elsif ($ENV{'form.advancedsubmit'} eq 'SEARCH') {
+ return &advancedsearch($r,\%ENV);
}
$scrout=''; # building a part of screen output
@@ -416,55 +419,122 @@ sub selectbox {
return $selout.'';
}
+# ------------------------------------------------ Performing a advanced search
+sub advancedsearch {
+ my ($r,$envhash)=@_;
+ my %ENV=%{$envhash};
+
+ return <<(END);
+Advanced searching is not yet implemented.
+END
+
+}
+
# --------------------------------------------------- Performing a basic search
sub basicsearch {
- my ($r,$expression)=@_;
+ my ($r,$envhash)=@_;
+ my %ENV=%{$envhash};
+
+ &output_blank_field_error($r) unless length($ENV{'form.basicexp'});
- my $query=$expression;
- $query="select * from metadata where concat(title,\" \",author) like '\%$expression\%'";
-# my $reply=&Apache::lonnet::reply("querysend:$query",'msul3');
+ my $query=$ENV{'form.basicexp'};
+ $query="select * from metadata where concat(title,\" \",author) like '\%$ENV{'form.basicexp'}\%'";
my $reply=&Apache::lonnet::metadata_query($query);
+ &output_results($r,$envhash,$reply);
+ return OK;
+}
- my @results;
+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.=<Search Catalog
+
-Basic search: $expression +Basic search: $ENV{'form.basicexp'}