home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
linuxmafia.com 2016
/
linuxmafia.com.tar
/
linuxmafia.com
/
pub
/
skeptic
/
bibliography
/
home2.cgi
< prev
next >
Wrap
Text File
|
2009-08-26
|
2KB
|
77 lines
#!/usr/bin/perl
# Default title - will be overwritten by category name
$title = "Home Page";
unshift(@INC, "lib");
require 'config.pl';
require 'bib.pl';
require 'web.pl';
print "Content-type: text/html\n\n";
&bib::load("CATEGORY", "KEYWORDS", "TITLE", "AUTHOR", "META");
# Get the categories
@categories = &bib::get_categories();
&error($bib::error) unless defined @categories;
# Get the keywords
@keywords = &bib::get_keywords(1);
&error($bib::error) unless defined @keywords;
# Get the keyword modifiers
@modifiers = &bib::get_modifiers();
&error($bib::error) unless defined @modifiers;
# Construct a list of all titles
foreach $category (@categories)
{
$CATEGORY = uc($category);
$cats .= ", " if $cats;
$cats .= sprintf("<A HREF=%s>%s</A>", "$bib::cgi/home2.cgi/$category", $CATEGORY);
}
# Get the category from the URL name
($category = $ENV{PATH_INFO}) =~ s!.*/!!;
if ($category)
{
$CATEGORY = uc($category);
$title = "$CATEGORY";
$all .= sprintf("<H2>%s</H2>\n", $CATEGORY);
$all .= "<UL>\n";
foreach $id (sort bib::id_by_title &bib::get_ids_in_category($category))
{
$series .= "$id,";
next if $bib::db{$id}->{META} =~ /submit|delete/;
$all .= "<LI> <A HREF=\"javascript:display($id)\" onMouseOver=\"window.status='Bibliography entry $id';return true\">" .
"$bib::db{$id}->{TITLE}</A>";
$all .= ", $bib::db{$id}->{AUTHOR}"
if $bib::db{$id}->{AUTHOR};
$all .= "\n";
}
$all .= "</UL>\n";
}
# Convert the categories, keywords, and modifiers to HTML option list
grep(s/.*/<OPTION>$&\n/, @categories);
grep(s/.*/<OPTION>$&\n/, @keywords);
grep(s/.*/<OPTION>$&\n/, @modifiers);
# Create the HTML page
print &bib::template("home2.html",
"CATEGORIES", "@categories",
"KEYWORDS", "@keywords",
"MODIFIERS", "@modifiers",
"CATS", $cats,
"TITLE", $title,
"ALL", $all,
"SERIES", $series,);
exit 0;