Solved

calendar application - more than one event at at time in table (date) cell

Posted on 2003-11-04
5
1,075 Views
Last Modified: 2013-12-24
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="calartscalendar">
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="calartscalendar" 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(SearchResults.Eventname,'~'),'~~','~ ~','All')>
          <CFSET Lst_EventDescription = Replace(ValueList(SearchResults.EventDescription,'~'),'~~','~ ~','All')>
          <CFSET Lst_Calendar_ID = ValueList(SearchResults.Calendar_ID,'~')>
          <CFSET Lst_CalendarDate = ValueList(SearchResults.CalendarDate,'~')>
          <CFPARAM NAME="curr_date" DEFAULT="#CreateDate(Year(Now()), Month(Now()), Day(Now()))#">
                    <CFSET Lst_CalendarDay = "">
          <CFLOOP FROM="1" TO="#ListLen(Lst_CalendarDate,'~')#" INDEX="day_index">
               <CFSET Lst_CalendarDay = ListAppend(Lst_CalendarDay,day(dateformat(ListGetAt(Lst_CalendarDate,day_index,'~'),'mm/dd/yyyy')),'~')>
          </CFLOOP>

         
          <TABLE width="722" border="0" cellspacing="0" cellpadding="0"> <TR>
                    <TD align="left" valign="top" width="41">&nbsp;</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)#</CFOUTPUT>"><span class="calendarbold_arrows"><font size="6">&#8249;&#8249;</font></span></A>  <A HREF="index.cfm?Curr_Date=<CFOUTPUT>#DateAdd('m',1,CURR_DATE)#</CFOUTPUT>"><span class="calendarbold_arrows"><font size="6">&#8250;&#8250;</font></span></A></SPAN></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(CreateDate(Year(Curr_Date), 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">&nbsp;</SPAN><BR></TD>                                  
                             </CFLOOP>
                              <CFSET I_ROWCNT = I_EMPTY>                              
                              <CFLOOP FROM="1" TO="#DaysInMonth(Curr_Date)#" INDEX="i_day">                                                                                          
                                   <CFIF ListFindNoCase(Lst_CalendarDay,i_day,'~') NEQ 0>
                                        <TD bgcolor="#F1E39E" align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"><CFOUTPUT>#i_day#</CFOUTPUT></SPAN><BR>                                  
                                        <SPAN class="frontcopy"><cfset myUrl = urlencodedformat(#ListGetAt(Lst_Eventname,ListFindNoCase(Lst_CalendarDay,i_day,'~'),'~')#)>
<cfoutput>
<a href="event.cfm?Eventname=#myUrl#">#ListGetAt(Lst_Eventname,ListFindNoCase(Lst_CalendarDay,i_day,'~'),'~')#</a> </cfoutput></A><BR></TD>    
                                   <CFELSE>                                        
                                        <TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold"><CFOUTPUT>#i_day#</CFOUTPUT></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">&nbsp;</SPAN><BR></TD>                                  
                                   <TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">&nbsp;</SPAN><BR></TD>                                  
                                   <TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">&nbsp;</SPAN><BR></TD>                                  
                                   <TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">&nbsp;</SPAN><BR></TD>                                  
                                   <TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">&nbsp;</SPAN><BR></TD>                                  
                                   <TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">&nbsp;</SPAN><BR></TD>                                  
                                   <TD align="left" valign="top" width="80" height="80"><SPAN class="calendarbold">&nbsp;</SPAN><BR></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>
0
Comment
Question by:phillystyle123
5 Comments
 
LVL 17

Assisted Solution

by:anandkp
anandkp earned 100 total points
ID: 9684292
show me how ur list "Lst_eventname" looks when u have 2 events on the same day ....

u'll just have to loop over the events & display them inside the TD - so as to be able to show multiple events on the same day.

K'Rgds
Anand
0
 
LVL 11

Accepted Solution

by:
hart earned 100 total points
ID: 9684387
Anands right :-)
since he doesn't have the code, i have just pasted what he means by looping over events

change this part in your code

<SPAN class="frontcopy"><cfset myUrl = urlencodedformat(#ListGetAt(Lst_Eventname,ListFindNoCase(Lst_CalendarDay,i_day,'~'),'~')#)>
<cfoutput>
<a href="event.cfm?Eventname=#myUrl#">#ListGetAt(Lst_Eventname,ListFindNoCase(Lst_CalendarDay,i_day,'~'),'~')#</a> </cfoutput></A><BR>


to this

                        <CFIF ListValueCount(Lst_CalendarDay,i_day,'~') GT 1>
                                                                  <CFLOOP FROM="1" TO="#ListLen(Lst_CalendarDay,'~')#" INDEX="event_index">
                                                                        <CFIF ListGetAt(Lst_CalendarDay,event_index,'~') Eq i_day>
                                                                              <cfset myUrl = urlencodedformat(ListGetAt(Lst_EventName,event_index,'~'))>                                                                              
                                                                              <SPAN class="frontcopy"><cfoutput><a href="event.cfm?Eventname=#myUrl#">#ListGetAt(Lst_EventName,event_index,'~')#</a></cfoutput><BR>
                                                                        </CFIF>                                                                        
                                                                  </CFLOOP>
                                                            <CFELSE>
                                                                  <cfset myUrl = urlencodedformat(ListGetAt(Lst_Eventname,ListFindNoCase(Lst_CalendarDay,i_day,'~'),'~'))>
                                                                  <SPAN class="frontcopy"><cfoutput><a href="event.cfm?Eventname=#myUrl#">#ListGetAt(Lst_Eventname,ListFindNoCase(Lst_CalendarDay,i_day,'~'),'~')#</a></cfoutput><BR>
                                                            </CFIF>


Regards
Hart


0
 

Author Comment

by:phillystyle123
ID: 9685677
thanks experts!  works perfectly!!!!!!
0
 

Expert Comment

by:mattimeikalainen
ID: 10029153
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_Eventname,ListFindNoCase(Lst_CalendarDay,i_day,'~'),'~'))>
<cfoutput><a href="event.cfm?eventName=#minunUrl#">#ListGetAt(Lst_Eventname,ListFindNoCase(Lst_CalendarDay,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#,#eventName#</td>
    <td></td>
    <td></td>
  </tr>
</table>
</cfoutput>



</body>
</html>


0
 
LVL 17

Expert Comment

by:anandkp
ID: 10033120
mattimeikalainen : put up a seperate q's for urself !
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question