Commit d3a16d6f authored by Karel Kozlík's avatar Karel Kozlík
Browse files

Adding support for sequence number property

parent b76ed63e
......@@ -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.
#### sequence([_Integer_ 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', 'stamp', 'timestamp', 'allDay', 'floating', 'repeating', 'summary', 'location', 'description', 'organizer', 'attendees', 'alarms', 'method', 'status', 'url'],
var attributes = ['id', 'uid', 'sequence', 'start', 'end', '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,
stamp: new Date(),
......@@ -65,6 +66,22 @@ var ICalEvent = function(_data) {
this.uid = this.id;
/**
* Set/Get the event's SEQUENCE number
*
* @param id 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
*
......@@ -566,6 +583,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';
......
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