home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
linuxmafia.com 2016
/
linuxmafia.com.tar
/
linuxmafia.com
/
pub
/
skeptic
/
bibliography
/
display2.cgi
< prev
next >
Wrap
Text File
|
2009-08-26
|
2KB
|
91 lines
#!/usr/bin/perl
# Given an ID, displays a single entry from the bibliography.
# The ID must be part of the URL, for example:
# /cgi-bin/display.cgi/ID
unshift(@INC, "lib");
require 'config.pl';
require 'db.pl';
require 'web.pl';
require 'cgi-lib.pl';
print "Content-type: text/html\n\n";
&ReadParse();
if ($in{id})
{
$id = $in{id};
}
elsif ($in{next_submit} && $in{next})
{
$id = $in{next};
}
elsif ($in{previous_submit} && $in{previous})
{
$id = $in{previous};
}
else
{
($id = $ENV{PATH_INFO}) =~ s!.*/!!;
&error("Bibliography ID must be specified as part of the URL.") unless $id;
}
(%entry) = &db::read_entry($id);
&error("Error reading bibliography entry for ID '$id': $db::error")
unless defined %entry;
foreach $keyword (sort {uc($a) cmp uc($b)} split(/\s+/, $entry{KEYWORDS}))
{
push(@keywords, $keyword);
}
$entry{KEYWORDS} = join(', ', @keywords);
($entry{TITLE2} = $entry{TITLE}) =~ s/\W+/ /g;
if ($entry{URL})
{
$entry{TITLE} = &hotlink($entry{URL}, $entry{TITLE});
}
foreach (split(/,/, $in{series}))
{
if ($need_next)
{
$next = "<INPUT TYPE=hidden NAME=next VALUE=$_>\n";
$next .= "<INPUT TYPE=submit NAME=next_submit VALUE=Next>";
last;
}
if ($id eq $_)
{
$need_next = 1;
next;
}
$previous = "<INPUT TYPE=hidden NAME=previous VALUE=$_>\n";
$previous .= "<INPUT TYPE=submit NAME=previous_submit VALUE=Previous>";
}
$entry .= &bib::template("entry3.html",
"NEXT", $next,
"PREVIOUS", $previous,
"SERIES", $in{series},
%entry)
if ($next || $previous);
$entry .= &bib::template("entry.html",
"ID", $id,
%entry);
$entry .= &bib::template("entry2.html",
"ID", $id,
%entry);
print &bib::template("basic.html",
"TITLE", $entry{TITLE2},
"DATA", $entry);
exit 0;