diff --git a/src/main/java/com/databasepreservation/common/client/ViewerConstants.java b/src/main/java/com/databasepreservation/common/client/ViewerConstants.java
index 4be8400b3..fc0773601 100644
--- a/src/main/java/com/databasepreservation/common/client/ViewerConstants.java
+++ b/src/main/java/com/databasepreservation/common/client/ViewerConstants.java
@@ -522,18 +522,31 @@ public class ViewerConstants {
/**
* Template Engine
*/
+
public static final String OPEN_TEMPLATE_ENGINE = "{{";
public static final String CLOSE_TEMPLATE_ENGINE = "}}";
+ public static final String TEMPLATE_UV_LINK = "uv_link";
public static final String TEMPLATE_LOB_DOWNLOAD_LABEL = "download_label";
public static final String TEMPLATE_LOB_DOWNLOAD_LINK = "download_link";
public static final String TEMPLATE_LOB_ROW_INDEX = "row_index";
public static final String TEMPLATE_LOB_COLUMN_INDEX = "column_index";
public static final String TEMPLATE_LOB_AUTO_DETECTED_MIME_TYPE = "auto_detected_mime_type";
public static final String TEMPLATE_LOB_AUTO_DETECTED_EXTENSION = "auto_detected_extension";
+ public static final String DEFAULT_VIEWER_DOWNLOAD_LABEL_TEMPLATE = ""
+ + ViewerConstants.OPEN_TEMPLATE_ENGINE + ViewerConstants.TEMPLATE_LOB_DOWNLOAD_LABEL
+ + ViewerConstants.CLOSE_TEMPLATE_ENGINE + "";
public static final String DEFAULT_DOWNLOAD_LABEL_TEMPLATE = ""
+ ViewerConstants.OPEN_TEMPLATE_ENGINE + ViewerConstants.TEMPLATE_LOB_DOWNLOAD_LABEL
+ ViewerConstants.CLOSE_TEMPLATE_ENGINE + "";
+ public static final String DEFAULT_DETAILED_VIEWER_LABEL_TEMPLATE = "";
/**
* SIARD prefixes
@@ -569,4 +582,12 @@ public class ViewerConstants {
*/
private ViewerConstants() {
}
+
+ /**
+ * External viewer information
+ */
+
+ public static final String UV_EXTERNAL_VIEWER_SERVICE_NAME = "ui.viewer.universalViewer.service_name";
+ public static final String PRESENTATION_EXTERNAL_SERVICE_NAME = "ui.viewer.presentation.service_name";
+ public static final String VIEWER_ENABLED = "ui.viewer.enabled";
}
diff --git a/src/main/java/com/databasepreservation/common/client/common/lists/TableRowList.java b/src/main/java/com/databasepreservation/common/client/common/lists/TableRowList.java
index 2da9359cb..8b24e30e2 100644
--- a/src/main/java/com/databasepreservation/common/client/common/lists/TableRowList.java
+++ b/src/main/java/com/databasepreservation/common/client/common/lists/TableRowList.java
@@ -287,7 +287,6 @@ public SafeHtml getValue(ViewerRow row) {
String template = configColumn.getSearchStatus().getList().getTemplate().getTemplate();
if (template != null && !template.isEmpty()) {
String json = JSOUtils.cellsToJson(cells, nestedTable);
- GWT.log("json -> " + json);
String blob = getBlobKey(configColumn.getTypeName());
if (!blob.isEmpty() && json.contains(blob)) {
String tempTemplate = template.replace("{{" + blob + "}}", "");
@@ -295,8 +294,7 @@ public SafeHtml getValue(ViewerRow row) {
if (tempTemplate.isEmpty())
tempTemplate = messages.row_downloadLOB();
template = ""
- +
- tempTemplate + "";
+ + tempTemplate + "";
String s = JavascriptUtils.compileTemplate(template, json);
aggregationList.add(s);
}
@@ -320,7 +318,6 @@ public SafeHtml getValue(ViewerRow row) {
} else {
if (!aggregationList.isEmpty()) {
ret = SafeHtmlUtils.fromSafeConstant(aggregationList.get(0));
- GWT.log("ret -> " + ret.asString());
}
}
}
@@ -432,6 +429,7 @@ private SafeHtml getLobDownload(ViewerDatabase database, ColumnStatus configColu
String template = configColumn.getSearchStatus().getList().getTemplate().getTemplate();
if (template != null && !template.isEmpty()) {
String json = JSOUtils.cellsToJson(ViewerConstants.TEMPLATE_LOB_DOWNLOAD_LABEL, messages.row_downloadLOB(),
+ ViewerConstants.TEMPLATE_UV_LINK, RestUtils.createUVLob(),
ViewerConstants.TEMPLATE_LOB_DOWNLOAD_LINK, RestUtils.createExportLobUri(database.getUuid(),
table.getSchemaName(), table.getName(), row.getUuid(), columnIndex));
return SafeHtmlUtils.fromSafeConstant(JavascriptUtils.compileTemplate(template, json));
diff --git a/src/main/java/com/databasepreservation/common/client/common/visualization/browse/RowPanel.java b/src/main/java/com/databasepreservation/common/client/common/visualization/browse/RowPanel.java
index 59cb0dcaa..1625f8fe3 100644
--- a/src/main/java/com/databasepreservation/common/client/common/visualization/browse/RowPanel.java
+++ b/src/main/java/com/databasepreservation/common/client/common/visualization/browse/RowPanel.java
@@ -17,7 +17,6 @@
import java.util.TreeMap;
import java.util.TreeSet;
-import com.databasepreservation.common.client.models.structure.ViewerPrimaryKey;
import org.roda.core.data.v2.index.sublist.Sublist;
import com.databasepreservation.common.client.ClientConfigurationManager;
@@ -335,6 +334,7 @@ private void getCellHTML(ViewerColumn column, Set[ relatedTo, Set][ refer
String template = columnStatus.getDetailsStatus().getTemplateStatus().getTemplate();
if (template != null && !template.isEmpty()) {
String json = JSOUtils.cellsToJson(ViewerConstants.TEMPLATE_LOB_DOWNLOAD_LABEL, messages.row_downloadLOB(),
+ ViewerConstants.TEMPLATE_UV_LINK, RestUtils.createUVLob(),
ViewerConstants.TEMPLATE_LOB_DOWNLOAD_LINK, RestUtils.createExportLobUri(database.getUuid(),
table.getSchemaName(), table.getName(), row.getUuid(), columnStatus.getColumnIndex()));
safeHtml = SafeHtmlUtils.fromSafeConstant(JavascriptUtils.compileTemplate(template, json));
@@ -350,6 +350,7 @@ private void getCellHTML(ViewerColumn column, Set][ relatedTo, Set][ refer
String template = columnStatus.getDetailsStatus().getTemplateStatus().getTemplate();
if (template != null && !template.isEmpty()) {
String json = JSOUtils.cellsToJson(ViewerConstants.TEMPLATE_LOB_DOWNLOAD_LABEL, messages.row_downloadLOB(),
+ ViewerConstants.TEMPLATE_UV_LINK, RestUtils.createUVLob(),
ViewerConstants.TEMPLATE_LOB_DOWNLOAD_LINK, RestUtils.createExportLobUri(database.getUuid(),
table.getSchemaName(), table.getName(), row.getUuid(), columnStatus.getColumnIndex()));
safeHtml = SafeHtmlUtils.fromSafeConstant(JavascriptUtils.compileTemplate(template, json));
@@ -420,15 +421,12 @@ private void getNestedHTML(ColumnStatus columnStatus) {
null, false, new ArrayList<>());
CollectionService.Util.call((IndexResult result) -> {
if (result.getTotalCount() >= 1) {
- GWT.log("count -> " +result.getTotalCount());
RowField rowField;
String json = JSOUtils.cellsToJson(result.getResults().get(0).getCells(), nestedTable);
String s = JavascriptUtils.compileTemplate(template, json);
if (columnStatus.getTypeName().contains("BINARY LARGE OBJECT")) {
String templateLob = "{{download_label}}";
- GWT.log("collumn status ->" + columnStatus.toString());
int originalCollumnIndex = 0;
- GWT.log("collumn status -> " + result.getResults().get(0).getCells());
//loop to find the original column index
for (Map.Entry entry : result.getResults().get(0).getCells().entrySet()) {
@@ -442,9 +440,8 @@ private void getNestedHTML(ColumnStatus columnStatus) {
rowField = RowField.createInstance(new Label(s).getText(), new HTML(messages.rowPanelTextForLobUnavailable()));
} else {
SafeHtml safeHtml = SafeHtmlUtils.EMPTY_SAFE_HTML;
- GWT.log("uuid -> " + result.getResults().get(0).toString());
- GWT.log("id -> " + columnStatus.getId());
json = JSOUtils.cellsToJson(ViewerConstants.TEMPLATE_LOB_DOWNLOAD_LABEL, messages.row_downloadLOB(),
+ ViewerConstants.TEMPLATE_UV_LINK, RestUtils.createUVLob(),
ViewerConstants.TEMPLATE_LOB_DOWNLOAD_LINK, RestUtils.createExportLobUri(database.getUuid(),
nestedTable.getSchemaName(), nestedTable.getName(), result.getResults().get(0).getUuid(), originalCollumnIndex));
safeHtml = SafeHtmlUtils.fromSafeConstant(JavascriptUtils.compileTemplate(templateLob, json));
@@ -457,7 +454,6 @@ private void getNestedHTML(ColumnStatus columnStatus) {
}
rowField.addColumnDescription(columnStatus.getCustomDescription());
- GWT.log("rowField -> " + rowField.toString());
panel.add(rowField);
}
}).findRows(database.getUuid(), database.getUuid(), nestedTable.getSchemaName(), nestedTable.getName(),
diff --git a/src/main/java/com/databasepreservation/common/client/common/visualization/browse/configuration/columns/helpers/BinaryColumnOptionsPanel.java b/src/main/java/com/databasepreservation/common/client/common/visualization/browse/configuration/columns/helpers/BinaryColumnOptionsPanel.java
index 0d21a2311..4aab32c49 100644
--- a/src/main/java/com/databasepreservation/common/client/common/visualization/browse/configuration/columns/helpers/BinaryColumnOptionsPanel.java
+++ b/src/main/java/com/databasepreservation/common/client/common/visualization/browse/configuration/columns/helpers/BinaryColumnOptionsPanel.java
@@ -7,8 +7,11 @@
*/
package com.databasepreservation.common.client.common.visualization.browse.configuration.columns.helpers;
+import static com.databasepreservation.common.client.ViewerConstants.DEFAULT_DETAILED_VIEWER_LABEL_TEMPLATE;
import static com.databasepreservation.common.client.ViewerConstants.DEFAULT_DOWNLOAD_LABEL_TEMPLATE;
+import static com.databasepreservation.common.client.ViewerConstants.DEFAULT_VIEWER_DOWNLOAD_LABEL_TEMPLATE;
+import com.databasepreservation.common.client.ClientConfigurationManager;
import com.databasepreservation.common.client.ViewerConstants;
import com.databasepreservation.common.client.common.utils.ApplicationTypeActions;
import com.databasepreservation.common.client.models.status.collection.ColumnStatus;
@@ -19,7 +22,12 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.ui.*;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.RadioButton;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
import config.i18n.client.ClientMessages;
@@ -87,7 +95,11 @@ public static ColumnOptionsPanel createInstance(TableStatus tableConfiguration,
public TemplateStatus getSearchTemplate() {
TemplateStatus templateStatus = new TemplateStatus();
if (ViewerStringUtils.isBlank(this.displayList.getText())) {
- templateStatus.setTemplate(DEFAULT_DOWNLOAD_LABEL_TEMPLATE);
+ if (ClientConfigurationManager.getBoolean(false, ViewerConstants.VIEWER_ENABLED)) {
+ templateStatus.setTemplate(DEFAULT_VIEWER_DOWNLOAD_LABEL_TEMPLATE);
+ } else {
+ templateStatus.setTemplate(DEFAULT_DOWNLOAD_LABEL_TEMPLATE);
+ }
} else {
templateStatus.setTemplate(this.displayList.getText());
}
@@ -99,7 +111,11 @@ public TemplateStatus getSearchTemplate() {
public TemplateStatus getDetailsTemplate() {
TemplateStatus templateStatus = new TemplateStatus();
if (ViewerStringUtils.isBlank(this.detailsList.getText())) {
- templateStatus.setTemplate(DEFAULT_DOWNLOAD_LABEL_TEMPLATE);
+ if (ClientConfigurationManager.getBoolean(false, ViewerConstants.VIEWER_ENABLED)) {
+ templateStatus.setTemplate(DEFAULT_DETAILED_VIEWER_LABEL_TEMPLATE);
+ } else {
+ templateStatus.setTemplate(DEFAULT_DOWNLOAD_LABEL_TEMPLATE);
+ }
} else {
templateStatus.setTemplate(this.detailsList.getText());
}
diff --git a/src/main/java/com/databasepreservation/common/client/common/visualization/browse/configuration/columns/helpers/ClobColumnOptionsPanel.java b/src/main/java/com/databasepreservation/common/client/common/visualization/browse/configuration/columns/helpers/ClobColumnOptionsPanel.java
index 1ecdfcba9..269b1b2e3 100644
--- a/src/main/java/com/databasepreservation/common/client/common/visualization/browse/configuration/columns/helpers/ClobColumnOptionsPanel.java
+++ b/src/main/java/com/databasepreservation/common/client/common/visualization/browse/configuration/columns/helpers/ClobColumnOptionsPanel.java
@@ -8,7 +8,9 @@
package com.databasepreservation.common.client.common.visualization.browse.configuration.columns.helpers;
import static com.databasepreservation.common.client.ViewerConstants.DEFAULT_DOWNLOAD_LABEL_TEMPLATE;
+import static com.databasepreservation.common.client.ViewerConstants.DEFAULT_VIEWER_DOWNLOAD_LABEL_TEMPLATE;
+import com.databasepreservation.common.client.ClientConfigurationManager;
import com.databasepreservation.common.client.ViewerConstants;
import com.databasepreservation.common.client.models.status.collection.ColumnStatus;
import com.databasepreservation.common.client.models.status.collection.TableStatus;
@@ -163,9 +165,14 @@ private void buildMIMETypeTextBox(ColumnStatus columnConfiguration) {
private TemplateStatus getTemplateStatus(ColumnTemplateOptions options) {
TemplateStatus templateStatus = new TemplateStatus();
+ GWT.log(options.toString());
String str = options.getText();
if (ViewerStringUtils.isBlank(str)) {
- templateStatus.setTemplate(DEFAULT_DOWNLOAD_LABEL_TEMPLATE);
+ if (ClientConfigurationManager.getBoolean(false, ViewerConstants.VIEWER_ENABLED)) {
+ templateStatus.setTemplate(DEFAULT_VIEWER_DOWNLOAD_LABEL_TEMPLATE);
+ } else {
+ templateStatus.setTemplate(DEFAULT_DOWNLOAD_LABEL_TEMPLATE);
+ }
} else {
templateStatus.setTemplate(str);
}
diff --git a/src/main/java/com/databasepreservation/common/client/tools/RestUtils.java b/src/main/java/com/databasepreservation/common/client/tools/RestUtils.java
index ed23a5b7c..62283db23 100644
--- a/src/main/java/com/databasepreservation/common/client/tools/RestUtils.java
+++ b/src/main/java/com/databasepreservation/common/client/tools/RestUtils.java
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.List;
+import com.databasepreservation.common.client.ClientConfigurationManager;
import com.databasepreservation.common.client.ViewerConstants;
import com.databasepreservation.common.client.common.utils.UriQueryUtils;
import com.databasepreservation.common.client.index.FindRequest;
@@ -61,6 +62,15 @@ public static String createExportLobUri(String databaseUUID, String schemaName,
+ columnIndex;
}
+ public static String createUVLob() {
+ return ClientConfigurationManager.getStringWithDefault("uv", ViewerConstants.UV_EXTERNAL_VIEWER_SERVICE_NAME)
+ + "/#?iiifManifestId=" + GWT.getHostPageBaseURL() + ClientConfigurationManager.getStringWithDefault(
+ "presentation", ViewerConstants.PRESENTATION_EXTERNAL_SERVICE_NAME)
+ + "/manifest?downloadLink=";
+ }
+
+
+
public static String createExportTableUri(String databaseUUID, String schemaName, String tableName,
FindRequest findRequest, String zipFilename, String filename, boolean descriptions, boolean lobs,
List fieldsToHeader) {
diff --git a/src/main/java/com/databasepreservation/common/server/ViewerConfiguration.java b/src/main/java/com/databasepreservation/common/server/ViewerConfiguration.java
index 1fb487974..1186bfd8b 100644
--- a/src/main/java/com/databasepreservation/common/server/ViewerConfiguration.java
+++ b/src/main/java/com/databasepreservation/common/server/ViewerConfiguration.java
@@ -137,6 +137,9 @@ public class ViewerConfiguration extends ViewerAbstractConfiguration {
public static final String RELOAD_DBPTK_VIEWER_PROPERTIES = "ui.reload.viewer.properties";
public static final String RELOAD_DBPTK_VIEWER_PROPERTIES_PERIOD = "ui.reload.viewer.properties.period";
+ public static final String UV_EXTERNAL_VIEWER_SERVICE_NAME = "ui.viewer.universalViewer.service_name";
+ public static final String PRESENTATION_EXTERNAL_SERVICE_NAME = "ui.viewer.presentation.service_name";
+ public static final String VIEWER_ENABLED = "ui.viewer.enabled";
private static boolean instantiatedWithoutErrors = true;
private static String applicationEnvironment = ViewerConstants.APPLICATION_ENV_SERVER;
diff --git a/src/main/java/com/databasepreservation/common/utils/StatusUtils.java b/src/main/java/com/databasepreservation/common/utils/StatusUtils.java
index 9ad1c4520..84a252736 100644
--- a/src/main/java/com/databasepreservation/common/utils/StatusUtils.java
+++ b/src/main/java/com/databasepreservation/common/utils/StatusUtils.java
@@ -7,6 +7,9 @@
*/
package com.databasepreservation.common.utils;
+import static com.databasepreservation.common.client.ViewerConstants.DEFAULT_DOWNLOAD_LABEL_TEMPLATE;
+import static com.databasepreservation.common.client.ViewerConstants.DEFAULT_VIEWER_DOWNLOAD_LABEL_TEMPLATE;
+
import java.util.ArrayList;
import java.util.List;
@@ -31,6 +34,7 @@
import com.databasepreservation.common.client.models.structure.ViewerMetadata;
import com.databasepreservation.common.client.models.structure.ViewerTable;
import com.databasepreservation.common.client.models.structure.ViewerType;
+import com.databasepreservation.common.server.ViewerConfiguration;
/**
* @author Miguel GuimarĂ£es
@@ -119,7 +123,12 @@ public static ColumnStatus getColumnStatus(ViewerColumn column, boolean show, in
if (column.getType() != null && (column.getType().getDbType().equals(ViewerType.dbTypes.BINARY)
|| column.getType().getDbType().equals(ViewerType.dbTypes.CLOB))) {
final TemplateStatus template = getTemplateStatus();
- template.setTemplate(ViewerConstants.DEFAULT_DOWNLOAD_LABEL_TEMPLATE);
+ if (ViewerConfiguration.getInstance().getViewerConfigurationAsBoolean(false,
+ ViewerConfiguration.VIEWER_ENABLED)) {
+ template.setTemplate(DEFAULT_VIEWER_DOWNLOAD_LABEL_TEMPLATE);
+ } else {
+ template.setTemplate(DEFAULT_DOWNLOAD_LABEL_TEMPLATE);
+ }
status.updateSearchListTemplate(template);
status.updateDetailsTemplate(template);
}
diff --git a/src/main/resources/com/databasepreservation/common/public/main.css b/src/main/resources/com/databasepreservation/common/public/main.css
index fdf72413c..4be550387 100644
--- a/src/main/resources/com/databasepreservation/common/public/main.css
+++ b/src/main/resources/com/databasepreservation/common/public/main.css
@@ -3462,4 +3462,16 @@ rgba(0, 0, 0, .125);
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
+}
+
+/************************************************
+* Universal embedded viewer
+ ************************************************/
+
+.embedded-viewer {
+ height: 1000px;
+ width: 1000px;
+ display: inline-block;
+ vertical-align: top;
+ margin-left: -6%;
}
\ No newline at end of file
diff --git a/src/main/resources/config/dbvtk-viewer.properties b/src/main/resources/config/dbvtk-viewer.properties
index 0023583ef..90a18d453 100644
--- a/src/main/resources/config/dbvtk-viewer.properties
+++ b/src/main/resources/config/dbvtk-viewer.properties
@@ -11,6 +11,7 @@ ui.sharedProperties.whitelist.configuration.prefix=ui.lists
ui.sharedProperties.whitelist.configuration.prefix=ui.reload
ui.sharedProperties.whitelist.configuration.prefix=ui.header
ui.sharedProperties.whitelist.configuration.prefix=ui.interface
+ui.sharedProperties.whitelist.configuration.prefix=ui.viewer
ui.sharedProperties.whitelist.configuration.prefix=ui.disable
ui.sharedProperties.whitelist.configuration.prefix=ui.plugin
ui.sharedProperties.whitelist.configuration.prefix=ui.reference
@@ -169,3 +170,11 @@ ui.reference.table.show.schema.name=true
##############################################
ui.reload.viewer.properties=false
ui.reload.viewer.properties.period=86400000
+
+###############################################
+# Universal Viewer and presentation addresses
+##############################################
+ui.viewer.enabled=true
+ui.viewer.universalViewer.service_name=uv
+ui.viewer.presentation.service_name=presentation
+
]