TOGAWA Satoshi
toga****@puyo*****
2003年 10月 25日 (土) 15:43:01 JST
とがわです.
「PIM表示で,最後に表示した日付と同一日付の予定は,表示する最大個数を越えても
表示する」というパッチを作ってみました.
機能を有効にするには,config.ph で
package HNS::PIM::Schedule;
$PrintOverMaxNum = 1;
としてください(デフォルトは0(無効)です).
問題なければcommitしたいです.
Index: public_html/diary/config.ph.in
===================================================================
RCS file: /cvsroot/h14m/hns-perl/public_html/diary/config.ph.in,v
retrieving revision 1.54
diff -u -u -r1.54 config.ph.in
--- public_html/diary/config.ph.in 3 Jan 2003 10:47:58 -0000 1.54
+++ public_html/diary/config.ph.in 25 Oct 2003 06:40:41 -0000
@@ -109,6 +109,7 @@
$Range = 1; # month(s) of schedule displayed
$RRange = $Range; # month(s) of schedule displayed for repeat
$GraceDays = 0; # number of day(s) to display past schedule
+$PrintOverMaxNum = 0; # print same day all plan of $Maxnum
################################################################
package HNS::PIM::Todo;
Index: public_html/diary/lib/HNS/PIM/Schedule.pm
===================================================================
RCS file: /cvsroot/h14m/hns-perl/public_html/diary/lib/HNS/PIM/Schedule.pm,v
retrieving revision 1.30
diff -u -u -r1.30 Schedule.pm
--- public_html/diary/lib/HNS/PIM/Schedule.pm 25 Oct 2003 06:38:13 -0000 1.30
+++ public_html/diary/lib/HNS/PIM/Schedule.pm 25 Oct 2003 06:40:41 -0000
@@ -1,5 +1,5 @@
package HNS::PIM::Schedule;
-# $Id: Schedule.pm,v 1.30 2003/10/25 06:38:13 togawa Exp $
+# $Id: Schedule.pm,v 1.29 2003/05/28 04:52:56 togawa Exp $
################################################################
=head1 NAME
@@ -30,7 +30,7 @@
attributes qw(contents error);
################################################################
-use vars qw($MaxNum $ContentTemplate $PastContentTemplate $TodayContentTemplate $BeginTemplate $EndTemplate @WeekString @ABCString $Unfixed $Range $RRange $GraceDays);
+use vars qw($MaxNum $ContentTemplate $PastContentTemplate $TodayContentTemplate $BeginTemplate $EndTemplate @WeekString @ABCString $Unfixed $Range $RRange $GraceDays $PrintOverMaxNum);
use vars qw(%ContentTemplate %PastContentTemplate %TodayContentTemplate
%BeginTemplate %EndTemplate);
@@ -42,6 +42,7 @@
$Range = 1;
$RRange = $Range;
$GraceDays = 0;
+$PrintOverMaxNum = 0;
# template
$ContentTemplate = qq(<li><strong>%month/%day%week</strong> %content</li>\n);
@@ -320,6 +321,7 @@
my $html;
my $day;
my $week;
+ my $prev;
my $now_date = $HNS::Status->start_time;
my $limit_date = new DateTime::Date(year=>$now_date->year,
@@ -340,7 +342,8 @@
$a->{content} cmp $b->{content} } @{$self->contents}){
next unless $limit_date <= $_->{date} && # now and future
$until_date > $_->{date}; # until next month
- last if ++$cnt > $MaxNum; # less than equal $MaxNum
+ last if (++$cnt > $MaxNum && # less than equal $MaxNum
+ ( $PrintOverMaxNum == 0 || $_->{date} != $prev->{date})); # if this date is different of $Maxnum
$week = "";
if ($_->{date}->day == 32) { # Unfixed
$day = $Unfixed;
@@ -371,6 +374,7 @@
day=>$day,
week=>$week,
content=>$_->{content}});
+ $prev = $_;
}
$html .= SelectTemplate($EndTemplate, %EndTemplate);
}
--
toga****@puyo***** 戸川聡士