--- Schedule.pm-orig Tue Apr 18 19:14:39 2000 +++ Schedule.pm Tue Apr 18 19:36:25 2000 @@ -29,7 +29,7 @@ attributes qw(contents error); ################################################################ -use vars qw($MaxNum $ContentTemplate $BeginTemplate $EndTemplate @WeekString @ABCString $Unfixed $Range $RRange); +use vars qw($MaxNum $ContentTemplate $PastContentTemplate $BeginTemplate $EndTemplate @WeekString @ABCString $Unfixed $Range $RRange $GraceDays); $MaxNum = 8; # max number of showing @WeekString = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); @@ -41,6 +41,7 @@ # template $ContentTemplate = qq(
  • %month/%day%week %content
  • \n); +$PastContentTemplate = qq(
  • %month/%day%week %content
  • \n); $BeginTemplate = ""; @@ -213,6 +214,10 @@ my $week; my $now_date = $HNS::Status->start_time; + my $limit_date = new DateTime::Date(year=>$now_date->year, + month=>$now_date->month, + day=>$now_date->day); + $limit_date -= "${GraceDays}D"; $html .= $BeginTemplate; my $until_date = new DateTime::Date(year=>$now_date->year, @@ -225,7 +230,7 @@ } for (sort { $a->{date} <=> $b->{date} || $a->{content} cmp $b->{content} } @{$self->contents}){ - next unless $now_date <= $_->{date} && # now and future + next unless $limit_date <= $_->{date} && # now and future $until_date > $_->{date}; # until next month last if ++$cnt > $MaxNum; # less than equal $MaxNum $week = ""; @@ -241,7 +246,9 @@ $day = sprintf("%02d", $_->{date}->day); $week = '(' . $WeekString[$_->{date}->week] . ')'; } - $html .= $templ->Expand($ContentTemplate, + my $template =($now_date <= $_->{date}) ? $ContentTemplate + : $PastContentTemplate; + $html .= $templ->Expand($template, {year=>sprintf("%04d", $_->{date}->year), month=>sprintf("%02d", $_->{date}->month), day=>$day,