--- loncom/interface/lonsearchcat.pm 2001/03/21 03:15:46 1.57 +++ loncom/interface/lonsearchcat.pm 2001/03/21 12:19:53 1.60 @@ -494,13 +494,44 @@ sub advancedsearch { my @queries; # Go through logical expression AND/OR/NOT phrase fields. - foreach my $field ('title','author','subject','notes','abstract') { + + foreach my $field ('title','author','subject','notes','abstract','url', + 'keywords','version','owner') { if ($ENV{'form.'.$field}) { push @queries,&build_SQL_query($field,$ENV{'form.'.$field}); } } + if ($ENV{'form.language'} and $ENV{'form.language'} ne 'any') { + push @queries,"(language like \"\%$ENV{'form.language'}\%\")"; + } + if ($ENV{'form.mime'} and $ENV{'form.mime'} ne 'any') { + push @queries,"(mime like \"\%$ENV{'form.mime'}\%\")"; + } + if ($ENV{'form.copyright'} and $ENV{'form.copyright'} ne 'any') { + push @queries,"(copyright like \"\%$ENV{'form.copyright'}\%\")"; + } + my $datequery=&build_date_queries( + $ENV{'form.creationdatestart_month'}, + $ENV{'form.creationdatestart_day'}, + $ENV{'form.creationdatestart_year'}, + $ENV{'form.creationdateend_month'}, + $ENV{'form.creationdateend_day'}, + $ENV{'form.creationdateend_year'}, + $ENV{'form.lastrevisiondatestart_month'}, + $ENV{'form.lastrevisiondatestart_day'}, + $ENV{'form.lastrevisiondatestart_year'}, + $ENV{'form.lastrevisiondateend_month'}, + $ENV{'form.lastrevisiondateend_day'}, + $ENV{'form.lastrevisiondateend_year'}, + ); + if ($datequery!~/^Incorrect/) { + push @queries,$datequery; + } + else { + &output_date_error($r,$datequery); + } if (@queries) { - $query=join(" and ",@queries); + $query=join(" AND ",@queries); $query="select * from metadata where $query"; my $reply=&Apache::lonnet::metadata_query($query); &output_results('Advanced',$r,$envhash,$query,$reply); @@ -883,5 +914,52 @@ END return $result; } +sub build_date_queries { + my ($cmonth1,$cday1,$cyear1,$cmonth2,$cday2,$cyear2, + $lmonth1,$lday1,$lyear1,$lmonth2,$lday2,$lyear2)=@_; + + return "Incorrect for some reason."; +} + +sub output_date_error { + my ($r,$message)=@_; + # 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

+
+$persistent + +$closebutton +
+

Helpful Message

+

+$message +

+ + +RESULTS +} + 1; __END__