GoogleCalendar.cfc Version 1
I've updated my GoogleCalendar.cfc. It now correctly (I think) handles time zone offsets and recurrences. I also added a simple way to make it refresh its own cache.
I think next I'll make a few convenience functions, like getTodaysEvents, getThisMonthsEvents, getThisWeeksEvents. Suggestions are welcome. (And if you use it on your site, let me know!)
The download is attached to this entry. I'll add a project page later on.
Oh - and I actually included instructions this time, and, thanks to certain events in the past, a license file as well.
Comments
# Posted By Brian Rinaldi
| 4/20/06 9:46 PM
# Posted By John Farrar
| 4/20/06 10:18 PM
hah.
jk, really.
# Posted By tony of the weeg clan
| 4/20/06 10:48 PM
# Posted By Raymond Camden
| 4/21/06 5:40 AM
"SyncKolab was written to add kolab functionality to thunderbird. It reads a selected Imap folder and synchronizes it with the local address book and calendar."
http://www.gargan.org/extensions/synckolab.html
# Posted By mikeD
| 4/21/06 8:52 AM
Thanks for the great start. I saw the Google calendar a couple of days ago and it about blew my mind. I have a customer that is trying to implement a scheduling calendar. The have been asking about dragging the appointments to different days in the calendar. That would require updating the database with the new date. Do you see a way in the Google API that when an event is moved or dropped to fire an event to a remote server to accomplish this?
Thanx
Jeff Douglas
# Posted By Jeff Douglas
| 4/21/06 10:47 AM
# Posted By Raymond Camden
| 4/21/06 11:04 AM
# Posted By Donnovan Lewis
| 4/27/06 5:15 PM
# Posted By Donnovan Lewis
| 4/27/06 5:16 PM
# Posted By Raymond Camden
| 4/27/06 5:21 PM
<cfset modifiedContent = Replace(r.content, '\n' , '#chr(10)#', 'all')>
# Posted By Donnovan Lewis
| 4/27/06 5:24 PM
seemed to work. i just didnt know what chr i was to replace...i thought it was \n or \r
# Posted By Donnovan Lewis
| 4/27/06 5:26 PM
also can i edit my comments so i dont have to send a new one everytime i think of something new
# Posted By Donnovan Lewis
| 4/27/06 5:27 PM
Using a ColdFusion QoQ to sort on a field named "date" will throw an error.
Is there a way to rename an existing query fieldname?
# Posted By Scott Fitchet
| 4/28/06 3:42 PM
What a great tool. Thanks so much!
Please excuse my ignorance, I have not used cfc's at all. I can get the dump to work well from my calendar. But I am having trouble outputting a query onto my page. What code would I use to out put this.
eg
<cfoutput query="r">#author#</cfoutput> or
<cfoutput query="application.gCal.readEntries()">#author#</cfoutput>
I am sorry this is probably way basic and if I could get a nudge in the right direction I would be greatful.
Thanks
Lach
# Posted By Lachie
| 6/8/06 12:10 PM
# Posted By Raymond Camden
| 6/8/06 9:44 PM
Dylan
UCSD School of Medicine
# Posted By Dylan
| 8/1/06 1:01 PM
For those who want to see a real example, click on the Speaking Engagement tab above.
# Posted By Raymond Camden
| 8/1/06 2:37 PM
# Posted By Marc Fathauer
| 8/30/06 1:38 PM
# Posted By Raymond Camden
| 8/30/06 2:02 PM
Thanks
# Posted By Marc Fathauer
| 8/30/06 3:07 PM
http://ray.camdenfamily.com/index.cfm?mode=entry&a...
To be clear - this is an OLD project of mine. It isn't even listed on my projects page yet.
# Posted By Raymond Camden
| 8/30/06 3:14 PM
# Posted By Marc Fathauer
| 8/30/06 4:18 PM
ray.camdenfamily.com/downloads/ical.zip
# Posted By Raymond Camden
| 8/30/06 4:21 PM
# Posted By Marc Fathauer
| 8/30/06 4:22 PM
I saw your gCal application and downloaded it but when i try browsing it, i get this error message "An error occured while Parsing an XML document.
Content is not allowed in prolog." it has something to do with parsing to XML in the file GoogleCalendar.cfc. Anyone experiencing the same thing?
# Posted By Leo
| 9/12/06 7:12 AM
# Posted By Raymond Camden
| 9/12/06 8:27 AM
# Posted By Leo
| 9/12/06 9:35 AM
The XML comes from Google itself. Basically my CFC grabs the XML feed and parses it.
# Posted By Raymond Camden
| 9/12/06 9:42 AM
# Posted By Leo
| 9/12/06 10:28 AM
# Posted By Raymond Camden
| 9/12/06 10:30 AM
Attribute validation error for tag http.
The tag does not have an attribute called result. The valid attribute(s) are url, port, method, username, password, name, columns, charset, path, file, delimiter, textqualifier, resolveurl, proxyserver, proxyport, proxyUser, proxyPassword, useragent, throwonerror, redirect, firstRowAsHeaders, timeout, multipart, getAsBinary.
What am I missing?
# Posted By Jay
| 9/26/06 2:41 PM
# Posted By Raymond Camden
| 9/26/06 3:01 PM
You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members.
The error occurred in C:\Inetpub\wwwroot\NewSite\GoogleCalendar.cfc: line 184
Called from C:\Inetpub\wwwroot\NewSite\GoogleCalendar.cfc: line 19
Called from C:\Inetpub\wwwroot\NewSite\calendartest.cfm: line 3
182 : <cfhttp url="#variables.calendarURL#">
183 : <!--- translate to xml --->
184 : <cfset variables.calendarXML = xmlParse(results.fileContent)>
185 :
186 : </cffunction>
My test page reads like this:
<cfapplication name="gCal">
<cfset reload = false>
<cfif not structKeyExists(application, "gCal") or reload>
<cfset application.gCal = createObject("component", "GoogleCalendar").init("http://www.google.com/calendar/feeds/rollisoj@gmai...)>
</cfif>
<cfset r = application.gCal.readEntries()>
<cfdump var="#r#">
<cfset m = application.gCal.readMeta()>
<cfdump var="#m#">
Does this require a partcular version of Cold Fusion MX? We are using MX 6.1.
Thanks!
# Posted By Jay
| 9/26/06 3:07 PM
# Posted By Raymond Camden
| 9/26/06 3:15 PM
Thanks
# Posted By Jay
| 9/26/06 3:17 PM
# Posted By Raymond Camden
| 9/26/06 3:33 PM
query - Top 0 of 0 Rows
struct
SUBTITLE Jay xxxxx
TITLE Jay xxxxx
I have events scheduled on the calendar but they are not being pulled in. How do I show the data returned from the readEntries query specified in the testa.cfm?
Thanks for all the help.
# Posted By Jay
| 9/27/06 8:34 AM
# Posted By Raymond Camden
| 9/27/06 8:54 AM
# Posted By Jay
| 9/27/06 9:30 AM
# Posted By Jay
| 9/27/06 9:49 AM
# Posted By Raymond Camden
| 9/27/06 10:09 AM
# Posted By Raymond Camden
| 9/27/06 10:10 AM
One last thing...I have time offset in the testa.cfm set to -5(EST) but the time is still showing 1-hour behind what my Google Calendar shows. Any ideas?
# Posted By Jay
| 9/27/06 10:28 AM
# Posted By Raymond Camden
| 9/27/06 10:32 AM
# Posted By Jay
| 9/27/06 10:45 AM
# Posted By Raymond Camden
| 9/27/06 10:50 AM
http://ray.camdenfamily.com/projects/googlecal
A new version was released this morning.
# Posted By Raymond Camden
| 9/27/06 10:51 AM
# Posted By Jay
| 9/27/06 10:57 AM
Sorry about that. :)
# Posted By Raymond Camden
| 9/27/06 10:58 AM
# Posted By Jay
| 9/27/06 3:57 PM
# Posted By Raymond Camden
| 9/27/06 4:03 PM
Why is it that no matter what I put in the calender url var on the testa page, it returns the Holidays calendar? It is obviously a cache issue, but I don't know how to fix it
Thanks
Russ
# Posted By Russ
| 1/11/07 11:29 AM
# Posted By Raymond Camden
| 1/11/07 11:35 AM
Yea I couldn't remember which post I commented on, and I have a new spam filter that I haven't got control of yet, so I didn't get any reply responce...sorry:[
I did figure out the reinit variable and of course it works great!
thanks,
I will have to have a look at that wish list, I am sure I can work the costs into my next project..
# Posted By Russ
| 1/11/07 2:09 PM
# Posted By Raymond Camden
| 1/11/07 7:15 PM
Local variable results on line 179 must be grouped at the top of the function body.
The error occurred in C:\Inetpub\wwwroot\Application.cfm: line 16
14 :
15 : <cfif not structKeyExists(application, "gCal") or structKeyExists(url, "reinit")>
16 : <cfset application.gCal = createObject("component", "GoogleCalendar").init(calendar,-4)>
17 : </cfif>
18 :
Any ideas as to why this would start occuring after a simple Windows update?
Thanks
# Posted By Jay
| 2/5/07 2:17 PM
# Posted By Raymond Camden
| 2/5/07 2:47 PM
# Posted By Jay
| 2/5/07 3:18 PM
# Posted By Raymond Camden
| 2/5/07 3:21 PM
# Posted By Jay
| 2/5/07 4:41 PM
# Posted By Raymond Camden
| 2/5/07 5:06 PM
<cfset u = application.gCal.update()>
Shouldn't this be refreshing the cache?
# Posted By Jay
| 2/6/07 8:43 AM
# Posted By Raymond Camden
| 2/6/07 8:45 AM
# Posted By joe
| 4/9/07 3:03 PM
# Posted By joe
| 4/9/07 3:04 PM
# Posted By Raymond Camden
| 4/9/07 4:33 PM
thx!
# Posted By joe
| 4/10/07 1:35 PM
# Posted By Raymond Camden
| 4/11/07 7:31 AM
The request has exceeded the allowable time limit Tag: cfhttp
The error occurred in C:\CFusionMX7\wwwroot\ows\Calendar\GoogleCalendar.cfc: line 181
Called from C:\CFusionMX7\wwwroot\ows\Calendar\GoogleCalendar.cfc: line 19
Called from C:\CFusionMX7\wwwroot\ows\Calendar\testa.cfm: line 5
179 :
180 : <!--- download xml --->
181 : <cfhttp url="#variables.calendarURL#" result="results">
182 : <!--- translate to xml --->
183 : <cfset variables.calendarXML = xmlParse(results.fileContent)>
--------------------------------------------------------------------------------
Resources:
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
Remote Address 127.0.0.1
Referrer
Date/Time 29-Jun-07 12:22 PM
Stack Trace (click to expand)
at cfGoogleCalendar2ecfc117159695$funcLOAD.runFunction(C:\CFusionMX7\wwwroot\ows\Calendar\GoogleCalendar.cfc:181) at cfGoogleCalendar2ecfc117159695$funcINIT.runFunction(C:\CFusionMX7\wwwroot\ows\Calendar\GoogleCalendar.cfc:19) at cftesta2ecfm1528332162.runPage(C:\CFusionMX7\wwwroot\ows\Calendar\testa.cfm:5)
coldfusion.runtime.RequestTimedOutException: The request has exceeded the allowable time limit Tag: cfhttp
at coldfusion.tagext.net.HttpTag.checkTimeout(HttpTag.java:1905)
at coldfusion.tagext.net.HttpTag.doEndTag(HttpTag.java:1005)
at coldfusion.runtime.CfJspPage._emptyTag(CfJspPage.java:1916)
at cfGoogleCalendar2ecfc117159695$funcLOAD.runFunction(C:\CFusionMX7\wwwroot\ows\Calendar\GoogleCalendar.cfc:181)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:344)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:290)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:254)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:56)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:207)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:169)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:1807)
at cfGoogleCalendar2ecfc117159695$funcINIT.runFunction(C:\CFusionMX7\wwwroot\ows\Calendar\GoogleCalendar.cfc:19)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:344)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:290)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:254)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:56)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:207)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:169)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:194)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:146)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:1634)
at cftesta2ecfm1528332162.runPage(C:\CFusionMX7\wwwroot\ows\Calendar\testa.cfm:5)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:225)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:51)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:69)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:115)
at coldfusion.CfmServlet.service(CfmServlet.java:107)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:78)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:318)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:426)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:264)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
# Posted By Kris Night
| 6/29/07 12:28 PM
# Posted By Raymond Camden
| 6/29/07 12:43 PM
An error occured while Parsing an XML document.
Content is not allowed in prolog.
The error occurred in C:\Inetpub\wwwroot\_Gcal\GoogleCalendar.cfc: line 183
Called from C:\Inetpub\wwwroot\_Gcal\GoogleCalendar.cfc: line 19
Called from C:\Inetpub\wwwroot\_Gcal\testa.cfm: line 5
181 : <cfhttp url="#variables.calendarURL#" result="results">
182 : <!--- translate to xml --->
183 : <cfset variables.calendarXML = xmlParse(results.fileContent)>
184 :
185 : </cffunction>
# Posted By Dale Hans
| 7/24/07 11:08 PM
# Posted By Raymond Camden
| 7/25/07 6:21 AM
But, that brings up the question, is there a way to identify myself to Google in the request so that the calendar can remain private and yet I can get my own results via your cfc?
# Posted By Dale Hans
| 7/25/07 9:01 AM
# Posted By Dale Hans
| 7/25/07 9:03 AM
# Posted By Dale Hans
| 7/25/07 3:01 PM
# Posted By Raymond Camden
| 7/25/07 4:08 PM
I am continuing to work to add Creation of reoccuring events and possibly, create to a secondary calendar. I will send you my complete version of the GoogleCalendar.cfc when I get reoccuring done for your critique.
# Posted By Dale Hans
| 7/29/07 12:00 AM
# Posted By Raymond Camden
| 7/29/07 9:02 AM
Error Executing Database Query.
Query Of Queries runtime error.
The select column reference [starttime] is not a column in any of the tables of the FROM table list.
The error occurred in C:\CFusionMX7\CustomTags\GoogleCalendar.cfc: line 580
Called from C:\Apache2\htdocs\dev\gcal.cfm: line 14
Called from C:\CFusionMX7\CustomTags\GoogleCalendar.cfc: line 580
Called from C:\Apache2\htdocs\dev\gcal.cfm: line 14
578 : select *
579 : from q
580 : where starttime > <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
581 : </cfquery>
582 : </cfif>
Any ideas here? We're running CF 7
Thanks!
# Posted By Steve-O
| 1/9/08 4:48 PM
# Posted By Raymond Camden
| 1/9/08 5:15 PM
# Posted By Mark
| 1/28/08 10:02 PM
# Posted By Raymond Camden
| 1/29/08 8:12 AM
# Posted By Mark
| 1/29/08 8:18 AM
I'm assuming that is my problem... When I run on CF MX I get the error:
Local variable colNames on line 41 must be grouped at the top of the function body.
Will this only run on certain versions of coldfusion???
# Posted By Mike
| 4/10/08 1:05 PM
# Posted By Raymond Camden
| 4/10/08 1:16 PM
The method 'getCalendars' could not be found in component D:\casemed_web\newhome\GoogleCalendar.cfc.
Check to ensure that the method is defined, and that it is spelled correctly.
# Posted By Ann
| 9/4/08 3:43 PM
<cffunction name="getCalendars" access="public" returnType="query" output="false" hint="Returns all the calendars for the user.">
Did you maybe typo the call? getCalenders?
# Posted By Raymond Camden
| 9/4/08 8:47 PM
the recurring string thats returned seems very difficult to parse, in the google api docs it says about using a getTimes() function but i can't figure out how i would use it.
I managed to get it to show a date in the date field by changing the following line
In the parseRecurrenceDate function in GoogleCalendar.cfc
I changed
<cfset datestring = reFindNoCase("DTSTART;VALUE=DATE:([0-9]+)", arguments.recurrence,1,true)>
to
<cfset datestring = reFindNoCase("DTSTART;TZID=Europe/London:([0-9]+)", arguments.recurrence,1,true)>
BUT this obviously wont work if your timezone isnt europe/London
If anyone has a cleaner nicer solution or i am doing something silly please let me know.
# Posted By Raymond Camden
| 12/7/08 6:37 PM
It really is difficult to get this working actually because this type of event i need the time as well and when it does the parseRecurrenceDate function there is no time information and this is a recurring event that happens between 7pm and 9pm which i'll need to display.
The bit where you do this parsing it hurting my head i'm wondering if i can get the start time and end time in the output somehow for recurring events.
