// RENDERER FOR THIS VIEW
function view_render_calendar() {
- fetch(
- "/ctdl/r/" + escapeHTMLURI(current_room) + "/calendar::"
- )
+
+ let options = {
+ method: "REPORT",
+ headers: {
+ "Content-Type" : "application/xml; charset=utf-8"
+ },
+ body: `
+ <CAL:calendar-query xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav">
+ <allprop />
+ <CAL:filter>
+ <CAL:comp-filter name="VCALENDAR">
+ <CAL:comp-filter name="VEVENT" />
+ </CAL:comp-filter>
+ </CAL:filter>
+ </CAL:calendar-query>
+ `
+ };
+
+ fetch("/ctdl/r/" + escapeHTMLURI(current_room), options)
.then(response => {
if (response.ok) {
- return(response.json());
+ return(response.text());
}
else {
throw new Error(`${response.status} ${response.statusText}`);
}
})
- .then(j => {
- document.getElementById("ctdl-main").innerHTML = JSON.stringify(j);
- })
+ //.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
+ .then(str => document.getElementById("ctdl-main").innerHTML = escapeHTML(str))
.catch(error => {
console.log(error);
document.getElementById("ctdl-main").innerHTML = `<div class="ctdl-fatal-error">${error}</div>`;