diff --git a/module/javascript/vitis/script_module.js b/module/javascript/vitis/script_module.js index f14e1f323236a857733612f3f3c22a24fa55164c..00d7bea38f0f130a3f1f55460702749cb216fc1f 100644 --- a/module/javascript/vitis/script_module.js +++ b/module/javascript/vitis/script_module.js @@ -915,7 +915,9 @@ vitisApp.on('appMainDrtvLoaded', function () { } this['getCapabilities'](serviceUrl, { - 'version': serviceVersion + 'version': serviceVersion, + 'service_login': envSrvc["oFormValues"][envSrvc['sFormDefinitionName']]['service_login'], + 'service_password': envSrvc["oFormValues"][envSrvc['sFormDefinitionName']]['service_password'] }).then(function (oResult) { if (goog.isDefAndNotNull(oResult)) { if (goog.isDefAndNotNull(oResult['json'])) { @@ -1098,6 +1100,12 @@ vitisApp.on('appMainDrtvLoaded', function () { if (goog.isDefAndNotNull(scope['oServices'][sServiceId]['service_type_version'])) { envSrvc["oFormValues"][envSrvc['sFormDefinitionName']]["service_type_version"] = scope['oServices'][sServiceId]['service_type_version']; } + if (goog.isDefAndNotNull(scope['oServices'][sServiceId]['service_login'])) { + envSrvc["oFormValues"][envSrvc['sFormDefinitionName']]["service_login"] = scope['oServices'][sServiceId]['service_login']; + } + if (goog.isDefAndNotNull(scope['oServices'][sServiceId]['service_password'])) { + envSrvc["oFormValues"][envSrvc['sFormDefinitionName']]["service_password"] = scope['oServices'][sServiceId]['service_password']; + } } } else { sServiceType = envSrvc['oFormValues'][envSrvc['sFormDefinitionName']]['service_type_id']; @@ -2497,11 +2505,15 @@ vitisApp.on('appMainDrtvLoaded', function () { $translate(["BTN_ADD_LAYERS_VMAP_MAP_LAYER"]).then(function (oTranslations) { var sServiceUrl = envSrvc["oFormValues"][sParentFormDefinitionName]["service_url"]; + var sServiceLogin = envSrvc["oFormValues"][sParentFormDefinitionName]["service_login"]; + var sServicePassword = envSrvc["oFormValues"][sParentFormDefinitionName]["service_password"]; var sVersion = envSrvc["oFormValues"][sParentFormDefinitionName]["service_type_version"]; sServiceUrl = sServiceUrl.replace("[token]", sha256(sessionSrvc["token"])); sServiceUrl = sServiceUrl.replace("[ms_cgi_url]", propertiesSrvc["ms_cgi_url"]); this_['showLayerModalWindow']({ 'service_url': sServiceUrl, + 'service_login': sServiceLogin, + 'service_password': sServicePassword, 'service_version': sVersion, 'buttons': [{ "label": oTranslations["BTN_ADD_LAYERS_VMAP_MAP_LAYER"], @@ -2874,7 +2886,9 @@ vitisApp.on('appMainDrtvLoaded', function () { } else if (goog.isDefAndNotNull(sServiceUrl)) { // Calques du service wms. scope.$root['getCapabilities'](sServiceUrl, { - 'version': opt_options['service_version'] + 'version': opt_options['service_version'], + 'service_login': opt_options['service_login'], + 'service_password': opt_options['service_password'] }).then(function (oGetCapabilities) { oCapabilities = oGetCapabilities; if (goog.isDefAndNotNull(oCapabilities)) { @@ -2906,6 +2920,9 @@ vitisApp.on('appMainDrtvLoaded', function () { "showErrorMessage": true, "version": "1.3.0" }; + var oHeaders = { + "charset": "charset=utf-8" + }; if (typeof (oOptions) == "undefined") oOptions = oDefaultOptions; else { @@ -2918,6 +2935,11 @@ vitisApp.on('appMainDrtvLoaded', function () { if (!goog.isDefAndNotNull(oOptions['showErrorMessage'])) { oOptions['showErrorMessage'] = true; } + if (goog.isDefAndNotNull(oOptions['service_login']) && goog.isDefAndNotNull(oOptions['service_password'])) { + if (oOptions['service_login'].length > 0 && oOptions['service_password'].length > 0) { + oHeaders['Authorization'] = "Basic " + btoa(oOptions['service_login'] + ":" + oOptions['service_password']); + } + } // Création de l'url vers le service. if (sServiceUrl.indexOf("?") === -1) sServiceUrl += "?"; @@ -2941,6 +2963,7 @@ vitisApp.on('appMainDrtvLoaded', function () { "method": "GET", "url": propertiesSrvc['proxy_url'], "params": {"url": sServiceUrl}, + 'headers': oHeaders, "scope": scope, "responseType": "text", "success": function (response) {