diff --git a/collections/tools/mapcoordaid.php b/collections/tools/mapcoordaid.php index 3c3ebe1ce3..91481fb51e 100644 --- a/collections/tools/mapcoordaid.php +++ b/collections/tools/mapcoordaid.php @@ -14,11 +14,10 @@ $wktInputId = array_key_exists("wkt_input_id", $_REQUEST)? htmlspecialchars($_REQUEST["wkt_input_id"]):"footprintwkt"; $outputType= array_key_exists("geoJson", $_REQUEST)?"geoJson":"wkt"; -$clManager = new ChecklistAdmin(); -$clManager->setClid($clid); - if($formSubmit){ if($formSubmit == 'save'){ + $clManager = new ChecklistAdmin(); + $clManager->setClid($clid); $clManager->savePolygon($_POST['footprintwkt']); $formSubmit = "exit"; } @@ -66,7 +65,7 @@

Taxon Map

- @@ -112,6 +111,12 @@ const wktInputId = ""; const polyOutputType = ""; + function saveCoordAid() { + const leaflet_save = document.querySelector(".leaflet-draw-actions li a[title='Save changes']"); + if(leaflet_save) leaflet_save.click(); + self.close(); + } + const setField = (id, v) => { var elem = opener.document.getElementById(id); if(elem) { @@ -223,6 +228,7 @@ function loadShape(mapMode) { case "polygon": if(polyOutputType === "geoJson") { const geoJsonStr = getField(wktInputId); + if(!geoJsonStr) break; try { const geoJson = JSON.parse(geoJsonStr); return { @@ -306,6 +312,8 @@ function leafletInit() { drawColor: {opacity: 0.85, fillOpacity: 0.55, color: '#000' } }, setShapeToSearchForm); + map.mapLayer.on("draw:edited", saveCoordAid); + if(formShape) { map.drawShape(formShape); } diff --git a/content/lang/geothesaurus/index.fr.php b/content/lang/geothesaurus/index.fr.php index 8230128634..b950644214 100644 --- a/content/lang/geothesaurus/index.fr.php +++ b/content/lang/geothesaurus/index.fr.php @@ -55,4 +55,4 @@ $LANG['SEARCH_GEOTHESAURUS'] = 'Rechercher un thésaurus géographique'; $LANG['ADD_TERM_LIST'] = 'Ajouter un terme à la liste'; -?> \ No newline at end of file +?> diff --git a/geothesaurus/index.php b/geothesaurus/index.php index 8aa7456777..b70ae4cb23 100644 --- a/geothesaurus/index.php +++ b/geothesaurus/index.php @@ -114,15 +114,26 @@ function listGeoUnits($arr) {