diff options
Diffstat (limited to 'module/calp/html')
-rw-r--r-- | module/calp/html/vcomponent.scm | 35 | ||||
-rw-r--r-- | module/calp/html/view/calendar.scm | 13 | ||||
-rw-r--r-- | module/calp/html/view/calendar/month.scm | 4 | ||||
-rw-r--r-- | module/calp/html/view/calendar/week.scm | 7 |
4 files changed, 25 insertions, 34 deletions
diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 574ad954..69e955db 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -99,7 +99,9 @@ (class ,(when (and (prop ev 'PARTSTAT) (eq? 'TENTATIVE (prop ev 'PARTSTAT))) " tentative ")) - (data-uid ,(output-uid ev))))) + ,@(when (repeating? ev) + `((data-instance ,(datetime->string (as-datetime (prop ev 'DTSTART)))))) + (data-uid ,(prop ev 'UID))))) (div (@ (class "vevent eventtext summary-tab")) (h3 ,(fmt-header (when (prop ev 'RRULE) @@ -283,7 +285,9 @@ extra-attributes `((id ,(html-id ev) "-block") (data-calendar ,(base64encode (or (prop (parent ev) 'NAME) "unknown"))) - (data-uid ,(output-uid ev)) + (data-uid ,(prop ev 'UID)) + ,@(when (repeating? ev) + `((data-instance ,(datetime->string (as-datetime (prop ev 'DTSTART)))))) (class "vevent event" ,(when (and (prop ev 'PARTSTAT) @@ -342,29 +346,6 @@ (prop event 'RRULE))))) -;; Return a unique identifier for a specific instance of an event. -;; Allows us to reference each instance of a repeating event separately -;; from any other -(define-public (output-uid event) - (string-concatenate - (cons - (prop event 'UID) - (when (repeating? event) - ;; TODO this will break if a UID already looks like this... - ;; Just using a pre-generated unique string would solve it, - ;; until someone wants to break us. Therefore, we just give - ;; up for now, until a proper solution can be devised. - (list "---" - ;; TODO Will this give us a unique identifier? - ;; Or can two events share UID along with start time - (datetime->string - (as-datetime (or - ;; TODO What happens if the parameter RANGE=THISANDFUTURE is set? - (prop event 'RECURRENCE-ID) - (prop event 'DTSTART))) - "~Y-~m-~dT~H:~M:~S")))))) - - (define (week-day-select args) `(select (@ ,@args) (option "-") @@ -475,7 +456,9 @@ ;; (hr) - (input (@ (type "submit"))) + (input (@ (type "submit") (data-key "this") (value "This"))) + (input (@ (type "submit") (data-key "this_future") (value "This & Future"))) + (input (@ (type "submit") (data-key "all") (value "All"))) )))) ;; description in sidebar / tab of popup diff --git a/module/calp/html/view/calendar.scm b/module/calp/html/view/calendar.scm index 6945c5d2..25cfb575 100644 --- a/module/calp/html/view/calendar.scm +++ b/module/calp/html/view/calendar.scm @@ -10,7 +10,6 @@ fmt-day make-block fmt-single-event - output-uid )) :use-module (calp html config) :use-module (calp html util) @@ -30,6 +29,8 @@ :use-module (ice-9 format) :use-module (calp translation) + :use-module ((vcomponent formats xcal output) + :select (vcomponent->sxcal)) ) @@ -380,11 +381,11 @@ window.default_calendar='~a';" (date+ post-end (date day: 1)))) events)))) (repeating% regular (partition repeating? flat-events)) + ;;; TODO (repeating (for ev in repeating% (define instance (copy-vcomponent ev)) - (set! (prop instance 'UID) (output-uid instance)) (delete-parameter! (prop* instance 'DTSTART) '-X-HNH-ORIGINAL) (delete-parameter! (prop* instance 'DTEND) '-X-HNH-ORIGINAL) @@ -417,5 +418,9 @@ window.default_calendar='~a';" (div (@ (style "display:none !important;") (id "xcal-data")) ,((@ (vcomponent formats xcal output) ns-wrap) - (map (@ (vcomponent formats xcal output) vcomponent->sxcal) - (append regular repeating))))))))) + (append + (map vcomponent->sxcal regular) + (map (lambda (ev) + (set! (prop ev 'X-HNH-INSTANCE-ID) + (datetime->string (as-datetime (prop ev 'DTSTART)))) + (vcomponent->sxcal ev)) repeating))))))))) diff --git a/module/calp/html/view/calendar/month.scm b/module/calp/html/view/calendar/month.scm index 2b4c888a..b5328571 100644 --- a/module/calp/html/view/calendar/month.scm +++ b/module/calp/html/view/calendar/month.scm @@ -11,7 +11,7 @@ :select (really-long-event? events-between)) :use-module ((calp html vcomponent) - :select (make-block output-uid)) + :select (make-block)) :use-module ((vcomponent util group) :select (group-stream get-groups-between)) ) @@ -83,7 +83,7 @@ (events-between pre-start post-end events)) `(popup-element (@ (class "vevent") - (data-uid ,(output-uid event))))) + (data-uid ,(prop event 'UID))))) (template (@ (id "vevent-block")) diff --git a/module/calp/html/view/calendar/week.scm b/module/calp/html/view/calendar/week.scm index 16337102..7d8f83d2 100644 --- a/module/calp/html/view/calendar/week.scm +++ b/module/calp/html/view/calendar/week.scm @@ -14,13 +14,14 @@ event-zero-length? events-between)) :use-module ((calp html vcomponent) - :select (make-block output-uid) ) + :select (make-block) ) ;; :use-module ((calp html components) ;; :select ()) :use-module (calp translation) :use-module ((vcomponent util group) :select (group-stream get-groups-between)) :use-module (ice-9 format) + :use-module ((vcomponent recurrence) :select (repeating?)) ) @@ -63,7 +64,9 @@ (events-between start-date end-date events)) `(popup-element (@ (class "vevent") - (data-uid ,(output-uid event))))))) + ,@(when (repeating? event) + `((data-instance ,(datetime->string (as-datetime (prop event 'DTSTART)))))) + (data-uid ,(prop event 'UID))))))) ;; This template is here, instead of in (calp html calendar) since it only |