mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
- Simplify grid sizing calculations
- Fix non-consolidated day update
This commit is contained in:
parent
2c31029f66
commit
5e5139ae2e
@ -1987,12 +1987,12 @@ app.classes.calendar = AppJS.extend(
|
||||
break;
|
||||
case 'day':
|
||||
var end = state.state.last = view.end_date(state.state).toJSON();
|
||||
value.push({
|
||||
value.push({
|
||||
id: app.classes.calendar._daywise_cache_id(date,state.state.owner),
|
||||
start_date: state.state.first,
|
||||
end_date: state.state.last,
|
||||
owner: view.owner(state.state)
|
||||
});
|
||||
start_date: state.state.first,
|
||||
end_date: state.state.last,
|
||||
owner: view.owner(state.state)
|
||||
});
|
||||
break;
|
||||
default:
|
||||
var end = state.state.last = view.end_date(state.state).toJSON();
|
||||
@ -2009,7 +2009,25 @@ app.classes.calendar = AppJS.extend(
|
||||
break;
|
||||
}
|
||||
// If we have cached data for the timespan, pass it along
|
||||
this._need_data(value,state.state);
|
||||
// Single day with multiple owners still needs owners split to satisfy
|
||||
// caching keys, otherwise they'll fetch & cache consolidated
|
||||
if(state.state.view == 'day' && state.state.owner.length < parseInt(this.egw.preference('day_consolidate','calendar')))
|
||||
{
|
||||
day_value = [];
|
||||
for(var i = 0; i < state.state.owner.length; i++)
|
||||
{
|
||||
day_value.push({
|
||||
start_date: state.state.first,
|
||||
end_date: state.state.last,
|
||||
owner: state.state.owner[i]
|
||||
});
|
||||
}
|
||||
this._need_data(day_value,state.state);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._need_data(value,state.state);
|
||||
}
|
||||
|
||||
var row_index = 0;
|
||||
|
||||
@ -2083,22 +2101,6 @@ app.classes.calendar = AppJS.extend(
|
||||
widget.set_value(value[row_index++]);
|
||||
}
|
||||
},this, et2_calendar_view);
|
||||
|
||||
// Single day with multiple owners still needs owners split to satisfy
|
||||
// caching keys, otherwise they'll cache consolidated
|
||||
if(state.state.view == 'day' && state.state.owner.length < parseInt(this.egw.preference('day_consolidate','calendar')))
|
||||
{
|
||||
value = [];
|
||||
for(var i = 0; i < state.state.owner.length; i++)
|
||||
{
|
||||
value.push({
|
||||
start_date: state.state.first,
|
||||
end_date: state.state.last,
|
||||
owner: state.state.owner[i]
|
||||
});
|
||||
}
|
||||
this._need_data(value,state.state);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -652,8 +652,8 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
if(event.participants && this._parent.options.owner)
|
||||
{
|
||||
var parent_owner = this._parent.options.owner;
|
||||
var match = false;
|
||||
for(var i = 0; !match && i < this._parent.options.owner.length; i++ )
|
||||
var owner_match = false;
|
||||
for(var i = 0; i < this._parent.options.owner.length; i++ )
|
||||
{
|
||||
if (parseInt(this._parent.options.owner[i]) < 0)
|
||||
{
|
||||
@ -669,20 +669,20 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
parent_owner.indexOf &&
|
||||
parent_owner.indexOf(id) >= 0)
|
||||
{
|
||||
match = true;
|
||||
owner_match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!match)
|
||||
if(!owner_match)
|
||||
{
|
||||
return(this._parent.options.owner == event.owner ||
|
||||
owner_match = (this._parent.options.owner == event.owner ||
|
||||
parent_owner.indexOf &&
|
||||
parent_owner.indexOf(event.owner) >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Simple, same day
|
||||
if(this.options.value.date && event.date == this.options.value.date)
|
||||
if(owner_match && this.options.value.date && event.date == this.options.value.date)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -690,15 +690,18 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
// Multi-day non-recurring event spans days - date does not match
|
||||
var event_start = new Date(event.start);
|
||||
var event_end = new Date(event.end);
|
||||
if(this._parent.date >= event_start && this._parent.date <= event_end)
|
||||
if(owner_match && this._parent.date >= event_start && this._parent.date <= event_end)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Delete all old actions
|
||||
this._actionObject.clear();
|
||||
this._actionObject.unregisterActions();
|
||||
this._actionObject = null;
|
||||
if(this._actionObject)
|
||||
{
|
||||
this._actionObject.clear();
|
||||
this._actionObject.unregisterActions();
|
||||
this._actionObject = null;
|
||||
}
|
||||
|
||||
// Update daywise caches
|
||||
var new_cache_id = app.classes.calendar._daywise_cache_id(event.date,this._parent.options.owner);
|
||||
|
@ -649,7 +649,6 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
|
||||
|
||||
|
||||
this.scrolling
|
||||
.css('height', (this.div.innerHeight() - header_height)+'px')
|
||||
.on('scroll', jQuery.proxy(this._scroll, this));
|
||||
|
||||
// Percent
|
||||
@ -684,7 +683,7 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
|
||||
this._top_time = 0
|
||||
for(var t = 0,i = 0; t < 1440; t += granularity,++i)
|
||||
{
|
||||
html += '<div class="calendar_calTimeRow" style="height: '+this.rowHeight+'px;">';
|
||||
html += '<div class="calendar_calTimeRow" style="height: '+rowHeight+'%;">';
|
||||
// show time for full hours, always for 45min interval and at least on every 3 row
|
||||
var time = jQuery.datepicker.formatTime(
|
||||
egw.preference("timeformat") === "12" ? "h:mmtt" : "HH:mm",
|
||||
@ -759,8 +758,6 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
|
||||
var wd_end = 60*this.options.day_end;
|
||||
var totalDisplayMinutes = wd_end - wd_start;
|
||||
var rowsToDisplay = Math.ceil((totalDisplayMinutes+60)/this.options.granularity);
|
||||
this.scrolling
|
||||
.css('height', (this.options.height - this.gridHeader.outerHeight(true))+'px');
|
||||
|
||||
var new_height = this.scrolling.height() / rowsToDisplay;
|
||||
this.rowHeight = new_height;
|
||||
@ -773,7 +770,6 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
|
||||
'100%' :
|
||||
(this.rowHeight*rows.length)+'px'
|
||||
);
|
||||
$j('.calendar_calAddEvent',this.scrolling).height(this.rowHeight);
|
||||
|
||||
// Scroll to start of day
|
||||
this._top_time = (wd_start * this.rowHeight) / this.options.granularity;
|
||||
@ -1670,7 +1666,7 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
|
||||
this.div.css('height', this.options.height);
|
||||
|
||||
// Re-do time grid
|
||||
this._drawTimes();
|
||||
if(!this.update_timer) this._drawTimes();
|
||||
|
||||
// Just re-did everything, no need to do more
|
||||
return;
|
||||
|
@ -189,10 +189,14 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget
|
||||
position: relative;
|
||||
bottom: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
cursor: default;
|
||||
}
|
||||
.calendar_calTimeGrid .calendar_calTimeLabels {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.calendar_calTimeGrid .loading,.calendar_plannerWidget .loading {
|
||||
top: 0px;
|
||||
|
Loading…
Reference in New Issue
Block a user