From 2d71cdf0f5500b203fc606cd7deeb4c904e45735 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 12 Mar 2018 17:04:17 +0100 Subject: [PATCH] Fix tracking of opened popups not working after framework reload --- api/js/framework/fw_base.js | 29 ----------------------------- api/js/jsapi/egw.js | 4 ++++ api/js/jsapi/egw_utils.js | 8 ++------ 3 files changed, 6 insertions(+), 35 deletions(-) diff --git a/api/js/framework/fw_base.js b/api/js/framework/fw_base.js index 807d6251de..269ae88181 100644 --- a/api/js/framework/fw_base.js +++ b/api/js/framework/fw_base.js @@ -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 * diff --git a/api/js/jsapi/egw.js b/api/js/jsapi/egw.js index 53e21f1dcc..99a6f3dd43 100644 --- a/api/js/jsapi/egw.js +++ b/api/js/jsapi/egw.js @@ -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); } diff --git a/api/js/jsapi/egw_utils.js b/api/js/jsapi/egw_utils.js index f83de851e7..55e6854148 100644 --- a/api/js/jsapi/egw_utils.js +++ b/api/js/jsapi/egw_utils.js @@ -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) {