version 1.110, 2001/12/11 03:18:39
|
version 1.113, 2001/12/17 00:56:48
|
Line 28
|
Line 28
|
# YEAR=2001 |
# YEAR=2001 |
# 3/8, 3/12, 3/13, 3/14, 3/15, 3/19 Scott Harrison |
# 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 |
# 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,12/10 Scott Harrison |
# 10/12,10/14,10/15,10/16,11/28,11/29,12/10,12/12,12/16 Scott Harrison |
# |
# |
### |
### |
|
|
Line 54 use Apache::File();
|
Line 54 use Apache::File();
|
use CGI qw(:standard); |
use CGI qw(:standard); |
use Text::Query; |
use Text::Query; |
use GDBM_File; |
use GDBM_File; |
|
use Apache::loncommon(); |
|
|
# ---------------------------------------- variables used throughout the module |
# ---------------------------------------- variables used throughout the module |
|
|
# -- information holders |
# -- information holders |
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 %hostdomains; # matches host name to host domain |
my %hostips; # matches host name to host ip |
my %hostips; # matches host name to host ip |
my %hitcount; # stores number of hits per host |
my %hitcount; # stores number of hits per host |
Line 98 END
|
Line 96 END
|
|
|
# ----------------------------------------------------------------------- BEGIN |
# ----------------------------------------------------------------------- BEGIN |
sub BEGIN { |
sub BEGIN { |
# --------------------------------- Compute various listings of metadata values |
|
$language{'any'}='Any language'; |
|
{ |
|
my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}. |
|
'/language.tab'); |
|
while (<$fh>) { |
|
$_=~/(\w+)\s+([\w\s\-]+)/; chomp; |
|
$language{$1}=$2; |
|
} |
|
} |
|
$cprtag{'any'}='Any copyright/distribution'; |
|
{ |
|
my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonIncludes'}. |
|
'/copyright.tab'); |
|
while (<$fh>) { |
|
$_=~/(\w+)\s+([\w\s\-]+)/; chomp; |
|
$cprtag{$1}=$2; |
|
} |
|
} |
|
$mimetag{'any'}='Any type'; |
|
{ |
|
my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}. |
|
'/filetypes.tab'); |
|
while (<$fh>) { |
|
if (/^\S/ and !/^\#/) { |
|
$_=~/(\S+)\s+(\S+)\s+([\S\s\-]+)/; chomp; |
|
$mimetag{$1}=".$1 $3"; |
|
} |
|
} |
|
} |
|
{ |
{ |
my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}. |
my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}. |
'/hosts.tab'); |
'/hosts.tab'); |
Line 235 END
|
Line 203 END
|
|
|
$ENV{'form.mime'}='any' unless length($ENV{'form.mime'}); |
$ENV{'form.mime'}='any' unless length($ENV{'form.mime'}); |
$scrout.=&selectbox('Limit by MIME type','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'}); |
$ENV{'form.language'}='any' unless length($ENV{'form.language'}); |
|
|
$scrout.=&selectbox('Limit by language','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 |
# ------------------------------------------------ Compute date selection boxes |
$scrout.=<<CREATIONDATESTART; |
$scrout.=<<CREATIONDATESTART; |
Line 292 LASTREVISIONDATEEND
|
Line 265 LASTREVISIONDATEEND
|
|
|
$ENV{'form.copyright'}='any' unless length($ENV{'form.copyright'}); |
$ENV{'form.copyright'}='any' unless length($ENV{'form.copyright'}); |
$scrout.=&selectbox('Limit by copyright/distribution','copyright', |
$scrout.=&selectbox('Limit by copyright/distribution','copyright', |
$ENV{'form.copyright'},%cprtag); |
$ENV{'form.copyright'}, |
|
'any','Any copyright/distribution', |
|
\&{Apache::loncommon::copyrightdescription}, |
|
(&Apache::loncommon::copyrightids), |
|
); |
|
|
# ------------------------------------------- Compute customized metadata field |
# ------------------------------------------- Compute customized metadata field |
$scrout.=<<CUSTOMMETADATA; |
$scrout.=<<CUSTOMMETADATA; |
Line 578 END
|
Line 555 END
|
} |
} |
|
|
sub selectbox { |
sub selectbox { |
my ($title,$name,$value,%options)=@_; |
my ($title,$name,$value,$anyvalue,$anytag,$functionref,@idlist)=@_; |
my $uctitle=uc($title); |
my $uctitle=uc($title); |
my $selout="\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:". |
my $selout="\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:". |
"</b></font><br />".'<select name="'.$name.'">'; |
"</b></font><br />".'<select name="'.$name.'">'; |
foreach (sort keys %options) { |
foreach ($anyvalue,@idlist) { |
$selout.='<option value=\''.$_.'\''; |
$selout.='<option value=\''.$_.'\''; |
if ($_ eq $value) { $selout.=' selected'; } |
if ($_ eq $value and !/^any$/) { |
$selout.='>'.$options{$_}.'</option>'; |
$selout.=' selected>'.&{$functionref}($_).'</option>'; |
|
} |
|
elsif ($_ eq $value and /^$anyvalue$/) { |
|
$selout.=' selected>'.$anytag.'</option>'; |
|
} |
|
else {$selout.='>'.&{$functionref}($_).'</option>';} |
} |
} |
return $selout.'</select>'; |
return $selout.'</select>'; |
} |
} |
|
|
|
sub testf { |
|
return @_[0]; |
|
} |
|
|
# ----------------------------------------------- Performing an advanced search |
# ----------------------------------------------- Performing an advanced search |
sub advancedsearch { |
sub advancedsearch { |
my ($r,$envhash)=@_; |
my ($r,$envhash)=@_; |
Line 1333 sub detailed_citation_view {
|
Line 1319 sub detailed_citation_view {
|
<b>Subject:</b> $subject<br /> |
<b>Subject:</b> $subject<br /> |
<b>Keyword(s):</b> $keywords<br /> |
<b>Keyword(s):</b> $keywords<br /> |
<b>Notes:</b> $notes<br /> |
<b>Notes:</b> $notes<br /> |
<b>MIME Type:</b> $mimetag{$mime}<br /> |
<b>MIME Type:</b> |
<b>Language:</b> $language{$lang}<br /> |
END |
<b>Copyright/Distribution:</b> $cprtag{$copyright}<br /> |
$result.=&Apache::loncommon::filedescription($mime); |
|
$result.=<<END; |
|
<br /> |
|
<b>Language:</b> |
|
END |
|
$result.=&Apache::loncommon::languagedescription($lang); |
|
$result.=<<END; |
|
<br /> |
|
<b>Copyright/Distribution:</b> |
|
END |
|
$result.=&Apache::loncommon::copyrightdescription($copyright); |
|
$result.=<<END; |
|
<br /> |
</p> |
</p> |
$extrashow |
$extrashow |
<p> |
<p> |
Line 1351 sub summary_view {
|
Line 1349 sub summary_view {
|
$notes,$shortabstract,$mime,$lang, |
$notes,$shortabstract,$mime,$lang, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$hostname,$httphost,$extrashow)=@_; |
$hostname,$httphost,$extrashow)=@_; |
|
my $cprtag=&Apache::loncommon::copyrightdescription($copyright); |
my $result=<<END; |
my $result=<<END; |
<a href="http://$httphost$url" TARGET='search_preview'>$author</a><br /> |
<a href="http://$httphost$url" TARGET='search_preview'>$author</a><br /> |
$title<br /> |
$title<br /> |
$owner -- $lastrevisiondate<br /> |
$owner -- $lastrevisiondate<br /> |
$cprtag{$copyright}<br /> |
$cprtag<br /> |
$extrashow |
$extrashow |
</p> |
</p> |
END |
END |
Line 1368 sub fielded_format_view {
|
Line 1367 sub fielded_format_view {
|
$notes,$shortabstract,$mime,$lang, |
$notes,$shortabstract,$mime,$lang, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$hostname,$httphost,$extrashow)=@_; |
$hostname,$httphost,$extrashow)=@_; |
|
my $mimetag=&Apache::loncommon::filedescription($mime); |
|
my $language=&Apache::loncommon::languagedescription($lang); |
|
my $cprtag=&Apache::loncommon::copyrightdescription($copyright); |
my $result=<<END; |
my $result=<<END; |
<b>URL: </b> <A HREF="http://$httphost$url" TARGET='search_preview'>$url</A> |
<b>URL: </b> <A HREF="http://$httphost$url" TARGET='search_preview'>$url</A> |
<br /> |
<br /> |
Line 1376 sub fielded_format_view {
|
Line 1378 sub fielded_format_view {
|
<b>Subject:</b> $subject<br /> |
<b>Subject:</b> $subject<br /> |
<b>Keyword(s):</b> $keywords<br /> |
<b>Keyword(s):</b> $keywords<br /> |
<b>Notes:</b> $notes<br /> |
<b>Notes:</b> $notes<br /> |
<b>MIME Type:</b> $mimetag{$mime}<br /> |
<b>MIME Type:</b> $mimetag<br /> |
<b>Language:</b> $language{$lang}<br /> |
<b>Language:</b> $language<br /> |
<b>Creation Date:</b> $creationdate<br /> |
<b>Creation Date:</b> $creationdate<br /> |
<b>Last Revision Date:</b> $lastrevisiondate<br /> |
<b>Last Revision Date:</b> $lastrevisiondate<br /> |
<b>Publisher/Owner:</b> $owner<br /> |
<b>Publisher/Owner:</b> $owner<br /> |
<b>Copyright/Distribution:</b> $cprtag{$copyright}<br /> |
<b>Copyright/Distribution:</b> $cprtag<br /> |
<b>Repository Location:</b> $hostname<br /> |
<b>Repository Location:</b> $hostname<br /> |
<b>Abstract:</b> $shortabstract<br /> |
<b>Abstract:</b> $shortabstract<br /> |
$extrashow |
$extrashow |
Line 1396 sub xml_sgml_view {
|
Line 1398 sub xml_sgml_view {
|
$notes,$shortabstract,$mime,$lang, |
$notes,$shortabstract,$mime,$lang, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$hostname,$httphost,$extrashow)=@_; |
$hostname,$httphost,$extrashow)=@_; |
|
my $cprtag=&Apache::loncommon::copyrightdescription($copyright); |
|
my $mimetag=&Apache::loncommon::filedescription($mime); |
|
my $language=&Apache::loncommon::languagedescription($lang); |
my $result=<<END; |
my $result=<<END; |
<pre> |
<pre> |
<LonCapaResource> |
<LonCapaResource> |
Line 1407 sub xml_sgml_view {
|
Line 1412 sub xml_sgml_view {
|
<notes>$notes</notes> |
<notes>$notes</notes> |
<mimeInfo> |
<mimeInfo> |
<mime>$mime</mime> |
<mime>$mime</mime> |
<mimetag>$mimetag{$mime}</mimetag> |
<mimetag>$mimetag</mimetag> |
</mimeInfo> |
</mimeInfo> |
<languageInfo> |
<languageInfo> |
<language>$lang</language> |
<language>$lang</language> |
<languagetag>$language{$lang}</languagetag> |
<languagetag>$language</languagetag> |
</languageInfo> |
</languageInfo> |
<creationdate>$creationdate</creationdate> |
<creationdate>$creationdate</creationdate> |
<lastrevisiondate>$lastrevisiondate</lastrevisiondate> |
<lastrevisiondate>$lastrevisiondate</lastrevisiondate> |
<owner>$owner</owner> |
<owner>$owner</owner> |
<copyrightInfo> |
<copyrightInfo> |
<copyright>$copyright</copyright> |
<copyright>$copyright</copyright> |
<copyrighttag>$cprtag{$copyright}</copyrighttag> |
<copyrighttag>$cprtag</copyrighttag> |
</copyrightInfo> |
</copyrightInfo> |
<repositoryLocation>$hostname</repositoryLocation> |
<repositoryLocation>$hostname</repositoryLocation> |
<shortabstract>$shortabstract</shortabstract> |
<shortabstract>$shortabstract</shortabstract> |
Line 1553 This routine is only run once after comp
|
Line 1558 This routine is only run once after comp
|
|
|
=item * |
=item * |
|
|
Initializes %language hash table. |
|
|
|
=item * |
|
|
|
Initializes %cprtag hash table (for copyright.tab). |
|
|
|
=item * |
|
|
|
Initializes %mimetag hash table (for filetypes.tab). |
|
|
|
=item * |
|
|
|
Initializes %hostdomains and hostips hash table (for hosts.tab). |
Initializes %hostdomains and hostips hash table (for hosts.tab). |
|
|
=back |
=back |