From 65ffb757d146ee7792cc3ec8f72bfaaf59045600 Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@nibio.no>
Date: Mon, 18 Jun 2018 13:46:26 +0200
Subject: [PATCH] Bugfix/updates

---
 .../cerealblotchmodels/barleynetblotchform.html  | 16 +++++++++++-----
 .../septoriahumiditymodelform.html               |  5 ++++-
 .../cerealblotchmodels/wheatleafblotchform.html  |  6 +-----
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/cerealblotchmodels/templates/cerealblotchmodels/barleynetblotchform.html b/cerealblotchmodels/templates/cerealblotchmodels/barleynetblotchform.html
index d4674ef0..9567efff 100755
--- a/cerealblotchmodels/templates/cerealblotchmodels/barleynetblotchform.html
+++ b/cerealblotchmodels/templates/cerealblotchmodels/barleynetblotchform.html
@@ -206,7 +206,7 @@
 		var headingLine = "<tr><td style=\"font-weight: bold;\">{% trans "Time" %}</td>";
         if(data.length > 0)
         {
-            var allKeys = data[0].keys;
+        	var allKeys = JSON.parse(data[0]["keys"]);
             for(var i in allKeys)
             {
                 headingLine +="<td style=\"font-weight: bold;\">" + paramDict[allKeys[i]] + "</td>";
@@ -217,14 +217,16 @@
             var table = ["<table border=\"1\">",headingLine];
             for(var row in data)
             {
-            	if(data[row]["validTimeStart"] == null)
+            	var aResult = data[i];
+				var allValues = JSON.parse(aResult["allValues"]);
+            	if(aResult["validTimeStart"] == null)
             	{
             		continue;
             	}
-                var resultLine = "<tr><td>" + moment(data[row]["validTimeStart"]).format() + "</td>";
+                var resultLine = "<tr><td>" + moment(aResult["validTimeStart"]).format() + "</td>";
                 for(var i in allKeys)
                 {
-                	var value = data[row].allValues[allKeys[i]];
+                	var value = allValues[allKeys[i]];
                 	if(value != null && $.isNumeric(value))
                 	{
                 		value = parseFloat(value).toFixed(2);
@@ -232,7 +234,7 @@
                     resultLine +="<td>" + value + "</td>";
                 }
                 resultLine +="<td style=\"background-color:";
-                var st = data[row]["warningStatus"];
+                var st = aResult["warningStatus"];
                 resultLine += st===0 ? "gray" : st===1 ? "blue" : st===2 ? "green" : st===3 ? "yellow" : "red";
                 resultLine +=";\">" + st + "</td>";
                 resultLine += "</tr>";
@@ -357,6 +359,10 @@
     };
     
     $(document).ready(function() {
+    	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." %}");
+		}
 		initWeatherStations();
 		initCrops();
 		initPreparations();
diff --git a/cerealblotchmodels/templates/cerealblotchmodels/septoriahumiditymodelform.html b/cerealblotchmodels/templates/cerealblotchmodels/septoriahumiditymodelform.html
index 35ced989..0d9d6880 100644
--- a/cerealblotchmodels/templates/cerealblotchmodels/septoriahumiditymodelform.html
+++ b/cerealblotchmodels/templates/cerealblotchmodels/septoriahumiditymodelform.html
@@ -201,7 +201,10 @@
 	
 	var specialFormFields =  ["organizationId_countryCode","weatherStationId"]; // Must be initialized after a few events
 	$(document).ready(function() {
-		
+		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." %}");
+		}
 		//initWeatherStations();
 		// Init form validation
 		loadFormDefinition("{{ form_id }}","/static/cerealblotchmodels/formdefinitions/");
diff --git a/cerealblotchmodels/templates/cerealblotchmodels/wheatleafblotchform.html b/cerealblotchmodels/templates/cerealblotchmodels/wheatleafblotchform.html
index 5840f6fa..be177c97 100755
--- a/cerealblotchmodels/templates/cerealblotchmodels/wheatleafblotchform.html
+++ b/cerealblotchmodels/templates/cerealblotchmodels/wheatleafblotchform.html
@@ -32,10 +32,6 @@
 {% block content %}
 <div class="singleBlockContainer">
 	<h1>{% trans "Wheat leaf blotch" %}</h1>
-	<div class="alert alert-danger" role="alert" id="oldIEWarning" style="display:none;">
-		Du bruker en gammel versjon av Internet Explorer. Den nye bladflekksjukdomsmodellen fungerer med 
-		de fleste moderne nettlesere, som Chrome, Firefox og Internet Explorer versjon 10 og nyere.
-	</div>
 	<form role="form" id="{{ form_id }}">
 		<input type="hidden" name="wheatType" id="wheatType" value="-1"/>
 		<div class="row">
@@ -282,7 +278,7 @@
             var table = ["<table border=\"1\">",headingLine];
             for(var i in data)
             {
-            	console.info(data[i]);
+            	//console.info(data[i]);
                	var aResult = data[i];
 				var allValues = JSON.parse(aResult["allValues"]);
             	if(aResult["validTimeStart"] == null)
-- 
GitLab