diff --git a/productMods/edit/forms/addAuthorsToInformationResource.jsp b/productMods/edit/forms/addAuthorsToInformationResource.jsp index 17534692..0e857ec2 100644 --- a/productMods/edit/forms/addAuthorsToInformationResource.jsp +++ b/productMods/edit/forms/addAuthorsToInformationResource.jsp @@ -5,7 +5,7 @@ Classes: core:InformationResource - the information resource being edited core:Authorship - primary new individual being created -foaf:Person - new or existing individual +foaf:Person - new or existing individual being linked to Data properties of Authorship: core:authorRank @@ -31,6 +31,7 @@ core:authorInAuthorship (Person : Authorship) - inverse of linkedAuthor <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyComparator" %> +<%-- <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.EntityMergedPropertyListController.PropertyRanker" %> --%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> @@ -256,8 +257,6 @@ SPARQL queries for existing values. --%> Individual infoResource = vreq.getWebappDaoFactory().getIndividualDao().getIndividualByURI(subjectUri); List authorships = infoResource.getRelatedIndividuals(predicateUri); String rankPredicateUri = "http://vivoweb.org/ontology/core#authorRank"; - DataPropertyComparator comp = new DataPropertyComparator(rankPredicateUri); - Collections.sort(authorships, comp); vreq.setAttribute("infoResourceName", infoResource.getName()); @@ -299,59 +298,65 @@ SPARQL queries for existing values. --%>

${title}

diff --git a/productMods/edit/forms/js/addAuthorsToInformationResource.js b/productMods/edit/forms/js/addAuthorsToInformationResource.js index 2b7e3059..84da6576 100644 --- a/productMods/edit/forms/js/addAuthorsToInformationResource.js +++ b/productMods/edit/forms/js/addAuthorsToInformationResource.js @@ -265,16 +265,19 @@ var addAuthorForm = { oldRankForN3, rankVals; - rankVals = oldRankVal.split('_'); // e.g., 1_http://www.w3.org/2001/XMLSchema#int - oldRank = rankVals[0]; - oldRankType = rankVals[1]; - oldRankForN3 = addAuthorForm.makeRankDataPropVal(oldRank, oldRankType); + if (oldRankVal) { + // e.g., 1_http://www.w3.org/2001/XMLSchema#int + // We handle typeless values formatted as either "1" or "1_". + rankVals = oldRankVal.split('_'); + oldRank = rankVals[0]; + oldRankType = rankVals.length > 1 ? rankVals[1] : ''; + oldRankForN3 = addAuthorForm.makeRankDataPropVal(oldRank, oldRankType); + retractions += subjectUri + ' ' + predicateUri + ' ' + oldRankForN3 + ' .'; + } - newRankForN3 = addAuthorForm.makeRankDataPropVal(newRank, rankXsdType); - + newRankForN3 = addAuthorForm.makeRankDataPropVal(newRank, rankXsdType); additions += subjectUri + ' ' + predicateUri + ' ' + newRankForN3 + ' .'; - retractions += subjectUri + ' ' + predicateUri + ' ' + oldRankForN3 + ' .'; - + // This data will be used to modify the page after successful completion // of the Ajax request. authorship = {