Commit 3fde5e76 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

fronted shows only datasets where user agreed to google license

parent 7d96fa50
......@@ -28,7 +28,7 @@
"istanbul": "0.4.5",
"jquery": "3.1.1",
"jquery-ui-dist": "^1.12.1",
"jsdom": "^11.1.0",
"jsdom": "11.1.0",
"jsdom-global": "^2.1.1",
"jshint": "^2.9.4",
"log4js-memory-appender": "1.0.5",
......
......@@ -44,7 +44,7 @@ ServerConnector.registerListenerType("onDataLoadStart");
ServerConnector.registerListenerType("onDataLoadStop");
ServerConnector._configurationParam = [];
ServerConnector._serverBaseUrl= undefined;
ServerConnector._serverBaseUrl = undefined;
ServerConnector.getMinOverlayColorInt = function () {
......@@ -275,8 +275,8 @@ ServerConnector.getApiBaseUrl = function () {
ServerConnector.getServerBaseUrl = function () {
if (this._serverBaseUrl === undefined) {
var url = "" + window.location.href;
if (url.indexOf("?")>=0) {
url = url.substr(0,url.indexOf("?"));
if (url.indexOf("?") >= 0) {
url = url.substr(0, url.indexOf("?"));
}
if (!url.endsWith("/")) {
url = url.substr(0, url.lastIndexOf("/") + 1);
......@@ -1264,6 +1264,9 @@ ServerConnector.updateOverlay = function (params) {
if (params.description !== undefined) {
filterParams.overlay.description = params.description;
}
if (params.googleLicenseConsent !== undefined) {
filterParams.overlay.googleLicenseConsent = params.googleLicenseConsent;
}
return self.getProjectId(params.projectId).then(function (result) {
queryParams.projectId = result;
return self.sendPatchRequest(self.updateOverlayUrl(queryParams), filterParams);
......
......@@ -190,6 +190,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]);
}
......
......@@ -141,7 +141,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");
......@@ -172,6 +172,7 @@ OverlayPanel.prototype.createOverlayRow = function (overlay, checked) {
$(thisCheckbox).prop("disabled", false);
});
};
$(checkbox).prop("disabled", disabled);
viewTd.appendChild(checkbox);
} else {
var img = guiUtils.createIcon("icons/search.png");
......@@ -230,6 +231,13 @@ 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/'>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 () {
......@@ -237,7 +245,8 @@ OverlayPanel.prototype.openEditOverlayDialog = function (overlay) {
return ServerConnector.updateOverlay({
overlayId: overlay.id,
name: nameInput.value,
description: descriptionInput.value
description: descriptionInput.value,
googleLicenseConsent: consentCheckbox.checked
}).then(function () {
return self.refresh();
}).then(function () {
......@@ -265,6 +274,7 @@ OverlayPanel.prototype.openEditOverlayDialog = function (overlay) {
}
}];
self.openDialog(content, {
width: "600px",
id: overlay.getId(),
buttons: buttons,
title: "Data overlay: " + overlay.getName(),
......@@ -317,7 +327,7 @@ OverlayPanel.prototype.refresh = function () {
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);
......@@ -342,7 +352,7 @@ OverlayPanel.prototype.refresh = function () {
table.appendChild(body);
for (i = 0; i < customOverlays.length; i++) {
overlay = customOverlays[i];
body.appendChild(self.createOverlayRow(overlay, selectedOverlay[overlay.getId()]));
body.appendChild(self.createOverlayRow(overlay, selectedOverlay[overlay.getId()], !overlay.isGoogleLicenseConsent()));
}
}
......
......@@ -23,6 +23,7 @@ function LayoutData(layoutId, name) {
this.setDirectory(object.directory);
this.setDescription(object.description);
this.setCreator(object.creator);
this.setGoogleLicenseConsent(object.googleLicenseConsent);
this.setInputDataAvailable(object.inputDataAvailable);
if (!this.getInputDataAvailable()) {
this.setInitialized(true);
......@@ -155,6 +156,15 @@ LayoutData.prototype.isInitialized = function() {
return this._initialized;
};
LayoutData.prototype.setGoogleLicenseConsent = function(value) {
this._googleLicenseConsent = value;
};
LayoutData.prototype.isGoogleLicenseConsent = function() {
return this._googleLicenseConsent;
};
LayoutData.prototype.getAliases = function() {
return this.aliases;
};
......
Supports Markdown
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