# The LearningOnline Network
# Search Catalog
#
# 03/08/2001 Scott Harrison
#
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(<The LearningOnline Network with CAPA