From b7d2027da424bffcdc06b625297a9331d3142a43 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Wed, 26 May 2010 14:03:59 +0000 Subject: [PATCH] Some reorganization of templates. Restored entitylist as destination of links on index page, since new individuallist controller/templates not finished yet. --- webapp/config/web.xml | 2 -- .../freemarker/IndividualController.java | 8 ++++++++ .../webapp/controller/freemarker/Routes.java | 2 +- .../vitro/webapp/view/IndividualView.java | 11 ++++++----- .../templates/entity/entityMergedPropsList.jsp | 10 +++++++++- .../templates/freemarker/body/individualList.ftl | 4 +--- .../body/partials/defaultIndividualListView.ftl | 3 +++ webapp/web/templates/freemarker/page/default.ftl | 16 ++++++++-------- .../partials}/breadcrumbs.ftl | 0 .../{components => page/partials}/copyright.ftl | 0 .../{components => page/partials}/doctype.html | 0 .../{components => page/partials}/footer.ftl | 2 +- .../partials}/googleAnalytics.ftl | 0 .../{components => page/partials}/head.ftl | 0 .../{components => page/partials}/identity.ftl | 0 .../{components => page/partials}/menu.ftl | 0 .../{components => page/partials}/scripts.ftl | 0 .../{components => page/partials}/search.ftl | 0 .../partials}/stylesheets.ftl | 0 .../{components => page/partials}/title.ftl | 0 20 files changed, 37 insertions(+), 21 deletions(-) create mode 100644 webapp/web/templates/freemarker/body/partials/defaultIndividualListView.ftl rename webapp/web/templates/freemarker/{components => page/partials}/breadcrumbs.ftl (100%) rename webapp/web/templates/freemarker/{components => page/partials}/copyright.ftl (100%) rename webapp/web/templates/freemarker/{components => page/partials}/doctype.html (100%) rename webapp/web/templates/freemarker/{components => page/partials}/footer.ftl (99%) rename webapp/web/templates/freemarker/{components => page/partials}/googleAnalytics.ftl (100%) rename webapp/web/templates/freemarker/{components => page/partials}/head.ftl (100%) rename webapp/web/templates/freemarker/{components => page/partials}/identity.ftl (100%) rename webapp/web/templates/freemarker/{components => page/partials}/menu.ftl (100%) rename webapp/web/templates/freemarker/{components => page/partials}/scripts.ftl (100%) rename webapp/web/templates/freemarker/{components => page/partials}/search.ftl (100%) rename webapp/web/templates/freemarker/{components => page/partials}/stylesheets.ftl (100%) rename webapp/web/templates/freemarker/{components => page/partials}/title.ftl (100%) diff --git a/webapp/config/web.xml b/webapp/config/web.xml index 2337cb506..512a86899 100644 --- a/webapp/config/web.xml +++ b/webapp/config/web.xml @@ -804,7 +804,6 @@ /listObjectPropertyStatements - IndividualListController diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java index 4dc9f9198..9d3235f22 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java @@ -57,6 +57,14 @@ import edu.cornell.mannlib.vitro.webapp.web.jsptags.StringProcessorTag; * @author bdc34 * */ + +/* IMPLEMENTATION NOTES + +- See NIHVIVO-512: +build up the list of actually rendered items first. Only then, if there are any, add the label on top. + +*/ + public class IndividualController extends FreeMarkerHttpServlet { private static final long serialVersionUID = 1L; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/Routes.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/Routes.java index ed99ae2e9..481e293bc 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/Routes.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/Routes.java @@ -11,7 +11,7 @@ public class Routes { public static final String BROWSE = "/browse"; public static final String CONTACT = "/contact"; public static final String INDIVIDUAL = "/individual"; - public static final String INDIVIDUAL_LIST = "/individuallist"; + public static final String INDIVIDUAL_LIST = "/entitylist"; //"/individuallist"; public static final String SEARCH = "/search"; public static final String TERMS_OF_USE = "/termsOfUse"; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/view/IndividualView.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/view/IndividualView.java index e1d710955..7aa43b381 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/view/IndividualView.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/view/IndividualView.java @@ -36,17 +36,18 @@ public class IndividualView extends ViewObject { return individual.getURI(); } - // Or maybe getProfileUrl - there might be other kinds of urls - // e.g., getEditUrl, getDeleteUrl - these would return the computations of PropertyEditLinks + // Return link to individual's profile page. + // There may be other urls associated with the individual. E.g., we might need + // getEditUrl(), getDeleteUrl() to return the links computed by PropertyEditLinks. // RY **** Need to account for everything in URLRewritingHttpServlet public String getProfileUrl() { return getUrl("/individual/" + individual.getLocalName()); } - public String getRenderer() { + public String getShortView() { // TODO - // iterate through class hierarchy looking for a custom renderer. If none, use - // default individual renderer. template will just do an include on individual.renderer + // iterate through class hierarchy looking for a custom short view. If none, use + // default individual short view. template will just do an include on individual.shortView // Use individual.getVClasses() - this is the class hierarchy // Question: what order are they returned in ? If from specific to general, break out of the iteration as soon as we find one. return null; diff --git a/webapp/web/templates/entity/entityMergedPropsList.jsp b/webapp/web/templates/entity/entityMergedPropsList.jsp index 7da34a297..9cc360ddc 100644 --- a/webapp/web/templates/entity/entityMergedPropsList.jsp +++ b/webapp/web/templates/entity/entityMergedPropsList.jsp @@ -131,8 +131,16 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp. + + <%-- rjy7 We have a logic problem here: if the custom short view dictates that the item NOT be rendered, + and because of this there are NO items to render, we shouldn't show the label when not in edit mode. + Example: people ( = positionHistory) of an organization don't render if the position end date is in the past. + So the organization might not have any current people, in which case we shouldn't show the "people" label. + We need to compute objRows on the basis of the rendering, not the number of objectPropertyStatements. + See NIHVIVO-512. --%> + - + diff --git a/webapp/web/templates/freemarker/body/individualList.ftl b/webapp/web/templates/freemarker/body/individualList.ftl index c177e0e2d..64b99be3d 100644 --- a/webapp/web/templates/freemarker/body/individualList.ftl +++ b/webapp/web/templates/freemarker/body/individualList.ftl @@ -3,7 +3,6 @@ <#-- List individual members of a class. -->
-

${title}

<#if subtitle??> @@ -17,11 +16,10 @@
    <#list individuals as individual>
  • - ${individual.name} ${individual.tagline} + <#include "partials/defaultIndividualListView.ftl">
-
diff --git a/webapp/web/templates/freemarker/body/partials/defaultIndividualListView.ftl b/webapp/web/templates/freemarker/body/partials/defaultIndividualListView.ftl new file mode 100644 index 000000000..4213143e6 --- /dev/null +++ b/webapp/web/templates/freemarker/body/partials/defaultIndividualListView.ftl @@ -0,0 +1,3 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +${individual.name} ${individual.tagline} diff --git a/webapp/web/templates/freemarker/page/default.ftl b/webapp/web/templates/freemarker/page/default.ftl index 70da460f2..c36262278 100644 --- a/webapp/web/templates/freemarker/page/default.ftl +++ b/webapp/web/templates/freemarker/page/default.ftl @@ -1,22 +1,22 @@ <#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> -<#include "/components/doctype.html"> +<#include "partials/doctype.html"> -<#include "/components/head.ftl"> +<#include "partials/head.ftl">
@@ -29,10 +29,10 @@
- <#include "/components/footer.ftl"> + <#include "partials/footer.ftl"> - <#include "/components/scripts.ftl"> + <#include "partials/scripts.ftl"> diff --git a/webapp/web/templates/freemarker/components/breadcrumbs.ftl b/webapp/web/templates/freemarker/page/partials/breadcrumbs.ftl similarity index 100% rename from webapp/web/templates/freemarker/components/breadcrumbs.ftl rename to webapp/web/templates/freemarker/page/partials/breadcrumbs.ftl diff --git a/webapp/web/templates/freemarker/components/copyright.ftl b/webapp/web/templates/freemarker/page/partials/copyright.ftl similarity index 100% rename from webapp/web/templates/freemarker/components/copyright.ftl rename to webapp/web/templates/freemarker/page/partials/copyright.ftl diff --git a/webapp/web/templates/freemarker/components/doctype.html b/webapp/web/templates/freemarker/page/partials/doctype.html similarity index 100% rename from webapp/web/templates/freemarker/components/doctype.html rename to webapp/web/templates/freemarker/page/partials/doctype.html diff --git a/webapp/web/templates/freemarker/components/footer.ftl b/webapp/web/templates/freemarker/page/partials/footer.ftl similarity index 99% rename from webapp/web/templates/freemarker/components/footer.ftl rename to webapp/web/templates/freemarker/page/partials/footer.ftl index 918342435..bfb6c8c20 100644 --- a/webapp/web/templates/freemarker/components/footer.ftl +++ b/webapp/web/templates/freemarker/page/partials/footer.ftl @@ -18,7 +18,7 @@ - + <#include "copyright.ftl"> All Rights Reserved. Terms of Use diff --git a/webapp/web/templates/freemarker/components/googleAnalytics.ftl b/webapp/web/templates/freemarker/page/partials/googleAnalytics.ftl similarity index 100% rename from webapp/web/templates/freemarker/components/googleAnalytics.ftl rename to webapp/web/templates/freemarker/page/partials/googleAnalytics.ftl diff --git a/webapp/web/templates/freemarker/components/head.ftl b/webapp/web/templates/freemarker/page/partials/head.ftl similarity index 100% rename from webapp/web/templates/freemarker/components/head.ftl rename to webapp/web/templates/freemarker/page/partials/head.ftl diff --git a/webapp/web/templates/freemarker/components/identity.ftl b/webapp/web/templates/freemarker/page/partials/identity.ftl similarity index 100% rename from webapp/web/templates/freemarker/components/identity.ftl rename to webapp/web/templates/freemarker/page/partials/identity.ftl diff --git a/webapp/web/templates/freemarker/components/menu.ftl b/webapp/web/templates/freemarker/page/partials/menu.ftl similarity index 100% rename from webapp/web/templates/freemarker/components/menu.ftl rename to webapp/web/templates/freemarker/page/partials/menu.ftl diff --git a/webapp/web/templates/freemarker/components/scripts.ftl b/webapp/web/templates/freemarker/page/partials/scripts.ftl similarity index 100% rename from webapp/web/templates/freemarker/components/scripts.ftl rename to webapp/web/templates/freemarker/page/partials/scripts.ftl diff --git a/webapp/web/templates/freemarker/components/search.ftl b/webapp/web/templates/freemarker/page/partials/search.ftl similarity index 100% rename from webapp/web/templates/freemarker/components/search.ftl rename to webapp/web/templates/freemarker/page/partials/search.ftl diff --git a/webapp/web/templates/freemarker/components/stylesheets.ftl b/webapp/web/templates/freemarker/page/partials/stylesheets.ftl similarity index 100% rename from webapp/web/templates/freemarker/components/stylesheets.ftl rename to webapp/web/templates/freemarker/page/partials/stylesheets.ftl diff --git a/webapp/web/templates/freemarker/components/title.ftl b/webapp/web/templates/freemarker/page/partials/title.ftl similarity index 100% rename from webapp/web/templates/freemarker/components/title.ftl rename to webapp/web/templates/freemarker/page/partials/title.ftl