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.
This commit is contained in:
rjy7 2010-07-08 15:08:42 +00:00
parent 9b219635a5
commit 95380454af
9 changed files with 93 additions and 72 deletions

View file

@ -55,14 +55,6 @@ core:authorInAuthorship (Person : Authorship) - inverse of linkedAuthor
VitroRequest vreq = new VitroRequest(request); VitroRequest vreq = new VitroRequest(request);
WebappDaoFactory wdf = vreq.getWebappDaoFactory(); WebappDaoFactory wdf = vreq.getWebappDaoFactory();
vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior 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())); vreq.setAttribute("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString()));
@ -106,8 +98,7 @@ SPARQL queries for existing values. --%>
<v:jsonset var="n3ForNewAuthorship"> <v:jsonset var="n3ForNewAuthorship">
@prefix core: <${vivoCore}> . @prefix core: <${vivoCore}> .
?authorshipUri a core:Authorship , ?authorshipUri a core:Authorship ;
<${flagUri}> ;
core:linkedInformationResource ?infoResource ; core:linkedInformationResource ?infoResource ;
core:authorRank ?rank . core:authorRank ?rank .
@ -124,8 +115,7 @@ SPARQL queries for existing values. --%>
@prefix foaf: <${foaf}> . @prefix foaf: <${foaf}> .
@prefix core: <${vivoCore}> . @prefix core: <${vivoCore}> .
?newPerson a foaf:Person , ?newPerson a foaf:Person ;
<${flagUri}> ;
<${label}> ?label . <${label}> ?label .
?authorshipUri core:linkedAuthor ?newPerson . ?authorshipUri core:linkedAuthor ?newPerson .

View file

@ -51,14 +51,6 @@ core:informationResourceInAuthorship (InformationResource : Authorship) - invers
VitroRequest vreq = new VitroRequest(request); VitroRequest vreq = new VitroRequest(request);
WebappDaoFactory wdf = vreq.getWebappDaoFactory(); WebappDaoFactory wdf = vreq.getWebappDaoFactory();
vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior 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())); vreq.setAttribute("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString()));
@ -87,8 +79,7 @@ SPARQL queries for existing values. --%>
<v:jsonset var="n3ForNewAuthorship"> <v:jsonset var="n3ForNewAuthorship">
@prefix core: <${vivoCore}> . @prefix core: <${vivoCore}> .
?authorshipUri a core:Authorship , ?authorshipUri a core:Authorship ;
<${flagUri}> ;
core:linkedAuthor ?person . core:linkedAuthor ?person .
?person core:authorInAuthorship ?authorshipUri . ?person core:authorInAuthorship ?authorshipUri .
@ -104,8 +95,7 @@ SPARQL queries for existing values. --%>
<v:jsonset var="n3ForNewPub"> <v:jsonset var="n3ForNewPub">
@prefix core: <${vivoCore}> . @prefix core: <${vivoCore}> .
?newPub a ?pubType , ?newPub a ?pubType ;
<${flagUri}> ;
<${label}> ?title . <${label}> ?title .
?authorshipUri core:linkedInformationResource ?newPub . ?authorshipUri core:linkedInformationResource ?newPub .
@ -219,7 +209,7 @@ SPARQL queries for existing values. --%>
<form id="addPublicationForm" action="<c:url value="/edit/processRdfForm2.jsp"/>" > <form id="addPublicationForm" action="<c:url value="/edit/processRdfForm2.jsp"/>" >
<v:input type="select" label="Publication type" id="pubType" /> <v:input type="select" label="Publication type" name="pubType" id="typeSelector" />
<v:input type="text" id="title" label="title" cssClass="acInput newIndLabel" size="50" /> <v:input type="text" id="title" label="title" cssClass="acInput newIndLabel" size="50" />

View file

@ -15,7 +15,7 @@ var addAuthorForm = {
vitro.utils.borrowMethods(vitro.customFormUtils, this); 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. // NB These must be assigned after the elements have been loaded onto the page.
initObjects: function() { initObjects: function() {

View file

@ -68,7 +68,7 @@ var customForm = {
vitro.utils.borrowMethods(vitro.customFormUtils, this); 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. // NB These must be assigned after the elements have been loaded onto the page.
initObjects: function() { initObjects: function() {

View file

@ -1,2 +1,81 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $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();
});

View file

@ -17,15 +17,7 @@
<% <%
VitroRequest vreq = new VitroRequest(request); VitroRequest vreq = new VitroRequest(request);
WebappDaoFactory wdf = vreq.getWebappDaoFactory(); WebappDaoFactory wdf = vreq.getWebappDaoFactory();
vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior 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);
%> %>
<v:jsonset var="personClassUri">http://xmlns.com/foaf/0.1/Person</v:jsonset> <v:jsonset var="personClassUri">http://xmlns.com/foaf/0.1/Person</v:jsonset>
@ -80,8 +72,7 @@
@prefix core: <http://vivoweb.org/ontology/core#>. @prefix core: <http://vivoweb.org/ontology/core#>.
?organizationUri core:organizationForPosition ?positionUri . ?organizationUri core:organizationForPosition ?positionUri .
?positionUri core:positionInOrganization ?organizationUri . ?positionUri core:positionInOrganization ?organizationUri .
?positionUri rdf:type core:Position . ?positionUri rdf:type core:Position .
?positionUri rdf:type <${flagURI}> .
</v:jsonset> </v:jsonset>
<c:set var="editjson" scope="request"> <c:set var="editjson" scope="request">

View file

@ -32,14 +32,6 @@
VitroRequest vreq = new VitroRequest(request); VitroRequest vreq = new VitroRequest(request);
WebappDaoFactory wdf = vreq.getWebappDaoFactory(); WebappDaoFactory wdf = vreq.getWebappDaoFactory();
vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior 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("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString()));
request.setAttribute("gYearMonthDatatypeUriJson", MiscWebUtils.escape(XSD.gYearMonth.toString())); request.setAttribute("gYearMonthDatatypeUriJson", MiscWebUtils.escape(XSD.gYearMonth.toString()));
@ -134,8 +126,7 @@
?activityUri <${labelUri}> ?label ; ?activityUri <${labelUri}> ?label ;
a <${activityClass}> ; a <${activityClass}> ;
a <${activitySuperClass}> ; a <${activitySuperClass}> ;
a <${flagUri}> ;
<${inverseUri}> ?person ; <${inverseUri}> ?person ;
<${inverseSuperPropertyUri}> ?person . <${inverseSuperPropertyUri}> ?person .

View file

@ -62,14 +62,6 @@ core:dateTimePrecision (DateTimeValue : DateTimeValuePrecision)
WebappDaoFactory wdf = vreq.getWebappDaoFactory(); WebappDaoFactory wdf = vreq.getWebappDaoFactory();
vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior 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("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString()));
request.setAttribute("gYearDatatypeUriJson", MiscWebUtils.escape(XSD.gYear.toString())); request.setAttribute("gYearDatatypeUriJson", MiscWebUtils.escape(XSD.gYear.toString()));
%> %>
@ -185,14 +177,12 @@ the org type still gets asserted. --%>
?person core:educationalBackground ?edTrainingUri . ?person core:educationalBackground ?edTrainingUri .
?edTrainingUri core:educationalBackgroundOf ?person ; ?edTrainingUri core:educationalBackgroundOf ?person ;
a core:EducationalTraining , a core:EducationalTraining .
<${flagUri}> .
</v:jsonset> </v:jsonset>
<v:jsonset var="n3ForNewOrg"> <v:jsonset var="n3ForNewOrg">
?newOrg <${label}> ?newOrgName ; ?newOrg <${label}> ?newOrgName ;
a ?newOrgType , a ?newOrgType .
<${flagUri}> .
?edTrainingUri <${orgGrantingDegree}> ?newOrg . ?edTrainingUri <${orgGrantingDegree}> ?newOrg .
</v:jsonset> </v:jsonset>

View file

@ -31,14 +31,6 @@
WebappDaoFactory wdf = vreq.getWebappDaoFactory(); WebappDaoFactory wdf = vreq.getWebappDaoFactory();
vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior 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("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString()));
request.setAttribute("gYearDatatypeUriJson", MiscWebUtils.escape(XSD.gYear.toString())); request.setAttribute("gYearDatatypeUriJson", MiscWebUtils.escape(XSD.gYear.toString()));
%> %>
@ -120,16 +112,14 @@
?person core:personInPosition ?positionUri . ?person core:personInPosition ?positionUri .
?positionUri core:positionForPerson ?person ; ?positionUri core:positionForPerson ?person ;
a ?positionType , a ?positionType .
<${flagUri}> .
</v:jsonset> </v:jsonset>
<v:jsonset var="n3ForNewOrg"> <v:jsonset var="n3ForNewOrg">
?positionUri <${positionInOrgPred}> ?newOrg . ?positionUri <${positionInOrgPred}> ?newOrg .
?newOrg <${label}> ?newOrgName ; ?newOrg <${label}> ?newOrgName ;
a ?newOrgType , a ?newOrgType ;
<${flagUri}> ;
<${orgForPositionPred}> ?positionUri . <${orgForPositionPred}> ?positionUri .
</v:jsonset> </v:jsonset>