use correct window of includeJS and alert, also fixed in wrong order included first JS file

This commit is contained in:
Ralf Becker 2019-01-15 14:34:52 +01:00
parent e90808ac2b
commit 5531844c0d
2 changed files with 6 additions and 2 deletions

View File

@ -149,6 +149,9 @@ egw.extend('files', egw.MODULE_WND_LOCAL, function(_app, _wnd)
*/ */
includeJS: function(_jsFiles, _callback, _context, _prefix) includeJS: function(_jsFiles, _callback, _context, _prefix)
{ {
// use egw_LAB object of correct window, not always the main window
var egw_LAB = (this.window || window).egw_LAB;
// Also allow including a single javascript file // Also allow including a single javascript file
if (typeof _jsFiles === 'string') if (typeof _jsFiles === 'string')
{ {

View File

@ -84,7 +84,8 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
// Function which is currently used to display alerts -- may be replaced by // Function which is currently used to display alerts -- may be replaced by
// some API function. // some API function.
this.alertHandler = function(_message, _details) { this.alertHandler = function(_message, _details) {
alert(_message); // we need to use the alert function of the window of the request, not just the main window
(this.egw ? this.egw.window : window).alert(_message);
if (_details) if (_details)
{ {
@ -175,7 +176,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
} }
// Load files first // Load files first
var js_files = []; var js_files = [];
for (var i = data.response.length - 1; i > 0; --i) for (var i = data.response.length - 1; i >= 0; --i)
{ {
var res = data.response[i]; var res = data.response[i];
if(res.type == 'js' && typeof res.data == 'string') if(res.type == 'js' && typeof res.data == 'string')