Browse Source

Remove inline comments, make comments 80 characters or less in length.

pull/203/head
Nigel Banks 12 years ago
parent
commit
92915bdd7c
  1. 54
      README
  2. 4
      admin/islandora.admin.inc
  3. 4
      includes/DublinCore.inc
  4. 26
      includes/add_datastream.form.inc
  5. 25
      includes/breadcrumb.inc
  6. 9
      includes/datastream.inc
  7. 9
      includes/delete_datastream.form.inc
  8. 18
      includes/delete_object.form.inc
  9. 109
      includes/globals.inc
  10. 103
      includes/ingest.form.inc
  11. 12
      includes/ingest.menu.inc
  12. 10
      includes/object_properties.form.inc
  13. 29
      includes/solution_packs.inc
  14. 11
      includes/utilities.inc
  15. 126
      islandora.module
  16. 8
      theme/islandora-object-edit.tpl.php
  17. 15
      theme/islandora-object.tpl.php
  18. 6
      theme/islandora.theme.inc

54
README

@ -1,9 +1,59 @@
CONTENTS OF THIS FILE
---------------------
* summary
* requirements
* installation
* configuration
* customization
* troubleshooting
* faq
* contact
* sponsors
SUMMARY
-------
Islandora Fedora Repository Module
For installation and customization instructions please see the documentation and the DuraSpace Wiki:
For installation and customization instructions please see the documentation
and the DuraSpace Wiki:
https://wiki.duraspace.org/display/ISLANDORA/Islandora
All bugs, feature requests and improvement suggestions are tracked at the DuraSpace JIRA:
All bugs, feature requests and improvement suggestions are tracked at the
DuraSpace JIRA:
https://jira.duraspace.org/browse/ISLANDORA
REQUIREMENTS
------------
INSTALLATION
------------
CONFIGURATION
-------------
CUSTOMIZATION
-------------
TROUBLESHOOTING
---------------
F.A.Q.
------
CONTACT
-------
SPONSORS
--------

4
admin/islandora.admin.inc

@ -2,7 +2,9 @@
/**
* @file
* islandora.admin.inc: This file contains the general islandora admin form and callback functions.
*
* islandora.admin.inc: This file contains the general islandora admin form and
* callback functions.
*/
/**

4
includes/DublinCore.inc

@ -2,6 +2,7 @@
/**
* @file
*
* Implements a simple class for working with Dublin Core data and exporting it
* back to XML. Inspiration and design shamelessly stolen from the pyfedora
* project at http://pypi.python.org/pypi/pyfedora/0.1.0
@ -32,7 +33,8 @@ class DublinCore {
public $owner;
/**
* Constructs a DublinCore object from a Fedora_Item object and populates the $dc array.
* Constructs a DublinCore object from a Fedora_Item object and populates the
* $dc array.
*
* @param string $dc_xml
*/

26
includes/add_datastream.form.inc

@ -41,8 +41,10 @@ function islandora_add_datastream_form(array $form, array &$form_state, FedoraOb
'dsid' => array(
'#title' => 'Datastream ID',
'#description' => t('An ID for this stream that is unique to this object.' .
'Must start with a letter and contain only alphanumeric characters and dashes and underscores.' .
'Datastreams that are defined by the content model don\'t currently exist: <b>@unused_dsids</b>.',
'Must start with a letter and contain only alphanumeric ' .
'characters and dashes and underscores. Datastreams that ' .
'are defined by the content model don\'t currently exist: ' .
'<b>@unused_dsids</b>.',
array('@unused_dsids' => $unused_datastreams)
),
'#type' => 'textfield',
@ -75,7 +77,8 @@ function islandora_add_datastream_form(array $form, array &$form_state, FedoraOb
'#upload_location' => 'temporary://',
'#upload_validators' => array(
'file_validate_extensions' => array(NULL),
'file_validate_size' => array($upload_size * 1024 * 1024), // Assume its specified in MB
// Assume its specified in MB
'file_validate_size' => array($upload_size * 1024 * 1024),
),
),
'submit' => array(
@ -119,7 +122,8 @@ function islandora_add_datastream_form_field_starts_with_a_letter(array $element
}
/**
* Checks if the given form field contains only valid characters for a datstream id.
* Checks if the given form field contains only valid characters for a
* datastream id.
*
* @param array $element
* The form field to check.
@ -152,7 +156,8 @@ function islandora_add_datastream_form_field_does_not_contain_a_forward_slash(ar
}
/**
* Checks if the given datastream id requires that the upload file be of a certian MIME type.
* Checks if the given datastream id requires that the upload file be of a
* certian MIME type.
*
* @param array $form
* The Drupal form.
@ -174,7 +179,8 @@ function islandora_add_datastream_form_validate(array $form, array &$form_state)
}
/**
* Adds the new datastream based on the submitted values, only creates managed datastreams at the moment.
* Adds the new datastream based on the submitted values, only creates managed
* datastreams at the moment.
*
* @param array $form
* The Drupal form.
@ -202,12 +208,14 @@ function islandora_add_datastream_form_submit(array $form, array &$form_state) {
}
/**
* Callback for an autocomplete field in the admin add datastream form. It lists the missing required (may be optional) datastreams.
* Callback for an autocomplete field in the admin add datastream form.
* It lists the missing required (may be optional) datastreams.
*
* @param FedoraObject $object
* The object used to check for missing required datastreams used to populate the options in this callback.
* The object used to check for missing required datastreams used to populate
* the options in this callback.
* @param string $query
* The user query to match against the missing required datastreams.
* vThe user query to match against the missing required datastreams.
*/
function islandora_add_datastream_form_autocomplete_callback(FedoraObject $object, $query = '') {
module_load_include('inc', 'islandora', 'includes/content_model');

25
includes/breadcrumb.inc

@ -7,10 +7,12 @@
*/
/**
* 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
* 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
* An object whose ancestry will be mapped to bread-crumbs.
@ -18,12 +20,15 @@
* @see drupal_set_breadcrumb()
*
* @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
* drupal_set_breadcrumb().
*/
function islandora_get_breadcrumbs($object) {
$breadcrumbs = array();
islandora_get_breadcrumbs_recursive($object->id, $breadcrumbs, $object->repository);
if (isset($breadcrumbs[0])) { // Remove the actual object.
if (isset($breadcrumbs[0])) {
// Remove the actual object.
unset($breadcrumbs[0]);
}
$breadcrumbs = array_reverse($breadcrumbs);
@ -35,7 +40,8 @@ function islandora_get_breadcrumbs($object) {
*
* @todo Make fully recursive...
*
* @todo Could use some clean up, can't be called multiple times safely due to the use of static variables.
* @todo Could use some clean up, can't be called multiple times safely due to
* the use of static variables.
*
* @param string $pid
* THe object id whose parent will be fetched for the next link.
@ -45,7 +51,8 @@ function islandora_get_breadcrumbs($object) {
* The fedora repository.
*/
function islandora_get_breadcrumbs_recursive($pid, array &$breadcrumbs, FedoraRepository $repository) {
// Before executing the query, we hve a base case of accessing the top-level collection
// Before executing the query, we hve a base case of accessing the
// top-level collection
static $max_level = 10;
static $level = -1;
@ -88,8 +95,10 @@ function islandora_get_breadcrumbs_recursive($pid, array &$breadcrumbs, FedoraRe
islandora_get_breadcrumbs_recursive($parent, $breadcrumbs, $repository);
}
else {
$breadcrumbs[] = '...'; // Add an non-link, as we don't know how to get back to the root.
islandora_get_breadcrumbs_recursive($root, $breadcrumbs, $repository); // And render the last two links and break (on the next pass).
// Add an non-link, as we don't know how to get back to the root.
$breadcrumbs[] = '...';
// And render the last two links and break (on the next pass).
islandora_get_breadcrumbs_recursive($root, $breadcrumbs, $repository);
}
}
}

9
includes/datastream.inc

@ -3,7 +3,8 @@
/**
* @file
*
* This file contains the admin form and callback functions for datastream manipulations.
* This file contains the admin form and callback functions for datastream
* manipulations.
*/
/**
@ -25,7 +26,8 @@ function islandora_download_datastream(FedoraDatastream $datastream) {
* @param FedoraDatastream $datastream
* The datastream to view/download.
* @param boolean $download
* If TRUE the file is download to the user computer for viewing otherwise it will attempt to display in the browser natively.
* If TRUE the file is download to the user computer for viewing otherwise it
* will attempt to display in the browser natively.
*/
function islandora_view_datastream(FedoraDatastream $datastream, $download = FALSE) {
header_remove('Cache-Control');
@ -53,7 +55,8 @@ function islandora_view_datastream(FedoraDatastream $datastream, $download = FAL
* The datastream to check.
*
* @return string
* A human readable size of the given datastream, or '-' if the size could not be determined.
* A human readable size of the given datastream, or '-' if the size could not
* be determined.
*/
function islandora_datastream_get_human_readable_size(FedoraDatastream $datastream) {
module_load_include('inc', 'islandora', 'includes/utilities');

9
includes/delete_datastream.form.inc

@ -3,7 +3,8 @@
/**
* @file
*
* This file contains the admin (confirmation) form and callback functions to delete/purge a datastream.
* This file contains the admin (confirmation) form and callback functions to
* delete/purge a datastream.
*/
/**
@ -31,9 +32,11 @@ function islandora_delete_datastream_form(array $form, array &$form_state, Fedor
}
/**
* Submit handler for the delete datastream form. Purges/Delete's the given FedoraDatastream if possible.
* Submit handler for the delete datastream form. Purges/Delete's the given
* FedoraDatastream if possible.
*
* The ISLANDORA_PRE_PURGE_DATASTREAM_HOOK will query other modules as to whether the given FedoraDatastream
* The ISLANDORA_PRE_PURGE_DATASTREAM_HOOK will query other modules as to
* whether the given FedoraDatastream
* should be: blocked from purging; state set to 'Deleted'; or purged.
*
* @see islandora_delete_datastream().

18
includes/delete_object.form.inc

@ -3,7 +3,8 @@
/**
* @file
*
* This file contains the admin (confirmation) form and callback functions to purge an object.
* This file contains the admin (confirmation) form and callback functions to
* purge an object.
*/
/**
@ -31,20 +32,7 @@ function islandora_delete_object_form(array $form, array &$form_state, FedoraObj
}
/**
* Gives the option of deleting or purging and object.
*
* @note The description below probably applies to islandora_object_purge() function...
*
* The default behaviour is to purge the object to reduce maintenance.
* If a solution pack wants to change this behaviour and have the object set to deleted then
* it can respond to the 'islandora_pre_purge_object' hook with an array containing the pair
* 'delete' => TRUE.
* Once the object has been deleted/purged then a second call lets the solution packs know that
* the object has been dealt with. In this call the object id and content models are sent out so
* that the solution packs can act on this news. There is no guarantee that the object still exists
* and so the object object isn't sent.
*
* @todo Clean Up!
* Delete's the object in questionGives deloption of deleting or purging and object.
*
* @param array $form
* The Drupal form.

109
includes/globals.inc

@ -3,11 +3,13 @@
/**
* @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.
* 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
* 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
* The identifier of the object to get.
*
* @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) {
$tuque = islandora_get_tuque_connection();
@ -52,7 +56,8 @@ function islandora_get_object_by_id($object_id) {
else {
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) {
$models = $object->models;
$action = islandora_pre_delete_object($object);
switch ($action) {
case 'blocked': // Do nothing.
case 'blocked':
// Do nothing.
return FALSE;
case 'delete': // Change the state to deleted.
case 'delete':
// Change the state to deleted.
$object->delete();
islandora_post_delete_object($object_id, $models);
return TRUE;
default: // Purge
default:
// Purge
$object->repository->purgeObject($object_id);
islandora_post_delete_object($object_id, $models);
$object = NULL;
@ -161,26 +169,32 @@ function islandora_post_delete_object($object_id, array $models) {
* Delete's/Purges the given datastream.
*
* @throws Exception
* Which types are undefined, but more than likely because of the hooks there will be several kinds.
* Which types are undefined, but more than likely because of the hooks
* there will be several kinds.
*
* @param FedoraDatastream $datastream
* The datastream to delete.
*
* @return boolean
* TRUE is returned if the datastream was Deleted/Purged, FALSE if it was blocked.
* TRUE is returned if the datastream was Deleted/Purged, FALSE if it was
* blocked.
*/
function islandora_delete_datastream(FedoraDatastream &$datastream) {
$datastream_id = $datastream->id;
$object = $datastream->parent;
$action = islandora_pre_delete_datastream($datastream);
switch ($action) {
case 'blocked': // Do nothing.
case 'blocked':
// Do nothing.
return FALSE;
case 'delete': // Change the state to deleted.
case 'delete':
// Change the state to deleted.
$object[$datastream_id]->state = 'D';
islandora_post_delete_datastream($object, $datastream_id); // @todo Differentiate between delete/purge in the hooks.
// @todo Differentiate between delete/purge in the hooks.
islandora_post_delete_datastream($object, $datastream_id);
return TRUE;
default: // Purge
default:
// Purge
$object->purgeDatastream($datastream_id);
islandora_post_delete_datastream($object, $datastream_id);
$datastream = NULL;
@ -189,27 +203,29 @@ function islandora_delete_datastream(FedoraDatastream &$datastream) {
}
/**
* The default behaviour is to 'purge' the datastream but this can be overridden by modules that implement
* the 'islandora_pre_purge_datastream' hook.
* The default behaviour is to 'purge' the datastream but this can be overridden
* by modules that implement the 'islandora_pre_purge_datastream' hook.
*
* @todo make this an alter.
*
* The returned array can include a 'block' => TRUE
* pair which will prevent the datastream from being deleted if it particularly needed for
* a certain function. Returning 'delete' => TRUE will cause the datastream to be put into
* a deleted state.
* pair which will prevent the datastream from being deleted if it particularly
* needed for a certain function. Returning 'delete' => TRUE will cause the
* datastream to be put into a deleted state.
*
* @param FedoraDatastream $datastream
* The datastream to delete.
*
* @return string
* The action to take when deleting the given datastream, either 'purge', 'delete', or 'block'.
* The action to take when deleting the given datastream, either 'purge',
* 'delete', or 'block'.
*/
function islandora_pre_delete_datastream(FedoraDatastream $datastream) {
module_load_include('inc', 'islandora', 'includes/utilities');
$results = array();
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..
$results = array_merge_recursive($results, module_invoke_all($hook, $datastream));
}
$action = (isset($results['block']) && $results['block']) ? 'block' : FALSE;
$action = (!$action && isset($results['delete']) && $results['delete']) ? 'delete' : $action;
@ -235,15 +251,18 @@ function islandora_post_delete_datastream(FedoraObject $object, $datastream_id)
}
/**
* Gets any objects that the given object has a (isMemberOf, isMemberOfCollection) relationship with.
* Gets any objects that the given object has a
* (isMemberOf, isMemberOfCollection) relationship with.
*
* This function gets its info from the RELS-EXT directly rather than through an risearch.
* This function gets its info from the RELS-EXT directly rather than through an
* risearch.
*
* @param FedoraObject $object
* The object whose parents will be returned.
*
* @return array
* An array of FedoraObject's that the given object has a (isMemberOf, isMemberOfCollection) relationship with.
* An array of FedoraObject's that the given object has a
* (isMemberOf, isMemberOfCollection) relationship with.
*/
function islandora_get_parents_from_rels_ext(FedoraObject $object) {
try {
@ -252,20 +271,24 @@ function islandora_get_parents_from_rels_ext(FedoraObject $object) {
$object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOf'));
}
catch (RepositoryException $e) {
// @todo some logging would be nice, not sure what this throws.
return array();
} // @todo some logging would be nice, not sure what this throws.
}
$collections = array_map(function($o) { return islandora_get_object_by_id($o['object']['value']); }, $collections);
return array_filter($collections);
}
/**
* Checks what datastreams the object already has against its required datastreams as defined by its content models, and returns their intersection.
* Checks what datastreams the object already has against its required
* datastreams as defined by its content models, and returns their intersection.
*
* @param FedoraObject $object
* The object which models will be used to determine what datastreams it should have.
* The object which models will be used to determine what datastreams it
* should have.
*
* @return array
* The DS-COMPOSITE-MODEL defined datastreams that are required for the given object, but not already present.
* The DS-COMPOSITE-MODEL defined datastreams that are required for the given
* object, but not already present.
*/
function islandora_get_missing_datastreams_requirements(FedoraObject $object) {
$datastreams = islandora_get_datastreams_requirements($object);
@ -278,19 +301,24 @@ function islandora_get_missing_datastreams_requirements(FedoraObject $object) {
}
/**
* Checks the object's content model's for which datastream are expected to be used with this object, as defined by the DS-COMPOSITE-MODEL datastreams.
* Checks the object's content model's for which datastream are expected to be
* used with this object, as defined by the DS-COMPOSITE-MODEL datastreams.
*
* For duplicate datastreams in the models, the first model defines the datastreams attributes regardless of what other models define.
* For duplicate datastreams in the models, the first model defines the
* datastreams attributes regardless of what other models define.
* This should be undefined behavior according to the documentation.
* @see https://wiki.duraspace.org/display/FEDORA34/Fedora+Digital+Object+Model#FedoraDigitalObjectModel-ContentModelObjectCMODEL
*
* @param FedoraObject $object
* The object which models will be used to determine what datastreams it should have.
* The object which models will be used to determine what datastreams it
* should have.
*
* @see islandora_get_required_datastreams_from_content_model() from more details on the return value.
* @see islandora_get_required_datastreams_from_content_model() from more
* details on the return value.
*
* @return array
* The DS-COMPOSITE-MODEL defined datastreams that are required for the given object.
* The DS-COMPOSITE-MODEL defined datastreams that are required for the given
* object.
*/
function islandora_get_datastreams_requirements(FedoraObject $object) {
$dsids = array();
@ -298,20 +326,24 @@ function islandora_get_datastreams_requirements(FedoraObject $object) {
$model = islandora_get_object_by_id($model);
$dsids += islandora_get_datastreams_requirements_from_content_model($model);
}
unset($dsids['AUDIT']); // The AUDIT Datastream can not really be added, so it can't really be missing.
// The AUDIT Datastream can not really be added, so it can't really be missing.
unset($dsids['AUDIT']);
return $dsids;
}
/**
* Checks the given content model for which datastreams are required for subscribing objects, as defined by it's DS-COMPOSITE-MODEL datastream.
* Checks the given content model for which datastreams are required for
* subscribing objects, as defined by it's DS-COMPOSITE-MODEL datastream.
*
* @todo Add support for fetching the schema information.
*
* @param FedoraObject $object
* The content model whose DS-COMPOSITE-MODEL datastream will be used to determine what datastreams are required.
* The content model whose DS-COMPOSITE-MODEL datastream will be used to
* determine what datastreams are required.
*
* @return array
* The DS-COMPOSITE-MODEL defined datastreams that are required for the given object.
* The DS-COMPOSITE-MODEL defined datastreams that are required for the given
* object.
*
* @code
* array(
@ -389,7 +421,8 @@ function islandora_prepare_new_object($namespace = NULL, $label = NULL, $datastr
$dsid = $ds['dsid'];
$label = isset($ds['label']) ? $ds['label'] : '';
$mimetype = isset($ds['mimetype']) ? $ds['mimetype'] : 'text/xml';
$control_group = (isset($ds['control_group']) && in_array($ds['control_group'], array('X', 'M', 'R', 'E'))) ? $ds['control_group'] : 'M'; // Default 'Managed'
// Default 'Managed'
$control_group = (isset($ds['control_group']) && in_array($ds['control_group'], array('X', 'M', 'R', 'E'))) ? $ds['control_group'] : 'M';
$datastream_file = url($ds['datastream_file'], array('absolute' => TRUE));
$datastream = $object->constructDatastream($dsid, $control_group);
$datastream->label = $label;

103
includes/ingest.form.inc

@ -3,19 +3,21 @@
/**
* @file
*
* Defines the multi-page ingest form and any relevant hooks and functions for defining the multi-page ingest forms.
* Defines the multi-page ingest form and any relevant hooks and functions for
* defining the multi-page ingest forms.
*/
/**
* Ingest form build function. Initializes the form state, and builds the initial list of steps,
* excutes the current step.
* Ingest form build function. Initializes the form state, and builds the
* initial list of steps, excutes the current step.
*
* @param array $form
* The drupal form.
* @param array $form_state
* The drupal form state.
* @param array $configuration
* A list of key value pairs that are used to build the list of steps to be executed.
* A list of key value pairs that are used to build the list of steps to be
* executed.
*
* @return array
* The form definition of the current step.
@ -33,13 +35,17 @@ function islandora_ingest_form(array $form, array &$form_state, array $configura
* @param array $form_state
* The drupal form state.
* @param array $configuration
* A list of key value pairs that are used to build the list of steps to be executed.
* A list of key value pairs that are used to build the list of steps to be
* executed.
*/
function islandora_ingest_form_init_form_state(array &$form_state, array $configuration) {
islandora_ingest_form_init_form_state_storage($form_state, $configuration); // First time initialization of storage.
// First time initialization of storage.
islandora_ingest_form_init_form_state_storage($form_state, $configuration);
$steps = &islandora_ingest_form_get_steps($form_state);
usort($steps, 'drupal_sort_weight'); // Always re-sort the steps just incase any build/submit handlers have appended new steps.
islandora_ingest_form_step_form_load_include($form_state); // Load any required files for the current step.
// Always re-sort the steps just incase any build/submit handlers have appended new steps.
usort($steps, 'drupal_sort_weight');
// Load any required files for the current step.
islandora_ingest_form_step_form_load_include($form_state);
}
/**
@ -48,12 +54,15 @@ function islandora_ingest_form_init_form_state(array &$form_state, array $config
* @param array $form_state
* The drupal form state.
* @param array $configuration
* A list of key value pairs that are used to build the list of steps to be executed.
* A list of key value pairs that are used to build the list of steps to be
* executed.
*/
function islandora_ingest_form_init_form_state_storage(array &$form_state, array $configuration) {
if (empty($form_state['islandora'])) {
$id = isset($configuration['id']) ? $configuration['id'] : NULL; // Use ID if given.
$namespace = isset($configuration['namespace']) && !isset($id) ? $configuration['namespace'] : $id; // Use namespace if ID not given.
// Use ID if given.
$id = isset($configuration['id']) ? $configuration['id'] : NULL;
// Use namespace if ID not given.
$namespace = isset($configuration['namespace']) && !isset($id) ? $configuration['namespace'] : $id;
$label = isset($configuration['label']) ? $configuration['label'] : 'New Object';
$relationship_map = function($o) { return array('relationship' => 'isMemberOfCollection', 'pid' => $o); };
$relationships = empty($configuration['collections']) ? array() : array_map($relationship_map, $configuration['collections']);
@ -68,8 +77,8 @@ function islandora_ingest_form_init_form_state_storage(array &$form_state, array
}
/**
* Executes the current step, building the form definition and appending on any additonal elements
* required for the step to function.
* Executes the current step, building the form definition and appending on any
* additonal elements required for the step to function.
*
* @param array $form
* The drupal form.
@ -87,7 +96,8 @@ function islandora_ingest_form_execute_step(array $form, array &$form_state) {
$args = isset($step_info['args']) ? array_merge($args, $step_info['args']) : $args;
$form = call_user_func_array($step_info['form_id'], $args);
return islandora_ingest_form_stepify($form, $form_state, $step_info);
case 'batch': // @todo Implement if possible.
case 'batch':
// @todo Implement if possible.
break;
}
return array();
@ -127,11 +137,13 @@ function islandora_ingest_form_previous_button() {
'#value' => t('Previous'),
'#name' => 'prev',
'#submit' => array('islandora_ingest_form_previous_submit'),
/**
* #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.
* 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
* 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, 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. 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
// 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()
);
}
@ -151,10 +163,10 @@ function islandora_ingest_form_previous_button() {
function islandora_ingest_form_previous_submit(array $form, array &$form_state) {
$step = &islandora_ingest_form_get_step($form_state);
$step_info = &islandora_ingest_form_get_step_info($form_state, $step);
$step_info['values'] = $form_state['values']; // Store values
$step--; // Goto previous step
$step_info = &islandora_ingest_form_get_step_info($form_state, $step); // Get values
$form_state['values'] = isset($step_info['values']) ? $step_info['values'] : NULL; // Use values
$step_info['values'] = $form_state['values'];
$step--;
$step_info = &islandora_ingest_form_get_step_info($form_state, $step);
$form_state['values'] = isset($step_info['values']) ? $step_info['values'] : NULL;
$form_state['rebuild'] = TRUE;
}
@ -196,10 +208,10 @@ function islandora_ingest_form_next_button(array $step_info) {
function islandora_ingest_form_next_submit(array $form, array &$form_state) {
$step = &islandora_ingest_form_get_step($form_state);
$step_info = &islandora_ingest_form_get_step_info($form_state, $step);
$step_info['values'] = $form_state['values']; // Store Values
$step++; // Goto Next Step
$step_info['values'] = $form_state['values'];
$step++;
$step_info = &islandora_ingest_form_get_step_info($form_state, $step);
$form_state['values'] = isset($step_info['values']) ? $step_info['values'] : array(); // Restore Values if Stored.
$form_state['values'] = isset($step_info['values']) ? $step_info['values'] : array();
$form_state['rebuild'] = TRUE;
}
@ -242,7 +254,8 @@ function islandora_ingest_form_submit(array $form, array &$form_state) {
islandora_add_object($object);
$form_state['redirect'] = "islandora/object/{$object->id}";
} catch (Exception $e) {
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
watchdog('islandora', $e->getMessage(), NULL, WATCHDOG_ERROR);
drupal_set_message(t('A problem occured while ingesting "@label" (ID: @pid), please notifiy the administrator.', array('@label' => $object->label, '@pid' => $object->id)), 'error');
}
}
@ -262,13 +275,15 @@ function islandora_ingest_form_get_configuration(array $form_state) {
}
/**
* Gets a reference to the stored NewFedoraObject's which are to be ingested when the final step submits.
* Gets a reference to the stored NewFedoraObject's which are to be ingested
* when the final step submits.
*
* @param array $form_state
* The drupal form state.
*
* @return array
* A reference to the stored NewFedoraObjects to be ingested when the final step submits.
* A reference to the stored NewFedoraObjects to be ingested when the final
* step submits.
*/
function &islandora_ingest_form_get_objects(array $form_state) {
return $form_state['islandora']['objects'];
@ -277,16 +292,18 @@ function &islandora_ingest_form_get_objects(array $form_state) {
/**
* Gets a single object from the stored NewFedoraObject's.
*
* @note - In our current use case we are only dealing with a single object ingest, this makes it convenient to access it.
* Ideally the steps implementations will be abstracted to be indifferent to what object it's currently working on. This will act as
* a placeholder for such functionality.
* @note - In our current use case we are only dealing with a single object
* ingest, this makes it convenient to access it. Ideally the steps
* implementations will be abstracted to be indifferent to what object it's
* currently working on. This will act as a placeholder for such
* functionality.
*
* @param array $form_state
* The drupal form state.
*
* @return array
* Returns the 'current' object in the array of NewFedoraObjects, generally this is only used
* when there is one object in the list of objects.
* Returns the 'current' object in the array of NewFedoraObjects, generally
* this is only used when there is one object in the list of objects.
*/
function islandora_ingest_form_get_object(array $form_state) {
$objects = &islandora_ingest_form_get_objects($form_state);
@ -307,7 +324,8 @@ function &islandora_ingest_form_get_step(array &$form_state) {
}
/**
* Get a reference to the step info of the given step or the current step if none is given.
* Get a reference to the step info of the given step or the current step if
* none is given.
*
* @param array $form_state
* The drupal form state.
@ -323,7 +341,8 @@ function &islandora_ingest_form_get_step_info(array &$form_state, $step = NULL)
if (!empty($steps[$step])) {
return $steps[$step];
}
return NULL; // @todo deal with unknown case.
// @todo deal with unknown case.
return NULL;
}
/**
@ -346,13 +365,14 @@ function &islandora_ingest_form_get_steps(array &$form_state) {
* The drupal form state.
*/
function islandora_ingest_form_step_form_load_include(array &$form_state) {
form_load_include($form_state, 'inc', 'islandora', 'includes/ingest.form'); // Always load this file.
form_load_include($form_state, 'inc', 'islandora', 'includes/ingest.form');
$step_info = islandora_ingest_form_get_step_info($form_state);
// Load include files
if (isset($step_info['file']) && isset($step_info['module'])) {
$matches = array();
preg_match('/^(.*)\.(.*)$/', $step_info['file'], $matches);
list($file, $name, $type) = $matches;
form_load_include($form_state, $type, $step_info['module'], $name); // Load include files.
form_load_include($form_state, $type, $step_info['module'], $name);
}
}
@ -371,7 +391,9 @@ function islandora_ingest_form_get_step_count(array $form_state) {
}
/**
* Buildes the initial list of ingest steps. Sorted by weight expected range between -50 to 50.
* Buildes the initial list of ingest steps.
*
* Sorted by weight expected range between -50 to 50.
*
* The sort order is undefined for steps which have the same weight.
*
@ -379,7 +401,8 @@ function islandora_ingest_form_get_step_count(array $form_state) {
* The configuration options used to build the multi-paged ingest process.
*
* @return array
* The initial list of sorted ingest steps as defined by all implementers of ISLANDORA_INGEST_STEP_HOOK.
* The initial list of sorted ingest steps as defined by all implementers
* of ISLANDORA_INGEST_STEP_HOOK.
*/
function islandora_ingest_get_steps(array $configuration) {
module_load_include('inc', 'islandora', 'includes/utilities');

12
includes/ingest.menu.inc

@ -14,9 +14,10 @@
*/
function islandora_ingest_callback() {
$configuration = islandora_ingest_get_configuration();
if ($configuration === FALSE) { // Redirect back to referer or top level collection.
if ($configuration === FALSE) {
drupal_set_message(t('Invalid ingest configuration.'), 'error');
$redirect = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '<front>';
// Redirect back to referer or top level collection.
drupal_goto($redirect);
}
module_load_include('inc', 'islandora', 'includes/ingest.form');
@ -26,10 +27,13 @@ function islandora_ingest_callback() {
/**
* Fetches/validates the ingest configuration from the $_GET parameters.
*
* Generic parameters as accepted by all ingest processes, other modules may add to this list.
* Generic parameters as accepted by all ingest processes, other modules may
* add to this list.
* id -> The pid of the object to create. optional.
* models -> Comma delimited list of all the content models the created object should have.
* collections -> Comma delimited list of all the collections the created object should belong to.
* models -> Comma delimited list of all the content models the created object
* should have.
* collections -> Comma delimited list of all the collections the created
* object should belong to.
*
* @return array
* The configuration options used to build the multi-paged ingest process.

10
includes/object_properties.form.inc

@ -32,11 +32,15 @@ function islandora_object_properties_form(array $form, array &$form_state, Fedor
'#default_value' => $object->label,
'#required' => 'TRUE',
'#description' => t('A Human readable label'),
'#size' => 120, // Double the normal length
'#maxlength' => 255, // Max length for a Fedora Label
// Double the normal length
'#size' => 120,
// Max length for a Fedora Label
'#maxlength' => 255,
'#type' => 'textfield'
),
'object_owner' => array( // @todo Make this into an autocomplete field that list the users in the system as well.
// @todo Make this into an autocomplete field that list the users in the
// system as well.
'object_owner' => array(
'#title' => t('Owner'),
'#default_value' => $object->owner,
'#required' => FALSE,

29
includes/solution_packs.inc

@ -3,7 +3,8 @@
/**
* @file
*
* This file contains all admin and callback functions for solution pack management.
* This file contains all admin and callback functions for solution pack
* management.
*/
/**
@ -69,25 +70,15 @@ function islandora_solution_pack_form($form, &$form_state, $solution_pack_modul
'#value' => $objects,
);
// table
// header
$table_header = array(t('Label'), t('PID'), t('Status'));
$table_rows = array();
// loop over defined objects
foreach ($objects as $object) {
$datastreams = NULL;
if (isset($object['pid'])) {
// set variables
$pid = $object['pid'];
// table row
$table_row = array();
// check object status
$object_status = islandora_check_object_status($object);
// set status labels
switch ($object_status) {
case 'up_to_date':
$object_status = t('Up-to-date');
@ -130,7 +121,6 @@ function islandora_solution_pack_form($form, &$form_state, $solution_pack_modul
'#suffix' => '</h3>',
);
// install status
$form['solution_pack']['install_status'] = array(
'#markup' => '<strong>' . t('Object status:') . '&nbsp;</strong>',
'#prefix' => '<div class="islandora-solution-pack-install-status">',
@ -269,8 +259,6 @@ function islandora_batch_reingest_object($object_model, &$context) {
function islandora_install_solution_pack($module_name = NULL, $op = 'install') {
// check if a module name is given. // @TODO: check module name for existance
if (!empty($module_name)) {
// include files
module_load_include('module', 'islandora', 'islandora');
module_load_include('inc', 'islandora', 'includes/utilities');
module_load_include('module', $module_name, $module_name);
@ -382,7 +370,8 @@ function islandora_install_solution_pack($module_name = NULL, $op = 'install') {
*
* @see islandora_solution_pack_form()
* @see islandora_install_solution_pack()
* @TODO: should this function live in islandora.module so it can be called easier without having to include the solution_packs.inc file?
* @todo: Should this function live in islandora.module so it can be called
* easier without having to include the solution_packs.inc file?
*/
function islandora_check_object_status($object_model = array()) {
if (!empty($object_model)) {
@ -409,7 +398,8 @@ function islandora_check_object_status($object_model = array()) {
$object_status = 'missing';
}
else {
// object defined with single datastream file // @TODO: should dsversion be mandatory for the check to valid?
// object defined with single datastream file
// @TODO: should dsversion be mandatory for the check to valid?
if (isset($object_model['dsid']) && isset($object_model['datastream_file']) && isset($object_model['dsversion'])) {
$datastreams = array(
array(
@ -580,7 +570,9 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL) {
'#type' => 'item',
'#title' => t('Select a viewer'),
'#description' => t('Preferred viewer for your solution pack. These may be provided by third-party modules.'),
'#tree' => TRUE, // this attribute is important to return the submitted values in a deeper nested arrays in
// This attribute is important to return the submitted values in a deeper
// nested arrays in
'#tree' => TRUE,
'#theme' => 'islandora_viewers_table',
);
@ -631,7 +623,8 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL) {
* Returns all defined viewers.
*
* @param string $mimetype
* specify a mimetype to return only viewers that support this certain mimetype.
* specify a mimetype to return only viewers that support this certain
* mimetype.
* @return
* array of viewer definitions, or FALSE if none are found.
*/

11
includes/utilities.inc

@ -156,7 +156,9 @@ function islandora_escape_pid_for_function($pid) {
* Gets the namespace of the given id.
*
* @param string $id
* Either a PID or namespace to check for accessibility. Any string like those below are fine.
* Either a PID or namespace to check for accessibility. Any string like those
* below are fine.
*
* @code
* 'islandora',
* 'islandora:',
@ -173,10 +175,13 @@ function islandora_get_namespace($id) {
}
/**
* Checks the given namespace or PID is/has an accessible namespace as defined by the "islandora_pids_allowed" variable.
* Checks the given namespace or PID is/has an accessible namespace as defined
* by the "islandora_pids_allowed" variable.
*
* @param string $namespace
* Either a PID or namespace to check for accessibility. Any string like those below are fine.
* Either a PID or namespace to check for accessibility. Any string like those
* below are fine.
*
* @code
* 'islandora',
* 'islandora:',

126
islandora.module

@ -3,7 +3,8 @@
/**
* @file
*
* islandora.module: defines paths (drupal menu items) as entry points and acts as a hub for dispatching tasks to other modules.
* islandora.module: defines paths (drupal menu items) as entry points and acts
* as a hub for dispatching tasks to other modules.
*
* This file is part of Islandora.
*
@ -49,7 +50,8 @@ define('ISLANDORA_EDIT_DATASTREAM_HOOK', 'islandora_edit_datastream');
/**
* Implements hook_menu().
*
* We need some standard entry points so we can have consistent urls for different Object actions
* We need some standard entry points so we can have consistent urls for
* different Object actions
*/
function islandora_menu() {
$items = array();
@ -290,16 +292,20 @@ function islandora_forms($form_id) {
}
/**
* Checks whether the user can access the given object with the given permission.
* Checks whether the user can access the given object with the given
* permission.
*
* Checks for object existance, accessiblitly, namespace permissions, and user permissions
* Checks for object existance, accessiblitly, namespace permissions,
* and user permissions
*
* @see islandora_object_load() To find potential solutions to enable page not found errors.
* @see islandora_object_load() To find potential solutions to enable
* page not found errors.
*
* @param string $perm
* The user permission to test for.
* @param FedoraObject $object
* The object to test, if NULL given the object doesn't exist or is inaccessible.
* The object to test, if NULL given the object doesn't exist or is
* inaccessible.
*
* @return boolean
* TRUE if the user is allowed to access this object, FALSE otherwise.
@ -310,18 +316,23 @@ function islandora_object_access_callback($perm, $object = NULL) {
}
/**
* Checks whether the user can access the given object and datastream with the given permission.
* Checks whether the user can access the given object and datastream with
* the given permission.
*
* Checks for object existance, accessiblitly, namespace permissions, and user permissions
* Checks for object existance, accessiblitly, namespace permissions,
* and user permissions
*
* @see islandora_object_load() To find potential solutions to enable page not found errors.
* @see islandora_object_load() To find potential solutions to enable page
* not found errors.
*
* @param string $perm
* The user permission to test for.
* @param FedoraObject $object
* The object to test, if NULL given the object doesn't exist or is inaccessible.
* The object to test, if NULL given the object doesn't exist or is
* inaccessible.
* @param FedoraDatastream $datastream
* The datastream to test, if NULL given the datastream doesn't exist or is inaccessible.
* The datastream to test, if NULL given the datastream doesn't exist
* or is inaccessible.
*
* @return boolean
* TRUE if the user is allowed to access this object, FALSE otherwise.
@ -332,10 +343,13 @@ function islandora_object_datastream_access_callback($perm, $object = NULL, $dat
}
/**
* Renders the given objects manage page. Its possible to modify the output of this function if 'ISLANDORA_EDIT_HOOK' is
* implemented in other modules.
* Renders the given objects manage page.
*
* If no modules implement 'ISLANDORA_EDIT_HOOK' then this function returns the default manage view.
* Its possible to modify the output of this function if 'ISLANDORA_EDIT_HOOK'
* is implemented in other modules.
*
* If no modules implement 'ISLANDORA_EDIT_HOOK' then this function returns the
* default manage view.
*
* @param FedoraObject $object
* The object to manage.
@ -353,7 +367,8 @@ function islandora_edit_object(FedoraObject $object) {
}
}
if (empty($output)) {
$output = islandora_default_islandora_edit_object($object); // Add in the default, if we did not get any results.
// Add in the default, if we did not get any results.
$output = islandora_default_islandora_edit_object($object);
}
arsort($output);
drupal_alter(ISLANDORA_EDIT_HOOK, $object, $output);
@ -367,7 +382,8 @@ function islandora_edit_object(FedoraObject $object) {
* The object used to render the manage object page.
*
* @return array
* The default rendering of the object manage page, indexed at 'Default Edit output'.
* The default rendering of the object manage page, indexed at
* 'Default Edit output'.
*/
function islandora_default_islandora_edit_object(FedoraObject $object) {
$output = theme('islandora_default_edit', array('islandora_object' => $object));
@ -377,7 +393,8 @@ function islandora_default_islandora_edit_object(FedoraObject $object) {
/**
* Page callback for the path "islandora".
*
* Redirects to the view of the object indicated by the Drupal variable 'islandora_repository_pid'.
* Redirects to the view of the object indicated by the Drupal variable
* 'islandora_repository_pid'.
*/
function islandora_view_default_object() {
$pid = variable_get('islandora_repository_pid', 'islandora:root');
@ -387,10 +404,11 @@ function islandora_view_default_object() {
/**
* Renders the default view object page for the given object.
*
* Modules should implement ISLANDORA_VIEW_HOOK for the Fedora Content models that
* their modules want to provide a view for.
* Modules should implement ISLANDORA_VIEW_HOOK for the Fedora Content
* models that their modules want to provide a view for.
*
* If no modules implement the hook then the default view object page will be rendered.
* If no modules implement the hook then the default view object page
* will be rendered.
*
* @param FedoraObject $object
* The object to view.
@ -407,13 +425,16 @@ function islandora_view_object(FedoraObject $object) {
$page_size = (empty($_GET['pagesize'])) ? '10' : $_GET['pagesize'];
$output = array();
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
// hook should use drupal page handling directly.
$temp = module_invoke_all($hook, $object, $page_number, $page_size);
if (!empty($temp)) {
$output = array_merge_recursive($output, $temp);
}
}
if (empty($output)) {
$output = islandora_default_islandora_view_object($object); // No results, use the default view.
// No results, use the default view.
$output = islandora_default_islandora_view_object($object);
}
arsort($output);
drupal_alter(ISLANDORA_VIEW_HOOK, $object, $output);
@ -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!
*
* When this function returns FALSE the Drupal menu system will issues a "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.
* When this function returns FALSE the Drupal menu system will issues a
* "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,
* as the access function will not be aware of this fact and will trigger the display of the "access denied" page.
* This will currently display a message if the repository is inaccessable,
* 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
* The pid of an object in the menu path identified by '%islandora_object'.
*
* @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
* object was inaccessible then NULL is returned, and the access callback is expected to catch that case, triggering drupal_access_denied().
* 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 object was inaccessible then NULL is returned, and the
* access callback is expected to catch that case, triggering
* drupal_access_denied().
*/
function islandora_object_load($object_id) {
static $object = NULL, $load_failed = FALSE; // Assume inaccessible.
@ -471,46 +503,49 @@ function islandora_object_load($object_id) {
}
/**
* A helper function to get an datastream specified as '%islandora_datastream' for the object specified in the menu path as '%islandora_object'.
* A helper function to get an datastream specified as '%islandora_datastream'
* for the object specified in the menu path as '%islandora_object'.
*
* This should only be used by the Drupal menu wildcard system! As for non existing datastreams this will return page not found.
* This should only be used by the Drupal menu wildcard system!
*
* The following settings are required for any menu paths which intent to use this auto loader.
* The following settings are required for any menu paths which intent to use
* this auto loader.
*
* @code
* 'load arguments' => array('%map'),
* @endcode
*
* @see islandora_object_load() for solutions to access/not found problems.
*
* @todo For non accessible datastreams to the user this should return access denied.
* @todo Is there anything we can do to enhance caching?
* Its up to the access callbacks and menu callbacks to trigger
* drupal_access_denied() when appropriate.
*
* @param string $datastream_id
* The dsid of the datastream specified as '%islandora_datastream' to fetch from the given object in the menu path identified by '%islandora_object'.
* The dsid of the datastream specified as '%islandora_datastream' to fetch
* from the given object in the menu path identified by '%islandora_object'.
*
* @return FedoraDatastream
* If the given datastream id exists in the object then this returns a FedoraDatastream, in other cases this aborts.
* If the given datastream ID exists then this returns a FedoraDatastream
* object, otherwise it returns NULL which triggers drupal_page_not_found().
*/
function islandora_datastream_load($datastream_id, $map) {
static $datastream = NULL, $load_failed = FALSE; // @hack for bug in drupal_not_found() when used before the menu callback. Infinite recursion bug.
static $datastream = NULL, $load_failed = FALSE;
if ($load_failed || isset($datastream)) {
return $datastream;
}
foreach ($map as $element) {
$is_fedora_object = is_object($element) && strtolower(get_class($element)) == 'fedoraobject'; // @todo Probably a better way to check types by now.
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.
$is_fedora_object = is_object($element) && strtolower(get_class($element)) == 'fedoraobject';
if ($is_fedora_object && isset($element[$datastream_id])) {
$datastream = $element[$datastream_id];
return $datastream;
}
}
$load_failed = TRUE;
return $datastream; // @todo Test
return $datastream;
}
/**
* Content model, collection view and collection policy datastreams may now optionally define a version
* number in their top-level XML element as an attribute, as in:
* Content model, collection view and collection policy datastreams may now
* optionally define a version number in their top-level XML element as an
* attribute, as in:
* <content_model name="Collection" version="2" ...
*
* @param object $item
@ -540,7 +575,6 @@ function islandora_get_islandora_datastream_version($item = NULL, $dsid = NULL,
* Implements hook_islandora_required_objects().
*/
function islandora_islandora_required_objects() {
// module path
$module_path = drupal_get_path('module', 'islandora');
return array(
'islandora' => array(

8
theme/islandora-object-edit.tpl.php

@ -2,8 +2,9 @@
/**
* @file
* islandora-object-edit.tpl.php: This is a template for objects that do not have
* a module to registered to build their display.
*
* islandora-object-edit.tpl.php: This is a template for objects that do not
* have a module to registered to build their display.
*
* islandora_object is a fedora tuque Object
* $object->label
@ -13,7 +14,8 @@
*
* $dublin_core is a DublinCore object
* which is an array of elements, such as dc.title
* and each element has an array of values. dc.title can have none, one or many titles
* and each element has an array of values.
* dc.title can have none, one or many titles
* this is the case for all dc elements.
*
*/

15
theme/islandora-object.tpl.php

@ -1,8 +1,10 @@
<?php
/*
/**
* @file
* This is a template for objects that do not have a module to registered to build their display.
*
* This is a template for objects that do not have a module to registered to
* build their display.
*
* islandora_object is a fedora tuque Object
* $object->label - The label for this object.
@ -35,13 +37,16 @@
* $ds->size - The size of the datastream
* $ds->checksum - The checksum of the datastream
* $ds->checksumType - The type of checksum for the datastream.
* $ds->createdDate->format("Y-m-d") - The created date with an option to use a format of your choice
* $ds->createdDate->format("Y-m-d") - The created date with an option to use
* a format of your choice
* $ds->content - The content of the datastream
* $ds->url - The URL. This is only valid for R and E datastreams.
* $ds->url - The URL. This is only valid for R and E
* datastreams.
*
* $dublin_core is a DublinCore object
* which is an array of elements, such as dc.title
* and each element has an array of values. dc.title can have none, one or many titles
* and each element has an array of values.
* dc.title can have none, one or many titles
* this is the case for all dc elements.
*
*

6
theme/islandora.theme.inc

@ -2,6 +2,7 @@
/**
* @file
*
* This file contains all theme and preprocess functions.
*/
@ -13,13 +14,12 @@
* theme variables for the edit template
*/
function islandora_preprocess_islandora_default_edit(&$variables) {
$islandora_object = $variables['islandora_object'];
global $base_url;
$islandora_object = $variables['islandora_object'];
$datastreams = array();
$variables['islandora_editmetadata_url'] = $base_url . '/islandora/edit_form/' . $islandora_object->id;
module_load_include('inc', 'islandora', 'includes/datastream');
module_load_include('inc', 'islandora', 'includes/utilities');
// $variables['add_datastream_form'] = drupal_get_form('islandora_add_datastream_form', $islandora_object->id);
$header = array(
array('data' => t('ID')),
array('data' => t('Label')),
@ -27,7 +27,6 @@ function islandora_preprocess_islandora_default_edit(&$variables) {
array('data' => t('Mime type')),
array('data' => t('Size')),
array('data' => t('Operations'), 'colspan' => '3'),
//array('data' => t('Delete')),
);
$table_attributes = array('class' => array('manage-datastreams'));
$rows = array();
@ -87,7 +86,6 @@ function islandora_preprocess_islandora_default(&$variables) {
$variables['datastreams'] = $datastreams;
try {
$dc = $islandora_object['DC']->content;
//$dc_xml = simplexml_load_string($dc);
$dc_object = DublinCore::import_from_xml_string($dc);
$dc_array = $dc_object->as_formatted_array();
} catch (Exception $e) {

Loading…
Cancel
Save