From 59db70e8e098515c62a237fdd22847239fd41c7f Mon Sep 17 00:00:00 2001 From: bdc34 Date: Thu, 22 Jul 2010 00:35:24 +0000 Subject: [PATCH] Merging to Trunk. Changing addPublicationToPerson.jsp to skip form when trying to edit an existing authorship, NIHVIVO-912 --- .../edit/forms/addPublicationToPerson.jsp | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/productMods/edit/forms/addPublicationToPerson.jsp b/productMods/edit/forms/addPublicationToPerson.jsp index 57f1149c..049d11cf 100644 --- a/productMods/edit/forms/addPublicationToPerson.jsp +++ b/productMods/edit/forms/addPublicationToPerson.jsp @@ -23,6 +23,7 @@ core:informationResourceInAuthorship (InformationResource : Authorship) - invers <%@ page import="com.hp.hpl.jena.rdf.model.Model" %> <%@ page import="com.hp.hpl.jena.vocabulary.XSD" %> +<%@page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> @@ -41,6 +42,7 @@ core:informationResourceInAuthorship (InformationResource : Authorship) - invers <%! public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.edit.forms.addAuthorsToInformationResource.jsp"); + public static String nodeToPubProp = "http://vivoweb.org/ontology/core#linkedInformationResource"; %> <% VitroRequest vreq = new VitroRequest(request); @@ -57,7 +59,27 @@ core:informationResourceInAuthorship (InformationResource : Authorship) - invers String intDatatypeUri = XSD.xint.toString(); vreq.setAttribute("intDatatypeUri", intDatatypeUri); vreq.setAttribute("intDatatypeUriJson", MiscWebUtils.escape(intDatatypeUri)); + + Individual subject = (Individual) request.getAttribute("subject"); + Individual obj = (Individual) request.getAttribute("object"); + + //check to see if this is an edit of existing, if yes redirect to pub + if( obj != null ){ + List stmts = obj.getObjectPropertyStatements( nodeToPubProp ); + if( stmts != null && stmts.size() > 0 ){ + ObjectPropertyStatement ops = stmts.get(0); + String pubUri = ops.getObjectURI(); + if( pubUri != null ){ + %> + + + + <% + } + } + } %> +