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 a81442373c
commit b799dda8c7
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)
{
if(this._parent.options.readonly ) return;
// Drag to create in progress
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');
}
if(event.participants && parent.options.owner)
if(event.participants && parent.options.owner.length > 0)
{
var parent_owner = jQuery.extend([], typeof parent.options.owner !== 'object' ?
[parent.options.owner] :

View File

@ -132,7 +132,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
destroy: function() {
// 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);
}
@ -164,7 +164,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
this._super.apply(this, arguments);
// 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)
.on('show.' + this.id, jQuery.proxy(
@ -1276,6 +1276,9 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
* @param {type} actionLinks
*/
_init_links_dnd: function(mgr,actionLinks) {
if (this.options.readonly) return;
var self = this;
var drop_link = mgr.getActionById('egw_link_drop');
@ -1788,6 +1791,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
click: function(_ev)
{
var result = true;
if(this.options.readonly ) return;
// Drag to create in progress
if(this.drag_create.start !== null) return;
@ -1875,6 +1879,8 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
_mouse_down: function(event)
{
if(event.which !== 1) return;
if (this.options.readonly) return;
var start = jQuery.extend({},this.gridHover[0].dataset);
if(start.date)
@ -1951,6 +1957,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
*/
_mouse_up: function(event)
{
if (this.options.readonly) return;
var end = jQuery.extend({}, this.gridHover[0].dataset);
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")
{
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_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")
{
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_date(new_date.substring(6,8));
}