Browse Source

Added delete validation to prevent removal of populated collections

pull/65/head
Alan Stanley 13 years ago
parent
commit
0cf63ac59d
  1. 17
      fedora_repository.module
  2. 1
      xsl/sparql_to_html.xsl

17
fedora_repository.module

@ -496,6 +496,23 @@ function fedora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NULL)
return $output; return $output;
} }
function fedora_repository_purge_object_form_validate($form, &$form_state) {
module_load_include('inc', 'fedora_repository', 'api/fedora_collection');
$pid = $form_state['values']['pid'];
$objectHelper = new ObjectHelper();
$contentModels = $objectHelper->get_content_models_list($pid);
foreach ($contentModels as $contentModel) {
if ($contentModel->pid == 'islandora:collectionCModel') {
$member_pids = get_related_items_as_array($pid, 'isMemberOfCollection');
if (is_array($member_pids)){
form_set_error('new_collection_pid', t("Please purge all members of this collection before deleting the collection itself."));
return;
}
}
}
}
/** /**
* fedora repository purge object form submit * fedora repository purge object form submit
* @param type $form * @param type $form

1
xsl/sparql_to_html.xsl

@ -245,3 +245,4 @@
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

Loading…
Cancel
Save