Browse Source

ISLANDORA-214 Fix reference in solution pack form.

pull/105/head
Alexander O'Neill 14 years ago
parent
commit
58bce36473
  1. 93
      fedora_repository.module

93
fedora_repository.module

@ -1781,68 +1781,68 @@ function fedora_repository_solution_packs_page() {
* Check for installed objects and add a 'Update' or 'Install' button if some objects are missing. * Check for installed objects and add a 'Update' or 'Install' button if some objects are missing.
* @param array $solution_pack * @param array $solution_pack
*/ */
function fedora_repository_solution_pack_form($form, $solution_pack_module, $solution_pack_name, $objects = array()) { function fedora_repository_solution_pack_form(&$form_state, $solution_pack_module, $solution_pack_name, $objects = array()) {
// Check each object to see if it is in the repository. // Check each object to see if it is in the repository.
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'api/fedora_item');
$form = array();
$form['solution_pack'] = array(
'#type' => 'fieldset',
'#title' => $solution_pack_name,
);
$needs_update = FALSE; $needs_update = FALSE;
$needs_install = FALSE; $needs_install = FALSE;
$form = array();
$form['solution_pack_module'] = array( $form['solution_pack_module'] = array(
'#type' => 'hidden', '#type' => 'hidden',
'#value' => $solution_pack_module, '#value' => $solution_pack_module,
); );
$form['solution_pack']['objects'] = array(
'#type' => 'fieldset', if (!$form_state['submitted']) {
'#title' => "Objects",
'#weight' => 10, $form['objects'] = array(
'#attributes' => array('class' => 'collapsed'), '#type' => 'fieldset',
'#collapsible' => TRUE, '#title' => "Objects",
'#collapsed' => TRUE, '#weight' => 10,
); '#attributes' => array('class' => 'collapsed'),
$table_header = array('PID', 'Status'); '#collapsible' => TRUE,
$table_rows = array(); '#collapsed' => TRUE,
);
$table_header = array('PID', 'Status');
foreach($objects as $object) { $table_rows = array();
if (isset($object['pid'])) {
$pid = $object['pid'];
foreach($objects as $object) {
$item = new Fedora_Item($pid); if (isset($object['pid'])) {
$table_row = array($object['pid']); $pid = $object['pid'];
$object_status = t('Up-to-date');
if (!$item->exists()) { $item = new Fedora_Item($pid);
$object_status = 'Missing'; $table_row = array($object['pid']);
$needs_install = TRUE; $object_status = t('Up-to-date');
} if (!$item->exists()) {
elseif (isset($object['dsid']) && isset($object['datastream_file']) && isset($object['dsversion'])) { $object_status = 'Missing';
// Check if the datastream is versioned and needs updating. $needs_install = TRUE;
$installed_version = fedora_repository_get_islandora_datastream_version($item, $object['dsid']);
$available_version = fedora_repository_get_islandora_datastream_version(NULL, NULL, $object['datastream_file']);
if ($available_version > $installed_version) {
$needs_update = TRUE;
$object_status = 'Out of date';
} }
} elseif (isset($object['dsid']) && isset($object['datastream_file']) && isset($object['dsversion'])) {
array_push($table_row, $object_status); // 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']);
if ($available_version > $installed_version) {
$needs_update = TRUE;
$object_status = 'Out of date';
}
}
array_push($table_row, $object_status);
$table_rows[] = $table_row; $table_rows[] = $table_row;
}
} }
} $form['objects']['table'] = array(
$form['solution_pack']['objects']['table'] = array(
'#type' => 'markup', '#type' => 'markup',
'#value' => theme_table($table_header, $table_rows), '#value' => theme_table($table_header, $table_rows),
); );
$form['install'] = array( }
'#name' => 'install', $form['submit'] = array(
'#value' => t('Install'), '#value' => t('Install'),
'#disabled' => !$needs_install, '#disabled' => !$needs_install,
'#type' => 'submit', '#type' => 'submit',
'#action' => 'install', '#name' => 'ingest',
); );
return $form; return $form;
@ -1864,7 +1864,6 @@ function fedora_repository_solution_pack_form_submit($form, &$form_state) {
$batch['operations'][] = array('fedora_repository_batch_reingest_object', array($object)); $batch['operations'][] = array('fedora_repository_batch_reingest_object', array($object));
} }
batch_set($batch); batch_set($batch);
batch_process();
} }
function fedora_repository_batch_reingest_object($object, &$context) { function fedora_repository_batch_reingest_object($object, &$context) {

Loading…
Cancel
Save