Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit bc7a5bc4 authored by Christoph Wurst's avatar Christoph Wurst
Browse files

fixup! Fix fullcalendar v5 options for background events

parent 568bdbd9
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -27,6 +27,11 @@
		opacity: .8;
		opacity: .8;
	}
	}


	.blocking-slot-free-busy {
		background: repeating-linear-gradient( 45deg, #606dbc, #606dbc 10px, #465298 10px, #465298 20px );
		z-index: 2;
	}

	.blocking-event-free-busy {
	.blocking-event-free-busy {
		border-color: red;
		border-color: red;
		border-style: solid;
		border-style: solid;
+2 −1
Original line number Original line Diff line number Diff line
@@ -142,7 +142,8 @@ export default {
				freeBusyEventSource(
				freeBusyEventSource(
					this._uid,
					this._uid,
					this.organizer.attendeeProperty,
					this.organizer.attendeeProperty,
					this.attendees.map((a) => a.attendeeProperty)
					this.attendees.map((a) => a.attendeeProperty),
					this.resources.map((resource) => resource.id)
				),
				),
				freeBusyFakeBlockingEventSource(
				freeBusyFakeBlockingEventSource(
					this._uid,
					this._uid,
+3 −2
Original line number Original line Diff line number Diff line
@@ -33,9 +33,10 @@ import logger from '../../utils/logger.js'
 * @param {String} id Identification for this source
 * @param {String} id Identification for this source
 * @param {AttendeeProperty} organizer The organizer of the event
 * @param {AttendeeProperty} organizer The organizer of the event
 * @param {AttendeeProperty[]} attendees Array of the event's attendees
 * @param {AttendeeProperty[]} attendees Array of the event's attendees
 * @param {string[]} resourceIds all resource IDs for the current free/busy data
 * @returns {{startEditable: boolean, resourceEditable: boolean, editable: boolean, id: string, durationEditable: boolean, events: events}}
 * @returns {{startEditable: boolean, resourceEditable: boolean, editable: boolean, id: string, durationEditable: boolean, events: events}}
 */
 */
export default function(id, organizer, attendees) {
export default function(id, organizer, attendees, resourceIds) {
	return {
	return {
		id: 'free-busy-event-source-' + id,
		id: 'free-busy-event-source-' + id,
		editable: false,
		editable: false,
@@ -75,7 +76,7 @@ export default function(id, organizer, attendees) {
			}
			}
			const events = []
			const events = []
			for (const [uri, data] of Object.entries(freeBusyData)) {
			for (const [uri, data] of Object.entries(freeBusyData)) {
				events.push(...freeBusyEventSourceFunction(uri, data.calendarData, data.success, startDateTime, endDateTime, timezoneObject))
				events.push(...freeBusyEventSourceFunction(uri, data.calendarData, data.success, startDateTime, endDateTime, timezoneObject, resourceIds))
			}
			}


			console.debug(events)
			console.debug(events)
+19 −2
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@


import { getColorForFBType } from '../../utils/freebusy.js'
import { getColorForFBType } from '../../utils/freebusy.js'
import { getParserManager } from 'calendar-js'
import { getParserManager } from 'calendar-js'
import logger from '../../utils/logger'


/**
/**
 * Converts the response
 * Converts the response
@@ -32,10 +33,12 @@ import { getParserManager } from 'calendar-js'
 * @param {DateTimeValue} start The start of the fetched time-range
 * @param {DateTimeValue} start The start of the fetched time-range
 * @param {DateTimeValue} end The end of the fetched time-range
 * @param {DateTimeValue} end The end of the fetched time-range
 * @param {Timezone} timezone Timezone of user viewing data
 * @param {Timezone} timezone Timezone of user viewing data
 * @param {string[]} resourceIds all resource IDs for the current free/busy data
 * @returns {Object[]}
 * @returns {Object[]}
 */
 */
export default function(uri, calendarData, success, start, end, timezone) {
export default function(uri, calendarData, success, start, end, timezone, resourceIds) {
	if (!success) {
	if (!success) {
		logger.info('no free/busy info for URI ' + uri + ', falling back to unknown state')
		return [{
		return [{
			id: Math.random().toString(36).substring(7),
			id: Math.random().toString(36).substring(7),
			start: start.getInTimezone(timezone).jsDate.toISOString(),
			start: start.getInTimezone(timezone).jsDate.toISOString(),
@@ -56,6 +59,7 @@ export default function(uri, calendarData, success, start, end, timezone) {
	const calendarComponent = parser._calendarComponent
	const calendarComponent = parser._calendarComponent
	const freeBusyComponent = calendarComponent.getFirstComponent('VFREEBUSY')
	const freeBusyComponent = calendarComponent.getFirstComponent('VFREEBUSY')
	if (!freeBusyComponent) {
	if (!freeBusyComponent) {
		logger.warn('no VFREEBUSY component found for URI ' + uri)
		return []
		return []
	}
	}


@@ -68,7 +72,20 @@ export default function(uri, calendarData, success, start, end, timezone) {
			end: freeBusyProperty.getFirstValue().end.getInTimezone(timezone).jsDate.toISOString(),
			end: freeBusyProperty.getFirstValue().end.getInTimezone(timezone).jsDate.toISOString(),
			resourceId: uri,
			resourceId: uri,
			display: 'background',
			display: 'background',
			backgroundColor: getColorForFBType(freeBusyProperty.type),
			// backgroundColor: getColorForFBType(freeBusyProperty.type),
		})

		// Add an overlay for blocked slots
		events.push({
			groupId: 'blocked-for-all',
			start: freeBusyProperty.getFirstValue().start.getInTimezone(timezone).jsDate.toISOString(),
			end: freeBusyProperty.getFirstValue().end.getInTimezone(timezone).jsDate.toISOString(),
			resourceIds,
			display: 'background',
			classNames: [
				'blocking-slot-free-busy'
			]
			// backgroundColor: getColorForFBType('BUSY'),
		})
		})
	}
	}