--- loncom/interface/lonsearchcat.pm 2001/03/08 13:32:04 1.2
+++ loncom/interface/lonsearchcat.pm 2001/03/08 16:45:22 1.3
@@ -8,12 +8,609 @@ package Apache::lonsearchcat;
use strict;
use Apache::Constants qw(:common);
+my %language;
+my $scrout;
+my %metadatafields;
+my %cprtag;
+my %mimetag;
+
sub handler {
my $r = shift;
$r->content_type('text/html');
$r->send_http_header;
return OK if $r->header_only;
+ %metadatafields=();
+
+# ------------------------------------------------ First, check out environment
+ $metadatafields{'owner'}=$ENV{'user.name'}.'@'.$ENV{'user.domain'};
+
+
+ %language=();
+ $language{'any'}='Any language';
+ {
+ my $fh=Apache::File->new($r->dir_config('lonTabDir').'/language.tab');
+ map {
+ $_=~/(\w+)\s+([\w\s\-]+)/;
+ $language{$1}=$2;
+ } <$fh>;
+ }
+
+ %cprtag=();
+ $cprtag{'any'}='Any copyright/distribution';
+ {
+ my $fh=Apache::File->new($r->dir_config('lonIncludes').'/copyright.tab');
+ map {
+ $_=~/(\w+)\s+([\w\s\-]+)/;
+ $cprtag{$1}=$2;
+ } <$fh>;
+ }
+
+ %mimetag=();
+ $mimetag{'any'}='Any type';
+ {
+ my $fh=Apache::File->new($r->dir_config('lonTabDir').'/filetypes.tab');
+ map {
+ $_=~/(\w+)\s+(\w+)\s+([\w\s\-]+)/;
+ $mimetag{$1}=".$1 $3";
+ } <$fh>;
+ }
+
+ $scrout="";
+ $scrout.=&searchphrasefield('Limit by title','title',
+ '');
+
+ $scrout.=&searchphrasefield('Limit by author','author',
+ '');
+
+ $scrout.=&searchphrasefield('Limit by subject','subject',
+ '');
+
+ $scrout.=&searchphrasefield('Limit by notes','notes',
+ '');
+
+ $scrout.=&searchphrasefield('Limit by abstract','abstract',
+ '');
+
+ $scrout.=&selectbox('Limit by MIME type','mime',
+ 'notxxx',%mimetag);
+
+ $scrout.=&selectbox('Limit by language','language',
+ 'any',%language);
+
+ $scrout.=<
+LIMIT BY CREATION DATE RANGE:
+
+
+between:
+
+
+and:
+
+
+
+CREATIONDATEEND
+
+ $scrout.=<
+LIMIT BY LAST REVISION DATE RANGE:
+
+
between:
+
+
+and:
+
+
+
+LASTREVISIONDATEEND
+
+ $scrout.=&searchphrasefield('Limit by publisher/owner','owner',
+ $metadatafields{'owner'});
+
+ $scrout.=&selectbox('Limit by copyright/distribution','copyright',
+ 'any',%cprtag);
+
# ---------------------------------------------------------------- Print screen
$r->print(<
@@ -22,43 +619,66 @@ sub handler {
Search Catalog
-
ENDDOCUMENT
return OK;
}
+# --------------------------------------------------------- Various form fields
+
+sub textfield {
+ my ($title,$name,$value)=@_;
+ return "\n$title:
".
+ '';
+}
+
+sub searchphrasefield {
+ my ($title,$name,$value)=@_;
+ my $instruction=<$uctitle:".
+ ": $instruction
".
+ '';
+}
+
+sub selectbox {
+ my ($title,$name,$value,%options)=@_;
+ my $uctitle=uc($title);
+ my $selout="\n$uctitle:".
+ "
".'';
+}
+
1;
__END__