Browse Source

ISLANDORA-214 Handle datastream versioning in Solution Pack form.

pull/105/head
Alexander O'Neill 14 years ago
parent
commit
abf001d96a
  1. 3
      fedora_repository.module
  2. 31
      fedora_repository.solutionpacks.inc

3
fedora_repository.module

@ -1413,7 +1413,7 @@ function fedora_repository_required_fedora_objects() {
'label' => 'Islandora Collection Content Model',
'dsid' => 'ISLANDORACM',
'datastream_file' => "$module_path/content_models/COLLECTIONCM.xml",
'dsversion' => NULL,
'dsversion' => 2,
'cmodel' => 'fedora-system:ContentModel-3.0',
),
array (
@ -1421,7 +1421,6 @@ function fedora_repository_required_fedora_objects() {
'label' => 'Islandora strict PDF content model',
'dsid' => 'ISLANDORACM',
'datastream_file' => "$module_path/content_models/STRICT_PDFCM.xml",
'dsversion' => NULL,
'cmodel' => 'fedora-system:ContentModel-3.0',
),
array(

31
fedora_repository.solutionpacks.inc

@ -77,6 +77,7 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul
foreach ($objects as $object) {
$datastreams = NULL;
if (isset($object['pid'])) {
$pid = $object['pid'];
@ -86,20 +87,35 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul
if (!$item->exists()) {
$object_status = 'Missing';
$needs_install = TRUE;
} else {
if (isset($object['dsid']) && isset($object['datastream_file']) && isset($object['dsversion'])) {
$datastreams = array(
array(
'dsid' => $object['dsid'],
'datastream_file' => $object['datastream_file'],
'dsversion' => $object['dsversion'],
),
);
} elseif (!empty($object['datastreams'])) {
$datastreams = $object['datastreams'];
}
elseif (isset($object['dsid']) && isset($object['datastream_file']) && isset($object['dsversion'])) {
if (!empty($datastreams) && is_array($datastreams)) {
foreach ($datastreams as $ds) {
if (isset($ds['dsversion'])) {
// Check if the datastream is versioned and needs updating.
$installed_version = fedora_repository_get_islandora_datastream_version($item, $object['dsid']);
$available_version = fedora_repository_get_islandora_datastream_version(NULL, NULL, $object['datastream_file']);
$installed_version = fedora_repository_get_islandora_datastream_version($item, $ds['dsid']);
$available_version = fedora_repository_get_islandora_datastream_version(NULL, NULL, $ds['datastream_file']);
if ($available_version > $installed_version) {
$needs_update = TRUE;
$object_status = 'Out of date';
}
}
}
}
array_push($table_row, $object_status);
$table_rows[] = $table_row;
}
}
}
$form['objects']['table'] = array(
@ -113,15 +129,14 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul
'#prefix' => '<strong>' . t('Object status:') . '&nbsp;</strong>',
'#suffix' => '&nbsp;',
);
if (!$needs_install) {
if (!$needs_install && !$needs_update) {
$form['install_status']['#value'] = theme_image('misc/watchdog-ok.png') . t('All required objects are installed and up-to-date.');
}
else {
} else {
$form['install_status']['#value'] = theme_image('misc/watchdog-warning.png') . t('Some objects must be re-ingested. See Objects list for details.');
}
$form['submit'] = array(
'#value' => t('Install'),
'#disabled' => !$needs_install,
'#disabled' => !$needs_install && !$needs_update,
'#type' => 'submit',
'#name' => $solution_pack_module,
);

Loading…
Cancel
Save