This is some code I threw together for one project. There are some notes at the top about what variables to have available. The calendar it makes is kind of small, but it should be a good starting point for you.

 

Robert

 


From: Ted Wolfley [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 20, 2005 11:03 AM
To: [email protected]
Subject: Witango-Talk: calendar display

 

Hi,

 

Before I start designing it, has anyone created in Witango, a month events calendar where the month display is built on the fly and  the dates are hyperlinks to that day's events. 

Here is an example of what I am looking for built using coldfusion: http://www.cityofrochester.com/index.cfm?app=calendar

 

Thanks in advance

 

Ted Wolfley
Database/Internet Programmer
The Ogden Group of Rochester

5637  West Henrietta Road

West Henrietta, NY 14586
phone: (585) 321 1060 x23
fax: (585) 321 0043

[EMAIL PROTECTED]

www.ogdengroup.com

 

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
<@EXCLUDE>

The input for this code is a month in this format: MM/1/YYYY

The VAR user$log_list contains an array of days to highlight.

determine first day of the previous month.

<@ASSIGN method$backone <@DAYS date=<@VAR month> days=-1>>
<@ASSIGN method$previousmonth <@VAR backone format=datetime:%m/01/%Y>>

determine first day of next month.

<@ASSIGN method$upone <@DAYS date=<@VAR month> days=45>>
<@ASSIGN method$nextmonth <@VAR upone format=datetime:%m/01/%Y>>

determine last day of month.

<@ASSIGN method$lastday <@DAYS date=<@VAR nextmonth> days=-1>>

determine weekday of the first and starting offset.

<@IFEQUAL <@VAR month format="datetime:%a"> sun>
        <@ASSIGN method$dayadjust 0>
<@ELSEIFEQUAL <@VAR month format="datetime:%a"> mon>
        <@ASSIGN method$dayadjust 1>
<@ELSEIFEQUAL <@VAR month format="datetime:%a"> tue>
        <@ASSIGN method$dayadjust 2>
<@ELSEIFEQUAL <@VAR month format="datetime:%a"> wed>
        <@ASSIGN method$dayadjust 3>
<@ELSEIFEQUAL <@VAR month format="datetime:%a"> thu>
        <@ASSIGN method$dayadjust 4>
<@ELSEIFEQUAL <@VAR month format="datetime:%a"> fri>
        <@ASSIGN method$dayadjust 5>
<@ELSE>
        <@ASSIGN method$dayadjust 6>
</@IF>

reset offset.

<@ASSIGN method$currentoffset 0>

</@EXCLUDE>



        <table border=1 cellpadding=3 cellspacing=0>
                <tr>
                        <td align=center colspan=7><b><@VAR month 
format="datetime:%B %Y"></b></td>
                </tr>
                <tr>
                        <td align=center>Su</td>
                        <td align=center>M</td>
                        <td align=center>Tu</td>
                        <td align=center>W</td>
                        <td align=center>Th</td>
                        <td align=center>F</td>
                        <td align=center>Sa</td>
                </tr>

        <@FOR stop=6>
                <tr>
                                <@IF expr='@@method$dayadjust != 0 && 
@@currentoffset = 0'>
                                <@FOR stop=@@method$dayadjust>
                                <td></td>
                                </@FOR>
                                </@IF>
                <@FOR stop=<@IF expr='@@currentoffset = 0'><@CALC 
7-@@method$dayadjust><@ELSE>7</@IF>>
                        <td align=center <@IFEQUAL <@DAYS date=@@month 
days=@@currentoffset format="datetime:%m/%d/%Y"> 
<@CURRENTDATE>>bgcolor=#cccccc</@IF>>
                                
                                <@IF expr='<@VAR user$log_list> contains <@DAYS 
date=@@month days=@@currentoffset format="datetime:%Y%m%d">'>
                                        <b>
                                        <a 
href=<@CGI><@APPFILE>?<@USERREFERENCEARGUMENT>&action=what_to_do&date=<@DAYS 
date=@@month days=@@currentoffset format="datetime:%Y%m%d"> 
style="text-decoration:none">
                                                <@CALC <@DAYS date=@@month 
days=@@currentoffset format="datetime:%d">>
                                        </a>
                                        </b>
                                <@ELSE>
                                        <a 
href=<@CGI><@APPFILE>?<@USERREFERENCEARGUMENT>&action=what_to_do&date=<@DAYS 
date=@@month days=@@currentoffset format="datetime:%Y%m%d"> 
style="text-decoration:none">
                                                <font color=black><@CALC <@DAYS 
date=@@month days=@@currentoffset format="datetime:%d">></font>
                                        </a>
                                </@IF>
                        </td>   
                        <@ASSIGN method$currentoffset <@CALC @@currentoffset+1>>
                        <@IF expr='@@currentoffset = <@VAR lastday 
format=datetime:%d>'><@BREAK></@IF>
                </@FOR>
                </tr>
                <@IF expr='@@currentoffset = <@VAR lastday 
format=datetime:%d>'><@BREAK></@IF>
        </@FOR>
        </table>
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to