From ecf001fe0641c024519abe8238496b86183bd708 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 8 Mar 2017 14:25:52 +0100 Subject: [PATCH] same story tutorial popup: ignore security exception if window.top is in a different security context eg. because SiteMgr contact-form is running in an iframe --- api/js/jsapi/egw.js | 57 ++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/api/js/jsapi/egw.js b/api/js/jsapi/egw.js index 9936e483fc..2648da4af8 100644 --- a/api/js/jsapi/egw.js +++ b/api/js/jsapi/egw.js @@ -319,35 +319,40 @@ { window.scrollTo(0, 1); } - // Open tutorial popup with an introduction video about egroupware - if (window.framework === window.top.framework && typeof et2_dialog != 'undefined' && - !egw.preference('egw_tutorial_noautoload', 'common') && - !parseInt(document.getElementById('egw_script_id').getAttribute('data-framework-reload')) && - (!egw.config('egw_tutorial_disable', 'phpgwapi') || egw.config('egw_tutorial_disable', 'phpgwapi') == 'sidebox')) - { - // we need to wait until common translations are loaded - egw.langRequireApp(window, 'common', function() + try { + // Open tutorial popup with an introduction video about egroupware + if (window.framework === window.top.framework && typeof et2_dialog != 'undefined' && + !egw.preference('egw_tutorial_noautoload', 'common') && + !parseInt(document.getElementById('egw_script_id').getAttribute('data-framework-reload')) && + (!egw.config('egw_tutorial_disable', 'phpgwapi') || egw.config('egw_tutorial_disable', 'phpgwapi') == 'sidebox')) { - var buttons = [ - {text:egw.lang("Show now"), id:"show", image: "check", default:"true"}, - {text:egw.lang("Show next login"), id:"later", image: "right"}, - {text:egw.lang("No thanks"), id:"never", image: "cancel"} - ]; - et2_dialog.show_dialog(function (_button_id) + // we need to wait until common translations are loaded + egw.langRequireApp(window, 'common', function() { - if (_button_id == "show" ) + var buttons = [ + {text:egw.lang("Show now"), id:"show", image: "check", default:"true"}, + {text:egw.lang("Show next login"), id:"later", image: "right"}, + {text:egw.lang("No thanks"), id:"never", image: "cancel"} + ]; + et2_dialog.show_dialog(function (_button_id) { - egw.open_link(egw.link('/index.php', 'menuaction=api.EGroupware\\Api\\Framework\\Tutorial.popup&tuid=introduction-'+egw.preference('lang')+'-0-a'),'_blank','960x580'); - } - if(_button_id != "later") - { - egw.set_preference('common', 'egw_tutorial_noautoload',true); - } - }, - egw.lang('We would like to introduce you to EGroupware by showing a short introduction video.'), - egw.lang('Introduction'), - {}, buttons, et2_dialog.QUESTION_MESSAGE, undefined, egw(window)); - }, this); + if (_button_id == "show" ) + { + egw.open_link(egw.link('/index.php', 'menuaction=api.EGroupware\\Api\\Framework\\Tutorial.popup&tuid=introduction-'+egw.preference('lang')+'-0-a'),'_blank','960x580'); + } + if(_button_id != "later") + { + egw.set_preference('common', 'egw_tutorial_noautoload',true); + } + }, + egw.lang('We would like to introduce you to EGroupware by showing a short introduction video.'), + egw.lang('Introduction'), + {}, buttons, et2_dialog.QUESTION_MESSAGE, undefined, egw(window)); + }, this); + } + } + catch(e) { + // ignore SecurityError exception if top is different security context / cross-origin } }); });