aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--module/calp/html/vcomponent.scm2
-rw-r--r--module/calp/html/view/calendar.scm56
-rw-r--r--module/vcomponent/xcal/output.scm5
-rw-r--r--static/globals.js2
-rw-r--r--static/vevent.js24
5 files changed, 52 insertions, 37 deletions
diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm
index 1b97e9b8..09d0038b 100644
--- a/module/calp/html/vcomponent.scm
+++ b/module/calp/html/vcomponent.scm
@@ -208,7 +208,7 @@
`(div (@ (class " eventtext edit-tab "))
(form (@ (class "edit-form"))
(select (@ (class "calendar-selection"))
- (option "- Choose a Calendar -")
+ (option "- Choose a Calendar -")
,@(let ((dflt (get-config 'default-calendar)))
(map (lambda (calendar)
(define name (prop calendar 'NAME))
diff --git a/module/calp/html/view/calendar.scm b/module/calp/html/view/calendar.scm
index dfcd2264..94175071 100644
--- a/module/calp/html/view/calendar.scm
+++ b/module/calp/html/view/calendar.scm
@@ -294,34 +294,34 @@
;; This would idealy be a <template> element, but there is some
;; form of special case with those in xhtml, but I can't find
;; the documentation for it.
- ,@(let* ((cal (vcalendar
- name: "Generated"
- children: (list (vevent
- ;; The event template SHOULD lack
- ;; a UID, to stop potential problems
- ;; with conflicts when multiple it's
- ;; cloned mulitple times.
- dtstart: (datetime)
- dtend: (datetime)
- summary: ""
- ;; force a description field,
- ;; but don't put anything in
- ;; it.
- description: ""))))
- (event (car (children cal))))
- `(
- ;; (div (@ (class "template event-container") (id "event-template")
- ;; ;; Only needed to create a duration. So actual dates
- ;; ;; dosen't matter
- ;; (data-start "2020-01-01")
- ;; (data-end "2020-01-02"))
- ;; ,(caddar ; strip <a> tag
- ;; (make-block event `((class " generated ")))))
- ;; TODO merge this into the event-set, add attribute
- ;; for non-displaying elements.
- ;; (div (@ (class "template") (id "popup-template"))
- ;; ,(popup event (string-append "popup" (html-id event))))
- ))
+ ;; ,@(let* ((cal (vcalendar
+ ;; name: "Generated"
+ ;; children: (list (vevent
+ ;; ;; The event template SHOULD lack
+ ;; ;; a UID, to stop potential problems
+ ;; ;; with conflicts when multiple it's
+ ;; ;; cloned mulitple times.
+ ;; dtstart: (datetime)
+ ;; dtend: (datetime)
+ ;; summary: ""
+ ;; ;; force a description field,
+ ;; ;; but don't put anything in
+ ;; ;; it.
+ ;; description: ""))))
+ ;; (event (car (children cal))))
+ ;; `(
+ ;; ;; (div (@ (class "template event-container") (id "event-template")
+ ;; ;; ;; Only needed to create a duration. So actual dates
+ ;; ;; ;; dosen't matter
+ ;; ;; (data-start "2020-01-01")
+ ;; ;; (data-end "2020-01-02"))
+ ;; ;; ,(caddar ; strip <a> tag
+ ;; ;; (make-block event `((class " generated ")))))
+ ;; ;; TODO merge this into the event-set, add attribute
+ ;; ;; for non-displaying elements.
+ ;; ;; (div (@ (class "template") (id "popup-template"))
+ ;; ;; ,(popup event (string-append "popup" (html-id event))))
+ ;; ))
;; Auto-complets when adding new fields to a component
;; Any string is however still valid.
diff --git a/module/vcomponent/xcal/output.scm b/module/vcomponent/xcal/output.scm
index 692b3ec2..095c61c2 100644
--- a/module/vcomponent/xcal/output.scm
+++ b/module/vcomponent/xcal/output.scm
@@ -121,7 +121,10 @@
,(vline->value-tag vline)))])
(properties component))))
(unless (null? props)
- `(properties ,@props)))
+ `(properties
+ ;; NOTE
+ (x-hnh-calendar-name (text ,(prop (parent component) 'NAME)))
+ ,@props)))
,(unless (null? (children component))
`(components ,@(map vcomponent->sxcal (children component)))))))
diff --git a/static/globals.js b/static/globals.js
index 86368e9a..b2f6ed4e 100644
--- a/static/globals.js
+++ b/static/globals.js
@@ -315,6 +315,7 @@ class PopupElement extends HTMLElement {
this.replaceChildren(body);
let that = this;
+ /*
this.getElementsByClassName("calendar-selection")
.addEventListener('change', function () {
let uid = that.closest('[data-uid]').dataset.uid
@@ -322,6 +323,7 @@ class PopupElement extends HTMLElement {
this.value;
// event.properties.calendar = this.value;
});
+ */
}
}
diff --git a/static/vevent.js b/static/vevent.js
index 678f2134..80d30444 100644
--- a/static/vevent.js
+++ b/static/vevent.js
@@ -1,10 +1,12 @@
"use strict";
class VEventValue {
- constructor (type, value, parameters = {}) {
+ constructor (type, value, calendar, parameters = {}) {
this.type = type;
this.value = value;
this.parameters = parameters;
+ this.calendar = calendar;
+ console.log(this.calendar);
}
to_jcal () {
@@ -172,19 +174,26 @@ function xml_to_vcal (xml) {
/* xml MUST have a VEVENT (or equivalent) as its root */
let properties = xml.getElementsByTagName('properties')[0];
let components = xml.getElementsByTagName('components')[0];
+ let calendar_name;
let property_map = {}
if (properties) {
- for (var i = 0; i < properties.childElementCount; i++) {
+ property_loop: for (var i = 0; i < properties.childElementCount; i++) {
let tag = properties.childNodes[i];
let parameters = {};
let value = [];
- for (var j = 0; j < tag.childElementCount; j++) {
+ value_loop: for (var j = 0; j < tag.childElementCount; j++) {
let child = tag.childNodes[j];
- switch (tag.tagName) {
- case 'parameters':
+ // console.log(tag);
+ if (child.tagName == 'parameters') {
+ // console.log('is parameters');
parameters = /* handle parameters */ {};
- break;
+ continue value_loop;
+ } else switch (tag.tagName) {
+ case 'x-hnh-calendar-name':
+ calendar_name = child.innerHTML;
+ console.log(calendar_name);
+ continue property_loop;
/* These can contain multiple value tags, per
RFC6321 3.4.1.1. */
@@ -210,5 +219,6 @@ function xml_to_vcal (xml) {
}
}
- return new VEvent(property_map, component_list)
+ console.log(calendar_name);
+ return new VEvent(property_map, component_list, calendar_name)
}