Skip to content
Snippets Groups Projects
Commit 9acd00c2 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Added handling of observation with hidden location

parent 2fde14de
No related branches found
No related tags found
No related merge requests found
No preview for this file type
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-28 13:03-0700\n" "POT-Creation-Date: 2017-03-13 15:02-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -26,15 +26,15 @@ msgstr "" ...@@ -26,15 +26,15 @@ msgstr ""
msgid "View all observations" msgid "View all observations"
msgstr "" msgstr ""
#: templates/observations/detail.html:32 templates/observations/index.html:44 #: templates/observations/detail.html:32 templates/observations/index.html:53
msgid "Organism" msgid "Organism"
msgstr "" msgstr ""
#: templates/observations/detail.html:34 templates/observations/index.html:45 #: templates/observations/detail.html:34 templates/observations/index.html:54
msgid "Crop" msgid "Crop"
msgstr "" msgstr ""
#: templates/observations/detail.html:36 templates/observations/index.html:43 #: templates/observations/detail.html:36 templates/observations/index.html:52
msgid "Time of observation" msgid "Time of observation"
msgstr "" msgstr ""
...@@ -50,6 +50,14 @@ msgstr "" ...@@ -50,6 +50,14 @@ msgstr ""
msgid "Observation was not quantified" msgid "Observation was not quantified"
msgstr "" msgstr ""
#: templates/observations/detail.html:116
msgid "Location is hidden"
msgstr ""
#: templates/observations/detail.html:117
msgid "The observer has requested that the location is hidden"
msgstr ""
#: templates/observations/index.html:25 templates/observations/index.html:28 #: templates/observations/index.html:25 templates/observations/index.html:28
msgid "Observations" msgid "Observations"
msgstr "" msgstr ""
...@@ -58,10 +66,14 @@ msgstr "" ...@@ -58,10 +66,14 @@ msgstr ""
msgid "All pests" msgid "All pests"
msgstr "" msgstr ""
#: templates/observations/index.html:46 #: templates/observations/index.html:55
msgid "Heading" msgid "Heading"
msgstr "" msgstr ""
#: templates/observations/index.html:86 #: templates/observations/index.html:82
msgid "Crops"
msgstr ""
#: templates/observations/index.html:112
msgid "View details" msgid "View details"
msgstr "" msgstr ""
No preview for this file type
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-06 10:13+0200\n" "POT-Creation-Date: 2017-03-13 15:02-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -28,17 +28,17 @@ msgid "View all observations" ...@@ -28,17 +28,17 @@ msgid "View all observations"
msgstr "Se alle observasjoner" msgstr "Se alle observasjoner"
#: templates/observations/detail.html:32 #: templates/observations/detail.html:32
#: templates/observations/index.html:44 #: templates/observations/index.html:53
msgid "Organism" msgid "Organism"
msgstr "Organisme" msgstr "Organisme"
#: templates/observations/detail.html:34 #: templates/observations/detail.html:34
#: templates/observations/index.html:45 #: templates/observations/index.html:54
msgid "Crop" msgid "Crop"
msgstr "Kultur" msgstr "Kultur"
#: templates/observations/detail.html:36 #: templates/observations/detail.html:36
#: templates/observations/index.html:43 #: templates/observations/index.html:52
msgid "Time of observation" msgid "Time of observation"
msgstr "Observasjonstidspunkt" msgstr "Observasjonstidspunkt"
...@@ -54,6 +54,14 @@ msgstr "Observasjonsdata" ...@@ -54,6 +54,14 @@ msgstr "Observasjonsdata"
msgid "Observation was not quantified" msgid "Observation was not quantified"
msgstr "Observasjonen ble ikke kvantifisert" msgstr "Observasjonen ble ikke kvantifisert"
#: templates/observations/detail.html:116
msgid "Location is hidden"
msgstr "Plasseringen er skjult"
#: templates/observations/detail.html:117
msgid "The observer has requested that the location is hidden"
msgstr "Observatøren har bedt om at plasseringen skal være skjult"
#: templates/observations/index.html:25 #: templates/observations/index.html:25
#: templates/observations/index.html:28 #: templates/observations/index.html:28
msgid "Observations" msgid "Observations"
...@@ -63,11 +71,16 @@ msgstr "Observasjoner" ...@@ -63,11 +71,16 @@ msgstr "Observasjoner"
msgid "All pests" msgid "All pests"
msgstr "Alle organismer" msgstr "Alle organismer"
#: templates/observations/index.html:46 #: templates/observations/index.html:55
msgid "Heading" msgid "Heading"
msgstr "Overskrift" msgstr "Overskrift"
#: templates/observations/index.html:86 #: templates/observations/index.html:82
#, fuzzy
msgid "Crops"
msgstr "Kultur"
#: templates/observations/index.html:112
msgid "View details" msgid "View details"
msgstr "Se detaljer" msgstr "Se detaljer"
No preview for this file type
...@@ -7,7 +7,7 @@ msgid "" ...@@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-28 13:04-0700\n" "POT-Creation-Date: 2017-03-13 15:02-0700\n"
"PO-Revision-Date: 2016-10-27 11:26+0200\n" "PO-Revision-Date: 2016-10-27 11:26+0200\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
...@@ -25,15 +25,15 @@ msgstr "观测" ...@@ -25,15 +25,15 @@ msgstr "观测"
msgid "View all observations" msgid "View all observations"
msgstr "查看所有观测" msgstr "查看所有观测"
#: templates/observations/detail.html:32 templates/observations/index.html:44 #: templates/observations/detail.html:32 templates/observations/index.html:53
msgid "Organism" msgid "Organism"
msgstr "生物" msgstr "生物"
#: templates/observations/detail.html:34 templates/observations/index.html:45 #: templates/observations/detail.html:34 templates/observations/index.html:54
msgid "Crop" msgid "Crop"
msgstr "作物" msgstr "作物"
#: templates/observations/detail.html:36 templates/observations/index.html:43 #: templates/observations/detail.html:36 templates/observations/index.html:52
msgid "Time of observation" msgid "Time of observation"
msgstr "观测时间" msgstr "观测时间"
...@@ -49,6 +49,14 @@ msgstr "观测数据" ...@@ -49,6 +49,14 @@ msgstr "观测数据"
msgid "Observation was not quantified" msgid "Observation was not quantified"
msgstr "观测没有定量化" msgstr "观测没有定量化"
#: templates/observations/detail.html:116
msgid "Location is hidden"
msgstr ""
#: templates/observations/detail.html:117
msgid "The observer has requested that the location is hidden"
msgstr ""
#: templates/observations/index.html:25 templates/observations/index.html:28 #: templates/observations/index.html:25 templates/observations/index.html:28
msgid "Observations" msgid "Observations"
msgstr "观测" msgstr "观测"
...@@ -57,10 +65,16 @@ msgstr "观测" ...@@ -57,10 +65,16 @@ msgstr "观测"
msgid "All pests" msgid "All pests"
msgstr "所有病虫害" msgstr "所有病虫害"
#: templates/observations/index.html:46 #: templates/observations/index.html:55
msgid "Heading" msgid "Heading"
msgstr "标题" msgstr "标题"
#: templates/observations/index.html:86 #: templates/observations/index.html:82
#, fuzzy
#| msgid "Crop"
msgid "Crops"
msgstr "作物"
#: templates/observations/index.html:112
msgid "View details" msgid "View details"
msgstr "看细节" msgstr "看细节"
observations/static/observations/images/globe.png

85.5 KiB

...@@ -78,12 +78,12 @@ var initMap = function(geoJSON, poi, container, mapAttribution) ...@@ -78,12 +78,12 @@ var initMap = function(geoJSON, poi, container, mapAttribution)
var format = new ol.format.GeoJSON(); var format = new ol.format.GeoJSON();
console.log(JSON.parse(geoJSON)); //console.log(JSON.parse(geoJSON));
var drawnfeatures = format.readFeatures(JSON.parse(geoJSON), { var drawnfeatures = format.readFeatures(JSON.parse(geoJSON), {
dataProjection: 'EPSG:4326', dataProjection: 'EPSG:4326',
featureProjection: map.getView().getProjection().getCode() featureProjection: map.getView().getProjection().getCode()
}); });
console.log(drawnfeatures); //console.log(drawnfeatures);
// TODO: Convert small areas to points on large scale views // TODO: Convert small areas to points on large scale views
/** /**
...@@ -106,7 +106,7 @@ var initMap = function(geoJSON, poi, container, mapAttribution) ...@@ -106,7 +106,7 @@ var initMap = function(geoJSON, poi, container, mapAttribution)
extent = featureOverlay.getSource().getExtent(); extent = featureOverlay.getSource().getExtent();
map.getView().fit(extent, map.getSize()); map.getView().fit(extent, map.getSize());
} }
else else if(poi != null)
{ {
/*var poiLayer = new ol.layer.Vector({ /*var poiLayer = new ol.layer.Vector({
source: new ol.source.Vector({ source: new ol.source.Vector({
......
...@@ -91,17 +91,31 @@ ...@@ -91,17 +91,31 @@
var illustration = observation.observationIllustrationSet[0]; var illustration = observation.observationIllustrationSet[0];
document.getElementById("observationIllustration").innerHTML = "<img src='" + settings.vipslogicProtocol + "://" + settings.vipslogicServerName + "/static/images/observations/" + observation.organismId + "/" + illustration.observationIllustrationPK.fileName + "' class='img-responsive'/>"; document.getElementById("observationIllustration").innerHTML = "<img src='" + settings.vipslogicProtocol + "://" + settings.vipslogicServerName + "/static/images/observations/" + observation.organismId + "/" + illustration.observationIllustrationPK.fileName + "' class='img-responsive'/>";
} }
if(observation.locationPointOfInterestId > 0) if(!observation.locationIsPrivate)
{ {
$.getJSON(settings.vipslogicProtocol + "://" + settings.vipslogicServerName + "/rest/poi/" + observation.locationPointOfInterestId , function( poi ) { if(observation.locationPointOfInterestId > 0)
initMap(null,poi,"observationViewMap","{{settings.MAP_ATTRIBUTION|safe}}") {
}); $.getJSON(settings.vipslogicProtocol + "://" + settings.vipslogicServerName + "/rest/poi/" + observation.locationPointOfInterestId , function( poi ) {
initMap(null,poi,"observationViewMap","{{settings.MAP_ATTRIBUTION|safe}}")
});
}
else
{
initMap(observation.geoinfo,null,"observationViewMap","{{settings.MAP_ATTRIBUTION|safe}}");
}
} }
else else
{ {
initMap(observation.geoinfo,null,"observationViewMap","{{settings.MAP_ATTRIBUTION|safe}}"); renderLocationIsHiddenMessage();
} }
}); });
}); });
function renderLocationIsHiddenMessage(){
document.getElementById("observationViewMap").parentNode.innerHTML =
"<h2>{% trans "Location is hidden" %}</h2>" +
"<p>{% trans "The observer has requested that the location is hidden" %}</p>" +
"<p><img class='img-responsive' src='{% static "observations/images/globe.png" %}'/></p>";
}
</script> </script>
{% endblock %} {% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment