[Zope] Calendar tag backed by database?

Loren Stafford lstafford@morphics.com
Mon, 20 Aug 2001 09:31:23 -0700


Here's an example that I'm currently developing to display an Outlook
Calendar that has been exported to an MSAccess database. The Access ODBC
query 'DateLookup' is:

select Subject, StartDate, EndDate, Location, Description, Showtimeas from
Calendar
  where StartDate <= #<dtml-var "ThisDate" fmt="%m/%d/%Y" sql_quote>
12:01:00 AM#
  and   EndDate >= #<dtml-var "ThisDate" fmt="%m/%d/%Y" sql_quote> 11:59:00
AM#

The DTML is:

<dtml-call "REQUEST.set('colorAssignment',{})">
<dtml-call "REQUEST.set('nextColor',0)">
<dtml-calendar weekdays="07">
<dtml-call "setCalendar('bordercolor', '0000CC')">
<dtml-call "setCalendar('spacing', '2')">
<dtml-call "setCalendar('padding', '2')">
<dtml-call "setCalendar('valign', 'top')">

<dtml-if "_.DateTime.isCurrentDay(date) and _.DateTime.isCurrentMonth(date)
and _.DateTime.isCurrentYear(date)">
<dtml-call "setCalendar('cellbgcolor', 'CCCCCC')">
</dtml-if>

<span style="font-size: 9pt; font-weight: bold; font-family: Verdana,
Helvetica, sans-serif;">
<dtml-var date fmt=%d>
</span>
<dtml-call "REQUEST.set('ThisDate', date)">
<dtml-in DateLookup sort=Showtimeas>

<dtml-call "REQUEST.set('statusColor',StatusColors[0])">
<dtml-if Showtimeas>
<dtml-call "REQUEST.set('statusColor',StatusColors[_.int(Showtimeas)])">
</dtml-if>
<span style="font-size: 8pt; font-family: Verdana, Helvetica, sans-serif;
color: black;
background-color: #<dtml-var statusColor>;">
<br><A onMouseOver="return overlib('Show time as: <dtml-var
"ShowTimeAsText[Showtimeas]"> (<dtml-var Showtimeas>)', RIGHT);"
onMouseOut="nd();"><dtml-var Subject></A><br>
</span>
</dtml-in>

</dtml-calendar>

-- HTH
-- Loren

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Frank
> McGeough
> Sent: Monday, August 20, 2001 06:26
> To: zope@zope.org
> Subject: [Zope] Calendar tag backed by database?
>
>
> Is their an example of using the calendar tag where the calendar
> entries are
> using a SQL database? I'm having trouble getting date based
> queries to work
> with MySql and also in understanding where the queries should go
> in my DTML
> method that include the calendar tag.
>