The iCalendar plugin allows you parsed iCalendar .ics and present it in DokuWiki
Compatible with DokuWiki
Similar to ical, icalevents
This plugin allows you to display events from iCalendar in your website. It was initially based on the 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.
Version 1.4:
Version 1.3:
Version 1.2:
Version 1.1:
Version 1.0:
Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.
{{iCalendar>http://host/myCalendar.ics}} 1){{iCalendar>http://host/myCalendar.ics#from=today&previewDays=30}} 2){{iCalendar>http://host/myCalendar.ics#from=01/01/2011&previewDays=30}} 3){{iCalendar>http://host/myCalendar.ics#from=today}} 4){{iCalendar>http://host/myCalendar.ics#to=today}} 5){{iCalendar>http://host/myCalendar.ics#from=today&numberOfEntries=5}} 6){{iCalendar>http://host/myCalendar.ics#sort=DESC}} 7){{iCalendar>http://host/myCalendar.ics#showAs=list}} 8)View the Online Demonstration
{{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 |
| | | | | Deprecated since version 1.4 |
| | | | | 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 Version 1.3. | optional | 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 | Version 1.4 |
| Key | Type | Comments | Requirement | Version |
|---|---|---|---|---|
| dformat | date | Formatting of the event date (See Format) | required | all |
| tformat | date | Formatting of the event time (See Format) | required | Version 1.1 |
| | | | | Deprecated since Version 1.3 |
| | | | | Deprecated since Version 1.3 |
| default | string | Default template for displaying events. Previously viewHTML. | required | Version 1.4 |
| list | string | Template for displaying events as a listview. Previously listHTML. | optional | Version 1.4 |
| table | string | Template for displaying events as a table. | optional | Version 1.4 |
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}}
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.
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 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. |
default
===== {date}: {summary} =====
**Location**: {location_link}\\\\
{description}
list
====== {date}: {summary} ======
**<sup>Location: {location}</sup>**\\
{description}
viewHTML:
<h2>{summary}</h2><p><small><strong>{date}</strong></small><br /><br /><b>Location</b>: {location}<br /><br />{description}
listHTML:
<p><small><b>{date}</b></small><br/><b>{summary}</b><br/>{description}</p>
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 |
$html = p_render($mode, p_get_instructions( $ret ), $info );
or download v1.4 again, since I added a hotfix. JDT
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] }
Do you think this is worth adding? — Rik BlokRik Blok
rikblok
2011/12/28 04:54
when I use
{{iCalendar>https://my.host.com/myCalendar.ics}}
I always get some error “cannot fetch ttps:\/\/my.host.com\/myCalendar.ics”
//Paul//
Thank you for your contributions!