Skip to content

Commit

Permalink
Enable the automatic opening of the export window from request parame…
Browse files Browse the repository at this point in the history
…ters (#482)

* action flow test

* remove script for layer_export

* automatic open layer export window

* get perms by conf
  • Loading branch information
luorlandini authored Aug 30, 2021
1 parent 74be1d9 commit 535544d
Show file tree
Hide file tree
Showing 2 changed files with 359 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1841,6 +1841,315 @@
}
}
],
"layer_export": [
{
"name": "Map",
"cfg": {
"tools": [
"measurement",
"draw",
"box"
],
"mapOptions": {
"openlayers": {
"attribution": {
"container": "#footer-attribution-container"
},
"interactions": {
"pinchRotate": false,
"altShiftDragRotate": false
}
}
}
}
},
{
"name": "BackgroundSelector"
},
{
"name": "Identify",
"cfg": {
"viewerOptions": {
"container": "{context.ReactSwipe}"
}
},
"override": {
"Toolbar": {
"position": 11,
"alwaysVisible": false
}
}
},
{
"name": "TOC",
"cfg": {
"activateMetedataTool": false
}
},
{
"name": "Settings",
"cfg": {
"wrap": true
}
},
{
"name": "Toolbar",
"id": "NavigationBar",
"cfg": {
"id": "navigationBar",
"layout": "horizontal"
}
},
{
"name": "MapLoading",
"override": {
"Toolbar": {
"alwaysVisible": true
}
}
},
{
"name": "DrawerMenu"
},
{
"name": "Cookie"
},
{
"name": "OmniBar"
},
{
"name": "Expander"
},
{
"name": "BurgerMenu"
},
{
"name": "MapFooter"
},
{
"name": "Measure"
},
{
"name": "Print",
"cfg": {
"useFixedScales": true,
"mapWidth": 256
}
},
{
"name": "ZoomAll",
"override": {
"Toolbar": {
"alwaysVisible": false
}
}
},
{
"name": "ZoomIn",
"override": {
"Toolbar": {
"alwaysVisible": true
}
}
},
{
"name": "ZoomOut",
"override": {
"Toolbar": {
"alwaysVisible": true
}
}
},
{
"name": "Timeline"
},
{
"name": "Playback"
},
{
"name": "LayerDownload",
"cfg": {
"disablePluginIf": "{!state('selectedLayerPermissions').includes('download_resourcebase')}"
}
},
{
"name": "AddLayer"
},
{
"name": "FilterLayer"
},
{
"name": "ScaleBox"
},
{
"name": "FeatureEditor"
},
{
"name": "QueryPanel",
"cfg": {
"activateQueryTool": true,
"spatialOperations": [
{
"id": "INTERSECTS",
"name": "queryform.spatialfilter.operations.intersects"
},
{
"id": "BBOX",
"name": "queryform.spatialfilter.operations.bbox"
},
{
"id": "CONTAINS",
"name": "queryform.spatialfilter.operations.contains"
},
{
"id": "WITHIN",
"name": "queryform.spatialfilter.operations.within"
}
],
"spatialMethodOptions": [
{
"id": "Viewport",
"name": "queryform.spatialfilter.methods.viewport"
},
{
"id": "BBOX",
"name": "queryform.spatialfilter.methods.box"
},
{
"id": "Circle",
"name": "queryform.spatialfilter.methods.circle"
},
{
"id": "Polygon",
"name": "queryform.spatialfilter.methods.poly"
}
]
}
},
{
"name": "MetadataExplorer",
"cfg": {
"wrap": true
}
},
{
"name": "MousePosition",
"cfg": {
"editCRS": true,
"showLabels": true,
"showToggle": true,
"filterAllowedCRS": [
"EPSG:4326",
"EPSG:3857"
],
"additionalCRS": {}
}
},
{
"name": "Search",
"cfg": {
"withToggle": [
"max-width: 768px",
"min-width: 768px"
]
}
},
{
"name": "GoFull",
"override": {
"Toolbar": {
"alwaysVisible": false
}
}
},
{
"name": "FullScreen",
"override": {
"Toolbar": {
"alwaysVisible": false
}
}
},
{
"name": "TOCItemsSettings",
"cfg": {
"hideTitleTranslations": true,
"showFeatureInfoTab": false
}
},
{
"name": "Widgets"
},
{
"name": "WidgetsTray"
},
{
"name": "SaveAs",
"cfg": {
"disablePermission": true
}
},
{
"name": "Notifications"
},
{
"name": "Share",
"cfg": {
"pathTemplate": "/maps/{id}/embed"
}
},
{
"name": "Swipe"
},
{
"name": "Locate"
},
{
"name": "WidgetsBuilder"
},
{
"name": "Save",
"cfg": {
"disablePermission": true
}
},
{
"name": "AddGroup"
},
{
"name": "StyleEditor",
"cfg": {
"styleService": {
"baseUrl": "{state('settings') && state('settings').geonodeUrl && state('settings').geonodeUrl + 'gs/' || '/gs/'}",
"formats": [
"css",
"sld"
],
"availableUrls": [
"{state('settings') && state('settings').geoserverUrl || '/geoserver/'}",
"{state('settings') && state('settings').geonodeUrl && state('settings').geonodeUrl + 'gs/' || '/gs/'}"
],
"fonts": [
"Arial",
"Courier New",
"Monospaced",
"SansSerif",
"Serif",
"Times New Roman"
]
},
"editingAllowedRoles": null,
"enableSetDefaultStyle": true
}
},
{
"name": "Annotations",
"cfg": {
"measurementAnnotationEdit": false,
"symbolsPath": "/static/mapstore/symbols/"
}
}
],
"geostory": [
{
"name": "OmniBar",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<script>
(function(window) {

function openDataserExportWindow(MapStoreAPI, config) {

const layers = config.resourceConfig && config.resourceConfig.map && config.resourceConfig.map.layers;
var layer = layers && layers[layers.length - 1];

function openModal(layer){

if(layer){

MapStoreAPI.triggerAction({
type: 'LAYERS:SELECT_NODE',
id: layer.node,
nodeType: layer.nodeType,
ctrlKey: false
});
MapStoreAPI.triggerAction({
type: 'GEONODE:SET_SELECTED_LAYER_PERMISSIONS',
permissions: layer.options.perms || []
});

MapStoreAPI.triggerAction({
type: 'SET_CONTROL_PROPERTY',
control: 'layerdownload',
property: 'available',
value: true
});
MapStoreAPI.triggerAction({
type: 'TOGGLE_CONTROL',
control: 'layerdownload'
});

}


}
MapStoreAPI.onAction('UPDATE_NODE', openModal);
}

window.onInitMapStoreAPI = function(MapStoreAPI, config) {
openDataserExportWindow(MapStoreAPI, config);
};


})(window);
</script>

{% include "./map_edit.html" with plugins_config_key="layer_export" %}

0 comments on commit 535544d

Please sign in to comment.