From cc480a396167dd8be0715e450d17c242662a4886 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Mon, 14 Jun 2010 19:22:50 +0000 Subject: [PATCH] NIHVIVO-646 Move custom form utilities to a separate js file and add utility mixin methods to mix them in to specific custom forms. Make paths to css and js files in formPrefix.jsp and formSuffix.jsp absolute instead of relative. --- .../edit/forms/addAuthorsToInformationResource.jsp | 13 ++++++++----- .../forms/js/addAuthorsToInformationResource.js | 6 +++++- productMods/edit/forms/personHasActivity.jsp | 2 +- .../edit/forms/personHasEducationalBackground.jsp | 8 ++++---- productMods/edit/forms/personHasPositionHistory.jsp | 8 ++++---- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/productMods/edit/forms/addAuthorsToInformationResource.jsp b/productMods/edit/forms/addAuthorsToInformationResource.jsp index 1bcc9ad4..e82f6be8 100644 --- a/productMods/edit/forms/addAuthorsToInformationResource.jsp +++ b/productMods/edit/forms/addAuthorsToInformationResource.jsp @@ -91,10 +91,10 @@ SPARQL queries for existing values. --%> @prefix core: <${vivoCore}> . - ?authorshipUri core:authorRank ?rank + ?authorshipUri core:authorRank ?rank . -<%-- This much applies to both new and existing person --%> +<%-- This applies to both new and existing person --%> @prefix core: <${vivoCore}> . @@ -225,11 +225,14 @@ SPARQL queries for existing values. --%> String linkedAuthorProperty = "http://vivoweb.org/ontology/core#linkedAuthor"; - List customJs = new ArrayList(Arrays.asList("forms/js/addAuthorsToInformationResource.js")); + List customJs = new ArrayList(Arrays.asList( + "/js/utils.js", + "/js/customFormUtils.js", + "/edit/forms/js/addAuthorsToInformationResource.js")); request.setAttribute("customJs", customJs); - List customCss = new ArrayList(Arrays.asList("forms/css/customForm.css", - "forms/css/addAuthorsToInformationResource.css" + List customCss = new ArrayList(Arrays.asList("/edit/forms/css/customForm.css", + "/edit/forms/css/addAuthorsToInformationResource.css" )); request.setAttribute("customCss", customCss); %> diff --git a/productMods/edit/forms/js/addAuthorsToInformationResource.js b/productMods/edit/forms/js/addAuthorsToInformationResource.js index 21817105..4a5fb7cb 100644 --- a/productMods/edit/forms/js/addAuthorsToInformationResource.js +++ b/productMods/edit/forms/js/addAuthorsToInformationResource.js @@ -34,6 +34,9 @@ var addAuthorForm = { initForm: function() { + // Mix in the custom form utility methods + vitro.utils.borrowMethods(vitro.customFormUtils, this); + this.showFormButton.click(function() { addAuthorForm.showFormDiv.hide(); addAuthorForm.form.show(); @@ -41,7 +44,7 @@ var addAuthorForm = { }); this.cancel.click(function() { - addAuthorForm.form.hide(); + addAuthorForm.hideFields(addAuthorForm.form); addAuthorForm.showFormDiv.show(); return false; }); @@ -51,6 +54,7 @@ var addAuthorForm = { // 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" } + } $(document).ready(function() { diff --git a/productMods/edit/forms/personHasActivity.jsp b/productMods/edit/forms/personHasActivity.jsp index 1962598e..83fb5c18 100644 --- a/productMods/edit/forms/personHasActivity.jsp +++ b/productMods/edit/forms/personHasActivity.jsp @@ -289,7 +289,7 @@ <% } - List customCss = new ArrayList(Arrays.asList("forms/css/customForm.css" + List customCss = new ArrayList(Arrays.asList("/edit/forms/css/customForm.css" )); request.setAttribute("customCss", customCss); %> diff --git a/productMods/edit/forms/personHasEducationalBackground.jsp b/productMods/edit/forms/personHasEducationalBackground.jsp index d5e499ec..74b03a64 100644 --- a/productMods/edit/forms/personHasEducationalBackground.jsp +++ b/productMods/edit/forms/personHasEducationalBackground.jsp @@ -364,13 +364,13 @@ the org type still gets asserted. --%> <% } - List customJs = new ArrayList(Arrays.asList("forms/js/customForm.js" - //, "forms/js/customFormOneStep.js" + List customJs = new ArrayList(Arrays.asList("/edit/forms/js/customForm.js" + //, "/edit/forms/js/customFormOneStep.js" )); request.setAttribute("customJs", customJs); - List customCss = new ArrayList(Arrays.asList("forms/css/customForm.css", - "forms/css/personHasEducationalBackground.css" + List customCss = new ArrayList(Arrays.asList("/edit/forms/css/customForm.css", + "/edit/forms/css/personHasEducationalBackground.css" )); request.setAttribute("customCss", customCss); %> diff --git a/productMods/edit/forms/personHasPositionHistory.jsp b/productMods/edit/forms/personHasPositionHistory.jsp index c62efce5..0592aa09 100644 --- a/productMods/edit/forms/personHasPositionHistory.jsp +++ b/productMods/edit/forms/personHasPositionHistory.jsp @@ -295,13 +295,13 @@ <% } - List customJs = new ArrayList(Arrays.asList("forms/js/customForm.js" - //, "forms/js/customFormTwoStep.js" + List customJs = new ArrayList(Arrays.asList("/edit/forms/js/customForm.js" + //, "/edit/forms/js/customFormTwoStep.js" )); request.setAttribute("customJs", customJs); - List customCss = new ArrayList(Arrays.asList("forms/css/customForm.css" - , "forms/css/personHasPositionHistory.css" + List customCss = new ArrayList(Arrays.asList("/edit/forms/css/customForm.css" + , "/edit/forms/css/personHasPositionHistory.css" )); request.setAttribute("customCss", customCss); %>