Browse Source

Code review feedback.

pull/499/head
MorganDawe 11 years ago
parent
commit
af8dcd01ae
  1. 12
      includes/datastream.version.inc
  2. 7
      islandora.module
  3. 3
      theme/theme.inc

12
includes/datastream.version.inc

@ -253,10 +253,14 @@ function islandora_datastream_version_replace_form($form, &$form_state, Abstract
$form_state['dsid'] = $datastream->id;
$form_state['object'] = $object;
$extensions = islandora_get_datastreams_requirements_from_models($object->models);
$ext = array(NULL);
if(isset($extensions[$datastream->id]['mime'])) {
$ext = array(implode(",", $extensions[$datastream->id]['mime']));
$mime_detect = new MimeDetect();
$ext = array();
foreach ($extensions[$datastream->id]['mime'] as $key => $value) {
$str = $mime_detect->getExtension($value);
array_push($ext, $str);
}
$comma = sizeof($ext) > 1 ? "," : "";
$ext = array(implode($comma, $ext));
$upload_size = min((int) ini_get('post_max_size'), (int) ini_get('upload_max_filesize'));
return array(
'dsid_fieldset' => array(
@ -318,7 +322,7 @@ function islandora_datastream_version_replace_form_submit($form, &$form_state) {
catch (exception $e) {
drupal_set_message(t('An error occurred during datastream updates. See watchlog for more information.'), 'error');
watchdog('islandora',
'Failed to add new versionable datastream.</br>code: @code<br/>message: @msg',
'Failed to add new versionable datastream.<br/>code: @code<br/>message: @msg',
array(
'@code' => $e->getCode(),
'@msg' => $e->getMessage(),

7
islandora.module

@ -609,8 +609,8 @@ function islandora_permission() {
'description' => t('Regenerate derivatives for an object or per datastream.'),
),
ISLANDORA_REPLACE_DATASTREAM_CONTENT => array(
'title' => t('Replace derivatives'),
'description' => t('Replace derivatives for an object or per datastream.'),
'title' => t('Replace datastreams'),
'description' => t('Replace datastreams for an object or per datastream.'),
),
);
}
@ -1893,7 +1893,8 @@ 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 && islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $object[$hook['source_dsid']], $user)) {
if ($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;
}

3
theme/theme.inc

@ -23,10 +23,9 @@ function islandora_preprocess_islandora_default_edit(array &$variables) {
$header[] = array('data' => t('Size'));
if (user_access(ISLANDORA_VIEW_DATASTREAM_HISTORY)) {
$header[] = array('data' => t('Versions'));
$header[] = array('data' => t('Replace'));
}
$header[] = array('data' => t('Operations'), 'colspan' => '4');
$header[] = array('data' => t('Operations'), 'colspan' => '5');
$table_attributes = array('class' => array('manage-datastreams'));
$rows = array();

Loading…
Cancel
Save