mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:15 +01:00
Fix display issues with multi-day events
- fix missing events when span is changed to cover new days - fix events stay when changing weeks, and the new week has a day with no events
This commit is contained in:
parent
dafbe6f9b5
commit
7467f3b855
@ -220,7 +220,7 @@ class calendar_uiforms extends calendar_ui
|
||||
// affect more than just one event widget, so require a full refresh.
|
||||
// $update_type is one of the update types
|
||||
// (add, edit, update, delete)
|
||||
$update_type = 'update';
|
||||
$update_type = $event['recur_type'] == MCAL_RECUR_NONE ? 'update' : 'edit';
|
||||
|
||||
list($button) = @each($content['button']);
|
||||
if (!$button && $content['action']) $button = $content['action']; // action selectbox
|
||||
@ -843,6 +843,13 @@ foreach($recur_event as $_k => $_v) error_log($_k . ': ' . array2string($_v));
|
||||
$event['button_was'] = $button; // remember for ignore
|
||||
return $this->conflicts($event,$conflicts,$preserv);
|
||||
}
|
||||
|
||||
// Event spans multiple days, need an edit to make sure they all get updated
|
||||
// We could check old date, as removing from days could still be an update
|
||||
if(date('Ymd', $event['start']) != date('Ymd', $event['end']))
|
||||
{
|
||||
$update_type = 'edit';
|
||||
}
|
||||
// check if there are messages from update, eg. removed participants or categories because of missing rights
|
||||
if ($messages)
|
||||
{
|
||||
|
@ -2770,7 +2770,9 @@ app.classes.calendar = AppJS.extend(
|
||||
.prependTo(date.getDOMNode())
|
||||
.addClass('et2_clickable')
|
||||
.on('click', function() {
|
||||
app.calendar.update_state({date: new Date().toJSON()});
|
||||
var tempDate = new Date();
|
||||
var today = new Date(tempDate.getFullYear(), tempDate.getUTCMonth(), tempDate.getUTCDate());
|
||||
app.calendar.update_state({date: today.toJSON()});
|
||||
});
|
||||
var position_today = function() {
|
||||
var week_col = $j('#calendar-sidebox_date th.ui-datepicker-week-col');
|
||||
|
@ -247,6 +247,14 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
if(this.options.date)
|
||||
{
|
||||
egw.dataUnregisterUID(app.classes.calendar._daywise_cache_id(this.options.date,this.options.owner),false,this);
|
||||
|
||||
// Remove existing events
|
||||
while(this._children.length > 0)
|
||||
{
|
||||
var node = this._children[this._children.length-1];
|
||||
this.removeChild(node);
|
||||
node.free();
|
||||
}
|
||||
}
|
||||
|
||||
this.options.date = new_date;
|
||||
|
@ -139,36 +139,16 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
var app_id = this.options.value.id + (this.options.value.recur_type ? ':'+this.options.value.recur_date : '');
|
||||
egw.dataRegisterUID('calendar::'+app_id, function(event) {
|
||||
// Check for changing days in the grid view
|
||||
if(this._parent && this._parent.instanceOf(et2_calendar_daycol) &&
|
||||
this.options.value.date && event.date != this.options.value.date)
|
||||
if(!this._sameday_check(event))
|
||||
{
|
||||
// Delete all old actions
|
||||
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);
|
||||
var old_cache_id = app.classes.calendar._daywise_cache_id(this.options.value.date,this._parent.options.owner);
|
||||
var new_daywise = egw.dataGetUIDdata(new_cache_id);
|
||||
var old_daywise = egw.dataGetUIDdata(old_cache_id);
|
||||
new_daywise = new_daywise ? new_daywise.data : [];
|
||||
old_daywise = old_daywise ? old_daywise.data : [];
|
||||
if (new_daywise.indexOf(event.id) < 0)
|
||||
{
|
||||
new_daywise.push(event.id);
|
||||
}
|
||||
old_daywise.splice(old_daywise.indexOf(this.options.value.id),1);
|
||||
egw.dataStoreUID(old_cache_id,old_daywise);
|
||||
egw.dataStoreUID(new_cache_id,new_daywise);
|
||||
|
||||
// This should now cease to exist, as new events have been created
|
||||
this.free();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Copy to avoid changes, which may cause nm problems
|
||||
this.options.value = jQuery.extend({},event);
|
||||
this.options.value.date = this._parent.options.date;
|
||||
|
||||
// Let parent position
|
||||
this._parent.position_event(this);
|
||||
@ -334,6 +314,7 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
},
|
||||
|
||||
_tooltip: function() {
|
||||
if(!this.div) return '';
|
||||
|
||||
var border = this.div.css('borderTopColor');
|
||||
var bg_color = this.div.css('background-color');
|
||||
@ -497,6 +478,51 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
}
|
||||
return timespan;
|
||||
},
|
||||
|
||||
_sameday_check: function(event)
|
||||
{
|
||||
// Event somehow got orphaned
|
||||
if(!this._parent || !this._parent.instanceOf(et2_calendar_daycol))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Simple, same day
|
||||
if(this.options.value.date && event.date == this.options.value.date)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Delete all old actions
|
||||
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);
|
||||
var old_cache_id = app.classes.calendar._daywise_cache_id(this.options.value.date,this._parent.options.owner);
|
||||
var new_daywise = egw.dataGetUIDdata(new_cache_id);
|
||||
var old_daywise = egw.dataGetUIDdata(old_cache_id);
|
||||
new_daywise = new_daywise ? new_daywise.data : [];
|
||||
old_daywise = old_daywise ? old_daywise.data : [];
|
||||
if (new_daywise.indexOf(event.id) < 0)
|
||||
{
|
||||
new_daywise.push(event.id);
|
||||
}
|
||||
old_daywise.splice(old_daywise.indexOf(this.options.value.id),1);
|
||||
egw.dataStoreUID(old_cache_id,old_daywise);
|
||||
egw.dataStoreUID(new_cache_id,new_daywise);
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
attachToDOM: function()
|
||||
{
|
||||
|
@ -585,7 +585,7 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
|
||||
this.rowHeight = this.scrolling.height() / rowsToDisplay;
|
||||
|
||||
// We need a reasonable bottom limit here...
|
||||
if(this.rowHeight < 5)
|
||||
if(this.rowHeight < 5 && this.div.is(':visible'))
|
||||
{
|
||||
this.options.granularity *= 2;
|
||||
return this._drawTimes();
|
||||
|
@ -51,7 +51,7 @@ if(view_change >= 0) {update.view = app.calendar.sidebox_changes_views[view_chan
|
||||
<taglist id="owner" class="et2_fullWidth" onchange="app.calendar.update_state({owner: widget.getValue()});" autocomplete_params=''/>
|
||||
-->
|
||||
<select id="filter" no_lang="true" class="et2_fullWidth" onchange="app.calendar.update_state({filter: widget.getValue()});"/>
|
||||
<select id="merge" empty_label="Insert in document" onchange="if(widget.getValue()) {widget.getRoot().getWidgetById('first').set_value(app.calendar.state.first);widget.getRoot().getWidgetById('last').set_value(app.calendar.state.last); widget.getInstanceManager().postSubmit();} window.setTimeout(function() {widget.set_value('');},100);return false;" class="et2_fullWidth"/>/>
|
||||
<select id="merge" empty_label="Insert in document" onchange="if(widget.getValue()) {widget.getRoot().getWidgetById('first').set_value(app.calendar.state.first);widget.getRoot().getWidgetById('last').set_value(app.calendar.state.last); widget.getInstanceManager().postSubmit();} window.setTimeout(function() {widget.set_value('');},100);return false;" class="et2_fullWidth"/>
|
||||
</vbox>
|
||||
<iframe id="iframe" width="100%" height="100%"/>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user