From c79efb77092c7e8bbe8ba105c5fca3b03656026c Mon Sep 17 00:00:00 2001 From: Lenninlasd Date: Thu, 7 Dec 2017 14:15:37 -0500 Subject: [PATCH] fix geoserver relative path for enable styles --- .../static/externals/gxp/src/script/plugins/Styler.js | 2 +- worldmap/templates/worldmap_client/worldmap.html | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/geonode-client/app/static/externals/gxp/src/script/plugins/Styler.js b/src/geonode-client/app/static/externals/gxp/src/script/plugins/Styler.js index 893a300..474ac99 100644 --- a/src/geonode-client/app/static/externals/gxp/src/script/plugins/Styler.js +++ b/src/geonode-client/app/static/externals/gxp/src/script/plugins/Styler.js @@ -143,7 +143,7 @@ gxp.plugins.Styler = Ext.extend(gxp.plugins.Tool, { */ handleLayerChange: function(record) { this.launchAction.disable(); - if (record && record.get("styles")) { + if (record && (record.get("styles") || record.get("styles") === "") ) { var source = this.target.getSource(record); if (source instanceof gxp.plugins.WMSSource) { source.describeLayer(record, function(describeRec) { diff --git a/worldmap/templates/worldmap_client/worldmap.html b/worldmap/templates/worldmap_client/worldmap.html index f27517b..5999268 100644 --- a/worldmap/templates/worldmap_client/worldmap.html +++ b/worldmap/templates/worldmap_client/worldmap.html @@ -43,6 +43,14 @@ } }; + function parseLocalGeoserverUrl(geoserverUrl){ + var localurl = window.location.origin; + if( geoserverUrl.indexOf(localurl) === 0 ){ + return geoserverUrl.split(localurl)[1]; + } + return geoserverUrl; + } + var app; var init = function() { {% autoescape off %} @@ -152,7 +160,7 @@ rest: "{% url "maps_browse" %}", ajaxLoginUrl: "{% url "account_ajax_login" %}", homeUrl: "{% url "home" %}", - localGeoServerBaseUrl: "{{ GEOSERVER_BASE_URL }}", + localGeoServerBaseUrl: parseLocalGeoserverUrl("{{ GEOSERVER_BASE_URL }}"), localCSWBaseUrl: "{{ CATALOGUE_BASE_URL }}", hypermapRegistryUrl: "{{ HYPERMAP_REGISTRY_URL }}", mapProxyUrl: "{{ HYPERMAP_REGISTRY_URL }}",