diff --git a/calendar/js/et2_widget_planner.js b/calendar/js/et2_widget_planner.js index 95c477bacc..a5ee654ae7 100644 --- a/calendar/js/et2_widget_planner.js +++ b/calendar/js/et2_widget_planner.js @@ -307,6 +307,9 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e .css('top', '').css('left','') .appendTo(ui.helper); ui.helper.width(jQuery(this).width()); + + // Cancel drag to create, we're dragging an existing event + planner._drag_create_end(); }); return true; }, @@ -1910,6 +1913,7 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e { var time = this._get_time_from_position(event.offsetX, event.offsetY); } + if(!time) return false; this.div.css('cursor', 'ew-resize'); diff --git a/calendar/js/et2_widget_timegrid.js b/calendar/js/et2_widget_timegrid.js index 8b180005c4..64f8d27a57 100644 --- a/calendar/js/et2_widget_timegrid.js +++ b/calendar/js/et2_widget_timegrid.js @@ -1091,8 +1091,14 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view. var event = event.iface.getWidget(); var timegrid = target.iface.getWidget() || false; if(event === timegrid || !event || !timegrid || - !event.options || !event.options.value.participants || !timegrid.options.owner ) return false; + !event.options || !event.options.value.participants || !timegrid.options.owner + ) + { + return false; + } var owner_match = false; + var own_timegrid = event.getParent().getParent() === timegrid && !timegrid.daily_owner; + for(var id in event.options.value.participants) { if(!timegrid.daily_owner) @@ -1111,11 +1117,15 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view. if(col.div.has(timegrid.gridHover).length || col.header.has(timegrid.gridHover).length) { owner_match = owner_match || col.options.owner.indexOf(id) !== -1; + own_timegrid = (col === event.getParent()); } }, this, et2_calendar_daycol); } } - var enabled = !owner_match; + var enabled = !owner_match && + // Not inside its own timegrid + !own_timegrid; + widget_object.getActionLink('invite').enabled = enabled; widget_object.getActionLink('change_participant').enabled = enabled; diff --git a/calendar/js/et2_widget_view.js b/calendar/js/et2_widget_view.js index f1dd8aa92e..8a4ecdcbd6 100644 --- a/calendar/js/et2_widget_view.js +++ b/calendar/js/et2_widget_view.js @@ -414,7 +414,10 @@ var et2_calendar_view = (function(){ "use strict"; return et2_valueWidget.extend // Clear some stuff, if last time did not complete if(this.drag_create.event) { - this.drag_create.event.destroy(); + if(this.drag_create.event.destroy) + { + this.drag_create.event.destroy(); + } this.drag_create.event = null; } // Wait a bit before adding an "event", it may be just a click @@ -467,7 +470,7 @@ var et2_calendar_view = (function(){ "use strict"; return et2_valueWidget.extend _drag_update_event: function() { if(!this.drag_create.event || !this.drag_create.start || !this.drag_create.end - || !this.drag_create.parent) + || !this.drag_create.parent || !this.drag_create.event._type) { return; } @@ -540,7 +543,10 @@ var et2_calendar_view = (function(){ "use strict"; return et2_valueWidget.extend this.drag_create.parent = null; if(this.drag_create.event) { - this.drag_create.event.destroy(); + if(this.drag_create.event.destroy) + { + this.drag_create.event.destroy(); + } this.drag_create.event = null; } },this),100); @@ -553,7 +559,10 @@ var et2_calendar_view = (function(){ "use strict"; return et2_valueWidget.extend this.drag_create.parent = null; if(this.drag_create.event) { - this.drag_create.event.destroy(); + if(this.drag_create.event.destroy) + { + this.drag_create.event.destroy(); + } this.drag_create.event = null; } return true;