From c06384d6c25fcae260f6fb70b022663e958e9e45 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Mon, 19 Jul 2010 21:35:26 +0000 Subject: [PATCH] Merging r914 through r916 from rel-1.1-maint --- doc/upgrade-1.1.txt | 2 +- .../edit/forms/addGrantRoleToPerson.jsp | 21 ++++-- .../edit/forms/addPublicationToPerson.jsp | 2 +- .../edit/forms/addRoleToPersonTwoStage.jsp | 23 +++++-- .../js/customFormWithAdvanceTypeSelection.js | 64 +++++++++++++------ 5 files changed, 79 insertions(+), 33 deletions(-) diff --git a/doc/upgrade-1.1.txt b/doc/upgrade-1.1.txt index cf196a07..743bfc31 100644 --- a/doc/upgrade-1.1.txt +++ b/doc/upgrade-1.1.txt @@ -295,7 +295,7 @@ Language) extension. Follow step A or B below, whichever is applicable to your site: A. If you did not create a customized theme for your site in VIVO 1.0, but used -the vivo-basic theme that shipped with VIVO 1.0, you need not take any action +the 1.0 vivo-basic theme in its original directory, you need not take any action in order to convert your site to the VIVO 1.1 theme. B. If you created your own theme directory in VIVO 1.0, follow the steps below diff --git a/productMods/edit/forms/addGrantRoleToPerson.jsp b/productMods/edit/forms/addGrantRoleToPerson.jsp index b3d9ea5f..96e56f88 100644 --- a/productMods/edit/forms/addGrantRoleToPerson.jsp +++ b/productMods/edit/forms/addGrantRoleToPerson.jsp @@ -157,7 +157,7 @@ PREFIX core: <${vivoCore}> "inverseRolePredicate" : "${inversePredicate}" }, "literalsInScope": { }, "urisOnForm" : [ "grant" ], - "literalsOnForm" : [ "grantLabel", "startYear", "endYear" ], + "literalsOnForm" : [ "grantLabel", "startYear", "endYear", "existingGrantLabel" ], "filesOnForm" : [ ], "sparqlForLiterals" : { }, "sparqlForUris" : { }, @@ -181,14 +181,25 @@ PREFIX core: <${vivoCore}> "optionsType" : "UNDEFINED", "literalOptions" : [ ], "predicateUri" : "", - "objectClassUri" : "${personClassUriJson}", + "objectClassUri" : "", "rangeDatatypeUri" : "${stringDatatypeUriJson}", "rangeLang" : "", "assertions" : ["${n3ForGrantLabel}"] }, + "existingGrantLabel" : { /* Needed iff we return from an invalid submission */ + "newResource" : "false", + "validators" : [ ], + "optionsType" : "UNDEFINED", + "literalOptions" : [ ], + "predicateUri" : "", + "objectClassUri" : "", + "rangeDatatypeUri" : "", + "rangeLang" : "", + "assertions" : [ ] + }, "startYear" : { "newResource" : "false", - "validators" : [ "datatype:${gYearDatatypeUriJson}" ], + "validators" : [ "nonempty", "datatype:${gYearDatatypeUriJson}" ], "optionsType" : "UNDEFINED", "literalOptions" : [ ], "predicateUri" : "", @@ -275,8 +286,8 @@ PREFIX core: <${vivoCore}>

(Verify this match)

- <%-- bdc34: for some odd reason id and name should not be grant in this input element. --%> - + <%-- Field value populated by JavaScript --%> + <%-- Needed iff we return from an invalid submission --%>

Dates of Participation in Grant

diff --git a/productMods/edit/forms/addPublicationToPerson.jsp b/productMods/edit/forms/addPublicationToPerson.jsp index 393cb609..57f1149c 100644 --- a/productMods/edit/forms/addPublicationToPerson.jsp +++ b/productMods/edit/forms/addPublicationToPerson.jsp @@ -218,7 +218,7 @@ SPARQL queries for existing values. --%>
<%-- RY maybe make this a label and input field. See what looks best. --%>

(Verify this match)

- +
diff --git a/productMods/edit/forms/addRoleToPersonTwoStage.jsp b/productMods/edit/forms/addRoleToPersonTwoStage.jsp index 1645ee1c..e6ffad62 100644 --- a/productMods/edit/forms/addRoleToPersonTwoStage.jsp +++ b/productMods/edit/forms/addRoleToPersonTwoStage.jsp @@ -189,7 +189,7 @@ "urisInScope" : { "inverseRolePredicate" : "${inversePredicate}" }, "literalsInScope": { }, "urisOnForm" : [ "roleActivity", "roleActivityType" ], - "literalsOnForm" : [ "activityLabel", "roleLabel", "startYear", "endYear" ], + "literalsOnForm" : [ "activityLabel", "roleLabel", "startYear", "endYear", "existingActivityLabel" ], "filesOnForm" : [ ], "sparqlForLiterals" : { }, "sparqlForUris" : { }, @@ -229,6 +229,17 @@ "rangeLang" : "", "assertions" : [ ] }, + "existingActivityLabel" : { /* Needed iff we return from an invalid submission */ + "newResource" : "false", + "validators" : [ ], + "optionsType" : "UNDEFINED", + "literalOptions" : [ ], + "predicateUri" : "", + "objectClassUri" : "", + "rangeDatatypeUri" : "", + "rangeLang" : "", + "assertions" : [ ] + }, "roleLabel" : { "newResource" : "false", "validators" : [ "nonempty","datatype:${stringDatatypeUriJson}" ], @@ -242,7 +253,7 @@ }, "startYear" : { "newResource" : "false", - "validators" : [ "datatype:${gYearDatatypeUriJson}" ], + "validators" : [ "nonempty", "datatype:${gYearDatatypeUriJson}" ], "optionsType" : "UNDEFINED", "literalOptions" : [ ], "predicateUri" : "", @@ -274,10 +285,7 @@ } editConfig.addValidator(new StartYearBeforeEndYear("startYear","endYear") ); - - - Model model = (Model) application.getAttribute("jenaOntModel"); String objectUri = (String) request.getAttribute("objectUri"); if (objectUri != null) { @@ -324,7 +332,7 @@

${titleText} ${roleActivityTypeLabel} entry for <%= subjectName %>

<%-- DO NOT CHANGE IDS, CLASSES, OR HTML STRUCTURE IN THIS FORM WITHOUT UNDERSTANDING THE IMPACT ON THE JAVASCRIPT! --%> -
" > +" >

@@ -335,7 +343,8 @@
<%-- RY maybe make this a label and input field. See what looks best. --%>

(Verify this match)

- + + <%-- Needed iff we return from an invalid submission --%>

diff --git a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js index 03121194..69aa1bbf 100644 --- a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js +++ b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js @@ -34,7 +34,8 @@ var customForm = { this.acSelector = this.form.find('.acSelector'); this.acSelection = this.form.find('.acSelection'); this.acSelectionInfo = this.form.find('.acSelectionInfo'); - this.acReceiver = this.form.find('.acReceiver'); + this.acUriReceiver = this.form.find('.acUriReceiver'); + this.acLabelReceiver = this.form.find('.acLabelReceiver'); this.verifyMatch = this.form.find('.verifyMatch'); this.verifyMatchBaseHref = this.verifyMatch.attr('href'); this.acSelectorWrapper = this.acSelector.parent(); @@ -85,14 +86,16 @@ var customForm = { initFormView: function() { var typeVal = this.typeSelector.val(); - - if (this.formSteps == 1 || this.findValidationErrors()) { - this.initFormFullView(); + + if (this.findValidationErrors()) { + this.initFormWithValidationErrors(); + //this.initFormFullView(); } + // this.formSteps == 1 includes edit mode. // If type is already selected when the page loads (Firefox retains value // on a refresh), go directly to full view. Otherwise user has to reselect - // twice to get to full view. - else if (typeVal.length) { + // twice to get to full view. + else if ( this.formSteps == 1 || typeVal.length ) { this.initFormFullView(); } else { @@ -123,10 +126,10 @@ var customForm = { this.requiredLegend.show(); this.button.show(); this.setButtonText('new'); - this.setLabels(); - this.cancel.unbind('click'); + this.setLabels(); - if( this.formSteps > 1 ){ + if( this.formSteps > 1 ){ // NB includes this.editMode == 1 + this.cancel.unbind('click'); this.cancel.click(function() { customForm.clearFormData(); // clear any input and validation errors customForm.initFormTypeView(); @@ -135,8 +138,31 @@ var customForm = { } }, + initFormWithValidationErrors: function() { + var uri = this.acUriReceiver.val(), + label = this.acLabelReceiver.val(); + + // Call initFormFullView first, because showAutocompleteSelection needs + // acType, which is set in initFormFullView. + this.initFormFullView(); + + if (uri) { + this.showAutocompleteSelection(label, uri); + } + + this.cancel.unbind('click'); + this.cancel.click(function() { + // Cancel back to full view with only type selection showing + customForm.undoAutocompleteSelection(); + customForm.clearFields(customForm.fullViewOnly); + customForm.initFormFullView(); + return false; + }); + + }, + initFormEditView: function() { - // These should not be editable: only properties of the role are editable. + // These are not editable: only properties of the role are editable. this.typeSelector.attr('disabled', 'disabled'); this.relatedIndLabel.attr('disabled', 'disabled'); @@ -148,7 +174,8 @@ var customForm = { }); }, - // Bind event listeners that persist over the life of the page. + // Bind event listeners that persist over the life of the page. Event listeners + // that depend on the view should be initialized in the view setup method. bindEventListeners: function() { this.typeSelector.change(function() { @@ -206,7 +233,7 @@ var customForm = { }); }, select: function(event, ui) { - customForm.showAutocompleteSelection(ui); + customForm.showAutocompleteSelection(ui.item.label, ui.item.uri); } }); @@ -280,10 +307,8 @@ var customForm = { this.acCache = {}; }, - showAutocompleteSelection: function(ui) { - - var uri = ui.item.uri; - + showAutocompleteSelection: function(label, uri) { + this.acSelectorWrapper.hide(); this.acSelector.attr('disabled', 'disabled'); @@ -294,8 +319,9 @@ var customForm = { this.acSelection.show(); - this.acReceiver.val(uri); - this.acSelectionInfo.html(ui.item.label); + this.acUriReceiver.val(uri); + this.acLabelReceiver.val(label); + this.acSelectionInfo.html(label); this.verifyMatch.attr('href', this.verifyMatchBaseHref + uri); this.setButtonText('existing'); @@ -316,7 +342,7 @@ var customForm = { this.acSelector.attr('disabled', ''); this.acSelector.val(''); this.hideFields(this.acSelection); - this.acReceiver.val(''); + this.acUriReceiver.val(''); this.acSelectionInfo.html(''); this.verifyMatch.attr('href', this.verifyMatchBaseHref);