From 01dfdd9b1d24ded3c9763b048961057813198d8d Mon Sep 17 00:00:00 2001 From: nathangray Date: Thu, 10 Jan 2019 14:58:40 -0700 Subject: [PATCH] Handle javascript as a link registry type target --- api/js/jsapi/egw_open.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/api/js/jsapi/egw_open.js b/api/js/jsapi/egw_open.js index bdabf6b921..b6782d1b8a 100644 --- a/api/js/jsapi/egw_open.js +++ b/api/js/jsapi/egw_open.js @@ -180,8 +180,17 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) return; } url = '/index.php'; - // Copy, not get a reference, or we'll change the registry - params = jQuery.extend({},app_registry[type]); + if(typeof app_registry[type] === 'object') + { + // Copy, not get a reference, or we'll change the registry + params = jQuery.extend({},app_registry[type]); + } + else if (typeof app_registry[type] === 'string' && app_registry[type].indexOf('javascript:') === 0) + { + // JavaScript, just pass it on + url = app_registry[type]; + params = {}; + } if (type == 'view' || type == 'edit') // add id parameter for type view or edit { params[app_registry[type+'_id']] = id; @@ -203,7 +212,16 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) } popup = app_registry[type+'_popup']; } - return this.open_link(this.link(url, params), target, popup, target_app, _check_popup_blocker); + if(url.indexOf('javascript:') === 0) + { + // Add parameters into javascript + url = 'javascript:var params = '+ JSON.stringify(params) + '; '+ url.substr(11); + } + else + { + url = this.link(url, params); + } + return this.open_link(url, target, popup, target_app, _check_popup_blocker); }, /**