[VIVO-1528] Select an editor for input fields based on annotation (#76)

* provide WYSIWYG editor for range XMLLiteral only

* Update defaultDataPropertyForm.ftl

* add annotation based selection of the desired editor for editing values
of datatype properties in the frontend

* create new annotation vitro:editing to allow configuration of desired
editor for editing of related dataproperties

Resolves: https://jira.duraspace.org/browse/VIVO-1528
This commit is contained in:
Stefan-Wolff 2018-12-07 15:14:36 +01:00 committed by Andrew Woods
parent 734b9ccf68
commit 129e1219a8
6 changed files with 31 additions and 20 deletions

View file

@ -22,6 +22,8 @@ public class DataProperty extends Property implements Comparable<DataProperty>,
private String domainClassURI = null; private String domainClassURI = null;
private String rangeDatatypeURI = null; private String rangeDatatypeURI = null;
private String editing = null;
private boolean functional = false; private boolean functional = false;
private String example = null; private String example = null;
@ -90,6 +92,14 @@ public class DataProperty extends Property implements Comparable<DataProperty>,
this.rangeDatatypeURI = rangeDatatypeURI; this.rangeDatatypeURI = rangeDatatypeURI;
} }
public void setEditing(String editing) {
this.editing = editing;
}
public String getEditing() {
return this.editing;
}
public boolean getFunctional() { public boolean getFunctional() {
return this.functional; return this.functional;
} }

View file

@ -46,6 +46,7 @@ public class VitroVocabulary {
public static final String DESCRIPTION_ANNOT = vitroURI + "descriptionAnnot"; public static final String DESCRIPTION_ANNOT = vitroURI + "descriptionAnnot";
public static final String PUBLIC_DESCRIPTION_ANNOT = vitroURI + "publicDescriptionAnnot"; public static final String PUBLIC_DESCRIPTION_ANNOT = vitroURI + "publicDescriptionAnnot";
public static final String EDITING = vitroURI + "editing";
public static final String SHORTDEF = "http://purl.obolibrary.org/obo/IAO_0000115"; public static final String SHORTDEF = "http://purl.obolibrary.org/obo/IAO_0000115";
public static final String EXAMPLE_ANNOT = "http://purl.obolibrary.org/obo/IAO_0000112"; public static final String EXAMPLE_ANNOT = "http://purl.obolibrary.org/obo/IAO_0000112";

View file

@ -197,6 +197,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
dp.setExample(getPropertyStringValue(op,EXAMPLE_ANNOT)); dp.setExample(getPropertyStringValue(op,EXAMPLE_ANNOT));
dp.setDescription(getPropertyStringValue(op,DESCRIPTION_ANNOT)); dp.setDescription(getPropertyStringValue(op,DESCRIPTION_ANNOT));
dp.setPublicDescription(getPropertyStringValue(op,PUBLIC_DESCRIPTION_ANNOT)); dp.setPublicDescription(getPropertyStringValue(op,PUBLIC_DESCRIPTION_ANNOT));
dp.setEditing(getPropertyStringValue(op,EDITING));
dp.setDisplayTier((getWebappDaoFactory()).getJenaBaseDao().getPropertyNonNegativeIntValue(op, DISPLAY_RANK_ANNOT)); dp.setDisplayTier((getWebappDaoFactory()).getJenaBaseDao().getPropertyNonNegativeIntValue(op, DISPLAY_RANK_ANNOT));
dp.setDisplayLimit((getWebappDaoFactory()).getJenaBaseDao().getPropertyNonNegativeIntValue(op, DISPLAY_LIMIT)); dp.setDisplayLimit((getWebappDaoFactory()).getJenaBaseDao().getPropertyNonNegativeIntValue(op, DISPLAY_LIMIT));

View file

@ -52,6 +52,8 @@ public class JenaBaseDaoCon {
protected AnnotationProperty PUBLIC_DESCRIPTION_ANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PUBLIC_DESCRIPTION_ANNOT); protected AnnotationProperty PUBLIC_DESCRIPTION_ANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PUBLIC_DESCRIPTION_ANNOT);
protected AnnotationProperty SHORTDEF = _constModel.createAnnotationProperty(VitroVocabulary.SHORTDEF); protected AnnotationProperty SHORTDEF = _constModel.createAnnotationProperty(VitroVocabulary.SHORTDEF);
protected AnnotationProperty EDITING = _constModel.createAnnotationProperty(VitroVocabulary.EDITING);
protected DatatypeProperty MONIKER = _constModel.createDatatypeProperty(VitroVocabulary.MONIKER); protected DatatypeProperty MONIKER = _constModel.createDatatypeProperty(VitroVocabulary.MONIKER);
protected OntClass CLASSGROUP = _constModel.createClass(VitroVocabulary.CLASSGROUP); protected OntClass CLASSGROUP = _constModel.createClass(VitroVocabulary.CLASSGROUP);
protected AnnotationProperty IN_CLASSGROUP = _constModel.createAnnotationProperty(VitroVocabulary.IN_CLASSGROUP); protected AnnotationProperty IN_CLASSGROUP = _constModel.createAnnotationProperty(VitroVocabulary.IN_CLASSGROUP);

View file

@ -36,6 +36,7 @@ xmlns:vitro="&vitro;"
<owl:AnnotationProperty rdf:about="&vitro;modTimeAnnot"/> <owl:AnnotationProperty rdf:about="&vitro;modTimeAnnot"/>
<owl:AnnotationProperty rdf:about="&vitro;shortDefAnnot"/> <owl:AnnotationProperty rdf:about="&vitro;shortDefAnnot"/>
<owl:AnnotationProperty rdf:about="&vitro;oldId"/> <owl:AnnotationProperty rdf:about="&vitro;oldId"/>
<owl:AnnotationProperty rdf:about="&vitro;editing"/>
<!-- VClassGroup-related constructs --> <!-- VClassGroup-related constructs -->

View file

@ -23,11 +23,7 @@
</#if> </#if>
<#assign literalValues = "${editConfiguration.dataLiteralValuesAsString}" /> <#assign literalValues = "${editConfiguration.dataLiteralValuesAsString}" />
<#if editConfiguration.dataPredicateProperty.rangeDatatypeURI?? > <#assign datatype = editConfiguration.dataPredicateProperty.rangeDatatypeURI!"none" />
<#assign datatype = editConfiguration.dataPredicateProperty.rangeDatatypeURI />
<#else>
<#assign datatype = "none" />
</#if>
<form class="editForm" action = "${submitUrl}" method="post"> <form class="editForm" action = "${submitUrl}" method="post">
<input type="hidden" name="editKey" id="editKey" value="${editKey}" role="input" /> <input type="hidden" name="editKey" id="editKey" value="${editKey}" role="input" />
@ -35,16 +31,15 @@
<label for="${editConfiguration.dataLiteral}"><p class="propEntryHelpText">${editConfiguration.dataPredicatePublicDescription}</p></label> <label for="${editConfiguration.dataLiteral}"><p class="propEntryHelpText">${editConfiguration.dataPredicatePublicDescription}</p></label>
</#if> </#if>
<#if datatype = "http://www.w3.org/2001/XMLSchema#integer" || datatype = "http://www.w3.org/2001/XMLSchema#int"> <#if "HTML" == editConfiguration.dataPredicateProperty.editing!>
<input <textarea rows="2" id="literal" name="literal" class="useTinyMce" role="textarea">${literalValues}</textarea>
type="text" id="literal" name="literal" value="${literalValues}"
placeholder="123456" <#elseif datatype = "http://www.w3.org/2001/XMLSchema#integer" || datatype = "http://www.w3.org/2001/XMLSchema#int">
/> <input type="text" id="literal" name="literal" value="${literalValues}" placeholder="123456" />
<#elseif datatype = "http://www.w3.org/2001/XMLSchema#float"> <#elseif datatype = "http://www.w3.org/2001/XMLSchema#float">
<input <input type="text" id="literal" name="literal" value="${literalValues}" placeholder="12.345" />
type="text" id="literal" name="literal" value="${literalValues}"
placeholder="12.345"
/>
<#elseif datatype = "http://www.w3.org/2001/XMLSchema#boolean"> <#elseif datatype = "http://www.w3.org/2001/XMLSchema#boolean">
<select id="literal" name="literal"> <select id="literal" name="literal">
<#if literalValues = "true"> <#if literalValues = "true">
@ -55,11 +50,10 @@
<option value="false" selected="true">false</option> <option value="false" selected="true">false</option>
</#if> </#if>
</select> </select>
<#elseif datatype = "http://www.w3.org/2001/XMLSchema#anyURI"> <#elseif datatype = "http://www.w3.org/2001/XMLSchema#anyURI">
<input <input type="text" id="literal" name="literal" value="${literalValues}" placeholder="http://..." />
type="text" id="literal" name="literal" value="${literalValues}"
placeholder="http://..."
/>
<#elseif datatype = "http://www.w3.org/2001/XMLSchema#dateTime" || <#elseif datatype = "http://www.w3.org/2001/XMLSchema#dateTime" ||
datatype = "http://www.w3.org/2001/XMLSchema#date" || datatype = "http://www.w3.org/2001/XMLSchema#date" ||
datatype = "http://www.w3.org/2001/XMLSchema#time" || datatype = "http://www.w3.org/2001/XMLSchema#time" ||
@ -67,8 +61,10 @@
datatype = "http://www.w3.org/2001/XMLSchema#gYear" || datatype = "http://www.w3.org/2001/XMLSchema#gYear" ||
datatype = "http://www.w3.org/2001/XMLSchema#gMonth" > datatype = "http://www.w3.org/2001/XMLSchema#gMonth" >
<#include "dateTimeEntryForm.ftl"> <#include "dateTimeEntryForm.ftl">
<#else> <#else>
<textarea rows="2" id="literal" name="literal" value="" class="useTinyMce" role="textarea">${literalValues}</textarea> <input type="text" size="70" id="literal" name="literal" value="${literalValues}" />
</#if> </#if>
<br /> <br />