Fix tracking of opened popups not working after framework reload

This commit is contained in:
Hadi Nategh 2018-03-12 17:04:17 +01:00
parent c2c1bdb6ad
commit 2d71cdf0f5
3 changed files with 6 additions and 35 deletions

View File

@ -137,7 +137,6 @@ var fw_base = (function(){ "use strict"; return Class.extend(
this.applications[this.appData.appName] = this.appData;
this.popups.concat(this.registerOpenedPopups(app.name));
}
// else display the default application
@ -808,34 +807,6 @@ var fw_base = (function(){ "use strict"; return Class.extend(
if (_returnID !== false) return windowID;
},
registerOpenedPopups: function (_app)
{
var w = Object.keys(egw.getOpenWindows(_app));
var popups = [];
var popup;
for (var i=0; i < w.length; i++)
{
try{
popup = window.open('', w[i], '100x100');
if (popup.location.href == "about:blank")
{
popup.close();
egw(window).windowClosed(_app, popup);
}
if (popup && egw.is_popup(popup)) popups.push(popup);
}catch(e)
{
if (popup)
{
popup.close();
egw.windowClosed(_app, popup);
}
continue;
}
}
return popups;
},
/**
* Check if given window is a "popup" alike, returning integer or undefined if not
*

View File

@ -224,6 +224,10 @@
{
// Timeout is 5 seconds, but it iks only applied(egw_utils) when something asks for the window list
window.setInterval(function() {
if (window.opener && window.opener.framework && typeof window.opener.framework.popup_idx(window) == 'undefined')
{
window.opener.framework.popups.push(window);
}
egw().storeWindow(this.egw_appName, this);
}, 2000);
}

View File

@ -270,12 +270,8 @@ egw.extend('utils', egw.MODULE_GLOBAL, function()
*/
storeWindow: function(appname, popup)
{
if (popup.opener) popup.opener.framework.popups_garbage_collector();
if (popup.opener && popup.opener.framework && egw.is_popup(popup)
&& typeof popup.opener.framework.popup_idx(popup) == 'undefined')
{
popup.opener.framework.popups.push(popup);
}
if (popup.opener && popup.opener.framework) popup.opener.framework.popups_garbage_collector();
// Don't store if it has no name
if(!popup.name || ['_blank'].indexOf(popup.name) >= 0)
{