1.1 --- a/eskp.py Mon Feb 03 16:20:55 2020 +0100
1.2 +++ b/eskp.py Mon Feb 03 17:20:42 2020 +0100
1.3 @@ -49,6 +49,14 @@
1.4 content = publish_parts(rst_data, writer_name='html', settings_overrides=overrides)['html_body']
1.5 return content
1.6
1.7 +def get_html_content(filename, overrides=None):
1.8 + html_content = u""
1.9 + filename = os.path.join(ESKP_PATH, filename)
1.10 + if os.path.isfile(filename):
1.11 + with codecs.open(filename, 'r', 'utf-8') as f:
1.12 + html_content = f.read()
1.13 +
1.14 + return html_content
1.15
1.16 def get_newest_date():
1.17 getdates = get_valid_dates(FILES)
1.18 @@ -279,7 +287,11 @@
1.19 def ozoneloss_uvmap():
1.20 filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_uvmap.rst")
1.21 content = get_content(filename)
1.22 - return render_template("/ozoneloss_uvmap.html", act="ozoneloss/uvmap", content=content)
1.23 +
1.24 + htmlfile = os.path.join("templates", get_locale(), "html", "uvi_table.html")
1.25 + html_content = get_html_content(htmlfile)
1.26 + return render_template("/ozoneloss_uvmap.html", act="ozoneloss/uvmap", content=content,
1.27 + html_content=html_content)
1.28
1.29
1.30 @app.route("/ozoneloss/vpsc")
1.31 @@ -291,22 +303,31 @@
1.32
1.33 @app.route("/ozoneloss/uvi", methods=['GET'])
1.34 def ozoneloss_uvi():
1.35 - # XXX check 'POST' does not work
1.36 filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_uvi.rst")
1.37 content = get_content(filename)
1.38 + htmlfile = os.path.join("templates", get_locale(), "html", "ozoneloss_uvi_form.html")
1.39 + html_content = get_html_content(htmlfile)
1.40 + htmlfile = os.path.join("templates", get_locale(), "html", "uvi_table.html")
1.41 + html_table = get_html_content(htmlfile)
1.42
1.43 lat = 50.
1.44 o3offset = 50.
1.45 figname = "uvincr_lat%0.3i_do3%0.3i.svg" % (lat, o3offset)
1.46 + button_text = _("Graph anzeigen")
1.47
1.48 return render_template('ozoneloss_uvi.html', act="ozoneloss/uvi", content=content, figname=figname,
1.49 - alt=_(u"UV increase at {{lat}} degrees N for {{o3offset}} DU ozone depletion"))
1.50 + alt=_(u"UV increase at {{lat}} degrees N for {{o3offset}} DU ozone depletion"),
1.51 + html_content=html_content, html_table=html_table, button_text=button_text)
1.52
1.53
1.54 @app.route("/ozoneloss/uvi_graph", methods=['POST'])
1.55 def ozoneloss_uvi_graph():
1.56 filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_uvi.rst")
1.57 content = get_content(filename)
1.58 + htmlfile = os.path.join("templates", get_locale(), "html", "ozoneloss_uvi_form.html")
1.59 + html_content = get_html_content(htmlfile)
1.60 + htmlfile = os.path.join("templates", get_locale(), "html", "uvi_table.html")
1.61 + html_table = get_html_content(htmlfile)
1.62
1.63 latstr = request.form['Gradzahl']
1.64 o3offsetstr = request.form['Dobson-Unit']
1.65 @@ -321,9 +342,12 @@
1.66 lat = -float(latstr2)
1.67
1.68 figname = "uvincr_lat%0.3i_do3%0.3i.svg" % (lat, float(o3offsetstr))
1.69 + button_text = _("Graph anzeigen")
1.70
1.71 return render_template('graph.html', act="ozoneloss_uvi_graph", content=content, figname=figname,
1.72 - o3offsetstr=o3offsetstr, latstr=latstr)
1.73 + alt=_(u"UV increase at {{lat}} degrees N for {{o3offset}} DU ozone depletion"),
1.74 + o3offsetstr=o3offsetstr, latstr=latstr, html_content=html_content,
1.75 + html_table=html_table, button_text=button_text)
1.76
1.77 @app.route("/ozoneloss/decadal")
1.78 def ozoneloss_decadal():
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/templates/de/html/ozoneloss_uvi_form.html Mon Feb 03 17:20:42 2020 +0100
2.3 @@ -0,0 +1,29 @@
2.4 +<form method="post" action="/ozoneloss/uvi_graph">
2.5 +<table border="0" width="100%">
2.6 + <tr> <h4>
2.7 + <p> UV-Index für
2.8 + <select name="Dobson-Unit" size="1" font-size="14" border-color="gray">
2.9 + <option>25</option>
2.10 + <option selected>50</option>
2.11 + <option>75</option>
2.12 + <option>100</option>
2.13 + <option>125</option>
2.14 + </select>
2.15 + DU zusätzlichen Ozonverlust bei der Breite
2.16 + <select name="Gradzahl" size="1" font-size="14" border-color="gray">
2.17 + <option>80° N</option>
2.18 + <option>70° N</option>
2.19 + <option>60° N</option>
2.20 + <option selected> 50° N</option>
2.21 + <option>50° S</option>
2.22 + <option>60° S</option>
2.23 + <option>70° S</option>
2.24 + <option>80° S</option>
2.25 + </select>
2.26 + :
2.27 + <input type="submit" value="Graph anzeigen" font-color="black" font-size="16" border-color="gray"/>
2.28 + </p>
2.29 + </h4>
2.30 +</tr>
2.31 +</table>
2.32 +</form>
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/templates/de/html/uvi_table.html Mon Feb 03 17:20:42 2020 +0100
3.3 @@ -0,0 +1,44 @@
3.4 +
3.5 +Die unten stehenden Tabelle gibt einen Anhaltspunkt für die Bedeutung der verschiedenen UV-Indices:
3.6 +<br>
3.7 +<br>
3.8 +<table border="black">
3.9 + <colgroup>
3.10 + <col width="100">
3.11 + <col width="100">
3.12 + <col width="400">
3.13 + </colgroup>
3.14 + <tr>
3.15 + <th align="center" bgcolor="#E0E0E0">UV-Index</th>
3.16 + <th align="center" bgcolor="#E0E0E0">Bewertung</th>
3.17 + <th align="center" bgcolor="#E0E0E0">Schutz</th>
3.18 + </tr>
3.19 + <tr>
3.20 + <td align="center" bgcolor="#00B000">0 – 2</td>
3.21 + <td align="center" bgcolor="#00B000">niedrig</td>
3.22 + <td style="padding-left:25px;">Kein Schutz erforderlich</td>
3.23 + </tr>
3.24 + <tr>
3.25 + <td align="center" bgcolor="#FFFF00">3 – 5</td>
3.26 + <td align="center" bgcolor="#FFFF00">mäßig</td>
3.27 + <td style="padding-left:25px;">Schutz erforderlich: Hut, T-Shirt, Sonnenbrille, Sonnencreme</td>
3.28 + </tr>
3.29 + <tr>
3.30 + <td align="center" bgcolor="#F87820">6 – 7</td>
3.31 + <td align="center" bgcolor="#F87820">hoch</td>
3.32 + <td style="padding-left:25px;">Schutz erforderlich: Hut, T-Shirt, Sonnenbrille, Sonnencreme</td>
3.33 + </tr>
3.34 + <tr>
3.35 + <td align="center" bgcolor="#FF0000">8 – 10</td>
3.36 + <td align="center" bgcolor="#FF0000">sehr hoch</td>
3.37 + <td style="padding-left:25px;">zusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden</td>
3.38 + </tr>
3.39 + <tr>
3.40 + <td align="center" bgcolor="#7F00FF">≥ 11</td>
3.41 + <td align="center" bgcolor="#7F00FF">extrem</td>
3.42 + <td style="padding-left:25px;">zusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden</td>
3.43 + </tr>
3.44 +</table>
3.45 +<h6>Quelle: <a href="https://www.bag.admin.ch/bag/de/home/gesund-leben/umwelt-und-gesundheit/strahlung-radioaktivitaet-schall/elektromagnetische-felder-emf-uv-laser-licht/sonne_uv-strahlung/uv-index.html">
3.46 + Schweizerisches Bundesamt für Gesundheit</a></h6>
3.47 +
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/templates/en/html/ozoneloss_uvi_form.html Mon Feb 03 17:20:42 2020 +0100
4.3 @@ -0,0 +1,29 @@
4.4 +<form method="post" action="/ozoneloss/uvi_graph">
4.5 +<table border="0" width="100%">
4.6 + <tr> <h4>
4.7 + <p> UV index for
4.8 + <select name="Dobson-Unit" size="1" font-size="14" border-color="gray">
4.9 + <option>25</option>
4.10 + <option selected>50</option>
4.11 + <option>75</option>
4.12 + <option>100</option>
4.13 + <option>125</option>
4.14 + </select>
4.15 + DU additional ozone loss at latitude
4.16 + <select name="Gradzahl" size="1" font-size="14" border-color="gray">
4.17 + <option>80° N</option>
4.18 + <option>70° N</option>
4.19 + <option>60° N</option>
4.20 + <option selected> 50° N</option>
4.21 + <option>50° S</option>
4.22 + <option>60° S</option>
4.23 + <option>70° S</option>
4.24 + <option>80° S</option>
4.25 + </select>
4.26 + :
4.27 + <input type="submit" value="Graph anzeigen" font-color="black" font-size="16" border-color="gray"/>
4.28 + </p>
4.29 + </h4>
4.30 +</tr>
4.31 +</table>
4.32 +</form>
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/templates/en/html/uvi_table.html Mon Feb 03 17:20:42 2020 +0100
5.3 @@ -0,0 +1,44 @@
5.4 +
5.5 +The table below gives an indication of the importance of the different UV indices:
5.6 +<br>
5.7 +<br>
5.8 +<table border="black">
5.9 + <colgroup>
5.10 + <col width="100">
5.11 + <col width="100">
5.12 + <col width="400">
5.13 + </colgroup>
5.14 + <tr>
5.15 + <th align="center" bgcolor="#E0E0E0">UV-Index</th>
5.16 + <th align="center" bgcolor="#E0E0E0">Evaluation</th>
5.17 + <th align="center" bgcolor="#E0E0E0">Protection</th>
5.18 + </tr>
5.19 + <tr>
5.20 + <td align="center" bgcolor="#00B000">0 – 2</td>
5.21 + <td align="center" bgcolor="#00B000">low</td>
5.22 + <td style="padding-left:25px;"> No protection required</td>
5.23 + </tr>
5.24 + <tr>
5.25 + <td align="center" bgcolor="#FFFF00">3 – 5</td>
5.26 + <td align="center" bgcolor="#FFFF00">moderate</td>
5.27 + <td style="padding-left:25px;">Protection required: hat, T-shirt, sunglasses, sunscreen</td>
5.28 + </tr>
5.29 + <tr>
5.30 + <td align="center" bgcolor="#F87820">6 – 7</td>
5.31 + <td align="center" bgcolor="#F87820">high</td>
5.32 + <td style="padding-left:25px;">Protection required: hat, T-shirt, sunglasses, sunscreen</td>
5.33 + </tr>
5.34 + <tr>
5.35 + <td align="center" bgcolor="#FF0000">8 – 10</td>
5.36 + <td align="center" bgcolor="#FF0000">very high</td>
5.37 + <td style="padding-left:25px;">additional protection required: avoid staying outside if possible</td>
5.38 + </tr>
5.39 + <tr>
5.40 + <td align="center" bgcolor="#7F00FF">≥ 11</td>
5.41 + <td align="center" bgcolor="#7F00FF">extreme</td>
5.42 + <td style="padding-left:25px;">additional protection required: avoid staying outside if possible</td>
5.43 + </tr>
5.44 +</table>
5.45 +<h6>Source: <a href="https://www.bag.admin.ch/bag/de/home/gesund-leben/umwelt-und-gesundheit/strahlung-radioaktivitaet-schall/elektromagnetische-felder-emf-uv-laser-licht/sonne_uv-strahlung/uv-index.html">
5.46 + Schweizerisches Bundesamt für Gesundheit</a></h6>
5.47 +
6.1 --- a/templates/graph.html Mon Feb 03 16:20:55 2020 +0100
6.2 +++ b/templates/graph.html Mon Feb 03 17:20:42 2020 +0100
6.3 @@ -54,7 +54,7 @@
6.4 <option>80° S</option>
6.5 </select>
6.6 :
6.7 - <input type="submit" value="Graph anzeigen" font-color="black" font-size="16" border-color="gray"/>
6.8 + <input type="submit" value="{{button_text}}" font-color="black" font-size="16" border-color="gray"/>
6.9 </p>
6.10 </h4>
6.11 </tr>
6.12 @@ -62,52 +62,10 @@
6.13 </form>
6.14 <br>
6.15 <img src="/static/images/uvindex/{{figname}}" border="6">
6.16 -
6.17 <br>
6.18 +{{ html_table|safe }}
6.19 <br>
6.20 -
6.21 -Die unten stehenden Tabelle gibt einen Anhaltspunkt für die Bedeutung der verschiedenen UV-Indices:
6.22 <br>
6.23 -<br>
6.24 -<table border="black">
6.25 - <colgroup>
6.26 - <col width="100">
6.27 - <col width="100">
6.28 - <col width="400">
6.29 - </colgroup>
6.30 - <tr>
6.31 - <th align="center" bgcolor="#E0E0E0">UV-Index</th>
6.32 - <th align="center" bgcolor="#E0E0E0">Bewertung</th>
6.33 - <th align="center" bgcolor="#E0E0E0">Schutz</th>
6.34 - </tr>
6.35 - <tr>
6.36 - <td align="center" bgcolor="#00B000">0 – 2</td>
6.37 - <td align="center" bgcolor="#00B000">niedrig</td>
6.38 - <td style="padding-left:25px;">Kein Schutz erforderlich</td>
6.39 - </tr>
6.40 - <tr>
6.41 - <td align="center" bgcolor="#FFFF00">3 – 5</td>
6.42 - <td align="center" bgcolor="#FFFF00">mäßig</td>
6.43 - <td style="padding-left:25px;">Schutz erforderlich: Hut, T-Shirt, Sonnenbrille, Sonnencreme</td>
6.44 - </tr>
6.45 - <tr>
6.46 - <td align="center" bgcolor="#F87820">6 – 7</td>
6.47 - <td align="center" bgcolor="#F87820">hoch</td>
6.48 - <td style="padding-left:25px;">Schutz erforderlich: Hut, T-Shirt, Sonnenbrille, Sonnencreme</td>
6.49 - </tr>
6.50 - <tr>
6.51 - <td align="center" bgcolor="#FF0000">8 – 10</td>
6.52 - <td align="center" bgcolor="#FF0000">sehr hoch</td>
6.53 - <td style="padding-left:25px;">zusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden</td>
6.54 - </tr>
6.55 - <tr>
6.56 - <td align="center" bgcolor="#7F00FF">≥ 11</td>
6.57 - <td align="center" bgcolor="#7F00FF">extrem</td>
6.58 - <td style="padding-left:25px;">zusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden</td>
6.59 - </tr>
6.60 -</table>
6.61 -<h6>Quelle: Schweizerisches Bundesamt für Gesundheit <a href="http://www.uv-index.ch/de/uvindex.html"> www.uv-index.ch/de/uvindex.html</a></h6>
6.62 -
6.63
6.64 <div class="row">
6.65 {{ content_explanation|safe }}
7.1 --- a/templates/ozoneloss_uvi.html Mon Feb 03 16:20:55 2020 +0100
7.2 +++ b/templates/ozoneloss_uvi.html Mon Feb 03 17:20:42 2020 +0100
7.3 @@ -9,83 +9,13 @@
7.4
7.5 <br>
7.6
7.7 -<form method="post" action="/ozoneloss/uvi_graph">
7.8 -<table border="0" width="100%">
7.9 - <tr> <h4>
7.10 - <p> UV-Index für
7.11 - <select name="Dobson-Unit" size="1" font-size="14" border-color="gray">
7.12 - <option>25</option>
7.13 - <option selected>50</option>
7.14 - <option>75</option>
7.15 - <option>100</option>
7.16 - <option>125</option>
7.17 - </select>
7.18 - DU zusätzlichen Ozonverlust bei der Breite
7.19 - <select name="Gradzahl" size="1" font-size="14" border-color="gray">
7.20 - <option>80° N</option>
7.21 - <option>70° N</option>
7.22 - <option>60° N</option>
7.23 - <option selected> 50° N</option>
7.24 - <option>50° S</option>
7.25 - <option>60° S</option>
7.26 - <option>70° S</option>
7.27 - <option>80° S</option>
7.28 - </select>
7.29 - :
7.30 - <input type="submit" value="Graph anzeigen" font-color="black" font-size="16" border-color="gray"/>
7.31 - </p>
7.32 - </h4>
7.33 -</tr>
7.34 -</table>
7.35 -</form>
7.36 +{{ html_content|safe }}
7.37 <br>
7.38 -<img src="/static/images/uvindex/{{figname}}" alt="{{ alt }}" border="6">
7.39 -
7.40 +<img src="/static/images/uvindex/{{ figname }}" alt="{{ alt }}" border="6">
7.41 <br>
7.42 +{{ html_table|safe }}
7.43 <br>
7.44 -
7.45 -Die unten stehenden Tabelle gibt einen Anhaltspunkt für die Bedeutung der verschiedenen UV-Indices:
7.46 <br>
7.47 -<br>
7.48 -<table border="black">
7.49 - <colgroup>
7.50 - <col width="100">
7.51 - <col width="100">
7.52 - <col width="400">
7.53 - </colgroup>
7.54 - <tr>
7.55 - <th align="center" bgcolor="#E0E0E0">UV-Index</th>
7.56 - <th align="center" bgcolor="#E0E0E0">Bewertung</th>
7.57 - <th align="center" bgcolor="#E0E0E0">Schutz</th>
7.58 - </tr>
7.59 - <tr>
7.60 - <td align="center" bgcolor="#00B000">0 – 2</td>
7.61 - <td align="center" bgcolor="#00B000">niedrig</td>
7.62 - <td style="padding-left:25px;">Kein Schutz erforderlich</td>
7.63 - </tr>
7.64 - <tr>
7.65 - <td align="center" bgcolor="#FFFF00">3 – 5</td>
7.66 - <td align="center" bgcolor="#FFFF00">mäßig</td>
7.67 - <td style="padding-left:25px;">Schutz erforderlich: Hut, T-Shirt, Sonnenbrille, Sonnencreme</td>
7.68 - </tr>
7.69 - <tr>
7.70 - <td align="center" bgcolor="#F87820">6 – 7</td>
7.71 - <td align="center" bgcolor="#F87820">hoch</td>
7.72 - <td style="padding-left:25px;">Schutz erforderlich: Hut, T-Shirt, Sonnenbrille, Sonnencreme</td>
7.73 - </tr>
7.74 - <tr>
7.75 - <td align="center" bgcolor="#FF0000">8 – 10</td>
7.76 - <td align="center" bgcolor="#FF0000">sehr hoch</td>
7.77 - <td style="padding-left:25px;">zusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden</td>
7.78 - </tr>
7.79 - <tr>
7.80 - <td align="center" bgcolor="#7F00FF">≥ 11</td>
7.81 - <td align="center" bgcolor="#7F00FF">extrem</td>
7.82 - <td style="padding-left:25px;">zusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden</td>
7.83 - </tr>
7.84 -</table>
7.85 -<h6>Quelle: Schweizerisches Bundesamt für Gesundheit <a href="http://www.uv-index.ch/de/uvindex.html"> www.uv-index.ch/de/uvindex.html</a></h6>
7.86 -
7.87
7.88 <div class="row">
7.89 {{ content_explanation|safe }}
8.1 --- a/templates/ozoneloss_uvmap.html Mon Feb 03 16:20:55 2020 +0100
8.2 +++ b/templates/ozoneloss_uvmap.html Mon Feb 03 17:20:42 2020 +0100
8.3 @@ -23,6 +23,7 @@
8.4 <br>
8.5
8.6 Die unten stehenden Tabelle gibt einen Anhaltspunkt für die Bedeutung der verschiedenen UV-Indices:
8.7 +
8.8 <br>
8.9 <br>
8.10 <table border="black">
8.11 @@ -62,7 +63,8 @@
8.12 <td style="padding-left:25px;">zusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden</td>
8.13 </tr>
8.14 </table>
8.15 -<h6>Quelle: Schweizerisches Bundesamt für Gesundheit <a href="http://www.uv-index.ch/de/uvindex.html"> www.uv-index.ch/de/uvindex.html</a></h6>
8.16 +<h6>Quelle: <a href="https://www.bag.admin.ch/bag/de/home/gesund-leben/umwelt-und-gesundheit/strahlung-radioaktivitaet-schall/elektromagnetische-felder-emf-uv-laser-licht/sonne_uv-strahlung/uv-index.html">
8.17 + Schweizerisches Bundesamt für Gesundheit</a></h6>
8.18 </div>
8.19 </div>
8.20
9.1 Binary file translations/de/LC_MESSAGES/messages.mo has changed
10.1 --- a/translations/de/LC_MESSAGES/messages.po Mon Feb 03 16:20:55 2020 +0100
10.2 +++ b/translations/de/LC_MESSAGES/messages.po Mon Feb 03 17:20:42 2020 +0100
10.3 @@ -114,7 +114,7 @@
10.4 #: eskp.py:303
10.5 #, fuzzy
10.6 msgid "UV increase at {{lat}} degrees N for {{o3offset}} DU ozone depletion"
10.7 -msgstr "UV Anstieg bei 52 Grad N für 50 DU Ozonverlust"
10.8 +msgstr "UV Anstieg bei {{lat}} Grad N für {{o3offset}} DU Ozonverlust"
10.9
10.10 #: eskp.py:375
10.11 #, python-format
10.12 @@ -125,6 +125,5 @@
10.13 msgid "This information is not available!"
10.14 msgstr "Diese Information steht nicht zur Verfügung"
10.15
10.16 -#~ msgid "UV increase at 52 degrees N for 50 DU ozone depletion"
10.17 -#~ msgstr "UV Anstieg bei 52 Grad N für 50 DU Ozonverlust"
10.18 -
10.19 +msgid "Graph anzeigen"
10.20 +msgstr "Graph anzeigen"
11.1 Binary file translations/en/LC_MESSAGES/messages.mo has changed
12.1 --- a/translations/en/LC_MESSAGES/messages.po Mon Feb 03 16:20:55 2020 +0100
12.2 +++ b/translations/en/LC_MESSAGES/messages.po Mon Feb 03 17:20:42 2020 +0100
12.3 @@ -80,3 +80,5 @@
12.4 msgid "This information is not available!"
12.5 msgstr "This information is not available!"
12.6
12.7 +msgid "Graph anzeigen"
12.8 +msgstr "Show figure"