From 5e13309e8a4497d2da28c795403bd94896f534f8 Mon Sep 17 00:00:00 2001 From: tworrall Date: Wed, 4 Apr 2012 14:01:41 +0000 Subject: [PATCH] custom form changes to support editable autocomplete fields; new validator classes --- .../edit/forms/addPresenterRoleToPerson.ftl | 34 ++- .../edit/forms/addPublicationToPerson.ftl | 70 +++++- .../forms/js/advisingRelationshipUtils.js | 15 ++ .../edit/forms/js/awardReceiptUtils.js | 2 +- .../forms/js/customFormWithAutocomplete.js | 5 +- .../edit/forms/js/publicationToPersonUtils.js | 82 +++++-- .../forms/personHasAdvisingRelationship.ftl | 11 +- .../edit/forms/personHasAwardOrHonor.ftl | 9 +- ...> AutocompleteRequiredInputValidator.java} | 36 +-- .../n3editing/PersonHasAdviseesValidator.java | 4 +- .../PersonHasPublicationValidator.java | 65 ++++-- .../AddPresenterRoleToPersonGenerator.java | 68 ++++-- .../AddPublicationToPersonGenerator.java | 214 ++++++++++++++---- .../PersonHasAwardOrHonorGenerator.java | 4 +- 14 files changed, 462 insertions(+), 157 deletions(-) rename src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/{PersonHasAwardOrHonorValidator.java => AutocompleteRequiredInputValidator.java} (59%) diff --git a/productMods/templates/freemarker/edit/forms/addPresenterRoleToPerson.ftl b/productMods/templates/freemarker/edit/forms/addPresenterRoleToPerson.ftl index 6b34ccb1..6bbb2a08 100644 --- a/productMods/templates/freemarker/edit/forms/addPresenterRoleToPerson.ftl +++ b/productMods/templates/freemarker/edit/forms/addPresenterRoleToPerson.ftl @@ -13,20 +13,27 @@ <#assign editMode = "add"> -<#assign newUriSentinel = "" /> -<#if editConfigurationConstants?has_content> - <#assign newUriSentinel = editConfigurationConstants["NEW_URI_SENTINEL"] /> +<#assign blankSentinel = "" /> +<#if editConfigurationConstants?has_content && editConfigurationConstants?keys?seq_contains("BLANK_SENTINEL")> + <#assign blankSentinel = editConfigurationConstants["BLANK_SENTINEL"] /> +<#--This flag is for clearing the label field on submission for an existing object being selected from autocomplete. +Set this flag on the input acUriReceiver where you would like this behavior to occur. --> +<#assign flagClearLabelForExisting = "flagClearLabelForExisting" /> + + <#assign htmlForElements = editConfiguration.pageData.htmlForElements /> <#--Retrieve variables needed--> -<#assign presentationValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "presentation") /> +<#assign presentationValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "existingPresentation") /> <#assign presentationLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "presentationLabel") /> +<#assign presentationLabelDisplayValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "presentationLabelDisplay") /> <#assign presentationTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "presentationType") /> <#assign roleLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "roleLabel") /> -<#assign conferenceValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "conference") /> +<#assign conferenceValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "existingConference") /> <#assign conferenceLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "conferenceLabel") /> +<#assign conferenceLabelDisplayValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "conferenceLabelDisplay") /> <#--If edit submission exists, then retrieve validation errors if they exist--> <#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content> @@ -50,6 +57,12 @@ <#--Display error messages if any--> <#if submissionErrors?has_content> + <#if conferenceLabelDisplayValue?has_content > + <#assign conferenceLabelValue = conferenceLabelDisplayValue /> + + <#if presentationLabelDisplayValue?has_content > + <#assign presentationLabelValue = presentationLabelDisplayValue /> +