VIVO-654: make role label fields on custom forms optional input, not required

This commit is contained in:
Tim Worrall 2014-06-04 16:56:49 -04:00
parent 78ee69ee00
commit 8c1e3cde93
4 changed files with 13 additions and 20 deletions

View file

@ -73,9 +73,6 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
<#if lvf.submissionErrorExists(editSubmission, "presentationLabel")>
${i18n().select_or_enter_name}
</#if>
<#if lvf.submissionErrorExists(editSubmission, "roleLabel")>
${i18n().enter_new_role_value}
</#if>
<#list submissionErrors?keys as errorFieldName>
<#if errorFieldName == "startField">
<#if submissionErrors[errorFieldName]?contains("before")>
@ -128,7 +125,7 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
<input class="acUriReceiver" type="hidden" id="presentationUri" name="existingPresentation" value="${existingPresentationValue}" ${flagClearLabelForExisting}="true" />
</div>
<p><label for="roleLabel">${i18n().role_in} ${i18n().presentation_capitalized} ${requiredHint} <span class="hint">(${i18n().presentation_hint})</span></label>
<p><label for="roleLabel">${i18n().role_in} ${i18n().presentation_capitalized} <span class="hint">(${i18n().presentation_hint})</span></label>
<input size="50" type="text" id="roleLabel" name="roleLabel" value="${roleLabelValue}" />
</p>
<p>

View file

@ -179,7 +179,7 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
</div>
<#if showRoleLabelField = true>
<p><label for="roleLabel">${i18n().role_in} ${genericLabel?capitalize} ${requiredHint} ${roleExamples}</label>
<p><label for="roleLabel">${i18n().role_in} ${genericLabel?capitalize} ${roleExamples}</label>
<input size="50" type="text" id="roleLabel" name="roleLabel" value="${roleLabel}" />
</p>
</#if>

View file

@ -58,9 +58,9 @@ public class AddPresenterRoleToPersonGenerator extends VivoBaseGenerator impleme
conf.setVarNameForPredicate("predicate");
conf.setVarNameForObject("role");
conf.setN3Required( Arrays.asList( n3ForNewRole,
roleLabelAssertion) );
conf.setN3Optional( Arrays.asList( n3ForNewPresentation,
conf.setN3Required( Arrays.asList( n3ForNewRole ) );
conf.setN3Optional( Arrays.asList( n3ForRoleLabelAssertion,
n3ForNewPresentation,
n3ForExistingPresentation,
n3ForNewConferenceNewPres,
n3ForNewConferenceExistingPres,
@ -125,10 +125,9 @@ public class AddPresenterRoleToPersonGenerator extends VivoBaseGenerator impleme
);
conf.addField( new FieldVTwo().
setName("roleLabel")
.setRangeDatatypeUri( XSD.xstring.toString() ).
setValidators( list("nonempty") )
);
setName("roleLabel").
setRangeDatatypeUri( XSD.xstring.toString() ).
setValidators(list("datatype:" + XSD.xstring.toString())));
conf.addField( new FieldVTwo(). // an autocomplete field
setName("existingConference")
@ -169,13 +168,13 @@ public class AddPresenterRoleToPersonGenerator extends VivoBaseGenerator impleme
/* N3 assertions */
final static String n3ForNewRole =
"@prefix core: <" + vivoCore + "> . \n\n" +
"@prefix core: <" + vivoCore + "> . \n" +
"?person <" + hasRolePred + "> ?role . \n" +
"?role a <" + roleClass + "> . \n" +
"?role <" + roleOfPred + "> ?person . ";
final static String roleLabelAssertion =
"?role <" + label + "> ?roleLabel .";
final static String n3ForRoleLabelAssertion =
"?role <" + label + "> ?roleLabel . ";
final static String n3ForNewPresentation =
"?role <" + roleRealizedInPred + "> ?presentation . \n" +

View file

@ -737,9 +737,6 @@ public abstract class AddRoleToPersonTwoStageGenerator extends BaseEditConfigura
List<String> validators = new ArrayList<String>();
validators.add("datatype:" + stringDatatypeUri);
if(isShowRoleLabelField()) {
validators.add("nonempty");
}
field.setValidators(validators);
fields.put(field.getName(), field);