====== iCalendar Plugin ====== ---- plugin ---- description: The iCalendar plugin allows you parsed iCalendar .ics and present it in DokuWiki author : Jannes Drost-Tenfelde email : info@drost-tenfelde.de type : Syntax lastupdate : 2011-11-19 compatible : Binky, Weatherwax, Angua, "Adora Belle" depends : conflicts : similar : icalevents, ical tags : !obsolete, calendar, icalendar, ical downloadurl: https://trello.com/1/cards/5af84a1b7fb272dd80edc0b1/attachments/5af84a6bb0c41f8fd3c62bdf/download/plugin_icalendar_1_4.zip bugtracker : sourcerepo : donationurl: http://drost-tenfelde.de/doku.php/donate ---- ===== Please switch to the iCalEvents Plugin ===== **:!: This plugin is no longer in active development and obsolete. Its functionality has been integrated back in the [[iCalEvents]] Plugin.** Just installing the [[iCalEvents]] Plugin should make your calendars work, it's nevertheless recommended to read the [[icalevents|plugin page]] first. ---- This plugin allows you to display events from iCalendar in your website. It was initially based on the [[plugin:iCalEvents]] Plugin by Robert Rackl. The plugin reads the ''*.ics'' file from a URL and parses it into DokuWiki using pre-defined [[#Templates]] from the configuration. ===== Added Features ===== Version 1.4: * Added extendable 'showAs' parameter, which allows users to add their own templates. * Altered templates to allow DokuWiki Syntax, rather than HTML. * Added default, list and table templates. * Fixed 'previewDays' issue. * Improved behavior of the 'sort' parameter. * Backward compatibility to older versions. Version 1.3: * Added parameter 'sort', which allows the entries to be sorted in reverse order. Version 1.2: * Fixed timezones for reoccuring events. Version 1.1: * Optional link to VEVENT, so that other users can add it to their calendar. * Event descriptions may now contain [[:wiki:syntax|DokuWiki syntax]]. Version 1.0: * Number of preview days is now optional. * Dates are now displayed using the local timezone settings of the server. * An optional 'to' date can be set to display events up until a certain date. * A maximum number of entries to display can be set. * The events can now be displayed in two alternate ways, using a listed format or an extended view format (see [[#configuration_and_settings]]). * Displays re-occuring events. * Allow external and internal links in events to link to external or internal pages using the %%[[ExternalPage]]%% or %%[[ExternalPage|Description]]%% tags. (See [[#Features]]) * Automatically parses contents of an internal page into the event description using the %%[InternalPage]%% tag. (See [[#Features]]) ===== Installation ===== Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. ===== Examples/Usage ===== * ''%%{{iCalendar>http://host/myCalendar.ics}}%%'' ((Displays all events in the calendar)) * ''%%{{iCalendar>http://host/myCalendar.ics#from=today&previewDays=30}}%%'' ((Displays all events in the calendar as of today until 30 days in the future)) * ''%%{{iCalendar>http://host/myCalendar.ics#from=01/01/2011&previewDays=30}}%%'' (( Displays all events in the calendar as of 01/01/2011 until 31/01/2001)) * ''%%{{iCalendar>http://host/myCalendar.ics#from=today}}%%'' ((Displays all events as of today)) * ''%%{{iCalendar>http://host/myCalendar.ics#to=today}}%%'' ((Displays all events until today)) * ''%%{{iCalendar>http://host/myCalendar.ics#from=today&numberOfEntries=5}}%%'' ((Displays the next 5 events after today)) * ''%%{{iCalendar>http://host/myCalendar.ics#sort=DESC}}%%'' ((Sorts the events from newest date to oldest date)) * ''%%{{iCalendar>http://host/myCalendar.ics#showAs=list}}%%'' ((Shows the events using the configuration parameter 'list')) ===== Syntax ===== {{iCalendar>icsUrl#key=value&..&key=value}} ^ icsUrl | the location of the ics file | required | ^ key | the parameter key to set | optional | ^ value | the parameter value to set | optional | Multiple ''key=value'' parameters can be set using the ''&'' as a seperator. Available parameters: ^ Key ^ Type ^ Comments ^ Requirement ^ Version ^ | from | date | Date from which the events should be displayed. Format is DD/MM/YYYY. The value 'today' is also valid. | optional | all | | to | date | Date until which the events should be displayed. Format is DD/MM/YYYY. The value 'today' is also valid. | optional | all | | previewDays | number | Number of days starting at the from date to display. | optional | all | | numberOfEntries | number | Number of entries to display | optional | all | | showEndDates | onoff | Determines if the end date/time should be shown. If an event covers more than one day, the end date is shown by default. Values: **0** for off, **1** for on. Default: **0**. | optional | all | | includeLink | onoff | Adds an iCalendar link to the summary of the event. By opening the link, users may add the complete event to their own calendar. Values: **0** for off, **1** for on. Default: **0** | optional | **Deprecated since version 1.4** | | showAsList | onoff | Uses alternate listHTML display formatting if set to **1**. Uses the default viewHTML code if set to **0** or not specified | optional | **Deprecated since version 1.4** | | sort | string | Default: **ASC**. If you set this parameter to **DESC**, the entries will be sorted in reverse order, from highest date downto the lowest. Parameter exists since [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_3.zip|Version 1.3]]. | optional | [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_3.zip|Version 1.3]] | | showAs | string | Default: **default**. Allows the user to display the events using a template defined in the configuration parameters. Currently available: **default**, **list**, **table**. The user can add more templates by editing the default.php and metadata.php files in the conf/ directory. | optional | [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_3.zip|Version 1.4]] | ===== Configuration and Settings ===== ^ Key ^ Type ^ Comments ^ Requirement ^ Version ^ | dformat | date | Formatting of the event date (See [[phpfn>strftime|Format]]) | required | all | | tformat | date | Formatting of the event time (See [[phpfn>strftime|Format]]) | required | Version 1.1 | | listHTML | string | Template for displaying events as a list. The list view can be enabled using the Syntax parameter 'showAsList'. | required | **Deprecated since Version 1.3** | | viewHTML | string | Default template for displaying events. | required | **Deprecated since Version 1.3** | | default | string | Default template for displaying events. Previously //viewHTML//. | required | [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_4.zip|Version 1.4]] | | list | string | Template for displaying events as a listview. Previously //listHTML//. | optional | [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_4.zip|Version 1.4]] | | table | string | Template for displaying events as a table. | optional | [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_4.zip|Version 1.4]] | ===== Entry templates ===== ==== v1.4 and later ==== The user may add their own configuration parameters for their entry templates. The appropriate configuration parameter for the template can be set via the syntax parameter **showAs**. In order to make a new template, for example one that displays all entries as an unsorted list, the configuration files must be changed as follows: ** conf/metadata.php ** If you wish to alter your self-created template in the administration panel, you must setup the metadata for this parameter. Example: $meta['unsortedlist'] = array(''); ** conf/default.php ** If you wish to set a default setting for the newly created parameter, you can set it up in default.php. This is optional, you can also use the administration panel to setup the configuration parameter. $conf['unsortedlist'] = ' * {date}: {summary} '; ** showAs ** Once the configuration parameter has been added, you can use it in the plugin syntax: ''%%{{iCalendar>http://host/myCalendar.ics#showAs=unsortedlist}}%%'' ==== v1.3 and before ==== Using the configuration parameters **listHTML** and **viewHTML** alternate HTML templates may be configured to display the events. The templates used for these parameters are plain HTML containing specific tags that will be interpreted by the plugin. ===== Template tags ===== The templates, which can be configured in ''conf/default.php'', or via the administraton panel, is parsed using the following tags: ^ Tag ^ Comments | | ''{summary}'' | Will display the event's title | | ''{summary_link}'' | Will display the event's title, including a link to the according VEVENT, which can be opened to include in your own iCalendar. (Since [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_4.zip|Version 1.4]])| | ''{date}'' | Will display the event date. The date format can be configured in the conf/default.php file | | ''{location}'' | Will display the event location | | ''{location_link}'' | Will display the event location with a link to GoogleMaps | | ''{description}'' | Will display the event description. If the %%[InternalPage]%% tag is included in the event description, the contents of the provided InternalPage will be inserted over the tag. | ==== Examples v1.4 and later === **default** ===== {date}: {summary} ===== **Location**: {location_link}\\\\ {description} **list** ====== {date}: {summary} ====== **Location: {location}**\\ {description} ==== Examples v1.3 and before ==== **viewHTML**:

{summary}

{date}

Location: {location}

{description}
\\ **listHTML**:

{date}
{summary}
{description}

===== Files ===== Here is a list of the files currently used in the plugin. ^ Source Code ^ | syntax.php | Contains the main plugin code | | vevent.php | Code to download an event as .ics file | | functions.php | Support functionality | ^ Support ^ | plugin.info.txt | Plugin information | | ics.png | Icon for events with links to their VEVENT .ics file | ^ Configuration ^ | conf/metadata.php | Metadata settings | | conf/default.php | Default settings | ^ Language ^ | lang/en/lang.php | English language file | ===== Development ===== === Change Log === * **2011-11-19** Hotfix * Added hotfix, since p_render was called without the third parameter, which gave warnings. Should be fixed now. * **2011-11-14** [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_4.zip|Version 1.4]] * Added extendable 'showAs' parameter, which allows users to add their own templates. * Altered templates to allow DokuWiki Syntax. * Added default, list and table templates. * Fixed 'previewDays' issue. * Improved behavior of the 'sort' parameter. * **2011-11-09** [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_3.zip|Version 1.3]] * Added reverse sorting of entries * **2011-11-06** [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_2.zip|Version 1.2]] * Minor bugfixes * Timezone fix for reoccuring events. * **2011-10-09** Hotfix * Added hotfix, since p_render was called without the third parameter, which gave warnings. Should be fixed now. * **2011-10-04** [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_1.zip|Version 1.1]] * Minor bugfixes * Event descriptions can now contain [[:wiki:syntax|DokuWiki syntax]], for Example %%[[URL|Description]]%%. * Added //'includeLink'// syntax parameter, which adds a link to the summary with the original VEVENT. By clicking the link, users are able to add the event to their own .ics calendar. * Added //'tformat'// configuration parameter, where the time format can be configured. * **2011-09-29** [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_0.zip|Version 1.0]] * Initial release === Known Bugs and Issues === - **(Solved)** When there is an url in the calendar event, the plugin renders it wrong. **Sometimes it converts the slashes after http: to italic slashes**. So the url is wrong and everything after http: is italic. The strange thing is, that this doesnt happen with every url. * If you wish to use URL's in your calendar event, please use the DokuWiki Syntax %%[[URL]]%%. I use standard DokuWiki functionality to turn the event description into HTML. The Syntax %%//%% is used for Italic by DokuWiki, so that could be the cause of the problem. Good luck! [[info@drost-tenfelde.de|JDT]] * This works great thanks for the tip. - **(Solved in v1.2)** Maybe I found another bug: when I set a **repeating event** in Google Calendar, **the plugin shows the time incorrect by 1 hour**. When i set a normal event, the time is allright. * Thanks. Ok, I have found the timezone error, it seems that the DTSTART and DTEND times for repeating events have a different timezone than the normal events. I have now added the support for the TZID elements within DTSTART and DTEND which defines those individual timezones. I released [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_2.zip|Version 1.2]] to this end, since many people currently use Version 1.1 and timezones are always a bit fiddly. I will look into reoccurring events more in the upcoming days, since the plugin currently only regards individual VEVENTs, but does not regard a single VEVENT being used for multiple events.[[info@drost-tenfelde.de|JDT]] - **(Solved in v1.4)** 'previewDays' is not working for me. Using this command: {{iCalendar>http://obfuscated.my/icalfile#from=today&previewDays=30&showAsList=1}} I get all events from today through next year(Dec 2012). This is a calendar of holidays, so all events are 'all day events' (in case that's relevant). The calendar is stored in a Kerio Connect mail server. [[m.mccarn@aicr.org|-MJM]] * Fixed in version 1.4. - **(Solved in v1.4 Hotfix)** In Version 1.4, this error is on every wikipage with icalendar: Warning: Missing argument 3 for p_render(), called in /www/htdocs/wiki/lib/plugins/iCalendar/syntax.php on line 247 and defined in /www/htdocs/wiki/inc/parserutils.php on line 647. * Hi, unfortunately, due to many changes, this error "slipped back in". You can fix it by changing line 247 of syntax.php to $html = p_render($mode, p_get_instructions( $ret ), $info ); or download v1.4 again, since I added a hotfix. [[info@drost-tenfelde.de|JDT]] - **Sorting not correct** In my case it sorts the entries by the date the data is modified, not by the date it starts. that makes a comletly useless list, by appointment for a year! - Does not work with .ics files generated by Evolution 3.12 http://wiki.gnome.org/Apps/Evolution/ === ToDo/Wish List === * Support for reoccurring events.[[info@drost-tenfelde.de|JDT]] * Support for ordinal numbers (1st, 2nd, 3rd, 4th) in dates (I don't know if [[http://www.php.net/manual/en/class.numberformatter.php#predefined constants|this]] (NumberFormatter::ORDINAL) or [[http://stackoverflow.com/questions/6604904/add-rd-or-th-or-st-dependant-on-number|this]] or [[http://stackoverflow.com/questions/3109978/php-display-number-with-ordinal-suffix|this]] might help). Be careful with 11th, 12th and 13th that are exceptions -a- ===== FAQ ===== * Why did you make a new plugin, rather than adjust the existing [[plugin:icalevents|icalevents plugin]] ? * Well, initially, I thought it would be best to change the existing plugin to fix a few bugs here and there, but as I got along, I found more and more things I wanted in the plugin, such as dynamically being able to adjust the presentation and adding new parameters. Whilst the [[plugin:icalevents|icalevents plugin]] covers my basic needs, which is loading *.ics files and turning them into HTML, I did not want to start making loads of patches to the existing plugin, but rather have the option of altering the complete functionality. ===== Discussion ===== - **(Solved in v1.3)** Thanks for your work. Would it be possible to add an option to display the latest calendar entry on top and the oldest one at the bottom? * Hi there. I have added a new parameter 'sort' in [[http://www.drost-tenfelde.de/lib/exe/fetch.php?media=dokuwiki:plugin_icalendar_1_3.zip|Version 1.3]], which you can set to DESC to sort in reverse order. I hope meets your requirement. [[info@drost-tenfelde.de|JDT]] * Perfect, thank you very much. - **(Added in v1.4)** I'd love to be able to display the output in a table, or using multiple options - perhaps by expanding 'showAsList' into a generic 'showAs' directive: &showAs=table, &showAs=list, &showAs=day &showAs=week, &showAs=month, &showAs=year (or &showAs=planner, or &showAs=gantt). [[m.mccarn@aicr.org|-MJM]] * Hi, I added this feature as described in v1.4 with three standard configurations &showAs=default, &showAs=list and &showAs=table. You can add your own templates by adding configuration parameters as described in [[#entry_templates|Entry templates]]. I hope that meets your requirements. [[info@drost-tenfelde.de|JDT]] - **(Added in v1.4)** I'd like to be able to specify wiki formatting as well as HTML in the template configurations, e.g. **| {date} | {location} | {summary} (({description})) |** (with the objective being to show a table with date, location and summary, with the description included as a footnote/mouse tip). [[m.mccarn@aicr.org|-MJM]] * You should now be able to use DokuWiki syntax for your templates. If you wish to use HTML, you can use the %%%% tags. [[info@drost-tenfelde.de|JDT]] - Thanks for the useful plugin, Jannes! I had a problem with wiki formatting in multiline descriptions. For example, the following description in an event would not render as expected: DESCRIPTION:^ 2:00 pm | Meeting: introduction and group assignments. |\n^ 3:00 pm | Work on research proposal: Find a good scientific question. |\ n^ 6:00 pm | Dinner. |\n^ 7:00 pm | Seminar. |\n The problem seems to be that "\n" isn't interpreted as a linebreak. I was able to get it working by changing lines 119-123 in functions.php to if (preg_match($regex_description, $vevent, $description)) { $entry['description'] = $description[1]; $entry['description'] = preg_replace("/[\r\n] ?/", "", $entry['description']); $entry['description'] = str_replace('\,', ',', $entry['description']); $entry['description'] = str_replace('\\n', "\n", $entry['description']); // added! Replace newlines in description with actual linebreaks [Rik, 2011-12-27] } I forked these changes from v1.4 to [[https://github.com/rikblok/dokuwiki-plugin-icalendar/ | GitHub]]. Download it [[https://github.com/rikblok/dokuwiki-plugin-icalendar/archive/master.zip | here]]. --- [[user>rikblok|Rik Blok]] //2014/01/09 01:01// - **What about https-Links?**\\ when I use\\ ''%%{{iCalendar>https://my.host.com/myCalendar.ics}}%%''\\ I always get some error "cannot fetch **ttps**:\/\/my.host.com\/myCalendar.ics"\\ //Paul// \\ Same problem here. \\ //gimili// \\ See my workaround hereafter \\ //Giloux// - If you get an event without the dtend attribute, the end date something 1998, I have fixed this, by setting enddate = startdate. I have also added another variable {url}. Code is available here: https://gitorious.org/dokuwiki-icalendar-plugin/dokuwiki-icalendar-plugin //0xAFFE// - **More Tags**\\ This could be really useful, but is it possible to have some more template tags, please? I'd particularly like to be able to access the DTSTART field so that I can display a time with the date, but URL and ATTACH would also be very useful. Thanks. --- [[user>iainhallam|Iain Hallam]] //2012/10/24 01:19// - It would be nice if the date/time output of the plugin was in the same language as the wiki, now it defaults to the language of the operating system that the wiki runs on. this can be achieved using eg. setlocale(LC_ALL, 'nl_NL'); --- [[user>mprins|Mark]] //2012/12/09 22:05// - **All-day events**: My system has difficulties to show all-day events, e.g. birthdays. I used MS Outlook to create a calendar with recurring events. The plugin shows the date but no summary. --- Arndt //2013/08/11 23:43// - **Order is wrong** It doesn't sort the dates correctly. The plugin sorts it in the order I modified the appointment not in the order they are coming. I am using it with google calendars. Anyone any ideas? ==== Doesn't work on https ==== I write : %%{{iCalendar>https://MyHordeSite/rpc.php/kronolith/gbreiner/tV0_HIukgmK0sftwQ6bIJA3.ics}}%% I get : Error in Plugin iCalendar: Could not get 'ttps:/ /MyHordeSite/rpc.php/kronolith/gbreiner/tV0_HIukgmK0sftwQ6bIJA3.ics': 401 Any help would be welcome. >Actually if you are getting a 401 error the authorization fails, this has nothing to do with https... the plugin does not support authorization --- [[user>mprins|Mark]] //2013/04/26 15:09// Thanks in advance. Gér@rd I thought it was an issue with my certificate ssl, but you're right, it is not. It seems rather that an authentication webdav is required. Many thanks for your answer. Gér@rd ==== workaround for 2 issues ==== === links with https === If you write %%{{iCalendar>https://example.com/blabla.ics}}%%, you get an error message like Error in Plugin iCalendar: Could not get %%'ttps://example.com/blabla.ics': 401%% To solve it, I just added a space before the url, like this: %%{{iCalendar> https://example.com/blabla.ics}}%% and it solved the issue. === Authentication === When one has to authenticate (like in owncloud for example), the user/pass can be specified in the url (be careful, ensure that you use the https protocol) like this : %%{{iCalendar> https://user:password@example.com/blabla.ics}}%% Hope this helps,\\ Giloux Thank you for your contributions! > Hi :) > After updating to the last version (as of Jan 2016) I get the following error message: > ''Error in Plugin iCalendar: Could not get 'https://user:pwd@google.com/calendar/ical/user%40gmail.com/private-7610e04df(...)2fbcba975d46ecaa/basic.ics': 404'' > User and pwd were obviously replaced by my credentials. (I removed some of the numbers in the string displayed here for confidentiality reasons...) > Any help would be greatly appreciated > Hey there! A 404 error code would indicate that the .ics URL could not be found. Try opening up the link in a browser and see if it works. Maybe the calendar is private? Cheers JDT. > * Thanks for the swift answer :) Yes the calendar is private. This is why I use the user:pwd parameters (https://user:pwd@google.com). It used to work fine until recently (a few days ago as of Jan 2016) ==== Fix for missing dates ==== We've found that some of our calendar entries don't show a date. It turns out that our ical entries contain "DTSTART:..." lines without a ";VALUE=DATE" part. I don't know if these Ical entries are invalid or not, but our patch seems to do no harm: diff iCalendar/functions.php.orig iCalendar/functions.php -u --- iCalendar/functions.php.orig 2013-07-01 16:14:43.000000000 +0100 +++ iCalendar/functions.php 2013-07-01 16:30:41.000000000 +0100 @@ -49,8 +49,8 @@ $regex_dtend_timezone = '/DTEND;TZID=(.*?):([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})/'; // all day event - $regex_alldaystart = '/DTSTART;VALUE=DATE:([0-9]{4})([0-9]{2})([0-9]{2})/'; - $regex_alldayend = '/DTEND;VALUE=DATE:([0-9]{4})([0-9]{2})([0-9]{2})/'; + $regex_alldaystart = '/DTSTART(?:;VALUE=DATE)?:([0-9]{4})([0-9]{2})([0-9]{2})/'; + $regex_alldayend = '/DTEND(?:;VALUE=DATE)?:([0-9]{4})([0-9]{2})([0-9]{2})/'; // Make the entry $entry = array();