summaryrefslogtreecommitdiffstats
path: root/blog
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-05-23 18:18:15 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-05-23 18:18:15 +0800
commit455ad22bfea540a4f7493c0126eb0d5032412050 (patch)
tree1d2e7a422fec93687d5b3745bb172a388b1e794f /blog
parent10929e1b3d964c25d65f02bdcb77a2e02c2887dc (diff)
downloadpttbbs-455ad22bfea540a4f7493c0126eb0d5032412050.tar
pttbbs-455ad22bfea540a4f7493c0126eb0d5032412050.tar.gz
pttbbs-455ad22bfea540a4f7493c0126eb0d5032412050.tar.bz2
pttbbs-455ad22bfea540a4f7493c0126eb0d5032412050.tar.lz
pttbbs-455ad22bfea540a4f7493c0126eb0d5032412050.tar.xz
pttbbs-455ad22bfea540a4f7493c0126eb0d5032412050.tar.zst
pttbbs-455ad22bfea540a4f7493c0126eb0d5032412050.zip
calendar support, XHTML valid
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@892 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'blog')
-rwxr-xr-xblog/blog.pl53
1 files changed, 52 insertions, 1 deletions
diff --git a/blog/blog.pl b/blog/blog.pl
index 30577d14..f4875b57 100755
--- a/blog/blog.pl
+++ b/blog/blog.pl
@@ -6,6 +6,7 @@ use strict;
use Data::Dumper;
use Date::Calc qw(:all);
use Template;
+use HTML::Calendar::Simple;
sub main
{
@@ -84,7 +85,57 @@ sub main
}
}
- # output
+ # Calendar ---------------------------------------------------------------
+ if( $attr{"$fn.loadCalendar"} ){
+ # 沒有合適的 module , 自己寫一個 |||b
+ my($c, $week, $day, $t, $link);
+ $c = ("<table border=\"0\" cellspacing=\"4\" cellpadding=\"0\">\n".
+ "<caption class=\"calendarhead\">$emonth[$m] $y</caption>\n".
+ "<tr>\n");
+ $c .= ("<th abbr=\"$_->[0]\" align=\"center\">".
+ "<span class=\"calendar\">$_->[1]</span></th>\n")
+ foreach( ['Sunday', 'Sun'], ['Monday', 'Mon'],
+ ['Tuesday', 'Tue'], ['Wednesday', 'Wed'],
+ ['Thursday', 'Thu'], ['Friday', 'Fri'],
+ ['Saturday', 'Sat'] );
+
+ $week = Day_of_Week($y, $m, 1);
+ $c .= "</tr>\n<tr>\n";
+
+ if( $week == 7 ){
+ $week = 0;
+ }
+ else{
+ $c .= ("<th abbr=\"null\" align=\"center\"><span class=\"calendar\">".
+ "&nbsp;</span></th>\n")
+ foreach( 1..$week );
+ }
+ foreach( 1..31 ){
+ $c .= "<th abbr=\"$_\" align=\"center\"><span class=\"calendar\">";
+
+ $t = packdate($y, $m, $_);
+ if( !$article{"$t.title"} ){
+ $c .= "$_";
+ }
+ else{
+ my $link = $attr{"$fn.loadCalendar"};
+ $link =~ s/\[\% key \%\]/$t/g;
+ $c .= "<a href=\"$link\">$_</a>";
+ }
+
+ $c .= "</span></th>\n";
+ if( ++$week == 7 ){
+ $c .= "</tr>\n\n<tr>\n";
+ $week = 0;
+ }
+ }
+
+ $c .= "</tr>\n</table>\n";
+ $th{calendar} = $c;
+ #my $cal = HTML::Calendar::Simple->new({month => $m, year => $y});
+ #$th{calendar} = $cal->calendar_month;
+ }
+
$tmpl = Template->new({INCLUDE_PATH => '.',
ABSOLUTE => 0,
RELATIVE => 0,