forked from geosolutions-it/geonode-mapstore-client
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable the automatic opening of the export window from request parame…
…ters (#482) * action flow test * remove script for layer_export * automatic open layer export window * get perms by conf
- Loading branch information
1 parent
74be1d9
commit 535544d
Showing
2 changed files
with
359 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
geonode_mapstore_client/templates/geonode-mapstore-client/layer_export.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" %} |