Diff for /ConnorCalendar/calendar.pl between versions 1.10 and 1.14

version 1.10, 2016/11/03 12:49:45 version 1.14, 2020/11/13 18:07:40
Line 26  use Calendar::Simple; Line 26  use Calendar::Simple;
 use Date::Pcalendar::Year qw( :all );  use Date::Pcalendar::Year qw( :all );
 use Date::Pcalendar::Profiles qw( $Profiles );  use Date::Pcalendar::Profiles qw( $Profiles );
   
 my $VERSION  = q/$Id$/;  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 @list     = ( );
 my @months   = qw/ January February March April May June July   my @months   = qw/ January February March April May June July 
                    August September October November December /;                     August September October November December /;
 my %holidays = (   my %holidays = ( 
                  "Easter Sunday"        => 'even',                   "Easter Sunday"        => 'even',
                  "Christmas Day"        => 'even',                   "Christmas Day"        => 'even',
Line 45  my %holidays = ( Line 45  my %holidays = (
                  "New Year's Day"       => 'odd',                   "New Year's Day"       => 'odd',
                  "New Year's Eve"       => 'odd',                   "New Year's Eve"       => 'odd',
                  "Thanksgiving Day"     => 'odd',                    "Thanksgiving Day"     => 'odd', 
                );           );
   
 my %specials = (  my %specials = (
                 "11/28"                 => "even",                  "11/28"                 => "even",
                 "5/6"                   => "odd",                  "5/6"                   => "odd",
                 );                  );
   
   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  ## Change this @weekend to 'qw/ 2011 8 12 /' for original schedule
 my @weekend  = qw/ 2011 8 19 /;  my @weekend  = qw/ 2011 8 19 /;
 my %weekends = &calcWeekends( @weekend );  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 );  push @list, 'Easter Sunday' if ( $YEAR % 2 == 0 );
   
 print "Content-type: text/html\n\n";  
 print &header( );  
 print &css( );  print &css( );
 my $year_us = Date::Pcalendar::Year->new( $YEAR, $Profiles->{'US-FL'} );  my $year_us = Date::Pcalendar::Year->new( $YEAR, $Profiles->{'US-FL'} );
 my @hdays = $year_us->labels( );  my @hdays = $year_us->labels( );
Line 99  for( my $month = 1; $month <= 12; $month Line 123  for( my $month = 1; $month <= 12; $month
                                         print sprintf "<font color=green><b>%2d</b> </font>", $day;                                          print sprintf "<font color=green><b>%2d</b> </font>", $day;
                                 } elsif ( &isToday( $YEAR, $month, $day ) ) {                                  } elsif ( &isToday( $YEAR, $month, $day ) ) {
                                         print sprintf "<font color=blue><b>%2d</b> </font>", $day;                                          print sprintf "<font color=blue><b>%2d</b> </font>", $day;
                   } elsif ( &isSchoolClosed( $YEAR, $month, $day ) ) {
                                           print sprintf "<font color=orange><b>%2d</b> </font>", $day;
                                 } else {                                  } else {
                                         print sprintf "%2d ", $day;                                          print sprintf "%2d ", $day;
                                 }                                  }
Line 112  for( my $month = 1; $month <= 12; $month Line 138  for( my $month = 1; $month <= 12; $month
         $row++;          $row++;
 }  }
 print "</tr></table>";  print "</tr></table>";
 print "<p class=\"Legend\">Holidays I have Connor are in <font color=red>Red</font>\n</br>";  print "<p class=\"Legend\">Holidays Connor visits are in <font color=red>Red</font>\n</br>";
 print "Today is <font color=blue>Blue</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 "Days off from school are <font color=orange>Orange</font>\n<br><b> Last Day of School 06/23/2021</b>\n</br>\n";
   print "Weekends and special days Connor visits are in <font color=green>Green</font>\n</p>";
   
   
 print "<table width=35% align=center border=0><tr><td>List of Special/Holidays " .  print "<table width=35% align=center border=0><tr><td>List of Special/Holidays " .
       "I have Connor:<br /><p class=Legend>";        "Connor Visits:<br /><p class=Legend>";
 print map { $_ . "<br />\n" } sort @list;  print map { $_ . "<br />\n" } sort @list;
 print "</p></td></tr></table>\n";  print "</p></td></tr></table>\n";
 print "</pre><p class=\"footer\">Version: <font color=green>$VERSION</font><br />";  print "</pre><p class=\"footer\">Version: <font color=green>$VERSION</font><br />";
Line 144  sub IHaveConnor Line 171  sub IHaveConnor
   
 sub isSpecial  sub isSpecial
 {  {
         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;
         my $yr = ( $YEAR % 2 ) ? "odd" : "even";          my $yr = ( $YEAR % 2 ) ? "odd" : "even";
   
         my $ref = "$m/$d";          my $ref = "$m/$d";
Line 163  sub isSpecial Line 190  sub isSpecial
         return 0;          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  sub isWeekend
 {  {
         my $y = shift || return 0;          my $y = shift || return 0;
Line 196  sub calcWeekends Line 238  sub calcWeekends
         my $d = shift;          my $d = shift;
         my %weekends = ( );          my %weekends = ( );
   
         print "Weekends I have Connor:\n";          print "Weekends Connor Visits:\n";
   
         use Calendar;          use Calendar;
         my $date = Calendar->new_from_Gregorian( $m, $d, $y );          my $date = Calendar->new_from_Gregorian( $m, $d, $y );

Removed from v.1.10  
changed lines
  Added in v.1.14


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>