diff --git a/productMods/templates/freemarker/edit/forms/addPresenterRoleToPerson.ftl b/productMods/templates/freemarker/edit/forms/addPresenterRoleToPerson.ftl
index 75753ea2..854899b1 100644
--- a/productMods/templates/freemarker/edit/forms/addPresenterRoleToPerson.ftl
+++ b/productMods/templates/freemarker/edit/forms/addPresenterRoleToPerson.ftl
@@ -1,27 +1,197 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
-<#--Two stage form for service provider role-->
-<#--
-Required Values to be set for each form that includes addRoleToPersonTwoStage.ftl are:
-roleDescriptor.
-The other required values (roleType, optionsType, objectClassUri, and literalOptions are
-set in the JAVA class corresponding to the form, e.g. AddPresenterRoleToPersonGenerator.java.
+<#-- this is in request.subject.name -->
-Optional values can be set, but each of these has default values
-set in addRoleToPersonTwoStage.ftl:
+<#-- leaving this edit/add mode code in for reference in case we decide we need it -->
-buttonText
-typeSelectorLabel
-numDateFields
-showRoleLAbelField
-roleExamples-->
+<#import "lib-vivo-form.ftl" as lvf>
+
+<#--Retrieve certain edit configuration information-->
+<#if editConfiguration.objectUri?has_content>
+ <#assign editMode = "edit">
+<#else>
+ <#assign editMode = "add">
+#if>
+
+<#assign htmlForElements = editConfiguration.pageData.htmlForElements />
+
+<#--Retrieve variables needed-->
+<#assign presentationValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "presentation") />
+<#assign presentationLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "presentationLabel") />
+<#assign presentationTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "presentationType") />
+<#assign roleLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "roleLabel") />
+<#assign conferenceValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "conference") />
+<#assign conferenceLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "conferenceLabel") />
+
+<#--If edit submission exists, then retrieve validation errors if they exist-->
+<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
+ <#assign submissionErrors = editSubmission.validationErrors/>
+#if>
+
+<#if editMode == "edit">
+ <#assign titleVerb="Edit">
+ <#assign submitButtonText="Save Changes">
+ <#assign disabledVal="disabled">
+<#else>
+ <#assign titleVerb="Create">
+ <#assign submitButtonText="Create Entry">
+ <#assign disabledVal=""/>
+#if>
+
+<#assign requiredHint = " *" />
+<#assign yearHint = "(YYYY)" />
+
+
${titleVerb} award or honor for ${editConfiguration.subjectName}
+ <#--Checking if any required fields are empty-->
+ <#if lvf.submissionErrorExists(editSubmission, "presentationLabel")>
+ Please select an existing value or enter a new value in the Name field.
+ #if>
+ <#if lvf.submissionErrorExists(editSubmission, "roleLabel")>
+ Please enter a new value in the Role field.
+ #if>
+ <#list submissionErrors?keys as errorFieldName>
+ <#if errorFieldName == "startField">
+ <#if submissionErrors[errorFieldName]?contains("before")>
+ The Start Year must be earlier than the End Year.
+ <#else>
+ ${submissionErrors[errorFieldName]}
+ #if>
+
+ <#elseif errorFieldName == "endField">
+ <#if submissionErrors[errorFieldName]?contains("after")>
+ The End Year must be later than the Start Year.
+ <#else>
+ ${submissionErrors[errorFieldName]}
+ #if>
+ #if>
+ #list>
+
or Cancel
@@ -105,11 +257,19 @@
sparqlForAcFilter: '${sparqlForAcFilter}',
sparqlQueryUrl: '${sparqlQueryUrl}',
acUrl: '${urls.base}/autocomplete?tokenize=true',
+ acTypes: {collection: 'http://purl.org/ontology/bibo/Periodical', book: 'http://purl.org/ontology/bibo/Book', conference: 'http://purl.org/NET/c4dm/event.owl#Event', event: 'http://purl.org/NET/c4dm/event.owl#Event', editor: 'http://xmlns.com/foaf/0.1/Person', publisher: 'http://xmlns.com/foaf/0.1/Organization'},
editMode: '${editMode}',
defaultTypeName: 'publication', // used in repair mode to generate button text
+ multipleTypeNames: {collection: 'publication', book: 'book', conference: 'conference', event: 'event', editor: 'editor', publisher: 'publisher'},
baseHref: '${urls.base}/individual?uri='
};
+
+
#if>
@@ -121,4 +281,5 @@ ${stylesheets.add('',
'',
'',
+ '',
'')}
diff --git a/productMods/templates/freemarker/edit/forms/css/customFormWithAutocomplete.css b/productMods/templates/freemarker/edit/forms/css/customFormWithAutocomplete.css
index 742fb8a7..54218bd2 100644
--- a/productMods/templates/freemarker/edit/forms/css/customFormWithAutocomplete.css
+++ b/productMods/templates/freemarker/edit/forms/css/customFormWithAutocomplete.css
@@ -34,3 +34,17 @@ form.customForm h4 {
span.readOnly {
color: #000;
}
+/* special styles for addPublicationToPerson.ftl
+ volume, number, issue fields and start/end page fields */
+label.vniLabels {
+ padding-left: 50px;
+}
+input.vniInputs {
+ margin-left: 57px;
+}
+label.sepLabels {
+ padding-left: 31px;
+}
+input.sepInputs {
+ margin-left: 57px;
+}
diff --git a/productMods/templates/freemarker/edit/forms/js/customFormWithAutocomplete.js b/productMods/templates/freemarker/edit/forms/js/customFormWithAutocomplete.js
index 9b84c994..55a215ad 100644
--- a/productMods/templates/freemarker/edit/forms/js/customFormWithAutocomplete.js
+++ b/productMods/templates/freemarker/edit/forms/js/customFormWithAutocomplete.js
@@ -11,7 +11,7 @@ var customForm = {
}
this.mixIn();
this.initObjects();
- this.initPage();
+ this.initPage();
},
disableFormInUnsupportedBrowsers: function() {
@@ -54,7 +54,7 @@ var customForm = {
// the verify popup window. Although there could be multiple verifyMatch objects
// selecting one and binding the event works for all of them
this.verifyMatch = this.form.find('.verifyMatch');
-
+
// find all the acSelector input elements
this.acSelectors = [] ;
@@ -209,10 +209,9 @@ var customForm = {
// If an autocomplete selection has been made, undo it.
// NEED TO LINK THE TYPE SELECTOR TO THE ACSELECTOR IT'S ASSOCIATED WITH
- // BECAUSE THERE COULD BE MORE THAN ON AC FIELD. ASSOCIATION IS MADE BY
- // SHARING THE SAME ID -- "typeSelector" -- AMONG THE SELECT AND THE INPUT
- // AND THE AC SELECTION DIV
- // DO WE NEED AN IF STATEMENT AROUND THIS ****
+ // BECAUSE THERE COULD BE MORE THAN ONE AC FIELD. ASSOCIATION IS MADE VIA
+ // THE SPECIAL "acGroupName" ATTRIBUTE WHICH IS SHARED AMONG THE SELECT AND
+ // THE INPUT AND THE AC SELECTION DIV.
customForm.undoAutocompleteSelection($(this));
// Reinitialize view. If no type selection in a two-step form, go back to type view;
@@ -246,7 +245,6 @@ var customForm = {
},
initAutocomplete: function(selectedObj) {
-
this.getAcFilter();
//If specific individuals are to be filtered out, add them here
//to the filtering list
@@ -387,6 +385,9 @@ var customForm = {
var $acDiv = this.acSelections[$(selectedObj).attr('acGroupName')];
+ // provides a way to monitor selection in other js files, e.g. to hide fields upon selection
+ $acDiv.addClass("userSelected");
+
// If the form has a type selector, add type name to label in add mode. In edit mode, use typeSelectorSpan
// html. The second case is an "else if" and not an else because the template may not be passing the label
// to the acSelection macro or it may not be using the macro at all and the label is hard-coded in the html.
@@ -403,7 +404,6 @@ var customForm = {
$acDiv.find("a.verifyMatch").attr('href', this.baseHref + uri);
$changeLink = $acDiv.find('a.changeSelection');
- $changeLink.unbind('click');
$changeLink.click(function() {
customForm.undoAutocompleteSelection($acDiv);
});
@@ -430,25 +430,24 @@ var customForm = {
else {
$acSelectionObj = $(selectedObj);
}
- if ( !$acSelectionObj.is(':hidden') ) {
- var $acSelector = null;
- $.each(this.acSelectors, function() {
- if ( $(this).attr('acGroupName') == $acSelectionObj.attr('acGroupName') ) {
- $acSelector = $(this);
- }
- });
- $acSelector.parent("p").show();
- this.hideFields($acSelectionObj);
- $acSelectionObj.find("input.acUriReceiver").val('');
- $acSelectionObj.find("span").text('');
- $acSelectionObj.find("a.verifyMatch").attr('href', this.baseHref);
- $acSelector.val('');
- customForm.addAcHelpText($acSelector);
-
- //Resetting so disable submit button again for object property autocomplete
- if ( this.acSelectOnly ) {
- this.disableSubmit();
+ var $acSelector = null;
+ $.each(this.acSelectors, function() {
+ if ( $(this).attr('acGroupName') == $acSelectionObj.attr('acGroupName') ) {
+ $acSelector = $(this);
}
+ });
+ $acSelector.parent("p").show();
+ this.hideFields($acSelectionObj);
+ $acSelectionObj.removeClass('userSelected');
+ $acSelectionObj.find("input.acUriReceiver").val('');
+ $acSelectionObj.find("span").text('');
+ $acSelectionObj.find("a.verifyMatch").attr('href', this.baseHref);
+ $acSelector.val('');
+ customForm.addAcHelpText($acSelector);
+
+ //Resetting so disable submit button again for object property autocomplete
+ if ( this.acSelectOnly ) {
+ this.disableSubmit();
}
},
@@ -496,12 +495,15 @@ var customForm = {
// If this.acType is empty, we are either in a one-step form with no type yet selected,
// or in repair mode in a two-step form with no type selected. Use the default type
// name specified in the form data.
- if ( selectedObj && this.hasMultipleTypeNames ) {
+ if ( !selectedObj || !this.hasMultipleTypeNames ) {
+ return this.acTypes ? this.typeName : this.capitalize(this.defaultTypeName);
+ }
+ else if ( selectedObj && ( $(selectedObj).attr('acGroupName') == this.typeSelector.attr('acGroupName') ) ) {
+ return this.acTypes ? this.typeName : this.capitalize(this.defaultTypeName);
+ }
+ else {
var name = customForm.multipleTypeNames[$(selectedObj).attr('id')];
return this.capitalize(name);
- }
- else {
- return this.acTypes ? this.typeName : this.capitalize(this.defaultTypeName);
}
},
@@ -510,7 +512,7 @@ var customForm = {
var typeText;
// First case applies on page load; second case applies when the type gets changed. With multiple
// ac fields there are cases where we also have to check if the help text is already there
- if (!$(selectedObj).val() || $(selectedObj).hasClass(this.acHelpTextClass) || $(selectedObj).val().substring(0, 18) == "Select an existing" ) {
+ if (!$(selectedObj).val() || $(selectedObj).hasClass(this.acHelpTextClass) || $(selectedObj).val().substring(0, 18) == "Select an existing" ) {
typeText = this.getTypeNameForLabels($(selectedObj));
var helpText = "Select an existing " + typeText + " or create a new one.";
//Different for object property autocomplete
diff --git a/productMods/templates/freemarker/edit/forms/js/publicationToPersonUtils.js b/productMods/templates/freemarker/edit/forms/js/publicationToPersonUtils.js
new file mode 100644
index 00000000..bd7493e2
--- /dev/null
+++ b/productMods/templates/freemarker/edit/forms/js/publicationToPersonUtils.js
@@ -0,0 +1,139 @@
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+
+
+var publicationToPersonUtils = {
+
+ onLoad: function(mode) {
+ this.initObjectReferences();
+ this.bindEventListeners();
+
+ this.autoDateLabel.hide();
+ },
+
+ initObjectReferences: function() {
+
+ this.form = $('#addpublicationToPerson');
+ this.collection = $('#collection');
+ this.book = $('#book');
+ this.presentedAt = $('#conference');
+ this.proceedingsOf = $('#event');
+ this.editor = $('#editor');
+ this.editorUri = $('#editorUri');
+ this.publisher = $('#publisher');
+ this.locale = $('#locale');
+ this.volume = $('#volume');
+ this.volLabel = $('#volLabel');
+ this.number = $('#number');
+ this.nbrLabel = $('#nbrLabel');
+ this.issue = $('#issue');
+ this.issueLabel = $('#issueLabel');
+ this.startPage = $('#startPage');
+ this.sPLabel = $('#sPLabel');
+ this.endPage = $('#endPage');
+ this.ePLabel = $('#ePLabel');
+ this.typeSelector = $('#typeSelector');
+ this.autoDateLabel = null;
+
+ this.form.find('label').each(function() {
+ if ( $(this).attr('for') == "dateTime-year") {
+ publicationToPersonUtils.autoDateLabel = $(this);
+ }
+ });
+
+ this.pubTitle = $('input#title');
+ this.pubAcSelection = $('div#pubAcSelection');
+ this.fieldsForNewPub = $('#fieldsForNewPub');
+ this.changeLink = this.pubAcSelection.children('p').children('#changeSelection');
+ },
+
+ bindEventListeners: function() {
+ this.idCache = {};
+
+ this.typeSelector.change(function() {
+ publicationToPersonUtils.showFieldsForPub();
+ publicationToPersonUtils.displayFieldsForType();
+ });
+
+ // we need the delay in the next two functions to ensure the correct timing after the user
+ // selects the ac item. The .change handles a mouse click; .blur an arrow key and tab selection
+ this.pubTitle.change( function(objEvent) {
+ window.setTimeout('publicationToPersonUtils.hideFieldsForPub()', 180);
+ });
+
+ this.pubTitle.blur( function(objEvent) {
+ window.setTimeout('publicationToPersonUtils.hideFieldsForPub()', 180);
+ });
+
+ this.changeLink.click( function() {
+ publicationToPersonUtils.showFieldsForPub();
+ });
+ },
+
+ hideFieldsForPub: function() {
+ if ( this.pubAcSelection.attr('class').indexOf('userSelected') != -1 ) {
+ this.fieldsForNewPub.slideUp(250);
+ }
+ },
+
+ showFieldsForPub: function() {
+ this.fieldsForNewPub.show();
+ },
+
+ displayFieldsForType: function() {
+ // hide everything, then show what's needed based on type
+ // simpler in the event the user changes the type
+ this.collection.parent('p').hide();
+ this.book.parent('p').hide();
+ this.presentedAt.parent('p').hide();
+ this.proceedingsOf.parent('p').hide();
+ this.editor.parent('p').hide();
+ this.publisher.parent('p').hide();
+ this.locale.parent('p').hide();
+ this.volume.hide();
+ this.volLabel.hide();
+ this.number.hide();
+ this.nbrLabel.hide();
+ this.issue.hide();
+ this.issueLabel.hide();
+ this.startPage.parent('p').hide();
+ this.sPLabel.parent('p').hide();
+
+ var selectedType = this.typeSelector.find(':selected').text();
+ if ( selectedType == 'Academic Article' || selectedType == 'Article' || selectedType == 'Editorial Article' || selectedType == 'Review') {
+ this.collection.parent('p').show();
+ this.volume.show();
+ this.volLabel.show();
+ this.number.show();
+ this.nbrLabel.show();
+ this.issue.show();
+ this.issueLabel.show();
+ this.startPage.parent('p').show();
+ this.sPLabel.parent('p').show();
+ }
+ else if ( selectedType == 'Chapter' ) {
+ this.book.parent('p').show();
+ this.editor.parent('p').show();
+ this.publisher.parent('p').show();
+ this.locale.parent('p').show();
+ this.volume.show();
+ this.volLabel.show();
+ }
+ else if ( selectedType == 'Book' || selectedType == 'Edited Book' ) {
+ this.editor.parent('p').show();
+ this.publisher.parent('p').show();
+ this.locale.parent('p').show();
+ this.volume.show();
+ this.volLabel.show();
+ }
+ else if ( selectedType == 'Conference Paper' ) {
+// this.collection.parent('p').show();
+ this.presentedAt.parent('p').show();
+// this.startPage.parent('p').show();
+// this.sPLabel.parent('p').show();
+ }
+ else if ( selectedType == 'Conference Poster' || selectedType == 'Speech') {
+ this.presentedAt.parent('p').show();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/productMods/templates/freemarker/edit/forms/personHasAwardOrHonor.ftl b/productMods/templates/freemarker/edit/forms/personHasAwardOrHonor.ftl
index 95c58aa1..7f2890b3 100644
--- a/productMods/templates/freemarker/edit/forms/personHasAwardOrHonor.ftl
+++ b/productMods/templates/freemarker/edit/forms/personHasAwardOrHonor.ftl
@@ -110,17 +110,15 @@