diff --git a/o2web/source/o2_core/o2.js b/o2web/source/o2_core/o2.js index 52c6351ed9ce94dfe57fe6de3b732b0ae5e8fba3..4fda5e2b539dc754f4b84dfb7e27c4bf78513b5c 100644 --- a/o2web/source/o2_core/o2.js +++ b/o2web/source/o2_core/o2.js @@ -1555,7 +1555,8 @@ if (window.Promise && !Promise.any){ address: o2.filterUrl(address), body: data, debug: (window.layout && layout["debugger"]), - token: (window.layout && layout.session && layout.session.user) ? layout.session.user.token : "" + token: (window.layout && layout.session && layout.session.user) ? layout.session.user.token : "", + tokenName: o2.tokenName } var actionWorker = new Worker("../o2_core/o2/actionWorker.js"); var p = new Promise(function(s,f){ diff --git a/o2web/source/o2_core/o2/actionWorker.js b/o2web/source/o2_core/o2/actionWorker.js index 52b0bbbaebf67747f33a6bb82cd2d02bb41fd1b3..1477928fc8d95f50b997cada6be41fbb1ec59f1c 100644 --- a/o2web/source/o2_core/o2/actionWorker.js +++ b/o2web/source/o2_core/o2/actionWorker.js @@ -34,6 +34,7 @@ function V(httpRequest) { var body = data.body; var debug = data.debug; var token = data.token; + var tokenName = data.tokenName; if (noCache) url = url+(((url.indexOf("?")!==-1) ? "&" : "?")+(new Date()).getTime()); @@ -44,8 +45,8 @@ function V(httpRequest) { this.request.setRequestHeader("Accept", "text/html,application/json,*/*"); if (debug) this.request.setRequestHeader("x-debugger", "true"); if (token){ - this.request.setRequestHeader(o2.tokenName, token); - this.request.setRequestHeader("authorization", token); + this.request.setRequestHeader(tokenName, token); + this.request.setRequestHeader("Authorization", token); } this.request.send(body); diff --git a/o2web/source/o2_core/o2/widget/JavascriptEditor.js b/o2web/source/o2_core/o2/widget/JavascriptEditor.js index e7a58be101689154da034cdb23dbf8c832d55c19..c3311ed654f0c6a0861b81a2da43cbb4a8585369 100644 --- a/o2web/source/o2_core/o2/widget/JavascriptEditor.js +++ b/o2web/source/o2_core/o2/widget/JavascriptEditor.js @@ -21,6 +21,7 @@ o2.widget.JavascriptEditor = new Class({ this.unbindEvents = []; this.node = $(node); this.id = o2.uuid(); + if (!o2.JSEditorCWE.isInit) o2.JSEditorCWE.init(); }, getDefaultEditorData: function(){ switch (this.options.type) { @@ -850,6 +851,7 @@ o2.widget.JavascriptEditor.completionWorkerEnvironment = o2.JSEditorCWE = { this.scriptWorker.onmessage = function(e) { if (e.data && e.data.type=="ready") this.setOnMessage(); }.bind(this); + this.isInit = true; return this; }, setOnMessage: function(){ @@ -872,4 +874,4 @@ o2.widget.JavascriptEditor.completionWorkerEnvironment = o2.JSEditorCWE = { this.scriptWorker.postMessage(o); } } -}.init(); +}; diff --git a/o2web/source/o2_core/scriptWorker.js b/o2web/source/o2_core/scriptWorker.js index 366408979f29ac2ee18709df6ba29a89c8311970..45e1790d021071604412bb8f3b8ce85d4c14f2c6 100644 --- a/o2web/source/o2_core/scriptWorker.js +++ b/o2web/source/o2_core/scriptWorker.js @@ -157,6 +157,7 @@ o2.addReady(function () { o2.getJSON("../x_desktop/res/config/config.json", function (config) { layout.config = config; + o2.tokenName = config.tokenName || "x-token"; configLoaded = true; if (configLoaded && commonLoaded && lpLoaded) _getDistribute(function () { _load(); }); }); diff --git a/o2web/source/x_component_process_ProcessDesigner/$Process/route.html b/o2web/source/x_component_process_ProcessDesigner/$Process/route.html index 1e52cdb1c3bd23069c9b09ac0a25bab6d0656cd6..d7dbb1f652d3895da5b210f31100d994563e866d 100644 --- a/o2web/source/x_component_process_ProcessDesigner/$Process/route.html +++ b/o2web/source/x_component_process_ProcessDesigner/$Process/route.html @@ -36,8 +36,8 @@