Closed (fixed)
Project:
Calendar
Version:
5.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Feb 2008 at 01:32 UTC
Updated:
7 Mar 2008 at 17:02 UTC
Hi -
Just completing an upgrade to this 2.0 RC - looking for some increased iCal support.
Did the install & DB updates OK, and modified mySQL to support timezones & imported the timezone files (a bit of a hurdle there if you don't have root access to your box).
Calendar is working (and looks great), but getting this warning message, and no inbound ical available.
warning: Invalid argument supplied for foreach() in /httpdocs/modules/calendar/calendar_ical.module on line 107
Comments
Comment #1
greg@beargroup.com commentedHave a couple hundred of these warnings after and afternoon... are appearing on every page load when the calendar block is active. Turned that off for now, but are appearing on each calendar page load.
Comment #2
sonicthoughts commentedI have the same issue.
using civicrm ical.
Comment #3
sonicthoughts commentedI may have found the issue - but am not good enough to fix it :)
modules/calendar/calendar_ical.module calls date_ical_import to parse. I noticed that the function does not return a VEVENT which is what the foreach() is trying to parse. below is what is sent to line 107 as calendar:
Array ( [0] => Array ( [VERSION] => 2.0 [PRODID] => -//CiviCRM//NONSGML CiviEvent iCal//EN [20080224T021500Z] => Array ( [0] => Array ( [UID] => CiviCRM_EventID_3@http://onepurim.com/ [SUMMARY] => Wednesday Men's Class [DESCRIPTION] => Join Guys at join Steve Eisenberg at his apartment every Wednesday evening as he hosts a personal growth class known as MUSSAR. The class is geared for beginners and scholars. The class is given by businessman Heshy Lieberman. [CATEGORIES] => Class [DTSTART] => Array ( [DATA] => 20080224T010000Z [type] => DATE-TIME [datetime] => 2008-02-24 01:00:00 [all_day] => 0 [tz] => UTC ) ) ) [LOCATION] => Bar Association 42 West 44th st between 5th & 6th, 42 West 44th st between 5th & 6th new york, NY 10012 United States [URL] => http://onepurim.com/civicrm/event/info?reset=1&id=2 [20080229T161500Z] => Array ( [0] => Array ( [UID] => CiviCRM_EventID_2@http://onepurim.com/ [SUMMARY] => JICNY Networking Group [DESCRIPTION] => The JICNY networking group is a quality forum for respected professionals to create circles of influence. We will only have one professional from each profession represented. Applicants must have a high level of personal integrity, be a respected professional in their field and be willing to contribute 10% of all sales from originating from the group to the JICNY. Please contact Jodi at jodi@jicny.com for more information. [CATEGORIES] => Networking [DTSTART] => Array ( [DATA] => 20080229T141500Z [type] => DATE-TIME [datetime] => 2008-02-29 14:15:00 [all_day] => 0 [tz] => UTC ) ) ) ) )
Comment #4
sonicthoughts commentedHas anyone tried the ICal2.dev with civicrm? It will not work.
Comment #5
greg@beargroup.com commentedHi - do you think this is a way CiviCRM has structured its iCal output? I just tried adding a Google Calendar for national holidays, and it seemed to work - although only the very first item (Easter) showed up. I think you are on to something with the code above... Downloading the very latest drop now of calendar to see if this has been addressed - looks like there was a lot of activity in the iCal support over the last month.
Comment #6
greg@beargroup.com commentedHi Karen - if you are monitoring this, Sonic wisely opened this up on CiviCRM's forum also:
http://forum.civicrm.org/index.php/topic,2368.0.html
And a new bug logged there: http://issues.civicrm.org/jira/browse/CRM-2654
Not quite sure what side this falls on - I'm not getting exactly what I'd expect from any iCal feed really. Adding this one with National Holidays, only brings up easter...
http://www.google.com/calendar/ical/usa__en%40holiday.calendar.google.co...
I have a test server with CiviCRM 1.9, Date/Calendar 2.0 installed if you need a place to test this specific environment. At least two of us are running it... :)
Thanks!
-Greg
Comment #7
karens commentedThe 5.2 version is all new and I'm jumping around fixing up various parts of it. The iCal code has been cleaned up and improved quite a bit, but it doesn't work exactly the same as it did before (it should be able to handle lots of things it couldn't before).
However neither the ical import nor the ical export have gotten much attention yet since I'm focusing on the rest of the code.
Anyway, I took a look at the ical from #6 and it is all done with repeat rules, meaning it shows a date in, say 2002 and then says to repeat it. If you take your calendar back to the original year for each event in the feed, you'll see it, so it is picking up the original event. It's just not computing the repeats yet, which is because I haven't had time to implement that because that's going to be more complicated to get working. You have to read the feed, figure out all the events that the repeat rule should create (they're not specified, they have to be computed), then display them.
Any ical feed that shows normal, non-repeating, events should work right at this point.
Comment #8
sonicthoughts commentedHi Karen: These were not for repeating events.
Thanks for all the great work - please let us know when you return your focus to ical. It would be great if we can make sure that civicrm is compatible.
thanks,
s.
Comment #9
karens commentedIf you're having trouble importing CivicCRM's output, it must also be publicly accessible. I've had other people report that there is something you have to set on the CivicCRM side to make the feed public, and if you don't do that you will get a file not found message and no feed.
If it's public and that's not the problem, I need to see exactly what the ical output looks like to tell anything. A link to a public feed would be helpful.
Comment #10
sonicthoughts commentedI believe that access is set up properly.
This is the link: http://onepurim.com/civicrm/event/ical?reset=1&page=1
Here are some entries:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CiviCRM//NONSGML CiviEvent iCal//EN
BEGIN:VEVENT
UID:CiviCRM_EventID_3@http://onepurim.com/
SUMMARY:Wednesday Men's Class
DESCRIPTION:Join Guys at join Steve Eisenberg at his apartment every Wednesday evening as he hosts a personal growth class known as MUSSAR. The class is geared for beginners and scholars. The class is given by businessman Heshy Lieberman.
CATEGORIES:Class
DTSTART:20080224T010000Z
DTEND:20080224T021500Z
LOCATION:Steve Eisnebergs House\, 313 WEA
URL:http://onepurim.com/civicrm/event/info?reset=1&id=3
END:VEVENT
BEGIN:VEVENT
UID:CiviCRM_EventID_2@http://onepurim.com/
SUMMARY:JICNY Networking Group
DESCRIPTION:The JICNY networking group is a quality forum for respected professionals to create circles of influence. We will only have one professional from each profession represented. Applicants must have a high level of personal integrity\, be a respected professional in their field and be willing to contribute 10% of all sales from originating from the group to the JICNY. Please contact Jodi at jodi@jicny.com for more information.
CATEGORIES:Networking
DTSTART:20080229T141500Z
DTEND:20080229T161500Z
LOCATION:Bar Association 42 West 44th st between 5th & 6th\, 42 West 44th st
between 5th & 6th
new york\, NY 10012
United States
URL:http://onepurim.com/civicrm/event/info?reset=1&id=2
END:VEVENT
END:VCALENDAR
Comment #11
karens commentedI think I see the problem. That ical uses:
DTSTART:20080229T141500Z
instead of the more common formats:
DTSTART;VALUE=DATE:20080229T141500Z
or
DTSTART;VALUE=DATE-TIME:20080229T141500Z
There is a patch outstanding for the Date module at http://drupal.org/node/210687 that might fix this problem. You could save me some time and try testing that patch to see :)
Comment #12
sonicthoughts commentedI'm happy to try, but i'm not really the patching type. The patch failed. I think it's because I just installed the latest date module from dev (v 1.21.2.3 2008/02/15) and the patch is revision 1.19. anyway, If you can patch the latest dev version, I'm happy to install it.
Sorry I couldn't help more.
Shawn
Comment #13
dggreenberg commentedKaren - Regarding your comment #11 above...
We had originally used the format you reference as more common, but it caused problems with the prior version of Calendar + Date modules:
DTSTART;VALUE=DATE:20080229T141500Z
... in addition - the iCalendar "standard" (http://www.ietf.org/rfc/rfc2445.txt) uses the same format as what we are currently outputting in CiviCRM in most of their VEVENT examples. From the standard:
That said, we are not experts on calendaring stuff - and if it's your understanding that the VALUE=DATE: is a more universally accepted format and works well with the new Date / Calendar modules, that would be a good argument for reverting :-) Do you know if VALUE=DATE: or VALUE=DATE-TIME is preferable?
Thx for any light you can help shed on this.
...dave (CiviCRM core team member)
Comment #14
karens commentedWhen in doubt, I go to the spec :)
At http://www.ietf.org/rfc/rfc2445.txt it says that both are valid, but it appears to me that not all are supported by all the various places that do calendaring. I was seeing ones with VALUE= pretty often, so decided that must be very common, but it looks like your current format is OK according to the spec.
Anyway, there are numerous possible ways to format dates and my intention was to be able to parse all of them, so if I'm not parsing this one, a valid format, the parser needs some work.
The patch I link to above may help.
Comment #15
sonicthoughts commentedI was unable to run the patch due to errors (probably user error.) I'm also too lame to try coding this, however I'm happy to do any testing or help in any other way.
Thanks Karen and Dave - civievents and drupal calenders are a powerful feature combination and, for what its worth, you guys are opensource rock stars!
Comment #16
karens commentedFirst of all, the patch was against an older version of HEAD, which is why it didn't work. I'm working on getting that, but figured out that is not going to do anything about this problem.
Here's the problem with that CivicCRM link -- it's not a downloaded file, it's a raw text page. The Calendar module is currently designed to expect a file, like the ones you get if you go to a link like http://upcoming.yahoo.com/calendar/v2/search_all/?category_id=8&search_p...
Upcoming.org and Google and others all pass a file rather than displaying a page. The Calendar module passes a file as its ical link by adding headers to it.
Does the current format work for importing CivicCRM events into other calendar programs? If so, I need to figure out how to change the ical function to handle this different format. If not, I think CivicCRM needs to add headers to make this link act as a file download.
Comment #17
karens commentedFWIW, I just tested that CivicCRM link in Google calendar and it won't work there, either. The links created by the Calendar module work fine in Google. So I think those headers are needed for it to work anywhere.
The headers that need to go at the top of the ical page look like:
'Content-Type: text/calendar; charset=utf-8';
'Content-Disposition: attachment; filename="calendar.ics"; ';
Comment #18
sonicthoughts commentedInteresting. I updated the issue on the civicrm side - i hope it gets into the 2.0 release scheduled on 2/25. Note that calendar / Ical works fine (except for the timezone issue) with the latest 1.x version.
BTW - I did try to apply that patch to the 1.19 release from HEAD but it also failed.
Karen - thanks so much for looking into this.
Comment #19
greg@beargroup.com commentedI downloaded my ical file, saved it out as .ics and started comparing this to the upcoming.org file format referenced above
When I remove the end date: DTEND:20080227T020000Z All of my events show up - of course there is no completion date anymore. It looks like this was replaced with DURATION in the sample file.
There are a number of differences - for instance the VVENUE could be used for the Location.
-Greg
Comment #20
karens commentedOK, finally found the problem. There is no problem with the CivicCRM file (although I still think I am right that it won't display in a Google calendar without those headers), the problem was in the new iCal parser regex which was a bit too loose. It only affected icals that use the DTEND format that CivicCRM uses, which is why it showed up as a problem with them and not with other files. The parser was hitting the DTEND in the CivicCRM file and treating it as the end of the event, creating very garbled results.
This should be working right now with the latest commit to the Date module.
Comment #21
sonicthoughts commentedThanks Karen - I will try. Interesting that a patch was submitted to civicrm to make it work - perhaps there are 2 problems. see http://forum.civicrm.org/index.php/topic,2368.0.html .
Will let you know - thanks again.
Comment #22
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.