--- ConnorCalendar/calendar.pl 2013/05/29 03:27:02 1.6
+++ ConnorCalendar/calendar.pl 2020/11/13 18:07:40 1.14
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -wT
+#!/usr/bin/perl -w
=begin comment info
+------------------------------------------------------------------------------
@@ -8,7 +8,7 @@
|
| Nicholas DeClario
| March 2009
-| $Id: calendar.pl,v 1.6 2013/05/29 03:27:02 nick Exp $
+| $Id: calendar.pl,v 1.14 2020/11/13 18:07:40 nick Exp $
|
+------------------------------------------------------------------------------
=end comment
@@ -23,55 +23,78 @@ use Getopt::Long;
use Pod::Usage;
use Data::Dumper;
use Calendar::Simple;
-use Date::Calendar::Year qw( :all );
-use Date::Calendar::Profiles qw( $Profiles );
+use Date::Pcalendar::Year qw( :all );
+use Date::Pcalendar::Profiles qw( $Profiles );
-my $VERSION = q/$Id: calendar.pl,v 1.6 2013/05/29 03:27:02 nick Exp $/;
+my $VERSION = '$Id: calendar.pl,v 1.14 2020/11/13 18:07:40 nick Exp $';
my $DEBUG = "";
my $URL = "http://demandred.dyndns.org/cgi-bin/ConnorCalendar/index.cgi";
my %post_in = ( );
my %opts = &fetchOptions( );
my @list = ( );
my @months = qw/ January February March April May June July
- August September October November December /;
+ August September October November December /;
my %holidays = (
+ "Easter Sunday" => 'even',
"Christmas Day" => 'even',
"Christmas Eve" => 'odd',
"Father's Day" => 'all',
"Independence Day" => 'even',
"Labor Day" => 'even',
"Memorial Day" => 'odd',
- "New Year's Day" => 'even',
+ "New Year's Day" => 'odd',
"New Year's Eve" => 'odd',
"Thanksgiving Day" => 'odd',
- );
+ );
my %specials = (
"11/28" => "even",
"5/6" => "odd",
);
-my @weekend = qw/ 2011 8 12 /;
+
+my @school_days = (
+ "2020/11/27",
+ "2020/12/24",
+ "2020/12/25",
+ "2020/12/28",
+ "2020/12/29",
+ "2020/12/30",
+ "2020/12/31",
+ "2021/01/01",
+ "2021/01/18",
+ "2021/02/15",
+ "2021/03/29",
+ "2021/03/30",
+ "2021/03/31",
+ "2021/04/01",
+ "2021/04/02",
+ "2021/04/05",
+ "2021/05/31",
+ "2021/06/01"
+ );
+
+print "Content-type: text/html\n\n";
+print &header( );
+
+
+## Change this @weekend to 'qw/ 2011 8 12 /' for original schedule
+my @weekend = qw/ 2011 8 19 /;
my %weekends = &calcWeekends( @weekend );
&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 );
+push @list, 'Easter Sunday' if ( $YEAR % 2 == 0 );
-print "Content-type: text/html\n\n";
-print &header( );
print &css( );
-print "Calendar for $YEAR
\n";
-my $year_us = Date::Calendar::Year->new( $YEAR, $Profiles->{'US-FL'} );
+my $year_us = Date::Pcalendar::Year->new( $YEAR, $Profiles->{'US-FL'} );
my @hdays = $year_us->labels( );
-#$DEBUG = "Holidays for $YEAR:\n";
-#foreach ( sort @hdays ) { $DEBUG .= $_ ."\n"; }
-
-
-print "<-- $YEAR " .
- "-->";
+print "<-- " .
+ "Calendar Days Connor Visits for $YEAR" .
+ " -->
";
my $row = 0;
print "";
for( my $month = 1; $month <= 12; $month++ )
@@ -100,6 +123,8 @@ for( my $month = 1; $month <= 12; $month
print sprintf "%2d ", $day;
} elsif ( &isToday( $YEAR, $month, $day ) ) {
print sprintf "%2d ", $day;
+ } elsif ( &isSchoolClosed( $YEAR, $month, $day ) ) {
+ print sprintf "%2d ", $day;
} else {
print sprintf "%2d ", $day;
}
@@ -113,15 +138,16 @@ for( my $month = 1; $month <= 12; $month
$row++;
}
print "
";
-print "Holidays I have Connor are in Red\n";
+print "
Holidays Connor visits are in Red\n";
print "Today is Blue\n";
-print "Weekends and special days I have Connor are in Green\n
";
+print "Days off from school are Orange\n
Last Day of School 06/23/2021\n\n";
+print "Weekends and special days Connor visits are in Green\n
";
-print "
List of Special/Holidays " .
- "I have Connor:
";
-print map { $_ . "\n" } sort @list;
-print " |
\n";
+print "List of Special/Holidays " .
+ "Connor Visits:
";
+print map { $_ . " \n" } sort @list;
+print " |
\n";
print "";
@@ -145,9 +171,9 @@ sub IHaveConnor
sub isSpecial
{
- my $y = shift || return 0;
- my $m = shift || return 0;
- my $d = shift || return 0;
+ my $y = shift || return 0;
+ my $m = shift || return 0;
+ my $d = shift || return 0;
my $yr = ( $YEAR % 2 ) ? "odd" : "even";
my $ref = "$m/$d";
@@ -164,11 +190,26 @@ sub isSpecial
return 0;
}
+sub isSchoolClosed
+{
+ my $y = shift || return 0;
+ my $m = shift || return 0;
+ my $d = shift || return 0;
+
+ my $date_str = sprintf( "$y/%02d/%02d", $m, $d );
+
+ foreach my $sd ( @school_days ) {
+ return 1 if $date_str =~ m/$sd/;
+ }
+
+ return 0;
+}
+
sub isWeekend
{
my $y = shift || return 0;
- my $m = shift || return 0;
- my $d = shift || return 0;
+ my $m = shift || return 0;
+ my $d = shift || return 0;
$m--;
my $ds = sprintf( "$y/$months[$m]/%02d", $d );
@@ -197,7 +238,7 @@ sub calcWeekends
my $d = shift;
my %weekends = ( );
- print "Weekends I have Connor:\n";
+ print "Weekends Connor Visits:\n";
use Calendar;
my $date = Calendar->new_from_Gregorian( $m, $d, $y );
@@ -306,7 +347,7 @@ padding-bottom: 0px;
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif;
#font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12pt;
- background:url(lowerright.jpg) no-repeat bottom right;
+ background: #eeeeee;
color:#000000;
@@ -325,7 +366,7 @@ p.Legend {
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif;
font-size: 8pt;
margin: auto;
- width: 28%;
+ width: 300px;
background-color : transparent;
border-top: 1px solid #888888;
border-left: 1px solid #888888;
@@ -394,7 +435,7 @@ p.footer {
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif;
font-size: 8pt;
margin: auto;
- width: 48%;
+ width: 500px;
background-color : transparent;
border-top: 1px solid #888888;
padding-top: 3px;