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"/>
</rdf:Description>
<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:inPropertyGroupAnnot rdf:resource="http://vivoweb.org/ontology#vitroPropertyGroupbibliographic"/>
<vitro:forceStubDeletionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</vitro:forceStubDeletionAnnot>

View file

@ -314,47 +314,59 @@ SPARQL queries for existing values. --%>
// Individual authorship = stmt.getObject();
for ( Individual authorship : authorships ) {
Individual author = authorship.getRelatedIndividual(vivoCore + "linkedAuthor");
if ( author != null ) {
authorshipCount++;
String rankValue = "";
DataPropertyStatement rankStmt = authorship.getDataPropertyStatement(rankPredicateUri);
if (rankStmt != null) {
rankValue = rankStmt.getData();
maxRank = Integer.valueOf(rankValue);
String rankDatatypeUri = rankStmt.getDatatypeURI();
if ( !StringUtils.isEmpty(rankDatatypeUri) ) {
rankValue += "_" + rankDatatypeUri;
}
}
request.setAttribute("rankValue", rankValue);
request.setAttribute("authorName", author.getName());
request.setAttribute("authorUri", author.getURI());
request.setAttribute("authorshipUri", authorship.getURI());
authorshipCount++;
// 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.
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" />
request.setAttribute("authorshipUri", authorship.getURI());
request.setAttribute("authorshipName", authorship.getName());
<li class="authorship" id="${authorshipUri}">
<span class="rank" id="${rankValue}"></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>
String rankValue = "";
DataPropertyStatement rankStmt = authorship.getDataPropertyStatement(rankPredicateUri);
if (rankStmt != null) {
rankValue = rankStmt.getData();
maxRank = Integer.valueOf(rankValue);
String rankDatatypeUri = rankStmt.getDatatypeURI();
if ( !StringUtils.isEmpty(rankDatatypeUri) ) {
rankValue += "_" + rankDatatypeUri;
}
}
request.setAttribute("rankValue", rankValue);
Individual author = authorship.getRelatedIndividual(vivoCore + "linkedAuthor");
if ( author != null ) {
request.setAttribute("author", author);
}
// 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.
request.setAttribute("position", authorshipCount);
%>
<li class="authorship" id="${authorshipUri}">
<span class="rank" id="${rankValue}"></span>
<span class="position" id="${position}"></span>
<%-- 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 href="${undoHref}" class="undo">Undo</a> --%>
</span>
</li>
<%
}
// A new author will be ranked last when added.
// This wouldn't handle gaps in the ranking: vreq.setAttribute("rank", authorships.size()+1);
request.setAttribute("newRank", maxRank + 1);
@ -363,11 +375,10 @@ SPARQL queries for existing values. --%>
</ul>
<%
if (authorshipCount == 0) {
%><p>This publication currently has no authors specified.</p><%
}
%>
<% if (authorshipCount == 0) { %>
<p>This publication currently has no authors specified.</p>
<% } %>
<div id="showAddForm">
<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;
}
#authorships a.authorLink.noAuthor {
width: auto;
}
#showAddForm span.or {
display: none;
}