Calendar/iCalendar question re: Paint Layout on Asset Listing to create an iCalendar file for a Single Calendar Event


(Steve Scamp) #1

Hi folks,


Sorry if this is an incredibly dumb question, but I guess I'll have to take that chance…



I'm in the process of setting up an Asset Listing that I'm including (via a Paint Layout) on each of my calendar event's pages as a "Download this event to your calendar" type link to an iCalendar file. (Much thanks to the providers of the information in forum threads such as http://forums.squizsuite.net/index.php?showtopic=6471 and http://forums.squizsuite.net/index.php?showtopic=6448).) The link on the calendar event's page includes a GET variable called eventid (e.g. http://www.blah.blah.blah.blah/single_event_in_ical_format?eventid=173563). The Asset Listing is set up with a dynamic paramater that looks for the eventid to use as its replacement root node, and the listing's maximum depth is set to 0 to ensure that it only lists details for that root node/event. (This may not be the best way to do this, but it seems to work.)



I've got it to the point where I can successfully click on the link and have it save the resulting icalendar file to my default calendar (Outlook, Google…). So that part is all good. However when the iCalendar file is lacking an end date/time in its DTEND component, the iCalendar file is rejected by these calendars.



So I thought I'd try creating a Paint Layout and use a Conditional Keyword to use the start date/time as the end date/time as well, when no end date/time was provided - something along the lines of what Julz did on http://forums.squizsuite.net/index.php?showtopic=6471.



I applied the Paint Layout to the Asset Listing that generates the icalendar file for a Calendar event, but unfortunately it doesn't work. It seems instead to be including information about the Asset Listing itself, rather than the calendar event, in the SUMMARY component (where it gives the Asset Listing's name, not the event's name), and no information at all in the DTSTART, DTEND and LOCATION components (presumably because the Asset Listing itself doesn't have the corresponding metadata fields that the Single Calendar Event does).



I've tried using Referring Asset global keywords (%referring_[attribute]%) in the Paint Layout. I've tried using the %asset_contents_paint_[asset id]% keyword in the Asset Listing. Neither approach has done anything to solve the problem. So I seem to be missing something vital - something that might be quite obvious to someone else out in Matrix-land.



Or is it in fact impossible to apply a Paint Layout to an Asset Listing that is using a replacement root node in this dynamic fashion, and get the Paint Layout to bring in the correct data about the actual event?



(My only other option appears to be requiring the data entry people to always include an end date for each calendar entry, but that is problematic for at least a couple of reasons, i.e. people will forget to enter it sometimes, and also people will not want to enter it where there is no closing time to include. So this would be a second- or third-best option, I'm thinking.)



Many, many thanks, as ever, for any advice you can provide, all.



Steve S


(Nic Hubbard) #2

After you applied your paint layout, did you make sure to add the %asset_contents% keyword to your asset listings type format? Then, you can start using your paint layouts type format which will basically replace the assets listings type format.


Did you configure your paint layout for the same asset type that the asset listing is using?


(Steve Scamp) #3

Hi Nic,


Thanks very much for the suggestions:



Yes, I had remembered to configure my paint layout for the same asset type that the asset listing is using. So that wasn't part of the problem I guess.



No, I hadn't added the %asset_contents% keyword to my asset listing's type format. So I tried that just now.



Unfortunately it didn't work for me. Instead of an iCalendar file looking like:



BEGIN:VCALENDAR

VERSION:2.0

PRODID:-//State Library of Queensland//NONSGML v1.0//EN

METHOD:PUBLISH

BEGIN:VEVENT

DTSTAMP:20101209T033526Z

UID:20101209T033526-173065

DTSTART:20100818T003000

DTEND:20100818T013000

SUMMARY:Cooks + Books

LOCATION:South Brisbane

END:VEVENT

END:VCALENDAR



… I got one looking like…



BEGIN:VCALENDAR

VERSION:2.0

PRODID:-//State Library of Queensland//NONSGML v1.0//EN

METHOD:PUBLISH

BEGIN:VEVENT

DTSTAMP:20101209T031655Z

UID:20101209T031655-171517

DTSTART:

DTEND:

SUMMARY:Single event in iCal format

LOCATION:

END:VEVENT

END:VCALENDAR



It seems to be that the Paint Layout is just not recognising that the Asset Listing is listing data from a specified Single Calendar Event (identified by the GET variable called eventid in the original link). Maybe it's just too many layers involved here - Single Calendar Event, with a Paint Layout applied to it, that includes a link to an Asset Listing set to provide that event in iCalendar format, with another Paint Layout applied to that Asset Listing. Makes the head hurt.



Thanks anyway, Nic. Hopefully I'll work out something.



Steve S


(Nic Hubbard) #4

This should be possible, but sometimes it is hard concepting something like this in my mind and trying to figure out what could be going wrong. If you rebuilt it on the Matrix Community site I could help you with getting the setup correct.


(Steve Scamp) #5

I'll do just that, Nic. I'll rebuild it on the Matrix Community site (I've just joined) and will let you know when it's all there to look at.


Thanks again!


(Nic Hubbard) #6

[quote]
I'll do just that, Nic. I'll rebuild it on the Matrix Community site (I've just joined) and will let you know when it's all there to look at.



Thanks again!

[/quote]



Thanks.