home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / skeptic / bibliography / home.cgi < prev    next >
Text File  |  2009-08-26  |  2KB  |  79 lines

  1. #!/usr/bin/perl
  2.  
  3. # $rcs = ' $Id: home.cgi,v 1.4 1998/06/20 07:15:03 fitz Exp $ ' ;
  4.  
  5. # Default title - will be overwritten by category name
  6. $title = "Home Page";
  7.  
  8. unshift(@INC, "lib");
  9.  
  10. require 'config.pl';
  11. require 'bib.pl';
  12. require 'web.pl';
  13.  
  14. print "Content-type: text/html\n\n";
  15.  
  16. &bib::load("CATEGORY", "KEYWORDS", "TITLE", "AUTHOR", "META");
  17.  
  18. # Get the categories
  19. @categories = &bib::get_categories();
  20. &error($bib::error) unless defined @categories;
  21.  
  22. # Get the keywords
  23. @keywords = &bib::get_keywords(1);
  24. &error($bib::error) unless defined @keywords;
  25.  
  26. # Get the keyword modifiers
  27. @modifiers = &bib::get_modifiers();
  28. &error($bib::error) unless defined @modifiers;
  29.  
  30. # Construct a list of all titles
  31. foreach $category (@categories)
  32. {
  33.     $CATEGORY = uc($category);
  34.     $cats .= ", " if $cats;
  35.     $cats .= sprintf("<A HREF=%s>%s</A>", "$bib::cgi/home.cgi/$category", $CATEGORY);
  36. }
  37.  
  38. # Get the category from the URL name
  39. ($category = $ENV{PATH_INFO}) =~ s!.*home.cgi/?!!;
  40.  
  41. if ($category)
  42. {
  43.     $CATEGORY = uc($category);
  44.     $title = "$CATEGORY";
  45.     $heading = "Category: <A HREF=$bib::cgi/home.cgi/$category>$CATEGORY</A>";
  46.  
  47.     $all .= sprintf("<H2>%s</H2>\n", $CATEGORY);
  48.     $all .= "<UL>\n";
  49.     foreach $id (sort bib::id_by_title &bib::get_ids_in_category($category))
  50.     {
  51.         $series .= "$id,";
  52.         next if $bib::db{$id}->{META} =~ /submit|delete/;
  53.  
  54.         $all .= "<LI> " . &bib::link_to_id($id);
  55.     }
  56.     $all .= "</UL>\n";
  57. }
  58.  
  59. # Convert the categories, keywords, and modifiers to HTML option list
  60. grep(s/.*/<OPTION>$&\n/, @categories);
  61. grep(s/.*/<OPTION>$&\n/, @keywords);
  62. grep(s/.*/<OPTION>$&\n/, @modifiers);
  63.  
  64. # Create the HTML page
  65. $data= &bib::template("home.html",
  66.                       "CATEGORIES", "@categories",
  67.                       "KEYWORDS", "@keywords",
  68.                       "MODIFIERS", "@modifiers",
  69.                       "CATS", $cats,
  70.                       "TITLE", $title,
  71.                       "HEADING", &untaint($heading),
  72.                       "ALL", $all,
  73.                       "SERIES", $series,);
  74.  
  75. print &bib::template("basic.html",
  76.                      "TITLE", $title,
  77.                      "DATA", $data,);
  78. exit 0;
  79.