Browse Source

Merge branch '7.x' of github.com:Islandora/islandora into 7.x-print-class

pull/582/head
MorganDawe 10 years ago
parent
commit
c45325fae4
  1. 6
      includes/admin.form.inc
  2. 1
      includes/ingest.form.inc
  3. 10
      includes/utilities.inc
  4. 30
      islandora.module
  5. 1
      js/spinner.js

6
includes/admin.form.inc

@ -68,6 +68,12 @@ function islandora_repository_admin(array $form, array &$form_state) {
useful if derivatives are to be created by an external service.'),
'#default_value' => variable_get('islandora_defer_derivatives_on_ingest', FALSE),
),
'islandora_show_print_option' => array(
'#type' => 'checkbox',
'#title' => t('Show print option on objects'),
'#description' => t('Displays an extra print tab, allowing an object to be printed'),
'#default_value' => variable_get('islandora_show_print_option', FALSE),
),
),
'islandora_namespace' => array(
'#type' => 'fieldset',

1
includes/ingest.form.inc

@ -762,6 +762,7 @@ function islandora_ingest_form_ingest_button_process(array $element) {
"$islandora_path/js/spinner.js",
),
);
$element['#attributes']['class'][] = 'islandora-spinner-submit';
return $element;
}

10
includes/utilities.inc

@ -72,6 +72,9 @@ function islandora_temp_file_entry($file_uri, $mime = NULL) {
if (isset($mime)) {
$file->filemime = $mime;
}
else {
$file->filemime = file_get_mimetype($file_uri);
}
}
$file->status = 0;
return file_save($file);
@ -194,12 +197,15 @@ function islandora_invoke_hook_list($hook, array $refinements, array $args) {
$return = array_merge_recursive($return, $result);
array_shift($args);
}
if (module_exists('rules') && $event = rules_get_cache("event_$hook")) {
$parameters = $event->parameterInfo();
if (module_exists('rules')) {
$event_info = rules_get_event_info($hook);
if (isset($event_info['module'])) {
$parameters = $event_info['variables'];
$rule_args = array_slice($args, 0, count($parameters));
array_unshift($rule_args, $hook);
$result = call_user_func_array('rules_invoke_event', $rule_args);
}
}
return $return;
}

30
islandora.module

@ -147,7 +147,7 @@ function islandora_menu() {
'page callback' => 'islandora_printer_object',
'page arguments' => array(2),
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_object_access',
'access callback' => 'islandora_print_object_access',
'access arguments' => array(ISLANDORA_VIEW_OBJECTS, 2),
);
$items['islandora/object/%islandora_object/print'] = array(
@ -663,6 +663,31 @@ function islandora_print_object(AbstractObject $object) {
return theme('islandora_object_print', array('object' => $object));
}
/**
* View print tab access.
*
* Configurable option in islandora configuration.
*
* @param string $op
* String identifying an operation to check. Should correspond to a
* permission declared via hook_permission().
* @param AbstractObject $object
* An object to check for permissions.
*
* @return bool
* TRUE if at least one implementation of hook_islandora_object_access()
* returned TRUE, and no implementation return FALSE; FALSE otherwise, or
* FALSE if 'islandora_show_print_option' is not selected in islandora
* configuraton.
*/
function islandora_print_object_access($op, $object) {
if (!variable_get('islandora_show_print_option', FALSE)) {
return FALSE;
}
$access = islandora_object_access($op, $object);
return $access;
}
/**
* Implements hook_forms().
*/
@ -1070,6 +1095,7 @@ function islandora_view_object(AbstractObject $object) {
function islandora_printer_object(AbstractObject $object) {
$output = array();
$temp_arr = array();
// Dispatch print hook.
foreach (islandora_build_hook_list(ISLANDORA_PRINT_HOOK, $object->models) as $hook) {
$temp = module_invoke_all($hook, $object);
@ -1950,7 +1976,7 @@ function islandora_islandora_datastream_access($op, AbstractDatastream $datastre
$hooks = islandora_invoke_hook_list(ISLANDORA_DERVIATIVE_CREATION_HOOK, $object->models, array($object));
$hooks = islandora_filter_derivatives($hooks, array('force' => TRUE), $object);
foreach ($hooks as $hook) {
if ($hook['destination_dsid'] == $datastream->id &&
if (isset($hook['destination_dsid']) && $hook['destination_dsid'] == $datastream->id &&
(is_null($hook['source_dsid']) || islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $object[$hook['source_dsid']], $user))) {
$applicable_hook = TRUE;
break;

1
js/spinner.js

@ -44,6 +44,7 @@
spinner.spin(this);
$('#edit-next').hide();
$('#edit-prev').hide();
$('.islandora-spinner-submit').hide();
// Submit the form after a set timeout, this handles problems with
// safari, in that safari submits immediately..
if (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1) {

Loading…
Cancel
Save