NIHVIVO-1332 Editing link for rdfs:label

This commit is contained in:
rjy7 2011-01-13 00:38:26 +00:00
parent d99c66c746
commit 00691d1d40
3 changed files with 23 additions and 18 deletions

View file

@ -79,7 +79,8 @@ public class DataPropertyStatementTemplateModel extends PropertyStatementTemplat
}
// 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);
if (policyHelper.isAuthorizedAction(action)) {
markDeletable();
@ -105,10 +106,6 @@ public class DataPropertyStatementTemplateModel extends PropertyStatementTemplat
if (! isDeletable()) {
params.put("deleteProhibited", "prohibited");
}
//
if (propertyUri.equals(VitroVocabulary.LABEL)) {
params.put("vitroNsProp", "true");
}
editUrl = UrlBuilder.getUrl(EDIT_PATH, params);
}
return editUrl;

View file

@ -175,6 +175,20 @@ public class IndividualTemplateModel extends BaseTemplateModel {
public boolean getShowAdminPanel() {
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
* 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() {
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() {
return individual.getMoniker();
}