From e4be7c255d05be6bb9fd9bb6fee81f5169c6c87f Mon Sep 17 00:00:00 2001 From: rjy7 Date: Tue, 7 Sep 2010 20:04:19 +0000 Subject: [PATCH] NIHVIVO-1098 Make start year optional when editing a position history, but required when adding a new position history. --- .../edit/forms/personHasPositionHistory.jsp | 68 +++++++++++-------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/productMods/edit/forms/personHasPositionHistory.jsp b/productMods/edit/forms/personHasPositionHistory.jsp index 6cc684a4..56ded7b5 100644 --- a/productMods/edit/forms/personHasPositionHistory.jsp +++ b/productMods/edit/forms/personHasPositionHistory.jsp @@ -138,6 +138,36 @@ ${positionClass} ${orgClass} + + + +<%-- Configure add vs. edit --%> +<% + + String objectUri = (String) request.getAttribute("objectUri"); + if (objectUri != null) { // editing existing entry +%> + + + + + <%-- Start year is required for an add but not an edit (so editors don't have to look up the start date in order + to edit an existing entry with no start date). --%> + + +<% + } else { // adding new entry +%> + + + + + + +<% } %> + + + { "formUrl" : "${formUrl}", @@ -149,9 +179,9 @@ "object" : ["position", "${objectUriJson}", "URI" ], "n3required" : [ "${n3ForNewPosition}", "${positionTitleAssertion}", "${positionTypeAssertion}", - "${orgLabelAssertion}", "${orgTypeAssertion}", "${startYearAssertion}" ], + "${orgLabelAssertion}", "${orgTypeAssertion}" ], - "n3optional" : [ "${endYearAssertion}" ], + "n3optional" : [ "${startYearAssertion}", "${endYearAssertion}" ], "newResources" : { "position" : "${defaultNamespace}", "org" : "${defaultNamespace}" }, @@ -232,7 +262,7 @@ }, "startYear" : { "newResource" : "false", - "validators" : [ "nonempty", "datatype:${gYearDatatypeUriJson}" ], + "validators" : [ ${startYearRequired} "datatype:${gYearDatatypeUriJson}" ], "optionsType" : "UNDEFINED", "literalOptions" : [ ], "predicateUri" : "", @@ -255,6 +285,7 @@ } } + <% log.debug(request.getAttribute("editjson")); @@ -267,32 +298,12 @@ editConfig.addValidator(new StartYearBeforeEndYear("startYear","endYear") ); Model model = (Model) application.getAttribute("jenaOntModel"); - String objectUri = (String) request.getAttribute("objectUri"); + if (objectUri != null) { // editing existing editConfig.prepareForObjPropUpdate(model); } else { // adding new editConfig.prepareForNonUpdate(model); } - - String subjectName = ((Individual) request.getAttribute("subject")).getName(); -%> - - -<% - if (objectUri != null) { // editing existing entry -%> - - - - -<% - } else { // adding new entry -%> - - - - -<% } List customJs = new ArrayList(Arrays.asList(JavaScript.JQUERY_UI.path(), JavaScript.CUSTOM_FORM_UTILS.path(), @@ -304,12 +315,11 @@ Css.CUSTOM_FORM.path(), "/edit/forms/css/customFormWithAutocomplete.css" )); - request.setAttribute("customCss", customCss); + request.setAttribute("customCss", customCss); + + String subjectName = ((Individual) request.getAttribute("subject")).getName(); %> - - -

${titleVerb} position entry for <%= subjectName %>

@@ -339,7 +349,7 @@ - +