VIVO-970: added domain and range display limit fields to object property editing form. The display is now used with the 'more...' link on profile pages.

This commit is contained in:
Tim Worrall 2015-02-16 11:03:29 -05:00
parent 823133688a
commit 0a516b0a01
4 changed files with 35 additions and 5 deletions

View file

@ -55,13 +55,13 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
private String domainEntitySortDirection = null; private String domainEntitySortDirection = null;
private Integer domainDisplayTier = null; private Integer domainDisplayTier = null;
private Integer domainDisplayLimit = 5; private Integer domainDisplayLimit = null;
private String objectIndividualSortPropertyURI = null; private String objectIndividualSortPropertyURI = null;
private String rangeEntitySortDirection = null; private String rangeEntitySortDirection = null;
private Integer rangeDisplayTier = null; private Integer rangeDisplayTier = null;
private Integer rangeDisplayLimit = 5; private Integer rangeDisplayLimit = null;
private boolean selectFromExisting = true; private boolean selectFromExisting = true;
private boolean offerCreateNewOption = false; private boolean offerCreateNewOption = false;

View file

@ -81,6 +81,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
private PropertyListConfig config; private PropertyListConfig config;
private String objectKey; private String objectKey;
private String sortDirection; private String sortDirection;
private int displayLimit;
ObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq, ObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq,
boolean editing) boolean editing)
@ -91,6 +92,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
sortDirection = op.getDomainEntitySortDirection(); sortDirection = op.getDomainEntitySortDirection();
domainUri = op.getDomainVClassURI(); domainUri = op.getDomainVClassURI();
rangeUri = op.getRangeVClassURI(); rangeUri = op.getRangeVClassURI();
displayLimit = op.getDomainDisplayLimit();
// Get the config for this object property // Get the config for this object property
try { try {
@ -175,6 +177,11 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
return Route.OBJECT_PROPERTY_EDIT; return Route.OBJECT_PROPERTY_EDIT;
} }
@Override
public int getDisplayLimit() {
return displayLimit;
}
public ConfigError checkQuery(String queryString) { public ConfigError checkQuery(String queryString) {
if (StringUtils.isBlank(queryString)) { if (StringUtils.isBlank(queryString)) {
return ConfigError.NO_SELECT_QUERY; return ConfigError.NO_SELECT_QUERY;

View file

@ -14,6 +14,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
import edu.cornell.mannlib.vitro.webapp.beans.FauxProperty; import edu.cornell.mannlib.vitro.webapp.beans.FauxProperty;
import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.Property; import edu.cornell.mannlib.vitro.webapp.beans.Property;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route;
@ -58,7 +59,6 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel {
this.name = fauxProperty.getDisplayName(); this.name = fauxProperty.getDisplayName();
this.displayLimit = fauxProperty.getDisplayLimit(); this.displayLimit = fauxProperty.getDisplayLimit();
} }
setVerboseDisplayValues(property); setVerboseDisplayValues(property);
} }

View file

@ -240,6 +240,29 @@
</c:choose> </c:choose>
</td> </td>
</tr> </tr>
<tr class="editformcell" >
<td valign="top" colspan="2" style="padding-top:25px">
<b>Display limit</b> for this property<br/>
<input type="text" class="shortInput" name="DomainDisplayLimit" value="<form:value name="DomainDisplayLimit"/>"/>
<c:set var="DomainDisplayLimitError"><form:error name="DomainDisplayLimit"/></c:set>
<c:if test="${!empty DomainDisplayLimitError}">
<span class="notice"><c:out value="${DomainDisplayLimitError}"/></span>
</c:if>
</td>
<td valign="top" colspan="2">
<b>Display limit</b> for inverse property<br/>
<input type="text" class="shortInput" name="RangeDisplayLimit" value="<form:value name="RangeDisplayLimit"/>"/>
<c:set var="RangeDisplayLimitError"><form:error name="RangeDisplayLimit"/></c:set>
<c:if test="${!empty RangeDisplayLimitError}">
<span class="notice"><c:out value="${RangeDisplayLimitError}"/></span>
</c:if>
</td>
</tr>
<tr class="editformcell" >
<td valign="top" colspan="6" style="padding-top:-12px">
The limit before the &quot;more ...&quot; button is displayed.<br/>
</td>
</tr>
<tr><td colspan="5"><hr class="formDivider"/></td></tr> <tr><td colspan="5"><hr class="formDivider"/></td></tr>
<tr class="editformcell"> <tr class="editformcell">
<td valign="top" colspan="2"> <td valign="top" colspan="2">