diff --git a/productMods/templates/freemarker/edit/forms/addGrantRoleToPerson.ftl b/productMods/templates/freemarker/edit/forms/addGrantRoleToPerson.ftl index 5f39ce47..59d09f2c 100644 --- a/productMods/templates/freemarker/edit/forms/addGrantRoleToPerson.ftl +++ b/productMods/templates/freemarker/edit/forms/addGrantRoleToPerson.ftl @@ -1,4 +1,5 @@ <#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> +<#import "lib-vivo-form.ftl" as lvf> <#-- Template for adding a grant role, such as principal investigator, to a foaf:Persons --> <#--Retrieve certain edit configuration information--> @@ -40,14 +41,10 @@ <#--Get selected activity type value if it exists, this is alternative to below--> <#assign grantLabel = lvf.getFormFieldValue(editSubmission, editConfiguration, "grantLabel")/> +<#--Get existing grant label value--> +<#assign existingGrantLabel = lvf.getFormFieldValue(editSubmission, editConfiguration, "existingGrantLabel")/> - <#--Get existing grant label value--> -<#assign existingGrantLabel = "" /> -<#if literalValues?keys?seq_contains("existingGrantLabel") && (literalValues.existingGrantLabel?size > 0)> - <#assign existingGrantLabel = literalValues.existingGrantLabel[0] /> - - <#assign requiredHint = " *" /> <#assign yearHint = "(YYYY)" /> diff --git a/productMods/templates/freemarker/edit/forms/personHasEducationalTraining.ftl b/productMods/templates/freemarker/edit/forms/personHasEducationalTraining.ftl index 4cefe9e3..c478c7ca 100644 --- a/productMods/templates/freemarker/edit/forms/personHasEducationalTraining.ftl +++ b/productMods/templates/freemarker/edit/forms/personHasEducationalTraining.ftl @@ -10,11 +10,17 @@ <#assign roleActivityUri="mysteryRoleActivityURI"/> <#assign orgLabel="mysteryOrgLabel"/> -<#if editConfiguration.object?has_content> - <#assign editMode = "edit"> -<#else> - <#assign editMode = "add"> - +<#--Retrieve certain edit configuration information--> +<#assign editMode = editConfiguration.pageData.editMode /> +<#assign htmlForElements = editConfiguration.pageData.htmlForElements /> + +<#--Retrieve variables needed--> +<#assign orgTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "orgType")/> +<#assign orgLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "orgLabel") /> +<#assign deptValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "dept") /> +<#assign infoValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "info") /> +<#assign majorFieldValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "majorField") /> +<#assign degreeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "degree") /> <#if editMode == "edit"> <#assign titleVerb="Edit"> @@ -67,7 +73,7 @@ +

+ <#--Store values in hidden fields--> + <#if editMode="edit"> + + + +

(Verify this match)

- + - +

- +

@@ -102,39 +114,41 @@ <#assign degreeOpts = editConfiguration.pageData.degree />

- +

- +
e.g., Postdoctoral training or Transferred

- - -
- -
- - -
- -
- + <#--Need to draw edit elements for dates here--> + <#if htmlForElements?keys?seq_contains("startField")> + + ${htmlForElements["startField"]} + + <#if htmlForElements?keys?seq_contains("endField")> + + ${htmlForElements["startField"]} + + + <#--End draw elements--> + +

or - Cancel + Cancel

* required fields

diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasEducationalTraining.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasEducationalTraining.java index b9a88bc5..25614ac9 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasEducationalTraining.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasEducationalTraining.java @@ -1,7 +1,10 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators; +import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; +import java.util.List; import javax.servlet.http.HttpSession; @@ -14,6 +17,8 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeIntervalVali import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo; +import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode; +import edu.cornell.mannlib.vitro.webapp.utils.generators.AddRoleUtils; /** Form for adding an educational attainment to an individual @@ -168,6 +173,8 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements VitroVocabulary.Precision.NONE.uri()))); //Add validator conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField")); + //Adding additional data, specifically edit mode + addFormSpecificData(conf, vreq); return conf; } @@ -308,5 +315,18 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements "?intervalNode <"+ intervalToEnd +"> ?endNode .\n"+ "?endNode <"+ type +"> <"+ dateTimeValueType +"> .\n"+ "?endNode <"+ dateTimePrecision +"> ?existingEndPrecision . }"; + + //Adding form specific data such as edit mode + public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { + HashMap formSpecificData = new HashMap(); + formSpecificData.put("editMode", getEditMode(vreq).name().toLowerCase()); + editConfiguration.setFormSpecificData(formSpecificData); + } + + public EditMode getEditMode(VitroRequest vreq) { + List predicates = new ArrayList(); + predicates.add(trainingAtOrg); + return AddRoleUtils.getEditMode(vreq, predicates); + } }