From 95380454afd700a3a7bc8004551dae44329eb7ba Mon Sep 17 00:00:00 2001 From: rjy7 Date: Thu, 8 Jul 2010 15:08:42 +0000 Subject: [PATCH] NIHVIVO-647 Add name attribute to vitro custom jsp input tag so that the name can differ from the id. Removed flag1value1 stuff from all vivo custom forms, since no longer needed. Initial setup for publication form javascript. --- .../forms/addAuthorsToInformationResource.jsp | 14 +--- .../edit/forms/addPublicationToAuthor.jsp | 16 +--- .../js/addAuthorsToInformationResource.js | 2 +- productMods/edit/forms/js/customForm.js | 2 +- .../js/customFormWithAdvanceTypeSelection.js | 79 +++++++++++++++++++ .../forms/organizationHasPositionHistory.jsp | 13 +-- productMods/edit/forms/personHasActivity.jsp | 11 +-- .../forms/personHasEducationalBackground.jsp | 14 +--- .../edit/forms/personHasPositionHistory.jsp | 14 +--- 9 files changed, 93 insertions(+), 72 deletions(-) diff --git a/productMods/edit/forms/addAuthorsToInformationResource.jsp b/productMods/edit/forms/addAuthorsToInformationResource.jsp index 2fd327d5..387aea4e 100644 --- a/productMods/edit/forms/addAuthorsToInformationResource.jsp +++ b/productMods/edit/forms/addAuthorsToInformationResource.jsp @@ -55,14 +55,6 @@ core:authorInAuthorship (Person : Authorship) - inverse of linkedAuthor VitroRequest vreq = new VitroRequest(request); WebappDaoFactory wdf = vreq.getWebappDaoFactory(); vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior - - String flagUri = null; - if (wdf.getApplicationDao().isFlag1Active()) { - flagUri = VitroVocabulary.vitroURI+"Flag1Value"+vreq.getPortal().getPortalId()+"Thing"; - } else { - flagUri = wdf.getVClassDao().getTopConcept().getURI(); // fall back to owl:Thing if not portal filtering - } - vreq.setAttribute("flagUri",flagUri); vreq.setAttribute("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString())); @@ -106,8 +98,7 @@ SPARQL queries for existing values. --%> @prefix core: <${vivoCore}> . - ?authorshipUri a core:Authorship , - <${flagUri}> ; + ?authorshipUri a core:Authorship ; core:linkedInformationResource ?infoResource ; core:authorRank ?rank . @@ -124,8 +115,7 @@ SPARQL queries for existing values. --%> @prefix foaf: <${foaf}> . @prefix core: <${vivoCore}> . - ?newPerson a foaf:Person , - <${flagUri}> ; + ?newPerson a foaf:Person ; <${label}> ?label . ?authorshipUri core:linkedAuthor ?newPerson . diff --git a/productMods/edit/forms/addPublicationToAuthor.jsp b/productMods/edit/forms/addPublicationToAuthor.jsp index f83a8193..a037a6f7 100644 --- a/productMods/edit/forms/addPublicationToAuthor.jsp +++ b/productMods/edit/forms/addPublicationToAuthor.jsp @@ -51,14 +51,6 @@ core:informationResourceInAuthorship (InformationResource : Authorship) - invers VitroRequest vreq = new VitroRequest(request); WebappDaoFactory wdf = vreq.getWebappDaoFactory(); vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior - - String flagUri = null; - if (wdf.getApplicationDao().isFlag1Active()) { - flagUri = VitroVocabulary.vitroURI+"Flag1Value"+vreq.getPortal().getPortalId()+"Thing"; - } else { - flagUri = wdf.getVClassDao().getTopConcept().getURI(); // fall back to owl:Thing if not portal filtering - } - vreq.setAttribute("flagUri",flagUri); vreq.setAttribute("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString())); @@ -87,8 +79,7 @@ SPARQL queries for existing values. --%> @prefix core: <${vivoCore}> . - ?authorshipUri a core:Authorship , - <${flagUri}> ; + ?authorshipUri a core:Authorship ; core:linkedAuthor ?person . ?person core:authorInAuthorship ?authorshipUri . @@ -104,8 +95,7 @@ SPARQL queries for existing values. --%> @prefix core: <${vivoCore}> . - ?newPub a ?pubType , - <${flagUri}> ; + ?newPub a ?pubType ; <${label}> ?title . ?authorshipUri core:linkedInformationResource ?newPub . @@ -219,7 +209,7 @@ SPARQL queries for existing values. --%>
" > - + diff --git a/productMods/edit/forms/js/addAuthorsToInformationResource.js b/productMods/edit/forms/js/addAuthorsToInformationResource.js index 2944c780..77ca0b4a 100644 --- a/productMods/edit/forms/js/addAuthorsToInformationResource.js +++ b/productMods/edit/forms/js/addAuthorsToInformationResource.js @@ -15,7 +15,7 @@ var addAuthorForm = { vitro.utils.borrowMethods(vitro.customFormUtils, this); }, - // On page load, create references within the addAuthorForm scope to DOM elements. + // On page load, create references for easy access to form elements. // NB These must be assigned after the elements have been loaded onto the page. initObjects: function() { diff --git a/productMods/edit/forms/js/customForm.js b/productMods/edit/forms/js/customForm.js index ff910f5c..3a1df17b 100644 --- a/productMods/edit/forms/js/customForm.js +++ b/productMods/edit/forms/js/customForm.js @@ -68,7 +68,7 @@ var customForm = { vitro.utils.borrowMethods(vitro.customFormUtils, this); }, - // On page load, create references within the customForm scope to DOM elements. + // On page load, create references for easy access to form elements. // NB These must be assigned after the elements have been loaded onto the page. initObjects: function() { diff --git a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js index 0dc42bbe..29afeec0 100644 --- a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js +++ b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js @@ -1,2 +1,81 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ +var customFormWATS = { + + /* *** Initial page setup *** */ + + onLoad: function() { + this.mixIn(); + this.initObjects(); + this.initPage(); + }, + + mixIn: function() { + // Mix in the custom form utility methods + vitro.utils.borrowMethods(vitro.customFormUtils, this); + }, + + // On page load, create references for easy access to form elements. + // NB These must be assigned after the elements have been loaded onto the page. + initObjects: function(){ + + this.form = $('#content form'); + this.button = $('#submit'); + this.or = $('span.or'); + this.requiredLegend = $('#requiredLegend'); + + this.typeSelector = this.form.find('.typeSelector'); + this.acInput = this.form.find('.acInput'); + this.acSelection = this.form.find('.acSelection'); + this.cancel = this.form.find('cancel'); + + }, + + // Set up the form on page load + initPage: function() { + + this.initFormTypeView(); + this.bindEventListeners(); + this.initAutocomplete(); + + }, + + initFormTypeView: function() { + + this.button.hide(); + this.or.hide(); + this.requiredLegend.hide(); + + this.cancel.unbind('click'); + this.cancel('click', function() { + + }); + }, + + initFormFullView: function() { + + this.button.show(); + this.or.show(); + this.requiredLegend.show(); + + this.cancel.unbind('click'); + this.cancel('click', function() { + + }); + }, + + // Bind event listeners that apply to all form views + bindEventListeners: function() { + + }, + + initAutocomplete: function() { + + } + + +}; + +$(document).ready(function() { + customFormWATS.onLoad(); +}); diff --git a/productMods/edit/forms/organizationHasPositionHistory.jsp b/productMods/edit/forms/organizationHasPositionHistory.jsp index 4dcf94e3..eaa3acb6 100644 --- a/productMods/edit/forms/organizationHasPositionHistory.jsp +++ b/productMods/edit/forms/organizationHasPositionHistory.jsp @@ -17,15 +17,7 @@ <% VitroRequest vreq = new VitroRequest(request); WebappDaoFactory wdf = vreq.getWebappDaoFactory(); - vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior - - String flagURI = null; - if (vreq.getAppBean().isFlag1Active()) { - flagURI = VitroVocabulary.vitroURI+"Flag1Value"+vreq.getPortal().getPortalId()+"Thing"; - } else { - flagURI = wdf.getVClassDao().getTopConcept().getURI(); // fall back to owl:Thing if not portal filtering - } - vreq.setAttribute("flagURI",flagURI); + vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior %> http://xmlns.com/foaf/0.1/Person @@ -80,8 +72,7 @@ @prefix core: . ?organizationUri core:organizationForPosition ?positionUri . ?positionUri core:positionInOrganization ?organizationUri . - ?positionUri rdf:type core:Position . - ?positionUri rdf:type <${flagURI}> . + ?positionUri rdf:type core:Position . diff --git a/productMods/edit/forms/personHasActivity.jsp b/productMods/edit/forms/personHasActivity.jsp index 3808fb72..66e6e291 100644 --- a/productMods/edit/forms/personHasActivity.jsp +++ b/productMods/edit/forms/personHasActivity.jsp @@ -32,14 +32,6 @@ VitroRequest vreq = new VitroRequest(request); WebappDaoFactory wdf = vreq.getWebappDaoFactory(); vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior - - String flagUri = null; - if (wdf.getApplicationDao().isFlag1Active()) { - flagUri = VitroVocabulary.vitroURI+"Flag1Value"+vreq.getPortal().getPortalId()+"Thing"; - } else { - flagUri = wdf.getVClassDao().getTopConcept().getURI(); // fall back to owl:Thing if not portal filtering - } - vreq.setAttribute("flagUri",flagUri); request.setAttribute("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString())); request.setAttribute("gYearMonthDatatypeUriJson", MiscWebUtils.escape(XSD.gYearMonth.toString())); @@ -134,8 +126,7 @@ ?activityUri <${labelUri}> ?label ; a <${activityClass}> ; - a <${activitySuperClass}> ; - a <${flagUri}> ; + a <${activitySuperClass}> ; <${inverseUri}> ?person ; <${inverseSuperPropertyUri}> ?person . diff --git a/productMods/edit/forms/personHasEducationalBackground.jsp b/productMods/edit/forms/personHasEducationalBackground.jsp index bf676348..4c03a5f7 100644 --- a/productMods/edit/forms/personHasEducationalBackground.jsp +++ b/productMods/edit/forms/personHasEducationalBackground.jsp @@ -62,14 +62,6 @@ core:dateTimePrecision (DateTimeValue : DateTimeValuePrecision) WebappDaoFactory wdf = vreq.getWebappDaoFactory(); vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior - String flagUri = null; - if (wdf.getApplicationDao().isFlag1Active()) { - flagUri = VitroVocabulary.vitroURI+"Flag1Value"+vreq.getPortal().getPortalId()+"Thing"; - } else { - flagUri = wdf.getVClassDao().getTopConcept().getURI(); // fall back to owl:Thing if not portal filtering - } - vreq.setAttribute("flagUri",flagUri); - request.setAttribute("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString())); request.setAttribute("gYearDatatypeUriJson", MiscWebUtils.escape(XSD.gYear.toString())); %> @@ -185,14 +177,12 @@ the org type still gets asserted. --%> ?person core:educationalBackground ?edTrainingUri . ?edTrainingUri core:educationalBackgroundOf ?person ; - a core:EducationalTraining , - <${flagUri}> . + a core:EducationalTraining . ?newOrg <${label}> ?newOrgName ; - a ?newOrgType , - <${flagUri}> . + a ?newOrgType . ?edTrainingUri <${orgGrantingDegree}> ?newOrg . diff --git a/productMods/edit/forms/personHasPositionHistory.jsp b/productMods/edit/forms/personHasPositionHistory.jsp index 589ff89d..cc8f485e 100644 --- a/productMods/edit/forms/personHasPositionHistory.jsp +++ b/productMods/edit/forms/personHasPositionHistory.jsp @@ -31,14 +31,6 @@ WebappDaoFactory wdf = vreq.getWebappDaoFactory(); vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior - String flagUri = null; - if (vreq.getAppBean().isFlag1Active()) { - flagUri = VitroVocabulary.vitroURI+"Flag1Value"+vreq.getPortal().getPortalId()+"Thing"; - } else { - flagUri = wdf.getVClassDao().getTopConcept().getURI(); // fall back to owl:Thing if not portal filtering - } - vreq.setAttribute("flagUri",flagUri); - request.setAttribute("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString())); request.setAttribute("gYearDatatypeUriJson", MiscWebUtils.escape(XSD.gYear.toString())); %> @@ -120,16 +112,14 @@ ?person core:personInPosition ?positionUri . ?positionUri core:positionForPerson ?person ; - a ?positionType , - <${flagUri}> . + a ?positionType . ?positionUri <${positionInOrgPred}> ?newOrg . ?newOrg <${label}> ?newOrgName ; - a ?newOrgType , - <${flagUri}> ; + a ?newOrgType ; <${orgForPositionPred}> ?positionUri .