NIHVIVO-143 Add front end edit links to moniker

This commit is contained in:
rjy7 2010-03-15 20:48:42 +00:00
parent 8ea46821c4
commit 5eb474a891
2 changed files with 40 additions and 29 deletions

View file

@ -304,10 +304,6 @@ public class PropertyEditLinks extends TagSupport{
ls.setMouseoverText("delete this relationship"); ls.setMouseoverText("delete this relationship");
links[index] = ls; index++; links[index] = ls; index++;
// String imgUrl = makeRelativeHref( themeDir + "site_icons/trashcan.gif");
// str += "<a class\"delete image\" href=" + url + " title=\"delete\">" +
// "<img src=" + imgUrl + " alt=\"(delete)\"/></a>\n";
} 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 ("+opropStmt.getPropertyURI()+") found in policy");
} }
@ -329,26 +325,19 @@ public class PropertyEditLinks extends TagSupport{
String dpropHash = String.valueOf(RdfLiteralHash.makeRdfLiteralHash( dpropStmt )); String dpropHash = String.valueOf(RdfLiteralHash.makeRdfLiteralHash( dpropStmt ));
String dispatchUrl = contextPath + "edit/editDatapropStmtRequestDispatch.jsp"; String dispatchUrl = contextPath + "edit/editDatapropStmtRequestDispatch.jsp";
//String propName = getNameFromUri(predicateUri);
//String editForm = "defaultVitroNsPropForm.jsp";
LinkStruct ls = new LinkStruct();
int index = 0; int index = 0;
if ( contains( allowedAccessTypeArray, EditLinkAccess.MODIFY ) ){ if ( contains( allowedAccessTypeArray, EditLinkAccess.MODIFY ) ){
log.debug("Permission found to UPDATE vitro namespace property " + predicateUri); log.debug("Permission found to UPDATE vitro namespace property " + predicateUri);
LinkStruct ls = new LinkStruct();
String url = makeRelativeHref(dispatchUrl, String url = makeRelativeHref(dispatchUrl,
"subjectUri", subjectUri, "subjectUri", subjectUri,
"predicateUri", predicateUri, "predicateUri", predicateUri,
"datapropKey", dpropHash, "datapropKey", dpropHash,
"vitroNsProp", "true"); "vitroNsProp", "true");
// RY If we use a single vitro ns form for all vitro ns props, we won't need the editForm param.
// See if they can reasonably be combined into a single form, then have
// editDatapropStmtRequestDispatch use a default vitro ns form if no custom form is specified.
//"editForm", editForm);
ls.setHref(url); ls.setHref(url);
ls.setType("edit"); ls.setType("edit");
ls.setMouseoverText("edit this property"); ls.setMouseoverText("edit this text");
links[index] = ls; links[index] = ls;
index++; index++;
} }
@ -359,16 +348,16 @@ public class PropertyEditLinks extends TagSupport{
// Name and type can be edited but not deleted // Name and type can be edited but not deleted
if ( !( predicateUri.endsWith("#label") || predicateUri.endsWith("#type") ) ) { if ( !( predicateUri.endsWith("#label") || predicateUri.endsWith("#type") ) ) {
if ( contains( allowedAccessTypeArray, EditLinkAccess.DELETE ) ){ if ( contains( allowedAccessTypeArray, EditLinkAccess.DELETE ) ){
LinkStruct ls = new LinkStruct();
log.debug("Permission found to DELETE vitro namespace property " + predicateUri); log.debug("Permission found to DELETE vitro namespace property " + predicateUri);
String url = makeRelativeHref(dispatchUrl, String url = makeRelativeHref(dispatchUrl,
"subjectUri", subjectUri, "subjectUri", subjectUri,
"predicateUri", predicateUri, "predicateUri", predicateUri,
"datapropKey", dpropHash, "datapropKey", dpropHash,
"vitroNsProp", "true"); "vitroNsProp", "true");
//"editForm", editForm);
ls.setHref(url); ls.setHref(url);
ls.setType("delete"); ls.setType("delete");
ls.setMouseoverText("delete this property"); ls.setMouseoverText("delete this text");
links[index] = ls; links[index] = ls;
index++; index++;
} }

View file

@ -78,9 +78,20 @@ 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}'/>
<c:set var="vitroNsUri" value="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#" />
<c:set var="typeUri" value="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" />
<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" />
<c:set var="typeUri" value="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" />
<c:set var="vitroNsUri" value="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#" />
<c:if test="${showEdits}">
<c:set var="labelEditLinks"><edLnk:editLinks item="${labelUri}" data="${entity.name}" icons="false"/></c:set>
<c:set var="monikerEditLinks"><edLnk:editLinks item="${vitroNsUri}moniker" data="${entity.moniker}" icons="false"/></c:set>
<c:set var="blurbEditLinks"><edLnk:editLinks item="${vitroNsUri}blurb" data="${entity.blurb}" icons="false"/></c:set>
<c:set var="citationEditLinks"><edLnk:editLinks item="${vitroNsUri}citation" data="${entity.citation}" icons="false"/></c:set>
<c:set var="descriptionEditLinks"><edLnk:editLinks item="${vitroNsUri}description" data="${entity.description}" icons="false"/></c:set>
<c:set var="timekeyEditLinks"><edLnk:editLinks item="${vitroNsUri}timekey" data="${entity.timekey}" icons="false"/></c:set>
<c:set var="urlEditLinks"><edLnk:editLinks item="${vitroNsUri}url" data="${entity.url}" icons="false"/></c:set>
<c:set var="anchorEditLinks"><edLnk:editLinks item="${vitroNsUri}anchor" data="${entity.anchor}" icons="false"/></c:set>
</c:if>
<c:set var='themeDir'><c:out value='${portalBean.themeDir}' /></c:set> <c:set var='themeDir'><c:out value='${portalBean.themeDir}' /></c:set>
@ -89,7 +100,7 @@ if (VitroRequestPrep.isSelfEditing(request) || LoginFormBean.loggedIn(request, L
<div class='contents entity'> <div class='contents entity'>
<div id="label"> <div id="labelAndMoniker">
<c:choose> <c:choose>
<c:when test="${!empty relatedSubject}"> <c:when test="${!empty relatedSubject}">
<h2><p:process>${relatingPredicate.domainPublic} for ${relatedSubject.name}</p:process></h2> <h2><p:process>${relatingPredicate.domainPublic} for ${relatedSubject.name}</p:process></h2>
@ -100,18 +111,29 @@ if (VitroRequestPrep.isSelfEditing(request) || LoginFormBean.loggedIn(request, L
<p><a href="${backToSubjectLink}">&larr; return to ${relatedSubject.name}</a></p> <p><a href="${backToSubjectLink}">&larr; return to ${relatedSubject.name}</a></p>
</c:when> </c:when>
<c:otherwise> <c:otherwise>
<div class="vitroNsPropertyValue"> <div class="vitroNsPropertyValue" id="label">
<div class="statementWrap"> <div class="statementWrap">
<h2><p:process>${entity.name}</p:process></h2> <h2><p:process>${entity.name}</p:process></h2>
<c:if test="${showEdits}"> <c:if test="${!empty labelEditLinks}">
<c:set var="editLinks"><edLnk:editLinks item="${labelUri}" data="${entity.name}" icons="false"/></c:set> <span class="editLinks">${labelEditLinks}</span>
<c:if test="${!empty editLinks}"><span class="editLinks">${editLinks}</span></c:if>
</c:if> </c:if>
</div> </div>
</div> </div>
<c:if test="${!empty entity.moniker}"> <c:choose>
<c:when test="${!empty entity.moniker}">
<div class="vitroNsPropertyValue" id="moniker">
<div class="statementWrap">
<p:process><em class="moniker">${entity.moniker}</em></p:process> <p:process><em class="moniker">${entity.moniker}</em></p:process>
<c:if test="${!empty monikerEditLinks}">
<span class="editLinks">${monikerEditLinks}</span>
</c:if> </c:if>
</div>
</div>
</c:when>
<c:otherwise>
<%-- Show the add link --%>
</c:otherwise>
</c:choose>
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
</div><!-- entity label --> </div><!-- entity label -->