From 9d991f5419a9ae2602c3c6d39e3b2c74d1f9216a Mon Sep 17 00:00:00 2001 From: "j.goderbauer" <j.goderbauer@adito.de> Date: Thu, 14 Jan 2021 15:54:18 +0100 Subject: [PATCH] [Projekt: Entwicklung - Neon][TicketNr.: 1071628][MapViewTemplate: Konfiguration wird nicht richtig ausgelesen] --- .../entityfields/open/onActionProcess.js | 4 +- .../Organisation_entity.aod | 68 +++++++++++++++++++ .../entityfields/map_config/valueProcess.js | 16 ++++- .../documentation.adoc | 6 +- .../mapviewcenterlat_param/documentation.adoc | 2 + .../mapviewcenterlat_param/valueProcess.js | 2 + .../mapviewcenterlon_param/documentation.adoc | 2 + .../mapviewcenterlon_param/valueProcess.js | 2 + 8 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 entity/Organisation_entity/entityfields/mapviewcenterlat_param/documentation.adoc create mode 100644 entity/Organisation_entity/entityfields/mapviewcenterlat_param/valueProcess.js create mode 100644 entity/Organisation_entity/entityfields/mapviewcenterlon_param/documentation.adoc create mode 100644 entity/Organisation_entity/entityfields/mapviewcenterlon_param/valueProcess.js diff --git a/entity/AroundLocation_entity/entityfields/open/onActionProcess.js b/entity/AroundLocation_entity/entityfields/open/onActionProcess.js index 7f56d76e8d..10fa1eeb00 100644 --- a/entity/AroundLocation_entity/entityfields/open/onActionProcess.js +++ b/entity/AroundLocation_entity/entityfields/open/onActionProcess.js @@ -34,6 +34,8 @@ var homeFeatureCollection = { }; var params = { - MapViewAdditionalFeatures_param: JSON.stringify(homeFeatureCollection) + MapViewAdditionalFeatures_param: JSON.stringify(homeFeatureCollection), + MapViewCenterLat_param: vars.get("$param.LocationLat_param"), + MapViewCenterLon_param: vars.get("$param.LocationLon_param") }; neon.openContext("Organisation", "OrganisationFilter_view", contactIds, neon.OPERATINGSTATE_SEARCH, params, null); \ No newline at end of file diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index b97cd74089..1e6ea3c4e7 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -148,6 +148,14 @@ <name>MapViewAdditionalFeatures_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>MapViewCenterLat_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>MapViewCenterLon_param</name> + <expose v="false" /> + </entityParameter> </children> <dependencies> <entityDependency> @@ -631,6 +639,14 @@ <name>MapViewAdditionalFeatures_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>MapViewCenterLat_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>MapViewCenterLon_param</name> + <expose v="false" /> + </entityParameter> </children> <dependencies> <entityDependency> @@ -700,6 +716,14 @@ <name>MapViewAdditionalFeatures_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>MapViewCenterLat_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>MapViewCenterLon_param</name> + <expose v="false" /> + </entityParameter> </children> <dependencies> <entityDependency> @@ -1067,6 +1091,14 @@ <name>MapViewAdditionalFeatures_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>MapViewCenterLat_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>MapViewCenterLon_param</name> + <expose v="false" /> + </entityParameter> </children> </entityProvider> <entityParameter> @@ -1290,6 +1322,14 @@ <name>MapViewAdditionalFeatures_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>MapViewCenterLat_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>MapViewCenterLon_param</name> + <expose v="false" /> + </entityParameter> </children> <dependencies> <entityDependency> @@ -1359,6 +1399,14 @@ <name>MapViewAdditionalFeatures_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>MapViewCenterLat_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>MapViewCenterLon_param</name> + <expose v="false" /> + </entityParameter> </children> </entityProvider> <entityConsumer> @@ -1407,6 +1455,14 @@ <name>MapViewAdditionalFeatures_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>MapViewCenterLon_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>MapViewCenterLat_param</name> + <expose v="false" /> + </entityParameter> </children> <dependencies> <entityDependency> @@ -1502,6 +1558,18 @@ <expose v="true" /> <documentation>%aditoprj%/entity/Organisation_entity/entityfields/mapviewadditionalfeatures_param/documentation.adoc</documentation> </entityParameter> + <entityParameter> + <name>MapViewCenterLat_param</name> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/mapviewcenterlat_param/valueProcess.js</valueProcess> + <expose v="true" /> + <documentation>%aditoprj%/entity/Organisation_entity/entityfields/mapviewcenterlat_param/documentation.adoc</documentation> + </entityParameter> + <entityParameter> + <name>MapViewCenterLon_param</name> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/mapviewcenterlon_param/valueProcess.js</valueProcess> + <expose v="true" /> + <documentation>%aditoprj%/entity/Organisation_entity/entityfields/mapviewcenterlon_param/documentation.adoc</documentation> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Organisation_entity/entityfields/map_config/valueProcess.js b/entity/Organisation_entity/entityfields/map_config/valueProcess.js index 6421bc7b36..786d88c24f 100644 --- a/entity/Organisation_entity/entityfields/map_config/valueProcess.js +++ b/entity/Organisation_entity/entityfields/map_config/valueProcess.js @@ -1,12 +1,14 @@ +import("system.vars"); import("system.util"); import("system.fileIO"); import("system.result"); var config = { startingCenterPosition : { - lat: 0, - lon: 0, - zoomLevel: 0, + lat: parseFloat(vars.get("$param.MapViewCenterLat_param")), + lon: parseFloat(vars.get("$param.MapViewCenterLon_param")), + zoomLevel: 5, + //but let's try to locate the users posistion for a better view autoLocate: true }, boundaries: { @@ -22,5 +24,13 @@ var config = { ] }; +//when opening the AroundLocation view we do want to have the source organisation as center, so let's not overwrite the starting center position by +//looking for the users current location +if (vars.get("$param.MapViewAdditionalFeatures_param")) +{ + config.startingCenterPosition.zoomLevel = 10;//max amount of km is 100, so let's zoom in + config.startingCenterPosition.autoLocate = false; +} + var res = JSON.stringify(config); result.string(res); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/mapviewadditionalfeatures_param/documentation.adoc b/entity/Organisation_entity/entityfields/mapviewadditionalfeatures_param/documentation.adoc index 3c5296d341..ec5cbf7e00 100644 --- a/entity/Organisation_entity/entityfields/mapviewadditionalfeatures_param/documentation.adoc +++ b/entity/Organisation_entity/entityfields/mapviewadditionalfeatures_param/documentation.adoc @@ -1 +1,5 @@ -You may provide a `GeoJSON` `FeatureCollection` that will be display in the `MapViewTemplate` of the `OrganisationFilter_view` here. \ No newline at end of file +You may provide a `GeoJSON` `FeatureCollection` that will be display in the `MapViewTemplate` of the `OrganisationFilter_view` here. +This is usefull for the "AroundLocation"-Search. + +If this param is passed the map view will not autolocate your position and center the view based on the parameters `MapViewCenterLat_param` and +`MapViewCenterLon_param` \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/mapviewcenterlat_param/documentation.adoc b/entity/Organisation_entity/entityfields/mapviewcenterlat_param/documentation.adoc new file mode 100644 index 0000000000..f92fe01e05 --- /dev/null +++ b/entity/Organisation_entity/entityfields/mapviewcenterlat_param/documentation.adoc @@ -0,0 +1,2 @@ +Pass a valid default decimal (or string-decimal) latitude-value to set the default center position of the Map-view which is based on the parameters +`MapViewCenterLat_param` and `MapViewCenterLon_param`. \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/mapviewcenterlat_param/valueProcess.js b/entity/Organisation_entity/entityfields/mapviewcenterlat_param/valueProcess.js new file mode 100644 index 0000000000..75f0dea1eb --- /dev/null +++ b/entity/Organisation_entity/entityfields/mapviewcenterlat_param/valueProcess.js @@ -0,0 +1,2 @@ +import("system.result"); +result.string("50.989791"); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/mapviewcenterlon_param/documentation.adoc b/entity/Organisation_entity/entityfields/mapviewcenterlon_param/documentation.adoc new file mode 100644 index 0000000000..ede2490bd8 --- /dev/null +++ b/entity/Organisation_entity/entityfields/mapviewcenterlon_param/documentation.adoc @@ -0,0 +1,2 @@ +Pass a valid default decimal (or string-decimal) longitude-value to set the default center position of the Map-view which is based on the parameters +`MapViewCenterLat_param` and `MapViewCenterLon_param`. \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/mapviewcenterlon_param/valueProcess.js b/entity/Organisation_entity/entityfields/mapviewcenterlon_param/valueProcess.js new file mode 100644 index 0000000000..2cdca40931 --- /dev/null +++ b/entity/Organisation_entity/entityfields/mapviewcenterlon_param/valueProcess.js @@ -0,0 +1,2 @@ +import("system.result"); +result.string("4.772377"); \ No newline at end of file -- GitLab