From a58c881af19af3cbe4e19e76444abbbb53e82360 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 22 Jul 2016 12:03:46 +0200 Subject: [PATCH] * Calendar: Fix opening a calendar entry sometimes doesn't work --- calendar/js/et2_widget_event.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/calendar/js/et2_widget_event.js b/calendar/js/et2_widget_event.js index 1780de83d6..5ab70902a4 100644 --- a/calendar/js/et2_widget_event.js +++ b/calendar/js/et2_widget_event.js @@ -948,7 +948,7 @@ et2_calendar_event.owner_check = function owner_check(event, parent, owner_too) continue; } } - + if (parseInt(parent_owner[i]) < 0) { // Add in groups, if we can get them (this is syncronous) @@ -1021,7 +1021,16 @@ et2_calendar_event.recur_prompt = function(event_data, callback, extra_data) { var edit_id = event_data.app_id; var edit_date = event_data.start; - var egw = this.egw ? (typeof this.egw == 'function' ? this.egw() : this.egw) : window.opener && typeof window.opener.egw != 'undefined' ? window.opener.egw('calendar'):window.egw('calendar'); + + // seems window.opener somehow in certian conditions could be from different origin + // we try to catch the exception and in this case retrive the egw object from current window. + try { + var egw = this.egw ? (typeof this.egw == 'function' ? this.egw() : this.egw) : window.opener && typeof window.opener.egw != 'undefined' ? window.opener.egw('calendar'):window.egw('calendar'); + } + catch(e){ + var egw = window.egw('calendar'); + } + var that = this; var extra_params = extra_data && typeof extra_data == 'object' ? extra_data : {}; @@ -1085,7 +1094,15 @@ et2_calendar_event.recur_prompt = function(event_data, callback, extra_data) */ et2_calendar_event.series_split_prompt = function(event_data, instance_date, callback) { - var egw = this.egw ? (typeof this.egw == 'function' ? this.egw() : this.egw) : window.opener && typeof window.opener.egw != 'undefined' ? window.opener.egw('calendar'):window.egw('calendar'); + // seems window.opener somehow in certian conditions could be from different origin + // we try to catch the exception and in this case retrive the egw object from current window. + try { + var egw = this.egw ? (typeof this.egw == 'function' ? this.egw() : this.egw) : window.opener && typeof window.opener.egw != 'undefined' ? window.opener.egw('calendar'):window.egw('calendar'); + } + catch(e){ + var egw = window.egw('calendar'); + } + var that = this; if(typeof instance_date == 'string')