aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJames Lal <james@lightsofapollo.com>2012-07-07 09:00:49 -0700
committerJames Lal <james@lightsofapollo.com>2012-07-07 09:00:49 -0700
commita3f59b6298d87c3a72c167142546a816b3f2e73d (patch)
treec7b1d138a2c766ca6fc50093a75e74743c16a2b8 /lib
parent0541668eaa804770d51e85037c21887c045642c7 (diff)
downloadjsCalDAV-a3f59b6298d87c3a72c167142546a816b3f2e73d.tar.gz
More complete parsing of calendar data
Diffstat (limited to 'lib')
-rw-r--r--lib/caldav/resources/calendar.js13
-rw-r--r--lib/caldav/sax/dav_response.js45
2 files changed, 51 insertions, 7 deletions
diff --git a/lib/caldav/resources/calendar.js b/lib/caldav/resources/calendar.js
index a5a47c7..fd921cb 100644
--- a/lib/caldav/resources/calendar.js
+++ b/lib/caldav/resources/calendar.js
@@ -6,10 +6,15 @@
/**
* Represents a (Web/Cal)Dav resource type.
*
+ * @param {Caldav.Connection} connection connection details.
* @param {Object} options public options on prototype.
*/
- function Calendar(options) {
+ function Calendar(connection, options) {
+ if (typeof(options) === 'undefined') {
+ options = {};
+ }
+ this.updateFromServer(options);
}
Calendar.prototype = {
@@ -60,6 +65,12 @@
privilegeSet: null,
/**
+ * Updates calendar details from server.
+ */
+ updateFromServer: function() {
+ },
+
+ /**
* Creates a query request for this calendar resource.
*
* @return {CalDav.Request.CalendarQuery} query object.
diff --git a/lib/caldav/sax/dav_response.js b/lib/caldav/sax/dav_response.js
index 0d9fb7c..dddd40b 100644
--- a/lib/caldav/sax/dav_response.js
+++ b/lib/caldav/sax/dav_response.js
@@ -43,11 +43,6 @@
var HrefHandler = Base.create({
name: 'href',
- //don't add text only elements
- //to the stack as objects
- onopentag: null,
- onclosetag: null,
-
onopentag: function() {
if (this.currentTag.handler === this.handler) {
this.stack.push(this.current);
@@ -90,6 +85,38 @@
}
});
+ var PrivilegeSet = Base.create({
+ name: 'PrivilegeSet',
+
+ name: 'href',
+
+ onopentag: function(data) {
+ if (this.currentTag.handler === this.handler) {
+ this.stack.push(this.current);
+ this.current = [];
+ } else {
+ if (data.tagSpec !== 'DAV:/privilege') {
+ this.current.push(data.local);
+ }
+ }
+ },
+
+ onclosetag: function(data) {
+ var current = this.currentTag;
+ var data;
+
+ if (current.handler === this.handler) {
+ data = this.current;
+
+ this.current = this.stack.pop();
+ this.current[current.local] = data;
+ }
+ },
+
+ ontext: null
+
+ });
+
var ArrayHandler = Base.create({
name: 'array',
@@ -124,14 +151,20 @@
handles: {
'DAV:/href': TextHandler,
+ 'http://calendarserver.org/ns//getctag': TextHandler,
'DAV:/status': HttpStatusHandler,
'DAV:/resourcetype': ArrayHandler,
+ 'DAV:/current-user-privilege-set': PrivilegeSet,
'DAV:/principal-URL': HrefHandler,
'DAV:/current-user-principal': HrefHandler,
'urn:ietf:params:xml:ns:caldav/calendar-data': CalendarDataHandler,
'DAV:/value': TextHandler,
+ 'DAV:/owner': HrefHandler,
+ 'DAV:/displayname': TextHandler,
'urn:ietf:params:xml:ns:caldav/calendar-home-set': HrefHandler,
- 'urn:ietf:params:xml:ns:caldav/calendar-user-address-set': HrefHandler
+ 'urn:ietf:params:xml:ns:caldav/calendar-timezone': TextHandler,
+ 'http://apple.com/ns/ical//calendar-color': TextHandler,
+ 'urn:ietf:params:xml:ns:caldav/calendar-description': TextHandler
},
onopentag: function(data, handler) {