Listed below is a simple calendar that I use for my blog. All you have to do
is add the dates that are checked out to the date array.
Display Page:
<cfset MyDateArray=ArrayNew(1)>
<!--- Example <cfset MyDateArray[1]=DateFormat(Now(),'mm/dd/yyyy')> --->
<cfparam name="URL.CalendarDate" default="#DateFormat(Now(),'yyyy_mm')#">
<cfparam name="myPage" default="#Script_Name#">
<cfmodule
template="calendar.cfm"
page="#myPage#"
datearray="#MyDateArray#"
calendardate="#URL.CalendarDate#"
>
calendar.cfm
<cfparam name="Attributes.Page" default="#Script_Name#">
<cfset
Attributes.CalendarDate=DateFormat(CreateDate(Left(Attributes.CalendarDate,4
), Right(Attributes.CalendarDate,2), 1),'mm/dd/yyyy')>
<cfset MyDateArray=Duplicate(Attributes.DateArray)>
<cfif Find('?',Attributes['Page'])>
<cfset Attributes['Page']=Attributes['Page']&'&'>
<cfelse>
<cfset Attributes['Page']=Attributes['Page']&'?'>
</cfif>
<cfscript>
function ArrayFind(arrayToSearch,valueToFind){
var ii = 0;
for(ii = 1; ii LTE arrayLen(arrayToSearch); ii = ii + 1){
if(NOT compare(arrayToSearch[ii],valueToFind))
return ii;
}
return 0;
}
</cfscript>
<cfoutput>
<table width="100%" align="center" cellpadding="3" cellspacing="1"
border="0" bgcolor="##000000">
<tr bgcolor="##ECECEC">
<td>
<table width="100%" cellpadding="0" cellspacing="0"
border="0">
<tr>
<td width="50" align="center"><a
href="#Attributes['Page']#CalendarDate=#DateFormat(DateAdd('m',-1,Attributes
['CalendarDate']),'yyyy_mm')#"><<<</a></td>
<td
align="center">#DateFormat(Attributes['CalendarDate'],'mmmm
yyyy')#</td>
<td width="50" align="center"><a
href="#Attributes['Page']#CalendarDate=#DateFormat(DateAdd('m',1,Attributes[
'CalendarDate']),'yyyy_mm')#">>>></a></td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<table width="100%" align="center" cellpadding="3" cellspacing="1"
border="0" bgcolor="##000000">
<tr>
<cfloop from="1"
to="#(DayOfWeek(Month(Attributes['CalendarDate'])&'/01/'&Year(Attributes['Ca
lendarDate']))-1)#" index="I">
<td bgcolor="##ECECEC"> </td>
</cfloop>
<cfloop from="1" to="#DaysInMonth(Attributes['CalendarDate'])#"
index="I">
<cfsilent>
<cfif I LTE 9>
<cfset I=0&I>
</cfif>
<cfset
InnerDate=Month(Attributes['CalendarDate'])&'/'&I&'/'&Year(Attributes['Calen
darDate'])>
<cfif IsDefined('MyDateArray')>
<cfif NOT
ArrayFind(MyDateArray,DateFormat(InnerDate,'mm/dd/yyyy'))>
<cfset hasEvent=0>
<cfelse>
<cfset hasEvent=1>
</cfif>
<cfelse>
<cfset hasEvent=0>
</cfif>
</cfsilent>
<td align="center" bgcolor="##FFFFFF" class="TEXT">
<cfif hasEvent>
<a
href="#Attributes['Page']#CalendarDate=#DateFormat(InnerDate,'yyyy_mm')#&Day
=#DateFormat(InnerDate,'dd')#">
</CFIF>
<cfif
DateFormat(InnerDate,'mm/dd/yyyy') IS
DateFormat(Now(),'mm/dd/yyyy')>
<span style="font-weight:
bold">
</CFIF>
#I#
<cfif
DateFormat(InnerDate,'mm/dd/yyyy') IS
DateFormat(Now(),'mm/dd/yyyy')>
</span>
</CFIF>
<cfif hasEvent>
</a>
</CFIF>
</td>
<cfif DayOfWeek(InnerDate) IS 7>
</tr>
<tr>
</CFIF>
</CFLOOP>
<cfloop from="1"
to="#Evaluate(7-DayOfWeek(Month(Attributes['CalendarDate'])&'/'&DaysInMonth(
Attributes['CalendarDate'])&'/'&Year(Attributes['CalendarDate'])))#"
index="I">
<cfif I LTE 9>
<cfset I=0&I>
</cfif>
<td align="center" bgcolor="##ECECEC">#I#</td>
</cfloop>
</tr>
</table>
</cfoutput>
<cfif IsDefined('URL.Day')>
<cfset
DateToCheck=CreateDate(DateFormat(Attributes['CalendarDate'],'yyyy'),
DateFormat(Attributes['CalendarDate'],'mm'), URL.Day)>
<script>
alert('Event Details Page goes here');
</script>
</cfif>
============================================
Bryan F. Hogan
Director of Internet Development
Team Macromedia Volunteer
Macromedia Certified ColdFusion MX Developer
Digital Bay Media, Inc.
1-877-72DIGITAL
============================================
-----Original Message-----
From: Jerry Johnson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 2:06 PM
To: CF-Talk
Subject: Re: Does this Widget exist?
The last time I did this, it was in ASP, and I have no code to share.
But one thing I learned and will pass on. Not only can a piece of equipment
be checked out, it needs to be able to be out of service, and you'll want to
know if its routine maintenance or broke. (I had to add this in in the last
few days before launch)
Also, you'll want to know what items need other items, both as neccessary
additions and as upsell options. (extension cords, carpets to cover
extension cords, portable generators, truck to deliver transport it...)
Good luck,
Jerry Johnson
>>> [EMAIL PROTECTED] 03/25/03 12:37PM >>>
We would rather not build from scratch if it exists...we have a rental
company...they want a calendar showing a month and a listing of equipment
and if its checked out, it blocks out those days...etc
Can't imagine it does as its fairly specific, but you never know. Any
pointers welcome.
Thanks!
Regards,
Eric J. Hoffman
DataStream Connexion
www.datastreamconnexion.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4