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
This commit is contained in:
nathangray 2021-07-06 11:05:03 -06:00 committed by nathan
parent b5015299ee
commit 0904057714
3 changed files with 12 additions and 13 deletions

View File

@ -9,15 +9,8 @@
* @copyright Nathan Gray 2011 * @copyright Nathan Gray 2011
*/ */
/*egw:uses // NEEDED by date widget
/vendor/bower-asset/jquery/dist/jquery.js; import "../jquery/jquery-ui-timepicker-addon.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";
import {et2_csvSplit, et2_no_init} from "./et2_core_common"; import {et2_csvSplit, et2_no_init} from "./et2_core_common";
import {ClassWithAttributes} from "./et2_core_inheritance"; import {ClassWithAttributes} from "./et2_core_inheritance";
import {et2_createWidget, et2_register_widget, et2_widget, WidgetConfig} from "./et2_core_widget"; 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' : ' '; 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, { _value += jQuery.datepicker.formatTime(this.timeFormat, {
hour: formatDate.getHours(), hour: formatDate.getHours(),
minute: formatDate.getMinutes(), minute: formatDate.getMinutes(),

View File

@ -630,8 +630,14 @@ export class CalendarApp extends EgwApp
let filtered = Object.keys(this._grants).filter(account => this.state.owner.indexOf(account) >= 0); let filtered = Object.keys(this._grants).filter(account => this.state.owner.indexOf(account) >= 0);
// Check if we're interested in displaying by owner / participant // Check if we're interested in displaying by owner / participant
let owner_check = et2_calendar_event.owner_check(cal_event, this.et2, jQuery.extend({}, let owner_check = et2_calendar_event.owner_check(
{options: {owner: filtered}})); 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) if(!owner_check)
{ {
// The owner is not in the list of what we're allowed / care about // The owner is not in the list of what we're allowed / care about

View File

@ -1207,7 +1207,7 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
static owner_check(event, parent, owner_too?) static owner_check(event, parent, owner_too?)
{ {
let owner_match = true; 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) if(typeof owner_too === 'undefined' && state.status_filter)
{ {
owner_too = state.status_filter === 'owner'; owner_too = state.status_filter === 'owner';