From 090405771471ca0ebe6841b9102153dc8f53da89 Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 6 Jul 2021 11:05:03 -0600 Subject: [PATCH] Solve some calendar issues that were breaking add / edit - Date widget did not find timepicker.formatTime() when it wanted it - Faked parent widget was not a good enough fake, added better checking --- api/js/etemplate/et2_widget_date.ts | 13 +++---------- calendar/js/app.ts | 10 ++++++++-- calendar/js/et2_widget_event.ts | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/api/js/etemplate/et2_widget_date.ts b/api/js/etemplate/et2_widget_date.ts index f175834490..09dc88f970 100644 --- a/api/js/etemplate/et2_widget_date.ts +++ b/api/js/etemplate/et2_widget_date.ts @@ -9,15 +9,8 @@ * @copyright Nathan Gray 2011 */ -/*egw:uses - /vendor/bower-asset/jquery/dist/jquery.js; - /vendor/bower-asset/jquery-ui/jquery-ui.js; - lib/date; - et2_core_inputWidget; - et2_core_valueWidget; -*/ - -//import "../../../vendor/bower-asset/jquery-ui/jquery-ui.js"; +// NEEDED by date widget +import "../jquery/jquery-ui-timepicker-addon.js"; import {et2_csvSplit, et2_no_init} from "./et2_core_common"; import {ClassWithAttributes} from "./et2_core_inheritance"; import {et2_createWidget, et2_register_widget, et2_widget, WidgetConfig} from "./et2_core_widget"; @@ -633,7 +626,7 @@ String: A string in the user\'s date format, or a relative date. Relative dates { if(this.getType() != 'date-timeonly') _value += this.is_mobile ? 'T' : ' '; - // @ts-ignore + // @ts-ignore TypeScript can't find formatTime(), but it's there _value += jQuery.datepicker.formatTime(this.timeFormat, { hour: formatDate.getHours(), minute: formatDate.getMinutes(), diff --git a/calendar/js/app.ts b/calendar/js/app.ts index 25538f0cbe..b44b83ae1c 100644 --- a/calendar/js/app.ts +++ b/calendar/js/app.ts @@ -630,8 +630,14 @@ export class CalendarApp extends EgwApp let filtered = Object.keys(this._grants).filter(account => this.state.owner.indexOf(account) >= 0); // Check if we're interested in displaying by owner / participant - let owner_check = et2_calendar_event.owner_check(cal_event, this.et2, jQuery.extend({}, - {options: {owner: filtered}})); + let owner_check = et2_calendar_event.owner_check( + cal_event, + // Fake the required widget since we don't actually have it right now + jQuery.extend({}, + {options: {owner: filtered}}, + this.et2 + ) + ); if(!owner_check) { // The owner is not in the list of what we're allowed / care about diff --git a/calendar/js/et2_widget_event.ts b/calendar/js/et2_widget_event.ts index e57ee8e24b..8942259736 100644 --- a/calendar/js/et2_widget_event.ts +++ b/calendar/js/et2_widget_event.ts @@ -1207,7 +1207,7 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached static owner_check(event, parent, owner_too?) { let owner_match = true; - let state = parent.getInstanceManager()?.app_obj.calendar.state || app.calendar?.state || {} + let state = (parent.getInstanceManager ? parent.getInstanceManager().app_obj.calendar.state : false ) || app.calendar?.state || {} if(typeof owner_too === 'undefined' && state.status_filter) { owner_too = state.status_filter === 'owner';