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