diff --git a/productMods/edit/forms/addAuthorsToInformationResource.jsp b/productMods/edit/forms/addAuthorsToInformationResource.jsp
index e29e4b73..441b8919 100644
--- a/productMods/edit/forms/addAuthorsToInformationResource.jsp
+++ b/productMods/edit/forms/addAuthorsToInformationResource.jsp
@@ -284,6 +284,7 @@ SPARQL queries for existing values. --%>
+<%-- DO NOT CHANGE IDS, CLASSES, OR HTML STRUCTURE ON THIS PAGE WITHOUT UNDERSTANDING THE IMPACT ON THE JAVASCRIPT! --%>
-
+
<%-- RY maybe make this a label and input field. See what looks best. --%>
@@ -321,7 +334,7 @@
-
+
Dates of Participation
@@ -345,7 +358,8 @@ SELECT ?indUri WHERE {<${subjectUri}> <${predicateUri}> ?role . ?role <${vivoCor
var customFormData = {
sparqlForAcFilter: '${sparqlForAcFilter}',
sparqlQueryUrl: '${sparqlQueryUrl}',
- acUrl: '${acUrl}'
+ acUrl: '${acUrl}',
+ editMode: '${editMode}'
};
\ No newline at end of file
diff --git a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js
index 03d0515d..f1497f40 100644
--- a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js
+++ b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js
@@ -45,6 +45,10 @@ var customForm = {
// because it may have already been modified for a previous selection.
this.baseLabelText = this.labelFieldLabel.html();
+ // Label field for new individual being created
+// this.newIndLabelFieldLabel = $('label[for=' + $('#newIndividualLabel').attr('id') + ']');
+// this.newIndBaseLabelText = this.newIndLabelFieldLabel.html();
+
this.or = $('span.or');
this.cancel = this.form.find('.cancel');
@@ -53,7 +57,11 @@ var customForm = {
// Set up the form on page load
initPage: function() {
- if (!this.typeSelector.length) {
+ if (!this.editMode) {
+ this.editMode = "add"; // edit vs add: default to add
+ }
+
+ if (!this.typeSelector.length || this.editMode == "edit") {
this.formSteps = 1;
// there's also going to be a 3-step form - look for this.subTypeSelector
} else {
@@ -67,7 +75,7 @@ var customForm = {
this.initFormView();
},
-
+
initFormView: function() {
var typeVal = this.typeSelector.val();
@@ -80,7 +88,7 @@ var customForm = {
// twice to get to full view.
else if (typeVal.length) {
this.acType = typeVal;
- this.setLabelFieldLabel();
+ this.setLabelFieldLabels();
this.initFormFullView();
}
else {
@@ -104,7 +112,7 @@ var customForm = {
this.or.show();
this.requiredLegend.show();
this.button.show();
- this.button.val('Create ' + this.baseButtonText);
+ this.toggleButtonText("new");
this.cancel.unbind('click');
if( this.formSteps > 1 ){
@@ -131,7 +139,7 @@ var customForm = {
customForm.acType = typeVal;
if (typeVal.length) {
- customForm.setLabelFieldLabel();
+ customForm.setLabelFieldLabels();
customForm.initFormFullView();
} else {
// If no selection, go back to type view. This prevents problems like trying to run autocomplete
@@ -262,7 +270,7 @@ var customForm = {
this.acSelectionInfo.html(ui.item.label);
this.verifyMatch.attr('href', this.verifyMatchBaseHref + uri);
- this.button.val('Add ' + this.baseButtonText);
+ this.toggleButtonText('existing');
this.cancel.unbind('click');
this.cancel.click(function() {
@@ -283,7 +291,7 @@ var customForm = {
this.acReceiver.val('');
this.acSelectionInfo.html('');
this.verifyMatch.attr('href', this.verifyMatchBaseHref);
- this.button.val('Create ' + this.baseButtonText)
+ this.toggleButtonText('new');
if (this.formSteps > 1) {
this.acSelection.find('label').html('Selected ');
@@ -295,8 +303,31 @@ var customForm = {
return this.typeSelector.find(':selected').html();
},
- setLabelFieldLabel: function() {
- this.labelFieldLabel.html(this.getSelectedTypeName() + ' ' + this.baseLabelText);
+ setLabelFieldLabels: function() {
+// var newLabelTextForNewInd;
+
+ this.labelFieldLabel.html(this.getSelectedTypeName() + ' ' + this.baseLabelText);
+
+// if (this.newIndLabelFieldLabel.length) {
+// newLabelTextForNewInd = this.newIndBaseLabelText.replace('X', this.getSelectedTypeName);
+// this.newIndLabelFieldLabel.html(newLabelTextForNewInd);
+// }
+
+ },
+
+ toggleButtonText: function(newOrExisting) {
+ if (this.editMode == "edit") {
+ this.button.val("Edit " + this.baseButtonText);
+ }
+ // RY Make this better for roles and grants forms later. The verbs
+ // don't quite work. It should be "Create X and
" vs.
+ // "Create " or "Add "
+ else if (newOrExisting == "new") {
+ this.button.val("Create " + this.baseButtonText);
+ }
+ else {
+ this.button.val("Add " + this.baseButtonText);
+ }
}
};