From 0a158ae30fffa5fce838c138ef4c4dcc362f1d8b Mon Sep 17 00:00:00 2001 From: cdtank Date: Mon, 9 May 2011 15:52:05 +0000 Subject: [PATCH] 1. Made changes to the coautho/copi link creator utility to first test for short-uri possibility. --- .../visualizations-beans-injection-fm.xml | 8 ++++---- .../js/visualization/entitycomparison/util.js | 14 ++++++++++++++ .../entitycomparison/entityComparisonSetup.ftl | 1 + .../EntityPublicationCountRequestHandler.java | 1 + .../TemporalGrantVisualizationRequestHandler.java | 1 + ...oralPublicationVisualizationRequestHandler.java | 1 + .../EntityGrantCountRequestHandler.java | 1 + 7 files changed, 23 insertions(+), 4 deletions(-) diff --git a/productMods/WEB-INF/visualization/visualizations-beans-injection-fm.xml b/productMods/WEB-INF/visualization/visualizations-beans-injection-fm.xml index 8fa37a1b..7fd32b8b 100644 --- a/productMods/WEB-INF/visualization/visualizations-beans-injection-fm.xml +++ b/productMods/WEB-INF/visualization/visualizations-beans-injection-fm.xml @@ -79,7 +79,7 @@ --> - + @@ -87,7 +87,7 @@ - + @@ -95,7 +95,7 @@ - + @@ -103,7 +103,7 @@ - + diff --git a/productMods/js/visualization/entitycomparison/util.js b/productMods/js/visualization/entitycomparison/util.js index 7fb9d8c3..ee52a3c7 100644 --- a/productMods/js/visualization/entitycomparison/util.js +++ b/productMods/js/visualization/entitycomparison/util.js @@ -762,7 +762,21 @@ function getVIVOURL(entityURI){ } function getTemporalVisURL(entityURI) { + if (vivoDefaultNamespace) { + + /* + * This means that the URI of the entity is made up of default namespace so lets make the + * short url, shorter! + * */ + if (entityURI.search(vivoDefaultNamespace) === 0) { + return temporalGraphCommonURL + entityURI.substring(vivoDefaultNamespace.length); + } + } + /* + * Default short url template involves using long uri, this in case the entity is not based off + * of default namespace. + * */ return temporalGraphCommonURL + "?uri=" + entityURI ; } diff --git a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonSetup.ftl b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonSetup.ftl index 6bb71a43..f85e85df 100644 --- a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonSetup.ftl +++ b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonSetup.ftl @@ -107,6 +107,7 @@ var subOrganizationGrantTemporalGraphCommonURL = "${subOrganizationGrantTemporal var subOrganizationPublicationTemporalGraphCommonURL = "${subOrganizationPublicationTemporalGraphCommonURL}"; var jsonString = '${jsonContent!}'; +var vivoDefaultNamespace = '${vivoDefaultNamespace!}'; var organizationLabel = '${organizationLabel}'; var organizationVIVOProfileURL = "${organizationVivoProfileURL}"; diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountRequestHandler.java index dd63756e..a2715c21 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountRequestHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountRequestHandler.java @@ -259,6 +259,7 @@ public class EntityPublicationCountRequestHandler implements body.put("title", organizationLabel + " - Temporal Graph Visualization"); body.put("organizationURI", entityURI); body.put("organizationLocalName", UtilityFunctions.getIndividualLocalName(entityURI, vreq)); + body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory().getDefaultNamespace()); body.put("organizationLabel", organizationLabel); return new TemplateResponseValues(standaloneTemplate, body); diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/cached/TemporalGrantVisualizationRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/cached/TemporalGrantVisualizationRequestHandler.java index 4ec78bb8..ce59b51a 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/cached/TemporalGrantVisualizationRequestHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/cached/TemporalGrantVisualizationRequestHandler.java @@ -290,6 +290,7 @@ public class TemporalGrantVisualizationRequestHandler implements body.put("title", organizationLabel + " - Temporal Graph Visualization"); body.put("organizationURI", entityURI); body.put("organizationLocalName", UtilityFunctions.getIndividualLocalName(entityURI, vreq)); + body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory().getDefaultNamespace()); body.put("organizationLabel", organizationLabel); return new TemplateResponseValues(standaloneTemplate, body); diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/cached/TemporalPublicationVisualizationRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/cached/TemporalPublicationVisualizationRequestHandler.java index 2bc21564..4583d4d8 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/cached/TemporalPublicationVisualizationRequestHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/cached/TemporalPublicationVisualizationRequestHandler.java @@ -282,6 +282,7 @@ public class TemporalPublicationVisualizationRequestHandler implements body.put("title", organizationLabel + " - Temporal Graph Visualization"); body.put("organizationURI", entityURI); body.put("organizationLocalName", UtilityFunctions.getIndividualLocalName(entityURI, vreq)); + body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory().getDefaultNamespace()); body.put("organizationLabel", organizationLabel); return new TemplateResponseValues(standaloneTemplate, body); diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitygrantcount/EntityGrantCountRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitygrantcount/EntityGrantCountRequestHandler.java index f1abdcd5..380cafd6 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitygrantcount/EntityGrantCountRequestHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitygrantcount/EntityGrantCountRequestHandler.java @@ -257,6 +257,7 @@ public class EntityGrantCountRequestHandler implements body.put("title", organizationLabel + " - Temporal Graph Visualization"); body.put("organizationURI", entityURI); body.put("organizationLocalName", UtilityFunctions.getIndividualLocalName(entityURI, vreq)); + body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory().getDefaultNamespace()); body.put("organizationLabel", organizationLabel); return new TemplateResponseValues(standaloneTemplate, body);