diff --git a/sao/CHANGELOG b/sao/CHANGELOG index 53112828e3..beabd85b0c 100644 --- a/sao/CHANGELOG +++ b/sao/CHANGELOG @@ -1,3 +1,4 @@ +* Use relative path for server requests * Use cookie to store session * Move the logout entry and add a help entry to the notification menu * Add visual hint on widget of modified field diff --git a/sao/src/rpc.js b/sao/src/rpc.js index 5e3eb473c9..8b1b157984 100644 --- a/sao/src/rpc.js +++ b/sao/src/rpc.js @@ -178,7 +178,7 @@ 'params': params })), 'dataType': 'json', - 'url': '/' + (session.database || '') + '/', + 'url': (session.database || '.') + '/', 'type': 'post', 'complete': [function() { Sao.common.processing.hide(timeoutID); diff --git a/sao/src/sao.js b/sao/src/sao.js index 04642cd808..fd9566516c 100644 --- a/sao/src/sao.js +++ b/sao/src/sao.js @@ -451,11 +451,11 @@ var Sao = { Sao.set_url = function(path, name) { var session = Sao.Session.current_session; if (session) { - var url = '#' + session.database; + var url = session.database; if (path) { url += '/' + path; } - window.location = url; + window.location.hash = url; } Sao.set_title(name); }; diff --git a/sao/src/session.js b/sao/src/session.js index e966a0c0f0..143612e926 100644 --- a/sao/src/session.js +++ b/sao/src/session.js @@ -58,7 +58,7 @@ 'contentType': 'application/json', 'data': JSON.stringify({}), 'dataType': 'json', - 'url': `/${this.database}/session/logout`, + 'url': `${this.database}/session/logout`, 'type': 'post', }); this.unstore(); @@ -189,7 +189,7 @@ 'params': [] }), 'dataType': 'json', - 'url': '/', + 'url': '.', 'type': 'post', 'complete': [function() { Sao.common.processing.hide(timeoutID); @@ -295,7 +295,7 @@ dfd.resolve(session); dialog.modal.remove(); if (database_url() != database) { - window.location = '#' + database; + window.location.hash = database; } }, function() { disable_form(false); @@ -314,10 +314,11 @@ return; } disable_form(); - var host = window.location.protocol + '//' + window.location.host; - var next = new URL(host + '/'); + const base = ( + window.location.protocol + '//' + window.location.host + window.location.pathname); + var next = new URL(base); next.searchParams.append('login_service', evt.data); - var url = new URL(host + '/' + database + evt.data); + var url = new URL(base + database + evt.data); url.searchParams.append('next', next.href); var service_window = window.open(url.href, '_blank', 'popup=1'); const timer = window.setInterval(() => { @@ -330,7 +331,7 @@ dfd.resolve(session); dialog.modal.remove(); if (database_url() != database) { - window.location = '#' + database; + window.location.hash = database; } } else { disable_form(false); @@ -449,7 +450,7 @@ 'contentType': 'application/json', 'data': JSON.stringify(data), 'dataType': 'json', - 'url': `/${this.session.database}/session/login`, + 'url': `${this.session.database}/session/login`, 'type': 'post', 'complete': [function() { Sao.common.processing.hide(timeoutID); @@ -601,7 +602,7 @@ 'params': [] }), 'dataType': 'json', - 'url': '/', + 'url': '.', 'type': 'post', 'complete': [function() { Sao.common.processing.hide(timeoutID); @@ -623,7 +624,7 @@ 'params': [] }), 'dataType': 'json', - 'url': '/', + 'url': '.', 'type': 'post', 'complete': [function() { Sao.common.processing.hide(timeoutID); diff --git a/sao/src/view/form.js b/sao/src/view/form.js index 9d5ae604f4..cc136f6e86 100644 --- a/sao/src/view/form.js +++ b/sao/src/view/form.js @@ -5010,7 +5010,7 @@ function eval_pyson(value){ if (!record || (record.id < 0)) { uri = ''; } else { - uri = '/' + record.model.session.database + + uri = record.model.session.database + '/ir/html/' + record.model.name + '/' + record.id + '/' + this.field_name; uri += '?language=' + encodeURIComponent( diff --git a/sao/src/window.js b/sao/src/window.js index 7cb0a494dd..3de6dd0185 100644 --- a/sao/src/window.js +++ b/sao/src/window.js @@ -2429,7 +2429,7 @@ query_string = query_string.map(function(param) { return param.map(encodeURIComponent).join('='); }).join('&'); - this.button_url.attr('href', '/' + path.join('/') + '?' + query_string); + this.button_url.attr('href', path.join('/') + '?' + query_string); }, });