* Get an array of links to be passed to drupal_set_breadcrumb(). This is used for generating the bread-crumbs for the view object page.
* Get an array of links to be passed to drupal_set_breadcrumb(). This is used
* for generating the bread-crumbs for the view object page.
*
*
* Each link in the bread-crumbs represents a member of the given objects ancestry
* Each link in the bread-crumbs represents a member of the given objects ancestry
* which is identified by any of the following RELS-EXT terms (isMemberOf,isMemberOfCollection,isPartOf).
* which is identified by any of the following RELS-EXT terms
* (isMemberOf,isMemberOfCollection,isPartOf).
*
*
* @param FedoraObject $object
* @param FedoraObject $object
* An object whose ancestry will be mapped to bread-crumbs.
* An object whose ancestry will be mapped to bread-crumbs.
@ -18,12 +20,15 @@
* @see drupal_set_breadcrumb()
* @see drupal_set_breadcrumb()
*
*
* @return array
* @return array
* Array of links, starting with most distant ancestor proceeding up to but not including the given object. For use in the function drupal_set_breadcrumb().
* Array of links, starting with most distant ancestor proceeding up to but
* not including the given object. For use in the function
* This file contains any functions meant to be part of the global space, ie. functions that and other modules will use without including a module file.
* This file contains any functions meant to be part of the global space, ie.
* functions that and other modules will use without including a module file.
*/
*/
/**
/**
* Just a wrapper around fetchings the IslandoraTuque object, with some very basic error logging.
* Just a wrapper around fetchings the IslandoraTuque object, with some very
* basic error logging.
*
*
* @return IslandoraTuque
* @return IslandoraTuque
* A IslandoraTuque instance
* A IslandoraTuque instance
@ -25,13 +27,15 @@ function islandora_get_tuque_connection() {
}
}
/**
/**
* Gets the given object if found, NULL if it is inaccessible and FALSE if it was not found.
* Gets the given object if found, NULL if it is inaccessible and FALSE if it
* was not found.
*
*
* @param string $object_id
* @param string $object_id
* The identifier of the object to get.
* The identifier of the object to get.
*
*
* @return FedoraObject
* @return FedoraObject
* The object if found, NULL if it is inaccessible and FALSE if it was not found.
* The object if found, NULL if it is inaccessible and FALSE if it was not
* found.
*/
*/
function islandora_get_object_by_id($object_id) {
function islandora_get_object_by_id($object_id) {
$tuque = islandora_get_tuque_connection();
$tuque = islandora_get_tuque_connection();
@ -52,7 +56,8 @@ function islandora_get_object_by_id($object_id) {
else {
else {
IslandoraTuque::getError();
IslandoraTuque::getError();
}
}
return NULL; // Assuming access denied in all other cases for now.
// Assuming access denied in all other cases for now.
return NULL;
}
}
/**
/**
@ -110,13 +115,16 @@ function islandora_delete_object(FedoraObject &$object) {
foreach (islandora_build_hook_list(ISLANDORA_PRE_PURGE_DATASTREAM_HOOK, $datastream->parent->models) as $hook) {
foreach (islandora_build_hook_list(ISLANDORA_PRE_PURGE_DATASTREAM_HOOK, $datastream->parent->models) as $hook) {
$results = array_merge_recursive($results, module_invoke_all($hook, $datastream)); // @note Not sure this will work the greatest, probably an alter would be better...
// Not sure this will work the greatest, probably an alter would be better..
// #limit_validation_errors, is why when the previous button is pressed no
* #limit_validation_errors, is why when the previous button is pressed no values persisted in the form_state, but its also what allows us to go back when validation errors occur.
// values persisted in the form_state, but its also what allows us to go
* To have a better solution going forward we can either limit validation only on required fields, or we can convert all required fields to use #element_validation functions, and
// back when validation errors occur. To have a better solution going
* Remove the need for #limit_validation_errors. Or maybe there is some other solution, regardless of what it is, it won't be standard.
// forward we can either limit validation only on required fields, or we can
*/
// convert all required fields to use #element_validation functions, and
// Remove the need for #limit_validation_errors. Or maybe there is some
// other solution, regardless of what it is, it won't be standard.
'#limit_validation_errors' => array()
'#limit_validation_errors' => array()
);
);
}
}
@ -151,10 +163,10 @@ function islandora_ingest_form_previous_button() {
function islandora_ingest_form_previous_submit(array $form, array &$form_state) {
function islandora_ingest_form_previous_submit(array $form, array &$form_state) {
watchdog('islandora', $e->getMessage(), NULL, WATCHDOG_ERROR); // If post hooks throws it may already exist at this point but may be invalid, so don't say failed :P
// If post hooks throws it may already exist at this point but may be invalid, so don't say failed :P
foreach (islandora_build_hook_list(ISLANDORA_VIEW_HOOK, $object->models) as $hook) {
foreach (islandora_build_hook_list(ISLANDORA_VIEW_HOOK, $object->models) as $hook) {
$temp = module_invoke_all($hook, $object, $page_number, $page_size); // @todo Remove page number and size from this hook, implementers of the hook should use drupal page handling directly.
// @todo Remove page number and size from this hook, implementers of the
@ -435,24 +456,35 @@ function islandora_default_islandora_view_object($object) {
}
}
/**
/**
* A helper function to get a connection and return an object for objects specified in the menu path as '%islandora_object'.
* A helper function to get a connection and return an object for objects
* specified in the menu path as '%islandora_object'.
*
*
* This should only be used by the Drupal menu wildcard system!
* This should only be used by the Drupal menu wildcard system!
*
*
* When this function returns FALSE the Drupal menu system will issues a "page not found" error, when this function returns NULL,
* When this function returns FALSE the Drupal menu system will issues a
* the access function is expected to check for the given object and return false generating a "accesss denied" error.
* "page not found" error, when this function returns NULL, the access function
* is expected to check for the given object and return false generating a
* "accesss denied" error.
*
*
* This will currently display a message if the repository is inaccessable, ideally this would redirect to another page in such a case,
* This will currently display a message if the repository is inaccessable,
* as the access function will not be aware of this fact and will trigger the display of the "access denied" page.
* ideally this would redirect to another page in such a case,
* as the access function will not be aware of this fact and will trigger
* the display of the "access denied" page.
*
*
* @todo When the repository down this should return a 500 error or a site offline notice. Currently only displays a message.
* @todo When the repository down this should return a 500 error or a
* site offline notice. Currently only displays a message.
*
*
* @param string $object_id
* @param string $object_id
* The pid of an object in the menu path identified by '%islandora_object'.
* The pid of an object in the menu path identified by '%islandora_object'.
*
*
* @return FedoraObject
* @return FedoraObject
* If the given object id exists in the repository then this returns a FedoraObject, if no object was found it returns FALSE which triggers drupal_page_not_found(), if the
* If the given object id exists in the repository then this returns a
* object was inaccessible then NULL is returned, and the access callback is expected to catch that case, triggering drupal_access_denied().
* FedoraObject.
* If no object was found it returns FALSE which triggers
* drupal_page_not_found().
* If the object was inaccessible then NULL is returned, and the
* access callback is expected to catch that case, triggering
if ($is_fedora_object && isset($element[$datastream_id])) { // @todo check for access denied to this datastream so we can show the access denied page instead.
if ($is_fedora_object && isset($element[$datastream_id])) {
$datastream = $element[$datastream_id];
$datastream = $element[$datastream_id];
return $datastream;
return $datastream;
}
}
}
}
$load_failed = TRUE;
$load_failed = TRUE;
return $datastream; // @todo Test
return $datastream;
}
}
/**
/**
* Content model, collection view and collection policy datastreams may now optionally define a version
* Content model, collection view and collection policy datastreams may now
* number in their top-level XML element as an attribute, as in:
* optionally define a version number in their top-level XML element as an