phillystyle123
asked on
calendar application - more than one event at at time in table (date) cell
the link to my calendar app:
http://www.redcatweb2.org/calendar/index.cfm
i need to be able to show more than one event in a table cell. currently if i add an event to a date already being used by another event, the new event takes over the spot of the old event and the old event isn't displayed anymore.
my code:
<cfquery name="craigcal" datasource="calartscalenda r">
SELECT * FROM calendar
</cfquery>
<CFPARAM name="Curr_Date" default="#now()#">
<CFIF isdefined("MonthChange")>
<CFIF monthchange is 'forward'>
<CFSET curntdate = createodbcdate(dateadd("m" , 1, lastdate))>
<CFELSE>
<CFSET curntdate = createodbcdate(dateadd("m" , -1, lastdate))>
</CFIF>
</CFIF>
<CFPARAM name="YearSet" default="#year(Curr_Date)# ">
<CFPARAM name="MonthSet" default="#month(Curr_Date) #">
<!--- Create the date variables to search the Database by. --->
<CFSET monthstart = createdatetime(#yearset#, #monthset#, 1, 0, 0, 0)>
<CFSET monthend = createdatetime(#yearset#, #monthset#, #daysinmonth(monthstart)#, 23, 59, 59)>
<CFQUERY datasource="calartscalenda r" name="SearchResults">
Select Eventname, EventDescription, Calendar_ID, CalendarDate From calendar Where CalendarDate >= #CreateODBCDate(monthstart )# and CalendarDate <= #CreateODBCDate(monthend)# <cfif #len(eventtype)#>and EventType = '#eventtype#'</cfif>
</CFQUERY>
<CFSET Lst_Eventname = Replace(ValueList(SearchRe sults.Even tname,'~') ,'~~','~ ~','All')>
<CFSET Lst_EventDescription = Replace(ValueList(SearchRe sults.Even tDescripti on,'~'),'~ ~','~ ~','All')>
<CFSET Lst_Calendar_ID = ValueList(SearchResults.Ca lendar_ID, '~')>
<CFSET Lst_CalendarDate = ValueList(SearchResults.Ca lendarDate ,'~')>
<CFPARAM NAME="curr_date" DEFAULT="#CreateDate(Year( Now()), Month(Now()), Day(Now()))#">
<CFSET Lst_CalendarDay = "">
<CFLOOP FROM="1" TO="#ListLen(Lst_CalendarD ate,'~')#" INDEX="day_index">
<CFSET Lst_CalendarDay = ListAppend(Lst_CalendarDay ,day(datef ormat(List GetAt(Lst_ CalendarDa te,day_ind ex,'~'),'m m/dd/yyyy' )),'~')>
</CFLOOP>
<TABLE width="722" border="0" cellspacing="0" cellpadding="0"> <TR>
<TD align="left" valign="top" width="41"> </TD>
<TD align="left" valign="top" width="630"><BR>
<TABLE width="558" border="0" cellspacing="0" cellpadding="2">
<TR>
<TD align="left">
<SPAN class="calendarbold_big">< CFOUTPUT># DATEFORMAT (CURR_DATE , "mmmm yyyy")#</CFOUTPUT></SPAN>< /TD>
<TD align="right">
<SPAN class="calendarbold_big">< A HREF="index.cfm?Curr_Date= <CFOUTPUT> #DateAdd(' m',-1,CURR _DATE)#</C FOUTPUT>"> <span class="calendarbold_arrows "><font size="6">‹‹</f ont></span ></A> <A HREF="index.cfm?Curr_Date= <CFOUTPUT> #DateAdd(' m',1,CURR_ DATE)#</CF OUTPUT>">< span class="calendarbold_arrows "><font size="6">››</f ont></span ></A></SPA N></TD>
</TR>
</TABLE><BR>
<TABLE width="600" border="0" cellspacing="0" cellpadding="6">
<TR align="left">
<TD valign="top" width="80" height=""><SPAN class="calendarbold"><FONT color="#000000">S</SPAN></ TD>
<TD valign="top" width="80" height="0"><SPAN class="calendarbold"><FONT color="#000000">M</SPAN></ TD>
<TD valign="top" width="80" height="0"><SPAN class="calendarbold"><FONT color="#000000">T</SPAN></ TD>
<TD valign="top" width="80" height="0"><SPAN class="calendarbold"><FONT color="#000000">W</SPAN></ TD>
<TD valign="top" width="80" height="0"><SPAN class="calendarbold"><FONT color="#000000">T</SPAN></ TD>
<TD valign="top" width="80" height="0"><SPAN class="calendarbold"><FONT color="#000000">F</SPAN></ TD>
<TD valign="top" width="80" height="0"><SPAN class="calendarbold"><FONT color="#000000">S</SPAN></ TD>
</TR>
<TR bgcolor="#FFFFFF">
<TD align="left" valign="top" width="80" height="2"></TD>
<TD align="left" valign="top" width="80" height="2"></TD>
<TD align="left" valign="top" width="80" height="2"></TD>
<TD align="left" valign="top" width="80" height="2"></TD>
<TD align="left" valign="top" width="80" height="2"></TD>
<TD align="left" valign="top" width="80" height="2"></TD>
<TD align="left" valign="top" width="80" height="2"></TD>
</TR>
<TR>
<!--- just change curr_date value as per date passed --->
<CFSET I_ROWCNT = 1>
<CFSET I_ROWNO = 1><!--- WILL HOLD THE N0 0F ROWS DISPLAYED IN CALENDAR. --->
<CFLOOP FROM="1" TO="#Evaluate(DayOfWeek(Cr eateDate(Y ear(Curr_D ate), Month(Curr_Date), 1))-1)#" INDEX="i_empty"><!--- put empty spaces till the first day of month comes eg. in case of May..there would be four empty spaces. --->
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">  ;</SPAN><B R></TD>
</CFLOOP>
<CFSET I_ROWCNT = I_EMPTY>
<CFLOOP FROM="1" TO="#DaysInMonth(Curr_Date )#" INDEX="i_day">
<CFIF ListFindNoCase(Lst_Calenda rDay,i_day ,'~') NEQ 0>
<TD bgcolor="#F1E39E" align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"><CFOU TPUT>#i_da y#</CFOUTP UT></SPAN> <BR>
<SPAN class="frontcopy"><cfset myUrl = urlencodedformat(#ListGetA t(Lst_Even tname,List FindNoCase (Lst_Calen darDay,i_d ay,'~'),'~ ')#)>
<cfoutput>
<a href="event.cfm?Eventname= #myUrl#"># ListGetAt( Lst_Eventn ame,ListFi ndNoCase(L st_Calenda rDay,i_day ,'~'),'~') #</a> </cfoutput></A><BR></TD>
<CFELSE>
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"><CFOU TPUT>#i_da y#</CFOUTP UT></SPAN> <BR></TD>
</CFIF>
<CFIF I_ROWCNT MOD 7 EQ 0>
</TR>
<TR bgcolor="#FFFFFF">
<TD align="left" valign="top" colspan="13" height="2"></TD>
</TR>
<TR>
<CFSET I_ROWNO = IncrementValue(I_ROWNO)>
</CFIF>
<CFSET I_ROWCNT = IncrementValue(I_ROWCNT)>
</CFLOOP>
</TR>
<CFIF I_ROWNO LT 6><!--- hide this row in no. of rows is 6 --->
<TR>
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">  ;</SPAN><B R></TD>
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">  ;</SPAN><B R></TD>
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">  ;</SPAN><B R></TD>
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">  ;</SPAN><B R></TD>
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">  ;</SPAN><B R></TD>
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">  ;</SPAN><B R></TD>
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">  ;</SPAN><B R></TD>
</TR>
</CFIF>
</TABLE></TD>
</TR>
</TABLE>
<CENTER><IMG src="http://calarts.edu/images/redcat/buildings/seasondarkgray.gif" width="640" height="359" alt="" border="0"></CENTER></TD>
</TR>
</TABLE>
</BODY>
</HTML>
http://www.redcatweb2.org/calendar/index.cfm
i need to be able to show more than one event in a table cell. currently if i add an event to a date already being used by another event, the new event takes over the spot of the old event and the old event isn't displayed anymore.
my code:
<cfquery name="craigcal" datasource="calartscalenda
SELECT * FROM calendar
</cfquery>
<CFPARAM name="Curr_Date" default="#now()#">
<CFIF isdefined("MonthChange")>
<CFIF monthchange is 'forward'>
<CFSET curntdate = createodbcdate(dateadd("m"
<CFELSE>
<CFSET curntdate = createodbcdate(dateadd("m"
</CFIF>
</CFIF>
<CFPARAM name="YearSet" default="#year(Curr_Date)#
<CFPARAM name="MonthSet" default="#month(Curr_Date)
<!--- Create the date variables to search the Database by. --->
<CFSET monthstart = createdatetime(#yearset#, #monthset#, 1, 0, 0, 0)>
<CFSET monthend = createdatetime(#yearset#, #monthset#, #daysinmonth(monthstart)#,
<CFQUERY datasource="calartscalenda
Select Eventname, EventDescription, Calendar_ID, CalendarDate From calendar Where CalendarDate >= #CreateODBCDate(monthstart
</CFQUERY>
<CFSET Lst_Eventname = Replace(ValueList(SearchRe
<CFSET Lst_EventDescription = Replace(ValueList(SearchRe
<CFSET Lst_Calendar_ID = ValueList(SearchResults.Ca
<CFSET Lst_CalendarDate = ValueList(SearchResults.Ca
<CFPARAM NAME="curr_date" DEFAULT="#CreateDate(Year(
<CFSET Lst_CalendarDay = "">
<CFLOOP FROM="1" TO="#ListLen(Lst_CalendarD
<CFSET Lst_CalendarDay = ListAppend(Lst_CalendarDay
</CFLOOP>
<TABLE width="722" border="0" cellspacing="0" cellpadding="0"> <TR>
<TD align="left" valign="top" width="41"> </TD>
<TD align="left" valign="top" width="630"><BR>
<TABLE width="558" border="0" cellspacing="0" cellpadding="2">
<TR>
<TD align="left">
<SPAN class="calendarbold_big"><
<TD align="right">
<SPAN class="calendarbold_big"><
</TR>
</TABLE><BR>
<TABLE width="600" border="0" cellspacing="0" cellpadding="6">
<TR align="left">
<TD valign="top" width="80" height=""><SPAN class="calendarbold"><FONT
<TD valign="top" width="80" height="0"><SPAN class="calendarbold"><FONT
<TD valign="top" width="80" height="0"><SPAN class="calendarbold"><FONT
<TD valign="top" width="80" height="0"><SPAN class="calendarbold"><FONT
<TD valign="top" width="80" height="0"><SPAN class="calendarbold"><FONT
<TD valign="top" width="80" height="0"><SPAN class="calendarbold"><FONT
<TD valign="top" width="80" height="0"><SPAN class="calendarbold"><FONT
</TR>
<TR bgcolor="#FFFFFF">
<TD align="left" valign="top" width="80" height="2"></TD>
<TD align="left" valign="top" width="80" height="2"></TD>
<TD align="left" valign="top" width="80" height="2"></TD>
<TD align="left" valign="top" width="80" height="2"></TD>
<TD align="left" valign="top" width="80" height="2"></TD>
<TD align="left" valign="top" width="80" height="2"></TD>
<TD align="left" valign="top" width="80" height="2"></TD>
</TR>
<TR>
<!--- just change curr_date value as per date passed --->
<CFSET I_ROWCNT = 1>
<CFSET I_ROWNO = 1><!--- WILL HOLD THE N0 0F ROWS DISPLAYED IN CALENDAR. --->
<CFLOOP FROM="1" TO="#Evaluate(DayOfWeek(Cr
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"> 
</CFLOOP>
<CFSET I_ROWCNT = I_EMPTY>
<CFLOOP FROM="1" TO="#DaysInMonth(Curr_Date
<CFIF ListFindNoCase(Lst_Calenda
<TD bgcolor="#F1E39E" align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"><CFOU
<SPAN class="frontcopy"><cfset myUrl = urlencodedformat(#ListGetA
<cfoutput>
<a href="event.cfm?Eventname=
<CFELSE>
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"><CFOU
</CFIF>
<CFIF I_ROWCNT MOD 7 EQ 0>
</TR>
<TR bgcolor="#FFFFFF">
<TD align="left" valign="top" colspan="13" height="2"></TD>
</TR>
<TR>
<CFSET I_ROWNO = IncrementValue(I_ROWNO)>
</CFIF>
<CFSET I_ROWCNT = IncrementValue(I_ROWCNT)>
</CFLOOP>
</TR>
<CFIF I_ROWNO LT 6><!--- hide this row in no. of rows is 6 --->
<TR>
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"> 
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"> 
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"> 
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"> 
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"> 
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"> 
<TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"> 
</TR>
</CFIF>
</TABLE></TD>
</TR>
</TABLE>
<CENTER><IMG src="http://calarts.edu/images/redcat/buildings/seasondarkgray.gif" width="640" height="359" alt="" border="0"></CENTER></TD>
</TR>
</TABLE>
</BODY>
</HTML>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I have also quite similar calendar application, but i have problems with event.cfm page. It also passes urlencodedformat url parameter to the action page (event.cfm) , but it doesn't work!
Here is my calendar page code where It passes url parameter:
<cfset minunUrl = urlencodedformat(ListGetAt (Lst_Event name,ListF indNoCase( Lst_Calend arDay,i_da y,'~'),'~' ))>
<cfoutput><a href="event.cfm?eventName= #minunUrl# ">#ListGet At(Lst_Eve ntname,Lis tFindNoCas e(Lst_Cale ndarDay,i_ day,'~'),' ~')#</a></ cfoutput>< BR>
</CFIF>
Here is event.cfm code:
<CFQUERY NAME="SearchResults" DATASOURCE="galleryesim">
SELECT *
FROM kalenteri
WHERE eventName = #url.eventName#
</CFQUERY>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<cfoutput query="SearchResults">
<table border="0" cellpadding="0">
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>#eventDescription#,#ev entName#</ td>
<td></td>
<td></td>
</tr>
</table>
</cfoutput>
</body>
</html>
Here is my calendar page code where It passes url parameter:
<cfset minunUrl = urlencodedformat(ListGetAt
<cfoutput><a href="event.cfm?eventName=
</CFIF>
Here is event.cfm code:
<CFQUERY NAME="SearchResults" DATASOURCE="galleryesim">
SELECT *
FROM kalenteri
WHERE eventName = #url.eventName#
</CFQUERY>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<cfoutput query="SearchResults">
<table border="0" cellpadding="0">
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>#eventDescription#,#ev
<td></td>
<td></td>
</tr>
</table>
</cfoutput>
</body>
</html>
mattimeikalainen : put up a seperate q's for urself !
ASKER