diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php
index 5ab751aa10..c36803938f 100644
--- a/calendar/inc/class.calendar_uiforms.inc.php
+++ b/calendar/inc/class.calendar_uiforms.inc.php
@@ -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)
{
diff --git a/calendar/js/app.js b/calendar/js/app.js
index d035ad7204..0d5ba62a55 100644
--- a/calendar/js/app.js
+++ b/calendar/js/app.js
@@ -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');
diff --git a/calendar/js/et2_widget_daycol.js b/calendar/js/et2_widget_daycol.js
index 6c1230dfcc..0aaaf2a390 100644
--- a/calendar/js/et2_widget_daycol.js
+++ b/calendar/js/et2_widget_daycol.js
@@ -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;
diff --git a/calendar/js/et2_widget_event.js b/calendar/js/et2_widget_event.js
index 662a2b5bee..e04b6d0e0d 100644
--- a/calendar/js/et2_widget_event.js
+++ b/calendar/js/et2_widget_event.js
@@ -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()
{
diff --git a/calendar/js/et2_widget_timegrid.js b/calendar/js/et2_widget_timegrid.js
index 125f1813ac..8344378a7d 100644
--- a/calendar/js/et2_widget_timegrid.js
+++ b/calendar/js/et2_widget_timegrid.js
@@ -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();
diff --git a/calendar/templates/default/sidebox.xet b/calendar/templates/default/sidebox.xet
index 656de2df7d..577db96d75 100644
--- a/calendar/templates/default/sidebox.xet
+++ b/calendar/templates/default/sidebox.xet
@@ -51,7 +51,7 @@ if(view_change >= 0) {update.view = app.calendar.sidebox_changes_views[view_chan
-->
- />
+