Browse Source

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

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

32
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,13 +280,15 @@ 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();
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));
$upload_size = min((int) ini_get('post_max_size'), (int) ini_get('upload_max_filesize'));

1
includes/derivatives.inc

@ -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