Hey,

I was wondering if it would be possible to add support for 'webcal://' links for the ical button. Maybe add an option somewhere where you can choose between html or webcal. I really have no idea how difficult this would be to implement but just thought I'd put it out there.

Comments

babbage’s picture

I too would be keen on this as an option.

Relevant discussion about the capacity for core's usual URL-creating functions to support this: #295021: filter_var() with FILTER_VALIDATE_URL accepts malformed URLs and rejects not all valid URLs

coredumperror’s picture

Version: 7.x-1.0 » 7.x-2.x-dev
Priority: Normal » Major

I'll add this feature to 7.x-2.x as soon as I can.

coredumperror’s picture

Having looked into this over the weekend, it looks like it would be an extremely complicated mechanism to implement, due to the way that Views builds the URL for a display. As best as I can tell, it would require one of two things:

1) Inherit from views_display_plguin_feed to create a whole new type of Views Display, so that you can override the get_path() and/or get_url() methods of that class. This feels like it might be out of scope for Date iCal.

2) It might be possible to write an alter hook of some sort, but I haven't quite found the right way to do so.

Bearing this in mind, I personally don't have enough knowledge about the deep bowels of Views to implement this in a timely manner. But if anyone would like to do some research to figure out some way to implement this, I'd be happy to write the actual code.

coredumperror’s picture

Status: Active » Closed (fixed)

I take it all back. This feature was dead easy to implement; I was just trying to go about it all wrong.

Rather than changing how the View itself outputs the URL, I just had to change the way that the orange iCal icon presents the URL. That change was a dinky one-liner, and is now available in the Date iCal 7.x-2.2 release.

Anonymous’s picture

Version: 7.x-2.x-dev » 7.x-2.2
Status: Closed (fixed) » Active

This feature doesn't appear to be working for me. I'm using the 7.x-2.2 version. When I click on the ical link, it prompts me with the External Protocol Request and opens iCal. Once iCal is open, it shows the prompt "Enter the URL of the calendar you want to subscribe to" and has the Calendar URL filled in (webcal://rdcep.sites-test.globuscs.info/events/events.ics/2013-01). When I click on subscribe, it gives me an error: "There was an error subscribing to the calendar. There was an unexpected error with the request on subscribed calendars (error -1)."

I'm not as familiar with the webcal protocol, so I'm not sure if I'm missing something obvious here...? Is there an option to still use the http:// method?

coredumperror’s picture

The first thing that comes to mind is that you may need to add a % to the path for your iCal Feed views display. Notice how "2013-01" is appearing after the .ics part of the URL? That's because your base calendar view is using that contextual filter, but your iCal feed isn't configured to accept contextual filters. Changing the Path in the Feed Settings for your iCal Feed to events/%/events.ics might fix this problem for you.

Please let me know if you need any more assistance. Otherwise, please close this issue if this suggestion worked for you.

coredumperror’s picture

Status: Active » Closed (fixed)

I found an even better way to implement this feature, which made it easy to implement the option to switch between http:// and webcal://. This new option is available in Date iCal 7.x-2.3.

potassiumchloride’s picture

I'm using the Path in the feed settings, as you describe, but my ical link is still coming up as webcal://[site]?q=node/7/calendar/export.ics/2013-05

Can you advise?

Gribnif’s picture

Looking at the code, it seems you are just changing http:// to webcal:// in the URL. That would be fine, unless your site uses SSL (https://) exclusively.

coredumperror’s picture

@potassiumchloride: The reason you're seeing that "2013-05" on the end of the URL is because it's a contextual filter whcih is not being consumed by a placeholder. So, you need to add another % to your iCal feed's path. My guess is that it's now node/%/calendar/export.ics. If so, you'll want to change it to node/%/calendar/%/export.ics.

@gribnif: I'll fix that. Thanks for the heads up.

potassiumchloride’s picture

@coredumper - Thanks. That was it, exactly, and I couldn't seem to figure out that obvious answer.