+ <#--below shows examples of both printing out all error messages and checking the error message for a specific field-->
+ <#list submissionErrors?keys as errorFieldName>
+ <#if errorFieldName == "startField">
+ <#if submissionErrors[errorFieldName]?contains("before")>
+ ${i18n().start_year_must_precede_end}
+ <#else>
+ ${submissionErrors[errorFieldName]}
+ #if>
+
+ <#elseif errorFieldName == "endField">
+ <#if submissionErrors[errorFieldName]?contains("after")>
+ ${i18n().end_year_must_be_later}
+ <#else>
+ ${submissionErrors[errorFieldName]}
+ #if>
+ <#else>
+ ${submissionErrors[errorFieldName]}
+ #if>
+ #list>
+ <#--Checking if Person Type field is empty-->
+ <#if lvf.submissionErrorExists(editSubmission, "personType")>
+ ${i18n().select_person_type}
+ #if>
+ <#--Checking if Person Name field is empty-->
+ <#if lvf.submissionErrorExists(editSubmission, "personLabel")>
+ ${i18n().select_an_person_name}
+ #if>
+ <#--Checking if Training Type field is empty-->
+ <#if lvf.submissionErrorExists(editSubmission, "trainingType")>
+ ${i18n().select_educational_training_value}
+ #if>
+
+
+
+
+#if>
+
+<@lvf.unsupportedBrowser urls.base />
+
+
+
+
+
+
+
+
+
+
+${stylesheets.add('')}
+${stylesheets.add('')}
+${stylesheets.add('')}
+
+
+${scripts.add('',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '')}
+
+
diff --git a/rdf/display/everytime/PropertyConfig.n3 b/rdf/display/everytime/PropertyConfig.n3
index 79f702e5..5ec9d41a 100644
--- a/rdf/display/everytime/PropertyConfig.n3
+++ b/rdf/display/everytime/PropertyConfig.n3
@@ -1745,6 +1745,7 @@ local:bfo_0000055Config a :ObjectPropertyDisplayConfig ;
vitro:displayRankAnnot 17;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:nobody ;
+ vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ProjectHasParticipantGenerator"^^ ;
:propertyGroup .
### grant roles using the core:relates property ###
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ProjectHasParticipantGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ProjectHasParticipantGenerator.java
new file mode 100644
index 00000000..88642c89
--- /dev/null
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ProjectHasParticipantGenerator.java
@@ -0,0 +1,184 @@
+/* $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;
+
+import com.hp.hpl.jena.vocabulary.XSD;
+
+import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
+import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.FirstAndLastNameValidator;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeIntervalValidationVTwo;
+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.fields.ChildVClassesOptions;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesWithParent;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.IndividualsViaVClassOptions;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
+import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
+import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils;
+
+public class ProjectHasParticipantGenerator extends VivoBaseGenerator implements EditConfigurationGenerator{
+
+ //TODO: can we get rid of the session and get it form the vreq?
+ public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, HttpSession session) throws Exception {
+
+ EditConfigurationVTwo conf = new EditConfigurationVTwo();
+
+ initBasics(conf, vreq);
+ initPropertyParameters(vreq, session, conf);
+ initObjectPropForm(conf, vreq);
+
+ conf.setTemplate("projectHasParticipant.ftl");
+
+ conf.setVarNameForSubject("project");
+ conf.setVarNameForPredicate("predicate");
+ conf.setVarNameForObject("projectRole");
+
+ conf.setN3Required( Arrays.asList( n3ForNewProjectRole ) );
+ conf.setN3Optional(Arrays.asList( n3ForNewPerson, n3ForExistingPerson, firstNameAssertion, lastNameAssertion ) );
+
+ conf.addNewResource("projectRole", DEFAULT_NS_FOR_NEW_RESOURCE);
+ conf.addNewResource("newPerson",DEFAULT_NS_FOR_NEW_RESOURCE);
+ conf.addNewResource("vcardPerson", DEFAULT_NS_FOR_NEW_RESOURCE);
+ conf.addNewResource("vcardName", DEFAULT_NS_FOR_NEW_RESOURCE);
+
+ //uris in scope: none
+ //literals in scope: none
+
+ conf.setUrisOnform( Arrays.asList( "existingPerson"));
+ conf.setLiteralsOnForm( Arrays.asList("personLabel", "personLabelDisplay", "roleLabel",
+ "roleLabeldisplay", "firstName", "lastName"));
+
+ conf.addSparqlForExistingLiteral("personLabel", personLabelQuery);
+ conf.addSparqlForExistingLiteral("roleLabel", roleLabelQuery);
+
+ conf.addSparqlForExistingUris("existingPerson", existingPersonQuery);
+
+ conf.addField( new FieldVTwo().
+ setName("existingPerson")
+ //options will be added in browser by auto complete JS
+ );
+
+ conf.addField( new FieldVTwo().
+ setName("personLabel").
+ setRangeDatatypeUri(XSD.xstring.toString() ).
+ setValidators( list("datatype:" + XSD.xstring.toString())));
+
+ conf.addField( new FieldVTwo().
+ setName("roleLabel").
+ setRangeDatatypeUri(XSD.xstring.toString() ).
+ setValidators( list("datatype:" + XSD.xstring.toString(),"nonempty")));
+
+ conf.addField( new FieldVTwo().
+ setName("personLabelDisplay").
+ setRangeDatatypeUri(XSD.xstring.toString() ));
+
+ conf.addField( new FieldVTwo().
+ setName("roleLabelDisplay").
+ setRangeDatatypeUri(XSD.xstring.toString() ));
+
+ conf.addField( new FieldVTwo().
+ setName("firstName").
+ setRangeDatatypeUri(XSD.xstring.toString() ).
+ setValidators( list("datatype:" + XSD.xstring.toString()) )
+ );
+
+ conf.addField( new FieldVTwo().
+ setName("lastName").
+ setRangeDatatypeUri(XSD.xstring.toString() ).
+ setValidators( list("datatype:" + XSD.xstring.toString()) )
+ );
+
+ //Add validator
+ conf.addValidator(new AntiXssValidation());
+ conf.addValidator(new FirstAndLastNameValidator("existingPerson"));
+
+ //Adding additional data, specifically edit mode
+ addFormSpecificData(conf, vreq);
+ prepare(vreq, conf);
+ return conf;
+ }
+
+ /* N3 assertions for working with educational training */
+
+ final static String n3ForNewProjectRole =
+ "@prefix core: <"+ vivoCore +"> .\n" +
+ "@prefix rdfs: <"+ rdfs +"> . \n"+
+ "?project ?projectRole .\n" +
+ "?projectRole a .\n" +
+ "?projectRole ?project . \n" +
+ "?projectRole <"+ label +"> ?roleLabel . \n" ;
+
+ final static String n3ForNewPerson =
+ "?projectRole ?newPerson . \n" +
+ "?newPerson ?projectRole . \n" +
+ "?newPerson a . \n" +
+ "?newPerson <"+ label +"> ?personLabel . ";
+
+ final static String n3ForExistingPerson =
+ "?projectRole ?existingPerson . \n" +
+ "?existingPerson ?projectRole . \n" +
+ " ";
+
+ final static String firstNameAssertion =
+ "@prefix vcard: . \n" +
+ "?newPerson ?vcardPerson . \n" +
+ "?vcardPerson ?newPerson . \n" +
+ "?vcardPerson a . \n" +
+ "?vcardPerson vcard:hasName ?vcardName . \n" +
+ "?vcardName a . \n" +
+ "?vcardName vcard:givenName ?firstName .";
+
+ final static String lastNameAssertion =
+ "@prefix vcard: . \n" +
+ "?newPerson ?vcardPerson . \n" +
+ "?vcardPerson ?newPerson . \n" +
+ "?vcardPerson a . \n" +
+ "?vcardPerson vcard:hasName ?vcardName . \n" +
+ "?vcardName a . \n" +
+ "?vcardName vcard:familyName ?lastName .";
+
+ /* Queries for editing an existing educational training entry */
+
+ final static String roleLabelQuery =
+ "SELECT ?roleLabel WHERE {\n"+
+ "?projectRole <"+ label +"> ?roleLabel }\n";
+
+ final static String existingPersonQuery =
+ "PREFIX rdfs: <"+ rdfs +"> \n"+
+ "SELECT ?existingPerson WHERE {\n"+
+ "?projectRole ?existingPerson . \n" +
+ "?existingPerson ?projectRole . \n" +
+ "?existingPerson a . \n " +
+ " }";
+
+ final static String personLabelQuery =
+ "PREFIX rdfs: <"+ rdfs +"> \n"+
+ "SELECT ?existingPersonLabel WHERE {\n"+
+ "?projectRole ?existingPerson . \n" +
+ "?existingPerson ?projectRole .\n"+
+ "?existingPerson <"+ label +"> ?existingPersonLabel .\n"+
+ "?existingPerson a . \n " +
+ " }";
+
+
+ //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("http://purl.obolibrary.org/obo/RO_0000053");
+ return EditModeUtils.getEditMode(vreq, predicates);
+ }
+}
diff --git a/themes/wilma/i18n/all.properties b/themes/wilma/i18n/all.properties
index d1c4bd51..9154b55a 100644
--- a/themes/wilma/i18n/all.properties
+++ b/themes/wilma/i18n/all.properties
@@ -883,4 +883,5 @@ administering_organization_for = administering organization for
missing_credential = missing credential
grant_administered_by = grant being administered by
missing_grant = missing grant
-editor_of_entry = editor of entry for
\ No newline at end of file
+editor_of_entry = editor of entry for
+researcher_role = Researcher's role in the project
\ No newline at end of file