forked from extern/egroupware
Home using non-global EgwApp instances for portlets
This commit is contained in:
parent
8f769a9550
commit
382de156cf
@ -150,7 +150,7 @@ var et2_portlet = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
// Add in defaults, but let provided actions override them
|
// Add in defaults, but let provided actions override them
|
||||||
this.options.actions = jQuery.extend(true, {}, defaults, actions);
|
this.options.actions = jQuery.extend(true, {}, defaults, actions);
|
||||||
_super.prototype.set_actions.call(this, [this.options.actions]);
|
_super.prototype.set_actions.call(this, this.options.actions);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Override _link_actions to remove edit action, if there is no settings
|
* Override _link_actions to remove edit action, if there is no settings
|
||||||
|
@ -208,7 +208,7 @@ class et2_portlet extends et2_valueWidget
|
|||||||
|
|
||||||
// Add in defaults, but let provided actions override them
|
// Add in defaults, but let provided actions override them
|
||||||
this.options.actions = jQuery.extend(true,{},defaults,actions);
|
this.options.actions = jQuery.extend(true,{},defaults,actions);
|
||||||
super.set_actions([this.options.actions]);
|
super.set_actions(this.options.actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -361,7 +361,7 @@ var etemplate2 = /** @class */ (function () {
|
|||||||
var appname = _name.split('.')[0];
|
var appname = _name.split('.')[0];
|
||||||
// if no app object provided and template app is not currentapp (eg. infolog CRM view)
|
// if no app object provided and template app is not currentapp (eg. infolog CRM view)
|
||||||
// create private app object / closure with just classes / prototypes
|
// create private app object / closure with just classes / prototypes
|
||||||
if (!_app && appname && appname != currentapp && currentapp != 'home' && appname != 'home') {
|
if (!_app && appname && appname != currentapp) {
|
||||||
app = { classes: window.app.classes };
|
app = { classes: window.app.classes };
|
||||||
}
|
}
|
||||||
// remember used app object, to eg. use: onchange="widget.getInstanceMgr().app_object[app].callback()"
|
// remember used app object, to eg. use: onchange="widget.getInstanceMgr().app_object[app].callback()"
|
||||||
|
@ -459,7 +459,7 @@ export class etemplate2
|
|||||||
const appname = _name.split('.')[0];
|
const appname = _name.split('.')[0];
|
||||||
// if no app object provided and template app is not currentapp (eg. infolog CRM view)
|
// if no app object provided and template app is not currentapp (eg. infolog CRM view)
|
||||||
// create private app object / closure with just classes / prototypes
|
// create private app object / closure with just classes / prototypes
|
||||||
if (!_app && appname && appname != currentapp && currentapp != 'home' && appname != 'home')
|
if (!_app && appname && appname != currentapp)
|
||||||
{
|
{
|
||||||
app = {classes: window.app.classes};
|
app = {classes: window.app.classes};
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ var CalendarApp = /** @class */ (function (_super) {
|
|||||||
return d;
|
return d;
|
||||||
},
|
},
|
||||||
end_of_week: function (date) {
|
end_of_week: function (date) {
|
||||||
var d = app.calendar.date.start_of_week(date);
|
var d = this.start_of_week(date);
|
||||||
d.setUTCDate(d.getUTCDate() + 6);
|
d.setUTCDate(d.getUTCDate() + 6);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
@ -558,6 +558,7 @@ var CalendarApp = /** @class */ (function (_super) {
|
|||||||
* @param pushData
|
* @param pushData
|
||||||
*/
|
*/
|
||||||
CalendarApp.prototype.push_calendar = function (pushData) {
|
CalendarApp.prototype.push_calendar = function (pushData) {
|
||||||
|
var _this = this;
|
||||||
// pushData does not contain everything, just the minimum. See calendar_hooks::search_link().
|
// pushData does not contain everything, just the minimum. See calendar_hooks::search_link().
|
||||||
var cal_event = pushData.acl || {};
|
var cal_event = pushData.acl || {};
|
||||||
// check visibility - grants is ID => permission of people we're allowed to see
|
// check visibility - grants is ID => permission of people we're allowed to see
|
||||||
@ -566,9 +567,9 @@ var CalendarApp = /** @class */ (function (_super) {
|
|||||||
this._grants = egw.grants(this.appname);
|
this._grants = egw.grants(this.appname);
|
||||||
}
|
}
|
||||||
// Filter what's allowed down to those we care about
|
// Filter what's allowed down to those we care about
|
||||||
var filtered = Object.keys(this._grants).filter(function (account) { return app.calendar.state.owner.indexOf(account) >= 0; });
|
var filtered = Object.keys(this._grants).filter(function (account) { return _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
|
||||||
var owner_check = et2_widget_event_1.et2_calendar_event.owner_check(cal_event, { options: { owner: filtered } });
|
var owner_check = et2_widget_event_1.et2_calendar_event.owner_check(cal_event, 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
|
||||||
return;
|
return;
|
||||||
@ -708,11 +709,11 @@ var CalendarApp = /** @class */ (function (_super) {
|
|||||||
case 'next':
|
case 'next':
|
||||||
case 'previous':
|
case 'previous':
|
||||||
var delta = action.id == 'previous' ? -1 : 1;
|
var delta = action.id == 'previous' ? -1 : 1;
|
||||||
var view = CalendarApp.views[app.calendar.state.view] || false;
|
var view = CalendarApp.views[this.state.view] || false;
|
||||||
var start = new Date(app.calendar.state.date);
|
var start = new Date(this.state.date);
|
||||||
if (view) {
|
if (view) {
|
||||||
start = view.scroll(delta);
|
start = view.scroll(delta);
|
||||||
app.calendar.update_state({ date: app.calendar.date.toString(start) });
|
app.calendar.update_state({ date: this.date.toString(start) });
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -503,10 +503,13 @@ class CalendarApp extends EgwApp
|
|||||||
this._grants = egw.grants(this.appname);
|
this._grants = egw.grants(this.appname);
|
||||||
}
|
}
|
||||||
// Filter what's allowed down to those we care about
|
// Filter what's allowed down to those we care about
|
||||||
let filtered = Object.keys(this._grants).filter(account => app.calendar.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, {options: {owner: filtered}});
|
let owner_check = et2_calendar_event.owner_check(cal_event, 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
|
||||||
@ -670,12 +673,12 @@ class CalendarApp extends EgwApp
|
|||||||
case 'next':
|
case 'next':
|
||||||
case 'previous':
|
case 'previous':
|
||||||
var delta = action.id == 'previous' ? -1 : 1;
|
var delta = action.id == 'previous' ? -1 : 1;
|
||||||
var view = CalendarApp.views[app.calendar.state.view] || false;
|
var view = CalendarApp.views[this.state.view] || false;
|
||||||
var start = new Date(app.calendar.state.date);
|
var start = new Date(this.state.date);
|
||||||
if (view)
|
if (view)
|
||||||
{
|
{
|
||||||
start = view.scroll(delta);
|
start = view.scroll(delta);
|
||||||
app.calendar.update_state({date:app.calendar.date.toString(start)});
|
app.calendar.update_state({date:this.date.toString(start)});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3803,7 +3806,7 @@ class CalendarApp extends EgwApp
|
|||||||
},
|
},
|
||||||
end_of_week: function(date)
|
end_of_week: function(date)
|
||||||
{
|
{
|
||||||
var d = app.calendar.date.start_of_week(date);
|
var d = this.start_of_week(date);
|
||||||
d.setUTCDate(d.getUTCDate() + 6);
|
d.setUTCDate(d.getUTCDate() + 6);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,8 @@ var et2_calendar_event = /** @class */ (function (_super) {
|
|||||||
this._values_check(value);
|
this._values_check(value);
|
||||||
}
|
}
|
||||||
// Check for changing days in the grid view
|
// Check for changing days in the grid view
|
||||||
if (!this._sameday_check(value) || !this._status_check(value, app.calendar.getState().status_filter, parent_owner)) {
|
var state = this.getInstanceManager().app_obj.calendar.getState() || app.calendar.getState();
|
||||||
|
if (!this._sameday_check(value) || !this._status_check(value, state.status_filter, parent_owner)) {
|
||||||
// May need to update parent to remove out-of-view events
|
// May need to update parent to remove out-of-view events
|
||||||
parent.removeChild(this);
|
parent.removeChild(this);
|
||||||
if (event === null && parent && parent.instanceOf(et2_widget_daycol_1.et2_calendar_daycol)) {
|
if (event === null && parent && parent.instanceOf(et2_widget_daycol_1.et2_calendar_daycol)) {
|
||||||
@ -927,9 +928,11 @@ var et2_calendar_event = /** @class */ (function (_super) {
|
|||||||
* @return {boolean} Should the event be displayed
|
* @return {boolean} Should the event be displayed
|
||||||
*/
|
*/
|
||||||
et2_calendar_event.owner_check = function (event, parent, owner_too) {
|
et2_calendar_event.owner_check = function (event, parent, owner_too) {
|
||||||
|
var _a, _b;
|
||||||
var owner_match = true;
|
var owner_match = true;
|
||||||
if (typeof owner_too === 'undefined' && app.calendar.state.status_filter) {
|
var state = ((_a = parent.getInstanceManager()) === null || _a === void 0 ? void 0 : _a.app_obj.calendar.state) || ((_b = app.calendar) === null || _b === void 0 ? void 0 : _b.state) || {};
|
||||||
owner_too = app.calendar.state.status_filter === 'owner';
|
if (typeof owner_too === 'undefined' && state.status_filter) {
|
||||||
|
owner_too = state.status_filter === 'owner';
|
||||||
}
|
}
|
||||||
var options = null;
|
var options = null;
|
||||||
if (app.calendar && app.calendar.sidebox_et2 && app.calendar.sidebox_et2.getWidgetById('owner')) {
|
if (app.calendar && app.calendar.sidebox_et2 && app.calendar.sidebox_et2.getWidgetById('owner')) {
|
||||||
|
@ -223,7 +223,8 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for changing days in the grid view
|
// Check for changing days in the grid view
|
||||||
if(!this._sameday_check(value) || !this._status_check(value, app.calendar.getState().status_filter, parent_owner))
|
let state = this.getInstanceManager().app_obj.calendar.getState() || app.calendar.getState();
|
||||||
|
if(!this._sameday_check(value) || !this._status_check(value, state.status_filter, parent_owner))
|
||||||
{
|
{
|
||||||
// May need to update parent to remove out-of-view events
|
// May need to update parent to remove out-of-view events
|
||||||
parent.removeChild(this);
|
parent.removeChild(this);
|
||||||
@ -1187,9 +1188,10 @@ 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;
|
||||||
if(typeof owner_too === 'undefined' && app.calendar.state.status_filter)
|
let state = parent.getInstanceManager()?.app_obj.calendar.state || app.calendar?.state || {}
|
||||||
|
if(typeof owner_too === 'undefined' && state.status_filter)
|
||||||
{
|
{
|
||||||
owner_too = app.calendar.state.status_filter === 'owner';
|
owner_too = state.status_filter === 'owner';
|
||||||
}
|
}
|
||||||
let options : any = null;
|
let options : any = null;
|
||||||
if(app.calendar && app.calendar.sidebox_et2 && app.calendar.sidebox_et2.getWidgetById('owner'))
|
if(app.calendar && app.calendar.sidebox_et2 && app.calendar.sidebox_et2.getWidgetById('owner'))
|
||||||
|
@ -354,15 +354,16 @@ var et2_calendar_planner = /** @class */ (function (_super) {
|
|||||||
getInstanceManager: function () { return im; }
|
getInstanceManager: function () { return im; }
|
||||||
}, { application: 'calendar' });
|
}, { application: 'calendar' });
|
||||||
var labels = [];
|
var labels = [];
|
||||||
if (!app.calendar.state.cat_id ||
|
var app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||||
app.calendar.state.cat_id.toString() === '' ||
|
if (!app_calendar.state.cat_id ||
|
||||||
app.calendar.state.cat_id.toString() == '0') {
|
app_calendar.state.cat_id.toString() === '' ||
|
||||||
app.calendar.state.cat_id = '';
|
app_calendar.state.cat_id.toString() == '0') {
|
||||||
|
app_calendar.state.cat_id = '';
|
||||||
labels.push({ id: '', value: '', label: egw.lang('none'), main: '', data: {} });
|
labels.push({ id: '', value: '', label: egw.lang('none'), main: '', data: {} });
|
||||||
labels = labels.concat(categories);
|
labels = labels.concat(categories);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var cat_id = app.calendar.state.cat_id;
|
var cat_id = app_calendar.state.cat_id;
|
||||||
if (typeof cat_id == 'string') {
|
if (typeof cat_id == 'string') {
|
||||||
cat_id = cat_id.split(',');
|
cat_id = cat_id.split(',');
|
||||||
}
|
}
|
||||||
@ -395,6 +396,7 @@ var et2_calendar_planner = /** @class */ (function (_super) {
|
|||||||
},
|
},
|
||||||
group: function (labels, rows, event) {
|
group: function (labels, rows, event) {
|
||||||
var cats = event.category;
|
var cats = event.category;
|
||||||
|
var app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||||
if (typeof event.category === 'string') {
|
if (typeof event.category === 'string') {
|
||||||
cats = cats.split(',');
|
cats = cats.split(',');
|
||||||
}
|
}
|
||||||
@ -406,7 +408,7 @@ var et2_calendar_planner = /** @class */ (function (_super) {
|
|||||||
for (var i = 0; i < labels.length; i++) {
|
for (var i = 0; i < labels.length; i++) {
|
||||||
if (labels[i].id == category) {
|
if (labels[i].id == category) {
|
||||||
// If there's no cat filter, only show the top level
|
// If there's no cat filter, only show the top level
|
||||||
if (!app.calendar.state.cat_id) {
|
if (!app_calendar.state.cat_id) {
|
||||||
for (var j = 0; j < labels.length; j++) {
|
for (var j = 0; j < labels.length; j++) {
|
||||||
if (labels[j].id == labels[i].main) {
|
if (labels[j].id == labels[i].main) {
|
||||||
label_index = j;
|
label_index = j;
|
||||||
@ -753,12 +755,13 @@ var et2_calendar_planner = /** @class */ (function (_super) {
|
|||||||
// Set height for rows
|
// Set height for rows
|
||||||
this.rows.height(this.div.height() - this.headers.outerHeight());
|
this.rows.height(this.div.height() - this.headers.outerHeight());
|
||||||
// Draw the rows
|
// Draw the rows
|
||||||
|
var app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||||
for (var key in labels) {
|
for (var key in labels) {
|
||||||
if (!labels.hasOwnProperty(key))
|
if (!labels.hasOwnProperty(key))
|
||||||
continue;
|
continue;
|
||||||
// Skip sub-categories (events are merged into top level)
|
// Skip sub-categories (events are merged into top level)
|
||||||
if (this.options.group_by == 'category' &&
|
if (this.options.group_by == 'category' &&
|
||||||
(!app.calendar.state.cat_id || app.calendar.state.cat_id == '') &&
|
(!app_calendar.state.cat_id || app_calendar.state.cat_id == '') &&
|
||||||
labels[key].id != labels[key].main) {
|
labels[key].id != labels[key].main) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -901,7 +904,8 @@ var et2_calendar_planner = /** @class */ (function (_super) {
|
|||||||
// we're not using UTC so date() formatting function works
|
// we're not using UTC so date() formatting function works
|
||||||
var t = new Date(start.valueOf());
|
var t = new Date(start.valueOf());
|
||||||
// Make sure we're lining up on the week
|
// Make sure we're lining up on the week
|
||||||
var week_end = app.calendar.date.end_of_week(start);
|
var app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||||
|
var week_end = app_calendar.date.end_of_week(start);
|
||||||
var days_in_week = Math.floor(((week_end - start) / (24 * 3600 * 1000)) + 1);
|
var days_in_week = Math.floor(((week_end - start) / (24 * 3600 * 1000)) + 1);
|
||||||
var week_width = 100 / days * (days <= 7 ? days : days_in_week);
|
var week_width = 100 / days * (days <= 7 ? days : days_in_week);
|
||||||
for (var left = 0, i = 0; i < days; t.setUTCDate(t.getUTCDate() + 7), left += week_width) {
|
for (var left = 0, i = 0; i < days; t.setUTCDate(t.getUTCDate() + 7), left += week_width) {
|
||||||
@ -915,12 +919,12 @@ var et2_calendar_planner = /** @class */ (function (_super) {
|
|||||||
usertime.setUTCMinutes(usertime.getUTCMinutes() - start.getTimezoneOffset());
|
usertime.setUTCMinutes(usertime.getUTCMinutes() - start.getTimezoneOffset());
|
||||||
}
|
}
|
||||||
week_width = 100 / days * Math.min(days, days_in_week);
|
week_width = 100 / days * Math.min(days, days_in_week);
|
||||||
var title = this.egw().lang('Week') + ' ' + app.calendar.date.week_number(usertime);
|
var title = this.egw().lang('Week') + ' ' + app_calendar.date.week_number(usertime);
|
||||||
if (start.getTimezoneOffset() > 0) {
|
if (start.getTimezoneOffset() > 0) {
|
||||||
// Gets the right week start west of GMT
|
// Gets the right week start west of GMT
|
||||||
usertime.setUTCMinutes(usertime.getUTCMinutes() + start.getTimezoneOffset());
|
usertime.setUTCMinutes(usertime.getUTCMinutes() + start.getTimezoneOffset());
|
||||||
}
|
}
|
||||||
state = app.calendar.date.start_of_week(usertime);
|
state = app_calendar.date.start_of_week(usertime);
|
||||||
state.setUTCHours(0);
|
state.setUTCHours(0);
|
||||||
state.setUTCMinutes(0);
|
state.setUTCMinutes(0);
|
||||||
state = state.toJSON();
|
state = state.toJSON();
|
||||||
|
@ -716,18 +716,19 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta
|
|||||||
},{application: 'calendar'});
|
},{application: 'calendar'});
|
||||||
|
|
||||||
var labels = [];
|
var labels = [];
|
||||||
if(!app.calendar.state.cat_id ||
|
let app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||||
app.calendar.state.cat_id.toString() === '' ||
|
if(!app_calendar.state.cat_id ||
|
||||||
app.calendar.state.cat_id.toString() == '0'
|
app_calendar.state.cat_id.toString() === '' ||
|
||||||
|
app_calendar.state.cat_id.toString() == '0'
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
app.calendar.state.cat_id = '';
|
app_calendar.state.cat_id = '';
|
||||||
labels.push({id:'',value:'',label: egw.lang('none'), main: '', data: {}});
|
labels.push({id:'',value:'',label: egw.lang('none'), main: '', data: {}});
|
||||||
labels = labels.concat(categories);
|
labels = labels.concat(categories);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var cat_id = app.calendar.state.cat_id;
|
var cat_id = app_calendar.state.cat_id;
|
||||||
if(typeof cat_id == 'string')
|
if(typeof cat_id == 'string')
|
||||||
{
|
{
|
||||||
cat_id = cat_id.split(',');
|
cat_id = cat_id.split(',');
|
||||||
@ -772,6 +773,7 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta
|
|||||||
},
|
},
|
||||||
group: function(labels, rows, event) {
|
group: function(labels, rows, event) {
|
||||||
var cats = event.category;
|
var cats = event.category;
|
||||||
|
let app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||||
if(typeof event.category === 'string')
|
if(typeof event.category === 'string')
|
||||||
{
|
{
|
||||||
cats = cats.split(',');
|
cats = cats.split(',');
|
||||||
@ -786,7 +788,7 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta
|
|||||||
if(labels[i].id == category)
|
if(labels[i].id == category)
|
||||||
{
|
{
|
||||||
// If there's no cat filter, only show the top level
|
// If there's no cat filter, only show the top level
|
||||||
if(!app.calendar.state.cat_id)
|
if(!app_calendar.state.cat_id)
|
||||||
{
|
{
|
||||||
for(var j = 0; j < labels.length; j++)
|
for(var j = 0; j < labels.length; j++)
|
||||||
{
|
{
|
||||||
@ -965,13 +967,14 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta
|
|||||||
this.rows.height(this.div.height() - this.headers.outerHeight());
|
this.rows.height(this.div.height() - this.headers.outerHeight());
|
||||||
|
|
||||||
// Draw the rows
|
// Draw the rows
|
||||||
|
let app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||||
for(var key in labels)
|
for(var key in labels)
|
||||||
{
|
{
|
||||||
if (!labels.hasOwnProperty(key)) continue;
|
if (!labels.hasOwnProperty(key)) continue;
|
||||||
|
|
||||||
// Skip sub-categories (events are merged into top level)
|
// Skip sub-categories (events are merged into top level)
|
||||||
if(this.options.group_by == 'category' &&
|
if(this.options.group_by == 'category' &&
|
||||||
(!app.calendar.state.cat_id || app.calendar.state.cat_id == '') &&
|
(!app_calendar.state.cat_id || app_calendar.state.cat_id == '') &&
|
||||||
labels[key].id != labels[key].main
|
labels[key].id != labels[key].main
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -1157,7 +1160,8 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta
|
|||||||
var t = new Date(start.valueOf());
|
var t = new Date(start.valueOf());
|
||||||
|
|
||||||
// Make sure we're lining up on the week
|
// Make sure we're lining up on the week
|
||||||
var week_end = app.calendar.date.end_of_week(start);
|
let app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||||
|
var week_end = app_calendar.date.end_of_week(start);
|
||||||
var days_in_week = Math.floor(((week_end-start ) / (24*3600*1000))+1);
|
var days_in_week = Math.floor(((week_end-start ) / (24*3600*1000))+1);
|
||||||
var week_width = 100 / days * (days <= 7 ? days : days_in_week);
|
var week_width = 100 / days * (days <= 7 ? days : days_in_week);
|
||||||
for(var left = 0,i = 0; i < days; t.setUTCDate(t.getUTCDate() + 7),left += week_width)
|
for(var left = 0,i = 0; i < days; t.setUTCDate(t.getUTCDate() + 7),left += week_width)
|
||||||
@ -1176,14 +1180,14 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta
|
|||||||
|
|
||||||
week_width = 100 / days * Math.min(days, days_in_week);
|
week_width = 100 / days * Math.min(days, days_in_week);
|
||||||
|
|
||||||
var title = this.egw().lang('Week')+' '+app.calendar.date.week_number(usertime);
|
var title = this.egw().lang('Week')+' '+app_calendar.date.week_number(usertime);
|
||||||
|
|
||||||
if(start.getTimezoneOffset() > 0)
|
if(start.getTimezoneOffset() > 0)
|
||||||
{
|
{
|
||||||
// Gets the right week start west of GMT
|
// Gets the right week start west of GMT
|
||||||
usertime.setUTCMinutes(usertime.getUTCMinutes() +start.getTimezoneOffset());
|
usertime.setUTCMinutes(usertime.getUTCMinutes() +start.getTimezoneOffset());
|
||||||
}
|
}
|
||||||
state = app.calendar.date.start_of_week(usertime);
|
state = app_calendar.date.start_of_week(usertime);
|
||||||
state.setUTCHours(0);
|
state.setUTCHours(0);
|
||||||
state.setUTCMinutes(0);
|
state.setUTCMinutes(0);
|
||||||
state = state.toJSON();
|
state = state.toJSON();
|
||||||
|
@ -814,11 +814,12 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
|
|||||||
*/
|
*/
|
||||||
et2_calendar_timegrid.prototype.set_header_classes = function () {
|
et2_calendar_timegrid.prototype.set_header_classes = function () {
|
||||||
var day;
|
var day;
|
||||||
|
var app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||||
for (var i = 0; i < this.day_widgets.length; i++) {
|
for (var i = 0; i < this.day_widgets.length; i++) {
|
||||||
day = this.day_widgets[i];
|
day = this.day_widgets[i];
|
||||||
// Classes
|
// Classes
|
||||||
if (app.calendar && app.calendar.state &&
|
if (app_calendar && app_calendar.state &&
|
||||||
this.day_list[i] && parseInt(this.day_list[i].substr(4, 2)) !== new Date(app.calendar.state.date).getUTCMonth() + 1) {
|
this.day_list[i] && parseInt(this.day_list[i].substr(4, 2)) !== new Date(app_calendar.state.date).getUTCMonth() + 1) {
|
||||||
day.set_class('calendar_differentMonth');
|
day.set_class('calendar_differentMonth');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1087,13 +1087,14 @@ export class et2_calendar_timegrid extends et2_calendar_view implements et2_IDet
|
|||||||
set_header_classes()
|
set_header_classes()
|
||||||
{
|
{
|
||||||
var day;
|
var day;
|
||||||
|
let app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||||
for(var i = 0; i < this.day_widgets.length; i++)
|
for(var i = 0; i < this.day_widgets.length; i++)
|
||||||
{
|
{
|
||||||
day = this.day_widgets[i];
|
day = this.day_widgets[i];
|
||||||
|
|
||||||
// Classes
|
// Classes
|
||||||
if(app.calendar && app.calendar.state &&
|
if(app_calendar && app_calendar.state &&
|
||||||
this.day_list[i] && parseInt(this.day_list[i].substr(4,2)) !== new Date(app.calendar.state.date).getUTCMonth()+1)
|
this.day_list[i] && parseInt(this.day_list[i].substr(4,2)) !== new Date(app_calendar.state.date).getUTCMonth()+1)
|
||||||
{
|
{
|
||||||
day.set_class('calendar_differentMonth');
|
day.set_class('calendar_differentMonth');
|
||||||
}
|
}
|
||||||
|
@ -491,7 +491,8 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
|||||||
jQuery.extend(options, this.drag_create.start, end);
|
jQuery.extend(options, this.drag_create.start, end);
|
||||||
delete (options.date);
|
delete (options.date);
|
||||||
// Make sure parent is set, if needed
|
// Make sure parent is set, if needed
|
||||||
if (this.drag_create.parent && this.drag_create.parent.options.owner !== app.calendar.state.owner && !options.owner) {
|
var app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||||
|
if (this.drag_create.parent && this.drag_create.parent.options.owner !== app_calendar.state.owner && !options.owner) {
|
||||||
options.owner = this.drag_create.parent.options.owner;
|
options.owner = this.drag_create.parent.options.owner;
|
||||||
}
|
}
|
||||||
// Remove empties
|
// Remove empties
|
||||||
|
@ -619,7 +619,8 @@ export class et2_calendar_view extends et2_valueWidget
|
|||||||
delete(options.date);
|
delete(options.date);
|
||||||
|
|
||||||
// Make sure parent is set, if needed
|
// Make sure parent is set, if needed
|
||||||
if (this.drag_create.parent && this.drag_create.parent.options.owner !== app.calendar.state.owner && !options.owner)
|
let app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||||
|
if (this.drag_create.parent && this.drag_create.parent.options.owner !== app_calendar.state.owner && !options.owner)
|
||||||
{
|
{
|
||||||
options.owner = this.drag_create.parent.options.owner;
|
options.owner = this.drag_create.parent.options.owner;
|
||||||
}
|
}
|
||||||
|
@ -144,14 +144,15 @@ app.classes.home = (function(){ "use strict"; return AppJS.extend(
|
|||||||
}
|
}
|
||||||
else if (et2.uniqueId)
|
else if (et2.uniqueId)
|
||||||
{
|
{
|
||||||
|
let portlet_container = this.portlet_container || window.app.home?.portlet_container;
|
||||||
// Handle bad timing - a sub-template was finished first
|
// Handle bad timing - a sub-template was finished first
|
||||||
if(!this.portlet_container)
|
if(!portlet_container)
|
||||||
{
|
{
|
||||||
window.setTimeout(jQuery.proxy(function() {this.et2_ready(et2, name);},this),200);
|
window.setTimeout(jQuery.proxy(function() {this.et2_ready(et2, name);},this),200);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var portlet = this.portlet_container.getWidgetById(et2.uniqueId);
|
var portlet = portlet_container.getWidgetById(et2.uniqueId);
|
||||||
// Check for existing etemplate, this one loaded over it
|
// Check for existing etemplate, this one loaded over it
|
||||||
// NOTE: Moving them around like this can cause problems with event handlers
|
// NOTE: Moving them around like this can cause problems with event handlers
|
||||||
var existing = etemplate2.getById(et2.uniqueId);
|
var existing = etemplate2.getById(et2.uniqueId);
|
||||||
|
Loading…
Reference in New Issue
Block a user