[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:
parent
734b9ccf68
commit
129e1219a8
6 changed files with 31 additions and 20 deletions
|
@ -22,6 +22,8 @@ public class DataProperty extends Property implements Comparable<DataProperty>,
|
|||
private String domainClassURI = null;
|
||||
private String rangeDatatypeURI = null;
|
||||
|
||||
private String editing = null;
|
||||
|
||||
private boolean functional = false;
|
||||
|
||||
private String example = null;
|
||||
|
@ -89,6 +91,14 @@ public class DataProperty extends Property implements Comparable<DataProperty>,
|
|||
public void setRangeDatatypeURI(String rangeDatatypeURI) {
|
||||
this.rangeDatatypeURI = rangeDatatypeURI;
|
||||
}
|
||||
|
||||
public void setEditing(String editing) {
|
||||
this.editing = editing;
|
||||
}
|
||||
|
||||
public String getEditing() {
|
||||
return this.editing;
|
||||
}
|
||||
|
||||
public boolean getFunctional() {
|
||||
return this.functional;
|
||||
|
|
|
@ -46,6 +46,7 @@ public class VitroVocabulary {
|
|||
|
||||
public static final String DESCRIPTION_ANNOT = vitroURI + "descriptionAnnot";
|
||||
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 EXAMPLE_ANNOT = "http://purl.obolibrary.org/obo/IAO_0000112";
|
||||
|
||||
|
|
|
@ -197,6 +197,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
|||
dp.setExample(getPropertyStringValue(op,EXAMPLE_ANNOT));
|
||||
dp.setDescription(getPropertyStringValue(op,DESCRIPTION_ANNOT));
|
||||
dp.setPublicDescription(getPropertyStringValue(op,PUBLIC_DESCRIPTION_ANNOT));
|
||||
dp.setEditing(getPropertyStringValue(op,EDITING));
|
||||
dp.setDisplayTier((getWebappDaoFactory()).getJenaBaseDao().getPropertyNonNegativeIntValue(op, DISPLAY_RANK_ANNOT));
|
||||
dp.setDisplayLimit((getWebappDaoFactory()).getJenaBaseDao().getPropertyNonNegativeIntValue(op, DISPLAY_LIMIT));
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ public class JenaBaseDaoCon {
|
|||
protected AnnotationProperty DESCRIPTION_ANNOT = _constModel.createAnnotationProperty(VitroVocabulary.DESCRIPTION_ANNOT);
|
||||
protected AnnotationProperty PUBLIC_DESCRIPTION_ANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PUBLIC_DESCRIPTION_ANNOT);
|
||||
protected AnnotationProperty SHORTDEF = _constModel.createAnnotationProperty(VitroVocabulary.SHORTDEF);
|
||||
|
||||
protected AnnotationProperty EDITING = _constModel.createAnnotationProperty(VitroVocabulary.EDITING);
|
||||
|
||||
protected DatatypeProperty MONIKER = _constModel.createDatatypeProperty(VitroVocabulary.MONIKER);
|
||||
protected OntClass CLASSGROUP = _constModel.createClass(VitroVocabulary.CLASSGROUP);
|
||||
|
|
|
@ -36,6 +36,7 @@ xmlns:vitro="&vitro;"
|
|||
<owl:AnnotationProperty rdf:about="&vitro;modTimeAnnot"/>
|
||||
<owl:AnnotationProperty rdf:about="&vitro;shortDefAnnot"/>
|
||||
<owl:AnnotationProperty rdf:about="&vitro;oldId"/>
|
||||
<owl:AnnotationProperty rdf:about="&vitro;editing"/>
|
||||
|
||||
<!-- VClassGroup-related constructs -->
|
||||
|
||||
|
|
|
@ -23,28 +23,23 @@
|
|||
</#if>
|
||||
|
||||
<#assign literalValues = "${editConfiguration.dataLiteralValuesAsString}" />
|
||||
<#if editConfiguration.dataPredicateProperty.rangeDatatypeURI?? >
|
||||
<#assign datatype = editConfiguration.dataPredicateProperty.rangeDatatypeURI />
|
||||
<#else>
|
||||
<#assign datatype = "none" />
|
||||
</#if>
|
||||
<#assign datatype = editConfiguration.dataPredicateProperty.rangeDatatypeURI!"none" />
|
||||
|
||||
<form class="editForm" action = "${submitUrl}" method="post">
|
||||
<input type="hidden" name="editKey" id="editKey" value="${editKey}" role="input" />
|
||||
<#if editConfiguration.dataPredicatePublicDescription?has_content>
|
||||
<label for="${editConfiguration.dataLiteral}"><p class="propEntryHelpText">${editConfiguration.dataPredicatePublicDescription}</p></label>
|
||||
</#if>
|
||||
|
||||
<#if 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"
|
||||
/>
|
||||
|
||||
<#if "HTML" == editConfiguration.dataPredicateProperty.editing!>
|
||||
<textarea rows="2" id="literal" name="literal" class="useTinyMce" role="textarea">${literalValues}</textarea>
|
||||
|
||||
<#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">
|
||||
<input
|
||||
type="text" id="literal" name="literal" value="${literalValues}"
|
||||
placeholder="12.345"
|
||||
/>
|
||||
<input type="text" id="literal" name="literal" value="${literalValues}" placeholder="12.345" />
|
||||
|
||||
<#elseif datatype = "http://www.w3.org/2001/XMLSchema#boolean">
|
||||
<select id="literal" name="literal">
|
||||
<#if literalValues = "true">
|
||||
|
@ -55,11 +50,10 @@
|
|||
<option value="false" selected="true">false</option>
|
||||
</#if>
|
||||
</select>
|
||||
|
||||
<#elseif datatype = "http://www.w3.org/2001/XMLSchema#anyURI">
|
||||
<input
|
||||
type="text" id="literal" name="literal" value="${literalValues}"
|
||||
placeholder="http://..."
|
||||
/>
|
||||
<input type="text" id="literal" name="literal" value="${literalValues}" placeholder="http://..." />
|
||||
|
||||
<#elseif datatype = "http://www.w3.org/2001/XMLSchema#dateTime" ||
|
||||
datatype = "http://www.w3.org/2001/XMLSchema#date" ||
|
||||
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#gMonth" >
|
||||
<#include "dateTimeEntryForm.ftl">
|
||||
|
||||
<#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>
|
||||
|
||||
<br />
|
||||
|
|
Loading…
Add table
Reference in a new issue