[Zope] Calendar Tag 0.9.1

technews@egsx.com technews@egsx.com
Mon, 20 Dec 1999 14:17:36 -0500 (EST)


I have worked extensively with this tag..
Production site I designed is online and has this calendar of events
http://www.aley.net/Ar/events/

This is the source.. It has some arabic text (sorry) but it will help you
get the idea behind what I have setup..


<dtml-call "REQUEST.set('ZToday', ZopeTime())">
<dtml-call "REQUEST.set('ZMonth', ZToday.mm())">
<dtml-call "REQUEST.set('ZYear', ZToday.year())">
<dtml-call "REQUEST.set('ZDay', ZToday.dd())"><p>

<center>
<!--#calendar date=ZToday mode=month bgcolor=e3e3e3 -->
<dtml-call "REQUEST.set('Today', date)">
<dtml-call "REQUEST.set('Month', Today.mm())">
<dtml-call "REQUEST.set('Year',Today.year())">
<dtml-call "REQUEST.set('Day',   Today.dd())">
<dtml-call "REQUEST.set('dash', '&nbsp;')">
<dtml-if   "_.int(Month)== 1"><dtml-call
"REQUEST.set('Month', ' ')"><dtml-elif "_.int(Month)== 2"><dtml-call
"REQUEST.set('Month', '')"><dtml-elif "_.int(Month)== 3"><dtml-call
"REQUEST.set('Month', '')"><dtml-elif "_.int(Month)== 4"><dtml-call
"REQUEST.set('Month', '')"><dtml-elif "_.int(Month)== 5"><dtml-call
"REQUEST.set('Month', '')"><dtml-elif "_.int(Month)== 6"><dtml-call
"REQUEST.set('Month', '')"><dtml-elif "_.int(Month)== 7"><dtml-call
"REQUEST.set('Month', '')"><dtml-elif "_.int(Month)== 8"><dtml-call
"REQUEST.set('Month', '')"><dtml-elif "_.int(Month)== 9"><dtml-call
"REQUEST.set('Month', '')"><dtml-elif "_.int(Month)== 10"><dtml-call
"REQUEST.set('Month', ' ')"><dtml-elif "_.int(Month)== 11"><dtml-call
"REQUEST.set('Month', ' ')"><dtml-elif "_.int(Month)== 12"><dtml-call
"REQUEST.set('Month', ' ')"></dtml-if>

<dtml-call "REQUEST.set('ar_Month',_.str(Month) + _.str(dash) + _.str(Year))">

<!-- Set the right top cell-->
<dtml-call "setCalendar('left',ar_Month)">
<dtml-call "setCalendar('middle','<font color=ffffff><b>Aley.net</b></font>')">

<!-- Set the letters for the day of the week -->
<dtml-call "setCalendar('daynames','SMTWRFS')">

<!-- Set the background color of the top cells -->
<dtml-call "setCalendar('leftbgcolor',main_color)">
<dtml-call "setCalendar('middlebgcolor',main_color)">
<dtml-call "setCalendar('rightbgcolor',main_color)">

<!-- Set the cell spacing and padding of a cell -->
<dtml-call "setCalendar('padding','5')">
<dtml-call "setCalendar('spacing','0')">

<dtml-if "mode=='month'">
<dtml-call "REQUEST.set('Month', date.mm())">
<dtml-call "REQUEST.set('Year', date.year())">
<dtml-call "REQUEST.set('Day',date.dd())">

<dtml-comment><a href="<!--#var "linkDate(date)"-->"><!--#var
date fmt=dd--></a></dtml-comment>

<font color=ff0000><b><!--#var date fmt=dd--></b></font>
<hr align=right width=70>
<a href="http://www.aley.net/Ar/goingout/Cinemas"><font
size=-1></font></a><br>

<dtml-in "objectValues(['Folder'])"> 
  <dtml-if "id == _.str(Year)">    
  <dtml-in "objectValues(['Folder'])">     
     <dtml-if "id == _.str(Month)">         
     <dtml-in "objectValues(['Folder'])">
         <dtml-if "id == _.str(Day)">             
         <dtml-if "objectValues(['DTML Document'])">              
         <dtml-in "objectValues(['DTML Document'])">
         <a href="/Ar/events/&dtml-Year;/&dtml-Month;/&dtml-Day;/&dtml-id;">
         <font size=-1><dtml-var title><br></font></a>
         </dtml-in>
         </dtml-if>
         </dtml-if>
     </dtml-in>
     </dtml-if>
    </dtml-in> 
    </dtml-if>
   </dtml-in>
</dtml-if>
<!--#/calendar--></center>


On Mon, 20 Dec 1999, Ibaņez Palomar Juan David wrote:

> > 
> > That is really cool, but the example:
> >     <!--#calendar [args]-->
> >       template code
> >     <!--#/calendar-->
> > 
> > hmmm... what do I do with the template code part?
> > 
> > Thanks
> > 
> 
> In the archives
>   http://lists.zope.org/pipermail/zope/1999-September/010057.html
> 
> you can find this explanation:
> 
>   The DTML within the calander tag is called for every cell that is rendered, 
>   be it in day, week or month mode. The tag supplies you with methods and 
>   variables to find out what mode you are in, what cell (what date, week or 
>   month), and to influence the rendering of that particular cell, or the 
>   rendering of the whole calendar.
> 
> (his english is better than mine)
> 
> For instance:
> 
>   <dtml-calendar>
>     <dtml-var date fmt=day>
>   </dtml-calendar>
> 
> renders a simple month calendar.
> 
> You can find lots of examples in the archives since the calendar tag
> was released in February (I will look at them carefully ASAP).
> 
> 
> Look also "http://www.endicor.com/zope/test/Calendar" for a simple demo.
> 
> 
> 
> David
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>