diff --git a/productMods/edit/forms/addAuthorsToInformationResource.jsp b/productMods/edit/forms/addAuthorsToInformationResource.jsp index f7ad59bf..79c6bb01 100644 --- a/productMods/edit/forms/addAuthorsToInformationResource.jsp +++ b/productMods/edit/forms/addAuthorsToInformationResource.jsp @@ -125,13 +125,13 @@ SPARQL queries for existing values. --%> ?newPerson core:authorInAuthorship ?authorshipUri . - + { "formUrl" : "${formUrl}", "editKey" : "${editKey}", - "urlPatternToReturnTo" : "${returnPath}", + "urlPatternToReturnTo" : "${returnPathAfterSubmit}", "subject" : ["infoResource", "${subjectUriJson}" ], "predicate" : ["predicate", "${predicateUriJson}" ], @@ -224,10 +224,11 @@ SPARQL queries for existing values. --%> EditConfiguration.putConfigInSession(editConfig,session); } + // Doing this in Javascript instead. // For now the field names in CreateLabelFromFieldNames.processEditSubmission() are - // hard-coded. If we want the flexibility in naming them, we can pass in a map of + // hard-coded. If we want flexibility in naming them, we can pass in a map of // the field names when creating the preprocessor. - editConfig.addEditSubmissionPreprocessor(new CreateLabelFromNameFields(editConfig)); + // editConfig.addEditSubmissionPreprocessor(new CreateLabelFromNameFields(editConfig)); Model model = (Model) application.getAttribute("jenaOntModel"); String objectUri = (String) request.getAttribute("objectUri"); @@ -295,7 +296,7 @@ SPARQL queries for existing values. --%>
- +
@@ -304,11 +305,14 @@ SPARQL queries for existing values. --%>

${initialHint}

${initialHint}

- - + -

+ + + + +

* required fields

diff --git a/productMods/edit/forms/js/addAuthorsToInformationResource.js b/productMods/edit/forms/js/addAuthorsToInformationResource.js index a1f5444c..95d2ca4b 100644 --- a/productMods/edit/forms/js/addAuthorsToInformationResource.js +++ b/productMods/edit/forms/js/addAuthorsToInformationResource.js @@ -23,7 +23,15 @@ var addAuthorForm = { this.showFormDiv = $('#showAddForm'); this.showFormButton = $('#showAddFormButton'); this.removeLinks = $('a.remove'); + this.submit = this.form.find(':submit'); this.cancel = this.form.find('.cancel'); + this.labelField = $('#label'); + this.firstNameField = $('#firstName'); + this.middleNameField = $('#middleName'); + this.lastNameField = $('#lastName'); + this.personUriField = $('#personUri'); + this.firstNameWrapper = this.firstNameField.parent(); + this.middleNameWrapper = this.middleNameField.parent(); }, // On page load, make changes to the non-Javascript version for the Javascript version. @@ -38,20 +46,28 @@ var addAuthorForm = { }, initForm: function() { - + + //this.firstNameWrapper.hide(); + //this.middleNameWrapper.hide(); + this.showFormButton.click(function() { addAuthorForm.showFormDiv.hide(); addAuthorForm.form.show(); return false; }); + this.submit.click(function() { + addAuthorForm.insertLabel(); // might be insertLabelOrPersonUri + }); + this.cancel.click(function() { addAuthorForm.hideFields(addAuthorForm.form); addAuthorForm.showFormDiv.show(); return false; }); + +// this.setUpAutocomplete(); - //this.setUpAutocomplete(); }, // setUpAutocomplete: function() { @@ -63,6 +79,32 @@ var addAuthorForm = { // // }, + insertLabel: function() { + var firstName, + middleName, + lastName, + name; + + if (!this.firstNameField.is(':hidden')) { + firstName = this.firstNameField.val(); + middleName = this.middleNameField.val(); + lastName = this.lastNameField.val(); + + name = lastName; + if (firstName) { + name += ", " + firstName; + } + if (middleName) { + name += " " + middleName; + } + + this.labelField.val(name); + } + else { + + } + }, + toggleRemoveLink: function() { // when clicking remove: remove the author, and change link text to "undo" // when clicking undo: add the author back, and change link text to "remove" diff --git a/productMods/edit/forms/organizationHasPositionHistory.jsp b/productMods/edit/forms/organizationHasPositionHistory.jsp index 14d35ee2..4dcf94e3 100644 --- a/productMods/edit/forms/organizationHasPositionHistory.jsp +++ b/productMods/edit/forms/organizationHasPositionHistory.jsp @@ -198,7 +198,7 @@ -

+

diff --git a/productMods/edit/forms/personHasActivity.jsp b/productMods/edit/forms/personHasActivity.jsp index 83fb5c18..3808fb72 100644 --- a/productMods/edit/forms/personHasActivity.jsp +++ b/productMods/edit/forms/personHasActivity.jsp @@ -310,7 +310,7 @@ -

+

* required fields

diff --git a/productMods/edit/forms/personHasEducationalBackground.jsp b/productMods/edit/forms/personHasEducationalBackground.jsp index b69ae887..26bb4aa4 100644 --- a/productMods/edit/forms/personHasEducationalBackground.jsp +++ b/productMods/edit/forms/personHasEducationalBackground.jsp @@ -421,7 +421,7 @@ the org type still gets asserted. --%> -

+

* required fields

diff --git a/productMods/edit/forms/personHasPositionHistory.jsp b/productMods/edit/forms/personHasPositionHistory.jsp index d90243a5..589ff89d 100644 --- a/productMods/edit/forms/personHasPositionHistory.jsp +++ b/productMods/edit/forms/personHasPositionHistory.jsp @@ -350,7 +350,7 @@ -

+

* required fields