I've gotten the Date iCal parser code working (at least in my test case with 3 different ical generators). The code is at https://github.com/sdague/parser_ical (it's 2 commits against HEAD, with some debug hanging in there which could be removed).

Would be happy to have it integrated. Works well enough for me to build an aggregate calendar.

Comments

bcobin’s picture

Hooray! Looks like it's working flawlessly... great work!

Will report back if there are any problems, but so far, so good... thanks a million!

bcobin’s picture

Wow - it's working nicely, but I think I found a bug when it comes to importing categories. A category I'm importing into Tags (using freetagging) is Fundraiser - Southampton; this gets imported as:

Fundraiser - SouthamptonCALSCALE:GREGORIAN

CALSCALE:GREGORIAN is the next thing in the iCal feed, so it seems like the Category field isn't being properly parsed.

I'll also note here that there's no "title" source - I've been using "summary" as the title, but that's a workaround.

I'm using the iCal Creator method, BTW.

Otherwise, it looks to be working great - thank you!

bcobin’s picture

Category: task » bug

This should probably be a separate thread, but system throws the following error when used with the Date API iCal parser:

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /batch?id=98&op=do StatusText: OK ResponseText: Fatal error: Method name must be a string in [site]/sites/all/modules/parser_ical/includes/ParserIcal.inc on line 63

iCal Creator parser seems to work fine with the exception as noted in the previous post.

sdague’s picture

please run git on your directory and tell me the git version.

bcobin’s picture

Thanks, sdague - I can't figure out git for the life of me, so I've been going to https://github.com/sdague/parser_ical/downloads and downloading the tar.gz archive.

Version is sdague-parser_ical-bcc6453.tar.gz

The site is currently in staging, so I can fool around - feel free to shoot me a message if you'd like me to do so or if you'd like to yourself. The anomalous behavior is easily reproducible and (I'm hoping) shouldn't be too hard to track down, at least when it comes to iCal Creator. Thanks much!

lsolesen’s picture

@sdague Maybe you should offer yourself as a co-maintainer? Seems that ekes does not have time for the 7.x-version at the moment?

bcobin’s picture

This thread seems to be the only action when it comes to having iCal import for D7 - I'd say this is a pretty important function generally, and for sites dealing with externally-generated events, the lack of such functionality could likely be a show-stopper when it comes to using D7.

Although I have yet to try with all-day events, different timezones, etc., what @sdague has done seems to be working very well with the two exceptions as noted above. I wish I was a coder (I'm not), but it seems to me that there must be somebody out there with the chops to take this the extra mile - it seems like it's 98% there.

In my case, I'm working with a CiviEvent iCal feed - I'd be willing to do whatever I can to try to get this working; frankly, I'm in a holding pattern until I can get this resolved in the hopes I don't have to resort to some sort of manual event entry. Ick.

Thanks for the shout out, @lsolesen - short of becoming a module co-maintainer, just a little more work on the code to address these two issues would be a big deal; in any event, I'd take it!

Thanks to you, to @sdague and the community... the beat goes on...

bcobin’s picture

After further investigation, I suspect that the CiviEvent iCal feed may be malformed. I really am no expert here (far from it), but in the template file that generates the CiviEvent iCal feed, CALSCALE:GREGORIAN appears within the event loop, which on the surface of it seems to be wrong - to me anyway.

iCalCreator specifies the declaration can happen only once and, additionally, having different calendar types within the same calendar seems to make little sense; in any event, changing the field order in the template seems to solve the Tags problem as listed above. I don't yet know if there are adverse consequences, but in looking at other iCal feeds, I see the declaration in question appearing before just about everything else.

Specifically, in sites/all/modules/civicrm/templates/CRM/Core/Calendar/iCal.tpl moving CALSCALE:GREGORIAN (line 41 in 4.1.3) to before the foreach statement seems to solve the problem. (I inserted it at line 30, FWIW.)

I won't mark this as fixed yet - greater minds than mine need to weigh in - but for now (hold your breath), it looks like there is finally finally a working method for importing events from iCal feeds into D7. Hooray!

Thank you SO much sdague - you are a rockstar! Now, back to work (starting with a report to Civi)... woo hoo!

Matthew Davidson’s picture

Status: Active » Needs review
StatusFileSize
new1.86 KB

The observant will have noticed that ekes merged in sdague's branch about a week ago (Thanks!). The attached patch restores the dtend source output handler which had been commented out at some stage (causing a missing handler error when trying to map dtend to a date field), makes the dtstart source name less ambiguous (when I first saw it in the UI I thought it might mean the post date of the event rather than the event start date), and does some superficial code tidying.

I haven't yet found anything else serious enough to justify holding off on creating a 7.x-2.x-dev release node. How about it @ekes?

Renee S’s picture

Confirmed, this works for me. I'd love to have an official release :)