NIHVIVO-193 Position history form on page load.
This commit is contained in:
parent
7aad9c2154
commit
dd96daadad
2 changed files with 63 additions and 47 deletions
|
@ -19,10 +19,10 @@
|
||||||
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
|
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
VitroRequest vreq = new VitroRequest(request);
|
VitroRequest vreq = new VitroRequest(request);
|
||||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
||||||
vreq.setAttribute("defaultNamespace", wdf.getDefaultNamespace());
|
vreq.setAttribute("defaultNamespace", wdf.getDefaultNamespace());
|
||||||
|
|
||||||
String flagURI = null;
|
String flagURI = null;
|
||||||
if (vreq.getAppBean().isFlag1Active()) {
|
if (vreq.getAppBean().isFlag1Active()) {
|
||||||
flagURI = VitroVocabulary.vitroURI+"Flag1Value"+vreq.getPortal().getPortalId()+"Thing";
|
flagURI = VitroVocabulary.vitroURI+"Flag1Value"+vreq.getPortal().getPortalId()+"Thing";
|
||||||
|
@ -45,22 +45,22 @@
|
||||||
and in the literalsOnForm --%>
|
and in the literalsOnForm --%>
|
||||||
<c:set var="titlePred" value="${vivo}titleOrRole" />
|
<c:set var="titlePred" value="${vivo}titleOrRole" />
|
||||||
<v:jsonset var="titleExisting" >
|
<v:jsonset var="titleExisting" >
|
||||||
SELECT ?titleExisting WHERE {
|
SELECT ?titleExisting WHERE {
|
||||||
?positionUri <${titlePred}> ?titleExisting }
|
?positionUri <${titlePred}> ?titleExisting }
|
||||||
</v:jsonset>
|
</v:jsonset>
|
||||||
|
|
||||||
<%-- Pair the "existing" query with the skeleton of what will be asserted for a new statement involving this field.
|
<%-- Pair the "existing" query with the skeleton of what will be asserted for a new statement involving this field.
|
||||||
The actual assertion inserted in the model will be created via string substitution into the ? variables.
|
The actual assertion inserted in the model will be created via string substitution into the ? variables.
|
||||||
NOTE the pattern of punctuation (a period after the prefix URI and after the ?field) --%>
|
NOTE the pattern of punctuation (a period after the prefix URI and after the ?field) --%>
|
||||||
<v:jsonset var="titleAssertion" >
|
<v:jsonset var="titleAssertion" >
|
||||||
?positionUri <${titlePred}> ?title .
|
?positionUri <${titlePred}> ?title .
|
||||||
?positionUri <${rdf}label> ?title.
|
?positionUri <${rdf}label> ?title.
|
||||||
</v:jsonset>
|
</v:jsonset>
|
||||||
|
|
||||||
<c:set var="involvedOrgNamePred" value="${vivo}involvedOrganizationName" />
|
<c:set var="involvedOrgNamePred" value="${vivo}involvedOrganizationName" />
|
||||||
<v:jsonset var="organizationNameExisting" >
|
<v:jsonset var="organizationNameExisting" >
|
||||||
SELECT ?existingOrgName WHERE {
|
SELECT ?existingOrgName WHERE {
|
||||||
?positionUri <${involvedOrgNamePred}> ?existingOrgName }
|
?positionUri <${involvedOrgNamePred}> ?existingOrgName }
|
||||||
</v:jsonset>
|
</v:jsonset>
|
||||||
<v:jsonset var="organizationNameAssertion" >
|
<v:jsonset var="organizationNameAssertion" >
|
||||||
?positionUri <${involvedOrgNamePred}> ?organizationName .
|
?positionUri <${involvedOrgNamePred}> ?organizationName .
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
<c:set var="startYearPred" value="${vivo}startYear" />
|
<c:set var="startYearPred" value="${vivo}startYear" />
|
||||||
<v:jsonset var="startYearExisting" >
|
<v:jsonset var="startYearExisting" >
|
||||||
SELECT ?startYearExisting WHERE {
|
SELECT ?startYearExisting WHERE {
|
||||||
?positionUri <${startYearPred}> ?startYearExisting }
|
?positionUri <${startYearPred}> ?startYearExisting }
|
||||||
</v:jsonset>
|
</v:jsonset>
|
||||||
<v:jsonset var="startYearAssertion" >
|
<v:jsonset var="startYearAssertion" >
|
||||||
?positionUri <${startYearPred}> ?startYear .
|
?positionUri <${startYearPred}> ?startYear .
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
<c:set var="endYearPred" value="${vivo}endYear" />
|
<c:set var="endYearPred" value="${vivo}endYear" />
|
||||||
<v:jsonset var="endYearExisting" >
|
<v:jsonset var="endYearExisting" >
|
||||||
SELECT ?endYearExisting WHERE {
|
SELECT ?endYearExisting WHERE {
|
||||||
?positionUri <${endYearPred}> ?endYearExisting }
|
?positionUri <${endYearPred}> ?endYearExisting }
|
||||||
</v:jsonset>
|
</v:jsonset>
|
||||||
<v:jsonset var="endYearAssertion" >
|
<v:jsonset var="endYearAssertion" >
|
||||||
?positionUri <${endYearPred}> ?endYear .
|
?positionUri <${endYearPred}> ?endYear .
|
||||||
|
@ -89,12 +89,12 @@
|
||||||
or in the SparqlForExistingUris, as well as perhaps in how the options are prepared --%>
|
or in the SparqlForExistingUris, as well as perhaps in how the options are prepared --%>
|
||||||
<c:set var="positionInOrgPred" value="${vivo}positionInOrganization" />
|
<c:set var="positionInOrgPred" value="${vivo}positionInOrganization" />
|
||||||
<v:jsonset var="organizationUriExisting" >
|
<v:jsonset var="organizationUriExisting" >
|
||||||
SELECT ?existingOrgUri WHERE {
|
SELECT ?existingOrgUri WHERE {
|
||||||
?positionUri <${positionInOrgPred}> ?existingOrgUri }
|
?positionUri <${positionInOrgPred}> ?existingOrgUri }
|
||||||
</v:jsonset>
|
</v:jsonset>
|
||||||
<v:jsonset var="organizationUriAssertion" >
|
<v:jsonset var="organizationUriAssertion" >
|
||||||
?positionUri <${positionInOrgPred}> ?organizationUri .
|
?positionUri <${positionInOrgPred}> ?organizationUri .
|
||||||
?organizationUri <${vivo}organizationForPosition> ?positionUri .
|
?organizationUri <${vivo}organizationForPosition> ?positionUri .
|
||||||
</v:jsonset>
|
</v:jsonset>
|
||||||
|
|
||||||
<v:jsonset var="n3ForStmtToPerson" >
|
<v:jsonset var="n3ForStmtToPerson" >
|
||||||
|
@ -129,7 +129,7 @@
|
||||||
"literalsInScope": { },
|
"literalsInScope": { },
|
||||||
"urisOnForm" : [ "organizationUri" ],
|
"urisOnForm" : [ "organizationUri" ],
|
||||||
"literalsOnForm" : [ "title", "organizationName",
|
"literalsOnForm" : [ "title", "organizationName",
|
||||||
"startYear", "endYear" ],
|
"startYear", "endYear" ],
|
||||||
"filesOnForm" : [ ],
|
"filesOnForm" : [ ],
|
||||||
"sparqlForLiterals" : { },
|
"sparqlForLiterals" : { },
|
||||||
"sparqlForUris" : { },
|
"sparqlForUris" : { },
|
||||||
|
@ -158,7 +158,7 @@
|
||||||
"newResource" : "false",
|
"newResource" : "false",
|
||||||
"validators" : [ ],
|
"validators" : [ ],
|
||||||
"optionsType" : "INDIVIDUALS_VIA_VCLASS",
|
"optionsType" : "INDIVIDUALS_VIA_VCLASS",
|
||||||
"literalOptions" : [ "--" ],
|
"literalOptions" : [ "Select one" ],
|
||||||
"predicateUri" : "",
|
"predicateUri" : "",
|
||||||
"objectClassUri" : "${organizationClass}",
|
"objectClassUri" : "${organizationClass}",
|
||||||
"rangeDatatypeUri" : "",
|
"rangeDatatypeUri" : "",
|
||||||
|
@ -203,35 +203,35 @@
|
||||||
</c:set>
|
</c:set>
|
||||||
<%
|
<%
|
||||||
|
|
||||||
EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request);
|
EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request);
|
||||||
if (editConfig == null) {
|
if (editConfig == null) {
|
||||||
editConfig = new EditConfiguration(
|
editConfig = new EditConfiguration(
|
||||||
(String) request
|
(String) request
|
||||||
.getAttribute("editjson"));
|
.getAttribute("editjson"));
|
||||||
EditConfiguration.putConfigInSession(editConfig,session);
|
EditConfiguration.putConfigInSession(editConfig,session);
|
||||||
}
|
}
|
||||||
|
|
||||||
Model model = (Model) application.getAttribute("jenaOntModel");
|
Model model = (Model) application.getAttribute("jenaOntModel");
|
||||||
String objectUri = (String) request.getAttribute("objectUri");
|
String objectUri = (String) request.getAttribute("objectUri");
|
||||||
if (objectUri != null) {
|
if (objectUri != null) {
|
||||||
editConfig.prepareForObjPropUpdate(model);
|
editConfig.prepareForObjPropUpdate(model);
|
||||||
} else {
|
} else {
|
||||||
editConfig.prepareForNonUpdate(model);
|
editConfig.prepareForNonUpdate(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* prepare the page title and text for the submit button */
|
/* prepare the page title and text for the submit button */
|
||||||
String subjectName = ((Individual) request.getAttribute("subject")).getName();
|
String subjectName = ((Individual) request.getAttribute("subject")).getName();
|
||||||
String submitLabel = "";
|
String submitLabel = "";
|
||||||
if (objectUri != null) {
|
if (objectUri != null) {
|
||||||
request.setAttribute("title","Edit position entry for "+ subjectName);
|
request.setAttribute("title","Edit position entry for "+ subjectName);
|
||||||
submitLabel = "Save changes";
|
submitLabel = "Save changes";
|
||||||
} else {
|
} else {
|
||||||
request.setAttribute("title","Create a new position entry for " + subjectName);
|
request.setAttribute("title","Create a new position entry for " + subjectName);
|
||||||
submitLabel = "Create new position history entry";
|
submitLabel = "Create new position history entry";
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> customJs = new ArrayList<String>(Arrays.asList("../js/customForms/personHasPositionHistory.js"));
|
List<String> customJs = new ArrayList<String>(Arrays.asList("../js/customForms/personHasPositionHistory.js"));
|
||||||
request.setAttribute("customJs", customJs);
|
request.setAttribute("customJs", customJs);
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<jsp:include page="${preForm}" />
|
<jsp:include page="${preForm}" />
|
||||||
|
@ -239,6 +239,10 @@
|
||||||
<h2>${title}</h2>
|
<h2>${title}</h2>
|
||||||
|
|
||||||
<form action="<c:url value="/edit/processRdfForm2.jsp"/>" >
|
<form action="<c:url value="/edit/processRdfForm2.jsp"/>" >
|
||||||
|
<div id="orgNotListed">
|
||||||
|
If your organization is not listed, please <a href="#">add a new organization</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="existingOrg">
|
<div id="existingOrg">
|
||||||
<v:input type="select" label="Organization" id="organizationUri" />
|
<v:input type="select" label="Organization" id="organizationUri" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -248,7 +252,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="position">
|
<div id="position">
|
||||||
<v:input type="text" label="Position Title" id="title" size="30" />
|
<v:input type="text" label="Position Title" id="title" size="30" />
|
||||||
<v:input type="select" label="Position Type" id="type" />
|
<v:input type="select" label="Position Type" id="type" />
|
||||||
|
|
||||||
<v:input type="text" label="Start Year" id="startYear" size="4"/>
|
<v:input type="text" label="Start Year" id="startYear" size="4"/>
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
var personHasPositionHistory = {
|
||||||
|
|
||||||
|
onLoad: function() {
|
||||||
|
$("#newOrg").hide();
|
||||||
|
$("#position").hide();
|
||||||
|
$("#submit").val("Continue");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
personHasPositionHistory.onLoad();
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue