From b8eacf533215eb397c62645d30240eb9cd0aa018 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 17 May 2021 16:27:51 +0200 Subject: [PATCH] Check popup blocker for when trying to open mail compose popup from filemamanger/Collabora --- api/js/jsapi/egw_global.d.ts | 3 ++- api/js/jsapi/egw_open.js | 7 ++++--- filemanager/js/app.js | 2 +- filemanager/js/app.ts | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/api/js/jsapi/egw_global.d.ts b/api/js/jsapi/egw_global.d.ts index f1f7a7848c..29a5bb2d00 100644 --- a/api/js/jsapi/egw_global.d.ts +++ b/api/js/jsapi/egw_global.d.ts @@ -1120,8 +1120,9 @@ declare interface IegwWndLocal extends IegwGlobal * @param {object} _content content to be passed to method * @param {string|object} _extra url or object of extra * @param {regexp} _regexp regular expression to get specific popup with matched url + * @param {boolean} _check_popup_blocker TRUE check if browser pop-up blocker is on/off, FALSE no check */ - openWithinWindow(_app : string, _method : string, _content : object, _extra? : string|object, _regexp? : RegExp) : void; + openWithinWindow(_app : string, _method : string, _content : object, _extra? : string|object, _regexp? : RegExp, _check_popup_blocker? : boolean) : void; /** * implemented in egw_ready.js diff --git a/api/js/jsapi/egw_open.js b/api/js/jsapi/egw_open.js index 0dd044f30a..31de272fca 100644 --- a/api/js/jsapi/egw_open.js +++ b/api/js/jsapi/egw_open.js @@ -514,8 +514,9 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) * @param {object} _content content to be passed to method * @param {string|object} _extra url or object of extra * @param {regex} _regexp regular expression to get specific popup with matched url + * @param {boolean} _check_popup_blocker TRUE check if browser pop-up blocker is on/off, FALSE no check */ - openWithinWindow: function (_app, _method, _content, _extra, _regexp) + openWithinWindow: function (_app, _method, _content, _extra, _regexp, _check_popup_blocker) { var popups = window.framework.popups_get(_app, _regexp); @@ -554,7 +555,7 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) // Firefox:~ 65k, Safari:80k, Chrome: 2MB, Apache: 4k, Nginx: 4k if (len > 2083) { - var popup = egw.open('','mail','add','','compose__','mail'); + var popup = egw.open('','mail','add','','compose__','mail', _check_popup_blocker); var $tmpForm = jQuery(document.createElement('form')); var $tmpSubmitInput = jQuery(document.createElement('input')).attr({type:"submit"}); for (var i in _extra) @@ -578,7 +579,7 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) } else { - egw.open('', _app, 'add', _extra, _app, _app); + egw.open('', _app, 'add', _extra, _app, _app, _check_popup_blocker); } }; for(var i = 0; i < popups.length; i++) diff --git a/filemanager/js/app.js b/filemanager/js/app.js index e3f1b94478..15d8f99664 100644 --- a/filemanager/js/app.js +++ b/filemanager/js/app.js @@ -229,7 +229,7 @@ var filemanagerAPP = /** @class */ (function (_super) { content.data.files["filemode"] = params['preset[filemode]']; // always open compose in html mode, as attachment links look a lot nicer in html params["mimeType"] = 'html'; - return egw.openWithinWindow("mail", "setCompose", content, params, /mail.mail_compose.compose/); + return egw.openWithinWindow("mail", "setCompose", content, params, /mail.mail_compose.compose/, true); }; /** * Mail files action: open compose with already attached files diff --git a/filemanager/js/app.ts b/filemanager/js/app.ts index 9410f07761..b52707f95e 100644 --- a/filemanager/js/app.ts +++ b/filemanager/js/app.ts @@ -259,7 +259,7 @@ export class filemanagerAPP extends EgwApp content.data.files["filemode"] = params['preset[filemode]']; // always open compose in html mode, as attachment links look a lot nicer in html params["mimeType"] = 'html'; - return egw.openWithinWindow("mail", "setCompose", content, params, /mail.mail_compose.compose/); + return egw.openWithinWindow("mail", "setCompose", content, params, /mail.mail_compose.compose/, true); } /**