1) Google Calendar / Ical integration

Google Calendar didn't like drupal's Ical file.

I've configured several Flexinodes with different event types. Google calendar doesn't want to import them. I downloaded (and attached) an offending .ics file.

The problem is with "=/n" in the file. Google gets pissed and refuses to import.

Also in the file are "=0D=0A" strings - suspiciously similar to linefeeds.

It seems like the offending line of code is this one - the check_markup function:

function _event_node_ical($node) {
  $event = array();
  // Allow modules to affect item fields
  node_invoke_nodeapi($node, 'ical item');
  $event['start'] = $node->event_start;
  $event['end'] = $node->event_end;
  $event['location'] = $node->event_location;
  $event['summary'] = $node->title;
  $event['description'] = check_markup($node->teaser ? $node->teaser : $node->body);         <==== HERE!
  $event['uid'] = url("node/$node->nid", NULL, NULL, 1);
  $event['url'] = url("node/$node->nid", NULL, NULL, 1);

  return $event;
}

It hurts when I do this, any ideas? I'm not sure what's next to do. Hack the code? Fiddle with my filters?

I'm using TinyMCE for editing and have these filters installed for the node (in order):

Encode email addresses
Code filter
URL filter
Quote filter
Glossary filter
Line break converter

Help!

CommentFileSizeAuthor
#1 ical.inc14.35 KBMichaelCole
calendar.ics_2.txt5.01 KBMichaelCole

Comments

MichaelCole’s picture

StatusFileSize
new14.35 KB

Hi all, I wish I could be of more help, but we all do what we can. I know java ;-)

So I've attached an ical.inc file for drupal 4.7 that works with google calendar. It most likely doesn't support non ascii characters. This is ok for my application, and maybe yours too.

This also fixes a BUG in the original - commas in the calendar title were not being escaped - leaving the titles as the last year of the calendar.

Its a working hack.

Thanks for all your hard work guys. There is alot here!

Mike

Occasionally, I used to get an ical file with no flexinodes (only the basic event nodes). I can't reproduce it, but if you find it, write it up!

biohabit’s picture

webcal://www.portlandpeakoil.org/cs/event/ical/all/all

Here is a ical file from the event module that I have confirmed doesn't work with Google Maps.

westbywest’s picture

I've been working with this problem myself and found that the hosting webserver (i.e. Apache) may need to be configured to correctly handle .ics format.

For linux, add the following to /etc/mime.types:

text/calendar ics

Otherwise, you could add the following to Apache's httpd.conf:

AddType text/calendar .ics

This fixed my problem importing the event module's ical feed into Google calendar.

killes@www.drop.org’s picture

Can somebody confirm that this helps and if yes create a patch for the README?

niklp’s picture

Is there a way to do this without having to mess with high-level config files? In .htaccess maybe?

geodaniel’s picture

According to this article it should be possible to use the AddType directive in the .htaccess file instead of editing the settings for the whole server.

I'm under the impression that this shouldn't be necessary though, if content-type headers are being sent by the module when iCal files are requested. Perhaps I'm wrong on that assumption?

It would be worth trying the latest version of the module as there was a recent patch applied that should solve the issues mentioned originally in this thread.

steve hanson’s picture

I can report that at least for me, the latest version of the module just works fine to export calendars to Google.

killes@www.drop.org’s picture

Status: Active » Fixed

great, makeing fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)
patcon’s picture

If this helps anyone, you can create a button so that your Event module events are all imported directly into Google Calendar.

1. Go to http://www.google.com/googlecalendar/event_publisher_guide.html#public
2. Choose the option to add all the calendar's events to Google Calendar
3. Enter the URL of the Event calendar feed into the space provided (usually www.yoursite.com/event/ical)
4. Copy the generated code into your theme wherever you want it to show up.

You now have a nifty button so that users can easily import your calendar into their google account.