1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
(function(module, ns) {
var Propfind = ns.require('request/propfind');
var Builder = ns.require('query_builder');
/**
* Creates a calendar query request.
*
* Defaults to Depth of 1.
*
* @param {CalDav.Connection} connection connection object.
* @param {Object} options options for calendar query.
*/
function CalendarQuery(connection, options) {
Propfind.apply(this, arguments);
this.xhr.headers['Depth'] = this.depth || 1;
this.xhr.method = 'REPORT';
this.template.rootTag = ['caldav', 'calendar-query'];
this.data = new Builder({
template: this.template
});
this.filter = new Builder({
template: this.template,
tag: ['caldav', 'filter'],
propTag: ['caldav', 'prop-filter'],
compTag: ['caldav', 'comp-filter']
});
}
CalendarQuery.prototype = {
__proto__: Propfind.prototype,
_createPayload: function() {
var content;
var props;
props = this._props.join('');
if (this.data) {
props += this.data.toString();
}
content = this.template.tag('prop', props);
if (this.filter) {
content += this.filter.toString();
}
return this.template.render(content);
}
};
module.exports = CalendarQuery;
}.apply(
this,
(this.Caldav) ?
[Caldav('request/calendar_query'), Caldav] :
[module, require('../caldav')]
));
|