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")> <#if lvf.submissionErrorExists(editSubmission, "presentationLabel")>
${i18n().select_or_enter_name} ${i18n().select_or_enter_name}
</#if> </#if>
<#if lvf.submissionErrorExists(editSubmission, "roleLabel")>
${i18n().enter_new_role_value}
</#if>
<#list submissionErrors?keys as errorFieldName> <#list submissionErrors?keys as errorFieldName>
<#if errorFieldName == "startField"> <#if errorFieldName == "startField">
<#if submissionErrors[errorFieldName]?contains("before")> <#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" /> <input class="acUriReceiver" type="hidden" id="presentationUri" name="existingPresentation" value="${existingPresentationValue}" ${flagClearLabelForExisting}="true" />
</div> </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}" /> <input size="50" type="text" id="roleLabel" name="roleLabel" value="${roleLabelValue}" />
</p> </p>
<p> <p>

View file

@ -179,7 +179,7 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
</div> </div>
<#if showRoleLabelField = true> <#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}" /> <input size="50" type="text" id="roleLabel" name="roleLabel" value="${roleLabel}" />
</p> </p>
</#if> </#if>

View file

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

View file

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