Some bugfixes:

- For some start / end date combinations, end date was incorrectly processed
- Check readonly flag to avoid errors from drag & drop, click to create and drag to create
This commit is contained in:
nathangray 2016-10-14 13:34:58 -06:00
parent 9dd7076e9d
commit fe4d00551a
4 changed files with 16 additions and 3 deletions

View File

@ -1063,6 +1063,8 @@ var et2_calendar_daycol = (function(){ "use strict"; return et2_valueWidget.exte
*/ */
click: function(_ev) click: function(_ev)
{ {
if(this._parent.options.readonly ) return;
// Drag to create in progress // Drag to create in progress
if(this._parent.drag_create.start !== null) return; if(this._parent.drag_create.start !== null) return;

View File

@ -958,7 +958,7 @@ et2_calendar_event.owner_check = function owner_check(event, parent, owner_too)
{ {
options = parent.getArrayMgr("sel_options").getRoot().getEntry('owner'); options = parent.getArrayMgr("sel_options").getRoot().getEntry('owner');
} }
if(event.participants && parent.options.owner) if(event.participants && parent.options.owner.length > 0)
{ {
var parent_owner = jQuery.extend([], typeof parent.options.owner !== 'object' ? var parent_owner = jQuery.extend([], typeof parent.options.owner !== 'object' ?
[parent.options.owner] : [parent.options.owner] :

View File

@ -132,7 +132,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
destroy: function() { destroy: function() {
// Stop listening to tab changes // Stop listening to tab changes
if(framework.getApplicationByName('calendar').tab) if(typeof framework !== 'undefined' && framework.getApplicationByName('calendar').tab)
{ {
jQuery(framework.getApplicationByName('calendar').tab.contentDiv).off('show.' + this.id); jQuery(framework.getApplicationByName('calendar').tab.contentDiv).off('show.' + this.id);
} }
@ -164,7 +164,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
this._super.apply(this, arguments); this._super.apply(this, arguments);
// Listen to tab show to make sure we scroll to the day start, not top // Listen to tab show to make sure we scroll to the day start, not top
if(framework.getApplicationByName('calendar').tab) if(typeof framework !== 'undefined' && framework.getApplicationByName('calendar').tab)
{ {
jQuery(framework.getApplicationByName('calendar').tab.contentDiv) jQuery(framework.getApplicationByName('calendar').tab.contentDiv)
.on('show.' + this.id, jQuery.proxy( .on('show.' + this.id, jQuery.proxy(
@ -1275,6 +1275,9 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
* @param {type} actionLinks * @param {type} actionLinks
*/ */
_init_links_dnd: function(mgr,actionLinks) { _init_links_dnd: function(mgr,actionLinks) {
if (this.options.readonly) return;
var self = this; var self = this;
var drop_link = mgr.getActionById('egw_link_drop'); var drop_link = mgr.getActionById('egw_link_drop');
@ -1787,6 +1790,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
click: function(_ev) click: function(_ev)
{ {
var result = true; var result = true;
if(this.options.readonly ) return;
// Drag to create in progress // Drag to create in progress
if(this.drag_create.start !== null) return; if(this.drag_create.start !== null) return;
@ -1877,6 +1881,8 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
_mouse_down: function(event) _mouse_down: function(event)
{ {
if(event.which !== 1) return; if(event.which !== 1) return;
if (this.options.readonly) return;
var start = jQuery.extend({},this.gridHover[0].dataset); var start = jQuery.extend({},this.gridHover[0].dataset);
if(start.date) if(start.date)
@ -1953,6 +1959,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
*/ */
_mouse_up: function(event) _mouse_up: function(event)
{ {
if (this.options.readonly) return;
var end = jQuery.extend({}, this.gridHover[0].dataset); var end = jQuery.extend({}, this.gridHover[0].dataset);
if(end.date) if(end.date)
{ {

View File

@ -151,6 +151,8 @@ var et2_calendar_view = (function(){ "use strict"; return et2_valueWidget.extend
else if(typeof new_date === "string") else if(typeof new_date === "string")
{ {
this.date_helper.set_year(new_date.substring(0,4)); this.date_helper.set_year(new_date.substring(0,4));
// Avoid overflow into next month, since we re-use date_helper
this.date_helper.set_date(1);
this.date_helper.set_month(new_date.substring(4,6)); this.date_helper.set_month(new_date.substring(4,6));
this.date_helper.set_date(new_date.substring(6,8)); this.date_helper.set_date(new_date.substring(6,8));
} }
@ -190,6 +192,8 @@ var et2_calendar_view = (function(){ "use strict"; return et2_valueWidget.extend
else if(typeof new_date === "string") else if(typeof new_date === "string")
{ {
this.date_helper.set_year(new_date.substring(0,4)); this.date_helper.set_year(new_date.substring(0,4));
// Avoid overflow into next month, since we re-use date_helper
this.date_helper.set_date(1);
this.date_helper.set_month(new_date.substring(4,6)); this.date_helper.set_month(new_date.substring(4,6));
this.date_helper.set_date(new_date.substring(6,8)); this.date_helper.set_date(new_date.substring(6,8));
} }