NIHVIVO-144 Add edit/delete links to primary and additional links on front end individual page. (These links generate errors when clicked, though.)
This commit is contained in:
parent
7f3ba68290
commit
53ac7a2587
5 changed files with 140 additions and 141 deletions
|
@ -8,8 +8,6 @@ import java.util.Comparator;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.EntityController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a class representing a particular instance of an object property
|
* a class representing a particular instance of an object property
|
||||||
*
|
*
|
||||||
|
@ -40,7 +38,15 @@ sunset
|
||||||
qualifier
|
qualifier
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public ObjectPropertyStatementImpl() { }
|
||||||
|
|
||||||
|
public ObjectPropertyStatementImpl(String subjectUri, String propertyUri, String objectUri) {
|
||||||
|
subjectURI = subjectUri;
|
||||||
|
propertyURI = propertyUri;
|
||||||
|
objectURI = objectUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
* @see edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement#toString()
|
* @see edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement#toString()
|
||||||
*/
|
*/
|
||||||
public String toString(){
|
public String toString(){
|
||||||
|
|
|
@ -12,7 +12,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
|
||||||
public class FrontEndEditingUtils {
|
public class FrontEndEditingUtils {
|
||||||
|
|
||||||
public static final List<String> VITRO_NS_DATAPROPS = Arrays.asList(VitroVocabulary.BLURB,
|
public static final List<String> VITRO_NS_DATA_PROPS = Arrays.asList(VitroVocabulary.BLURB,
|
||||||
VitroVocabulary.CITATION,
|
VitroVocabulary.CITATION,
|
||||||
VitroVocabulary.DESCRIPTION,
|
VitroVocabulary.DESCRIPTION,
|
||||||
VitroVocabulary.IMAGETHUMB,
|
VitroVocabulary.IMAGETHUMB,
|
||||||
|
|
|
@ -41,9 +41,11 @@ import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatementImpl;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSP tag to generate the HTML of links for edit, delete or
|
* JSP tag to generate the HTML of links for edit, delete or
|
||||||
|
@ -118,15 +120,19 @@ public class PropertyEditLinks extends TagSupport{
|
||||||
if( item instanceof ObjectPropertyStatement ){
|
if( item instanceof ObjectPropertyStatement ){
|
||||||
ObjectPropertyStatement prop = (ObjectPropertyStatement)item;
|
ObjectPropertyStatement prop = (ObjectPropertyStatement)item;
|
||||||
links = doObjPropStmt( prop, policyToAccess(ids, policy, prop), contextPath );
|
links = doObjPropStmt( prop, policyToAccess(ids, policy, prop), contextPath );
|
||||||
|
|
||||||
} else if( item instanceof DataPropertyStatement ){
|
} else if( item instanceof DataPropertyStatement ){
|
||||||
DataPropertyStatement prop = (DataPropertyStatement)item;
|
DataPropertyStatement prop = (DataPropertyStatement)item;
|
||||||
links = doDataPropStmt( prop, policyToAccess(ids, policy, prop), contextPath );
|
links = doDataPropStmt( prop, policyToAccess(ids, policy, prop), contextPath );
|
||||||
|
|
||||||
} else if (entity == null) {
|
} else if (entity == null) {
|
||||||
log.error("unable to find an Individual in request using var name 'entity'");
|
log.error("unable to find an Individual in request using var name 'entity'");
|
||||||
return SKIP_BODY;
|
return SKIP_BODY;
|
||||||
|
|
||||||
} else if( item instanceof ObjectProperty ){
|
} else if( item instanceof ObjectProperty ){
|
||||||
ObjectProperty prop = (ObjectProperty)item;
|
ObjectProperty prop = (ObjectProperty)item;
|
||||||
links = doObjProp( prop, entity, policyToAccess(ids, policy, entity.getURI(), prop), contextPath );
|
links = doObjProp( prop, entity, policyToAccess(ids, policy, entity.getURI(), prop), contextPath );
|
||||||
|
|
||||||
} else if( item instanceof DataProperty ){
|
} else if( item instanceof DataProperty ){
|
||||||
DataProperty prop = (DataProperty)item; // a DataProperty populated for this subject individual
|
DataProperty prop = (DataProperty)item; // a DataProperty populated for this subject individual
|
||||||
links = doDataProp( prop, entity, policyToAccess(ids, policy, entity.getURI(), prop),contextPath );
|
links = doDataProp( prop, entity, policyToAccess(ids, policy, entity.getURI(), prop),contextPath );
|
||||||
|
@ -142,12 +148,15 @@ public class PropertyEditLinks extends TagSupport{
|
||||||
DataPropertyStatement dps = (DataPropertyStatement) new DataPropertyStatementImpl(subjectUri, predicateUri, data);
|
DataPropertyStatement dps = (DataPropertyStatement) new DataPropertyStatementImpl(subjectUri, predicateUri, data);
|
||||||
links = doVitroNsDataPropStmt( dps, entity, policyToAccess(ids, policy, dps), contextPath );
|
links = doVitroNsDataPropStmt( dps, entity, policyToAccess(ids, policy, dps), contextPath );
|
||||||
}
|
}
|
||||||
} else if (isVitroNsObjectProp(predicateUri)) {
|
} else if (isVitroNsObjProp(predicateUri)) {
|
||||||
if (data == null) { // link to add a new value
|
if (data == null) { // link to add a new value
|
||||||
links = doObjProp( subjectUri, predicateUri, policyToAccess(ids, policy, subjectUri, predicateUri), contextPath );
|
links = doObjProp( subjectUri, predicateUri, policyToAccess(ids, policy, subjectUri, predicateUri), contextPath );
|
||||||
} else { // links to edit or delete an existing value
|
} else { // links to edit or delete an existing value
|
||||||
DataPropertyStatement dps = (DataPropertyStatement) new DataPropertyStatementImpl(subjectUri, predicateUri, data);
|
// RY **** May need new policyToAccess which gets the specific obj prop statement using the data as well as subject and predicate
|
||||||
//links = doVitroNsObjPropStmt( dps, entity, policyToAccess(ids, policy, dps), contextPath );
|
// This is NOT the correct object property statement - we need the link individual uri in data, instead of the link URL
|
||||||
|
// Then we can combine this with doObjPropStmt
|
||||||
|
ObjectPropertyStatement prop = new ObjectPropertyStatementImpl(subjectUri, predicateUri, data);
|
||||||
|
links = doVitroNsObjPropStmt( subjectUri, predicateUri, data, policyToAccess(ids, policy, prop), contextPath );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -246,7 +255,6 @@ public class PropertyEditLinks extends TagSupport{
|
||||||
return links;
|
return links;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used for ontology object properties
|
|
||||||
protected LinkStruct[] doObjProp(ObjectProperty oprop, Individual entity, EditLinkAccess[] allowedAccessTypeArray, String contextPath) {
|
protected LinkStruct[] doObjProp(ObjectProperty oprop, Individual entity, EditLinkAccess[] allowedAccessTypeArray, String contextPath) {
|
||||||
if( allowedAccessTypeArray == null || oprop == null || allowedAccessTypeArray.length == 0 ) {
|
if( allowedAccessTypeArray == null || oprop == null || allowedAccessTypeArray.length == 0 ) {
|
||||||
log.debug("null or empty access type array in doObjProp for oprop "+oprop.getDomainPublic()+"; most likely just a property prohibited from editing");
|
log.debug("null or empty access type array in doObjProp for oprop "+oprop.getDomainPublic()+"; most likely just a property prohibited from editing");
|
||||||
|
@ -256,7 +264,6 @@ public class PropertyEditLinks extends TagSupport{
|
||||||
return doObjProp(entity.getURI(), oprop.getURI(), allowedAccessTypeArray, contextPath);
|
return doObjProp(entity.getURI(), oprop.getURI(), allowedAccessTypeArray, contextPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used for Vitro namespace object properties
|
|
||||||
protected LinkStruct[] doObjProp(String subjectUri, String predicateUri, EditLinkAccess[] allowedAccessTypeArray, String contextPath) {
|
protected LinkStruct[] doObjProp(String subjectUri, String predicateUri, EditLinkAccess[] allowedAccessTypeArray, String contextPath) {
|
||||||
if( allowedAccessTypeArray == null || subjectUri == null || allowedAccessTypeArray.length == 0 ) {
|
if( allowedAccessTypeArray == null || subjectUri == null || allowedAccessTypeArray.length == 0 ) {
|
||||||
log.debug("null or empty access type array in doObjProp for oprop "+ predicateUri +"; most likely just a property prohibited from editing");
|
log.debug("null or empty access type array in doObjProp for oprop "+ predicateUri +"; most likely just a property prohibited from editing");
|
||||||
|
@ -265,14 +272,13 @@ public class PropertyEditLinks extends TagSupport{
|
||||||
LinkStruct[] links = new LinkStruct[1];
|
LinkStruct[] links = new LinkStruct[1];
|
||||||
|
|
||||||
if( contains( allowedAccessTypeArray, EditLinkAccess.ADDNEW )){
|
if( contains( allowedAccessTypeArray, EditLinkAccess.ADDNEW )){
|
||||||
|
|
||||||
String url= makeRelativeHref(contextPath + "edit/editRequestDispatch.jsp",
|
String url= makeRelativeHref(contextPath + "edit/editRequestDispatch.jsp",
|
||||||
"subjectUri", subjectUri,
|
"subjectUri", subjectUri,
|
||||||
"predicateUri", predicateUri);
|
"predicateUri", predicateUri);
|
||||||
LinkStruct ls = new LinkStruct();
|
LinkStruct ls = new LinkStruct();
|
||||||
ls.setHref( url );
|
ls.setHref( url );
|
||||||
ls.setType("add");
|
ls.setType("add");
|
||||||
ls.setMouseoverText("add relationship");
|
ls.setMouseoverText("add " + getObjPropMouseoverLabel(predicateUri));
|
||||||
links[0]=ls;
|
links[0]=ls;
|
||||||
}
|
}
|
||||||
return links;
|
return links;
|
||||||
|
@ -416,99 +422,73 @@ public class PropertyEditLinks extends TagSupport{
|
||||||
log.info("null or empty access type array in doObjPropStmt for "+opropStmt.getPropertyURI());
|
log.info("null or empty access type array in doObjPropStmt for "+opropStmt.getPropertyURI());
|
||||||
return empty_array;
|
return empty_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String subjectUri = opropStmt.getSubjectURI();
|
||||||
|
String predicateUri = opropStmt.getPropertyURI();
|
||||||
|
String objectUri = opropStmt.getObjectURI();
|
||||||
|
String mouseoverLabel = "relationship";
|
||||||
|
|
||||||
|
return doObjPropStmt(subjectUri, predicateUri, objectUri, allowedAccessTypeArray, contextPath, mouseoverLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected LinkStruct[] doVitroNsObjPropStmt(String subjectUri, String predicateUri, String objectUri, EditLinkAccess[] allowedAccessTypeArray, String contextPath) {
|
||||||
|
if( allowedAccessTypeArray == null || subjectUri == null || allowedAccessTypeArray.length == 0 ) {
|
||||||
|
log.info("null or empty access type array in doObjPropStmt for " + predicateUri);
|
||||||
|
return empty_array;
|
||||||
|
}
|
||||||
|
|
||||||
|
Model model = (Model)pageContext.getServletContext().getAttribute("jenaOntModel");
|
||||||
|
|
||||||
|
String mouseoverLabel = getObjPropMouseoverLabel(predicateUri);
|
||||||
|
return doObjPropStmt(subjectUri, predicateUri, objectUri, allowedAccessTypeArray, contextPath, mouseoverLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected LinkStruct[] doObjPropStmt(String subjectUri, String predicateUri, String objectUri, EditLinkAccess[] allowedAccessTypeArray, String contextPath, String mouseoverLabel) {
|
||||||
|
|
||||||
LinkStruct[] links = new LinkStruct[2];
|
LinkStruct[] links = new LinkStruct[2];
|
||||||
int index=0;
|
int index=0;
|
||||||
|
|
||||||
if( contains( allowedAccessTypeArray, EditLinkAccess.MODIFY ) ){
|
if( contains( allowedAccessTypeArray, EditLinkAccess.MODIFY ) ){
|
||||||
log.debug("permission found to UPDATE object property statement "+opropStmt.getPropertyURI()+" so icon created");
|
log.debug("permission found to UPDATE object property statement "+ predicateUri +" so icon created");
|
||||||
String url = ( contains( allowedAccessTypeArray, EditLinkAccess.DELETE ) )
|
String url = ( contains( allowedAccessTypeArray, EditLinkAccess.DELETE ) )
|
||||||
? makeRelativeHref(contextPath + "edit/editRequestDispatch.jsp",
|
? makeRelativeHref(contextPath + "edit/editRequestDispatch.jsp",
|
||||||
"subjectUri", opropStmt.getSubjectURI(),
|
"subjectUri", subjectUri,
|
||||||
"predicateUri", opropStmt.getPropertyURI(),
|
"predicateUri", predicateUri,
|
||||||
"objectUri", opropStmt.getObjectURI())
|
"objectUri", objectUri)
|
||||||
: makeRelativeHref(contextPath + "edit/editRequestDispatch.jsp",
|
: makeRelativeHref(contextPath + "edit/editRequestDispatch.jsp",
|
||||||
"subjectUri", opropStmt.getSubjectURI(),
|
"subjectUri", subjectUri,
|
||||||
"predicateUri", opropStmt.getPropertyURI(),
|
"predicateUri", predicateUri,
|
||||||
"objectUri", opropStmt.getObjectURI(),
|
"objectUri", objectUri,
|
||||||
"deleteProhibited", "prohibited");
|
"deleteProhibited", "prohibited");
|
||||||
|
|
||||||
LinkStruct ls = new LinkStruct();
|
LinkStruct ls = new LinkStruct();
|
||||||
ls.setHref( url );
|
ls.setHref( url );
|
||||||
ls.setType("edit");
|
ls.setType("edit");
|
||||||
ls.setMouseoverText("change this relationship");
|
ls.setMouseoverText("change this " + mouseoverLabel);
|
||||||
links[index] = ls; index++;
|
links[index] = ls; index++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log.debug("NO permission to UPDATE this object property statement ("+opropStmt.getPropertyURI()+") found in policy");
|
log.debug("NO permission to UPDATE this object property statement (" + predicateUri + ") found in policy");
|
||||||
}
|
}
|
||||||
if( contains( allowedAccessTypeArray, EditLinkAccess.DELETE ) ){
|
if( contains( allowedAccessTypeArray, EditLinkAccess.DELETE ) ){
|
||||||
log.debug("permission found to DELETE object property statement "+opropStmt.getPropertyURI()+" so icon created");
|
log.debug("permission found to DELETE object property statement "+ predicateUri + " so icon created");
|
||||||
String url = makeRelativeHref(contextPath + "edit/editRequestDispatch.jsp",
|
String url = makeRelativeHref(contextPath + "edit/editRequestDispatch.jsp",
|
||||||
"subjectUri", opropStmt.getSubjectURI(),
|
"subjectUri", subjectUri,
|
||||||
"predicateUri", opropStmt.getPropertyURI(),
|
"predicateUri", predicateUri,
|
||||||
"objectUri", opropStmt.getObjectURI(),
|
"objectUri", objectUri,
|
||||||
"cmd", "delete");
|
"cmd", "delete");
|
||||||
LinkStruct ls = new LinkStruct();
|
LinkStruct ls = new LinkStruct();
|
||||||
ls.setHref( url );
|
ls.setHref( url );
|
||||||
ls.setType("delete");
|
ls.setType("delete");
|
||||||
ls.setMouseoverText("delete this relationship");
|
ls.setMouseoverText("delete this " + mouseoverLabel);
|
||||||
links[index] = ls; index++;
|
links[index] = ls; index++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log.debug("NO permission to DELETE this object property statement ("+opropStmt.getPropertyURI()+") found in policy");
|
log.debug("NO permission to DELETE this object property statement (" + predicateUri + ") found in policy");
|
||||||
}
|
}
|
||||||
return links;
|
return links;
|
||||||
}
|
}
|
||||||
|
|
||||||
// protected LinkStruct[] doObjPropStmt(ObjectPropertyStatement opropStmt, EditLinkAccess[] allowedAccessTypeArray, String contextPath) {
|
|
||||||
// if( allowedAccessTypeArray == null || opropStmt == null || allowedAccessTypeArray.length == 0 ) {
|
|
||||||
// log.info("null or empty access type array in doObjPropStmt for "+opropStmt.getPropertyURI());
|
|
||||||
// return empty_array;
|
|
||||||
// }
|
|
||||||
// LinkStruct[] links = new LinkStruct[2];
|
|
||||||
// int index=0;
|
|
||||||
//
|
|
||||||
// if( contains( allowedAccessTypeArray, EditLinkAccess.MODIFY ) ){
|
|
||||||
// log.debug("permission found to UPDATE object property statement "+opropStmt.getPropertyURI()+" so icon created");
|
|
||||||
// String url = ( contains( allowedAccessTypeArray, EditLinkAccess.DELETE ) )
|
|
||||||
// ? makeRelativeHref(contextPath + "edit/editRequestDispatch.jsp",
|
|
||||||
// "subjectUri", opropStmt.getSubjectURI(),
|
|
||||||
// "predicateUri", opropStmt.getPropertyURI(),
|
|
||||||
// "objectUri", opropStmt.getObjectURI())
|
|
||||||
// : makeRelativeHref(contextPath + "edit/editRequestDispatch.jsp",
|
|
||||||
// "subjectUri", opropStmt.getSubjectURI(),
|
|
||||||
// "predicateUri", opropStmt.getPropertyURI(),
|
|
||||||
// "objectUri", opropStmt.getObjectURI(),
|
|
||||||
// "deleteProhibited", "prohibited");
|
|
||||||
//
|
|
||||||
// LinkStruct ls = new LinkStruct();
|
|
||||||
// ls.setHref( url );
|
|
||||||
// ls.setType("edit");
|
|
||||||
// ls.setMouseoverText("change this relationship");
|
|
||||||
// links[index] = ls; index++;
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// log.debug("NO permission to UPDATE this object property statement ("+opropStmt.getPropertyURI()+") found in policy");
|
|
||||||
// }
|
|
||||||
// if( contains( allowedAccessTypeArray, EditLinkAccess.DELETE ) ){
|
|
||||||
// log.debug("permission found to DELETE object property statement "+opropStmt.getPropertyURI()+" so icon created");
|
|
||||||
// String url = makeRelativeHref(contextPath + "edit/editRequestDispatch.jsp",
|
|
||||||
// "subjectUri", opropStmt.getSubjectURI(),
|
|
||||||
// "predicateUri", opropStmt.getPropertyURI(),
|
|
||||||
// "objectUri", opropStmt.getObjectURI(),
|
|
||||||
// "cmd", "delete");
|
|
||||||
// LinkStruct ls = new LinkStruct();
|
|
||||||
// ls.setHref( url );
|
|
||||||
// ls.setType("delete");
|
|
||||||
// ls.setMouseoverText("delete this relationship");
|
|
||||||
// links[index] = ls; index++;
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// log.debug("NO permission to DELETE this object property statement ("+opropStmt.getPropertyURI()+") found in policy");
|
|
||||||
// }
|
|
||||||
// return links;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
/* ********************* utility methods ********************************* */
|
/* ********************* utility methods ********************************* */
|
||||||
protected static String makeRelativeHref( String baseUrl, String ... queries ) {
|
protected static String makeRelativeHref( String baseUrl, String ... queries ) {
|
||||||
|
@ -678,11 +658,21 @@ public class PropertyEditLinks extends TagSupport{
|
||||||
|
|
||||||
|
|
||||||
private boolean isVitroNsDataProp(String predicateUri) {
|
private boolean isVitroNsDataProp(String predicateUri) {
|
||||||
return FrontEndEditingUtils.VITRO_NS_DATAPROPS.contains(predicateUri);
|
return FrontEndEditingUtils.VITRO_NS_DATA_PROPS.contains(predicateUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isVitroNsObjectProp(String predicateUri) {
|
private boolean isVitroNsObjProp(String predicateUri) {
|
||||||
return FrontEndEditingUtils.VITRO_NS_OBJECT_PROPS.contains(predicateUri);
|
return FrontEndEditingUtils.VITRO_NS_OBJECT_PROPS.contains(predicateUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getObjPropMouseoverLabel(String propertyUri) {
|
||||||
|
String mouseoverText = "relationship"; // default
|
||||||
|
|
||||||
|
if (StringUtils.equalsOneOf(propertyUri, VitroVocabulary.ADDITIONAL_LINK, VitroVocabulary.PRIMARY_LINK)) {
|
||||||
|
mouseoverText = "link";
|
||||||
|
}
|
||||||
|
|
||||||
|
return mouseoverText;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,13 @@
|
||||||
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.edit.forms.defaultLinkForm.jsp");
|
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.edit.forms.defaultLinkForm.jsp");
|
||||||
%>
|
%>
|
||||||
<%
|
<%
|
||||||
String predicateUri = (String)request.getAttribute("predicateUri");
|
VitroRequest vreq = new VitroRequest(request);
|
||||||
|
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
||||||
|
vreq.setAttribute("defaultNamespace", wdf.getDefaultNamespace());
|
||||||
|
|
||||||
|
String propertyUri = (String) request.getAttribute("predicateUri");
|
||||||
|
String objectUri = (String) request.getAttribute("objectUri");
|
||||||
|
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<c:set var="vitroUri" value="<%= VitroVocabulary.vitroURI %>" />
|
<c:set var="vitroUri" value="<%= VitroVocabulary.vitroURI %>" />
|
||||||
|
@ -39,16 +45,14 @@
|
||||||
Each of these must then be referenced in the sparqlForExistingLiterals section of the JSON block below
|
Each of these must then be referenced in the sparqlForExistingLiterals section of the JSON block below
|
||||||
and in the literalsOnForm --%>
|
and in the literalsOnForm --%>
|
||||||
<v:jsonset var="urlExisting" >
|
<v:jsonset var="urlExisting" >
|
||||||
PREFIX vitro: <${vitroUri}> .
|
|
||||||
SELECT ?urlExisting
|
SELECT ?urlExisting
|
||||||
WHERE { ?link vitro:linkURL ?urlExisting }
|
WHERE { ?subject ?predicate ?urlExisting }
|
||||||
</v:jsonset>
|
</v:jsonset>
|
||||||
<%-- Pair the "existing" query with the skeleton of what will be asserted for a new statement involving this field.
|
<%-- Pair the "existing" query with the skeleton of what will be asserted for a new statement involving this field.
|
||||||
The actual assertion inserted in the model will be created via string substitution into the ? variables.
|
The actual assertion inserted in the model will be created via string substitution into the ? variables.
|
||||||
NOTE the pattern of punctuation (a period after the prefix URI and after the ?field) --%>
|
NOTE the pattern of punctuation (a period after the prefix URI and after the ?field) --%>
|
||||||
<v:jsonset var="urlAssertion" >
|
<v:jsonset var="urlAssertion" >
|
||||||
@prefix vitro: <${vitroUri}> .
|
?subject ?predicate ?url .
|
||||||
?link vitro:linkURL ?url .
|
|
||||||
</v:jsonset>
|
</v:jsonset>
|
||||||
|
|
||||||
<v:jsonset var="anchorExisting" >
|
<v:jsonset var="anchorExisting" >
|
||||||
|
@ -68,7 +72,7 @@
|
||||||
@prefix rdf: <${rdfUri}> .
|
@prefix rdf: <${rdfUri}> .
|
||||||
@prefix vitro: <${vitroUri}> .
|
@prefix vitro: <${vitroUri}> .
|
||||||
|
|
||||||
?subject <${predicateUri}> ?link .
|
?subject ?predicate ?link .
|
||||||
|
|
||||||
?link rdf:type vitro:Link .
|
?link rdf:type vitro:Link .
|
||||||
|
|
||||||
|
@ -96,7 +100,7 @@
|
||||||
|
|
||||||
"n3required" : [ "${n3ForEdit}" ],
|
"n3required" : [ "${n3ForEdit}" ],
|
||||||
"n3optional" : [ "${n3Optional}" ],
|
"n3optional" : [ "${n3Optional}" ],
|
||||||
"newResources" : { "link" : "http://vivo.library.cornell.edu/ns/0.1#individual" },
|
"newResources" : { "link" : "${defaultNamespace}" },
|
||||||
"urisInScope" : { },
|
"urisInScope" : { },
|
||||||
"literalsInScope" : { },
|
"literalsInScope" : { },
|
||||||
"urisOnForm" : [ ],
|
"urisOnForm" : [ ],
|
||||||
|
@ -145,7 +149,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
Model model = (Model)application.getAttribute("jenaOntModel");
|
Model model = (Model)application.getAttribute("jenaOntModel");
|
||||||
String objectUri = (String)request.getAttribute("objectUri");
|
|
||||||
if( objectUri != null ){
|
if( objectUri != null ){
|
||||||
editConfig.prepareForObjPropUpdate(model);
|
editConfig.prepareForObjPropUpdate(model);
|
||||||
}else{
|
}else{
|
||||||
|
@ -157,7 +160,7 @@
|
||||||
|
|
||||||
String submitLabel="";
|
String submitLabel="";
|
||||||
String title="";
|
String title="";
|
||||||
String linkType = predicateUri.equals(VitroVocabulary.PRIMARY_LINK) ? "primary" : "additional";
|
String linkType = propertyUri.equals(VitroVocabulary.PRIMARY_LINK) ? "primary" : "additional";
|
||||||
if (objectUri != null) {
|
if (objectUri != null) {
|
||||||
title = "Edit <em>" + linkType + " link</em> for " + subject.getName();
|
title = "Edit <em>" + linkType + " link</em> for " + subject.getName();
|
||||||
submitLabel = "Save changes";
|
submitLabel = "Save changes";
|
||||||
|
@ -173,7 +176,7 @@
|
||||||
<h2><%= title %></h2>
|
<h2><%= title %></h2>
|
||||||
<form action="<c:url value="/edit/processRdfForm2.jsp"/>" >
|
<form action="<c:url value="/edit/processRdfForm2.jsp"/>" >
|
||||||
<v:input type="text" label="URL" id="url" size="70"/>
|
<v:input type="text" label="URL" id="url" size="70"/>
|
||||||
<v:input type="text" label="Link anchor text" id="anchor" size="60"/>
|
<v:input type="text" label="Link anchor text" id="anchor" size="70"/>
|
||||||
<p class="submit"><v:input type="submit" id="submit" value="<%=submitLabel%>" cancel="${param.subjectUri}"/></p>
|
<p class="submit"><v:input type="submit" id="submit" value="<%=submitLabel%>" cancel="${param.subjectUri}"/></p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.templates.entity.entityBasic.jsp");
|
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.templates.entity.entityBasic.jsp");
|
||||||
%>
|
%>
|
||||||
<%
|
<%
|
||||||
log.debug("Starting entityBasic.jsp");
|
log.debug("Starting entityBasic.jsp");
|
||||||
Individual entity = (Individual)request.getAttribute("entity");
|
Individual entity = (Individual)request.getAttribute("entity");
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<c:set var="labelUri" value="http://www.w3.org/2000/01/rdf-schema#label" />
|
<c:set var="labelUri" value="http://www.w3.org/2000/01/rdf-schema#label" />
|
||||||
|
@ -86,13 +86,6 @@ if (VitroRequestPrep.isSelfEditing(request) || LoginFormBean.loggedIn(request, L
|
||||||
<c:set var='portal' value='${currentPortalId}'/>
|
<c:set var='portal' value='${currentPortalId}'/>
|
||||||
<c:set var='portalBean' value='${currentPortal}'/>
|
<c:set var='portalBean' value='${currentPortal}'/>
|
||||||
|
|
||||||
<%-- Using VitroVocabulary constants instead.
|
|
||||||
RY Description not working - FIX
|
|
||||||
<c:set var="labelUri" value="http://www.w3.org/2000/01/rdf-schema#label" />
|
|
||||||
<c:set var="typeUri" value="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" />
|
|
||||||
<c:set var="vitroUri" value="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#" />
|
|
||||||
--%>
|
|
||||||
|
|
||||||
<c:set var='themeDir'><c:out value='${portalBean.themeDir}' /></c:set>
|
<c:set var='themeDir'><c:out value='${portalBean.themeDir}' /></c:set>
|
||||||
|
|
||||||
<div id="content">
|
<div id="content">
|
||||||
|
@ -150,7 +143,7 @@ RY Description not working - FIX
|
||||||
|
|
||||||
<%-- Links --%>
|
<%-- Links --%>
|
||||||
<c:if test="${ showEdits || !empty entity.url || !empty entity.linksList }">
|
<c:if test="${ showEdits || !empty entity.url || !empty entity.linksList }">
|
||||||
<div id="dprop-vitro-urls" class="propsItem ${editingClass}">
|
<div id="dprop-vitro-links" class="propsItem ${editingClass}">
|
||||||
<c:if test="${showEdits}">
|
<c:if test="${showEdits}">
|
||||||
<h3 class="propertyName">links</h3>
|
<h3 class="propertyName">links</h3>
|
||||||
<c:choose>
|
<c:choose>
|
||||||
|
@ -163,42 +156,49 @@ RY Description not working - FIX
|
||||||
</c:choose>
|
</c:choose>
|
||||||
<edLnk:editLinks item="${addUrlPredicate}" icons="false" />
|
<edLnk:editLinks item="${addUrlPredicate}" icons="false" />
|
||||||
</c:if>
|
</c:if>
|
||||||
<div class="datatypeProperties">
|
<ul class="externalLinks properties">
|
||||||
<div class="datatypePropertyValue">
|
<%-- Primary link --%>
|
||||||
<div class="statementWrap">
|
<c:if test="${!empty entity.anchor}">
|
||||||
<ul class="externalLinks">
|
<c:choose>
|
||||||
<c:if test="${!empty entity.anchor}">
|
<c:when test="${!empty entity.url}">
|
||||||
<c:choose>
|
<c:url var="entityUrl" value="${entity.url}" />
|
||||||
<c:when test="${!empty entity.url}">
|
<li class="primary">
|
||||||
<c:url var="entityUrl" value="${entity.url}" />
|
<span class="statementWrap">
|
||||||
<li class="primary"><a class="externalLink" href="<c:out value="${entityUrl}"/>"><p:process>${entity.anchor}</p:process></a></li>
|
<a class="externalLink" href="<c:out value="${entityUrl}"/>"><p:process>${entity.anchor}</p:process></a>
|
||||||
</c:when>
|
<c:if test="${showEdits}">
|
||||||
<c:otherwise>
|
<c:set var="editLinks"><edLnk:editLinks item="<%= VitroVocabulary.PRIMARY_LINK %>" data="${entity.url}" icons="false"/></c:set>
|
||||||
<li class="primary"><span class="externalLink"><p:process>${entity.anchor}</p:process></span></li>
|
<c:if test="${!empty editLinks}"><span class="editLinks">${editLinks}</span></c:if>
|
||||||
</c:otherwise>
|
</c:if>
|
||||||
</c:choose>
|
</span>
|
||||||
<%--
|
</li>
|
||||||
<c:if test="${showEdits}">
|
</c:when>
|
||||||
<c:set var="editLinks"><edLnk:editLinks item="<%= VitroVocabulary.LINK_ANCHOR %>" data="${entity.anchor}" icons="false"/></c:set>
|
<c:otherwise>
|
||||||
<c:if test="${!empty editLinks}"><span class="editLinks">${editLinks}</span></c:if>
|
<%-- RY For now, not providing editing links for anchor text with no url. Should fix. --%>
|
||||||
</c:if>
|
<li class="primary"><span class="externalLink"><p:process>${entity.anchor}</p:process></span></li>
|
||||||
--%>
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
|
<%-- Additional links --%>
|
||||||
|
<c:if test="${!empty entity.linksList }">
|
||||||
|
<c:forEach items="${entity.linksList}" var='link' varStatus="count">
|
||||||
|
<c:url var="linkUrl" value="${link.url}" />
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="${empty entity.url && count.first==true}"><li class="first"></c:when>
|
||||||
|
<c:otherwise><li></c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
<span class="statementWrap">
|
||||||
|
<a class="externalLink" href="<c:out value="${linkUrl}"/>"><p:process>${link.anchor}</p:process></a>
|
||||||
|
<c:if test="${showEdits}">
|
||||||
|
<c:set var="editLinks"><edLnk:editLinks item="<%= VitroVocabulary.ADDITIONAL_LINK %>" data="${linkUrl}" icons="false"/></c:set>
|
||||||
|
<c:if test="${!empty editLinks}"><span class="editLinks">${editLinks}</span></c:if>
|
||||||
</c:if>
|
</c:if>
|
||||||
<c:if test="${!empty entity.linksList }">
|
</span>
|
||||||
<c:forEach items="${entity.linksList}" var='link' varStatus="count">
|
</li>
|
||||||
<c:url var="linkUrl" value="${link.url}" />
|
</c:forEach>
|
||||||
<c:choose>
|
</c:if>
|
||||||
<c:when test="${empty entity.url && count.first==true}"><li class="first"></c:when>
|
</ul>
|
||||||
<c:otherwise><li></c:otherwise>
|
</div> <!-- end dprop-vitro-links -->
|
||||||
</c:choose>
|
|
||||||
<a class="externalLink" href="<c:out value="${linkUrl}"/>"><p:process>${link.anchor}</p:process></a></li>
|
|
||||||
</c:forEach>
|
|
||||||
</c:if>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<%-- Thumbnail (with citation) --%>
|
<%-- Thumbnail (with citation) --%>
|
||||||
|
|
Loading…
Add table
Reference in a new issue