summaryrefslogtreecommitdiffabout
path: root/htdocs/examples/calendar.chtml
Side-by-side diff
Diffstat (limited to 'htdocs/examples/calendar.chtml') (more/less context) (show whitespace changes)
-rw-r--r--htdocs/examples/calendar.chtml1
1 files changed, 1 insertions, 0 deletions
diff --git a/htdocs/examples/calendar.chtml b/htdocs/examples/calendar.chtml
index eea20cb..85aa7ba 100644
--- a/htdocs/examples/calendar.chtml
+++ b/htdocs/examples/calendar.chtml
@@ -1,70 +1,71 @@
<%impl>
/* vim:set ft=sitecing: */
#include <time.h>
#include <konforka/exception.h>
</%impl>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+% __SCIF->flush();
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>really simple page</title>
<style type="text/css">
table.calendar {
font-family: monospace;
}
table.calendar th.heading {
border: double blue 3px;
}
table.calendar td {
text-align: right;
margin: 0.5ex; padding: 2px;
border: solid 1px black;
}
table.calendar .wd-0, table.calendar .wd-6 {
color: red;
}
table.calendar td.unexistant {
border: none;
}
table.calendar td.today {
background: #ffffc0;
color: blue;
font-weight: bold;
}
</style>
</head>
<body>
% /* Just call the calendar member function */
% calendar();
</body>
</html>
<%method void calendar() %>
<%code>
time_t tt = time(0);
struct tm t;
if(!localtime_r(&tt,&t))
throw konforka::exception(CODEPOINT,"couldn't fetch current date");
char h[16];
if(strftime(h,sizeof(h),"%B, %Y",&t)>=sizeof(h))
throw konforka::exception(CODEPOINT,"couldn't produce heading for the calendar");
int today = t.tm_mday;
t.tm_mday = 1;
tt=mktime(&t);
if(!localtime_r(&tt,&t))
throw konforka::exception(CODEPOINT,"couldn't fetch current date");
int dim = 31;
if(t.tm_mon==3 || t.tm_mon==5 || t.tm_mon==8 || t.tm_mon==10) {
dim = 30;
}else if(t.tm_mon==1) {
dim = (t.tm_year%4)?28:29;
}
</%code>
<table class="calendar">
<tr>
<th class="heading" colspan="7"><% h %></th>
</tr>
<tr>
<th class="wd-0">Sun</th>
<th class="wd-1">Mon</th>
<th class="wd-2">Tue</th>
<th class="wd-3">Wed</th>
<th class="wd-4">Thu</th>