NIHVIVO-646 Handle authorships with no linked author in add authors to publication form.

This commit is contained in:
rjy7 2010-07-05 20:57:37 +00:00
parent f4948022dd
commit 7ae1a931e4
4 changed files with 81 additions and 42 deletions

View file

@ -3310,6 +3310,7 @@ display level </vitro:publicDescriptionAnnot>
<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"/>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://vivoweb.org/ontology/core#authorInAuthorship"> <rdf:Description rdf:about="http://vivoweb.org/ontology/core#authorInAuthorship">
<vitro:customEntryFormAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">addInformationResourceToAuthor.jsp</vitro:customEntryFormAnnot>
<vitro:offerCreateNewOptionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</vitro:offerCreateNewOptionAnnot> <vitro:offerCreateNewOptionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</vitro:offerCreateNewOptionAnnot>
<vitro:inPropertyGroupAnnot rdf:resource="http://vivoweb.org/ontology#vitroPropertyGroupbibliographic"/> <vitro:inPropertyGroupAnnot rdf:resource="http://vivoweb.org/ontology#vitroPropertyGroupbibliographic"/>
<vitro:forceStubDeletionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</vitro:forceStubDeletionAnnot> <vitro:forceStubDeletionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</vitro:forceStubDeletionAnnot>

View file

@ -314,9 +314,11 @@ SPARQL queries for existing values. --%>
// Individual authorship = stmt.getObject(); // Individual authorship = stmt.getObject();
for ( Individual authorship : authorships ) { for ( Individual authorship : authorships ) {
Individual author = authorship.getRelatedIndividual(vivoCore + "linkedAuthor");
if ( author != null ) {
authorshipCount++; authorshipCount++;
request.setAttribute("authorshipUri", authorship.getURI());
request.setAttribute("authorshipName", authorship.getName());
String rankValue = ""; String rankValue = "";
DataPropertyStatement rankStmt = authorship.getDataPropertyStatement(rankPredicateUri); DataPropertyStatement rankStmt = authorship.getDataPropertyStatement(rankPredicateUri);
if (rankStmt != null) { if (rankStmt != null) {
@ -328,33 +330,43 @@ SPARQL queries for existing values. --%>
} }
} }
request.setAttribute("rankValue", rankValue); request.setAttribute("rankValue", rankValue);
request.setAttribute("authorName", author.getName());
request.setAttribute("authorUri", author.getURI()); Individual author = authorship.getRelatedIndividual(vivoCore + "linkedAuthor");
request.setAttribute("authorshipUri", authorship.getURI()); if ( author != null ) {
request.setAttribute("author", author);
}
// This value is used to replace a moved element after a failed reorder. // This value is used to replace a moved element after a failed reorder.
// It's not the same as rank, because ranks may have gaps. // It's not the same as rank, because ranks may have gaps.
request.setAttribute("position", authorshipCount); request.setAttribute("position", authorshipCount);
%> %>
<c:url var="authorHref" value="/individual">
<c:param name="uri" value="${authorUri}"/>
</c:url>
<c:url var="deleteAuthorshipHref" value="/edit/primitiveDelete" />
<li class="authorship" id="${authorshipUri}"> <li class="authorship" id="${authorshipUri}">
<span class="rank" id="${rankValue}"></span> <span class="rank" id="${rankValue}"></span>
<span class="position" id="${position}"></span> <span class="position" id="${position}"></span>
<%-- This span will be used in the next phase, when we display a message that the author has been
removed. That text will replace the a.authorLink, which will be removed. --%>
<span class="author"><a href="${authorHref}" id="${authorUri}" class="authorLink">${authorName}</a>
<a href="${deleteAuthorshipHref}" class="remove">Remove</a>
<%-- <a href="${undoHref}" class="undo">Undo</a> --%></span>
</li>
<%-- span.author will be used in the next phase, when we display a message that the author has been
removed. That text will replace the a.authorLink, which will be removed. --%>
<span class="author">
<% if (author != null) { // c:choose not working here, don't know why %>
<c:url var="authorHref" value="/individual">
<c:param name="uri" value="${author.URI}"/>
</c:url>
<a href="${authorHref}" id="${author.URI}" class="authorLink">${author.name}</a>
<% } else { %>
<c:url var="authorshipHref" value="/individual">
<c:param name="uri" value="${authorshipUri}"/>
</c:url>
<a href="${authorshipHref}" id="${authorshipUri}" class="authorLink noAuthor">${authorshipName}</a> <em>(no linked author)</em>
<% } %>
<c:url var="deleteAuthorshipHref" value="/edit/primitiveDelete" />
<a href="${deleteAuthorshipHref}" class="remove">Remove</a>
<%-- <a href="${undoHref}" class="undo">Undo</a> --%>
</span>
</li>
<% <%
} }
}
// A new author will be ranked last when added. // A new author will be ranked last when added.
// This wouldn't handle gaps in the ranking: vreq.setAttribute("rank", authorships.size()+1); // This wouldn't handle gaps in the ranking: vreq.setAttribute("rank", authorships.size()+1);
request.setAttribute("newRank", maxRank + 1); request.setAttribute("newRank", maxRank + 1);
@ -363,11 +375,10 @@ SPARQL queries for existing values. --%>
</ul> </ul>
<% <% if (authorshipCount == 0) { %>
if (authorshipCount == 0) { <p>This publication currently has no authors specified.</p>
%><p>This publication currently has no authors specified.</p><% <% } %>
}
%>
<div id="showAddForm"> <div id="showAddForm">
<v:input type="submit" value="Add Author" id="showAddFormButton" cancel="true" cancelLabel="Return to Publication" cancelUrl="/individual" /> <v:input type="submit" value="Add Author" id="showAddFormButton" cancel="true" cancelLabel="Return to Publication" cancelUrl="/individual" />

View file

@ -0,0 +1,23 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%-- Custom form for adding an information resource to an author
Classes:
foaf:Person - the individual being edited
core:Authorship - primary new individual being created
core:InformationResource - new or existing individual being linked to
Data properties of Authorship:
core:authorRank
Object properties (domain : range)
core:informationResourceInAuthorship (InformationResource : Authorship)
core:linkedInformationResource (Authorship : InformationResource) - inverse of informationResourceInAuthorship
core:linkedAuthor (Authorship : Person)
core:authorInAuthorship (Person : Authorship) - inverse of linkedAuthor
--%>
hello world

View file

@ -20,6 +20,10 @@
width: 15em; width: 15em;
} }
#authorships a.authorLink.noAuthor {
width: auto;
}
#showAddForm span.or { #showAddForm span.or {
display: none; display: none;
} }