version 1.2, 2013/05/28 22:07:14
|
version 1.3, 2013/05/28 22:58:31
|
Line 26 use Calendar::Simple;
|
Line 26 use Calendar::Simple;
|
use Date::Calendar::Year qw( :all ); |
use Date::Calendar::Year qw( :all ); |
use Date::Calendar::Profiles qw( $Profiles ); |
use Date::Calendar::Profiles qw( $Profiles ); |
|
|
|
my $VERSION = qw/$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 Novemeber December /; |
my %holidays = ( |
my %holidays = ( |
Line 48 my %specials = (
|
Line 50 my %specials = (
|
"11/28" => "even", |
"11/28" => "even", |
"5/6" => "odd", |
"5/6" => "odd", |
); |
); |
|
my @weekend = qw/ 2011 8 12 /; |
|
my %weekends = &calcWeekends( @weekend ); |
|
|
&ReadParse( ); |
&ReadParse( ); |
|
|
Line 65 print "Weekends and special days I have
|
Line 69 print "Weekends and special days I have
|
my $year_us = Date::Calendar::Year->new( $YEAR, $Profiles->{'US-FL'} ); |
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"; |
#$DEBUG = "Holidays for $YEAR:\n"; |
foreach ( sort @hdays ) { $DEBUG .= $_ ."\n"; } |
#foreach ( sort @hdays ) { $DEBUG .= $_ ."\n"; } |
|
|
|
|
print "<center><a href=\"$URL?cy=" . ( $YEAR - 1 ) . |
print "<center><a href=\"$URL?cy=" . ( $YEAR - 1 ) . |
Line 93 for( my $month = 1; $month <= 12; $month
|
Line 97 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 117 for( my $month = 1; $month <= 12; $month
|
$row++; |
$row++; |
} |
} |
print "</tr></table>"; |
print "</tr></table>"; |
print "<pre>$DEBUG</pre>"; |
print "<center>List of Special/Holidays I have Connor:<br /><pre>"; |
|
print map { $_ . "\n" } sort @list; |
|
print "</pre><br /><hr />Version: <font color=green>$VERSION</font><br />"; |
|
print "CVS: <a href=\"http://demandred.dyndns.org/cgi-bin/cvsweb/ConnorCalendar/\">http://demandred.dyndns.org/cgi-bin/cvsweb/ConnorCalendar/</a>"; |
|
print "</center><pre>\n\n$DEBUG</pre>"; |
|
|
|
|
############################################################################### |
############################################################################### |
############################################################################### |
############################################################################### |
Line 141 sub isSpecial
|
Line 151 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 163 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 187 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 |