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
This commit is contained in:
Ralf Becker 2017-03-08 14:25:52 +01:00
parent 461b2e3e0a
commit ecf001fe06

View File

@ -319,35 +319,40 @@
{ {
window.scrollTo(0, 1); window.scrollTo(0, 1);
} }
// Open tutorial popup with an introduction video about egroupware try {
if (window.framework === window.top.framework && typeof et2_dialog != 'undefined' && // Open tutorial popup with an introduction video about egroupware
!egw.preference('egw_tutorial_noautoload', 'common') && if (window.framework === window.top.framework && typeof et2_dialog != 'undefined' &&
!parseInt(document.getElementById('egw_script_id').getAttribute('data-framework-reload')) && !egw.preference('egw_tutorial_noautoload', 'common') &&
(!egw.config('egw_tutorial_disable', 'phpgwapi') || egw.config('egw_tutorial_disable', 'phpgwapi') == 'sidebox')) !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()
{ {
var buttons = [ // we need to wait until common translations are loaded
{text:egw.lang("Show now"), id:"show", image: "check", default:"true"}, egw.langRequireApp(window, 'common', function()
{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)
{ {
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 == "show" )
} {
if(_button_id != "later") egw.open_link(egw.link('/index.php', 'menuaction=api.EGroupware\\Api\\Framework\\Tutorial.popup&tuid=introduction-'+egw.preference('lang')+'-0-a'),'_blank','960x580');
{ }
egw.set_preference('common', 'egw_tutorial_noautoload',true); 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)); egw.lang('We would like to introduce you to EGroupware by showing a short introduction video.'),
}, this); 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
} }
}); });
}); });