version 1.2, 2013/05/28 22:07:14
|
version 1.11, 2016/11/03 12:54:10
|
Line 1
|
Line 1
|
#!/usr/bin/perl -wT |
#!/usr/bin/perl -w |
|
|
=begin comment info |
=begin comment info |
+------------------------------------------------------------------------------ |
+------------------------------------------------------------------------------ |
Line 23 use Getopt::Long;
|
Line 23 use Getopt::Long;
|
use Pod::Usage; |
use Pod::Usage; |
use Data::Dumper; |
use Data::Dumper; |
use Calendar::Simple; |
use Calendar::Simple; |
use Date::Calendar::Year qw( :all ); |
use Date::Pcalendar::Year qw( :all ); |
use Date::Calendar::Profiles qw( $Profiles ); |
use Date::Pcalendar::Profiles qw( $Profiles ); |
|
|
|
my $VERSION = '$Id$'; |
my $DEBUG = ""; |
my $DEBUG = ""; |
my $URL = "http://demandred.dyndns.org/cgi-bin/ConnorCalendar/index.cgi"; |
my $URL = "http://demandred.dyndns.org/cgi-bin/ConnorCalendar/index.cgi"; |
my %post_in = ( ); |
my %post_in = ( ); |
my %opts = &fetchOptions( ); |
my %opts = &fetchOptions( ); |
|
my @list = ( ); |
my @months = qw/ January February March April May June July |
my @months = qw/ January February March April May June July |
August September October Novemeber December /; |
August September October November December /; |
my %holidays = ( |
my %holidays = ( |
|
"Easter Sunday" => 'even', |
"Christmas Day" => 'even', |
"Christmas Day" => 'even', |
"Christmas Eve" => 'odd', |
"Christmas Eve" => 'odd', |
"Father's Day" => 'all', |
"Father's Day" => 'all', |
"Independence Day" => 'even', |
"Independence Day" => 'even', |
"Labor Day" => 'even', |
"Labor Day" => 'even', |
"Memorial Day" => 'odd', |
"Memorial Day" => 'odd', |
"New Year's Day" => 'even', |
"New Year's Day" => 'odd', |
"New Year's Eve" => 'odd', |
"New Year's Eve" => 'odd', |
"Thanksgiving Day" => 'odd', |
"Thanksgiving Day" => 'odd', |
); |
); |
Line 48 my %specials = (
|
Line 51 my %specials = (
|
"11/28" => "even", |
"11/28" => "even", |
"5/6" => "odd", |
"5/6" => "odd", |
); |
); |
|
## Change this @weekend to 'qw/ 2011 8 12 /' for original schedule |
|
my @weekend = qw/ 2011 8 19 /; |
|
my %weekends = &calcWeekends( @weekend ); |
|
|
&ReadParse( ); |
&ReadParse( ); |
|
|
my $yr = sprintf( "%d", $post_in{'cy'} ) || ( ( localtime )[5] + 1900 ); |
my $yr = sprintf( "%d", $post_in{'cy'} ) || ( ( localtime )[5] + 1900 ); |
my $YEAR = sprintf( "%d", $yr ); |
my $YEAR = sprintf( "%d", $yr ); |
|
push @list, 'Easter Sunday' if ( $YEAR % 2 == 0 ); |
|
|
print "Content-type: text/html\n\n"; |
print "Content-type: text/html\n\n"; |
print "<html>"; |
print &header( ); |
print "<Title>Calendar Days I Have Connor</title>"; |
print &css( ); |
print "<h1>Calendar for $YEAR</h1>\n"; |
my $year_us = Date::Pcalendar::Year->new( $YEAR, $Profiles->{'US-FL'} ); |
print "</p>Holidays I have Connor are in <font color=red>Red</font>\n</br>"; |
|
print "Today is <font color=blue>Blue</font>\n</br>"; |
|
print "Weekends and special days I have Connor are in <font color=green>Green</font>\n</p>"; |
|
|
|
my $year_us = Date::Calendar::Year->new( $YEAR, $Profiles->{'US-FL'} ); |
|
my @hdays = $year_us->labels( ); |
my @hdays = $year_us->labels( ); |
|
|
$DEBUG = "Holidays for $YEAR:\n"; |
print "<h1><center><a href=\"$URL?cy=" . ( $YEAR - 1 ) . |
foreach ( sort @hdays ) { $DEBUG .= $_ ."\n"; } |
"\"><--</a> " . |
|
"Calendar Days Connor Visits for $YEAR" . |
|
"<a href=\"$URL?cy=" . ( $YEAR + 1 ) . "\"> --></a></h1>"; |
print "<center><a href=\"$URL?cy=" . ( $YEAR - 1 ) . |
|
"\"><--</a> <b>$YEAR</b> " . |
|
"<a href=\"$URL?cy=" . ( $YEAR + 1 ) . "\">--></a></center>"; |
|
my $row = 0; |
my $row = 0; |
print "<table align=center border=1><tr>"; |
print "<table align=center border=0><tr>"; |
for( my $month = 1; $month <= 12; $month++ ) |
for( my $month = 1; $month <= 12; $month++ ) |
{ |
{ |
if ( $row >= 3 ) |
if ( $row >= 3 ) |
Line 93 for( my $month = 1; $month <= 12; $month
|
Line 92 for( my $month = 1; $month <= 12; $month
|
{ |
{ |
my $h_day = ( $year_us->labels( $YEAR, $month, $day ) )[1]; |
my $h_day = ( $year_us->labels( $YEAR, $month, $day ) )[1]; |
if( &IHaveConnor( $h_day ) ) { |
if( &IHaveConnor( $h_day ) ) { |
|
push @list, $h_day; |
print sprintf "<font color=red><b>%2d</b> </font>", $day; |
print sprintf "<font color=red><b>%2d</b> </font>", $day; |
} elsif ( &isSpecial( $YEAR, $month, $day ) || |
} elsif ( &isSpecial( $YEAR, $month, $day ) || |
&isWeekend( $YEAR, $month, $day ) ) { |
&isWeekend( $YEAR, $month, $day ) ) { |
Line 112 for( my $month = 1; $month <= 12; $month
|
Line 112 for( my $month = 1; $month <= 12; $month
|
$row++; |
$row++; |
} |
} |
print "</tr></table>"; |
print "</tr></table>"; |
print "<pre>$DEBUG</pre>"; |
print "<p class=\"Legend\">Holidays I have Connor are in <font color=red>Red</font>\n</br>"; |
|
print "Today is <font color=blue>Blue</font>\n</br>"; |
|
print "Weekends and special days I have Connor are in <font color=green>Green</font>\n</p>"; |
|
|
|
|
|
print "<table width=35% align=center border=0><tr><td>List of Special/Holidays " . |
|
"I have Connor:<br /><p class=Legend>"; |
|
print map { $_ . "<br />\n" } sort @list; |
|
print "</p></td></tr></table>\n"; |
|
print "</pre><p class=\"footer\">Version: <font color=green>$VERSION</font><br />"; |
|
print "CVS: <a target=\"_new\" href=\"http://demandred.dyndns.org/cgi-bin/cvsweb/ConnorCalendar/\">http://demandred.dyndns.org/cgi-bin/cvsweb/ConnorCalendar/</a>"; |
|
print "</center></p>"; |
|
|
|
|
############################################################################### |
############################################################################### |
############################################################################### |
############################################################################### |
Line 141 sub isSpecial
|
Line 153 sub isSpecial
|
|
|
if ( defined $specials{$ref} ) |
if ( defined $specials{$ref} ) |
{ |
{ |
return 1 if ( $specials{$ref} eq "all" || |
if ( $specials{$ref} eq "all" || |
$specials{$ref} eq $yr ); |
$specials{$ref} eq $yr ) { |
|
push @list, $ref; |
|
return 1; |
|
} |
} |
} |
|
|
return 0; |
return 0; |
Line 150 sub isSpecial
|
Line 165 sub isSpecial
|
|
|
sub isWeekend |
sub isWeekend |
{ |
{ |
my $y = shift || return 0; |
my $y = shift || return 0; |
my $m = shift || return 0; |
my $m = shift || return 0; |
my $d = shift || return 0; |
my $d = shift || return 0; |
|
|
|
$m--; |
|
my $ds = sprintf( "$y/$months[$m]/%02d", $d ); |
|
|
|
return 1 if ( defined $weekends{$ds} ); |
|
|
return 0; |
return 0; |
} |
} |
Line 169 sub isToday
|
Line 189 sub isToday
|
return 0; |
return 0; |
} |
} |
|
|
|
sub calcWeekends |
|
{ |
|
my $y = shift; |
|
my $m = shift; |
|
my $d = shift; |
|
my %weekends = ( ); |
|
|
|
print "Weekends I have Connor:\n"; |
|
|
|
use Calendar; |
|
my $date = Calendar->new_from_Gregorian( $m, $d, $y ); |
|
|
|
$weekends{$date->date_string( "%Y/%M/%d" )} = 1; |
|
&twoMore( $date ); |
|
while ( $date->date_string( "%Y" ) <= 2026 ) |
|
{ |
|
$date += 14; |
|
$weekends{$date->date_string( "%Y/%M/%d" )} = 1; |
|
&twoMore( $date ); |
|
} |
|
|
|
return %weekends; |
|
|
|
sub twoMore |
|
{ |
|
my $td = shift; |
|
|
|
$td++; |
|
$weekends{$td->date_string( "%Y/%M/%d" )} = 1; |
|
$td++; |
|
$weekends{$td->date_string( "%Y/%M/%d" )} = 1; |
|
} |
|
} |
|
|
############################################################################### |
############################################################################### |
############################################################################### |
############################################################################### |
sub ReadParse |
sub ReadParse |
Line 223 sub fetchOptions {
|
Line 277 sub fetchOptions {
|
return %opts; |
return %opts; |
} |
} |
|
|
|
sub header { |
|
return <<EOF; |
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
<head> |
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> |
|
<title>Calendar Days Connor Visits</title> |
|
</head> |
|
<body bgcolor="#FFFFFF"> |
|
EOF |
|
} |
|
|
|
sub css { |
|
return <<EOF; |
|
<style type="text/css"> |
|
body { |
|
|
|
padding-top: 0px; |
|
padding-left: 0px; |
|
padding-right: 0px; |
|
padding-bottom: 0px; |
|
|
|
text-align:left; |
|
margin:0; |
|
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif; |
|
#font-family: Geneva, Arial, Helvetica, sans-serif; |
|
font-size: 12pt; |
|
background: #eeeeee; |
|
color:#000000; |
|
|
|
|
|
} |
|
|
|
.name { |
|
color: #191970; |
|
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif; |
|
#font-family: Verdana, Arial, sans-serif; |
|
font-size: 18pt; font-weight: bold; line-height: 38pt; |
|
text-align: center; |
|
} |
|
|
|
p.Legend { |
|
color: #000000; |
|
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif; |
|
font-size: 8pt; |
|
margin: auto; |
|
width: 300px; |
|
background-color : transparent; |
|
border-top: 1px solid #888888; |
|
border-left: 1px solid #888888; |
|
border-right: 1px solid #888888; |
|
border-bottom: 1px solid #888888; |
|
padding-top: 3px; |
|
padding-bottom: 3px; |
|
padding-left: 3px; |
|
padding-right: 3px; |
|
} |
|
|
|
h1 { |
|
color: #191970; |
|
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif; |
|
#font-family: Verdana, Arial, sans-serif; |
|
font-size: 12pt; font-weight: bold; line-height: 15pt; |
|
background-color : transparent; |
|
margin-left: 20px; |
|
margin-right: 20px; |
|
border-top: 1px solid black; |
|
border-bottom: 1px solid black; |
|
} |
|
|
|
|
|
h2 { |
|
color: #191970; |
|
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif; |
|
font-weight: bold; |
|
font-size: 18px; |
|
} |
|
|
|
h3 { |
|
color: #191970; |
|
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif; |
|
font-weight: bold; |
|
font-size: 14px; |
|
} |
|
|
|
|
|
textarea { width:100%; } |
|
|
|
.gallery { |
|
padding-top: 80px; |
|
padding-left: 60px; |
|
padding-right: 50px; |
|
line-height: 120%; |
|
background:url('topleft.jpg') no-repeat top left; |
|
} |
|
.browse { |
|
padding-top: 80px; |
|
padding-left: 60px; |
|
padding-right: 50px; |
|
line-height: 120%; |
|
background:url(topleft.jpg) no-repeat top left; |
|
} |
|
.content, .rc { |
|
padding-top: 100px; |
|
padding-left: 80px; |
|
padding-right: 50px; |
|
line-height: 120%; |
|
} |
|
|
|
|
|
p.footer { |
|
color: #000000; |
|
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif; |
|
font-size: 8pt; |
|
margin: auto; |
|
width: 500px; |
|
background-color : transparent; |
|
border-top: 1px solid #888888; |
|
padding-top: 3px; |
|
padding-bottom: 3px; |
|
padding-left: 3px; |
|
padding-right: 3px; |
|
text-align: center; |
|
} |
|
|
|
|
|
.header { |
|
float: right; |
|
margin-top: 30px; |
|
margin-right: 50px; |
|
padding: 10px; |
|
padding-top: 10px,10px,10px,10px; |
|
|
|
} |
|
pre { |
|
border: #777777 1px dashed; |
|
padding: 0.5em; |
|
margin-left: 1em; |
|
margin-right: 2em; |
|
white-space: pre; |
|
background-color: #fbfdff; |
|
color: black; |
|
font-size:12px; |
|
} |
|
|
|
.refer { |
|
padding-left: 60px; |
|
padding-right: 50px; |
|
margin-right: 50px; |
|
margin-left: 50px; |
|
font-size:80%; |
|
} |
|
|
|
.gotobar { |
|
color: #191970; |
|
font-size:10px; |
|
} |
|
|
|
.edit bar { |
|
color: #949ce5; |
|
} |
|
|
|
.contactInfo { |
|
font-size:12px; |
|
text-align:center; |
|
} |
|
|
|
.workHeader { |
|
text-align:left; |
|
font-size:13px; |
|
text-decoration:none; |
|
font-weight:normal; |
|
} |
|
|
|
.workHeaderDate { |
|
float: right; |
|
} |
|
|
|
.workHeaderStrong { |
|
font-size:15px; |
|
text-decoration:none; |
|
font-weight:bolder; |
|
} |
|
|
|
.jobDescription { |
|
padding-top:15px; |
|
font-size:13px; |
|
} |
|
|
|
.bulletContent { |
|
font-size:13px; |
|
} |
|
|
|
.leftCol { |
|
width:10.2em; |
|
position:absolute; |
|
top:0; |
|
font-size:13px; |
|
padding-left:1%; |
|
padding-right:1%; |
|
} |
|
|
|
.rightCol { |
|
width:10.2em; |
|
position:absolute; |
|
top:0; |
|
font-size:13px; |
|
padding-left:1%; |
|
padding-right:1%; |
|
} |
|
|
|
a:link {color:#082e58; text-decoration: none; font-weight:bolder;} |
|
a:visited {color:#7795b7; font-weight:normal; text-decoration:none;} |
|
a:hover {color:#949ce5;} |
|
|
|
|
|
a.definition:before { content:"[::"; } |
|
a.definition:after { content:"]"; } |
|
a.alias { text-decoration:none; border-bottom: thin dashed; } |
|
a.near:link { color:#093; } |
|
a.near:visited { color:#550; } |
|
a.upload:before { content:"<"; } |
|
a.upload:after { content:">"; } |
|
a.outside:before { content:"["; } |
|
a.outside:after { content:"]"; } |
|
img.logo { float: right; clear: right; border-style:none; } |
|
div.diff { padding-left:5%; padding-right:5%; } |
|
div.old { background-color:#FFFFAF; } |
|
div.new { background-color:#CFFFCF; } |
|
div.message { background-color:#FEE; } |
|
div.journal h1 { font-size:large; } |
|
table.history { border-style:none; } |
|
td.history { border-style:none; } |
|
span.result { font-size:larger; } |
|
span.info { font-size:smaller; font-style:italic; } |
|
div.rss { background-color:#EEF; } |
|
div.sister { float:left; margin-right:1ex; background-color:#FFF; } |
|
div.sister p { margin-top:0; } |
|
div.sister img { border:none; } |
|
div.near { background-color:#EFE; } |
|
div.near p { margin-top:0; } |
|
</style> |
|
EOF |
|
|
|
} |
|
|
__END__ |
__END__ |
|
|
=head1 NAME |
=head1 NAME |