Does any one know how to have the option to download the current calendar (day, week, or month) as a .ics file or i calendar format? Avi mentioned is here.
I could not find anything other than keywords in the Calendar docu, but that didn’t seem to be the thing I was looking for. How would I do this?
Export/download Calendar as .ics
You need to create an Asset Listing that generates a .ics format page, then apply a blank design to it. I know I have one on a system somewhere, so I'll try and find it and post the contents.
Here's an example of how to export Single Calendar Events in iCal format using an Asset Listing Page.
Create an asset listing page
- Select 'Single Calendar Events' as 'Asset Types to List', set Root Node.
- Display format for page contents should look like the following (ref: RFC 2445)
BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Squiz Example iCal Export//NONSGML v1.0//EN %asset_listing% END:VCALENDAR
- Make sure you are using 'Raw HTML' content type so that you don't get extra HTML tag like <p> or <br> in the final .ics file
- Create a 'Customised Asset Type Formats' for 'Single Calendar Events', the display format should look like the following
BEGIN:VEVENT DTSTART:%event_start_time_ical% DTEND:%event_end_time_ical% SUMMARY:%asset_name% END:VEVENT
[b]Create a blank design[/b]
1. The content of the parse file should be
2. Apply this design, so that you can download content as .ics file when you visit the asset listing page created earlier
[b]Example[/b]
An example of the final .ics file with one event will look like
BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Squiz Example iCal Export//NONSGML v1.0//EN BEGIN:VEVENT DTSTART:20070425T000000 DTEND:20070426T000000 SUMMARY:Anzac Day END:VEVENT END:VCALENDAR
Bringing up an old topic, as I am finally implementing this.
With the given example being an asset listing, it will only list a certain number of events, rather than a set period such as a month, week, or day. So, the logical use would then be to use a Calendar asset for this, because I can then have the .ics file have 1 week periods, or what ever I choose.
But the problem is, that with a calendar asset, it inserts the calendar javascript even when I don't want it. So it creaks me ical formatting. Any ideas on how to get around this, and be able to create the ics file for a week period, month or day, without having the calendar asset insert its javascript?
Right now it is looking like this:
BEGIN:VCALENDARVERSION:2.0 PRODID:-//PUC iCal Export//NONSGML v1.0//EN <script type="text/javascript" src="http://websrv.puc.edu/__lib/js/general.js"></script><script type="text/javascript" src="http://websrv.puc.edu/__lib/js/translation.js"></script><script type="text/javascript" src="http://websrv.puc.edu/__data/system/core/js_strings.en.js"></script> <!-- GENERAL CALENDAR PAGE JAVASCRIPT, ALWAYS PRESENT --> <script type="text/javascript"> <!-- var formSubmitted = false; function clickChild(elt) { if (formSubmitted) { return; } formSubmitted = true; linkChildren = elt.getElementsByTagName("A"); if (linkChildren.length > 0) { linkChildren.item(0).click(); } } function sq_cal_redirect(url) { if (url.getElementsByTagName) { url = url.getElementsByTagName("A")[0].href; } if ((typeof moved == "undefined") || !moved) { document.location.href = url; formSubmitted = true; } } function statusBarMsg(m) { window.status = m; setTimeout('window.status=""', 2000); } //--> </script> <!-- /GENERAL CALENDAR PAGE JAVASCRIPT, ALWAYS PRESENT --> BEGIN:VEVENT DTSTART:20080107T000000 DTEND: SUMMARY:Instruction begins END:VEVENTBEGIN:VEVENT DTSTART:20080107T190000 DTEND: SUMMARY:Movie Monday END:VEVENTBEGIN:VEVENT DTSTART:20080108T173000 DTEND: SUMMARY:Women's Basketball END:VEVENTBEGIN:VEVENT DTSTART:20080108T193000 DTEND: SUMMARY:Men's Basketball END:VEVENTBEGIN:VEVENT DTSTART:20080109T190000 DTEND: SUMMARY:Mountaintop Prayer Meeting END:VEVENTBEGIN:VEVENT DTSTART:20080109T190000 DTEND: SUMMARY:Live Jazz Jam Wednesday END:VEVENTBEGIN:VEVENT DTSTART:20080110T100000 DTEND: SUMMARY:Colloquy: Martin Luther King Jr. END:VEVENTBEGIN:VEVENT DTSTART:20080110T173000 DTEND: SUMMARY:Women's Basketball END:VEVENTBEGIN:VEVENT DTSTART:20080110T190000 DTEND: SUMMARY:Fusion General Session END:VEVENTBEGIN:VEVENT DTSTART:20080110T193000 DTEND: SUMMARY:Men's Basketball END:VEVENTBEGIN:VEVENT DTSTART:20080111T000000 DTEND: SUMMARY:Last day for bookstore refunds END:VEVENTBEGIN:VEVENT DTSTART:20080111T170700 DTEND: SUMMARY:Sunset END:VEVENTBEGIN:VEVENT DTSTART:20080111T200000 DTEND: SUMMARY:Vespers END:VEVENTBEGIN:VEVENT DTSTART:20080112T100000 DTEND: SUMMARY:Majestic Worship: Tim Mitchell END:VEVENTBEGIN:VEVENT DTSTART:20080112T110000 DTEND: SUMMARY:Sabbath School Classes END:VEVENTBEGIN:VEVENT DTSTART:20080112T121200 DTEND: SUMMARY:The Gathering: Tim Mitchell END:VEVENTBEGIN:VEVENT DTSTART:20080112T190000 DTEND: SUMMARY:Rasmussen Art Gallery Opening END:VEVENTBEGIN:VEVENT DTSTART:20080112T190000 DTEND: SUMMARY:SA Presents END:VEVENTBEGIN:VEVENT DTSTART:20080112T190000 DTEND: SUMMARY:Concert: Piano Trio END:VEVENTBEGIN:VEVENT DTSTART:20080113T080000 DTEND: SUMMARY:CSET END:VEVENT END:VCALENDAR</pre>
Most of my iCal implementations just output all the assets (i.e. all events) instead of just a particular period. How many events do you have? Because iCal is auto-updating, it doesn't really matter how many events are in the feed itself.
Right now we have almost 1000 events, and more being added every day. Are you saying that iCal will continue to look at the URL that I have set for the ical version of our events calendar, and continually update itself with new events, and remove old ones?
Absolutely. The default for iCal is to update every 15 minutes. :) With over 1000 events, I'd ensure that caching was active for the .ics URL, but otherwise you should be fine. How long does it take Matrix to generate an asset list of 1000 events? You might also want to look at the auto re-caching stuff in v3.16.
Having said that, I still think the Calendar List View should be as free of JavaScript as possible, so that you could create .ics format on a per month/week basis. I'd submit that as a feature request, perhaps. Or even let the What's New asset base its date range on an asset attribute/metadata field.
[quote]Absolutely. The default for iCal is to update every 15 minutes. With over 1000 events, I'd ensure that caching was active for the .ics URL, but otherwise you should be fine. How long does it take Matrix to generate an asset list of 1000 events? You might also want to look at the auto re-caching stuff in v3.16.
Having said that, I still think the Calendar List View should be as free of JavaScript as possible, so that you could create .ics format on a per month/week basis. I'd submit that as a feature request, perhaps. Or even let the What's New asset base its date range on an asset attribute/metadata field.[/quote]
Thanks Avi. It takes about about 7 seconds for those 1000 events to be listed with an asset name and ical start time. So I think I would cache this.
I will submit the feature request.
Just a thought. You have to actually subscribe to the .ics URL in order to get the constant updates, just downloading the file gives you a static file.
so, I will need to direct my users to subscribe to the file. Or is there a way you can craft the URL to let users subscribe?
The URLs are the same -- if I click on a .ics file on my Mac, it fires up iCal and subscribes to that Calendar. Its only on silly browser/OS combinations that it downloads the file (usually when someone doesn't have a calendar application installed).
Does the following set the mime type?
Wikipedia is saying it needs to be text/calendar no text/ics ...
I am having problems with safari just loading the content up into a page, rather than downloading it, or opening it in iCal. I am wondering if it is mime type issues....
Yes, the content_type should set the MIME type. I use text/calendar myself.
I'm sure I remember someone (probably Avi) successfully creating an iCal feed that included recurring events. (And iCal understood they were recurring events). Anyone got a type format to help me out?