Browse Source

Merge pull request #244 from jordandukart/7.x

Change so that we can pass through and use URIs in additional to the ori...
pull/246/head
Jonathan Green 12 years ago
parent
commit
2c5f8b8b87
  1. 13
      includes/utilities.inc

13
includes/utilities.inc

@ -397,13 +397,26 @@ function islandora_prepare_new_object($namespace = NULL, $label = NULL, $datastr
$mimetype = isset($ds['mimetype']) ? $ds['mimetype'] : 'text/xml';
// Default 'Managed'
$control_group = (isset($ds['control_group']) && in_array($ds['control_group'], array('X', 'M', 'R', 'E'))) ? $ds['control_group'] : 'M';
$ds_uri = FALSE;
if (file_valid_uri($ds['datastream_file'])) {
$datastream_file = $ds['datastream_file'];
$ds_uri = TRUE;
}
else {
$datastream_file = url($ds['datastream_file'], array('absolute' => TRUE));
}
$datastream = $object->constructDatastream($dsid, $control_group);
$datastream->label = $label;
$datastream->mimetype = $mimetype;
switch ($control_group) {
case 'M':
if ($ds_uri) {
$datastream->setContentFromFile($datastream_file);
}
else {
$datastream->setContentFromUrl($datastream_file);
}
break;
case 'X':
$datastream->setContentFromString(file_get_contents($datastream_file));

Loading…
Cancel
Save