Added code for deleting individuals (#213)
* Added code for deleting individuals * Allow admins delete individuals * Fixed delete individual url params * Improved query safety * refact: fixed constants' names, fixed mistakes, removed useless code * refact: refactored sparql queries * fix: fixed error logging mistakes * fix: use CONSTRUCT instead of DESCRIBE as less potentionally problematic, lookup for mostSpecificTypes * feat: add delete link in vitro individual profile if individual is editable * fix: renamed individualURI to individualUri and added safety check * fix: use ABox model to construct triples to delete
This commit is contained in:
parent
c41853440f
commit
ff285fb80d
11 changed files with 327 additions and 9 deletions
|
@ -49,7 +49,9 @@
|
|||
<h1 class="fn" itemprop="name">
|
||||
<#-- Label -->
|
||||
<@p.label individual editable labelCount localesCount languageCount/>
|
||||
|
||||
<#if editable>
|
||||
<@p.deleteIndividualLink individual />
|
||||
</#if>
|
||||
<#-- Most-specific types -->
|
||||
<@p.mostSpecificTypes individual />
|
||||
<span id="iconControlsVitro"><img id="uriIcon" title="${individual.uri}" class="middle" src="${urls.images}/individual/uriIcon.gif" alt="uri icon"/></span>
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<#-- $This file is distributed under the terms of the license in LICENSE$ -->
|
||||
<#if editConfiguration.pageData.redirectUrl??>
|
||||
<#assign redirectUrl = editConfiguration.pageData.redirectUrl />
|
||||
<#else>
|
||||
<#assign redirectUrl = "/" />
|
||||
</#if>
|
||||
<#if editConfiguration.pageData.individualName??>
|
||||
<#assign individualName = editConfiguration.pageData.individualName />
|
||||
</#if>
|
||||
<#if editConfiguration.pageData.individualType??>
|
||||
<#assign individualType = editConfiguration.pageData.individualType />
|
||||
</#if>
|
||||
|
||||
<form action="${editConfiguration.deleteIndividualProcessingUrl}" method="get">
|
||||
<h2>${i18n().confirm_individual_deletion} </h2>
|
||||
|
||||
<input type="hidden" name="individualUri" value="${editConfiguration.objectUri}" role="input" />
|
||||
<input type="hidden" name="redirectUrl" value="${redirectUrl}" role="input" />
|
||||
<p>
|
||||
<#if individualType??>
|
||||
${individualType}
|
||||
</#if>
|
||||
<#if individualName??>
|
||||
${individualName}
|
||||
</#if>
|
||||
</p>
|
||||
<br />
|
||||
<p class="submit">
|
||||
<input type="submit" id="submit" value="${i18n().delete_button}" role="button"/>
|
||||
or
|
||||
<a class="cancel" title="${i18n().cancel_title}" href="${editConfiguration.cancelUrl}">${i18n().cancel_link}</a>
|
||||
</p>
|
||||
</form>
|
|
@ -203,6 +203,16 @@ name will be used as the label. -->
|
|||
<a class="edit-${propertyLocalName}" href="${url}" title="${i18n().edit_entry}"><img class="edit-individual" data-range="${rangeUri}" src="${urls.images}/individual/editIcon.gif" alt="${i18n().edit_entry}" /></a>
|
||||
</#macro>
|
||||
|
||||
<#macro deleteIndividualLink individual redirectUrl="/">
|
||||
<#local url = individual.deleteUrl + "&redirectUrl=" + "${redirectUrl}">
|
||||
<@showDeleteIndividualLink url />
|
||||
</#macro>
|
||||
|
||||
|
||||
<#macro showDeleteIndividualLink url>
|
||||
<a class="delete-individual" href="${url}" title="${i18n().delete_entry}"><img class="delete-individual" src="${urls.images}/individual/deleteIcon.gif" alt="${i18n().delete_entry}" /></a>
|
||||
</#macro>
|
||||
|
||||
<#macro deleteLink propertyLocalName propertyName statement rangeUri="">
|
||||
<#local url = statement.deleteUrl>
|
||||
<#if url?has_content>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue