Change to EditSubmission for blank URIs of new resources

Adding post edit redirect for addPublicationToAuthor.jsp
This commit is contained in:
bdc34 2010-07-12 16:10:15 +00:00
parent 266dfadee0
commit b2dc8f0060
3 changed files with 109 additions and 9 deletions

View file

@ -4259,6 +4259,7 @@ display level </vitro:publicDescriptionAnnot>
<vitro:displayRankAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#int">-1</vitro:displayRankAnnot> <vitro:displayRankAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#int">-1</vitro:displayRankAnnot>
<vitro:hiddenFromDisplayBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/> <vitro:hiddenFromDisplayBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
<vitro:prohibitedFromUpdateBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/> <vitro:prohibitedFromUpdateBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
<vitro:customShortViewAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">grantRoleShortView.jsp</vitro:customShortViewAnnot>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://vivoweb.org/ontology/core"> <rdf:Description rdf:about="http://vivoweb.org/ontology/core">
<vitro:ontologyPrefixAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">core</vitro:ontologyPrefixAnnot> <vitro:ontologyPrefixAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">core</vitro:ontologyPrefixAnnot>

View file

@ -68,11 +68,11 @@ core:informationResourceInAuthorship (InformationResource : Authorship) - invers
SPARQL queries for existing values. --%> SPARQL queries for existing values. --%>
<v:jsonset var="newPubTypeAssertion"> <v:jsonset var="newPubTypeAssertion">
?newPub a ?pubType . ?pubUri a ?pubType .
</v:jsonset> </v:jsonset>
<v:jsonset var="newPubNameAssertion"> <v:jsonset var="newPubNameAssertion">
?newPub <${label}> ?title . ?pubUri <${label}> ?title .
</v:jsonset> </v:jsonset>
<%-- This applies to both a new and an existing publication --%> <%-- This applies to both a new and an existing publication --%>
@ -95,11 +95,11 @@ SPARQL queries for existing values. --%>
<v:jsonset var="n3ForNewPub"> <v:jsonset var="n3ForNewPub">
@prefix core: <${vivoCore}> . @prefix core: <${vivoCore}> .
?newPub a ?pubType ; ?pubUri a ?pubType ;
<${label}> ?title . <${label}> ?title .
?authorshipUri core:linkedInformationResource ?newPub . ?authorshipUri core:linkedInformationResource ?pubUri .
?newPub core:informationResourceInAuthorship ?authorshipUri . ?pubUri core:informationResourceInAuthorship ?authorshipUri .
</v:jsonset> </v:jsonset>
<%-- Must be all one line for JavaScript. Must use ?individual since Javascript will look for that property in the data returned. --%> <%-- Must be all one line for JavaScript. Must use ?individual since Javascript will look for that property in the data returned. --%>
@ -114,7 +114,7 @@ PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:author
{ {
"formUrl" : "${formUrl}", "formUrl" : "${formUrl}",
"editKey" : "${editKey}", "editKey" : "${editKey}",
"urlPatternToReturnTo" : "", // this will be a problem in the case of a new infoResource - we don't have the uri yet "urlPatternToReturnTo" : "/individual",
"subject" : ["person", "${subjectUriJson}" ], "subject" : ["person", "${subjectUriJson}" ],
"predicate" : ["predicate", "${predicateUriJson}" ], "predicate" : ["predicate", "${predicateUriJson}" ],
@ -126,7 +126,7 @@ PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:author
"${newPubNameAssertion}", "${newPubTypeAssertion}" ], "${newPubNameAssertion}", "${newPubTypeAssertion}" ],
"newResources" : { "authorshipUri" : "${defaultNamespace}", "newResources" : { "authorshipUri" : "${defaultNamespace}",
"newPub" : "${defaultNamespace}" }, "pubUri" : "${defaultNamespace}" },
"urisInScope" : { }, "urisInScope" : { },
"literalsInScope": { }, "literalsInScope": { },
@ -161,7 +161,7 @@ PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:author
"assertions" : [ "${newPubTypeAssertion}" ] "assertions" : [ "${newPubTypeAssertion}" ]
}, },
"pubUri" : { "pubUri" : {
"newResource" : "false", "newResource" : "true",
"validators" : [ ], "validators" : [ ],
"optionsType" : "UNDEFINED", "optionsType" : "UNDEFINED",
"literalOptions" : [ ], "literalOptions" : [ ],
@ -189,7 +189,7 @@ PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:author
Model model = (Model) application.getAttribute("jenaOntModel"); Model model = (Model) application.getAttribute("jenaOntModel");
String objectUri = (String) request.getAttribute("objectUri"); String objectUri = (String) request.getAttribute("objectUri");
editConfig.prepareForNonUpdate(model); // we're only adding new, not editing existing editConfig.prepareForNonUpdate(model); // we're only adding new, not editing existing
editConfig.setEntityToReturnTo("?pubUri");
List<String> customJs = new ArrayList<String>(Arrays.asList(JavaScript.JQUERY_UI.path(), List<String> customJs = new ArrayList<String>(Arrays.asList(JavaScript.JQUERY_UI.path(),
JavaScript.UTILS.path(), JavaScript.UTILS.path(),
JavaScript.CUSTOM_FORM_UTILS.path(), JavaScript.CUSTOM_FORM_UTILS.path(),

View file

@ -0,0 +1,99 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://vitro.mannlib.cornell.edu/vitro/tags/StringProcessorTag" prefix="p" %>
<c:set var="personToRolePredicate">http://vivoweb.org/ontology/core#hasCo-PrincipalInvestigatorRole</c:set>
<c:set var="roleActivityToRolePredicate">http://vivoweb.org/ontology/core#roleIn</c:set>
<c:set var="roleActivityLabel">grant</c:set>
<c:choose>
<c:when test="${!empty individual}"><%-- individual is the OBJECT of the property referenced -- the Role individual, not the Person or grant --%>
<%-- c:set var="authorRank" value="${individual.dataPropertyMap['http://vivoweb.org/ontology/core#authorRank'].dataPropertyStatements[0].data}"/ --%>
<c:choose>
<c:when test="${!empty predicateUri}">
<c:choose>
<%-- SUBJECT is a Person, so get info from other part of the role --%>
<c:when test="${predicateUri == personToRolePredicate}">
<c:choose>
<c:when test="${!empty individual.objectPropertyMap['http://vivoweb.org/ontology/core#relatedRole']}">
<c:set var="roleActivity" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#relatedRole'].objectPropertyStatements[0].object}" />
<c:set var="name" value="${roleActivity.name}"/>
<c:set var="moniker" value="${roleActivity.moniker}"/>
<%--<c:set var="year" value="${roleActivity.dataPropertyMap['http://vivoweb.org/ontology/core#year'].dataPropertyStatements[0].data}"/> --%>
<c:set var="label" value="${moniker} ${year}"/>
<c:set var="uri" value="${roleActivity.URI}"/>
</c:when>
<c:otherwise><%-- this Role is not linked to a anything yet; use name as a placeholder and add link to the Role so user can add more information --%>
<c:choose>
<c:when test="${!empty individual.name}">
<c:set var="name" value="${individual.name}"/>
</c:when>
<c:otherwise>
<c:set var="name" value="unlabeled role"/>
</c:otherwise>
</c:choose>
<c:set var="label" >(no ${roleActivityLabel} linked yet)</c:set>
<c:set var="uri" value="${individual.URI}"/>
</c:otherwise>
</c:choose>
</c:when>
<%-- SUBJECT is an activity of some sort, so get info from the Role about the related Person --%>
<c:when test="${predicateUri == roleActivityToRolePredicate}">
<c:choose>
<%-- there is a related Person --%>
<c:when test="${!empty individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedAuthor']}">
<c:set var="author" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedAuthor'].objectPropertyStatements[0].object}" />
<c:set var="name" value="${author.name}"/>
<c:set var="label" value="${author.dataPropertyMap['http://vivoweb.org/ontology/core#preferredTitle'].dataPropertyStatements[0].data}" />
<c:set var="uri" value="${author.URI}"/>
</c:when>
<%-- only an author name has been specified --%>
<c:when test="${!empty individual.dataPropertyMap['http://vivoweb.org/ontology/core#authorNameAsListed'].dataPropertyStatements[0].data}">
<c:set var="name" value="<strong>${individual.dataPropertyMap['http://vivoweb.org/ontology/core#authorNameAsListed'].dataPropertyStatements[0].data}</strong>"/>
</c:when>
<%-- no related Person yet (likely from before custom form available) --%>
<c:otherwise>
<c:choose>
<c:when test="${!empty individual.name}"><c:set var="name" value="${individual.name}"/></c:when>
<c:otherwise><c:set var="name" value="unlabeled authorship"/></c:otherwise>
</c:choose>
<c:set var="label" value="(no author linked yet)"/>
<c:set var="uri" value="${individual.URI}"/>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<c:set var="name" value="unknown predicate"/>
<c:set var="label" value="please contact your VIVO support team"/>
<c:set var="uri" value="${predicateUri}"/>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${!empty uri}">
<c:url var="olink" value="/entity"><c:param name="uri" value="${uri}"/></c:url>
<a href="<c:out value="${olink}"/>"><p:process>${name}</p:process></a> <p:process>${label}</p:process>
</c:when>
<c:otherwise>
<p:process><strong>${name}</strong> ${label}</p:process>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<c:out value="No predicate available for custom rendering ..."/>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<c:out value="Got nothing to draw here ..."/>
</c:otherwise>
</c:choose>