NIHVIVO-646 Slight change to implementation of existing author filter on autocomplete
This commit is contained in:
parent
9d045bc98b
commit
1e127abac1
2 changed files with 12 additions and 8 deletions
|
@ -24,6 +24,7 @@ core:authorInAuthorship (Person : Authorship) - inverse of linkedAuthor
|
||||||
<%@ page import="java.util.ArrayList" %>
|
<%@ page import="java.util.ArrayList" %>
|
||||||
<%@ page import="java.util.Arrays" %>
|
<%@ page import="java.util.Arrays" %>
|
||||||
<%@ page import="java.util.Collections" %>
|
<%@ page import="java.util.Collections" %>
|
||||||
|
<%@ page import="java.net.URLEncoder" %>
|
||||||
|
|
||||||
<%@ page import="com.hp.hpl.jena.rdf.model.Model" %>
|
<%@ page import="com.hp.hpl.jena.rdf.model.Model" %>
|
||||||
<%@ page import="com.hp.hpl.jena.vocabulary.XSD" %>
|
<%@ page import="com.hp.hpl.jena.vocabulary.XSD" %>
|
||||||
|
@ -287,13 +288,15 @@ SPARQL queries for existing values. --%>
|
||||||
Individual author = authorship.getRelatedIndividual(linkedAuthorProperty);
|
Individual author = authorship.getRelatedIndividual(linkedAuthorProperty);
|
||||||
if ( author != null ) {
|
if ( author != null ) {
|
||||||
request.setAttribute("author", author);
|
request.setAttribute("author", author);
|
||||||
|
// Doesn't seem to need urlencoding to add as id attribute value
|
||||||
|
//request.setAttribute("authorUri", URLEncoder.encode(author.getURI(), "UTF-8"));
|
||||||
|
request.setAttribute("authorUri", author.getURI());
|
||||||
%>
|
%>
|
||||||
<c:url var="authorHref" value="/individual">
|
<c:url var="authorHref" value="/individual">
|
||||||
<c:param name="uri" value="${author.URI}"/>
|
<c:param name="uri" value="${authorUri}"/>
|
||||||
</c:url>
|
</c:url>
|
||||||
<li>
|
<li>
|
||||||
<span class="existingAuthorUri">${author.URI}</span>
|
<a id="${authorUri}" href="${authorHref}" class="existingAuthor">${author.name}</a>
|
||||||
<a href="${authorHref}" class="existingAuthor">${author.name}</a>
|
|
||||||
<a href="" class="remove">Remove</a>
|
<a href="" class="remove">Remove</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
@ -302,7 +305,7 @@ SPARQL queries for existing values. --%>
|
||||||
|
|
||||||
}
|
}
|
||||||
// A new author will be ranked last when added.
|
// A new author will be ranked last when added.
|
||||||
// This doesn'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);
|
||||||
vreq.setAttribute("rank", rank + 1);
|
vreq.setAttribute("rank", rank + 1);
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ var addAuthorForm = {
|
||||||
var cache = {};
|
var cache = {};
|
||||||
var url = $('#acUrl').val();
|
var url = $('#acUrl').val();
|
||||||
var existingAuthorUris = addAuthorForm.getExistingAuthorUris();
|
var existingAuthorUris = addAuthorForm.getExistingAuthorUris();
|
||||||
|
|
||||||
jQuery.each(existingAuthorUris, function(index, element) {
|
jQuery.each(existingAuthorUris, function(index, element) {
|
||||||
url += '&filter=' + element;
|
url += '&filter=' + element;
|
||||||
});
|
});
|
||||||
|
@ -208,9 +208,10 @@ var addAuthorForm = {
|
||||||
},
|
},
|
||||||
|
|
||||||
getExistingAuthorUris: function() {
|
getExistingAuthorUris: function() {
|
||||||
var authorUris = $('span.existingAuthorUri');
|
|
||||||
return authorUris.map(function() {
|
var existingAuthors = $('#authors .existingAuthor');
|
||||||
return $(this).html();
|
return existingAuthors.map(function() {
|
||||||
|
return $(this).attr('id');
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue