NIHVIVO-195 Custom activity forms basically working now.
This commit is contained in:
parent
4d87cf4acb
commit
1663e9ff2d
2 changed files with 40 additions and 31 deletions
|
@ -98,5 +98,8 @@ option {
|
||||||
/*display: none; Hide if Javascript disabled. Javascript will show. */
|
/*display: none; Hide if Javascript disabled. Javascript will show. */
|
||||||
border-color: #FF7700;
|
border-color: #FF7700;
|
||||||
color: #FF7700;
|
color: #FF7700;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content form textarea {
|
||||||
|
width: 30%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,20 +25,20 @@
|
||||||
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
|
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
|
||||||
|
|
||||||
<%!
|
<%!
|
||||||
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.edit.forms.personHasPositionHistory.jsp");
|
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.edit.forms.personHasActivity.jsp");
|
||||||
%>
|
%>
|
||||||
<%
|
<%
|
||||||
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;
|
String flagUri = null;
|
||||||
if (vreq.getAppBean().isFlag1Active()) {
|
if (wdf.getApplicationDao().isFlag1Active()) {
|
||||||
flagURI = VitroVocabulary.vitroURI+"Flag1Value"+vreq.getPortal().getPortalId()+"Thing";
|
flagUri = VitroVocabulary.vitroURI+"Flag1Value"+vreq.getPortal().getPortalId()+"Thing";
|
||||||
} else {
|
} else {
|
||||||
flagURI = wdf.getVClassDao().getTopConcept().getURI(); // fall back to owl:Thing if not portal filtering
|
flagUri = wdf.getVClassDao().getTopConcept().getURI(); // fall back to owl:Thing if not portal filtering
|
||||||
}
|
}
|
||||||
vreq.setAttribute("flagURI",flagURI);
|
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()));
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
<c:set var="vivoCore" value="http://vivoweb.org/ontology/core#" />
|
<c:set var="vivoCore" value="http://vivoweb.org/ontology/core#" />
|
||||||
<c:set var="rdfs" value="<%= VitroVocabulary.RDFS %>" />
|
<c:set var="rdfs" value="<%= VitroVocabulary.RDFS %>" />
|
||||||
<c:set var="label" value="${rdfs}label" />
|
<c:set var="labelUri" value="${rdfs}label" />
|
||||||
|
|
||||||
<c:set var="researchActivityUri" value="${vivoCore}hasResearchActivity" />
|
<c:set var="researchActivityUri" value="${vivoCore}hasResearchActivity" />
|
||||||
<c:set var="teachingActivityUri" value="${vivoCore}hasTeachingActivity" />
|
<c:set var="teachingActivityUri" value="${vivoCore}hasTeachingActivity" />
|
||||||
|
@ -55,21 +55,26 @@
|
||||||
|
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="${predicateUri == researchActivityUri}">
|
<c:when test="${predicateUri == researchActivityUri}">
|
||||||
<c:set var="inverseUri" value="${vivoCore}researchActivityBy" scope="page" />
|
<c:set var="inverseUri" value="${vivoCore}researchActivityBy" />
|
||||||
|
<c:set var="activityClass" value="${vivoCore}ResearchActivity" />
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:when test="${predicateUri == teachingActivityUri}">
|
<c:when test="${predicateUri == teachingActivityUri}">
|
||||||
<c:set var="inverseUri" value="${vivoCore}teachingActivityBy" scope="page" />
|
<c:set var="inverseUri" value="${vivoCore}teachingActivityBy" />
|
||||||
|
<c:set var="activityClass" value="${vivoCore}TeachingActivity" />
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:when test="${predicateUri == serviceActivityUri}">
|
<c:when test="${predicateUri == serviceActivityUri}">
|
||||||
<c:set var="inverseUri" value="${vivoCore}professionalServiceActivityBy" scope="page" />
|
<c:set var="inverseUri" value="${vivoCore}professionalServiceActivityBy" />
|
||||||
|
<c:set var="activityClass" value="${vivoCore}ServiceActivity" />
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:when test="${predicateUri == outreachActivityUri}">
|
<c:when test="${predicateUri == outreachActivityUri}">
|
||||||
<c:set var="inverseUri" value="${vivoCore}outreachActivityBy" scope="page" />
|
<c:set var="inverseUri" value="${vivoCore}outreachActivityBy" />
|
||||||
|
<c:set var="activityClass" value="${vivoCore}OutreachActivity" />
|
||||||
</c:when>
|
</c:when>
|
||||||
</c:choose>
|
</c:choose>
|
||||||
|
|
||||||
<c:set var="activityUri" value="${vivoCore}hasActivity" />
|
<c:set var="activitySuperClass" value="${vivoCore}Activity" />
|
||||||
<c:set var="inverseActivityUri" value="${vivoCore}activityBy" />
|
<c:set var="superPropertyUri" value="${vivoCore}hasActivity" />
|
||||||
|
<c:set var="inverseSuperPropertyUri" value="${vivoCore}activityBy" />
|
||||||
|
|
||||||
<%-- Then enter a SPARQL query for each field, by convention concatenating the field id with "Existing"
|
<%-- Then enter a SPARQL query for each field, by convention concatenating the field id with "Existing"
|
||||||
to convey that the expression is used to retrieve any existing value for the field in an existing individual.
|
to convey that the expression is used to retrieve any existing value for the field in an existing individual.
|
||||||
|
@ -77,14 +82,14 @@
|
||||||
and in the literalsOnForm --%>
|
and in the literalsOnForm --%>
|
||||||
<v:jsonset var="labelExisting" >
|
<v:jsonset var="labelExisting" >
|
||||||
SELECT ?existingLabel WHERE {
|
SELECT ?existingLabel WHERE {
|
||||||
?activityUri <${label}> ?existingLabel }
|
?activityUri <${labelUri}> ?existingLabel }
|
||||||
</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="labelAssertion" >
|
<v:jsonset var="labelAssertion" >
|
||||||
?activityUri <${label}> ?label .
|
?activityUri <${labelUri}> ?label .
|
||||||
</v:jsonset>
|
</v:jsonset>
|
||||||
|
|
||||||
<c:set var="descriptionUri" value="${vivoCore}description" />
|
<c:set var="descriptionUri" value="${vivoCore}description" />
|
||||||
|
@ -125,16 +130,16 @@
|
||||||
|
|
||||||
<v:jsonset var="n3ForStmtToPerson">
|
<v:jsonset var="n3ForStmtToPerson">
|
||||||
|
|
||||||
?activityUri <${label}> ?label ;
|
?activityUri <${labelUri}> ?label ;
|
||||||
a <${predicateUri}> ;
|
a <${activityClass}> ;
|
||||||
a <${activityUri} ;
|
a <${activitySuperClass}> ;
|
||||||
a <${flagUri} ;
|
a <${flagUri}> ;
|
||||||
<${inverseUri}> ?person ;
|
<${inverseUri}> ?person ;
|
||||||
<${inverseActivityUri}> ?person .
|
<${inverseSuperPropertyUri}> ?person .
|
||||||
|
|
||||||
?person <${predicateUri}> ?activityUri ;
|
?person <${predicateUri}> ?activityUri ;
|
||||||
<${activityUri}> ?activityUri .
|
<${superPropertyUri}> ?activityUri .
|
||||||
s
|
|
||||||
</v:jsonset>
|
</v:jsonset>
|
||||||
|
|
||||||
<c:set var="editjson" scope="request">
|
<c:set var="editjson" scope="request">
|
||||||
|
@ -155,13 +160,13 @@
|
||||||
|
|
||||||
"urisInScope" : { },
|
"urisInScope" : { },
|
||||||
"literalsInScope": { },
|
"literalsInScope": { },
|
||||||
"urisOnForm" : [ "activityUri"],
|
"urisOnForm" : [ ],
|
||||||
"literalsOnForm" : [ "name", "description", "role", "startYearMonth", "endYearMonth" ],
|
"literalsOnForm" : [ "label", "description", "role", "startYearMonth", "endYearMonth" ],
|
||||||
"filesOnForm" : [ ],
|
"filesOnForm" : [ ],
|
||||||
"sparqlForLiterals" : { },
|
"sparqlForLiterals" : { },
|
||||||
"sparqlForUris" : { },
|
"sparqlForUris" : { },
|
||||||
"sparqlForExistingLiterals" : {
|
"sparqlForExistingLiterals" : {
|
||||||
"name" : "${labelExisting}",
|
"label" : "${labelExisting}",
|
||||||
"description" : "${descriptionExisting}",
|
"description" : "${descriptionExisting}",
|
||||||
"role" : "${roleExisting}",
|
"role" : "${roleExisting}",
|
||||||
"startYearMonth" : "${startYearMonthExisting}",
|
"startYearMonth" : "${startYearMonthExisting}",
|
||||||
|
@ -170,7 +175,7 @@
|
||||||
"sparqlForExistingUris" : { },
|
"sparqlForExistingUris" : { },
|
||||||
|
|
||||||
"fields" : {
|
"fields" : {
|
||||||
"name" : {
|
"label" : {
|
||||||
"newResource" : "false",
|
"newResource" : "false",
|
||||||
"validators" : [ "nonempty" ],
|
"validators" : [ "nonempty" ],
|
||||||
"optionsType" : "UNDEFINED",
|
"optionsType" : "UNDEFINED",
|
||||||
|
@ -201,7 +206,7 @@
|
||||||
"objectClassUri" : "",
|
"objectClassUri" : "",
|
||||||
"rangeDatatypeUri" : "${stringDatatypeUriJson}",
|
"rangeDatatypeUri" : "${stringDatatypeUriJson}",
|
||||||
"rangeLang" : "",
|
"rangeLang" : "",
|
||||||
"assertions" : [ "${descriptionAssertion}" ]
|
"assertions" : [ "${roleAssertion}" ]
|
||||||
},
|
},
|
||||||
"startYearMonth" : {
|
"startYearMonth" : {
|
||||||
"newResource" : "false",
|
"newResource" : "false",
|
||||||
|
@ -248,6 +253,7 @@
|
||||||
String subjectName = ((Individual) request.getAttribute("subject")).getName();
|
String subjectName = ((Individual) request.getAttribute("subject")).getName();
|
||||||
%>
|
%>
|
||||||
<c:set var="subjectName" value="<%= subjectName %>" />
|
<c:set var="subjectName" value="<%= subjectName %>" />
|
||||||
|
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="${predicateUri == researchActivityUri}">
|
<c:when test="${predicateUri == researchActivityUri}">
|
||||||
<c:set var="propertyName" value="research focus and activity" scope="request" />
|
<c:set var="propertyName" value="research focus and activity" scope="request" />
|
||||||
|
@ -294,7 +300,7 @@
|
||||||
<form action="<c:url value="/edit/processRdfForm2.jsp"/>" >
|
<form action="<c:url value="/edit/processRdfForm2.jsp"/>" >
|
||||||
|
|
||||||
<v:input type="text" label="Name ${requiredHint}" id="label" size="30" />
|
<v:input type="text" label="Name ${requiredHint}" id="label" size="30" />
|
||||||
<v:input type="textarea" label="Description ${requiredHint}" id="description" rows="5" cols="30" />
|
<v:input type="textarea" label="Description ${requiredHint}" id="description" rows="5" cols="20" />
|
||||||
<v:input type="text" label="Role ${requiredHint}" id="role" size="30" />
|
<v:input type="text" label="Role ${requiredHint}" id="role" size="30" />
|
||||||
|
|
||||||
<v:input type="text" label="Start Year and Month ${yearMonthHint}" id="startYearMonth" size="7"/>
|
<v:input type="text" label="Start Year and Month ${yearMonthHint}" id="startYearMonth" size="7"/>
|
||||||
|
|
Loading…
Add table
Reference in a new issue