Commit 7d440bcd authored by Sebastian's avatar Sebastian
Browse files

Merge branch 'develop' of https://github.com/kkozlik/ical-generator into kkozlik-develop

# Conflicts:
#	lib/event.js
parents cdb5fd21 9ad2c5d2
......@@ -274,6 +274,12 @@ Empty the Calender.
Use this method to set the event's ID. If not set, an UID will be generated randomly. When output, the ID will be suffixed with '@' + your calendar's domain.
#### sequence([_Number_ sequence])
Use this method to set the event's revision sequence number of the
calendar component within a sequence of revisions.
#### start([_Date_ start])
Appointment date of beginning as Date object. This is required for all events!
......
......@@ -7,7 +7,7 @@
* @constructor ICalEvent Event
*/
var ICalEvent = function(_data) {
var attributes = ['id', 'uid', 'start', 'end', 'timezone', 'stamp', 'timestamp', 'allDay', 'floating', 'repeating', 'summary', 'location', 'description', 'organizer', 'attendees', 'alarms', 'method', 'status', 'url'],
var attributes = ['id', 'uid', 'sequence', 'start', 'end', 'timezone', 'stamp', 'timestamp', 'allDay', 'floating', 'repeating', 'summary', 'location', 'description', 'organizer', 'attendees', 'alarms', 'method', 'status', 'url'],
vars,
i,
data;
......@@ -20,6 +20,7 @@ var ICalEvent = function(_data) {
data = {
id: ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4),
sequence: 0,
start: null,
end: null,
timezone: null,
......@@ -66,6 +67,22 @@ var ICalEvent = function(_data) {
this.uid = this.id;
/**
* Set/Get the event's SEQUENCE number
*
* @param {Integer} sequence
* @since 0.2.6
* @returns {ICalEvent|Integer}
*/
this.sequence = function(sequence) {
if(!sequence) {
return data.sequence;
}
data.sequence = sequence;
return this;
};
/**
* Set/Get the event's start date
*
......@@ -588,6 +605,10 @@ var ICalEvent = function(_data) {
// DATE & TIME
g += 'BEGIN:VEVENT\r\n';
g += 'UID:' + data.id + '@' + calendar.domain() + '\r\n';
// SEQUENCE
g += 'SEQUENCE:' + data.sequence + '\r\n';
g += 'DTSTAMP:' + tools.formatDate(data.stamp) + '\r\n';
if(data.allDay) {
g += 'DTSTART;VALUE=DATE:' + tools.formatDate(data.start, true) + '\r\n';
......
......@@ -3,6 +3,7 @@ VERSION:2.0
PRODID:-//sebbo.net//ical-generator.tests//EN
BEGIN:VEVENT
UID:123@sebbo.net
SEQUENCE:0
DTSTAMP:20131004T233453Z
DTSTART:20131004T223930Z
DTEND:20131004T231500Z
......
......@@ -3,6 +3,7 @@ VERSION:2.0
PRODID:-//sebbo.net//ical-generator.tests//EN
BEGIN:VEVENT
UID:123@sebbo.net
SEQUENCE:0
DTSTAMP:20131004T233453Z
DTSTART:20131004T223930Z
DTEND:20131004T231500Z
......
......@@ -3,6 +3,7 @@ VERSION:2.0
PRODID:-//sebbo.net//ical-generator.tests//EN
BEGIN:VEVENT
UID:123@sebbo.net
SEQUENCE:0
DTSTAMP:20131004T233453Z
DTSTART;VALUE=DATE:20131004
DTEND;VALUE=DATE:20131006
......
......@@ -3,6 +3,7 @@ VERSION:2.0
PRODID:-//sebbo.net//ical-generator.tests//EN
BEGIN:VEVENT
UID:1@sebbo.net
SEQUENCE:0
DTSTAMP:20131004T233453Z
DTSTART:20131004T223930Z
DTEND:20131006T231500Z
......@@ -11,6 +12,7 @@ SUMMARY:repeating by month
END:VEVENT
BEGIN:VEVENT
UID:2@sebbo.net
SEQUENCE:0
DTSTAMP:20131004T233453Z
DTSTART:20131004T223930Z
DTEND:20131006T231500Z
......@@ -19,6 +21,7 @@ SUMMARY:repeating by day\, twice
END:VEVENT
BEGIN:VEVENT
UID:3@sebbo.net
SEQUENCE:0
DTSTAMP:20131004T233453Z
DTSTART:20131004T223930Z
DTEND:20131006T231500Z
......
......@@ -3,6 +3,7 @@ VERSION:2.0
PRODID:-//sebbo.net//ical-generator.tests//EN
BEGIN:VEVENT
UID:1@sebbo.net
SEQUENCE:0
DTSTAMP:20131004T233453Z
DTSTART:20131004T223930
DTEND:20131006T231500
......
......@@ -3,6 +3,7 @@ VERSION:2.0
PRODID:-//sebbo.net//ical-generator.tests//EN
BEGIN:VEVENT
UID:123@sebbo.net
SEQUENCE:0
DTSTAMP:20131004T233453Z
DTSTART;VALUE=DATE:20131004
DTEND;VALUE=DATE:20131006
......
......@@ -3,6 +3,7 @@ VERSION:2.0
PRODID:-//sebbo.net//ical-generator.tests//EN
BEGIN:VEVENT
UID:1@sebbo.net
SEQUENCE:0
DTSTAMP:20131004T233453Z
DTSTART:20131004T223930Z
DTEND:20131006T231500Z
......@@ -11,6 +12,7 @@ SUMMARY:repeating by month
END:VEVENT
BEGIN:VEVENT
UID:2@sebbo.net
SEQUENCE:0
DTSTAMP:20131004T233453Z
DTSTART:20131004T223930Z
DTEND:20131006T231500Z
......@@ -19,6 +21,7 @@ SUMMARY:repeating on Mo/We/Fr\, twice
END:VEVENT
BEGIN:VEVENT
UID:3@sebbo.net
SEQUENCE:0
DTSTAMP:20131004T233453Z
DTSTART:20131004T223930Z
DTEND:20131006T231500Z
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment