diff options
Diffstat (limited to 'module/calp/html/view')
-rw-r--r-- | module/calp/html/view/calendar.scm | 32 | ||||
-rw-r--r-- | module/calp/html/view/calendar/month.scm | 3 | ||||
-rw-r--r-- | module/calp/html/view/calendar/shared.scm | 12 | ||||
-rw-r--r-- | module/calp/html/view/calendar/week.scm | 3 | ||||
-rw-r--r-- | module/calp/html/view/search.scm | 5 | ||||
-rw-r--r-- | module/calp/html/view/small-calendar.scm | 3 |
6 files changed, 34 insertions, 24 deletions
diff --git a/module/calp/html/view/calendar.scm b/module/calp/html/view/calendar.scm index 8b7d8075..9378737f 100644 --- a/module/calp/html/view/calendar.scm +++ b/module/calp/html/view/calendar.scm @@ -31,6 +31,8 @@ :use-module (ice-9 format) :use-module (calp translation) + + :export (html-generate) ) @@ -49,21 +51,21 @@ ;; TODO document what @var{render-calendar} is supposed to take and return. ;; Can at least note that @var{render-calendar} is strongly encouraged to include ;; (script "const VIEW='??';"), where ?? is replaced by the name of the view. -(define*-public (html-generate - key: - (intervaltype 'all) ; 'week | 'month | 'all - calendars ; All calendars to work on, probably (get-calendars global-event-object) - events ; All events which can be worked on, probably (get-event-set global-event-object) - start-date ; First date in interval to show - end-date ; Last date in interval to show - render-calendar ; (bunch of kv args) → (list sxml) - next-start ; date → date - prev-start ; date → date - ;; The pre and post dates are if we want to show some dates just - ;; outside our actuall interval. Primarily for whole month views, - ;; which needs a bit on each side. - (pre-start start-date) - (post-end end-date)) +(define* (html-generate + key: + (intervaltype 'all) ; 'week | 'month | 'all + calendars ; All calendars to work on, probably (get-calendars global-event-object) + events ; All events which can be worked on, probably (get-event-set global-event-object) + start-date ; First date in interval to show + end-date ; Last date in interval to show + render-calendar ; (bunch of kv args) → (list sxml) + next-start ; date → date + prev-start ; date → date + ;; The pre and post dates are if we want to show some dates just + ;; outside our actuall interval. Primarily for whole month views, + ;; which needs a bit on each side. + (pre-start start-date) + (post-end end-date)) ;; NOTE maybe don't do this again for every month (define evs (get-groups-between (group-stream events) diff --git a/module/calp/html/view/calendar/month.scm b/module/calp/html/view/calendar/month.scm index 1c162aaa..a19fcdb5 100644 --- a/module/calp/html/view/calendar/month.scm +++ b/module/calp/html/view/calendar/month.scm @@ -15,10 +15,11 @@ :select (make-block output-uid)) :use-module ((vcomponent util group) :select (group-stream get-groups-between)) + :export (render-calendar-table) ) ;; (stream event-group) -> sxml -(define*-public (render-calendar-table key: events start-date end-date pre-start post-end #:allow-other-keys) +(define* (render-calendar-table key: events start-date end-date pre-start post-end #:allow-other-keys) (define-values (long-events short-events) ;; TODO should be really-long-event? or event-spanning-midnight diff --git a/module/calp/html/view/calendar/shared.scm b/module/calp/html/view/calendar/shared.scm index 108f3b9a..41d96171 100644 --- a/module/calp/html/view/calendar/shared.scm +++ b/module/calp/html/view/calendar/shared.scm @@ -15,7 +15,11 @@ :select (make-block format-summary)) :use-module (ice-9 format) :use-module (calp translation) - ) + + :export (fix-event-widths! + lay-out-long-events + create-top-block + )) @@ -25,7 +29,7 @@ ;; Takes a list of vcomponents, sets their widths and x-positions to optimally ;; fill out the space, without any overlaps. -(define*-public (fix-event-widths! lst key: event-length-key (event-length-comperator date/-time>?)) +(define* (fix-event-widths! lst key: event-length-key (event-length-comperator date/-time>?)) ;; The tree construction is greedy. This means ;; that if a smaller event preceeds a longer ;; event it would capture the longer event to @@ -51,7 +55,7 @@ (inner x (right-subtree tree)))))) -(define-public (lay-out-long-events start end events) +(define (lay-out-long-events start end events) (fix-event-widths! events event-length-key: event-length event-length-comperator: date/-time>) (map (lambda (e) (create-top-block start end e)) @@ -61,7 +65,7 @@ ;; get hours. This means that a day is always assumed to be 24h, even when that's ;; wrong. This might lead to some weirdness when the timezon switches (DST), but it ;; makes everything else behave MUCH better. -(define-public (create-top-block start-date end-date ev) +(define (create-top-block start-date end-date ev) (define total-length (* 24 (days-in-interval start-date end-date))) diff --git a/module/calp/html/view/calendar/week.scm b/module/calp/html/view/calendar/week.scm index 78abcfbf..828dce41 100644 --- a/module/calp/html/view/calendar/week.scm +++ b/module/calp/html/view/calendar/week.scm @@ -22,10 +22,11 @@ :use-module ((vcomponent util group) :select (group-stream get-groups-between)) :use-module (ice-9 format) + :export (render-calendar) ) -(define*-public (render-calendar key: calendars events start-date end-date #:allow-other-keys) +(define* (render-calendar key: calendars events start-date end-date #:allow-other-keys) (let* ((long-events short-events (partition long-event? (stream->list (events-between start-date end-date events)))) (range (date-range start-date end-date))) `((script ,(lambda () (format #t "window.VIEW='week';"))) diff --git a/module/calp/html/view/search.scm b/module/calp/html/view/search.scm index 08436bc5..114541ed 100644 --- a/module/calp/html/view/search.scm +++ b/module/calp/html/view/search.scm @@ -9,6 +9,7 @@ :use-module ((calp html vcomponent) :select (compact-event-list)) :use-module (calp translation) + :export (search-result-page) ) ;; Display the result of a search term, but doesn't do any searching @@ -21,8 +22,8 @@ ;; @var{search-result} : The list of matched events ;; @var{page} : Which page we are on ;; @var{paginator} : A paginator object -(define-public (search-result-page - errors has-query? search-term search-result page paginator) +(define (search-result-page + errors has-query? search-term search-result page paginator) (xhtml-doc (@ (lang sv)) (head (title ,(_ "Search results")) diff --git a/module/calp/html/view/small-calendar.scm b/module/calp/html/view/small-calendar.scm index 80cbbaf2..4d40c57c 100644 --- a/module/calp/html/view/small-calendar.scm +++ b/module/calp/html/view/small-calendar.scm @@ -2,9 +2,10 @@ :use-module ((calp html components) :select (xhtml-doc include-css)) :use-module ((calp html caltable) :select (cal-table)) :use-module ((datetime) :select (month- month+ remove-day date->string)) + :export (render-small-calendar) ) -(define-public (render-small-calendar month standalone) +(define (render-small-calendar month standalone) (define table (cal-table start-date: month end-date: (remove-day (month+ month)) |