summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaren Stevenson2011-12-31 13:55:11 (GMT)
committer Karen Stevenson2011-12-31 13:55:11 (GMT)
commitbd2cacf516bd1d57e4825985a5013a98d026ec35 (patch)
tree3ef9eba2080a0e874d0e9112bffad814346536ac
parentda9d55ae26301553671320909af7cc6416cf714f (diff)
Issue #1302052 by benjifisher, penguin25, and helmo, Fix linespace ending problems in ical files.
-rw-r--r--CHANGELOG.txt1
-rw-r--r--date_api/theme/date-valarm.tpl.php39
-rw-r--r--date_api/theme/date-vcalendar.tpl.php28
-rw-r--r--date_api/theme/date-vevent.tpl.php50
4 files changed, 66 insertions, 52 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 0684333..dfec81e 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -5,6 +5,7 @@ Date Module 7.x
Version 7.x-2.x-dev
===================
+- Issue #1302052 by benjifisher, penguin25, and helmo, Fix linespace ending problems in ical files.
- Issue #1357216, The Date Views field list was including the Date Views filter itself, creating errors about missing node.date_filter values.
- Issue #1259870, Reinstate the test for a missing date argument for the pager.
- The new option to hide the add_delta for simple fields needs to be adjusted to work right where there is no field.
diff --git a/date_api/theme/date-valarm.tpl.php b/date_api/theme/date-valarm.tpl.php
index e7ea41e..1711913 100644
--- a/date_api/theme/date-valarm.tpl.php
+++ b/date_api/theme/date-valarm.tpl.php
@@ -13,22 +13,25 @@
* An email alarm should have two additional parts:
* $alarm['email'] - a comma-separated list of email recipients.
* $alarm['summary'] - the subject of the alarm email.
+ *
+ * If you are editing this file, remember that all output lines generated by it
+ * must end with DOS-style \r\n line endings, and not Unix-style \n, in order to
+ * be compliant with the iCal spec (see http://tools.ietf.org/html/rfc5545#section-3.1)
*/
-?>
-BEGIN:VALARM
-ACTION:<?php print $alarm['action'] . "\n";?>
-<?php if (!empty($alarm['trigger'])): ?>
-TRIGGER:<?php print $alarm['trigger'] . "\n"; ?>
-<?php endif; ?>
-<?php if (!empty($alarm['repeat'])): ?>
-REPEAT:<?php print $alarm['repeat'] . "\n"; ?>
-<?php endif; ?>
-<?php if (!empty($alarm['duration'])): ?>
-DURATION:<?php print $alarm['duration'] . "\n"; ?>
-<?php endif; ?>
-<?php if ($alarm['action'] == 'EMAIL'): ?>
-ATTENDEE:MAILTO:<?php print $alarm['email'] . "\n" ?>
-SUMMARY:<?php print $alarm['summary'] . "\n" ?>
-<?php endif; ?>
-DESCRIPTION:<?php print $alarm['description'] . "\n" ?>
-END:VALARM \ No newline at end of file
+print "BEGIN:VALARM\r\n";
+print "ACTION:" . $alarm['action'] . "\r\n";
+if (!empty($alarm['trigger'])):
+ print "TRIGGER:" . $alarm['trigger'] . "\r\n";
+endif;
+if (!empty($alarm['repeat'])):
+ print "REPEAT:" . $alarm['repeat'] . "\r\n";
+endif;
+if (!empty($alarm['duration'])):
+ print "DURATION:" . $alarm['duration'] . "\r\n";
+endif;
+if ($alarm['action'] == 'EMAIL'):
+ print "ATTENDEE:MAILTO:" . $alarm['email'] . "\r\n";
+ print "SUMMARY:" . $alarm['summary'] . "\n";
+endif;
+print "DESCRIPTION:" . $alarm['description'] . "\r\n";
+print "END:VALARM\r\n"; \ No newline at end of file
diff --git a/date_api/theme/date-vcalendar.tpl.php b/date_api/theme/date-vcalendar.tpl.php
index 9cf9aec..df4aa22 100644
--- a/date_api/theme/date-vcalendar.tpl.php
+++ b/date_api/theme/date-vcalendar.tpl.php
@@ -6,19 +6,23 @@
* $events
* @see date-vevent.tpl.php.
* @see date-valarm.tpl.php.
+ *
+ * If you are editing this file, remember that all output lines generated by it
+ * must end with DOS-style \r\n line endings, and not Unix-style \n, in order to
+ * be compliant with the iCal spec (see http://tools.ietf.org/html/rfc5545#section-3.1)
*/
if (empty($method)) {
$method = 'PUBLISH';
}
-?>
-BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:<?php print $method; ?>
-<?php if (!empty($calname)): ?>
-X-WR-CALNAME;VALUE=TEXT:<?php print $calname . "\r\n"; ?>
-<?php endif; ?>
-PRODID:-//Drupal iCal API//EN
-<?php foreach($events as $event): ?>
-<?php print theme('date_vevent', $event); ?>
-<?php endforeach; ?>
-END:VCALENDAR
+print "BEGIN:VCALENDAR\r\n";
+print "VERSION:2.0\r\n";
+print "METHOD:$method\r\n";
+if (!empty($calname)) {
+ print "X-WR-CALNAME;VALUE=TEXT:$calname\r\n";
+}
+print "PRODID:-//Drupal iCal API//EN\r\n";
+// Note that theme('date_event') already has the right line endings and needs no more.
+foreach($events as $event):
+ print theme('date_vevent', $event);
+endforeach;
+print "END:VCALENDAR\r\n";
diff --git a/date_api/theme/date-vevent.tpl.php b/date_api/theme/date-vevent.tpl.php
index 5c3c7c5..8b3c7bb 100644
--- a/date_api/theme/date-vevent.tpl.php
+++ b/date_api/theme/date-vevent.tpl.php
@@ -15,26 +15,32 @@
* $event['description'] - a description of the event.
* $event['alarm'] - an optional array of alarm values.
* @see date-valarm.tpl.php.
+ *
+ * If you are editing this file, remember that all output lines generated by it
+ * must end with DOS-style \r\n line endings, and not Unix-style \n, in order to
+ * be compliant with the iCal spec (see http://tools.ietf.org/html/rfc5545#section-3.1)
+
*/
-?>
-BEGIN:VEVENT
-UID:<?php print($event['uid'] . "\r\n") ?>
-SUMMARY:<?php print($event['summary'] . "\r\n") ?>
-DTSTAMP:<?php print($site_timezone_utc . "Z\r\n") ?>
-DTSTART;<?php print $event['timezone'] ?><?php print($event['start'] . "\r\n") ?>
-<?php if (!empty($event['end'])): ?>
-DTEND;<?php print $event['timezone'] ?><?php print($event['end'] . "\r\n") ?>
-<?php endif; ?>
-<?php if (!empty($event['rrule'])) : ?>
-<?php print($event['rrule'] . "\r\n") ?>
-<?php endif; ?>
-<?php if (!empty($event['url'])): ?>
-URL;VALUE=URI:<?php print($event['url'] . "\r\n") ?>
-<?php endif; ?>
-<?php if (!empty($event['location'])): ?>
-LOCATION:<?php print($event['location'] . "\r\n") ?>
-<?php endif; ?>
-<?php if (!empty($event['description'])) : ?>
-DESCRIPTION:<?php print($event['description'] . "\r\n") ?>
-<?php endif; ?>
-END:VEVENT
+$date = date_now('UTC');
+$current_date = !empty($event['current_date']) ? $event['current_date'] : $date->format(DATE_FORMAT_ICAL);
+print "BEGIN:VEVENT\r\n";
+print "UID:" . $event['uid'] . "\r\n";
+print "SUMMARY:" . $event['summary'] . "\r\n";
+print "DTSTAMP:" . $current_date . "Z\r\n";
+print "DTSTART:" . $event['start'] . "Z\r\n";
+if (!empty($event['end'])) {
+ print "DTEND:" . $event['end'] . "Z\r\n";
+}
+if (!empty($event['rrule'])) {
+ print $event['rrule'] . "\r\n";
+}
+if (!empty($event['url'])) {
+ print "URL;VALUE=URI:" . $event['url'] . "\r\n";
+}
+if (!empty($event['location'])) {
+ print "LOCATION:" . $event['location'] . "\r\n";
+}
+if (!empty($event['description'])) {
+ print "DESCRIPTION:" . $event['description'] . "\r\n";
+}
+print "END:VEVENT\r\n"; \ No newline at end of file