2010-03-02 20:56:03 +00:00
|
|
|
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
|
|
|
|
|
2010-03-26 21:58:00 +00:00
|
|
|
<%@ page import="java.util.List" %>
|
|
|
|
<%@ page import="java.util.ArrayList" %>
|
|
|
|
<%@ page import="java.util.Arrays" %>
|
|
|
|
|
2010-01-29 22:12:41 +00:00
|
|
|
<%@ page import="com.hp.hpl.jena.rdf.model.Literal"%>
|
|
|
|
<%@ page import="com.hp.hpl.jena.rdf.model.Model"%>
|
2010-03-26 20:19:17 +00:00
|
|
|
<%@ page import="com.hp.hpl.jena.vocabulary.XSD" %>
|
|
|
|
|
2010-01-29 22:12:41 +00:00
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%>
|
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%>
|
2010-03-26 20:19:17 +00:00
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration"%>
|
2010-01-29 22:12:41 +00:00
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%>
|
2010-03-26 20:19:17 +00:00
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%>
|
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%>
|
2011-01-06 01:47:54 +00:00
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.StartYearBeforeEndYear"%>
|
2010-09-01 21:06:17 +00:00
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.JavaScript" %>
|
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %>
|
2011-01-06 01:47:54 +00:00
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.elements.DateTimeWithPrecision"%>
|
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field"%>
|
2011-01-25 22:41:20 +00:00
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils"%>
|
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode"%>
|
2010-01-29 22:12:41 +00:00
|
|
|
|
2010-03-29 15:41:45 +00:00
|
|
|
<%@ page import="org.apache.commons.logging.Log" %>
|
|
|
|
<%@ page import="org.apache.commons.logging.LogFactory" %>
|
2011-01-25 22:41:20 +00:00
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.DateTimeIntervalValidation"%>
|
2010-03-29 15:41:45 +00:00
|
|
|
|
2010-01-29 22:12:41 +00:00
|
|
|
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
|
|
|
|
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
|
|
|
|
|
2010-03-29 15:41:45 +00:00
|
|
|
<%!
|
|
|
|
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.edit.forms.personHasPositionHistory.jsp");
|
|
|
|
%>
|
2010-01-29 22:12:41 +00:00
|
|
|
<%
|
2010-03-26 22:33:55 +00:00
|
|
|
VitroRequest vreq = new VitroRequest(request);
|
2010-04-01 21:35:39 +00:00
|
|
|
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
|
|
|
vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior
|
2010-03-26 22:33:55 +00:00
|
|
|
|
2010-03-26 20:19:17 +00:00
|
|
|
request.setAttribute("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString()));
|
|
|
|
request.setAttribute("gYearDatatypeUriJson", MiscWebUtils.escape(XSD.gYear.toString()));
|
2011-01-25 22:00:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
There are 4 modes that this form can be in:
|
|
|
|
1. Add, there is a subject and a predicate but no position and nothing else.
|
|
|
|
|
|
|
|
2. normal edit where everything should already be filled out. There is a subject, a object and an individual on
|
|
|
|
the other end of the object's core:personInOrganization stmt.
|
|
|
|
|
|
|
|
3. Repair a bad role node. There is a subject, prediate and object but there is no individual on the
|
|
|
|
other end of the object's core:personInOrganization stmt. This should be similar to an add but the form should be expanded.
|
|
|
|
|
|
|
|
4. Really bad node. multiple core:personInOrganization statements.
|
|
|
|
*/
|
|
|
|
|
|
|
|
EditMode mode = FrontEndEditingUtils.getEditMode(request, "http://vivoweb.org/ontology/core#positionInOrganization");
|
|
|
|
|
|
|
|
if( mode == EditMode.ADD ) {
|
|
|
|
%> <c:set var="editMode" value="add"/><%
|
|
|
|
} else if(mode == EditMode.EDIT){
|
|
|
|
%> <c:set var="editMode" value="edit"/><%
|
|
|
|
} else if(mode == EditMode.REPAIR){
|
|
|
|
%> <c:set var="editMode" value="repair"/><%
|
|
|
|
}
|
2010-01-29 22:12:41 +00:00
|
|
|
%>
|
|
|
|
|
2011-01-05 21:25:18 +00:00
|
|
|
<c:set var="vivoCore" value="http://vivoweb.org/ontology/core#" />
|
2011-01-04 00:03:25 +00:00
|
|
|
<c:set var="type" value="<%= VitroVocabulary.RDF_TYPE %>" />
|
2010-03-29 15:41:45 +00:00
|
|
|
<c:set var="rdfs" value="<%= VitroVocabulary.RDFS %>" />
|
|
|
|
<c:set var="label" value="${rdfs}label" />
|
2010-03-29 17:14:24 +00:00
|
|
|
<c:set var="positionClass" value="${vivoCore}Position" />
|
|
|
|
<c:set var="orgClass" value="http://xmlns.com/foaf/0.1/Organization" />
|
2010-01-29 22:12:41 +00:00
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<%-- Define predicates used in n3 assertions and sparql queries --%>
|
|
|
|
<c:set var="positionInOrgPred" value="${vivoCore}positionInOrganization" />
|
|
|
|
<c:set var="orgForPositionPred" value="${vivoCore}organizationForPosition" />
|
|
|
|
|
2011-01-04 00:03:25 +00:00
|
|
|
<c:set var="dateTimeValue" value="${vivoCore}dateTime"/>
|
|
|
|
<c:set var="dateTimeValueType" value="${vivoCore}DateTimeValue"/>
|
|
|
|
<c:set var="dateTimePrecision" value="${vivoCore}dateTimePrecision"/>
|
|
|
|
<c:set var="edToDateTime" value="${vivoCore}dateTimeInterval"/>
|
|
|
|
|
|
|
|
<c:set var="positionToInterval" value="${vivoCore}dateTimeInterval"/>
|
|
|
|
<c:set var="intervalType" value="${vivoCore}DateTimeInterval"/>
|
|
|
|
<c:set var="intervalToStart" value="${vivoCore}start"/>
|
|
|
|
<c:set var="intervalToEnd" value="${vivoCore}end"/>
|
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<%-- Assertions for adding a new role --%>
|
|
|
|
|
|
|
|
<v:jsonset var="orgTypeAssertion">
|
|
|
|
?org a ?orgType .
|
2010-01-29 22:12:41 +00:00
|
|
|
</v:jsonset>
|
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<v:jsonset var="orgLabelAssertion">
|
|
|
|
?org <${label}> ?orgLabel .
|
2010-01-29 22:12:41 +00:00
|
|
|
</v:jsonset>
|
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<v:jsonset var="positionTitleAssertion" >
|
2011-01-05 15:46:08 +00:00
|
|
|
?position <${label}> ?positionTitle .
|
2010-01-29 22:12:41 +00:00
|
|
|
</v:jsonset>
|
2010-09-01 21:06:17 +00:00
|
|
|
|
|
|
|
<v:jsonset var="positionTypeAssertion">
|
|
|
|
?position a ?positionType .
|
2010-01-29 22:12:41 +00:00
|
|
|
</v:jsonset>
|
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<v:jsonset var="n3ForNewPosition">
|
|
|
|
@prefix core: <${vivoCore}> .
|
|
|
|
|
|
|
|
?person core:personInPosition ?position .
|
|
|
|
|
|
|
|
?position a ?positionType ;
|
|
|
|
core:positionForPerson ?person ;
|
|
|
|
<${positionInOrgPred}> ?org .
|
|
|
|
|
|
|
|
?org <${orgForPositionPred}> ?position .
|
2010-03-29 15:41:45 +00:00
|
|
|
</v:jsonset>
|
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<v:jsonset var="n3ForPositionToOrg" >
|
|
|
|
?position <${positionInOrgPred}> ?org .
|
|
|
|
?org <${orgForPositionPred}> ?position .
|
2010-03-29 18:12:22 +00:00
|
|
|
</v:jsonset>
|
2010-09-01 21:06:17 +00:00
|
|
|
|
2011-01-04 00:03:25 +00:00
|
|
|
<v:jsonset var="n3ForStart">
|
|
|
|
?position <${positionToInterval}> ?intervalNode .
|
|
|
|
?intervalNode <${type}> <${intervalType}> .
|
|
|
|
?intervalNode <${intervalToStart}> ?startNode .
|
|
|
|
?startNode <${type}> <${dateTimeValueType}> .
|
|
|
|
?startNode <${dateTimeValue}> ?startField.value .
|
|
|
|
?startNode <${dateTimePrecision}> ?startField.precision .
|
|
|
|
</v:jsonset>
|
|
|
|
|
|
|
|
<v:jsonset var="n3ForEnd">
|
|
|
|
?position <${positionToInterval}> ?intervalNode .
|
|
|
|
?intervalNode <${type}> <${intervalType}> .
|
|
|
|
?intervalNode <${intervalToEnd}> ?endNode .
|
|
|
|
?endNode <${type}> <${dateTimeValueType}> .
|
|
|
|
?endNode <${dateTimeValue}> ?endField.value .
|
|
|
|
?endNode <${dateTimePrecision}> ?endField.precision .
|
|
|
|
</v:jsonset>
|
2010-09-01 21:06:17 +00:00
|
|
|
|
|
|
|
<%-- Queries for editing an existing role --%>
|
|
|
|
|
|
|
|
<v:jsonset var="orgQuery" >
|
|
|
|
SELECT ?existingOrg WHERE {
|
|
|
|
?position <${positionInOrgPred}> ?existingOrg . }
|
2010-03-29 18:12:22 +00:00
|
|
|
</v:jsonset>
|
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<v:jsonset var="orgLabelQuery" >
|
|
|
|
SELECT ?existingOrgLabel WHERE {
|
|
|
|
?position <${positionInOrgPred}> ?existingOrg .
|
|
|
|
?existingOrg <${label}> ?existingOrgLabel .
|
|
|
|
}
|
2010-03-29 15:41:45 +00:00
|
|
|
</v:jsonset>
|
2010-09-01 21:06:17 +00:00
|
|
|
|
2011-01-27 20:11:19 +00:00
|
|
|
<%-- Limit type to subclasses of foaf:Organization. Otherwise, sometimes owl:Thing or another
|
|
|
|
type is returned and we don't get a match to the select element options. --%>
|
|
|
|
<v:jsonset var="orgTypeQuery" >
|
|
|
|
PREFIX rdfs: <${rdfs}>
|
2010-09-01 21:06:17 +00:00
|
|
|
SELECT ?existingOrgType WHERE {
|
|
|
|
?position <${positionInOrgPred}> ?existingOrg .
|
|
|
|
?existingOrg a ?existingOrgType .
|
2011-01-27 20:14:46 +00:00
|
|
|
?existingOrgType rdfs:subClassOf <${orgClass}> .
|
2011-01-27 20:11:19 +00:00
|
|
|
}
|
2010-01-29 22:12:41 +00:00
|
|
|
</v:jsonset>
|
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<v:jsonset var="positionTitleQuery" >
|
|
|
|
SELECT ?existingPositionTitle WHERE {
|
2011-01-05 15:46:08 +00:00
|
|
|
?position <${label}> ?existingPositionTitle . }
|
2010-09-01 21:06:17 +00:00
|
|
|
</v:jsonset>
|
2010-01-29 22:12:41 +00:00
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<v:jsonset var="positionTypeQuery">
|
|
|
|
SELECT ?existingPositionType WHERE {
|
|
|
|
?position a ?existingPositionType . }
|
2010-03-29 15:41:45 +00:00
|
|
|
</v:jsonset>
|
|
|
|
|
2011-01-04 00:03:25 +00:00
|
|
|
|
|
|
|
<v:jsonset var="existingIntervalNodeQuery" >
|
|
|
|
SELECT ?existingIntervalNode WHERE {
|
|
|
|
?position <${positionToInterval}> ?existingIntervalNode .
|
|
|
|
?existingIntervalNode <${type}> <${intervalType}> . }
|
|
|
|
</v:jsonset>
|
|
|
|
|
|
|
|
<v:jsonset var="existingStartNodeQuery" >
|
|
|
|
SELECT ?existingStartNode WHERE {
|
|
|
|
?position <${positionToInterval}> ?intervalNode .
|
|
|
|
?intervalNode <${type}> <${intervalType}> .
|
|
|
|
?intervalNode <${intervalToStart}> ?existingStartNode .
|
|
|
|
?existingStartNode <${type}> <${dateTimeValueType}> .}
|
|
|
|
</v:jsonset>
|
|
|
|
|
|
|
|
<v:jsonset var="existingStartDateQuery" >
|
|
|
|
SELECT ?existingDateStart WHERE {
|
|
|
|
?position <${positionToInterval}> ?intervalNode .
|
|
|
|
?intervalNode <${type}> <${intervalType}> .
|
|
|
|
?intervalNode <${intervalToStart}> ?startNode .
|
|
|
|
?startNode <${type}> <${dateTimeValueType}> .
|
|
|
|
?startNode <${dateTimeValue}> ?existingDateStart . }
|
2010-09-01 21:06:17 +00:00
|
|
|
</v:jsonset>
|
2010-04-12 21:26:09 +00:00
|
|
|
|
2011-01-04 00:03:25 +00:00
|
|
|
<v:jsonset var="existingStartPrecisionQuery" >
|
|
|
|
SELECT ?existingStartPrecision WHERE {
|
|
|
|
?position <${positionToInterval}> ?intervalNode .
|
|
|
|
?intervalNode <${type}> <${intervalType}> .
|
|
|
|
?intervalNode <${intervalToStart}> ?startNode .
|
|
|
|
?startNode <${type}> <${dateTimeValueType}> .
|
|
|
|
?startNode <${dateTimePrecision}> ?existingStartPrecision . }
|
|
|
|
</v:jsonset>
|
|
|
|
|
|
|
|
|
|
|
|
<v:jsonset var="existingEndNodeQuery" >
|
|
|
|
SELECT ?existingEndNode WHERE {
|
|
|
|
?position <${positionToInterval}> ?intervalNode .
|
|
|
|
?intervalNode <${type}> <${intervalType}> .
|
|
|
|
?intervalNode <${intervalToEnd}> ?existingEndNode .
|
|
|
|
?existingEndNode <${type}> <${dateTimeValueType}> .}
|
|
|
|
</v:jsonset>
|
|
|
|
|
|
|
|
<v:jsonset var="existingEndDateQuery" >
|
|
|
|
SELECT ?existingEndDate WHERE {
|
|
|
|
?position <${positionToInterval}> ?intervalNode .
|
|
|
|
?intervalNode <${type}> <${intervalType}> .
|
|
|
|
?intervalNode <${intervalToEnd}> ?endNode .
|
|
|
|
?endNode <${type}> <${dateTimeValueType}> .
|
|
|
|
?endNode <${dateTimeValue}> ?existingEndDate . }
|
|
|
|
</v:jsonset>
|
|
|
|
|
|
|
|
<v:jsonset var="existingEndPrecisionQuery" >
|
|
|
|
SELECT ?existingEndPrecision WHERE {
|
|
|
|
?position <${positionToInterval}> ?intervalNode .
|
|
|
|
?intervalNode <${type}> <${intervalType}> .
|
|
|
|
?intervalNode <${intervalToEnd}> ?endNode .
|
|
|
|
?endNode <${type}> <${dateTimeValueType}> .
|
|
|
|
?endNode <${dateTimePrecision}> ?existingEndPrecision . }
|
2010-04-12 21:26:09 +00:00
|
|
|
</v:jsonset>
|
2010-01-29 22:12:41 +00:00
|
|
|
|
2010-03-29 17:14:24 +00:00
|
|
|
<v:jsonset var="positionClassUriJson">${positionClass}</v:jsonset>
|
|
|
|
<v:jsonset var="orgClassUriJson">${orgClass}</v:jsonset>
|
2010-01-29 22:12:41 +00:00
|
|
|
|
2010-09-07 20:04:19 +00:00
|
|
|
<c:set var="requiredHint" value="<span class='requiredHint'> *</span>" />
|
|
|
|
<c:set var="yearHint" value="<span class='hint'>(YYYY)</span>" />
|
|
|
|
|
2011-01-25 22:00:51 +00:00
|
|
|
<%-- Configure add vs. edit --%>
|
|
|
|
<c:choose>
|
|
|
|
<c:when test='${editMode == "add"}'>
|
2010-09-07 20:04:19 +00:00
|
|
|
<c:set var="titleVerb" value="Create" />
|
|
|
|
<c:set var="submitButtonText" value="Position" />
|
|
|
|
<c:set var="disabledVal" value="" />
|
2011-01-25 22:00:51 +00:00
|
|
|
</c:when>
|
|
|
|
<c:otherwise>
|
|
|
|
<c:set var="titleVerb" value="Edit" />
|
|
|
|
<c:set var="submitButtonText" value="Edit Position" />
|
2011-01-26 20:12:40 +00:00
|
|
|
<c:set var="disabledVal">${editMode == "repair" ? "" : "disabled" }</c:set>
|
2011-01-25 22:00:51 +00:00
|
|
|
</c:otherwise>
|
|
|
|
</c:choose>
|
2010-09-07 20:04:19 +00:00
|
|
|
|
2010-01-29 22:12:41 +00:00
|
|
|
<c:set var="editjson" scope="request">
|
|
|
|
{
|
|
|
|
"formUrl" : "${formUrl}",
|
|
|
|
"editKey" : "${editKey}",
|
|
|
|
"urlPatternToReturnTo" : "/entity",
|
|
|
|
|
|
|
|
"subject" : ["person", "${subjectUriJson}" ],
|
|
|
|
"predicate" : ["predicate", "${predicateUriJson}" ],
|
2010-09-01 21:06:17 +00:00
|
|
|
"object" : ["position", "${objectUriJson}", "URI" ],
|
2010-01-29 22:12:41 +00:00
|
|
|
|
2010-09-07 16:21:13 +00:00
|
|
|
"n3required" : [ "${n3ForNewPosition}", "${positionTitleAssertion}", "${positionTypeAssertion}",
|
2010-09-07 20:04:19 +00:00
|
|
|
"${orgLabelAssertion}", "${orgTypeAssertion}" ],
|
2010-03-29 15:41:45 +00:00
|
|
|
|
2011-01-04 00:03:25 +00:00
|
|
|
"n3optional" : [ "${n3ForStart}", "${n3ForEnd}" ],
|
2010-09-01 21:06:17 +00:00
|
|
|
|
|
|
|
"newResources" : { "position" : "${defaultNamespace}",
|
2011-01-04 00:03:25 +00:00
|
|
|
"org" : "${defaultNamespace}",
|
|
|
|
"intervalNode" : "${defaultNamespace}",
|
|
|
|
"startNode" : "${defaultNamespace}",
|
|
|
|
"endNode" : "${defaultNamespace}" },
|
2010-03-29 15:41:45 +00:00
|
|
|
|
2010-01-29 22:12:41 +00:00
|
|
|
"urisInScope" : { },
|
|
|
|
"literalsInScope": { },
|
2010-09-01 21:06:17 +00:00
|
|
|
"urisOnForm" : [ "org", "orgType", "positionType" ],
|
2011-01-04 00:03:25 +00:00
|
|
|
"literalsOnForm" : [ "positionTitle", "orgLabel" ],
|
2010-01-29 22:12:41 +00:00
|
|
|
"filesOnForm" : [ ],
|
|
|
|
"sparqlForLiterals" : { },
|
|
|
|
"sparqlForUris" : { },
|
|
|
|
"sparqlForExistingLiterals" : {
|
2010-09-01 21:06:17 +00:00
|
|
|
"orgLabel" : "${orgLabelQuery}",
|
|
|
|
"positionTitle" : "${positionTitleQuery}",
|
2011-01-04 00:03:25 +00:00
|
|
|
"startField.value" : "${existingStartDateQuery}",
|
|
|
|
"endField.value" : "${existingEndDateQuery}"
|
2010-01-29 22:12:41 +00:00
|
|
|
},
|
|
|
|
"sparqlForExistingUris" : {
|
2010-09-01 21:06:17 +00:00
|
|
|
"org" : "${orgQuery}",
|
|
|
|
"orgType" : "${orgTypeQuery}",
|
2011-01-04 00:03:25 +00:00
|
|
|
"positionType" : "${positionTypeQuery}" ,
|
|
|
|
"intervalNode" : "${existingIntervalNodeQuery}",
|
|
|
|
"startNode" : "${existingStartNodeQuery}",
|
|
|
|
"endNode" : "${existingEndNodeQuery}",
|
|
|
|
"startField.precision": "${existingStartPrecisionQuery}",
|
|
|
|
"endField.precision" : "${existingEndPrecisionQuery}"
|
2010-01-29 22:12:41 +00:00
|
|
|
},
|
|
|
|
"fields" : {
|
2010-09-01 21:06:17 +00:00
|
|
|
"positionTitle" : {
|
2010-01-29 22:12:41 +00:00
|
|
|
"newResource" : "false",
|
|
|
|
"validators" : [ "nonempty" ],
|
|
|
|
"optionsType" : "UNDEFINED",
|
|
|
|
"literalOptions" : [ ],
|
|
|
|
"predicateUri" : "",
|
|
|
|
"objectClassUri" : "",
|
2010-03-30 14:13:23 +00:00
|
|
|
"rangeDatatypeUri" : "${stringDatatypeUriJson}",
|
2010-01-29 22:12:41 +00:00
|
|
|
"rangeLang" : "",
|
2010-09-01 21:06:17 +00:00
|
|
|
"assertions" : [ "${positionTitleAssertion}" ]
|
2010-01-29 22:12:41 +00:00
|
|
|
},
|
2010-03-29 17:14:24 +00:00
|
|
|
"positionType" : {
|
|
|
|
"newResource" : "false",
|
2010-04-05 17:51:17 +00:00
|
|
|
"validators" : [ "nonempty" ],
|
2010-03-29 17:14:24 +00:00
|
|
|
"optionsType" : "CHILD_VCLASSES_WITH_PARENT",
|
|
|
|
"literalOptions" : [ "Select one" ],
|
|
|
|
"predicateUri" : "",
|
|
|
|
"objectClassUri" : "${positionClassUriJson}",
|
|
|
|
"rangeDatatypeUri" : "",
|
|
|
|
"rangeLang" : "",
|
2010-03-29 18:12:22 +00:00
|
|
|
"assertions" : [ "${positionTypeAssertion}" ]
|
2010-03-29 17:14:24 +00:00
|
|
|
},
|
2010-09-01 21:06:17 +00:00
|
|
|
"org" : {
|
2010-01-29 22:12:41 +00:00
|
|
|
"newResource" : "false",
|
|
|
|
"validators" : [ ],
|
|
|
|
"optionsType" : "INDIVIDUALS_VIA_VCLASS",
|
2010-03-26 22:33:55 +00:00
|
|
|
"literalOptions" : [ "Select one" ],
|
2010-01-29 22:12:41 +00:00
|
|
|
"predicateUri" : "",
|
2010-03-29 17:14:24 +00:00
|
|
|
"objectClassUri" : "${orgClassUriJson}",
|
2010-01-29 22:12:41 +00:00
|
|
|
"rangeDatatypeUri" : "",
|
|
|
|
"rangeLang" : "",
|
2010-09-01 21:06:17 +00:00
|
|
|
"assertions" : [ "${n3ForPositionToOrg}" ]
|
2010-01-29 22:12:41 +00:00
|
|
|
},
|
2010-09-01 21:06:17 +00:00
|
|
|
"orgLabel" : {
|
2010-03-30 14:13:23 +00:00
|
|
|
"newResource" : "false",
|
2010-09-07 16:21:13 +00:00
|
|
|
"validators" : [ "nonempty" ],
|
2010-01-29 22:12:41 +00:00
|
|
|
"optionsType" : "UNDEFINED",
|
|
|
|
"literalOptions" : [ ],
|
|
|
|
"predicateUri" : "",
|
|
|
|
"objectClassUri" : "",
|
2010-03-26 20:19:17 +00:00
|
|
|
"rangeDatatypeUri" : "${stringDatatypeUriJson}",
|
2010-01-29 22:12:41 +00:00
|
|
|
"rangeLang" : "",
|
2010-09-01 21:06:17 +00:00
|
|
|
"assertions" : [ "${orgLabelAssertion}" ]
|
2010-01-29 22:12:41 +00:00
|
|
|
},
|
2010-09-01 21:06:17 +00:00
|
|
|
"orgType" : {
|
2010-03-29 15:41:45 +00:00
|
|
|
"newResource" : "false",
|
2010-09-07 16:21:13 +00:00
|
|
|
"validators" : [ "nonempty" ],
|
2010-03-30 01:03:57 +00:00
|
|
|
"optionsType" : "CHILD_VCLASSES",
|
2010-03-29 15:41:45 +00:00
|
|
|
"literalOptions" : [ "Select one" ],
|
|
|
|
"predicateUri" : "",
|
2010-03-30 01:03:57 +00:00
|
|
|
"objectClassUri" : "${orgClassUriJson}",
|
2010-03-29 15:41:45 +00:00
|
|
|
"rangeDatatypeUri" : "",
|
|
|
|
"rangeLang" : "",
|
2010-09-01 21:06:17 +00:00
|
|
|
"assertions" : [ "${orgTypeAssertion}" ]
|
2010-03-29 15:41:45 +00:00
|
|
|
},
|
2011-01-04 00:03:25 +00:00
|
|
|
"startField" : {
|
2010-01-29 22:12:41 +00:00
|
|
|
"newResource" : "false",
|
2011-01-04 00:03:25 +00:00
|
|
|
"validators" : [ ],
|
2010-01-29 22:12:41 +00:00
|
|
|
"optionsType" : "UNDEFINED",
|
|
|
|
"literalOptions" : [ ],
|
|
|
|
"predicateUri" : "",
|
|
|
|
"objectClassUri" : "",
|
2011-01-04 00:03:25 +00:00
|
|
|
"rangeDatatypeUri" : "",
|
2010-01-29 22:12:41 +00:00
|
|
|
"rangeLang" : "",
|
2011-01-04 00:03:25 +00:00
|
|
|
"assertions" : ["${n3ForStart}"]
|
2010-01-29 22:12:41 +00:00
|
|
|
},
|
2011-01-04 00:03:25 +00:00
|
|
|
"endField" : {
|
2010-01-29 22:12:41 +00:00
|
|
|
"newResource" : "false",
|
2011-01-04 00:03:25 +00:00
|
|
|
"validators" : [ ],
|
2010-01-29 22:12:41 +00:00
|
|
|
"optionsType" : "UNDEFINED",
|
|
|
|
"literalOptions" : [ ],
|
|
|
|
"predicateUri" : "",
|
|
|
|
"objectClassUri" : "",
|
2011-01-04 00:03:25 +00:00
|
|
|
"rangeDatatypeUri" : "",
|
2010-01-29 22:12:41 +00:00
|
|
|
"rangeLang" : "",
|
2011-01-04 00:03:25 +00:00
|
|
|
"assertions" : ["${n3ForEnd}"]
|
2010-02-05 20:02:47 +00:00
|
|
|
}
|
2010-01-29 22:12:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</c:set>
|
2010-09-07 20:04:19 +00:00
|
|
|
|
2010-01-29 22:12:41 +00:00
|
|
|
<%
|
2011-01-25 22:00:51 +00:00
|
|
|
//log.debug(request.getAttribute("editjson"));
|
2010-01-29 22:12:41 +00:00
|
|
|
|
2010-03-26 22:33:55 +00:00
|
|
|
EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request);
|
|
|
|
if (editConfig == null) {
|
2010-03-29 15:41:45 +00:00
|
|
|
editConfig = new EditConfiguration((String) request.getAttribute("editjson"));
|
2010-03-26 22:33:55 +00:00
|
|
|
EditConfiguration.putConfigInSession(editConfig,session);
|
2011-01-04 00:03:25 +00:00
|
|
|
|
|
|
|
//setup date time edit elements
|
|
|
|
Field startField = editConfig.getField("startField");
|
2011-01-06 01:47:54 +00:00
|
|
|
// arguments for DateTimeWithPrecision are (fieldName, minimumPrecision, [requiredLevel])
|
|
|
|
startField.setEditElement(new DateTimeWithPrecision(startField, VitroVocabulary.Precision.YEAR.uri(), VitroVocabulary.Precision.NONE.uri()));
|
2011-01-04 00:03:25 +00:00
|
|
|
Field endField = editConfig.getField("endField");
|
2011-01-06 01:47:54 +00:00
|
|
|
endField.setEditElement(new DateTimeWithPrecision(endField, VitroVocabulary.Precision.YEAR.uri(), VitroVocabulary.Precision.NONE.uri()));
|
2011-01-11 18:21:13 +00:00
|
|
|
|
|
|
|
editConfig.addValidator(new DateTimeIntervalValidation("startField","endField") );
|
|
|
|
}
|
2010-09-01 21:06:17 +00:00
|
|
|
|
2010-03-26 22:33:55 +00:00
|
|
|
Model model = (Model) application.getAttribute("jenaOntModel");
|
2010-09-07 20:04:19 +00:00
|
|
|
|
2011-01-25 22:00:51 +00:00
|
|
|
String objectUri = (String) request.getAttribute("objectUri");
|
2010-03-29 15:41:45 +00:00
|
|
|
if (objectUri != null) { // editing existing
|
2010-03-26 22:33:55 +00:00
|
|
|
editConfig.prepareForObjPropUpdate(model);
|
2010-03-29 15:41:45 +00:00
|
|
|
} else { // adding new
|
2010-03-26 22:33:55 +00:00
|
|
|
editConfig.prepareForNonUpdate(model);
|
|
|
|
}
|
2010-09-01 21:06:17 +00:00
|
|
|
|
|
|
|
List<String> customJs = new ArrayList<String>(Arrays.asList(JavaScript.JQUERY_UI.path(),
|
|
|
|
JavaScript.CUSTOM_FORM_UTILS.path(),
|
|
|
|
"/edit/forms/js/customFormWithAutocomplete.js"
|
|
|
|
));
|
2010-03-26 22:33:55 +00:00
|
|
|
request.setAttribute("customJs", customJs);
|
2010-03-26 23:06:38 +00:00
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
List<String> customCss = new ArrayList<String>(Arrays.asList(Css.JQUERY_UI.path(),
|
|
|
|
Css.CUSTOM_FORM.path(),
|
|
|
|
"/edit/forms/css/customFormWithAutocomplete.css"
|
|
|
|
));
|
2010-09-07 20:04:19 +00:00
|
|
|
request.setAttribute("customCss", customCss);
|
|
|
|
|
|
|
|
String subjectName = ((Individual) request.getAttribute("subject")).getName();
|
2010-01-29 22:12:41 +00:00
|
|
|
%>
|
|
|
|
|
2010-03-26 21:58:00 +00:00
|
|
|
<jsp:include page="${preForm}" />
|
2010-01-29 22:12:41 +00:00
|
|
|
|
2011-01-25 22:00:51 +00:00
|
|
|
<% if( mode == EditMode.ERROR ){ %>
|
|
|
|
<div>This form is unable to handle the editing of this position because it is associated with
|
|
|
|
multiple Position individuals.</div>
|
|
|
|
<% }else{ %>
|
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<h2>${titleVerb} position entry for <%= subjectName %></h2>
|
2010-03-30 19:33:54 +00:00
|
|
|
|
2010-12-08 14:04:45 +00:00
|
|
|
<form class="customForm" action="<c:url value="/edit/processRdfForm2.jsp"/>" >
|
2010-03-29 15:41:45 +00:00
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<p class="inline"><v:input type="select" label="Organization Type ${requiredHint}" name="orgType" disabled="${disabledVal}" id="typeSelector" /></p>
|
|
|
|
|
|
|
|
<div class="fullViewOnly">
|
|
|
|
|
2010-09-02 19:54:05 +00:00
|
|
|
<%-- <p> needed to create wrapper for show/hide --%>
|
2010-09-03 15:51:32 +00:00
|
|
|
<p><v:input type="text" id="relatedIndLabel" name="orgLabel" label="### Name ${requiredHint}" cssClass="acSelector" disabled="${disabledVal}" size="50" /></p>
|
2010-09-01 21:06:17 +00:00
|
|
|
|
|
|
|
<%-- Store these values in hidden fields, because the displayed fields are disabled and don't submit. This ensures that when
|
|
|
|
returning from a validation error, we retain the values. --%>
|
|
|
|
<c:if test="${editMode == 'edit'}">
|
|
|
|
<v:input type="hidden" id="orgType" />
|
|
|
|
<v:input type="hidden" id="orgLabel" />
|
|
|
|
</c:if>
|
|
|
|
|
|
|
|
<div class="acSelection">
|
|
|
|
<%-- RY maybe make this a label and input field. See what looks best. --%>
|
|
|
|
<p class="inline"><label></label><span class="acSelectionInfo"></span> <a href="<c:url value="/individual?uri=" />" class="verifyMatch">(Verify this match)</a></p>
|
|
|
|
<v:input type="hidden" id="org" cssClass="acUriReceiver" /> <!-- Field value populated by JavaScript -->
|
2010-04-02 22:30:09 +00:00
|
|
|
</div>
|
2010-09-01 21:06:17 +00:00
|
|
|
|
2010-09-03 15:51:32 +00:00
|
|
|
<v:input type="text" label="Position Title ${requiredHint}" id="positionTitle" size="30" />
|
2010-03-30 01:03:57 +00:00
|
|
|
<v:input type="select" label="Position Type ${requiredHint}" id="positionType" />
|
2010-03-26 21:58:00 +00:00
|
|
|
|
2011-01-04 00:03:25 +00:00
|
|
|
<v:input id="startField" label="Start Year <span class='hint'>(YYYY)</span>" />
|
|
|
|
<v:input id="endField" label="End Year <span class='hint'>(YYYY)</span>" />
|
2010-03-29 15:41:45 +00:00
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
</div>
|
2010-04-02 23:21:42 +00:00
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<p class="submit"><v:input type="submit" id="submit" value="${submitButtonText}" cancel="true"/></p>
|
2010-03-30 01:03:57 +00:00
|
|
|
|
|
|
|
<p id="requiredLegend" class="requiredHint">* required fields</p>
|
2010-01-29 22:12:41 +00:00
|
|
|
</form>
|
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<c:url var="acUrl" value="/autocomplete?tokenize=true&stem=true" />
|
2010-01-29 22:12:41 +00:00
|
|
|
|
2010-09-01 21:06:17 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
var customFormData = {
|
|
|
|
acUrl: '${acUrl}',
|
|
|
|
editMode: '${editMode}',
|
2011-01-25 22:00:51 +00:00
|
|
|
submitButtonTextType: 'compound',
|
|
|
|
defaultTypeName: 'organization' // used in repair mode, to generate button text and org name field label
|
2010-09-01 21:06:17 +00:00
|
|
|
};
|
|
|
|
</script>
|
2011-01-25 22:00:51 +00:00
|
|
|
<% } %>
|
2010-09-01 21:06:17 +00:00
|
|
|
|
|
|
|
<jsp:include page="${postForm}"/>
|