From 3451bb4786dadaae8051ff2e6de27e1479380fd9 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Tue, 11 Jan 2011 17:03:52 +0000 Subject: [PATCH] NIHVIVO-1332 Modifications to controller, template models, and templates for editing controls --- .../freemarker/IndividualController.java | 27 +++-------- .../CollatedObjectPropertyTemplateModel.java | 10 ++-- .../DataPropertyStatementTemplateModel.java | 6 +-- .../individual/DataPropertyTemplateModel.java | 8 ++-- .../individual/GroupedPropertyList.java | 12 +++-- .../individual/IndividualTemplateModel.java | 24 +++++++++- .../ObjectPropertyStatementTemplateModel.java | 12 ++--- .../ObjectPropertyTemplateModel.java | 12 ++--- .../PropertyGroupTemplateModel.java | 6 +-- .../individual/PropertyTemplateModel.java | 6 +-- ...UncollatedObjectPropertyTemplateModel.java | 6 +-- .../freemarker/body/individual/individual.ftl | 18 +++---- .../individual/individual-properties.ftl | 6 +-- .../partials/individual/lib-properties.ftl | 48 ++++++++++--------- 14 files changed, 103 insertions(+), 98 deletions(-) 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 3b74620ec..b44a69648 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 @@ -114,8 +114,6 @@ public class IndividualController extends FreemarkerHttpServlet { } Map body = new HashMap(); - - body.put("editStatus", getEditingData(vreq)); body.put("title", individual.getName()); @@ -151,20 +149,6 @@ public class IndividualController extends FreemarkerHttpServlet { EditSubmission.clearAllEditSubmissionsInSession(session); } - private Map getEditingData(VitroRequest vreq) { - - LoginStatusBean loginBean = LoginStatusBean.getBean(vreq); - Map editingData = new HashMap(); - - // RY This will be improved later. What is important is not whether the user is a self-editor, - // but whether he has editing privileges on this profile. - editingData.put("showEditingLinks", VitroRequestPrep.isSelfEditing(vreq) || - loginBean.isLoggedInAtLeast(LoginStatusBean.NON_EDITOR)); - editingData.put("showAdminPanel", loginBean.isLoggedInAtLeast(LoginStatusBean.EDITOR)); - - return editingData; - } - private Map getRelatedSubject(VitroRequest vreq) { Map map = null; @@ -215,14 +199,15 @@ public class IndividualController extends FreemarkerHttpServlet { //setup highlighter for search terms //checkForSearch(vreq, individual); - return new IndividualTemplateModel(individual, vreq); + return new IndividualTemplateModel(individual, vreq, LoginStatusBean.getBean(vreq)); } // Determine whether the individual has a custom display template based on its class membership. // If not, return the default individual template. private String getIndividualTemplate(Individual individual) { - String vclassName = "unknown"; + @SuppressWarnings("unused") + String vclassName = "unknown"; String customTemplate = null; if( individual.getVClass() != null ){ @@ -232,8 +217,8 @@ public class IndividualController extends FreemarkerHttpServlet { customTemplate = clas.getCustomDisplayView(); if (customTemplate != null) { if (customTemplate.length()>0) { - vclassName = clas.getName(); // reset entity vclassname to name of class where a custom view - log.debug("Found direct class ["+clas.getName()+"] with custom view "+customTemplate+"; resetting entity vclassName to this class"); + vclassName = clas.getName(); // reset entity vclassname to name of class where a custom view; this call has side-effects + log.debug("Found direct class [" + clas.getName() + "] with custom view " + customTemplate + "; resetting entity vclassName to this class"); break; } else { customTemplate = null; @@ -247,7 +232,7 @@ public class IndividualController extends FreemarkerHttpServlet { if (customTemplate != null) { if (customTemplate.length()>0) { // note that NOT changing entity vclassName here yet - log.debug("Found inferred class ["+clas.getName()+"] with custom view "+customTemplate); + log.debug("Found inferred class [" + clas.getName() + "] with custom view " + customTemplate); break; } else { customTemplate = null; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/CollatedObjectPropertyTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/CollatedObjectPropertyTemplateModel.java index 25d36cb46..b16f2c583 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/CollatedObjectPropertyTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/CollatedObjectPropertyTemplateModel.java @@ -38,10 +38,10 @@ public class CollatedObjectPropertyTemplateModel extends ObjectPropertyTemplateM private SortedMap> subclasses; CollatedObjectPropertyTemplateModel(ObjectProperty op, Individual subject, - VitroRequest vreq, EditingHelper editLinkHelper) + VitroRequest vreq, EditingHelper editingHelper) throws InvalidConfigurationException { - super(op, subject, vreq, editLinkHelper); + super(op, subject, vreq, editingHelper); String invalidConfigMessage = checkConfiguration(); if ( ! invalidConfigMessage.isEmpty() ) { @@ -62,7 +62,7 @@ public class CollatedObjectPropertyTemplateModel extends ObjectPropertyTemplateM /* Collate the data */ Map> unsortedSubclasses = - collate(subjectUri, propertyUri, statementData, vreq, editLinkHelper); + collate(subjectUri, propertyUri, statementData, vreq, editingHelper); /* Sort by subclass name */ Comparator comparer = new Comparator() { @@ -97,7 +97,7 @@ public class CollatedObjectPropertyTemplateModel extends ObjectPropertyTemplateM } private Map> collate(String subjectUri, String propertyUri, - List> statementData, VitroRequest vreq, EditingHelper editLinkHelper) { + List> statementData, VitroRequest vreq, EditingHelper editingHelper) { Map> subclassMap = new HashMap>(); @@ -117,7 +117,7 @@ public class CollatedObjectPropertyTemplateModel extends ObjectPropertyTemplateM subclassMap.put(subclassName, currentList); } currentList.add(new ObjectPropertyStatementTemplateModel(subjectUri, - propertyUri, objectKey, map, editLinkHelper)); + propertyUri, objectKey, map, editingHelper)); } return subclassMap; } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyStatementTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyStatementTemplateModel.java index 72656ee5e..4284eee59 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyStatementTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyStatementTemplateModel.java @@ -13,11 +13,11 @@ public class DataPropertyStatementTemplateModel extends BaseTemplateModel { private static final Log log = LogFactory.getLog(DataPropertyStatementTemplateModel.class); private DataPropertyStatement statement; - private EditingHelper editLinkHelper; + private EditingHelper editingHelper; - DataPropertyStatementTemplateModel(DataPropertyStatement statement, EditingHelper editLinkHelper) { + DataPropertyStatementTemplateModel(DataPropertyStatement statement, EditingHelper editingHelper) { this.statement = statement; - this.editLinkHelper = editLinkHelper; + this.editingHelper = editingHelper; } /* Access methods for templates */ diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyTemplateModel.java index 54d2a4640..888784069 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyTemplateModel.java @@ -22,10 +22,10 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel { private static final String TYPE = "data"; private List statements; - private EditingHelper editLinkHelper; + private EditingHelper editingHelper; - DataPropertyTemplateModel(DataProperty dp, Individual subject, VitroRequest vreq, EditingHelper editLinkHelper) { - super(dp, editLinkHelper); + DataPropertyTemplateModel(DataProperty dp, Individual subject, VitroRequest vreq, EditingHelper editingHelper) { + super(dp, editingHelper); setName(dp.getPublicName()); @@ -34,7 +34,7 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel { List dpStatements = dpDao.getDataPropertyStatementsForIndividualByProperty(subject, dp); statements = new ArrayList(dpStatements.size()); for (DataPropertyStatement dps : dpStatements) { - statements.add(new DataPropertyStatementTemplateModel(dps, editLinkHelper)); + statements.add(new DataPropertyStatementTemplateModel(dps, editingHelper)); } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/GroupedPropertyList.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/GroupedPropertyList.java index 903210ee6..96e10b625 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/GroupedPropertyList.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/GroupedPropertyList.java @@ -45,19 +45,21 @@ public class GroupedPropertyList extends BaseTemplateModel { private Individual subject; private VitroRequest vreq; private WebappDaoFactory wdf; + private LoginStatusBean loginStatusBean; private List groups; - GroupedPropertyList(Individual subject, VitroRequest vreq) { + GroupedPropertyList(Individual subject, VitroRequest vreq, LoginStatusBean loginStatusBean) { this.subject = subject; this.vreq = vreq; this.wdf = vreq.getWebappDaoFactory(); + this.loginStatusBean = loginStatusBean; // Determine whether we're editing or not. boolean userCanEditThisProfile = getEditingStatus(); - EditingHelper editLinkHelper = null; + EditingHelper editingHelper = null; if (userCanEditThisProfile) { - editLinkHelper = new EditingHelper(vreq, getServletContext()); + editingHelper = new EditingHelper(vreq, getServletContext()); } // Create the property list for the subject. The properties will be put into groups later. @@ -106,7 +108,7 @@ public class GroupedPropertyList extends BaseTemplateModel { // Build the template data model from the groupList groups = new ArrayList(propertyGroupList.size()); for (PropertyGroup pg : propertyGroupList) { - groups.add(new PropertyGroupTemplateModel(vreq, pg, subject, editLinkHelper)); + groups.add(new PropertyGroupTemplateModel(vreq, pg, subject, editingHelper)); } } @@ -118,7 +120,7 @@ public class GroupedPropertyList extends BaseTemplateModel { */ private boolean getEditingStatus() { boolean isSelfEditing = VitroRequestPrep.isSelfEditing(vreq); - boolean isCurator = LoginStatusBean.getBean(vreq).isLoggedInAtLeast(LoginStatusBean.CURATOR); + boolean isCurator = loginStatusBean.isLoggedInAtLeast(LoginStatusBean.CURATOR); return isSelfEditing || isCurator; } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java index 56197bc74..8967eda21 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java @@ -10,6 +10,7 @@ import org.apache.commons.logging.LogFactory; import org.openrdf.model.URI; import org.openrdf.model.impl.URIImpl; +import edu.cornell.mannlib.vedit.beans.LoginStatusBean; import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Link; import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup; @@ -18,6 +19,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; +import edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep; import edu.cornell.mannlib.vitro.webapp.web.ViewFinder; import edu.cornell.mannlib.vitro.webapp.web.ViewFinder.ClassView; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.BaseTemplateModel; @@ -32,6 +34,7 @@ public class IndividualTemplateModel extends BaseTemplateModel { protected VitroRequest vreq; protected UrlBuilder urlBuilder; protected GroupedPropertyList propertyList = null; + protected LoginStatusBean loginStatusBean = null; public IndividualTemplateModel(Individual individual, VitroRequest vreq) { this.individual = individual; @@ -39,6 +42,14 @@ public class IndividualTemplateModel extends BaseTemplateModel { // Needed for getting portal-sensitive urls. Remove if multi-portal support is removed. this.urlBuilder = new UrlBuilder(vreq.getPortal()); } + + public IndividualTemplateModel(Individual individual, VitroRequest vreq, LoginStatusBean loginStatusBean) { + this.individual = individual; + this.vreq = vreq; + this.loginStatusBean = loginStatusBean; + // Needed for getting portal-sensitive urls. Remove if multi-portal support is removed. + this.urlBuilder = new UrlBuilder(vreq.getPortal()); + } /* These methods perform some manipulation of the data returned by the Individual methods */ @@ -129,11 +140,22 @@ public class IndividualTemplateModel extends BaseTemplateModel { public GroupedPropertyList getPropertyList() { if (propertyList == null) { - propertyList = new GroupedPropertyList(individual, vreq); + propertyList = new GroupedPropertyList(individual, vreq, loginStatusBean); } return propertyList; } + public boolean getShowEditingLinks() { + // RY This will be improved later. What is important is not whether the user is a self-editor, + // but whether he has editing privileges on this profile. + return VitroRequestPrep.isSelfEditing(vreq) || + loginStatusBean.isLoggedInAtLeast(LoginStatusBean.NON_EDITOR); + } + + public boolean getShowAdminPanel() { + return loginStatusBean.isLoggedInAtLeast(LoginStatusBean.EDITOR); + } + /* These methods simply forward to the methods of the wrapped individual. It would be desirable to * implement a scheme for proxying or delegation so that the methods don't need to be simply listed here. * A Ruby-style method missing method would be ideal. diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyStatementTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyStatementTemplateModel.java index 4bd376ad6..a4ab16ede 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyStatementTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyStatementTemplateModel.java @@ -27,20 +27,20 @@ public class ObjectPropertyStatementTemplateModel extends BaseTemplateModel { private String propertyUri; private Map data; - private EditingHelper editLinkHelper; + private EditingHelper editingHelper; private String objectUri = null; private ObjectPropertyStatement objectPropertyStatement = null; ObjectPropertyStatementTemplateModel(String subjectUri, String propertyUri, - String objectKey, Map data, EditingHelper editLinkHelper) { + String objectKey, Map data, EditingHelper editingHelper) { this.subjectUri = subjectUri; this.propertyUri = propertyUri; this.data = data; - this.editLinkHelper = editLinkHelper; + this.editingHelper = editingHelper; - // If the editLinkHelper is non-null, we are in edit mode, so create the necessary objects. - if (this.editLinkHelper != null) { + // If the editingHelper is non-null, we are in edit mode, so create the necessary objects. + if (this.editingHelper != null) { objectUri = data.get(objectKey); objectPropertyStatement = new ObjectPropertyStatementImpl(subjectUri, propertyUri, objectUri); } @@ -57,7 +57,7 @@ public class ObjectPropertyStatementTemplateModel extends BaseTemplateModel { public String getEditUrl() { String editUrl = ""; RequestedAction action = new EditObjPropStmt(objectPropertyStatement); - PolicyDecision decision = editLinkHelper.getPolicy().isAuthorized(editLinkHelper.getIds(), action); + PolicyDecision decision = editingHelper.getPolicy().isAuthorized(editingHelper.getIds(), action); if (decision != null && decision.getAuthorized() == Authorization.AUTHORIZED) { ParamMap params = new ParamMap( "subjectUri", subjectUri, diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel.java index 5039174ce..468edadaa 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel.java @@ -61,8 +61,8 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel private PropertyListConfig config; private String objectKey; - ObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq, EditingHelper editLinkHelper) { - super(op, editLinkHelper); + ObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq, EditingHelper editingHelper) { + super(op, editingHelper); setName(op.getDomainPublic()); // Get the config for this object property @@ -107,16 +107,16 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel } protected static ObjectPropertyTemplateModel getObjectPropertyTemplateModel(ObjectProperty op, - Individual subject, VitroRequest vreq, EditingHelper editLinkHelper) { + Individual subject, VitroRequest vreq, EditingHelper editingHelper) { if (op.getCollateBySubclass()) { try { - return new CollatedObjectPropertyTemplateModel(op, subject, vreq, editLinkHelper); + return new CollatedObjectPropertyTemplateModel(op, subject, vreq, editingHelper); } catch (InvalidConfigurationException e) { log.error(e); - return new UncollatedObjectPropertyTemplateModel(op, subject, vreq, editLinkHelper); + return new UncollatedObjectPropertyTemplateModel(op, subject, vreq, editingHelper); } } else { - return new UncollatedObjectPropertyTemplateModel(op, subject, vreq, editLinkHelper); + return new UncollatedObjectPropertyTemplateModel(op, subject, vreq, editingHelper); } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/PropertyGroupTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/PropertyGroupTemplateModel.java index e15ea8fe2..9c5093974 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/PropertyGroupTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/PropertyGroupTemplateModel.java @@ -24,7 +24,7 @@ public class PropertyGroupTemplateModel extends BaseTemplateModel { private String name; private List properties; - PropertyGroupTemplateModel(VitroRequest vreq, PropertyGroup group, Individual subject, EditingHelper editLinkHelper) { + PropertyGroupTemplateModel(VitroRequest vreq, PropertyGroup group, Individual subject, EditingHelper editingHelper) { this.name = group.getName(); List propertyList = group.getPropertyList(); @@ -32,9 +32,9 @@ public class PropertyGroupTemplateModel extends BaseTemplateModel { for (Property p : propertyList) { if (p instanceof ObjectProperty) { ObjectProperty op = (ObjectProperty)p; - properties.add(ObjectPropertyTemplateModel.getObjectPropertyTemplateModel(op, subject, vreq, editLinkHelper)); + properties.add(ObjectPropertyTemplateModel.getObjectPropertyTemplateModel(op, subject, vreq, editingHelper)); } else { - properties.add(new DataPropertyTemplateModel((DataProperty)p, subject, vreq, editLinkHelper)); + properties.add(new DataPropertyTemplateModel((DataProperty)p, subject, vreq, editingHelper)); } } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/PropertyTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/PropertyTemplateModel.java index 70266a746..9aaf95008 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/PropertyTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/PropertyTemplateModel.java @@ -18,15 +18,15 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel { private String name; private String uri; protected Property property; // needed to get the edit links - protected EditingHelper editLinkHelper; + protected EditingHelper editingHelper; - PropertyTemplateModel(Property property, EditingHelper editLinkHelper) { + PropertyTemplateModel(Property property, EditingHelper editingHelper) { // Do in subclass constructor. The label has not been set on the property, and getting the // label differs between object and data properties. // this.name = property.getLabel(); this.uri = property.getURI(); this.property = property; - this.editLinkHelper = editLinkHelper; + this.editingHelper = editingHelper; } protected void setName(String name) { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/UncollatedObjectPropertyTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/UncollatedObjectPropertyTemplateModel.java index 8ee26fbb5..6742a256c 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/UncollatedObjectPropertyTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/UncollatedObjectPropertyTemplateModel.java @@ -22,8 +22,8 @@ public class UncollatedObjectPropertyTemplateModel extends ObjectPropertyTemplat private List statements; - UncollatedObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq, EditingHelper editLinkHelper) { - super(op, subject, vreq, editLinkHelper); + UncollatedObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq, EditingHelper editingHelper) { + super(op, subject, vreq, editingHelper); /* Get the data */ WebappDaoFactory wdf = vreq.getWebappDaoFactory(); @@ -41,7 +41,7 @@ public class UncollatedObjectPropertyTemplateModel extends ObjectPropertyTemplat String objectKey = getObjectKey(); for (Map map : statementData) { statements.add(new ObjectPropertyStatementTemplateModel(subjectUri, - propertyUri, objectKey, map, editLinkHelper)); + propertyUri, objectKey, map, editingHelper)); } postprocessStatementList(statements); diff --git a/webapp/web/templates/freemarker/body/individual/individual.ftl b/webapp/web/templates/freemarker/body/individual/individual.ftl index 2bb65067f..88cd26d38 100644 --- a/webapp/web/templates/freemarker/body/individual/individual.ftl +++ b/webapp/web/templates/freemarker/body/individual/individual.ftl @@ -1,21 +1,13 @@ <#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> -<#-- Template for individual profile page --> +<#-- Generic template for individual profile page --> -<#import "lib-list.ftl" as l> -<#import "lib-properties.ftl" as p> -<#assign core = "http://vivoweb.org/ontology/core#"> +<#include "individual-setup.ftl"> -<#assign editingClass> - <#if editStatus.showEditingLinks>editing<#else> - - -<#if editStatus.showAdminPanel> +<#if individual.showAdminPanel> <#include "individual-adminPanel.ftl"> -<#assign propertyGroups = individual.propertyList> -
<#-- Thumbnail --> @@ -48,6 +40,7 @@ <#assign overview = propertyGroups.getPropertyAndRemoveFromList("${core}overview")!> <#if overview?has_content> <#-- true when the property is in the list, even if not populated (when editing) --> <#list overview.statements as statement> + <@p.editingLinks statement showEditingLinks />

${statement.value}

@@ -87,8 +80,9 @@
+<#assign nameForOtherGroup = "other"> <#-- used by both individual-propertyGroupMenu.ftl and individual-properties.ftl --> + <#-- Property group menu --> -<#assign nameForOtherGroup = "other"> <#include "individual-propertyGroupMenu.ftl"> <#-- Ontology properties --> diff --git a/webapp/web/templates/freemarker/body/partials/individual/individual-properties.ftl b/webapp/web/templates/freemarker/body/partials/individual/individual-properties.ftl index c164a5852..daeac0f10 100644 --- a/webapp/web/templates/freemarker/body/partials/individual/individual-properties.ftl +++ b/webapp/web/templates/freemarker/body/partials/individual/individual-properties.ftl @@ -30,13 +30,13 @@
    <#-- data property --> <#if property.type == "data"> - <@p.dataPropertyList property.statements /> + <@p.dataPropertyList property.statements showEditingLinks /> <#-- object property --> <#elseif property.collatedBySubclass> <#-- collated --> - <@p.collatedObjectPropertyList property /> + <@p.collatedObjectPropertyList property showEditingLinks /> <#else> <#-- uncollated --> - <@p.objectPropertyList property.statements property.template /> + <@p.objectPropertyList property.statements property.template showEditingLinks />
diff --git a/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl b/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl index fae8a2828..177fbd73a 100644 --- a/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl +++ b/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl @@ -4,56 +4,58 @@ Macros for generating property lists ------------------------------------------------------------------------------> -<#macro dataPropertyList statements> +<#macro dataPropertyList statements showEditingLinks> <#list statements as statement> - <@propertyListItem statement>${statement.value} + <@propertyListItem statement showEditingLinks>${statement.value} -<#macro collatedObjectPropertyList property> +<#macro collatedObjectPropertyList property showEditingLinks> <#assign subclasses = property.subclasses> <#list subclasses?keys as subclass>
  • ${subclass?lower_case}

      - <@objectPropertyList subclasses[subclass] property.template /> + <@objectPropertyList subclasses[subclass] property.template showEditingLinks />
  • -<#macro simpleObjectPropertyList property> - <@objectPropertyList property.statements "propStatement-simple.ftl" /> +<#macro simpleObjectPropertyList property showEditingLinks> + <@objectPropertyList property.statements "propStatement-simple.ftl" showEditingLinks /> -<#macro objectPropertyList statements template> +<#macro objectPropertyList statements template showEditingLinks> <#list statements as statement> - <@propertyListItem statement><#include "${template}"> + <@propertyListItem statement showEditingLinks><#include "${template}"> -<#macro propertyListItem statement> +<#macro propertyListItem statement showEditingLinks>
  • - <@editLink statement /> - <@deleteLink statement /> + <@editingLinks statement showEditingLinks /> <#nested>
  • -<#macro editLink statement> - <#if editStatus.showEditingLinks> - <#local url = statement.editUrl> - <#if url?has_content> - edit - +<#macro editingLinks statement showEditingLinks> + <#if showEditingLinks> + <@editLink statement /> + <@deleteLink statement /> -<#macro deleteLink statement> - <#if editStatus.showEditingLinks> - <#local url = statement.deleteUrl> - <#if url?has_content> - delete - +<#macro editLink statement> + <#local url = statement.editUrl> + <#if url?has_content> + edit + + + +<#macro deleteLink statement> + <#local url = statement.deleteUrl> + <#if url?has_content> + delete \ No newline at end of file