@ -24,16 +24,17 @@
*/
*/
// Common datastreams.
// Common datastreams.
define('DS_COMP_STREAM', 'DS-COMPOSITE-MODEL');
define('ISLANDORA_ DS_COMP_STREAM', 'DS-COMPOSITE-MODEL');
// Permissions.
// Permissions.
define('FE DORA_VIEW_OBJECTS', 'view fedora repository objects');
define('ISLAN DORA_VIEW_OBJECTS', 'view fedora repository objects');
define('FE DORA_METADATA_EDIT', 'edit fedora metadata');
define('ISLAN DORA_METADATA_EDIT', 'edit fedora metadata');
define('FE DORA_ADD_DS', 'add fedora datastreams');
define('ISLAN DORA_ADD_DS', 'add fedora datastreams');
define('FE DORA_INGEST', 'ingest fedora objects');
define('ISLAN DORA_INGEST', 'ingest fedora objects');
define('FE DORA_PURGE', 'delete fedora objects and datastreams');
define('ISLAN DORA_PURGE', 'delete fedora objects and datastreams');
define('FE DORA_MANAGE_PROPERTIES', 'manage object properties');
define('ISLAN DORA_MANAGE_PROPERTIES', 'manage object properties');
define('ISLANDORA_VIEW_DATASTREAM_HISTORY', 'view old datastream versions');
define('ISLANDORA_VIEW_DATASTREAM_HISTORY', 'view old datastream versions');
define('ISLANDORA_REVERT_DATASTREAM', 'revert to old datastream');
// Hooks.
// Hooks.
define('ISLANDORA_VIEW_HOOK', 'islandora_view_object');
define('ISLANDORA_VIEW_HOOK', 'islandora_view_object');
@ -53,10 +54,24 @@ define('ISLANDORA_DATASTREAM_INGESTED_HOOK', 'islandora_datastream_ingested');
define('ISLANDORA_DATASTREAM_MODIFIED_HOOK', 'islandora_datastream_modified');
define('ISLANDORA_DATASTREAM_MODIFIED_HOOK', 'islandora_datastream_modified');
define('ISLANDORA_DATASTREAM_PURGED_HOOK', 'islandora_datastream_purged');
define('ISLANDORA_DATASTREAM_PURGED_HOOK', 'islandora_datastream_purged');
define('ISLANDORA_INGEST_STEP_HOOK', 'islandora_ingest_steps');
define('ISLANDORA_INGEST_STEP_HOOK', 'islandora_ingest_steps');
define('ISLANDORA_DERVIATIVE_CREATION_HOOK', 'islandora_derivative');
// Autocomplete paths.
// Autocomplete paths.
define('ISLANDORA_CONTENT_MODELS_AUTOCOMPLETE', 'islandora/autocomplete/content-models');
define('ISLANDORA_CONTENT_MODELS_AUTOCOMPLETE', 'islandora/autocomplete/content-models');
/**
* @deprecated Constants.
*/
// @codingStandardsIgnoreStart
define('DS_COMP_STREAM', ISLANDORA_DS_COMP_STREAM);
define('FEDORA_VIEW_OBJECTS', ISLANDORA_VIEW_OBJECTS);
define('FEDORA_METADATA_EDIT', ISLANDORA_METADATA_EDIT);
define('FEDORA_ADD_DS', ISLANDORA_ADD_DS);
define('FEDORA_INGEST', ISLANDORA_INGEST);
define('FEDORA_PURGE', ISLANDORA_PURGE);
define('FEDORA_MANAGE_PROPERTIES', ISLANDORA_MANAGE_PROPERTIES);
// @codingStandardsIgnoreEnd
/**
/**
* Implements hook_menu().
* Implements hook_menu().
*
*
@ -85,7 +100,7 @@ function islandora_menu() {
'title' => 'Solution packs',
'title' => 'Solution packs',
'description' => 'Install content models and collections required by installed solution packs.',
'description' => 'Install content models and collections required by installed solution packs.',
'page callback' => 'islandora_solution_packs_admin',
'page callback' => 'islandora_solution_packs_admin',
'access arguments' => array(FE DORA_ADD_DS),
'access arguments' => array(ISLAN DORA_ADD_DS),
'file' => 'includes/solution_packs.inc',
'file' => 'includes/solution_packs.inc',
'type' => MENU_NORMAL_ITEM,
'type' => MENU_NORMAL_ITEM,
);
);
@ -93,7 +108,7 @@ function islandora_menu() {
'title' => 'Islandora Repository',
'title' => 'Islandora Repository',
'page callback' => 'islandora_view_default_object',
'page callback' => 'islandora_view_default_object',
'type' => MENU_NORMAL_ITEM,
'type' => MENU_NORMAL_ITEM,
'access arguments' => array(FE DORA_VIEW_OBJECTS),
'access arguments' => array(ISLAN DORA_VIEW_OBJECTS),
);
);
$items['islandora/object/%islandora_object'] = array(
$items['islandora/object/%islandora_object'] = array(
'title callback' => 'islandora_drupal_title',
'title callback' => 'islandora_drupal_title',
@ -102,14 +117,23 @@ function islandora_menu() {
'page arguments' => array(2),
'page arguments' => array(2),
'type' => MENU_NORMAL_ITEM,
'type' => MENU_NORMAL_ITEM,
'access callback' => 'islandora_object_access_callback',
'access callback' => 'islandora_object_access_callback',
'access arguments' => array(FE DORA_VIEW_OBJECTS, 2),
'access arguments' => array(ISLAN DORA_VIEW_OBJECTS, 2),
);
);
$items['islandora/object/%islandora_object/print'] = array(
$items['islandora/object/%islandora_object/print_object '] = array(
'page callback' => 'islandora_printer_object',
'page callback' => 'islandora_printer_object',
'page arguments' => array(2),
'page arguments' => array(2),
'type' => MENU_NORMAL_ITEM,
'type' => MENU_NORMAL_ITEM,
'access callback' => 'islandora_object_access_callback',
'access callback' => 'islandora_object_access',
'access arguments' => array(FEDORA_VIEW_OBJECTS, 2),
'access arguments' => array(ISLANDORA_VIEW_OBJECTS, 2),
);
$items['islandora/object/%islandora_object/print'] = array(
'title' => 'Print Object',
'page callback' => 'islandora_print_object',
'page arguments' => array(2),
'type' => MENU_CALLBACK,
'access callback' => 'islandora_object_access',
'access arguments' => array(ISLANDORA_VIEW_OBJECTS, 2),
'load arguments' => array(2),
);
);
$items['islandora/object/%islandora_object/view'] = array(
$items['islandora/object/%islandora_object/view'] = array(
'title' => 'View',
'title' => 'View',
@ -129,20 +153,18 @@ function islandora_menu() {
'access callback' => 'islandora_object_manage_access_callback',
'access callback' => 'islandora_object_manage_access_callback',
'access arguments' => array(
'access arguments' => array(
array(
array(
FE DORA_MANAGE_PROPERTIES,
ISLAN DORA_MANAGE_PROPERTIES,
FE DORA_METADATA_EDIT,
ISLAN DORA_METADATA_EDIT,
FE DORA_ADD_DS,
ISLAN DORA_ADD_DS,
FE DORA_PURGE,
ISLAN DORA_PURGE,
FE DORA_INGEST,
ISLAN DORA_INGEST,
), 2),
), 2),
);
);
$items['islandora/object/%islandora_object/manage/overview'] = array(
$items['islandora/object/%islandora_object/manage/overview'] = array(
'title' => 'Overview',
'title' => 'Overview',
'type' => MENU_DEFAULT_LOCAL_TASK,
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -20,
'weight' => -20,
);
);
$items['islandora/object/%islandora_object/manage/datastreams'] = array(
$items['islandora/object/%islandora_object/manage/datastreams'] = array(
'title' => 'Datastreams',
'title' => 'Datastreams',
'type' => MENU_LOCAL_TASK,
'type' => MENU_LOCAL_TASK,
@ -151,13 +173,12 @@ function islandora_menu() {
'access callback' => 'islandora_object_manage_access_callback',
'access callback' => 'islandora_object_manage_access_callback',
'access arguments' => array(
'access arguments' => array(
array(
array(
FE DORA_METADATA_EDIT,
ISLAN DORA_METADATA_EDIT,
FE DORA_ADD_DS,
ISLAN DORA_ADD_DS,
FE DORA_PURGE,
ISLAN DORA_PURGE,
), 2),
), 2),
'weight' => -10,
'weight' => -10,
);
);
$items['islandora/object/%islandora_object/manage/properties'] = array(
$items['islandora/object/%islandora_object/manage/properties'] = array(
'title' => 'Properties',
'title' => 'Properties',
'page callback' => 'drupal_get_form',
'page callback' => 'drupal_get_form',
@ -165,7 +186,7 @@ function islandora_menu() {
'page arguments' => array('islandora_object_properties_form', 2),
'page arguments' => array('islandora_object_properties_form', 2),
'type' => MENU_LOCAL_TASK,
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_object_access_callback',
'access callback' => 'islandora_object_access_callback',
'access arguments' => array(FE DORA_MANAGE_PROPERTIES, 2),
'access arguments' => array(ISLAN DORA_MANAGE_PROPERTIES, 2),
'weight' => -5,
'weight' => -5,
);
);
$items['islandora/object/%islandora_object/delete'] = array(
$items['islandora/object/%islandora_object/delete'] = array(
@ -175,7 +196,7 @@ function islandora_menu() {
'page arguments' => array('islandora_delete_object_form', 2),
'page arguments' => array('islandora_delete_object_form', 2),
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'access callback' => 'islandora_object_access_callback',
'access callback' => 'islandora_object_access_callback',
'access arguments' => array(FE DORA_PURGE, 2),
'access arguments' => array(ISLAN DORA_PURGE, 2),
);
);
$items['islandora/object/%islandora_object/manage/datastreams/add'] = array(
$items['islandora/object/%islandora_object/manage/datastreams/add'] = array(
'title' => 'Add a datastream',
'title' => 'Add a datastream',
@ -184,7 +205,7 @@ function islandora_menu() {
'page arguments' => array('islandora_add_datastream_form', 2),
'page arguments' => array('islandora_add_datastream_form', 2),
'type' => MENU_LOCAL_ACTION,
'type' => MENU_LOCAL_ACTION,
'access callback' => 'islandora_object_access_callback',
'access callback' => 'islandora_object_access_callback',
'access arguments' => array(FE DORA_ADD_DS, 2),
'access arguments' => array(ISLAN DORA_ADD_DS, 2),
);
);
$items['islandora/object/%islandora_object/manage/datastreams/add/autocomplete'] = array(
$items['islandora/object/%islandora_object/manage/datastreams/add/autocomplete'] = array(
'file' => 'includes/add_datastream.form.inc',
'file' => 'includes/add_datastream.form.inc',
@ -192,7 +213,7 @@ function islandora_menu() {
'page arguments' => array(2),
'page arguments' => array(2),
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'access callback' => 'islandora_object_access_callback',
'access callback' => 'islandora_object_access_callback',
'access arguments' => array(FE DORA_ADD_DS, 2),
'access arguments' => array(ISLAN DORA_ADD_DS, 2),
);
);
$items['islandora/object/%islandora_object/datastream/%islandora_datastream'] = array(
$items['islandora/object/%islandora_object/datastream/%islandora_datastream'] = array(
'title' => 'View datastream',
'title' => 'View datastream',
@ -201,7 +222,7 @@ function islandora_menu() {
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'file' => 'includes/datastream.inc',
'file' => 'includes/datastream.inc',
'access callback' => 'islandora_datastream_access',
'access callback' => 'islandora_datastream_access',
'access arguments' => array(FE DORA_VIEW_OBJECTS, 4),
'access arguments' => array(ISLAN DORA_VIEW_OBJECTS, 4),
'load arguments' => array(2),
'load arguments' => array(2),
);
);
// This menu item uses token authentication in islandora_tokened_object.
// This menu item uses token authentication in islandora_tokened_object.
@ -209,7 +230,7 @@ function islandora_menu() {
'title' => 'View datastream',
'title' => 'View datastream',
'load arguments' => array('%map'),
'load arguments' => array('%map'),
'access callback' => 'islandora_object_datastream_tokened_access_callback',
'access callback' => 'islandora_object_datastream_tokened_access_callback',
'access arguments' => array(FE DORA_VIEW_OBJECTS, 2, 4),
'access arguments' => array(ISLAN DORA_VIEW_OBJECTS, 2, 4),
'type' => MENU_DEFAULT_LOCAL_TASK,
'type' => MENU_DEFAULT_LOCAL_TASK,
);
);
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/download'] = array(
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/download'] = array(
@ -219,7 +240,7 @@ function islandora_menu() {
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'file' => 'includes/datastream.inc',
'file' => 'includes/datastream.inc',
'access callback' => 'islandora_datastream_access',
'access callback' => 'islandora_datastream_access',
'access arguments' => array(FE DORA_VIEW_OBJECTS, 4),
'access arguments' => array(ISLAN DORA_VIEW_OBJECTS, 4),
'load arguments' => array(2),
'load arguments' => array(2),
);
);
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/edit'] = array(
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/edit'] = array(
@ -229,7 +250,7 @@ function islandora_menu() {
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'file' => 'includes/datastream.inc',
'file' => 'includes/datastream.inc',
'access callback' => 'islandora_datastream_access',
'access callback' => 'islandora_datastream_access',
'access arguments' => array(FE DORA_METADATA_EDIT, 4),
'access arguments' => array(ISLAN DORA_METADATA_EDIT, 4),
'load arguments' => array(2),
'load arguments' => array(2),
);
);
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/delete'] = array(
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/delete'] = array(
@ -239,7 +260,7 @@ function islandora_menu() {
'file' => 'includes/delete_datastream.form.inc',
'file' => 'includes/delete_datastream.form.inc',
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'access callback' => 'islandora_datastream_access',
'access callback' => 'islandora_datastream_access',
'access arguments' => array(FE DORA_PURGE, 4),
'access arguments' => array(ISLAN DORA_PURGE, 4),
'load arguments' => array(2),
'load arguments' => array(2),
);
);
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/version'] = array(
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/version'] = array(
@ -259,7 +280,17 @@ function islandora_menu() {
'file' => 'includes/datastream.version.inc',
'file' => 'includes/datastream.version.inc',
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'access callback' => 'islandora_datastream_access',
'access callback' => 'islandora_datastream_access',
'access arguments' => array(FEDORA_PURGE, 4),
'access arguments' => array(ISLANDORA_PURGE, 4),
'load arguments' => array(2),
);
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/version/%/revert'] = array(
'title' => 'Revert to datastream version',
'page arguments' => array('islandora_revert_datastream_version_form', 4, 6),
'page callback' => 'drupal_get_form',
'file' => 'includes/datastream.version.inc',
'type' => MENU_CALLBACK,
'access callback' => 'islandora_datastream_access',
'access arguments' => array(ISLANDORA_REVERT_DATASTREAM, 4),
'load arguments' => array(2),
'load arguments' => array(2),
);
);
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/version/%/view'] = array(
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/version/%/view'] = array(
@ -277,7 +308,7 @@ function islandora_menu() {
'page arguments' => array(2),
'page arguments' => array(2),
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'access callback' => 'islandora_object_access',
'access callback' => 'islandora_object_access',
'access arguments' => array(FE DORA_VIEW_OBJECTS, 2),
'access arguments' => array(ISLAN DORA_VIEW_OBJECTS, 2),
'load arguments' => array(2),
'load arguments' => array(2),
);
);
$items[ISLANDORA_CONTENT_MODELS_AUTOCOMPLETE] = array(
$items[ISLANDORA_CONTENT_MODELS_AUTOCOMPLETE] = array(
@ -326,8 +357,13 @@ function islandora_theme() {
'file' => 'includes/solution_packs.inc',
'file' => 'includes/solution_packs.inc',
'render element' => 'form',
'render element' => 'form',
),
),
// Print object view .
// Print used by the clipper .
'islandora_object_print' => array(
'islandora_object_print' => array(
'file' => 'theme/theme.inc',
'variables' => array('object' => NULL, 'content' => array()),
),
// Print object view, prints islandora objects.
'islandora_object_print_object' => array(
'file' => 'theme/theme.inc',
'file' => 'theme/theme.inc',
'template' => 'theme/islandora-object-print',
'template' => 'theme/islandora-object-print',
'variables' => array(
'variables' => array(
@ -366,6 +402,10 @@ function islandora_theme() {
'file' => 'theme/theme.inc',
'file' => 'theme/theme.inc',
'variables' => array('datastream' => NULL, 'version' => NULL),
'variables' => array('datastream' => NULL, 'version' => NULL),
),
),
'islandora_datastream_revert_link' => array(
'file' => 'theme/theme.inc',
'variables' => array('datastream' => NULL, 'version' => NULL),
),
'islandora_datastream_view_link' => array(
'islandora_datastream_view_link' => array(
'file' => 'theme/theme.inc',
'file' => 'theme/theme.inc',
'variables' => array(
'variables' => array(
@ -390,27 +430,27 @@ function islandora_theme() {
*/
*/
function islandora_permission() {
function islandora_permission() {
return array(
return array(
FE DORA_VIEW_OBJECTS => array(
ISLAN DORA_VIEW_OBJECTS => array(
'title' => t('View repository objects'),
'title' => t('View repository objects'),
'description' => t('View objects in the repository. Note: Fedora XACML security policies may override this permission.'),
'description' => t('View objects in the repository. Note: Fedora XACML security policies may override this permission.'),
),
),
FE DORA_ADD_DS => array(
ISLAN DORA_ADD_DS => array(
'title' => t('Add datastreams to repository objects'),
'title' => t('Add datastreams to repository objects'),
'description' => t('Add datastreams to objects in the repository. Note: Fedora XACML security policies may override this position.'),
'description' => t('Add datastreams to objects in the repository. Note: Fedora XACML security policies may override this position.'),
),
),
FE DORA_METADATA_EDIT => array(
ISLAN DORA_METADATA_EDIT => array(
'title' => t('Edit metadata'),
'title' => t('Edit metadata'),
'description' => t('Edit metadata for objects in the repository.'),
'description' => t('Edit metadata for objects in the repository.'),
),
),
FE DORA_INGEST => array(
ISLAN DORA_INGEST => array(
'title' => t('Create new repository objects'),
'title' => t('Create new repository objects'),
'description' => t('Create new objects in the repository.'),
'description' => t('Create new objects in the repository.'),
),
),
FE DORA_PURGE => array(
ISLAN DORA_PURGE => array(
'title' => t('Permanently remove objects from the repository'),
'title' => t('Permanently remove objects from the repository'),
'description' => t('Permanently remove objects from the repository.'),
'description' => t('Permanently remove objects from the repository.'),
),
),
FE DORA_MANAGE_PROPERTIES => array(
ISLAN DORA_MANAGE_PROPERTIES => array(
'title' => t('Manage object properties'),
'title' => t('Manage object properties'),
'description' => t('Modify object labels, owner IDs, and states.'),
'description' => t('Modify object labels, owner IDs, and states.'),
),
),
@ -418,9 +458,29 @@ function islandora_permission() {
'title' => t('View datastream history'),
'title' => t('View datastream history'),
'description' => t('View all previous versions of a datastream.'),
'description' => t('View all previous versions of a datastream.'),
),
),
ISLANDORA_REVERT_DATASTREAM => array(
'title' => t('Revert datastream history'),
'description' => t('Revert to a previous version of a datastream.'),
),
);
);
}
}
/**
* Renders the print page for the given object.
*
* Modules can either implement preprocess functions to append content onto the
* 'content' variable, or override the display by providing a theme suggestion.
*
* @param AbstractObject $object
* The object.
*
* @return array
* A renderable array.
*/
function islandora_print_object(AbstractObject $object) {
drupal_set_title($object->label);
return theme('islandora_object_print', array('object' => $object));
}
/**
/**
* Implements hook_forms().
* Implements hook_forms().
*/
*/
@ -802,7 +862,7 @@ function islandora_view_object(AbstractObject $object) {
drupal_add_js(array(
drupal_add_js(array(
'islandora' => array(
'islandora' => array(
'print_link' => '/ islandora/object/' . $object->id . '/print')),
'print_link' => 'islandora/object/' . $object->id . '/print_objec t')),
array('type' => 'setting'));
array('type' => 'setting'));
drupal_add_js($path . '/js/add_print.js');
drupal_add_js($path . '/js/add_print.js');
@ -935,7 +995,7 @@ function islandora_default_islandora_printer_object($object, $alter) {
}
}
$variables = isset($dc_object) ? $dc_object->asArray() : array();
$variables = isset($dc_object) ? $dc_object->asArray() : array();
$output = theme('islandora_object_print', array(
$output = theme('islandora_object_print_object ', array(
'object' => $object,
'object' => $object,
'dc_array' => $variables,
'dc_array' => $variables,
'islandora_content' => $alter));
'islandora_content' => $alter));
@ -1492,3 +1552,49 @@ function islandora_islandora_basic_collection_get_query_filters() {
));
));
}
}
}
}
/**
* Implements hook_islandora_object_ingested().
*
* On object ingestion we call the case of source_dsid being NULL only as
* the islandora_islandora_datastream_ingested hook will handle the cases
* where specific values of source_dsid can occur.
*/
function islandora_islandora_object_ingested(AbstractObject $object) {
module_load_include('inc', 'islandora', 'includes/derivatives');
$logging_results = islandora_do_derivatives($object, array(
'source_dsid' => NULL,
));
islandora_derivative_logging($logging_results);
}
/**
* Implements hook_islandora_datastream_ingested().
*
* When a datastream is ingested we filter the derivatives on source_dsid being
* equal to the current ingested datastream's id.
*/
function islandora_islandora_datastream_ingested(AbstractObject $object, AbstractDatastream $datastream) {
module_load_include('inc', 'islandora', 'includes/derivatives');
$logging_results = islandora_do_derivatives($object, array(
'source_dsid' => $datastream->id,
));
islandora_derivative_logging($logging_results);
}
/**
* Implements hook_islandora_datastream_modified().
*
* When a datastream is modified we filter the derivatives on source_dsid being
* equal to the current ingested datastream's id. Force is set to TRUE such that
* existing derivatives will be updated to reflect the change in the source.
*/
function islandora_islandora_datastream_modified(AbstractObject $object, AbstractDatastream $datastream) {
module_load_include('inc', 'islandora', 'includes/derivatives');
$logging_results = islandora_do_derivatives($object, array(
'source_dsid' => $datastream->id,
'force' => TRUE,
));
islandora_derivative_logging($logging_results);
}