summaryrefslogtreecommitdiffabout
path: root/htdocs/examples
authorMichael Krelin <hacker@klever.net>2005-04-02 17:12:01 (UTC)
committer Michael Krelin <hacker@klever.net>2005-04-02 17:12:01 (UTC)
commit0234b0ae9ba19a37771a8e7d519137fa811c206c (patch) (side-by-side diff)
tree0ea91c13e615a7abf70ad6d3ccdda7cacb97dd56 /htdocs/examples
parent1a234a03b327b20bf7490c696ebc41a9d65117ac (diff)
downloadsitecing-0234b0ae9ba19a37771a8e7d519137fa811c206c.zip
sitecing-0234b0ae9ba19a37771a8e7d519137fa811c206c.tar.gz
sitecing-0234b0ae9ba19a37771a8e7d519137fa811c206c.tar.bz2
1. minor changes to CSS
2. arrows added to walkthrough navigation 3. added new files to the list of sources 4. extra div-s added to metasytnax for the sake of validity 5. hyperlink added to the reference index page 6. changed the note about fastcgi being the only supported inface 7. flushing added to calendar for a bit of performance analysis.
Diffstat (limited to 'htdocs/examples') (more/less context) (ignore 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,101 +1,102 @@
<%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>
<th class="wd-5">Fri</th>
<th class="wd-6">Sat</th>
</tr>
<%code>
int dow=0; int dom=1-t.tm_wday;
for(;;dom++,dow=(dow+1)%7) {
if(!dow) {
<%output>
<tr>
</%output>
}
bool be = (dom>=1 && dom<=dim);
std::string ec = be?" existant":" unexistant";
if(dom==today)
ec+=" today";
<%output><td class="wd-<% dow %><% ec %>"></%output>
if(be) {
<%output><% dom %></%output>
}
<%output></td></%output>
if(dow==6) {
<%output>
</tr>
</%output>
if(dom>=dim)
break;
}
}
</%code>
</table>
</%method>