aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJames Lal <james@lightsofapollo.com>2012-07-08 12:44:49 -0700
committerJames Lal <james@lightsofapollo.com>2012-07-08 12:44:49 -0700
commit055988cbf2d8609963369494304b6b2a70e16f6a (patch)
treea4842f77986cdafa81e50d80f51a936093a588da /scripts
parentee8dac6ecd2927d6ea1930ae478ff65766b446d9 (diff)
downloadjsCalDAV-055988cbf2d8609963369494304b6b2a70e16f6a.tar.gz
Fixed bug in resourcetype logic in Request.Resources. Refactored scripts/connect to use Resources
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/connect39
1 files changed, 14 insertions, 25 deletions
diff --git a/scripts/connect b/scripts/connect
index b5d12cb..bab6271 100755
--- a/scripts/connect
+++ b/scripts/connect
@@ -36,37 +36,26 @@ var con = new CalDav.Connection({
var Propfind = CalDav.Request.Propfind;
var CalendarHome = CalDav.Request.CalendarHome;
var Calendar = CalDav.Resources.Calendar;
+var Resources = CalDav.Request.Resources;
function getCalendarDetails(caluri) {
- var calFind = findProp(caluri);
- calFind.prop(['ical', 'calendar-color']);
- calFind.prop('owner');
- calFind.prop('current-user-privilege-set');
- calFind.prop(['caldav', 'calendar-description']);
- calFind.prop(['caldav', 'calendar-timezone']);
- calFind.prop('displayname');
- calFind.prop('resourcetype');
- calFind.prop(['calserver', 'getctag']);
- calFind.depth = 1;
-
+ var resources = new Resources(con, {
+ url: caluri
+ });
- // found calendar home find calendars.
- calFind.send(function(err, data) {
- var url, name, calendars = {};
+ resources.addResource('calendar', Calendar);
- for (url in data) {
- if (data[url].resourcetype.value.indexOf('calendar') !== -1) {
- calendars[url] = new Calendar(con, { url: url });
- calendars[url].updateFromServer(data[url]);
+ resources.prop(['ical', 'calendar-color']);
+ resources.prop(['caldav', 'calendar-description']);
+ resources.prop(['caldav', 'calendar-timezone']);
+ resources.prop('displayname');
+ resources.prop('resourcetype');
+ resources.prop(['calserver', 'getctag']);
- console.log('CAL RESOURCE:', calendars[url]);
- }
- }
- //console.log('DATA:');
- //console.log(JSON.stringify(data));
- //console.log('RAW:');
- //console.log(calFind.xhr.xhr.responseText);
+ // found calendar home find calendars.
+ resources.send(function(err, data) {
+ console.log(data);
});
}