Skip to content

Commit

Permalink
- Allow templates to inherit all properties form "defaultConfig"
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Apr 2, 2020
1 parent 88f9927 commit 0c7f832
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,37 @@
translations: '',
useAuthenticationRules: true,
loadAfterTheme: true,
projectionDefs: [{
"code": "EPSG:3003",
"def": "+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl+towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68 +units=m +no_defs",
"extent": [1241482.0019, 973563.1609, 1830078.9331, 5215189.0853],
"worldExtent": [6.6500, 8.8000, 12.0000, 47.0500]
}, {
"code": "EPSG:3785",
"def": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs",
"extent": [-20026376.39, -19971868.88, 20026376.39, 19971868.88],
"worldExtent": [-180.0, -90.0, 180.0, 90.0]
}, {
"code": "EPSG:3857",
"def": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs",
"extent": [-20026376.39, -20048966.10, 20026376.39, 20048966.10],
"worldExtent": [-180.0, -85.06, 180.0, 85.06]
}, {
"code": "EPSG:32632",
"def": "+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs",
"extent": [166021.44, 0.00, 534994.66, 9329005.18],
"worldExtent": [6.0, 0.0, 12.0, 84.0]
}, {
"code": "EPSG:32647",
"def": "+proj=utm +zone=47 +datum=WGS84 +units=m +no_defs",
"extent": [166021.44, 0.00, 534994.66, 9329005.18],
"worldExtent": [96.0, 0.0, 102.0, 84.0]
}, {
"code": "EPSG:32736",
"def": "+proj=utm +zone=36 +south +datum=WGS84 +units=m +no_defs",
"extent": [441867.78, 1116915.04, 833978.56, 10000000.00],
"worldExtent": [30.0, -80.0, 36.0, 0.0]
}],
authenticationRules: [{
"urlPattern": ".*geostore.*",
"method": "bearer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
}
MS2_PLUGINS.desktop.push(stylerCfg);
MS2_PLUGINS["mobile"] = MS2_PLUGINS.desktop;
let localConfig = defaultConfig.localConfig;
MapStore2.create('ms-container', {
config: ms2_config,
mapId: ms2_config.map && ms2_config.map.info && ms2_config.map.info.id,
Expand Down Expand Up @@ -78,15 +79,7 @@
},
proxy: defaultConfig.proxy,
printingEnabled: defaultConfig.printingEnabled,
localConfig: {
geonode_url: defaultConfig.localConfig.geonode_url,
genode_rest_api: defaultConfig.localConfig.genode_rest_api,
loadAfterTheme: defaultConfig.localConfig.loadAfterTheme,
printUrl: defaultConfig.localConfig.printUrl,
translations: defaultConfig.localConfig.translations,
useAuthenticationRules: defaultConfig.localConfig.useAuthenticationRules,
authenticationRules: defaultConfig.localConfig.authenticationRules
},
localConfig: localConfig,
plugins: MS2_PLUGINS
});
if (user && user.id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
MS2_PLUGINS = window.squashMS2PlugCfg(MS2_BASE_PLUGINS, MS2_MAP_PLUGINS, MS2_EDIT_PLUGINS);
MS2_PLUGINS = window.excludeMS2Plugins(MS2_PLUGINS, ["Save", "SaveAs","WidgetsBuilder","Widgets"]);
MS2_PLUGINS["mobile"] = MS2_PLUGINS.desktop;
let localConfig = defaultConfig.localConfig;
initMapstore2Api('edit', function(MapStore2, options) {
if (options && options.setLocale) {
options.setLocale('{{ LANGUAGE_CODE }}');
Expand Down Expand Up @@ -67,15 +68,7 @@
},
proxy: defaultConfig.proxy,
printingEnabled: defaultConfig.printingEnabled,
localConfig: {
geonode_url: defaultConfig.localConfig.geonode_url,
genode_rest_api: defaultConfig.localConfig.genode_rest_api,
loadAfterTheme: defaultConfig.localConfig.loadAfterTheme,
printUrl: defaultConfig.localConfig.printUrl,
translations: defaultConfig.localConfig.translations,
useAuthenticationRules: defaultConfig.localConfig.useAuthenticationRules,
authenticationRules: defaultConfig.localConfig.authenticationRules
},
localConfig: localConfig,
plugins: MS2_PLUGINS
});
if (ms2_config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
$('#embedded_map').html('<div class="_ms2_init_spinner _ms2_init_center"><div></div> <div class="_ms2_init_text _ms2_init_center">Loading MapStore</div>');
MS2_PLUGINS = MS2_BASE_PLUGINS;
MS2_PLUGINS["mobile"] = MS2_PLUGINS.desktop;
let localConfig = defaultConfig.localConfig;
initMapstore2Api('preview', function(MapStore2, options) {
if (options && options.setLocale) {
options.setLocale('{{ LANGUAGE_CODE }}');
Expand Down Expand Up @@ -56,15 +57,7 @@
},
proxy: defaultConfig.proxy,
printingEnabled: defaultConfig.printingEnabled,
localConfig: {
mapLayout: defaultConfig.localConfig.mapLayout,
geonode_url: defaultConfig.localConfig.geonode_url,
translations: defaultConfig.localConfig.translations,
loadAfterTheme: defaultConfig.localConfig.loadAfterTheme,
printUrl: defaultConfig.localConfig.printUrl,
useAuthenticationRules: defaultConfig.localConfig.useAuthenticationRules,
authenticationRules: defaultConfig.localConfig.authenticationRules
},
localConfig: localConfig,
plugins: MS2_PLUGINS
});
if (ms2_config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
MS2_PLUGINS.desktop.push(stylerCfg);
MS2_PLUGINS = window.excludeMS2Plugins(MS2_PLUGINS, ["Save", "SaveAs", "Widgets", "WidgetsBuilder"]);
MS2_PLUGINS["mobile"] = MS2_PLUGINS.desktop;
let localConfig = defaultConfig.localConfig;
initMapstore2Api('edit', function(MapStore2, options) {
if (options && options.setLocale) {
options.setLocale('{{ LANGUAGE_CODE }}');
Expand Down Expand Up @@ -80,15 +81,7 @@
},
proxy: defaultConfig.proxy,
printingEnabled: defaultConfig.printingEnabled,
localConfig: {
geonode_url: defaultConfig.localConfig.geonode_url,
genode_rest_api: defaultConfig.localConfig.genode_rest_api,
loadAfterTheme: defaultConfig.localConfig.loadAfterTheme,
printUrl: defaultConfig.localConfig.printUrl,
translations: defaultConfig.localConfig.translations,
useAuthenticationRules: defaultConfig.localConfig.useAuthenticationRules,
authenticationRules: defaultConfig.localConfig.authenticationRules
},
localConfig: localConfig,
plugins: MS2_PLUGINS
});
if (ms2_config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
MS2_PLUGINS.desktop.push(stylerCfg);
MS2_PLUGINS = window.excludeMS2Plugins(MS2_PLUGINS, ["Save", "SaveAs", "Widgets", "WidgetsBuilder"]);
MS2_PLUGINS["mobile"] = MS2_PLUGINS.desktop;
let localConfig = defaultConfig.localConfig;
initMapstore2Api('edit', function(MapStore2, options) {
if (options && options.setLocale) {
options.setLocale('{{ LANGUAGE_CODE }}');
Expand Down Expand Up @@ -80,15 +81,7 @@
},
proxy: defaultConfig.proxy,
printingEnabled: defaultConfig.printingEnabled,
localConfig: {
geonode_url: defaultConfig.localConfig.geonode_url,
genode_rest_api: defaultConfig.localConfig.genode_rest_api,
loadAfterTheme: defaultConfig.localConfig.loadAfterTheme,
printUrl: defaultConfig.localConfig.printUrl,
translations: defaultConfig.localConfig.translations,
useAuthenticationRules: defaultConfig.localConfig.useAuthenticationRules,
authenticationRules: defaultConfig.localConfig.authenticationRules
},
localConfig: localConfig,
plugins: MS2_PLUGINS
});
if (ms2_config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
}
MS2_PLUGINS = window.squashMS2PlugCfg(MS2_BASE_PLUGINS, MS2_EMBED_PLUGINS);
MS2_PLUGINS["mobile"] = MS2_PLUGINS.desktop;
let localConfig = defaultConfig.localConfig;
initMapstore2Api('edit', function(MapStore2, options) {
if (options && options.setLocale) {
options.setLocale('{{ LANGUAGE_CODE }}');
Expand Down Expand Up @@ -56,15 +57,7 @@
},
proxy: defaultConfig.proxy,
printingEnabled: defaultConfig.printingEnabled,
localConfig: {
geonode_url: defaultConfig.localConfig.geonode_url,
genode_rest_api: defaultConfig.localConfig.genode_rest_api,
loadAfterTheme: defaultConfig.localConfig.loadAfterTheme,
printUrl: defaultConfig.localConfig.printUrl,
translations: defaultConfig.localConfig.translations,
useAuthenticationRules: defaultConfig.localConfig.useAuthenticationRules,
authenticationRules: defaultConfig.localConfig.authenticationRules
},
localConfig: localConfig,
plugins: MS2_PLUGINS
});
if (user && user.id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
}
MS2_PLUGINS = window.squashMS2PlugCfg(MS2_BASE_PLUGINS, MS2_MAP_PLUGINS);
MS2_PLUGINS["mobile"] = MS2_PLUGINS.desktop;
let localConfig = defaultConfig.localConfig;
localConfig.disableCheckEditPermissions = true;
initMapstore2Api('edit', function(MapStore2) {
MapStore2.create('ms-container', {
config: ms2_config,
Expand Down Expand Up @@ -62,16 +64,7 @@
},
proxy: defaultConfig.proxy,
printingEnabled: defaultConfig.printingEnabled,
localConfig: {
disableCheckEditPermissions: true,
geonode_url: defaultConfig.localConfig.geonode_url,
genode_rest_api: defaultConfig.localConfig.genode_rest_api,
loadAfterTheme: defaultConfig.localConfig.loadAfterTheme,
printUrl: defaultConfig.localConfig.printUrl,
translations: defaultConfig.localConfig.translations,
useAuthenticationRules: defaultConfig.localConfig.useAuthenticationRules,
authenticationRules: defaultConfig.localConfig.authenticationRules
},
localConfig: localConfig,
plugins: MS2_PLUGINS
});
if (user && user.id) {
Expand Down

0 comments on commit 0c7f832

Please sign in to comment.