#! e:\perl\bin\perl.exe
#
# attendweb.perl: Script to generate British Plate Armour Society (BPA)S attendance web page
# directly from database Will work as CGI or as command line script. If command line writes to file
# defined in variables below, otherwise writes to STDOUT for CGI
#
# Copyright (C) 2004 Craig Nicholas
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program;
# if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA
#
# Craig Nicholas
# Website: www.britishplate.org.uk
use DBI;
use strict;
use CGI qw/:standard *table *center/;
use Carp;
use bpas;
use Win32;
my ($dbConnect,$outputFile,$debug ) =
("DBI:ODBC:BPAS",
"AttendList.htm",
0);
my $showStatement = qq(SELECT ShowID, ShowName, StartDate, EndDate
FROM Shows
ORDER BY StartDate);
my $attendStatement = "
SELECT DISTINCTROW MemberShows.Notes, MemberShows.ExpectedArrival,
MemberShows.PlannedAttendance, MemberShows.PlannedDays,
Membership.Name, Membership.No, Membership.Commandary
FROM Membership RIGHT JOIN MemberShows
ON Membership.No = MemberShows.MembershipNo
WHERE MemberShows.ShowID = ?
ORDER BY Membership.Name";
# global html values
my ($bgColor,$tableWidth,$col1Width,$col2Width,,$col3Width,,$col4Width,,$col5Width,$showTitleFontCol,$listTitleFontCol) =
("#40878E",
"624",
"110",
"86",
"92",
"108",
"208",
"#800000",
"#000080");
my %tableAlign = (align=>"left",
valign=>"top");
my %col1 = (width=>$col1Width);
my %col2 = (width=>$col2Width);
my %col3 = (width=>$col3Width);
my %col4 = (width=>$col4Width);
my %col5 = (width=>$col5Width);
my (%months) = ( "01" => "Jan",
"02" => "Feb",
"03" => "Mar",
"04" => "Apr",
"05" => "May",
"06" => "Jun",
"07" => "Jul",
"08" => "Aug",
"09" => "Sep",
"10" => "Oct",
"11" => "Nov",
"12" => "Dec" );
my ($bCGI, $attendSth, $out, $key);
####################################
# subroutine to write the top, fixed, bit of the web page
####################################
sub WebHeader()
{
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my $genDate = $mday . "/" . ($mon+1) . "/" . ($year+1900);
DbgPrint "WEB HEADER\n";
PrintWeb (start_html({-title=>"BPAS shows Attendance list 2004",
-stylesrc=>"index.htm",
-style=>{'src'=>'bpasstyles.css'},
meta=>{GENERATOR=>'perl CGI',
keywords=>'generated by perl',
description=>'BPAS shows attendance list 2004.
Generated using perl::DBI to extract data from an MS Access database and perl::CGI to generate the web page.
(Craig Nicholas 2003 - craig\@dethorpe.demon.co.uk)'}}));
# BPAS header and page description
PrintWeb (<![BPAS banner [Click to go to home page]](images/BPASbanner.jpg)
This page contains a list shows, and for each show the members who have confirmed they are attending. This feature is an aid to members and organisers in arranging shows, any comments or suggestions welcome.
END ); # Start of attendance table PrintWeb ( start_center(), start_table({border=>"1",bgcolor=>"#FFFFFF",cellspacing=>"0",bordercolor=>$bgColor,width=>$tableWidth})); } #################################### # subroutine to write the bottom, fixed, bit of the web page #################################### sub WebFooter() { DbgPrint "WEB FOOTER\n"; # end of shows table PrintWeb (end_table()); # generated by perl footer PerlFooter($tableWidth); PrintWeb (end_center(),end_html()); } ##################################################### # Subroutine to write an attendance record to the web page ##################################################### sub WebRecord($) { my ($recArr) = shift; # set blank fields to a non-breaking space ( ) foreach (@$recArr) { unless ($_) { $_ = " "; } } my ($notes, $expArrival, $planAttend, $planDays, $name, $no, $commandary ) = @$recArr; $notes =~ s/\n/