--- loncom/interface/lonsearchcat.pm 2001/11/29 20:33:28 1.108
+++ loncom/interface/lonsearchcat.pm 2001/12/13 14:00:37 1.112
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.108 2001/11/29 20:33:28 harris41 Exp $
+# $Id: lonsearchcat.pm,v 1.112 2001/12/13 14:00:37 harris41 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -28,7 +28,7 @@
# YEAR=2001
# 3/8, 3/12, 3/13, 3/14, 3/15, 3/19 Scott Harrison
# 3/20, 3/21, 3/22, 3/26, 3/27, 4/2, 8/15, 8/24, 8/25 Scott Harrison
-# 10/12,10/14,10/15,10/16,11/28,11/29 Scott Harrison
+# 10/12,10/14,10/15,10/16,11/28,11/29,12/10,12/12 Scott Harrison
#
###
@@ -54,13 +54,14 @@ use Apache::File();
use CGI qw(:standard);
use Text::Query;
use GDBM_File;
+use Apache::loncommon();
# ---------------------------------------- variables used throughout the module
# -- information holders
-my %language; # holds contents of language.tab
-my %cprtag; # holds contents of copyright.tab
-my %mimetag; # holds contents of filetypes.tab
+# my %language; # holds contents of language.tab
+# my %cprtag; # holds contents of copyright.tab
+# my %mimetag; # holds contents of filetypes.tab
my %hostdomains; # matches host name to host domain
my %hostips; # matches host name to host ip
my %hitcount; # stores number of hits per host
@@ -98,44 +99,16 @@ END
# ----------------------------------------------------------------------- BEGIN
sub BEGIN {
-# --------------------------------- Compute various listings of metadata values
- $language{'any'}='Any language';
- {
- my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
- '/language.tab');
- map {
- $_=~/(\w+)\s+([\w\s\-]+)/; chomp;
- $language{$1}=$2;
- } <$fh>;
- }
- $cprtag{'any'}='Any copyright/distribution';
- {
- my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonIncludes'}.
- '/copyright.tab');
- map {
- $_=~/(\w+)\s+([\w\s\-]+)/; chomp;
- $cprtag{$1}=$2;
- } <$fh>;
- }
- $mimetag{'any'}='Any type';
- {
- my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
- '/filetypes.tab');
- map {
- $_=~/(\w+)\s+(\w+)\s+([\w\s\-]+)/; chomp;
- $mimetag{$1}=".$1 $3";
- } <$fh>;
- }
{
my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
'/hosts.tab');
- map {
+ while (<$fh>) {
$_=~/(\w+?)\:(\w+?)\:(\w+?)\:(.*)/; chomp;
if ($3 eq 'library') {
$hostdomains{$1}=$2;
$hostips{$1}=$4;
}
- } <$fh>;
+ }
}
}
@@ -231,15 +204,20 @@ END
$scrout.=&searchphrasefield('Limit by abstract','abstract',
$ENV{'form.abstract'});
- $ENV{'form.mime'}='notxxx' unless length($ENV{'form.mime'});
+ $ENV{'form.mime'}='any' unless length($ENV{'form.mime'});
$scrout.=&selectbox('Limit by MIME type','mime',
- $ENV{'form.mime'},%mimetag);
+ $ENV{'form.mime'},
+ 'any','Any type',
+ \&{Apache::loncommon::filedescriptionex},
+ (&Apache::loncommon::fileextensions));
$ENV{'form.language'}='any' unless length($ENV{'form.language'});
$scrout.=&selectbox('Limit by language','language',
- $ENV{'form.language'},%language);
-
+ $ENV{'form.language'},'any','Any Language',
+ \&{Apache::loncommon::languagedescription},
+ (&Apache::loncommon::languageids),
+ );
# ------------------------------------------------ Compute date selection boxes
$scrout.=<
$uctitle:".
"
".'';
}
+sub testf {
+ return @_[0];
+}
+
# ----------------------------------------------- Performing an advanced search
sub advancedsearch {
my ($r,$envhash)=@_;
@@ -1331,9 +1322,21 @@ sub detailed_citation_view {
Subject: $subject
Keyword(s): $keywords
Notes: $notes
-MIME Type: $mimetag{$mime}
-Language: $language{$lang}
-Copyright/Distribution: $cprtag{$copyright}
+MIME Type:
+END
+ $result.=&Apache::loncommon::filedescription($mime);
+ $result.=<
@@ -1349,11 +1352,12 @@ sub summary_view {
$notes,$shortabstract,$mime,$lang,
$creationdate,$lastrevisiondate,$owner,$copyright,
$hostname,$httphost,$extrashow)=@_;
+ my $cprtag=&Apache::loncommon::copyrightdescription($copyright);
my $result=<
$title
$owner -- $lastrevisiondate
-$cprtag{$copyright}
+$cprtag
$extrashow