Browse Source

Merge branch '7.x' of github.com:Islandora/islandora into 7.x

pull/108/head
Paul Pound 13 years ago
parent
commit
0832cd7b41
  1. 43
      includes/ingest-menu.inc
  2. 10
      islandora.api.php
  3. 11
      islandora.module

43
includes/ingest-menu.inc

@ -0,0 +1,43 @@
<?php
/**
* @file
* Menu callback functionality for islandora/ingest
*/
/**
* Callback function for islandora/ingest/%collection_pid
* @TODO: validate?: pid, registry return
* @param string $pid
*/
function islandora_ingest_callback($collection_pid) {
$ingest_registry = module_invoke_all('islandora_ingest_registry', $collection_pid);
$registry_count = count($ingest_registry);
if ($registry_count == 0) {
// No ingest implementations.
drupal_set_message(t('There are no ingest methods specified for this collection.'));
drupal_goto('islandora/object/' . $collection_pid);
}
elseif ($registry_count == 1) {
// One registry implementation, go there
drupal_goto($ingest_registry[0]['url']);
}
else {
// Multiple ingest routes registered
return islandora_ingest_registry_render($ingest_registry);
}
}
//@TODO: theme
function islandora_ingest_registry_render($ingest_registry) {
$output = array(
'#type' => 'markup',
'#markup' => '',
);
foreach ($ingest_registry AS $ingest_route) {
$output['#markup'] .= l($ingest_route['name'], $ingest_route['url']) . '<br/>';
}
return $output;
}

10
islandora.api.php

@ -17,4 +17,12 @@ function hook_islandora_preingest_alter(){}
function hook_islandora_postingest($object){}
function hook_islandora_datastream_edit($object, $dsid){}
function hook_islandora_datastream_edit($object, $dsid){}
/**
* Register potential ingest routes. Implementations should return an array containing possible routes.
* Ex. array(
* array('name' => t('Ingest Route Name'), 'url' => 'ingest_route/url', 'weight' => 0),
* );
*/
function hook_islandora_ingest_registry($collection_pid) {}

11
islandora.module

@ -78,13 +78,14 @@ function islandora_menu() {
'type' => MENU_CALLBACK,
'access arguments' => array(FEDORA_VIEW),
);
$items['islandora/ingest/%'] = array(
'title' => 'Ingest object',
'page callback' => 'islandora_ingest_object',
'title' => t('Ingest object'),
'page callback' => 'islandora_ingest_callback',
'page arguments' => array(2),
'type' => MENU_NORMAL_ITEM,
'access arguments' => array(FEDORA_INGEST)
'file' => 'includes/ingest-menu.inc',
'type' => MENU_CALLBACK,
'access arguments' => array(FEDORA_INGEST),
);
$items['islandora/object/%'] = array(

Loading…
Cancel
Save