Browse Source

Removed default ingest menu, ingest configuration can now take a object.

Was not in use and excepting any parameters for the ingest process via GET
was not very safe.

Also the ingest configuration can now take an NewFedoraObject rather than
building one from the configuration options. The old way is still supported
for now though.
pull/287/head
Nigel Banks 12 years ago
parent
commit
6aa5226e58
  1. 21
      includes/ingest.form.inc
  2. 49
      includes/ingest.menu.inc

21
includes/ingest.form.inc

@ -96,15 +96,18 @@ function islandora_ingest_form_init_form_state_storage(array &$form_state, array
*/ */
function islandora_ingest_form_prepare_new_object(array $configuration) { function islandora_ingest_form_prepare_new_object(array $configuration) {
module_load_include('inc', 'islandora', 'includes/utilities'); module_load_include('inc', 'islandora', 'includes/utilities');
// ID is more specific than namespace so it will take precedence. if (empty($configuration['object'])) {
$id = isset($configuration['namespace']) ? $configuration['namespace'] : 'islandora'; // ID is more specific than namespace so it will take precedence.
$id = isset($configuration['id']) ? $configuration['id'] : $id; $id = isset($configuration['namespace']) ? $configuration['namespace'] : 'islandora';
$label = isset($configuration['label']) ? $configuration['label'] : 'New Object'; $id = isset($configuration['id']) ? $configuration['id'] : $id;
$relationship_map = function($o) { $label = isset($configuration['label']) ? $configuration['label'] : 'New Object';
return array('relationship' => 'isMemberOfCollection', 'pid' => $o); $relationship_map = function($o) {
}; return array('relationship' => 'isMemberOfCollection', 'pid' => $o);
$relationships = empty($configuration['collections']) ? array() : array_map($relationship_map, $configuration['collections']); };
return islandora_prepare_new_object($id, $label, array(), array(), $relationships); $relationships = empty($configuration['collections']) ? array() : array_map($relationship_map, $configuration['collections']);
return islandora_prepare_new_object($id, $label, array(), array(), $relationships);
}
return $configuration['object'];
} }
/** /**

49
includes/ingest.menu.inc

@ -1,49 +0,0 @@
<?php
/**
* @file
* Ingest Menu callback hooks.
*/
/**
* Menu callback, Renders the multi-page ingest form if possible.
*
* @return string
* HTML representing the mult-page ingest form.
*/
function islandora_ingest_callback() {
module_load_include('inc', 'islandora', 'includes/ingest.form');
try {
$configuration = islandora_ingest_get_configuration();
return drupal_get_form('islandora_ingest_form', $configuration);
}
catch(Exception $e) {
$redirect = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '<front>';
// Redirect back to referer or top level collection.
drupal_goto($redirect);
}
}
/**
* Fetches the ingest configuration from the $_GET parameters.
*
* Generic parameters as accepted by all ingest processes, other modules may
* add to this list.
* id -> The pid of the object to create. optional.
* models -> Comma delimited list of all the content models the created object
* should have.
* collections -> Comma delimited list of all the collections the created
* object should belong to.
*
* @return array
* The configuration options used to build the multi-paged ingest process.
*/
function islandora_ingest_get_configuration() {
$configuration = $_GET;
unset($configuration['q']);
$convert_to_array_keys = array_intersect(array('models', 'collections'), array_keys($configuration));
foreach ($convert_to_array_keys as $key) {
$configuration[$key] = explode(',', $configuration[$key]);
}
return $configuration;
}
Loading…
Cancel
Save