Browse Source

Merge branch 'qadan-7.x' into 7.x

pull/507/head
qadan 11 years ago
parent
commit
6a94a5e542
  1. 38
      includes/datastream.version.inc
  2. 3
      includes/derivatives.inc

38
includes/datastream.version.inc

@ -231,6 +231,34 @@ function islandora_revert_datastream_version_form_submit(array $form, array &$fo
$form_state['redirect'] = "islandora/object/{$islandora_object->id}/datastream/{$datastream_to_revert->id}/version";
}
/**
* Process available dsids, mime and extensions for a given object.
*
* @param AbstractObject $object
* The FedoraObject to process available extensions
*
* @return array()
* An associative array, merged from calls to
* islandora_get_datastreams_requirements_from_content_models()
* and an objects dsid's.
*/
function islandora_get_object_extensions(AbstractObject $object) {
$extensions = islandora_get_datastreams_requirements_from_models($object->models);
foreach ($object as $datastream) {
// Could be a datastream not associated in a content model,
// such as user added.
if (!isset($extensions[$datastream->id])) {
// Add the extensions manually.
$extensions[$datastream->id] = array(
'id' => $datastream->id,
'optional' => TRUE,
'mime' => array($datastream->mimeType),
);
}
}
return $extensions;
}
/**
* The admin replace datastream form.
*
@ -252,12 +280,14 @@ function islandora_datastream_version_replace_form($form, &$form_state, Abstract
$form_state['object_id'] = $object->id;
$form_state['dsid'] = $datastream->id;
$form_state['object'] = $object;
$extensions = islandora_get_datastreams_requirements_from_models($object->models);
$extensions = islandora_get_object_extensions($object);
$mime_detect = new MimeDetect();
$ext = array();
foreach ($extensions[$datastream->id]['mime'] as $key => $value) {
$str = $mime_detect->getExtension($value);
array_push($ext, $str);
if (isset($extensions[$datastream->id])) {
foreach ($extensions[$datastream->id]['mime'] as $key => $value) {
$str = $mime_detect->getExtension($value);
array_push($ext, $str);
}
}
$comma = count($ext) > 1 ? "," : "";
$ext = array(implode($comma, $ext));

3
includes/derivatives.inc

@ -29,7 +29,7 @@ function islandora_run_derivatives(AbstractObject $object, $dsid) {
);
if ($operations) {
batch_set(
// Title won't show for batch in a batch.
// Title won't show for batch in a batch.
array(
'init_message' => t('Preparing derivatives for @label', array('@label' => $object->label)),
'error_message' => t('An error occured creating derivatives.'),
@ -40,7 +40,6 @@ function islandora_run_derivatives(AbstractObject $object, $dsid) {
),
'file' => drupal_get_path('module', 'islandora') . '/includes/regenerate_derivatives.form.inc',
'operations' => $operations,
'finished' => 'islandora_regenerate_derivative_batch_finished',
)
);
}

Loading…
Cancel
Save