From d965ed0966cbb8fde8d6ee1e14553d6a41346803 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Thu, 15 Jul 2010 15:58:41 +0000 Subject: [PATCH] NIHVIVO-821 Adapt grant form for editing existing role --- .../edit/forms/addGrantRoleToPerson.jsp | 24 +++++++++++---- .../edit/forms/addPublicationToPerson.jsp | 3 +- .../edit/forms/addRoleToPersonTwoStage.jsp | 5 ++-- .../js/customFormWithAdvanceTypeSelection.js | 30 +++++++++++++------ 4 files changed, 44 insertions(+), 18 deletions(-) diff --git a/productMods/edit/forms/addGrantRoleToPerson.jsp b/productMods/edit/forms/addGrantRoleToPerson.jsp index 79da1599..022e00e6 100644 --- a/productMods/edit/forms/addGrantRoleToPerson.jsp +++ b/productMods/edit/forms/addGrantRoleToPerson.jsp @@ -66,15 +66,15 @@ String subjectName = ((Individual) request.getAttribute("subject")).getName(); if ( ((String)request.getAttribute("predicateUri")).endsWith("hasPrincipalInvestigatorRole") ) { %> http://vivoweb.org/ontology/core#PrincipalInvestigatorRole Principal Investigator - Create a new principal investigator entry for <%= subjectName %> + principal investigator entry for <%= subjectName %> <% }else if ( ((String)request.getAttribute("predicateUri")).endsWith("hasCo-PrincipalInvestigatorRole") ) { %> http://vivoweb.org/ontology/core#CoPrincipalInvestigatorRole Co-Principal Investigator - Create a new co-principal investigator entry for <%= subjectName %> + co-principal investigator entry for <%= subjectName %> <% }else { %> http://vivoweb.org/ontology/core#InvestigatorRole Investigator - Create a new investigator entry for <%= subjectName %> + investigator entry for <%= subjectName %> <% } %> @@ -252,6 +252,17 @@ PREFIX core: <${vivoCore}> + + "> + + + + + + + + +

${formHeading}

@@ -259,7 +270,7 @@ PREFIX core: <${vivoCore}> <%-- DO NOT CHANGE IDS, CLASSES, OR HTML STRUCTURE IN THIS FORM WITHOUT UNDERSTANDING THE IMPACT ON THE JAVASCRIPT! --%>
" > -

+

(Verify this match)

@@ -289,7 +300,10 @@ var customFormData = { sparqlForAcFilter: '${sparqlForAcFilter}', sparqlQueryUrl: '${sparqlQueryUrl}', acUrl: '${acUrl}', - acType: '${vivoCore}Grant', + acType: '${vivoCore}Grant', + editMode: '${editMode}', + submitButtonType: 'compound', + typeName: 'Grant' }; diff --git a/productMods/edit/forms/addPublicationToPerson.jsp b/productMods/edit/forms/addPublicationToPerson.jsp index cddbcf91..26d06ff6 100644 --- a/productMods/edit/forms/addPublicationToPerson.jsp +++ b/productMods/edit/forms/addPublicationToPerson.jsp @@ -239,7 +239,8 @@ PREFIX core: <${vivoCore}> SELECT ?pubUri WHERE {<${subjectUri}> core:authorInAu var customFormData = { sparqlForAcFilter: '${sparqlForAcFilter}', sparqlQueryUrl: '${sparqlQueryUrl}', - acUrl: '${acUrl}' + acUrl: '${acUrl}', + submitButtonType: 'simple' }; \ No newline at end of file diff --git a/productMods/edit/forms/addRoleToPersonTwoStage.jsp b/productMods/edit/forms/addRoleToPersonTwoStage.jsp index d9f59565..2321b366 100644 --- a/productMods/edit/forms/addRoleToPersonTwoStage.jsp +++ b/productMods/edit/forms/addRoleToPersonTwoStage.jsp @@ -309,12 +309,10 @@ "> - - @@ -363,7 +361,8 @@ var customFormData = { sparqlForAcFilter: '${sparqlForAcFilter}', sparqlQueryUrl: '${sparqlQueryUrl}', acUrl: '${acUrl}', - editMode: '${editMode}' + editMode: '${editMode}', + submitButtonType: 'compound' }; \ No newline at end of file diff --git a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js index 20ec68c8..3b7918ee 100644 --- a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js +++ b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js @@ -326,7 +326,7 @@ var customForm = { setLabelFieldLabels: function() { var newLabelTextForNewInd, - selectedTypeName = this.getSelectedTypeName(); + selectedTypeName = this.getTypeName(); this.labelFieldLabel.html(selectedTypeName + ' ' + this.baseLabelText); @@ -338,18 +338,30 @@ var customForm = { }, toggleButtonText: function(newOrExisting) { - if (this.editMode == 'edit') { + + if (this.editMode === 'edit') { this.button.val('Edit ' + this.baseButtonText); + } + // creating new related individual + else if (newOrExisting === 'new') { + if (this.submitButtonType == 'compound') { // use == to tolerate nulls + // e.g., 'Create Grant & Principal Investigator' + this.button.val('Create ' + this.getTypeName() + ' & ' + this.baseButtonText); + } else { + // e.g., 'Create Publication' + this.button.val('Create ' + 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 { + // using existing related individual + else { this.button.val('Add ' + this.baseButtonText); } + }, + + getTypeName: function() { + // If there's no type field, the type comes hard-coded in the customFormData. + // Otherwise, get the selected type from the type selector field. + return this.typeName ? this.typeName : this.getSelectedTypeName(); } };