--- loncom/interface/lonsearchcat.pm 2001/03/15 14:20:13 1.14
+++ 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
@@ -178,7 +181,7 @@ For author-specific metadata, enter in a
CUSTOMMETADATA
$scrout.=&simpletextfield('custommetadata',$ENV{'form.custommetadata'});
-$scrout.='initial users of this system do not need to worry about this option';
+$scrout.=' initial users of this system do not need to worry about this option';
# ---------------------------------------------------------------- Print screen
$r->print(<';
}
+# ------------------------------------------------ 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.=<
+END
+ }
+ } (keys %ENV);
+
+ $r->print(<
+
+The LearningOnline Network with CAPA
+BEGINNING
+ $r->print(<
+
+
+Search Catalog
+
END
-}
+ }
- unless ($compiledresult) {
- $compiledresult="There were no results that matched your query";
- }
+ unless ($compiledresult) {
+ $compiledresult="There were no results that matched your query";
+ }
- # 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
- }
- } (keys %ENV);
+ }
+ } (keys %ENV);
- $r->print(<print(<
The LearningOnline Network with CAPA
BEGINNING
- $r->print(<
SCRIPT
- $r->print(<print(<
@@ -536,15 +606,14 @@ $persistent
Search Query
-Basic search: $expression
+Basic search: $ENV{'form.basicexp'}
Search Results
$compiledresult
RESULTS
-
- return OK;
+ }
}
1;