I've added iCal support as a beta feature for the Views Calendar module. It is a separate module which you can enable or not which gives you the ability to export as well as import ical feeds. This feature is still in development. It is not recommended yet for production sites!!
It requires the HEAD or 5.x snapshot version of both the Calendar and the Date module (the Calendar module now requires the Date API which is packaged with the Date module. The Date API was split out to provide date functionality to other modules with no dependency on CCK).
To use it, enable the new Calendar iCal module, along with Calendar, Views, and Date API.
To export the calendar as an iCal feed, follow the instructions to create a calendar, and add a fourth Calendar argument to your view, the Calendar: iCal Feed argument.
To import iCal feeds from other locations into your calendar, choose the 'iCal' tab you see when looking at your calendar and fill out information about the feeds you want to insert into the calendar.
Imported feeds also get added to the iCal export, so you can add several feeds to your calendar, then export all of them as a combined ical feed.
There is a demonstration link on the Calendar project page that has an import and export of feeds from Upcoming.org.

Comments
IMPORT? Oooooh....
Karen, you're awesome.
Now ... I know I should just go read the source, but I'm lazy. ;-)
Does the import slurp VEVENTs into nodes, or store things separately with a hook to merge data at display time? If nodes, how are you handling changes to existing items? Maybe storing the UID in a field, so a future update can differentiate between VEVENTs that are changed versus ones that are new? How does (or will) it handle recurring events? Does it do anything with X-MOZILLA-RECUR-DEFAULT-UNITS and X-MOZILLA-RECUR-DEFAULT-INTERVAL?
Is it intended for feed aggregation, or can it be used to take an existing iCal and convert into native Drupal nodes?
This is very very welcome. I will be playing with it as soon as I get a chance!
THANKS!
Paul Chvostek — Developer, integrator, Internet plumber.
What I'm doing in the
What I'm doing in the current code is grabbing the ical feed and parsing it into an array of pseudo nodes, then caching the results. In the calendar, I created a hook to add items to the array of event items that the Views produces, and the ical module uses that hook to insert its nodes into the view. Then I run the combined node array through the calendar api to create the calendar.
Not sure yet if there will be a better way to do this, but this seems to work pretty smoothly and with the cache shouldn't be too much of a resource hog, I hope.
This is still basic. I'm ignoring repeats and I'm ignoring things like the VVENUE tags that Upcoming.org adds with address info, there's no access control (I'm assuming the feed is already public so it's not needed), and I'm not trying (yet) to provide a way to permanently save the info as Drupal nodes. All of those things can potentially be worked on.
Import to Dates
You can now use Date Copy (in the 5.x version of the Date module) to import an iCal feed into Date nodes. This is an alternative to using the Calendar iCal import to display a feed in a calendar. So you can:
1) Use the Calendar iCal module to display iCal feeds in a calendar without actually turning the iCal events into nodes, OR
2) Use the Date Copy module to import an iCal feed and create a CCK date node for each imported event (and then you can display the nodes in calendars in the same way other nodes are displayed).
Both modules are still a little beta-ish, but are working, at least for me. Post problems on the appropriate issue queue so we can iron them out.
Neither module yet supports iCal repeat rules, that would be a future feature request, but they will create either a node or a calendar item for each distinct iCal event.
this sound almost too nice
this sound almost too nice to be true..:] ..but to be honest, I just cant find neither the 'iCal tab' nor the import functionality..? ..I installed the calendar module - but cant find the calendar ical module...:| So CCK, Calendar, Views, and Date API ane all up and running on a 5.1, but no iCal 4me..?¿ ..pleaze.. - ..help..?¿
thank you very (very!) much, greetz from berlin, till..
ps: i also cant really find the demonstration link on the Calendar project page..?¿
The ical module is at
The ical module is at http://cvs.drupal.org/viewcvs/drupal/contributions/modules/calendar/, it maybe didn't make it into the tarball by the time you checked.
You're right, I forgot to post the demonstration link on the project page so I'll add it. It's http://www.elderweb.com/demo/calendar/.
The iCal tab should show up
The iCal tab should show up when you view the calendar. The tab is a bit buggy because Views just added tabs in the latest version and Views uses an odd method of defining tabs that doesn't play well with the usual way of defining them with the menu hook. Anyway, you should still be able to see the tab if you use the latest version of the Calendar module.
And by latest version she
And by latest version she means latest Dev version -- the tabs are still experimental and haven't been released into the wild as an official release yet.
Sorry Earl! I hope I didn't
Sorry Earl! I hope I didn't confuse things or sound like I was being critical about them. I really like those new tabs, they'll be very handy.
Not at all! You clearly like
Not at all! You clearly like them since you're trying to play nice with them, but they're still infants and are being selfish. We have to train them properly. =)
Help exporting an ical feed?
Thanks for providing the iCal finctionality!
I'm having trouble getting it working though. I upgraded to the latest versions of Date and Calendar.
I defined a new view, and in the Page are I selected "Provide Page View" and made View Type
be "Calendar: iCal feed".
I selected my fields and filter appropriately.
I added Year, month day arguments, and also added the 4th argument, Calendar: iCal Feed
and selected Display All Values for it.
When I hit the url I assigned, I get an ical file with no items in it:
To test whether my criteria was set properly, I edited this View and changed View Type to
Calendar, and I could see a calendar with my events on it. So my filter and fields are
correct.
What might be going on here? Any clue?
Thanks,
-Bob
Page type must be calendar
You have to have the type set to Calendar for ical to work, so if you didn't have it set up that way in the first place, it won't. It sounds like you did everything right except that.
If you still have problems after that, report it on the Calendar issue queue and be sure to post an export of your view.
Hm, still doesn't work
Hi Karen,
Thanks for the quick reply.
I have the type set to Calendar, and I can see the visual display of events on the
month view that comes up. When I click on the icon at the bottom, it offers up
calendar.ics, but it doesn't have any events in it.
Out of curiosity, what is Type Calendar: ical feed supposed to be used for
I put a request in for support and included an export of the view.
Thanks,
-Bob
Oh, I see what your
Oh, I see what your confusion was. That type is there to establish the ical display as a plugin in Views and the Calendar module uses it in when you click on the icon. You're not meant to use it when you set up your Calendar. There's probably a better way to do this, but didn't have time to research other, possibly better, ways to get this working.
So for now, just set your Calendar up with the Calendar type, not the Calendar iCal type.
hCalendar
Are you making use of, or have plans to use, the microformat hCalendar? Check out http://microformats.org/wiki/hcalendar if you aren't already familiar with it. It seems to aid in the sharing of calendar/event information.
So...
I'd love to see an example of, say, aggregating hCalendar or another real "sharing" use. Every implementation I've seen takes hCalendar and converts it to a vCal so desktops can use it.
I mean, it's trivial to add support for outputting hCalendar -- it's just HTML tags -- but KarenS iCal support lets you mix multiple iCal feeds, aggregate them, and output them as a combined iCal feed -- which anyone on the desktop or Google Calendar etc. can use today.
Sorry, rant off on hCalendar / microformats in general. Would love to see a patch that adds it....
iCal and CiviCRM's CiviEvent Component
Hi Karen,
We were thrilled to see the iCal feed import in Calendar - as we have just released CiviCRM 1.7 with CiviEvent component - which allows CiviCRM folks to create and manage events.. AND we include in iCal feed of all current/future public events in the functionality.
Michal Mach and I have played with and installed the latest (I think) Calendar code (plus dependent mods) on our public demo and configured it to pickup the CiviEvent feed.
It's working amazingly well - and will be a super cool feature for our Drupal users. You can see the demo calendar here:
http://demo.civicrm.org/drupal/calendar
... and the source iCal feed here:
http://demo.civicrm.org/drupal/civicrm/event/ical?reset=1&page=1
We have one issue and one question, and one "issue":
Question: Does the iCal "import" automatically pickup changes in our iCalendar feed (e.g. when someone posts a new event in CiviEvent which is reflected in the feed page)? Or does the site admin need to run a cron job or some other task in order to update the "cache"?
Issue: The values we're outputting for start and end TIMES seem to work when I import into Mac Ical.app and also importing into Google Calendar. However, they are not displayed properly in the Drupal Calendar. Not sure if this is a settings problem on our site, or an issue with our output or ??
Example from the demo data for our "Rainforest Cup Youth Soccer Tournament
The event is set up with the following start/end in CiviEvent:
October 27th, 2007 7:00 AM through October 29th, 2007 5:00 PM
Our iCal output is:
DTSTART;VALUE=DATE:20071027T140000Z DTEND;VALUE=DATE:20071030T000000Z
The Drupal calendar displays Start Time as 21:000 and End Time as 7:00 (http://demo.civicrm.org/drupal/calendar/2007/10)
Thx for your work on this! and any light you can shed on the above.
How did you do it?
Possibly the wrong place for this post, but I'll give it a shot.
I would love to link the CivEvent module with my calendar install, but I can't get it to work.
I updated my Civcrm codebase last week, and downloaded all of the modules today (Calendar, Views, Date). When I enter the url for the CivCRM iCal info it seems to work, but nothing is displayed on my calendar.
Any ideas?
Regarding the date issue that you stated above, my first thought was the offset that you have set in your drupal install, the other is within the calendar its self. Can you find a setting that is exactly 7 hours off?
Either way, according to the times you stated above your iCal output should be:
DTSTART;VALUE=DATE:20071027T073000Z DTEND;VALUE=DATE:20071029T170000Z
BTW: This is how I've seen iCal date info used (Time: Wednesday, May 30, 2007, 1:00:00 PM - 4:00:00 PM):
DTSTART;TZID="(GMT-06.00) Central Time (US & Canada)":20070530T130000
DTEND;TZID="(GMT-06.00) Central Time (US & Canada)":20070530T160000
It seems like you have bad output iCal info, as well as something fishy with your timezone setup, possibly in your Drupal install.
CiviEvent iCal Format and How...
RE: How to do it, the one "trick" we found was that we had to go into the Calendar "Setup" tab and then Save it before we were able to see CiviEvent feed items in the calendar (drupal/calendar/setup/edit). Once we did that, we entered the CiviEvent feed URL under the iCal setup tab (drupal/calendar/ical) and VOILA - the sample events show up.
EX: this is the iCal feed URL for our public demo:
http://demo.civicrm.org/drupal/civicrm/event/ical?reset=1&page=1
Regarding the Event Time Issue...
We are following the RFC2445 format for Date-Time element expressed as UTC time:
RFC2445
Our demo server is at UTC -7 (US Pacific Time) and our Drupal timezone is set accordingly. Hence, our output for the sample event which starts at 12:00 noon is DTSTART;VALUE=DATE:20070617T190000Z (i.e. 1900 hours UTC). I'm going to play with using the other two formats in the RFC (local time, and local time w/ time zone reference - which is the format you've referenced above more or less) - and see if any of those work better.
Of course, feedback from the developer(s) would be most awesome :-)
time issues
I know you are awaiting a response from the developers, and this may belong in a forum surrounding CiviCRM however based on what you just said regarding the time the output you stated above is incorrect:
This would be October 27th, 2007 2:00 PM through October 30th, 2007 12:00 AM
Also, from the demo site you sent in CivEvent you have:
June 6th, 2007 2:00 PM through June 7th, 2007 8:00 PM
but the calendar outputs:
DTSTART;VALUE=DATE:20070606T210000Z DTEND;VALUE=DATE:20070608T030000Z
which is: June 6th, 2007 9:00 PM through June 8th, 2007 3:00 AM
You probably already know all of this, and I'll post no more, but it seems like the time zone offset is being missed at some point.
The reason you needed to use
The reason you needed to use the setup tab and save it was because the caching wasn't set up correctly and wasn't clearing. I think that is fixed in the latest dev version.
I don't doubt there are still timezone issues that need to be addressed, if those are not already posted on the issue queue, please add them there.
Thanks!
solution: fix logic error in date_ical.inc
see http://drupal.org/node/156418 for (abbreviated) explanation and code patch. works for me, and i'm pretty sure it'll solve this problem, at least. ymmv.
hth,
.b
Anyone test above patch
Just checking if anyone used the above patch? If so did it resolve the date issues?
Also, when I view the day that the CiviEvent event is listed on I don't see the event. It shows up in the month view (on the wrong day) but I can't see it on the day view.
-M
Views Calendar module
Good work.
Thank for this new option.
works sweet
Just ignore what i said before :D
all works sweet.
mike
Is there anybody out there...
wrong date in title...
I've see your calendar demo at
http://www.elderweb.com/demo/calendar/
now i have a problem like your on my site...if I click on a day on the calendar the title node is bad.
http://www.elderweb.com/demo/calendar/2007/10/1
i see
Friday, December 1 2006
do you have any idea how we can resolve this??
thanks
lorenzo..
What version?
Sorry about the late addition to this thread, but I am having the same problem: I just can't see how / where I am supposed to add iCal feeds.
I am running the most recent (stable) versions of all the required modules on a fresh install of 5.3. Should I be using anything different? Is there direct URL to the page that lets me add icals?
Help Needed right away!
Hello,
Our web firm is having some trouble with some ical integration.
Most events show up in ical as one hour off, while others show up with the correct time.
Any ideas or direct support would be much appreciated.
Please email me directly at james.welsh@ursaminor.com
Thank You!!
Problems with iCal import
Hey,
I tried to get the iCal import working. I used this manual (http://drupal.org/node/341716), when I enter the link for my iCal file after the 4th step and submit all that, I always get the following failure (the same applies if I am uploading an iCal file):
* warning: Invalid argument supplied for foreach() in /var/www/web28/html/drupal/sites/all/modules/parser_ical/parser_ical.module on line 101.
* warning: Invalid argument supplied for foreach() in /var/www/web28/html/drupal/sites/all/modules/parser_ical/parser_ical.module on line 101.
Then its not possible to map the fields, because there are only 3 or 4 fields to map, but only those which shouldn't be mapped. However there should be many fields to choose from.
Has anyone an idea on how to solve this?
Btw. The iCal file is not empty!
Thanks!
Import problem solved
I dont know why the upload does not work, but the reason why the google calender import did not work was, because the calender was still private.
Invalid start of ical
I have a problem which has just arisen (again)...
My ical views (using the calendar module) are failing to validate because I am getting some 'garbage' appearing at the start of the output view.
Rather than seeing
BEGIN:VCALENDARI am seeingBEGIN:VCALENDAR.However, if I download the generated .ics file, it shows correct code! So the 'bad stuff' is only appearing when trying to link to the calendar view from Google Calendar or an iPhone.
I can't figure out where this is coming from. It does not show up in the Views preview, only in the actual output.
Can anyone help?
The starting garbage is a UTF8 BOM
Bom or byte order marks tell certain devices about the character set in use. If you altered anything with dreamweaver or an application that includes BOMs they will screw things up. Try to identify any recently updated or changed files by atypical applications. Another file editor may be able to get rid of the BOM, and is almost always at the start of the file.
Thanks! I found a shell
Thanks!
I found a shell script that allowed me to search for BOM in files.
find -type f -print0 | xargs -0 grep -lprintf '^\xef\xbb\xbf'| sed 's/^/found BOM in: /'I have discovered that the culprit was the duplicate_role module.
I see no tabs on the calendar
New to Drupal (only a little)
I installed all the latest modules required for Calendar iCal, and I see no tab above the calendar. All I see are the "Edit | Export | Clone" links when I hover over the view. In fact, with the exception of the module enable/disable, I see no mention of iCal anywhere on the site. Where am I going wrong?
@thiirteen: I think much of
@thiirteen:
I think much of the links about calendar/date/views/ical are just out of date. It took me some time, but I was able to piece together a strategy.
1) Install date, dateAPI, Calendar, etc
2) Install the 'feeds' module. This lets you produca and consume a variety of feeds, map them to nodes, etc. I think feeds relies on job_scheduler, so get that one too.
3) install the ical_parser module. I think you need the dev version. This gives you an additional parsing plugin to the feeds module, letting you consume ical feeds.
4) enable all the above stuff. Your method may vary from here on out, but this is what I did:
5) Created an 'event' content type that has a date field for the start time and a text field for the location.
6) visit admin/build/feeds/list to see the default feeds available.
7) click on 'New Importer' and follow the steps.
Essentially, what you are doing here is giving the importer a name and then configuring some settings. You are going to choose the ical parser as the parser type, and you need to onfigure the node mapper to map your remote calendars feed items against the 'event' node type you want to use.
8) Assuming you got the new import type set, go to /import and choose the new importer you just created. It will ask you for a URL, so paste in your google ical link here.
It will now go and get your ical feed, parse it, and map it to nodes as you specified. Now you have an importer that will run on a schedule as defined in your importer settings.
9) You probably need to go to your calendar view and click edit. Here you want to change a few things, like changing the filter to eliminate everything except nodes with type='event'. You also likely need to change the argument, and the fields, becuase you likely want to show the custom cck field you are using for the date, rather than Calendar's default node->updated time.
It seems complicated, but I was able to install this and configure it in less than an hour.
Thank you for all of your
Thank you for all of your help. I got as far as #7, and did not see a "New Importer" option. My only guess is that I'm missing an essential module. Alas, a newbie still.
Edit: I realized I need to enable Feeds API. However, I am not able to select an iCal Parser anywhere.
There are two modules. One
There are two modules. One called Feed API and a newer module called simply 'feeds'. You need 'feeds'. With feeds enabled, you shold see the New importer tab. It is located at 'admin/build/feeds/create'
This approach for iCal with exposed filters?
I realized that the default iCal feed in the Calendar module doesn't inherit exposed filters a little too late (posted my support request here: http://drupal.org/node/1107510). Do you think that your approach might make it possible to get an iCal feed that does reflect the chosen values for an exposed filter?