From 3c75a8ea459e63a04d08cc078a45811e5a34f7ff Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@nibio.no>
Date: Wed, 2 May 2018 11:30:58 +0200
Subject: [PATCH] Added chart, field memory (locally on unit) and other
 improvements

---
 VIPSWeb/static/js/util.js                     |   5 +
 .../locale/de/LC_MESSAGES/django.mo           | Bin 421 -> 421 bytes
 .../locale/de/LC_MESSAGES/django.po           |  51 +++---
 .../locale/nb/LC_MESSAGES/django.mo           | Bin 3973 -> 4583 bytes
 .../locale/nb/LC_MESSAGES/django.po           |  77 +++++-----
 .../locale/zh_CN/LC_MESSAGES/django.mo        | Bin 2212 -> 2212 bytes
 .../locale/zh_CN/LC_MESSAGES/django.po        |  67 +++++---
 .../septoriahumiditymodelform.html            | 145 ++++++++++++++++--
 forecasts/static/forecasts/js/forecasts.js    |   5 +-
 9 files changed, 249 insertions(+), 101 deletions(-)

diff --git a/VIPSWeb/static/js/util.js b/VIPSWeb/static/js/util.js
index 9aa3d20a..8f2a2ce7 100755
--- a/VIPSWeb/static/js/util.js
+++ b/VIPSWeb/static/js/util.js
@@ -334,6 +334,11 @@ function getJSON(ambiguousVar)
 	}
 }
 
+
+function isDictEmpty(v){
+	return Object.keys(v).length == 0;
+}
+
 function isDict(v){
 	return typeof v==='object' && v!==null && !(v instanceof Array) && !(v instanceof Date);
 }
diff --git a/cerealblotchmodels/locale/de/LC_MESSAGES/django.mo b/cerealblotchmodels/locale/de/LC_MESSAGES/django.mo
index 01a204af9666829002cccf454223039e23666e9f..8d0348cd4f57fc0808a17665a2327698bb2fb9dc 100755
GIT binary patch
delta 21
ccmZ3=yp(xDFPEvVfsultp_P&0#_4>F07JM1vH$=8

delta 21
ccmZ3=yp(xDFPDj~k+FiIiIt(r#_4>F07LEtxc~qF

diff --git a/cerealblotchmodels/locale/de/LC_MESSAGES/django.po b/cerealblotchmodels/locale/de/LC_MESSAGES/django.po
index 61811b7b..8c1b819a 100755
--- a/cerealblotchmodels/locale/de/LC_MESSAGES/django.po
+++ b/cerealblotchmodels/locale/de/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-04-23 14:14+0200\n"
+"POT-Creation-Date: 2018-05-02 11:21+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -28,6 +28,7 @@ msgid "Background data for the barley net blotch model"
 msgstr ""
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:49
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:45
 #: templates/cerealblotchmodels/wheatleafblotchform.html:49
 msgid "Weather station"
 msgstr ""
@@ -138,13 +139,13 @@ msgid "Disease"
 msgstr ""
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:206
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:333
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:382
 #: templates/cerealblotchmodels/wheatleafblotchform.html:208
 msgid "Time"
 msgstr ""
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:214
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:341
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:389
 #: templates/cerealblotchmodels/wheatleafblotchform.html:216
 msgid "Warning status"
 msgstr ""
@@ -160,12 +161,13 @@ msgid "Disease value"
 msgstr ""
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:267
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:438
 #: templates/cerealblotchmodels/wheatleafblotchform.html:269
 msgid "Barley net blotch development"
 msgstr ""
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:279
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:263
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:308
 #: templates/cerealblotchmodels/wheatleafblotchform.html:281
 msgid "Select weather station"
 msgstr ""
@@ -203,10 +205,6 @@ msgstr ""
 msgid "Please select"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:45
-msgid "WeatherStation"
-msgstr ""
-
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:53
 msgid "Sprayings"
 msgstr ""
@@ -273,45 +271,58 @@ msgid "Number of consecutive 'humid hours'"
 msgstr ""
 
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:138
-msgid "Spraying protection period"
+msgid "Spraying protection days"
 msgstr ""
 
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:143
 msgid "Leaf life time (days)"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:303
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:350
 msgid "The model is running, please wait"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:320
-msgid "Temperature, hourly mean"
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:369
+msgid "Leaf wetness, hourly"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:321
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:370
 msgid "Rain, hourly"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:322
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:371
 msgid "Relative humidity, hourly mean"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:323
-msgid "Leaf wetness, hourly"
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:372
+msgid "Humid hour (yes/no)"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:324
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:373
 msgid "Humid period hour"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:325
-msgid "Humid hour (yes/no)"
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:374
+msgid "Humid hour sum"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:326
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:375
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:433
 msgid "Humid period hour outside protection period"
 msgstr ""
 
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:429
+msgid "Hours"
+msgstr ""
+
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:434
+msgid "Threshold humid period"
+msgstr ""
+
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:435
+msgid "Spraying protection period"
+msgstr ""
+
 #: templates/cerealblotchmodels/wheatleafblotchform.html:25
 #: templates/cerealblotchmodels/wheatleafblotchform.html:34
 msgid "Wheat leaf blotch"
diff --git a/cerealblotchmodels/locale/nb/LC_MESSAGES/django.mo b/cerealblotchmodels/locale/nb/LC_MESSAGES/django.mo
index 3f0be08a16babeb7ab2fb54c2ef07cb5b7e468d5..67fcaa9b70056f1e1b90b5f6284d8373f7a71f5a 100755
GIT binary patch
delta 1883
zcmZpbf394APl#nI0|NttGXn#I3<Cp$2@?ZDBm)D34+}_?fnftH1A{071H(pE1_m((
z28QEM`W`C-gE9jH!&g=Y27U$x21zys27Lww22Cg($;QAS$iTqR$;QAS%fP@en~i}%
zgn@x!CmRC;I|Bp5IW`6c76yiThHGpL3=#|s47Z^YU)UHJco`TN{;)v|=3-}HU}a!n
zkYZ<G5N2RtP+(_Z-~&079b$nqI|G9@0|P@SJH(-l><kRz3=9m@*&!CLXJ=rLXJBAB
z!VdA^6LyG$7&#ai1Q_ZW800x1J~03bFffF0Kzy3Y!N9=Dz`#($0dY_p2Ll5e0|Ubp
zD1SBw0|Pe$1H($FzO5V(2OWco-{4?i;9+23cmfsw$icuM$H2hA%n319iIagrqMm_)
zL5CA!kSiwxgAfA)Lm(%_0V$jipHy=)Fi0~nFihrTV31;9U|0`Te~OcVfs28G;Tk8z
zfe%3jGB7Z_hpOY?f>@-?1u;jLi-AFrfq}slDxS{8z)%m0(?Y032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YhRK%xnhK|xs(lomj2Q1%5SG(!f6
znV_@)iUv@2)CHvr28h|9Y^ub-z`(@-%6|-yxMgKvV9;S;U{GOTV2}ivhK51u0hAj+
zIRhjG%9@~%0<l5a4&-=HE&%cMKxv7Afq@CcVSq#phzTk$K<P{i#9;s@Qc(Jb@Ib)>
zDi}aKP<{o`1`G@g79a)#Bsh&3AY}kZ2vlH!Xj29T26F}m1``m60g}K#1rI2JaWFt~
z3@8dg=>@DrP1)GoTER0fEj76$b@D#exs$uuCQMdjm)z{h9?Cd*4Tt4q7EXc5Oq_Qo
zzv7f+D@ZNM%ukuD!zImDlv<pTpEJ3Q>j;;Lu92~Vp^25D$>tF5EsT>*c)La1O0!Ec
z(-lfGb5j*GvJ&<4QZqF-zveAsoSe#UIr#{`@Z^L1FDCC0(4NdIC^y+hP=Qw|4WUJ8
I@-)Ff03L{mO8@`>

diff --git a/cerealblotchmodels/locale/nb/LC_MESSAGES/django.po b/cerealblotchmodels/locale/nb/LC_MESSAGES/django.po
index 130c40e9..8ba9b8a3 100755
--- a/cerealblotchmodels/locale/nb/LC_MESSAGES/django.po
+++ b/cerealblotchmodels/locale/nb/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-04-23 14:14+0200\n"
+"POT-Creation-Date: 2018-05-02 11:21+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -28,6 +28,7 @@ msgid "Background data for the barley net blotch model"
 msgstr "Bakgrunnsdata for byggbrunflekkmodellen"
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:49
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:45
 #: templates/cerealblotchmodels/wheatleafblotchform.html:49
 msgid "Weather station"
 msgstr "Målestasjon"
@@ -138,13 +139,13 @@ msgid "Disease"
 msgstr "Sykdom"
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:206
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:333
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:382
 #: templates/cerealblotchmodels/wheatleafblotchform.html:208
 msgid "Time"
 msgstr "Tid"
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:214
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:341
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:389
 #: templates/cerealblotchmodels/wheatleafblotchform.html:216
 msgid "Warning status"
 msgstr "Varselstatus"
@@ -160,12 +161,13 @@ msgid "Disease value"
 msgstr "Sykdomsverdi"
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:267
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:438
 #: templates/cerealblotchmodels/wheatleafblotchform.html:269
 msgid "Barley net blotch development"
 msgstr "Utvikling av byggbrunflekk"
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:279
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:263
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:308
 #: templates/cerealblotchmodels/wheatleafblotchform.html:281
 msgid "Select weather station"
 msgstr "Velg målestasjon"
@@ -203,21 +205,14 @@ msgstr "Land"
 msgid "Please select"
 msgstr "Vennligst velg"
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:45
-#, fuzzy
-msgid "WeatherStation"
-msgstr "Målestasjon"
-
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:53
-#, fuzzy
 msgid "Sprayings"
-msgstr "Sprøytedato"
+msgstr "Sprøytinger"
 
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:55
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:60
-#, fuzzy
 msgid "Spraying 1"
-msgstr "Sprøytedato"
+msgstr "Sprøytedato 1"
 
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:70
 msgid "Phenology"
@@ -245,7 +240,7 @@ msgstr "Alle kjerner fullt strukket ut (vs 75)"
 
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:100
 msgid "Threshold values for 'humid hour'"
-msgstr "Terskelverdier for \"fuktig time\""
+msgstr "Terskelverdier for fuktig time"
 
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:102
 msgid "Relative humidity"
@@ -256,9 +251,8 @@ msgid "Leaf wetness (min/hour)"
 msgstr "Bladfukt (min/t)"
 
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:112
-#, fuzzy
 msgid "Precipitation"
-msgstr "Plantevernmiddel"
+msgstr "Nedbør"
 
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:117
 msgid "Sliding hours past (hours)"
@@ -277,55 +271,64 @@ msgid "Number of consecutive 'humid hours'"
 msgstr "Antall sammenhengende \"fuktige timer\""
 
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:138
-msgid "Spraying protection period"
+msgid "Spraying protection days"
 msgstr "Antall dager beskyttelse etter sprøyting"
 
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:143
 msgid "Leaf life time (days)"
 msgstr "Levetid for blad (dager)"
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:303
-#, fuzzy
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:350
 msgid "The model is running, please wait"
 msgstr "Modellen kjører, vennligst vent"
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:320
-#, fuzzy
-msgid "Temperature, hourly mean"
-msgstr "Temperatur, døgngjennomsnitt"
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:369
+msgid "Leaf wetness, hourly"
+msgstr "Bladfukt, timesverdi"
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:321
-#, fuzzy
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:370
 msgid "Rain, hourly"
-msgstr "Regn, daglig"
+msgstr "Regn, timeverdi"
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:322
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:371
 msgid "Relative humidity, hourly mean"
 msgstr "Relativ luftfuktighet, timesgjennomsnitt"
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:323
-msgid "Leaf wetness, hourly"
-msgstr "Bladfukt, timesverdi"
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:372
+msgid "Humid hour (yes/no)"
+msgstr "Fuktig time (ja/nei)"
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:324
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:373
 msgid "Humid period hour"
 msgstr "Time nr i fuktig periode"
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:325
-msgid "Humid hour (yes/no)"
-msgstr "Fuktig time (ja/nei)"
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:374
+msgid "Humid hour sum"
+msgstr "Sum fuktige timer"
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:326
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:375
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:433
 msgid "Humid period hour outside protection period"
 msgstr "Time nr x i fuktig periode utenfor sprøyteperiode"
 
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:429
+msgid "Hours"
+msgstr "Timer"
+
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:434
+msgid "Threshold humid period"
+msgstr "Terskelverdier for fuktig time"
+
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:435
+msgid "Spraying protection period"
+msgstr "Beskyttelse etter sprøyting"
+
 #: templates/cerealblotchmodels/wheatleafblotchform.html:25
 #: templates/cerealblotchmodels/wheatleafblotchform.html:34
 msgid "Wheat leaf blotch"
 msgstr "Bladflekksjukdommer i hvete"
 
 #: templates/cerealblotchmodels/wheatleafblotchform.html:42
-#, fuzzy
 msgid "Background data for the wheat leaf blotch model"
-msgstr "Bakgrunnsdata for byggbrunflekkmodellen"
+msgstr "Bakgrunnsdata for bladflekksjukdomsmodellen"
 
diff --git a/cerealblotchmodels/locale/zh_CN/LC_MESSAGES/django.mo b/cerealblotchmodels/locale/zh_CN/LC_MESSAGES/django.mo
index 1d22b3b4c2987addf1f13ebb79af5b91d2e7356e..298a32a2cda4024a7a483c6ad7510817220325a8 100755
GIT binary patch
delta 23
fcmZ1?xI}Qnd{!<~T>~QpLqjVg!_6yMe=`99R2~Nk

delta 23
fcmZ1?xI}Qnd{!<KT_a-!LlY}Qlg%qxe=`99R9goT

diff --git a/cerealblotchmodels/locale/zh_CN/LC_MESSAGES/django.po b/cerealblotchmodels/locale/zh_CN/LC_MESSAGES/django.po
index 8a241ec4..eff7c52b 100755
--- a/cerealblotchmodels/locale/zh_CN/LC_MESSAGES/django.po
+++ b/cerealblotchmodels/locale/zh_CN/LC_MESSAGES/django.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-04-23 14:14+0200\n"
+"POT-Creation-Date: 2018-05-02 11:21+0200\n"
 "PO-Revision-Date: 2016-10-07 11:05+0200\n"
 "Last-Translator: \n"
 "Language-Team: \n"
@@ -28,6 +28,7 @@ msgid "Background data for the barley net blotch model"
 msgstr "大麦网斑病模型的背景数据"
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:49
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:45
 #: templates/cerealblotchmodels/wheatleafblotchform.html:49
 msgid "Weather station"
 msgstr "气象站"
@@ -138,13 +139,13 @@ msgid "Disease"
 msgstr "疾病"
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:206
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:333
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:382
 #: templates/cerealblotchmodels/wheatleafblotchform.html:208
 msgid "Time"
 msgstr "时间"
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:214
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:341
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:389
 #: templates/cerealblotchmodels/wheatleafblotchform.html:216
 msgid "Warning status"
 msgstr "预警信息"
@@ -160,12 +161,13 @@ msgid "Disease value"
 msgstr "疾病值"
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:267
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:438
 #: templates/cerealblotchmodels/wheatleafblotchform.html:269
 msgid "Barley net blotch development"
 msgstr "大麦网斑病发展"
 
 #: templates/cerealblotchmodels/barleynetblotchform.html:279
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:263
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:308
 #: templates/cerealblotchmodels/wheatleafblotchform.html:281
 msgid "Select weather station"
 msgstr "选择气象站"
@@ -203,12 +205,6 @@ msgstr ""
 msgid "Please select"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:45
-#, fuzzy
-#| msgid "Weather station"
-msgid "WeatherStation"
-msgstr "气象站"
-
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:53
 #, fuzzy
 #| msgid "Spraying date"
@@ -281,51 +277,62 @@ msgid "Number of consecutive 'humid hours'"
 msgstr ""
 
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:138
-msgid "Spraying protection period"
+msgid "Spraying protection days"
 msgstr ""
 
 #: templates/cerealblotchmodels/septoriahumiditymodelform.html:143
 msgid "Leaf life time (days)"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:303
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:350
 #, fuzzy
 #| msgid "Model is running, please wait"
 msgid "The model is running, please wait"
 msgstr "模型在运行,请等候"
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:320
-#, fuzzy
-#| msgid "Temperature, daily mean"
-msgid "Temperature, hourly mean"
-msgstr "日均温"
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:369
+msgid "Leaf wetness, hourly"
+msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:321
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:370
 #, fuzzy
 #| msgid "Rain, daily"
 msgid "Rain, hourly"
 msgstr "日降雨"
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:322
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:371
 msgid "Relative humidity, hourly mean"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:323
-msgid "Leaf wetness, hourly"
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:372
+msgid "Humid hour (yes/no)"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:324
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:373
 msgid "Humid period hour"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:325
-msgid "Humid hour (yes/no)"
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:374
+msgid "Humid hour sum"
 msgstr ""
 
-#: templates/cerealblotchmodels/septoriahumiditymodelform.html:326
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:375
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:433
 msgid "Humid period hour outside protection period"
 msgstr ""
 
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:429
+msgid "Hours"
+msgstr ""
+
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:434
+msgid "Threshold humid period"
+msgstr ""
+
+#: templates/cerealblotchmodels/septoriahumiditymodelform.html:435
+msgid "Spraying protection period"
+msgstr ""
+
 #: templates/cerealblotchmodels/wheatleafblotchform.html:25
 #: templates/cerealblotchmodels/wheatleafblotchform.html:34
 msgid "Wheat leaf blotch"
@@ -337,6 +344,16 @@ msgstr ""
 msgid "Background data for the wheat leaf blotch model"
 msgstr "大麦网斑病模型的背景数据"
 
+#, fuzzy
+#~| msgid "Weather station"
+#~ msgid "WeatherStation"
+#~ msgstr "气象站"
+
+#, fuzzy
+#~| msgid "Temperature, daily mean"
+#~ msgid "Temperature, hourly mean"
+#~ msgstr "日均温"
+
 #, fuzzy
 #~| msgid "Background data for the barley net blotch model"
 #~ msgid "Background data for the Septoria humidity model"
diff --git a/cerealblotchmodels/templates/cerealblotchmodels/septoriahumiditymodelform.html b/cerealblotchmodels/templates/cerealblotchmodels/septoriahumiditymodelform.html
index 40618e9d..8521ab64 100644
--- a/cerealblotchmodels/templates/cerealblotchmodels/septoriahumiditymodelform.html
+++ b/cerealblotchmodels/templates/cerealblotchmodels/septoriahumiditymodelform.html
@@ -42,7 +42,7 @@
 				<span class="help-block" id="{{ form_id }}_organizationId_countryCode_validation"></span>
 			</div>
 			<div class="form-group">
-				<label for="weatherStationId">{% trans "WeatherStation" %}</label>
+				<label for="weatherStationId">{% trans "Weather station" %}</label>
 				<select name="weatherStationId" id="weatherStationId" class="form-control">
 				<option value="">{% trans "Please select" %}</option>
 				<option value="test">TEST</option>
@@ -135,7 +135,7 @@
 					<span class="help-block" id="{{ form_id }}_thresholdHumidPeriodHours_validation"></span>
 				</div>
 				<div class="form-group">
-					<label for="sprayingProtectionDays">{% trans "Spraying protection period" %}</label>
+					<label for="sprayingProtectionDays">{% trans "Spraying protection days" %}</label>
 					<input type="number" name="sprayingProtectionDays" class="form-control" value="10"/>
 					<span class="help-block" id="{{ form_id }}_sprayingProtectionDays_validation"></span>
 				</div>
@@ -149,10 +149,15 @@
 	</div>
 	<div class="row">
 		<div class="col-md-12 form-group">
-			<button type="button" class="btn btn-primary" onclick="if(validateForm(document.getElementById('{{ form_id }}'))){runModel();}">{% trans "Run model" %}</button>
+			<button type="button" class="btn btn-primary" onclick="if(validateForm(document.getElementById('{{ form_id }}'))){storeUserSettings();runModel();}">{% trans "Run model" %}</button>
 		</div>
 	</div>
 	</form>
+	
+	<div class="row">
+		<div class="col-md-12" id="chartContainer" style="height:400px; display: none;">
+		</div>
+	</div>
 	<div class="row">
 		<div class="col-md-12">
 			<div class="table-responsive">
@@ -169,19 +174,54 @@
 <script type="text/javascript" src="{% static "js/3rdparty/highcharts.js" %}"></script>
 <script type="text/javascript" src="{% static "js/util.js" %}"></script>
 <script type="text/javascript" src="{% static "js/validateForm.js" %}"></script>
+<script type="text/javascript" src="{% static "forecasts/js/forecasts.js" %}"></script>
 <script type="text/javascript">
 	var danishPostCodesUTM;
 	var organizations;
 	var allowedCountryCodes = ["NO","DK","SE","FI","LT"];
+	var formFields = [
+		"organizationId_countryCode",
+		"weatherStationId",
+		"dateSpraying1",
+		"dateSpraying2",
+		"dateGs31",
+		"date3rdUpperLeafEmerging",
+		"date2ndUpperLeafEmerging",
+		"dateUpperLeafEmerging",
+		"dateGs75",
+		"thresholdRelativeHumidity",
+		"thresholdLeafWetness",
+		"thresholdPrecipitation",
+		"slidingHoursPast",
+		"slidingHoursAhead",
+		"thresholdHumidPeriodHours",
+		"sprayingProtectionDays",
+		"leafLifeTime"
+		];
+	
+	var specialFormFields =  ["organizationId_countryCode","weatherStationId"]; // Must be initialized after a few events
 	$(document).ready(function() {
-		initOrganizations();
+		
 		//initWeatherStations();
 		// Init form validation
 		loadFormDefinition("{{ form_id }}","/static/cerealblotchmodels/formdefinitions/");
-		initDanishPostCodesUTM();
-		updateGSDates();
+		initDanishPostCodesUTM(function(){
+			initOrganizations(function(){
+				var userSettings = getLocalSettings(getNameSpaced("{{ form_id }}",formFields), false);
+				if(!isDictEmpty(userSettings)) {
+					renderUserSettings(userSettings);
+				}
+				else
+				{
+					updateGSDates();
+				}
+			});
+			
+		});
+		
+		
 	});
-	var initDanishPostCodesUTM = function(){
+	var initDanishPostCodesUTM = function(callback){
 		$.ajax({
 	        type:"GET",
 	        url: "{% static "cerealblotchmodels/weatherDataInfo/PostalCodesUTM.xml" %}",
@@ -190,6 +230,7 @@
 	            	danishPostCodesUTM = Array.prototype.slice.call(data.getElementsByTagName("PostalCode"),0).sort(function(a,b){
 	            		return a.getElementsByTagName("CityName")[0].firstChild.nodeValue < b.getElementsByTagName("CityName")[0].firstChild.nodeValue ? -1 : 1;
 	            	});
+	            	callback();
 	        	},
 	            400: handleAjaxError,
 	            401: handleAjaxError,
@@ -199,7 +240,7 @@
 	     });
 	};
 	
-	var initOrganizations = function(){
+	var initOrganizations = function(callback){
 		$.ajax({
 	        type:"GET",
 	        url: settings.vipslogicProtocol + "://" + settings.vipslogicServerName + "/rest/organization",
@@ -219,6 +260,9 @@
 	            			}
 	            		}
 	            	}
+	            	renderUserSetting(orgSelect);
+					orgSelect.onchange();
+					callback();
 	        	},
 	            400: handleAjaxError,
 	            401: handleAjaxError,
@@ -251,6 +295,7 @@
 				//console.info(opt);
 				selectList.options[selectList.options.length] = opt;
 			}
+			renderUserSetting(selectList);
 		}
 		else
 		{
@@ -267,7 +312,9 @@
 		            		var ws = data[i];
 		            		wsHTML.push("<option value=\"" + ws["pointOfInterestId"] + "\">" + ws["name"] + "</option>");
 		            	}
-		            	document.getElementById("weatherStationId").innerHTML = wsHTML.join("");
+		            	var wsSelect = document.getElementById("weatherStationId");
+		            	wsSelect.innerHTML = wsHTML.join("");
+		            	renderUserSetting(wsSelect);
 		        	},
 		            400: handleAjaxError,
 		            401: handleAjaxError,
@@ -299,6 +346,7 @@
 	}
 	
 	var runModel = function(){
+		document.getElementById("chartContainer").style.display="none"; // Hide chart
 		// Insert please wait message
 		document.getElementById("resultsTable").innerHTML='<div class="alert alert-info" role="alert">{% trans "The model is running, please wait" %}</div>';
 		var formStr = $("#{{ form_id }}").serialize();
@@ -316,13 +364,15 @@
 		//console.log(formStr);
 	}
 	
+	var resultParameterOrdering = ["WEATHER.UM","WEATHER.RR","WEATHER.BT","SEPTORIAHU.HH","SEPTORIAHU.HPH","SEPTORIAHU.HHS","SEPTORIAHU.HPHPP"];
+	
 	var paramDict = {
-			"WEATHER.TM": "{% trans "Temperature, hourly mean" %}",
+			"WEATHER.BT" : "{% trans "Leaf wetness, hourly" %}",
 			"WEATHER.RR" : "{% trans "Rain, hourly" %}",
 			"WEATHER.UM": "{% trans "Relative humidity, hourly mean" %}",
-			"WEATHER.BT" : "{% trans "Leaf wetness, hourly" %}",
-			"SEPTORIAHU.HPH" : "{% trans "Humid period hour" %}",
 			"SEPTORIAHU.HH" : "{% trans "Humid hour (yes/no)" %}",
+			"SEPTORIAHU.HPH" : "{% trans "Humid period hour" %}",
+			"SEPTORIAHU.HHS" : "{% trans "Humid hour sum" %}",
 			"SEPTORIAHU.HPHPP" : "{% trans "Humid period hour outside protection period" %}"
 		};
 	
@@ -333,10 +383,9 @@
 		var headingLine = "<tr><td style=\"font-weight: bold;\">{% trans "Time" %}</td>";
         if(data.length > 0)
         {
-            var allKeys = JSON.parse(data[0].keys);
-            for(var i=0;i<allKeys.length;i++)
+            for(var i in paramDict)
             {
-                headingLine +="<td style=\"font-weight: bold;\">" + paramDict[allKeys[i]] + "</td>";
+                headingLine +="<td style=\"font-weight: bold;\">" + paramDict[i] + "</td>";
             }
             headingLine +="<td style=\"font-weight: bold;\">{% trans "Warning status" %}</td>";
             headingLine += "</tr>";
@@ -350,9 +399,9 @@
             	}
                 var resultLine = "<tr><td>" + moment(data[row]["validTimeStart"]).format("YYYY-MM-DD HH:mm") + "</td>";
                 var allValues = JSON.parse(data[row].allValues);
-                for(var i in allKeys)
+                for(var i in paramDict)
                 {
-                	var value = allValues[allKeys[i]];
+                	var value = allValues[i];
                 	if(value != null && $.isNumeric(value))
                 	{
                 		value = parseFloat(value).toFixed(2);
@@ -369,10 +418,72 @@
             table.push("</table>");
             document.getElementById("resultsTable").innerHTML=table.join("");
 		}
+        
+     	// Then: The chart
+        // We must sort data ascending again
+        document.getElementById("chartContainer").style.display="block";
+        data.reverse();
+        var warningStatusPlotBandData = getWarningStatusPlotBandData(data);
+        //console.log(warningStatusPlotBandData);
+        var data = getHighChartsSeries(
+        	data,
+        	[
+        		{"color": "#6600FF", "opposite": false, "abbr": " ", "title": "{% trans "Hours" %}"},
+        		{min: 0, max: 1.5, visible: false}
+        	],
+        	[
+        		{key: "SEPTORIAHU.HPHPP", type: "spline", color: "black", name: "{% trans "Humid period hour outside protection period" %}", yAxis: 0},
+        		{key: "SEPTORIAHU.THPHPP", type: "spline", color: "red", name: "{% trans "Threshold humid period" %}", yAxis: 0},
+        		{key: "SEPTORIAHU.SPP", type: "spline", lineWidth: 5, color: "blue", name: "{% trans "Spraying protection period" %}", yAxis: 1},
+        	]
+        );
+        renderForecastChart("chartContainer", "{% trans "Barley net blotch development" %}", warningStatusPlotBandData, data);
 	}
 	
 	var handleAjaxError = function(jqXHR,textStatus,errorThrown){
 		alert(textStatus);
 	};
+	
+	var renderUserSettings = function(userSettings){
+		// Strip namespace from form field
+		var theForm = document.getElementById('{{ form_id }}');
+		for(var i in userSettings){
+			var fieldName = i.substring("{{form_id}}.".length);
+			if(specialFormFields.indexOf(fieldName) < 0){
+				theForm[fieldName].value = userSettings[i];
+			}
+		}
+	};
+	
+	var renderUserSetting = function(formField)
+	{
+		var localStorageKey = "{{form_id}}." + formField.name;
+		
+		var locallyStoredValue = getLocalSettings([localStorageKey]) != null ? getLocalSettings([localStorageKey])[localStorageKey] : null;
+		if(locallyStoredValue != null)
+		{
+			formField.value = locallyStoredValue;
+		}
+	}
+	
+	var getNameSpaced = function(nameSpace, anArray){
+		var retVal = [];
+		for(var i = 0; i<anArray.length;i++)
+		{
+			retVal.push(nameSpace + "." + anArray[i]);
+		}
+		return retVal;
+	};
+	
+	var storeUserSettings = function(){
+		var theForm = document.getElementById('{{ form_id }}');
+		var settingsDict = {}
+		for(var i in formFields)
+		{
+			// Need to add the formId as namespace to avoid confusion in Local Storage
+			settingsDict["{{ form_id }}" + "." + formFields[i]] = theForm[formFields[i]].value;
+		}
+		storeLocalSettings(settingsDict);
+	};
 </script>
 {% endblock %}
\ No newline at end of file
diff --git a/forecasts/static/forecasts/js/forecasts.js b/forecasts/static/forecasts/js/forecasts.js
index 0753c1ae..4358c0d0 100755
--- a/forecasts/static/forecasts/js/forecasts.js
+++ b/forecasts/static/forecasts/js/forecasts.js
@@ -275,7 +275,7 @@ function getWarningStatusPlotBandData(forecastResults)
 	if(plotBand != null && plotBand["to"] == null)
 	{
 		// Moment.js!!!
-		plotBand.to = getUnixTimestampFromJSONforecastResults([forecastResults.length -1]["validTimeStart"]) + bandOffset;
+		plotBand.to = getUnixTimestampFromJSON([forecastResults.length -1]["validTimeStart"]) + bandOffset;
 		plotBands.push(plotBand);
 	}
 	
@@ -298,7 +298,8 @@ function getHighChartsSeries(forecastResults, yAxisList, parameterList)
 				name: parameter.name,
 				showInLegend: (parameter.showInLegend === undefined || parameter.showInLegend === null || parameter.showInLegend === true),
 				color: parameter.color,
-				yAxis: parameter.yAxis
+				yAxis: parameter.yAxis,
+				lineWidth: parameter.lineWidth !== undefined ?  parameter.lineWidth: 2
 		};
 	}
 	
-- 
GitLab