Browse Source

Merge branch 'Kylea' of https://github.com/knjackson30974/islandora into Kylea

pull/586/head
Kylea Jackson 10 years ago
parent
commit
1b11c4b258
  1. 7
      includes/breadcrumb.inc
  2. 8
      islandora.rules.inc
  3. 16
      tests/includes/utilities.inc

7
includes/breadcrumb.inc

@ -91,6 +91,7 @@ function islandora_get_breadcrumbs_recursive($pid, FedoraRepository $repository,
!optionals !optionals
!filters !filters
} }
!order
EOQ; EOQ;
$query_optionals = (array) module_invoke('islandora_xacml_api', 'islandora_basic_collection_get_query_optionals', 'view'); $query_optionals = (array) module_invoke('islandora_xacml_api', 'islandora_basic_collection_get_query_optionals', 'view');
@ -98,10 +99,14 @@ EOQ;
$filter_map = function ($filter) { $filter_map = function ($filter) {
return "FILTER($filter)"; return "FILTER($filter)";
}; };
$query_filters[] = "sameTerm(?collection_predicate, <fedora-rels-ext:isMemberOfCollection>) || sameTerm(?collection_predicate, <fedora-rels-ext:isMemberOf>)"; $collection_predicate_filters = "sameTerm(?collection_predicate, <fedora-rels-ext:isPartOf>)";
$collection_predicate_filters .= " || sameTerm(?collection_predicate, <fedora-rels-ext:isMemberOfCollection>) || sameTerm(?collection_predicate, <fedora-rels-ext:isMemberOf>)";
$query_filters[] = $collection_predicate_filters;
$query_order = "ORDER BY DESC(?label)";
$query = format_string($query, array( $query = format_string($query, array(
'!optionals' => !empty($query_optionals) ? ('OPTIONAL {{' . implode('} UNION {', $query_optionals) . '}}') : '', '!optionals' => !empty($query_optionals) ? ('OPTIONAL {{' . implode('} UNION {', $query_optionals) . '}}') : '',
'!filters' => implode(' ', array_map($filter_map, $query_filters)), '!filters' => implode(' ', array_map($filter_map, $query_filters)),
'!order' => $query_order,
)); ));
$query = format_string($query, array( $query = format_string($query, array(
'!pid' => $pid, '!pid' => $pid,

8
islandora.rules.inc

@ -406,9 +406,11 @@ function islandora_rules_datastream_load_namespace_vocab($xpath, $xpath_vocab) {
/** /**
* Rules XPath helper; grab the datastream content and build a DOMXPath. * Rules XPath helper; grab the datastream content and build a DOMXPath.
*/ */
function islandora_rules_datastream_load_xpath(AbstractDatastream $datastream, $xpath_vocab) { function islandora_rules_datastream_load_xpath(AbstractDatastream $datastream, $xpath_vocab = NULL) {
$result = islandora_rules_datastream_load_domxpath($datastream->content, $xpath_vocab); $result = islandora_rules_datastream_load_domxpath($datastream->content);
islandora_rules_datastream_load_namespace_vocab($result['islandora_domxpath'], $xpath_vocab); if (is_object($xpath_vocab)) {
islandora_rules_datastream_load_namespace_vocab($result['islandora_domxpath'], $xpath_vocab);
}
return $result; return $result;
} }

16
tests/includes/utilities.inc

@ -314,7 +314,8 @@ class IslandoraTestUtilities extends IslandoraTestUtilityClass {
* The user whose objects we'd like to remove. * The user whose objects we'd like to remove.
* *
* @return bool * @return bool
* TRUE on success, FALSE on failure. * TRUE if all objects were removed, or FALSE if any of them still remained
* after removal.
*/ */
public function deleteUserCreatedObjects($username) { public function deleteUserCreatedObjects($username) {
if ($username === $this->configuration['admin_user']) { if ($username === $this->configuration['admin_user']) {
@ -330,16 +331,19 @@ SELECT ?object FROM <#ri> WHERE
QUERY; QUERY;
$objects = $this->repository->ri->sparqlQuery($query); $objects = $this->repository->ri->sparqlQuery($query);
$return_value = TRUE;
foreach ($objects as $object) { foreach ($objects as $object) {
$loaded_object = islandora_object_load($object['object']['value']); $loaded_object = islandora_object_load($object['object']['value']);
$this->repository->api->m->purgeObject($loaded_object->id); $this->repository->purgeObject($loaded_object->id);
if (islandora_object_load($object['object']['value'])) { if (!islandora_object_load($object['object']['value'])) {
$this->addResult(TRUE, "Object {$object['object']['value']} successfully removed from repository."); $this->addResult(TRUE, "Object {$object['object']['value']} successfully removed from repository.");
return TRUE;
} }
$this->addResult(FALSE, "Unable to remove object {$object['object']['value']} from the repository."); else {
return FALSE; $this->addResult(FALSE, "Unable to remove object {$object['object']['value']} from the repository.");
$return_value = FALSE;
}
} }
return $return_value;
} }
/** /**

Loading…
Cancel
Save