From fd9570c14521f696cccaaf8b8e7e0fa75cfddc2a Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 16 Apr 2024 16:25:41 -0700 Subject: [PATCH] Calendar view: initial call of REPORT method. Right now it's just a placeholder that outputs the raw XML to the screen. Use the allprop tag --- webcit-ng/static/js/view_calendar.js | 29 +++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/webcit-ng/static/js/view_calendar.js b/webcit-ng/static/js/view_calendar.js index 786090aa6..f5c53fc19 100644 --- a/webcit-ng/static/js/view_calendar.js +++ b/webcit-ng/static/js/view_calendar.js @@ -8,20 +8,35 @@ // 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: ` + + + + + + + + + ` + }; + + 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 = `
${error}
`; -- 2.30.2