From 0a0b62c6ef349fad9ba78d7f32f61e7982a66be7 Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@nibio.no>
Date: Fri, 5 Apr 2019 11:56:30 +0200
Subject: [PATCH] Allowing for more than one organization's stations to be
 shown on the map

---
 VIPSWeb/local_settings_sample.py  | 2 ++
 VIPSWeb/static/js/frontpageMap.js | 8 +++++++-
 VIPSWeb/templates/index.html      | 2 +-
 VIPSWeb/templates/settings.js     | 2 ++
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/VIPSWeb/local_settings_sample.py b/VIPSWeb/local_settings_sample.py
index 5519396e..e87634e2 100755
--- a/VIPSWeb/local_settings_sample.py
+++ b/VIPSWeb/local_settings_sample.py
@@ -116,6 +116,8 @@ VIPSLOGIC_SERVER_NAME = "vipslogic"
 VIPSLOGIC_PROTOCOL = "https"
 # This organization's ID in VIPSLogic/CoreManager
 VIPS_ORGANIZATION_ID = 1
+# Use this if you want to override and show icons for stations belonging to several organizations
+#FORECAST_MAP_ORGANIZATION_IDS =[1,6]
 # The server name used for VIPSCoreManager
 VIPSCOREMANAGER_SERVER_NAME = "vipscoremanager"
 # Local path to self signed certificate of VIPSCoreManager. 
diff --git a/VIPSWeb/static/js/frontpageMap.js b/VIPSWeb/static/js/frontpageMap.js
index 87c021cf..668d29c0 100755
--- a/VIPSWeb/static/js/frontpageMap.js
+++ b/VIPSWeb/static/js/frontpageMap.js
@@ -408,7 +408,13 @@ function updateForecastLayers()
 	forecastLayer = new ol.layer.Vector({
 		source: new ol.source.Vector({
 			//url: settings.vipslogicProtocol + "://" + settings.vipslogicServerName + "/rest/forecastresults/aggregate/" + settings.vipsOrganizationId + "?" + cropCategoryIdStr,
-			url: "/vipslogicproxy/rest/forecastresults/aggregate/" + settings.vipsOrganizationId + "?" + cropCategoryIdStr,
+			url: "/vipslogicproxy/rest/forecastresults/aggregate/" + 
+				(
+						settings.forecastMapOrganizationIds != null && settings.forecastMapOrganizationIds.length > 0 ? 
+						"orgspan?organizationId=" + settings.forecastMapOrganizationIds.join("&organizationId=") + cropCategoryIdStr
+						: settings.vipsOrganizationId + "?" + cropCategoryIdStr
+				) 
+				,
 			format: new ol.format.KML(),
 			projection: ol.proj.get('EPSG:3857')
 		})
diff --git a/VIPSWeb/templates/index.html b/VIPSWeb/templates/index.html
index 4edbaf51..7523c55e 100755
--- a/VIPSWeb/templates/index.html
+++ b/VIPSWeb/templates/index.html
@@ -44,7 +44,7 @@
 
 		if(settings.userIsIE)
 		{
-			alert("{% trans "WARNING: We suspect you are using Internet Explorer to view this site. VIPS is not designed to work with Internet Explorer, you may experience errors and missing features. Please use a different browser, like Microsoft Edge or Google Chrome." %}");
+			alert("{% trans "WARNING: We suspect you are using Internet Explorer to view this site. VIPS is not designed to work with Internet Explorer, you may experience errors and missing features. Please use a different browser, like Firefox, Microsoft Edge or Google Chrome." %}");
 		}
 
 		
diff --git a/VIPSWeb/templates/settings.js b/VIPSWeb/templates/settings.js
index 918e8f69..3a3ed9f9 100755
--- a/VIPSWeb/templates/settings.js
+++ b/VIPSWeb/templates/settings.js
@@ -25,6 +25,8 @@ var settings = {
 		vipslogicProtocol: "{{settings.VIPSLOGIC_PROTOCOL}}",
 		vipsCoremanagerServerName : "{{settings.VIPSCOREMANAGER_SERVER_NAME}}",
 		
+		forecastMapOrganizationIds: {{settings.FORECAST_MAP_ORGANIZATION_IDS}},
+		
 		mapZoomlevel: {{settings.MAP_ZOOMLEVEL}},
 		
 		systemTimeOffsetMonths: {{settings.SYSTEM_TIME_OFFSET_MONTHS}},
-- 
GitLab