#!/usr/bin/perl
#
# Original script written by Joel Hahn, 1997; modified 1998, 1999.

# Get the input
$buffer=$ENV{'QUERY_STRING'};

$file=$buffer;

# Check for which product line was selected
if ($file eq "jg") {
 $part=", part 1";
}
elsif ($file eq "jg2") {
 $part=", part 2";
}
else {
 $file="jg";
 $part=", part 1";
}

# Open the datafile, dump all of the data into the @LINES array
open(FILEDAT,"$file.dat") || die "Can't Open $file.dat: $!\n";
@LINES=<FILEDAT>;
close(FILEDAT);
$SIZE=@LINES;

# Start printing the form page
print "Content-Type: text/html\n\n";
print "<html><head><title>Rate Judges Guild Products$part</title></head>\n";
print "<body text=#000000 bgcolor=#FFFFFF>\n";
print "<h1>Rate Judges Guild Products$part</h1>\n";
print "<p>\n";
print "Below is a list of the known products Judges Guild published that were\n";
print "compatible with TSR's AD&amp;D game.  Please rate the products you are\n";
print "familiar with from 0 (awful) to 10 (superb).  If you do not wish to\n";
print "vote for a particular product, either leave those buttons blank or\n";
print "vote 'N/A'</i>\n";
print "<p><h5>Notes: This is not an official Judges Guild survey.\n";
print "AD&ampD is a trademark of TSR.  The maintainer of this page is not\n";
print "affiliated with TSR nor the current owner of the Judges Guild\n";
print "in any way.</h5>\n";
#print "<hr>\n";
print "<form method=post action=\"http://www.hahnlibrary.net/rpgs/rate/doratejg.cgi\">\n";
#print "<form method=post action=\"http://hoohoo.ncsa.uiuc.edu/cgi-bin/post-query\">\n";
print "<input type=hidden name=filename value=$file>\n";

# Get the product name, set up the radio buttons, using the product code for
# an identifier
for ($i=0;$i<=$SIZE-1;$i++) {
   $_=$LINES[$i];
   ($prodcode, $prodname, $rest)= split(/\|/, $_, 3);
   print "<hr>$prodname<br>\n";
   print "<input type=radio name=$prodcode value=11>N/A\n";
   print "<input type=radio name=$prodcode value=0>0\n";
   print "<input type=radio name=$prodcode value=1>1\n";
   print "<input type=radio name=$prodcode value=2>2\n";
   print "<input type=radio name=$prodcode value=3>3\n";
   print "<input type=radio name=$prodcode value=4>4\n";
   print "<input type=radio name=$prodcode value=5>5\n";
   print "<input type=radio name=$prodcode value=6>6\n";
   print "<input type=radio name=$prodcode value=7>7\n";
   print "<input type=radio name=$prodcode value=8>8\n";
   print "<input type=radio name=$prodcode value=9>9\n";
   print "<input type=radio name=$prodcode value=10>10\n";
#   for ($j=0;$j<=10;$j++) {
#      print "<input type=radio name=$prodcode value=$j>$j\n";
#   }
   print "<p>\n";
}

# Finish printing the form page
print "<p><input type=submit value=\"Send\">\n";
print "<input type=reset value=\"Clear All\">\n";
print "</form>\n";
print "<hr>\n";
print "If you're not interested in voting at this time, you can:<br>\n";
print "Return to the <a href=\"http://www.hahnlibrary.net/rpgs/rate/index.html\">main ratings page</a>.<br>\n";
print "<a href=\"http://www.hahnlibrary.net/rpgs/rate/disratejg.cgi?jg\">View part 1 of the ratings</a>.<br>\n";
print "<a href=\"http://www.hahnlibrary.net/rpgs/rate/disratejg.cgi?jg2\">View part 2 of the ratings</a>.\n";
print "</body></html>";

