--- loncom/interface/lonsearchcat.pm 2001/03/08 16:54:20 1.4
+++ loncom/interface/lonsearchcat.pm 2001/03/19 16:45:38 1.41
@@ -3,10 +3,38 @@
#
# 03/08/2001 Scott Harrison
#
+# Functions
+#
+# handler(server reference) : interacts with the Apache server layer
+# (for /adm/searchcat URLs)
+# simpletextfield(name,value) : returns HTML formatted string for simple text
+# field
+# simplecheckbox(name,value) : returns HTML formatted string for simple
+# checkbox
+# searchphrasefield(title,name,value) : returns HTML formatted string for
+# a search expression phrase field
+# dateboxes(name, defaultmonth, defaultday, defaultyear) : returns HTML
+# formatted string
+# for a calendar date
+# selectbox(title,name,value,%HASH=options) : returns HTML formatted string for
+# a selection box field
+# advancedsearch() :
+# filled(field) : determines whether a given field has been filled
+# basicsearch() :
+# output_blank_field_error() : outputs a message saying that more fields need
+# to be filled in
+# output_results() : outputs results from search
+# build_SQL_query() : builds a SQL query string from a logical expression
+# with AND/OR keywords
+
package Apache::lonsearchcat;
use strict;
use Apache::Constants qw(:common);
+use Apache::lonnet();
+use Apache::File();
+use CGI qw(:standard);
+use Text::Query;
my %language;
my $scrout;
@@ -16,15 +44,32 @@ my %mimetag;
sub handler {
my $r = shift;
+
+# -------------------------------------- see if called from an interactive mode
+ map {
+ my ($name, $value) = split(/=/,$_);
+ $value =~ tr/+/ /;
+ $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
+ if ($name eq 'catalogmode') {
+ $ENV{'form.'.$name}=$value;
+ }
+ } (split(/&/,$ENV{'QUERY_STRING'}));
+
$r->content_type('text/html');
$r->send_http_header;
return OK if $r->header_only;
%metadatafields=();
+ my $hidden='';
+ $hidden=<
-between:
-
-
-and:
-
-
-
$title:
".
- '';
+sub simpletextfield {
+ my ($name,$value)=@_;
+ return '';
+}
+
+sub simplecheckbox {
+ my ($name,$value)=@_;
+ my $checked='';
+ $checked="CHECKED" if $value eq 'on';
+ return '';
}
sub searchphrasefield {
@@ -664,10 +277,154 @@ as AND or OR.
END
my $uctitle=uc($title);
return "\n
$uctitle:".
- ": $instruction
".
+ " $instruction
".
'';
}
+sub dateboxes {
+ my ($name,$defaultmonth,$defaultday,$defaultyear,
+ $currentmonth,$currentday,$currentyear)=@_;
+ ($defaultmonth,$defaultday,$defaultyear)=('','','');
+ my $month=<Search Catalog
+