-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Damianos Mylonakis
committed
Mar 5, 2012
1 parent
6575414
commit 3da2690
Showing
11 changed files
with
120 additions
and
23,588 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./lib/ical'); | ||
module.exports = require('./lib'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
var Element = require('./element').Element | ||
, util = require('util') | ||
, Event = require('./event').Event | ||
|
||
var DELIM = '\r\n' | ||
|
||
function Calendar(data) { | ||
this.prodid = data.prodid | ||
this.version = data.version || '2.0' | ||
this.events = data.events | ||
} | ||
|
||
util.inherits(Calendar, Element) | ||
|
||
Calendar.prototype.addEvent = function (event) { | ||
this.events.push(event) | ||
} | ||
|
||
Calendar.prototype.toICal = function () { | ||
var x = 'BEGIN:VCALENDAR' + DELIM | ||
for (var k in this) { | ||
if (this.hasOwnProperty(k)) { | ||
var prop = this[k] | ||
debugger | ||
if (Array.isArray(prop)) { | ||
for (var i = 0; i < prop.length; i++) { | ||
var p = prop[i] | ||
if (p instanceof Element) { | ||
x += p.toICal() | ||
} | ||
else { | ||
x += k.toUpperCase() + ':' + this[k] + DELIM | ||
} | ||
} | ||
} | ||
if (prop instanceof Element) { | ||
x += prop.toICal() | ||
} | ||
else { | ||
x += k.toUpperCase() + ':' + this[k] + DELIM | ||
} | ||
} | ||
} | ||
x += 'END:VCALENDAR' | ||
return x | ||
} | ||
|
||
exports.Calendar = Calendar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
function Element() { | ||
|
||
} | ||
|
||
Element.prototype.toICal = function () { | ||
throw new Error('not supported') | ||
} | ||
|
||
|
||
exports.Element = Element |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
BEGIN:VEVENT | ||
DTSTART:20111206T150000Z | ||
DTEND:20111206T180000Z | ||
DTSTAMP:20120217T005926Z | ||
UID:[email protected] | ||
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=danmyl | ||
[email protected];X-NUM-GUESTS=0:mailto:[email protected] | ||
CREATED:20111206T013929Z | ||
DESCRIPTION: | ||
LAST-MODIFIED:20111206T013929Z | ||
LOCATION: | ||
SEQUENCE:1 | ||
STATUS:TENTATIVE | ||
SUMMARY:557 με δαμον | ||
TRANSP:OPAQUE | ||
CATEGORIES:http://schemas.google.com/g/2005#event | ||
BEGIN:VALARM | ||
ACTION:DISPLAY | ||
DESCRIPTION:This is an event reminder | ||
TRIGGER:-P0DT0H10M0S | ||
END:VALARM | ||
END:VEVENT | ||
*/ | ||
|
||
var Element = require('./element').Element | ||
, util = require('util') | ||
|
||
var DELIM = '\r\n' | ||
|
||
function Event(data) { | ||
this.summary = data.summary | ||
this.location = data.location | ||
this.description = data.description | ||
} | ||
|
||
util.inherits(Event, Element) | ||
|
||
Event.prototype.toICal = function () { | ||
var x = 'BEGIN:VEVENT' + DELIM | ||
for (var k in this) { | ||
if (this.hasOwnProperty(k)) { | ||
x += k.toUpperCase() + ':' + this[k] + DELIM | ||
} | ||
} | ||
x += 'END:VEVENT' + DELIM | ||
return x | ||
} | ||
|
||
exports.Event = Event |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
Parser: require('./parser').Parser | ||
, Calendar: require('./calendar').Calendar | ||
, Event: require('./event').Event | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.