Calendar: Fix planner by user only showed one user

Fixed a few other planner bugs too:
- Not all properties were being set (owner, group_by, show_weekend)
- header was incorrectly sized
This commit is contained in:
nathan 2022-04-12 11:25:33 -06:00
parent 319bd51f80
commit 2755d19d2f
3 changed files with 31 additions and 5 deletions

View File

@ -132,9 +132,35 @@ export abstract class View
parseInt(<string>egw.preference('interval', 'calendar')) || 30;
}
public static extend(sub)
/**
* You can't iterate through a class's methods normally and get parent methods as well.
* This lets us get the methods from class + parent
*
* @param view
* @returns {string[]}
*/
public static getAllFuncs(view)
{
return jQuery.extend({}, this, {_super: this}, sub);
const props = [];
let obj = view;
do
{
props.push(...Object.getOwnPropertyNames(obj));
}
while((obj = Object.getPrototypeOf(obj)) && obj !== View);
props.push(...Object.getOwnPropertyNames(View));
return props.sort().filter((e, i, arr) =>
{
if(e[0] === "_" || ["getAllFuncs"].indexOf(e) !== -1)
{
return false;
}
if(e != arr[i + 1] && typeof view[e] == 'function')
{
return true;
}
});
}
/**

View File

@ -3106,7 +3106,7 @@ export class CalendarApp extends EgwApp
{
// Simple, easy case - just one widget for the selected time span. (planner)
// Update existing view's special attribute filters, defined in the view list
for(let updater of Object.getOwnPropertyNames(view))
for(let updater of view.getAllFuncs(view))
{
if(typeof view[updater] === 'function')
{

View File

@ -1008,7 +1008,7 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta
// Adjust header if there's a scrollbar
if(this.rows.children().last().length)
{
this.gridHeader.css('margin-right', (this.rows.width() - this.rows.children().last().width()) + 'px');
this.gridHeader.css('margin-right', (this.rows.width() - this.rows.children().first().width()) + 'px');
}
// Add actual events
for(var key in this._deferred_row_updates)
@ -2034,7 +2034,7 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta
// in some cases
if(this.rows.children().last().length)
{
this.gridHeader.css('margin-right', (this.rows.width() - this.rows.children().last().width()) + 'px');
this.gridHeader.css('margin-right', (this.rows.width() - this.rows.children().first().width()) + 'px');
}
}