NIHVIVO-1332 Editing link for rdfs:label
This commit is contained in:
parent
d99c66c746
commit
00691d1d40
3 changed files with 23 additions and 18 deletions
|
@ -79,7 +79,8 @@ public class DataPropertyStatementTemplateModel extends PropertyStatementTemplat
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine whether the statement can be deleted
|
// Determine whether the statement can be deleted
|
||||||
if ( ! propertyUri.equals(VitroVocabulary.LABEL)) {
|
// Hack for rdfs:label - the policy doesn't prevent deletion
|
||||||
|
if ( ! propertyUri.equals(VitroVocabulary.LABEL) ) {
|
||||||
action = new DropDataPropStmt(dps);
|
action = new DropDataPropStmt(dps);
|
||||||
if (policyHelper.isAuthorizedAction(action)) {
|
if (policyHelper.isAuthorizedAction(action)) {
|
||||||
markDeletable();
|
markDeletable();
|
||||||
|
@ -105,10 +106,6 @@ public class DataPropertyStatementTemplateModel extends PropertyStatementTemplat
|
||||||
if (! isDeletable()) {
|
if (! isDeletable()) {
|
||||||
params.put("deleteProhibited", "prohibited");
|
params.put("deleteProhibited", "prohibited");
|
||||||
}
|
}
|
||||||
//
|
|
||||||
if (propertyUri.equals(VitroVocabulary.LABEL)) {
|
|
||||||
params.put("vitroNsProp", "true");
|
|
||||||
}
|
|
||||||
editUrl = UrlBuilder.getUrl(EDIT_PATH, params);
|
editUrl = UrlBuilder.getUrl(EDIT_PATH, params);
|
||||||
}
|
}
|
||||||
return editUrl;
|
return editUrl;
|
||||||
|
|
|
@ -175,6 +175,20 @@ public class IndividualTemplateModel extends BaseTemplateModel {
|
||||||
public boolean getShowAdminPanel() {
|
public boolean getShowAdminPanel() {
|
||||||
return loginStatusBean.isLoggedInAtLeast(LoginStatusBean.EDITOR);
|
return loginStatusBean.isLoggedInAtLeast(LoginStatusBean.EDITOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DataPropertyStatementTemplateModel getNameStatement() {
|
||||||
|
String propertyUri = VitroVocabulary.LABEL; // rdfs:label
|
||||||
|
DataPropertyStatementTemplateModel dpstm = new DataPropertyStatementTemplateModel(getUri(), propertyUri, vreq, policyHelper);
|
||||||
|
|
||||||
|
// If the individual has no rdfs:label, return the local name. It will not be editable (this replicates previous behavior;
|
||||||
|
// perhaps we would want to allow a label to be added. But such individuals do not usually have their profiles viewed or
|
||||||
|
// edited directly.
|
||||||
|
if (dpstm.getValue() == null) {
|
||||||
|
dpstm.setValue(getLocalName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return dpstm;
|
||||||
|
}
|
||||||
|
|
||||||
/* These methods simply forward to the methods of the wrapped individual. It would be desirable to
|
/* These methods simply forward to the methods of the wrapped individual. It would be desirable to
|
||||||
* implement a scheme for proxying or delegation so that the methods don't need to be simply listed here.
|
* implement a scheme for proxying or delegation so that the methods don't need to be simply listed here.
|
||||||
|
@ -186,17 +200,7 @@ public class IndividualTemplateModel extends BaseTemplateModel {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return individual.getName();
|
return individual.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataPropertyStatementTemplateModel getNameStatement() {
|
|
||||||
String propertyUri = VitroVocabulary.LABEL; // rdfs:label
|
|
||||||
DataPropertyStatementTemplateModel dpstm = new DataPropertyStatementTemplateModel(getUri(), propertyUri, vreq, policyHelper);
|
|
||||||
// If the individual has no rdfs:label, return the local name. It will correctly not be editable.
|
|
||||||
if (dpstm.getValue() == null) {
|
|
||||||
dpstm.setValue(getLocalName());
|
|
||||||
}
|
|
||||||
return dpstm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMoniker() {
|
public String getMoniker() {
|
||||||
return individual.getMoniker();
|
return individual.getMoniker();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %>
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %>
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Portal" %>
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Portal" %>
|
||||||
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary" %>
|
||||||
<%@ page import="java.util.HashMap" %>
|
<%@ page import="java.util.HashMap" %>
|
||||||
<%@ page import="org.apache.commons.logging.Log" %>
|
<%@ page import="org.apache.commons.logging.Log" %>
|
||||||
<%@ page import="org.apache.commons.logging.LogFactory" %>
|
<%@ page import="org.apache.commons.logging.LogFactory" %>
|
||||||
|
@ -58,7 +59,11 @@
|
||||||
String command = vreq.getParameter("cmd");
|
String command = vreq.getParameter("cmd");
|
||||||
|
|
||||||
String vitroNsProp = (String) vreq.getParameter("vitroNsProp");
|
String vitroNsProp = (String) vreq.getParameter("vitroNsProp");
|
||||||
boolean isVitroNsProp = "true".equals(vitroNsProp) ? true : false;
|
|
||||||
|
boolean isVitroNsProp = false;
|
||||||
|
if ( "true".equals(vitroNsProp) || predicateUri.equals(VitroVocabulary.LABEL) ) {
|
||||||
|
isVitroNsProp = true;
|
||||||
|
}
|
||||||
|
|
||||||
if( subjectUri == null || subjectUri.trim().length() == 0 ) {
|
if( subjectUri == null || subjectUri.trim().length() == 0 ) {
|
||||||
log.error("required subjectUri parameter missing");
|
log.error("required subjectUri parameter missing");
|
||||||
|
@ -87,7 +92,6 @@
|
||||||
DataProperty dataproperty = wdf.getDataPropertyDao().getDataPropertyByURI( predicateUri );
|
DataProperty dataproperty = wdf.getDataPropertyDao().getDataPropertyByURI( predicateUri );
|
||||||
if( dataproperty == null) {
|
if( dataproperty == null) {
|
||||||
// No dataproperty will be returned for a vitro ns prop, but we shouldn't throw an error.
|
// No dataproperty will be returned for a vitro ns prop, but we shouldn't throw an error.
|
||||||
// RY This is not necessarily true...
|
|
||||||
if (!isVitroNsProp) {
|
if (!isVitroNsProp) {
|
||||||
log.error("Could not find data property '"+predicateUri+"' in model");
|
log.error("Could not find data property '"+predicateUri+"' in model");
|
||||||
throw new Error("editDatapropStmtRequest.jsp: Could not find DataProperty in model: " + predicateUri);
|
throw new Error("editDatapropStmtRequest.jsp: Could not find DataProperty in model: " + predicateUri);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue