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

Add isPrivate to POI/WeatherStation

parent b329ffc9
Branches addIsPrivateToPOI-VIPSUTV-767
No related tags found
1 merge request!191Add map module and Open-Meteo support
...@@ -298,6 +298,8 @@ public class PointOfInterestController extends HttpServlet { ...@@ -298,6 +298,8 @@ public class PointOfInterestController extends HttpServlet {
{ {
weatherStation.setIsForecastLocation(Boolean.TRUE); weatherStation.setIsForecastLocation(Boolean.TRUE);
} }
weatherStation.setIsPrivate(formValidation.getFormField("isPrivate").getWebValue() != null);
Double altitude = 0.0; Double altitude = 0.0;
Point p2d = formValidation.getFormField("location").getValueAsPointWGS84(); Point p2d = formValidation.getFormField("location").getValueAsPointWGS84();
...@@ -657,6 +659,8 @@ public class PointOfInterestController extends HttpServlet { ...@@ -657,6 +659,8 @@ public class PointOfInterestController extends HttpServlet {
{ {
poi.setIsForecastLocation(Boolean.FALSE); poi.setIsForecastLocation(Boolean.FALSE);
} }
poi.setIsPrivate(formValidation.getFormField("isPrivate").getWebValue() != null);
Double altitude = 0.0; Double altitude = 0.0;
Point p2d = formValidation.getFormField("location").getValueAsPointWGS84(); Point p2d = formValidation.getFormField("location").getValueAsPointWGS84();
......
...@@ -91,8 +91,17 @@ public class PointOfInterest implements Serializable, Comparable { ...@@ -91,8 +91,17 @@ public class PointOfInterest implements Serializable, Comparable {
private Boolean isForecastLocation; private Boolean isForecastLocation;
private Integer pointOfInterestTypeId; private Integer pointOfInterestTypeId;
private Date lastEditedTime; private Date lastEditedTime;
private Boolean isPrivate;
@Column(name = "is_private")
public Boolean getIsPrivate() {
return isPrivate;
}
public void setIsPrivate(Boolean isPrivate) {
this.isPrivate = isPrivate;
}
// For attaching ad-hoc properties // For attaching ad-hoc properties
// e.g. Worst warning for map // e.g. Worst warning for map
private Map<String, Object> properties; private Map<String, Object> properties;
......
-- Adding this property when adding support for private POIs/weather datasources in VIPS
ALTER TABLE point_of_interest
ADD COLUMN is_private BOOLEAN DEFAULT FALSE;
-- Set all POIS not owned by a superuser or admin to is_private = TRUE
UPDATE point_of_interest
SET is_private=TRUE
WHERE user_id NOT IN
(
SELECT DISTINCT user_id FROM user_vips_logic_role
WHERE vips_logic_role_id IN (1,2)
);
\ No newline at end of file
...@@ -86,6 +86,11 @@ ...@@ -86,6 +86,11 @@
"name" : "isForecastLocation", "name" : "isForecastLocation",
"dataType" : "STRING", "dataType" : "STRING",
"required" : false "required" : false
},
{
"name" : "isPrivate",
"dataType" : "STRING",
"required" : false
} }
] ]
} }
...@@ -87,6 +87,11 @@ ...@@ -87,6 +87,11 @@
"dataType" : "STRING", "dataType" : "STRING",
"fieldType" : "MULTIPLE_MAP", "fieldType" : "MULTIPLE_MAP",
"required" : false "required" : false
},
{
"name" : "isPrivate",
"dataType" : "STRING",
"required" : false
} }
] ]
......
...@@ -81,6 +81,14 @@ ...@@ -81,6 +81,14 @@
<input type="text" class="form-control" name="name" placeholder="${i18nBundle.name}" value="${(poi.name)!""}" onblur="validateField(this); checkPoiNameAvailability(this);"/> <input type="text" class="form-control" name="name" placeholder="${i18nBundle.name}" value="${(poi.name)!""}" onblur="validateField(this); checkPoiNameAvailability(this);"/>
<span class="help-block" id="${formId}_name_validation"></span> <span class="help-block" id="${formId}_name_validation"></span>
</div> </div>
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" name="isPrivate"<#if poi.isPrivate?has_content && poi.isPrivate == true> checked="checked"<#else></#if>/>
</label>
${i18nBundle.isPrivate}
</div>
</div>
<div class="form-group"> <div class="form-group">
<label for="pointOfInterestTypeId">${i18nBundle.pointOfInterestType}</label> <label for="pointOfInterestTypeId">${i18nBundle.pointOfInterestType}</label>
<select class="form-control" name="pointOfInterestTypeId" onblur="validateField(this);"> <select class="form-control" name="pointOfInterestTypeId" onblur="validateField(this);">
......
...@@ -71,6 +71,14 @@ ...@@ -71,6 +71,14 @@
</label> </label>
</div> </div>
</div> </div>
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" name="isPrivate"<#if weatherStation.isPrivate?has_content && weatherStation.isPrivate == true> checked="checked"<#else></#if>/>
</label>
${i18nBundle.isPrivate}
</div>
</div>
<div class="form-group"> <div class="form-group">
<label for="location">${i18nBundle.location} (<a href="http://en.wikipedia.org/wiki/World_Geodetic_System#A_new_World_Geodetic_System:_WGS_84" target="new">WGS84</a>: ${i18nBundle.longitude},${i18nBundle.latitude})</label> <label for="location">${i18nBundle.location} (<a href="http://en.wikipedia.org/wiki/World_Geodetic_System#A_new_World_Geodetic_System:_WGS_84" target="new">WGS84</a>: ${i18nBundle.longitude},${i18nBundle.latitude})</label>
<input type="text" class="form-control" id="location" name="location" placeholder="${i18nBundle.location}" value="${(weatherStation.longitude?c)!""},${(weatherStation.latitude?c)!""}" onblur="validateField(this);" onchange="if(validateField(this)){updateMarkerPosition();}" /> <input type="text" class="form-control" id="location" name="location" placeholder="${i18nBundle.location}" value="${(weatherStation.longitude?c)!""},${(weatherStation.latitude?c)!""}" onblur="validateField(this);" onchange="if(validateField(this)){updateMarkerPosition();}" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment