Commit 5c9ba672 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch 'devel_11.1.x-clean'

parents bfaf1fc3 184b25f5
Pipeline #6354 passed with stages
in 8 minutes and 55 seconds
......@@ -82,12 +82,17 @@ minerva (12.0.0~alpha.0) unstable; urgency=medium
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 21 Feb 2018 12:00:00 +0200
minerva (11.1.0) stable; urgency=high
* User can provide Google Maps API key that must be registered in google
cloud account
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 14 May 2018 9:00:00 +0200
minerva (11.0.10) stable; urgency=medium
* Bug fix: link from overview image to search result was broken
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 16 Apr 2018 15:00:00 +0200
minerva (11.0.9) stable; urgency=medium
* Bug fix: some comment couldn't be loaded
* Bug fix: when adding comment it didn't appear on map immediately
......
......@@ -3,6 +3,7 @@
var ConfigurationType = {
DEFAULT_MAP: "DEFAULT_MAP",
GOOGLE_ANALYTICS_IDENTIFIER: "GOOGLE_ANALYTICS_IDENTIFIER",
GOOGLE_MAPS_API_KEY: "GOOGLE_MAPS_API_KEY",
LOGO_IMG: "LOGO_IMG",
LOGO_LINK: "LOGO_LINK",
LOGO_TEXT: "LOGO_TEXT",
......
......@@ -1742,7 +1742,8 @@ ServerConnector.updateOverlay = function (overlay) {
description: overlay.getDescription(),
creator: overlay.getCreator(),
publicOverlay: overlay.getPublicOverlay(),
defaultOverlay: overlay.isDefaultOverlay()
defaultOverlay: overlay.isDefaultOverlay(),
googleLicenseConsent : overlay.isGoogleLicenseConsent()
}
};
return self.sendPatchRequest(self.updateOverlayUrl(queryParams), filterParams);
......
......@@ -166,6 +166,8 @@ Panel.prototype.assignDialogOptions = function (div, params) {
dialog.dialog('option', 'dialogClass', params[key]);
} else if (key === "title") {
dialog.dialog('option', 'title', params[key]);
} else if (key === "width") {
dialog.dialog('option', 'width', params[key]);
} else {
throw new Error("Unknown dialog param: " + key + " - " + params[key]);
}
......
......@@ -316,4 +316,12 @@ LeftPanel.prototype.destroy = function () {
return Promise.all(promises);
};
LeftPanel.prototype.setGoogleLicenseConsentRequired = function (value) {
this._googleLicenseConsentRequired = value;
};
LeftPanel.prototype.isGoogleLicenseConsentRequired = function () {
return this._googleLicenseConsentRequired;
};
module.exports = LeftPanel;
......@@ -141,8 +141,6 @@ OverlayPanel.prototype._createOverlayPanelGui = function () {
content: "Add overlay"
});
centerTag.appendChild(addOverlayButton);
this.setControlElement(PanelControlElementType.OVERLAY_ADD_OVERLAY_BUTTON, addOverlayButton);
};
......@@ -183,7 +181,7 @@ OverlayPanel.prototype.createTableHeader = function (edit) {
return result;
};
OverlayPanel.prototype.createOverlayRow = function (overlay, checked) {
OverlayPanel.prototype.createOverlayRow = function (overlay, checked, disabled) {
var self = this;
var guiUtils = self.getGuiUtils();
var result = document.createElement("tr");
......@@ -204,6 +202,7 @@ OverlayPanel.prototype.createOverlayRow = function (overlay, checked) {
data: overlay.getId()
});
checkbox.checked = checked;
$(checkbox).prop("disabled", disabled);
viewTd.appendChild(checkbox);
} else {
var img = guiUtils.createIcon("icons/search.png");
......@@ -285,12 +284,21 @@ OverlayPanel.prototype.openEditOverlayDialog = function (overlay) {
row = guiUtils.createTableRow([guiUtils.createLabel("Description: "), descriptionInput]);
content.appendChild(row);
var consentCheckbox = document.createElement("input");
consentCheckbox.type = "checkbox";
consentCheckbox.checked = overlay.isGoogleLicenseConsent();
row = guiUtils.createTableRow([guiUtils.createLabel("I am aware that this map is displayed under the terms of the <a href='https://cloud.google.com/maps-platform/terms/' target='_blank'>license of Google Maps Platform</a> and I agree to these terms. " +
"In particular, I warrant that this dataset does not contain Protected Health Information (as defined in and subject to HIPAA). "), consentCheckbox]);
content.appendChild(row);
var buttons = [{
text: "SAVE",
click: function () {
var windowSelf = this;
overlay.setName(nameInput.value);
overlay.setDescription(descriptionInput.value);
overlay.setGoogleLicenseConsent(consentCheckbox.checked);
return ServerConnector.updateOverlay(overlay).then(function () {
return self.refresh();
}).then(function () {
......@@ -318,6 +326,7 @@ OverlayPanel.prototype.openEditOverlayDialog = function (overlay) {
}
}];
self.openDialog(content, {
width: "600px",
id: overlay.getId(),
buttons: buttons,
title: "Data overlay: " + overlay.getName(),
......@@ -377,7 +386,7 @@ OverlayPanel.prototype.refresh = function (showDefault) {
table.appendChild(body);
for (i = 0; i < generalOverlays.length; i++) {
overlay = generalOverlays[i];
body.appendChild(self.createOverlayRow(overlay, selectedOverlay[overlay.getId()]));
body.appendChild(self.createOverlayRow(overlay, selectedOverlay[overlay.getId()], false));
}
var title = self.getControlElement(PanelControlElementType.OVERLAY_CUSTOM_OVERLAY_TITLE);
......@@ -406,12 +415,16 @@ OverlayPanel.prototype.refresh = function (showDefault) {
}
}).DataTable();
var data = [];
self.setGoogleLicenseConsentRequired(false);
for (i = 0; i < customOverlays.length; i++) {
overlay = customOverlays[i];
if (showDefault && overlay.isDefaultOverlay()) {
selectedOverlay[overlay.getId()] = true;
}
data.push(self.overlayToDataRow(overlay, selectedOverlay[overlay.getId()]));
data.push(self.overlayToDataRow(overlay, selectedOverlay[overlay.getId()], !overlay.isGoogleLicenseConsent()));
if (!overlay.isGoogleLicenseConsent()) {
self.setGoogleLicenseConsentRequired(true);
}
}
table.clear().rows.add(data).draw();
......@@ -532,4 +545,10 @@ OverlayPanel.prototype.destroy = function () {
}
};
OverlayPanel.prototype.setGoogleLicenseConsentRequired = function (value) {
var leftPanel = this.getParent();
if (leftPanel !== undefined) {
leftPanel.setGoogleLicenseConsentRequired(value);
}
};
module.exports = OverlayPanel;
......@@ -26,6 +26,7 @@ function DataOverlay(overlayId, name) {
this.setFilename(object.filename);
this.setPublicOverlay(object.publicOverlay);
this.setDefaultOverlay(object.defaultOverlay);
this.setGoogleLicenseConsent(object.googleLicenseConsent);
this.setInputDataAvailable(object.inputDataAvailable);
this.setType(object.type);
if (!this.getInputDataAvailable()) {
......@@ -241,6 +242,14 @@ DataOverlay.prototype.setType = function (type) {
this._type = type;
};
DataOverlay.prototype.setGoogleLicenseConsent = function(value) {
this._googleLicenseConsent = value;
};
DataOverlay.prototype.isGoogleLicenseConsent = function() {
return this._googleLicenseConsent;
};
DataOverlay.prototype.update = function (overlay) {
this.setName(overlay.getName());
this.setDescription(overlay.getDescription());
......
......@@ -246,12 +246,13 @@ function create(params) {
params.getElement().innerHTML = "<div style='vertical-align:middle;display:table-cell;text-align: center'>"
+ "<img src='resources/images/icons/ajax-loader.gif'/>" + "</div>";
// make sure that we are logged in
// make sure that we are logged in
return ServerConnector.createSession().then(function () {
return ServerConnector.getConfiguration();
}).then(function (configuration) {
params.setConfiguration(configuration);
return functions.loadScript("https://maps.google.com/maps/api/js?libraries=drawing&v=3.26&key=" + configuration.getOption(ConfigurationType.GOOGLE_MAPS_API_KEY));
}).then(function () {
return getProject(params);
}).then(function (project) {
if (project === null) {
......@@ -353,6 +354,9 @@ function create(params) {
}
return Promise.all(promises);
}).then(function () {
if (leftPanel.isGoogleLicenseConsentRequired()) {
GuiConnector.alert("Some data overlays doesn't have consent to the terms of the <a href='https://cloud.google.com/maps-platform/terms/' target='_blank'>license of Google Maps Platform</a>. To be able to visualize them you must edit data overlay. ")
}
var result = {
destroy: function () {
return leftPanel.destroy().then(function () {
......@@ -538,6 +542,8 @@ function createExport(params) {
// make sure that we are logged in
return ServerConnector.getConfiguration().then(function (configuration) {
params.setConfiguration(configuration);
return functions.loadScript("https://maps.google.com/maps/api/js?libraries=drawing&v=3.26&key=" + configuration.getOption(ConfigurationType.GOOGLE_MAPS_API_KEY));
}).then(function () {
return getProject(params);
}).then(function (project) {
params.setProject(project);
......@@ -568,6 +574,8 @@ function createAdmin(params) {
return ServerConnector.getConfiguration();
}).then(function (configuration) {
params.setConfiguration(configuration);
return functions.loadScript("https://maps.google.com/maps/api/js?libraries=drawing&v=3.26&key=" + configuration.getOption(ConfigurationType.GOOGLE_MAPS_API_KEY));
}).then(function () {
result = new Admin(params);
return createFooter();
}).then(function (footer) {
......
......@@ -94,6 +94,9 @@ public class Layout implements Serializable {
*/
private boolean hierarchicalView = false;
@Column(name="google_license_consent")
private boolean googleLicenseConsent = false;
/**
* If overlay contain hierarchical view then it might be fixed on some specific
* level. This parameter defines the level at which it's fixed or contains null
......@@ -487,4 +490,12 @@ public class Layout implements Serializable {
this.orderIndex = orderIndex;
}
public boolean isGoogleLicenseConsent() {
return googleLicenseConsent;
}
public void setGoogleLicenseConsent(boolean googleLicenseConsent) {
this.googleLicenseConsent = googleLicenseConsent;
}
}
......@@ -188,6 +188,12 @@ public enum ConfigurationElementType {
SHOW_REACTION_TYPE("Show reaction type when browsing map", "true",
ConfigurationElementEditType.BOOLEAN, false, ConfigurationElementTypeGroup.LEGEND_AND_LOGO),
GOOGLE_MAPS_API_KEY("By providing this Google Maps Platform API key I declare that I am aware that "
+ "I am a Customer of the Google Maps Platform and I agree to the terms of the <a href=\"https://cloud.google.com/maps-platform/terms/\" target='_blank'>license of Google Maps Platform</a>." +
"In particular, I warrant that neither any of the maps nor publicly available data overlays "
+ "(\"General overlays\") on this MINERVA server contain Protected Health Information (as defined in and subject to HIPAA).",
"", ConfigurationElementEditType.STRING, false, ConfigurationElementTypeGroup.SERVER_CONFIGURATION),
;
/**
......@@ -211,7 +217,7 @@ public enum ConfigurationElementType {
/**
* Default constructor.
*
*
* @param commonName
* common name used for this parameter
* @param editType
......
alter table layout add column google_license_consent boolean default false;
......@@ -214,6 +214,8 @@ public class OverlayRestImpl extends BaseRestImpl {
layout.setPublicLayout(parseBoolean(value));
} else if (key.equalsIgnoreCase("defaultOverlay")) {
layout.setDefaultOverlay(parseBoolean(value));
} else if (key.equalsIgnoreCase("googleLicenseConsent")) {
layout.setGoogleLicenseConsent((Boolean) overlayData.get("googleLicenseConsent"));
} else if (key.equalsIgnoreCase("creator")) {
if ("".equals(value)) {
layout.setCreator(null);
......
......@@ -10,9 +10,6 @@
<h:head>
<!-- Google Maps API version 3.20 -->
<script src="https://maps.google.com/maps/api/js?libraries=drawing" type="text/javascript"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" type="text/javascript"/>
<script src="https://twitter.github.io/typeahead.js/releases/latest/typeahead.bundle.min.js" type="text/javascript"/>
......@@ -20,12 +17,12 @@
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/rowreorder/1.2.3/js/dataTables.rowReorder.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css"/>
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/rowreorder/1.2.3/css/rowReorder.dataTables.min.css"/>
<link rel="shortcut icon" href="./resources/images/favicon.png" type="image/png" />
<h:outputScript library="js" name="minerva.js" />
......
......@@ -11,10 +11,6 @@
<link rel="shortcut icon" href="./resources/images/favicon.png"
type="image/png" />
<script
src="https://maps.google.com/maps/api/js?libraries=drawing&amp;v=3.26"
type="text/javascript" />
<script src="https://code.jquery.com/jquery-1.12.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
......@@ -36,7 +32,7 @@
function init() {
var element = document.getElementById('minervaAppDiv');
return minerva.createLogin({
element : element,
element : element,
}).catch(function(rejectReason){
minerva.GuiConnector.alert(rejectReason, true);
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment