Browse Source

Added some initial ingest function.

pull/108/head
jonathangreen 13 years ago
parent
commit
6a65cdfe06
  1. 31
      includes/add-menu.inc
  2. 4
      includes/ingest-menu.inc
  3. 17
      islandora.module
  4. 21
      islandora_basic_collection/islandora_basic_collection.module

31
includes/add-menu.inc

@ -1,31 +0,0 @@
<?php
function islandora_add_callback($pid) {
module_load_include('inc', 'islandora', 'RestConnection');
$user = new stdClass();
$user->name = 'fedoraAdmin';
$user->pass = 'password';
$connection = new RestConnection($user);
$object = $connection->repository->getObject($pid);
$models = $object->models;
return drupal_get_form('islandora_add_form', $models, $object);
}
function islandora_add_form($object) {
$form = array ();
return $form;
}
function islandora_form_alter(&$form, &$form_state, $form_id) {
if($form_id == 'islandora_add_form') {
$form['islandora_repository_pid'] = array(
'#type' => 'textfield',
'#title' => t('Root Collection PID'),
'#default_value' => variable_get('islandora_repository_pid', 'islandora:root'),
'#description' => t('The PID of the Root Collection Object'),
'#required' => TRUE,
'#weight' => -18
);
}
}

4
includes/ingest-menu.inc

@ -22,7 +22,7 @@ function islandora_ingest_callback($collection_pid) {
} }
elseif ($registry_count == 1) { elseif ($registry_count == 1) {
// One registry implementation, go there // One registry implementation, go there
drupal_goto($ingest_registry[0]['url']); drupal_goto($ingest_registry[0]['url'] . "/$collection_pid");
} }
else { else {
// Multiple ingest routes registered // Multiple ingest routes registered
@ -37,7 +37,7 @@ function islandora_ingest_registry_render($ingest_registry) {
'#markup' => '', '#markup' => '',
); );
foreach ($ingest_registry AS $ingest_route) { foreach ($ingest_registry AS $ingest_route) {
$output['#markup'] .= l($ingest_route['name'], $ingest_route['url']) . '<br/>'; $output['#markup'] .= l($ingest_route['name'], $ingest_route['url']. "/$collection_pid") . '<br/>';
} }
return $output; return $output;
} }

17
islandora.module

@ -172,6 +172,14 @@ function islandora_menu() {
'access arguments' => array(FEDORA_PURGE), 'access arguments' => array(FEDORA_PURGE),
); );
$items['islandora/test/%'] = array(
'title' => 'Purge data stream',
'page callback' => 'islandora_test_test',
'page arguments' => array(2),
'type' => MENU_CALLBACK,
'access arguments' => array(FEDORA_PURGE),
);
return $items; return $items;
} }
@ -394,3 +402,12 @@ function islandora_preprocess_islandora_default(&$variables) {
$variables['islandora_thumbnail_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view'; $variables['islandora_thumbnail_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view';
} }
} }
function islandora_islandora_ingest_registry() {
return array(array('url' => 'islandora/test', 'name' => 'basic collection ingest'));
}
function islandora_test_test($pid) {
return 'jessus';
}

21
islandora_basic_collection/islandora_basic_collection.module

@ -132,3 +132,24 @@ function islandora_basic_collection_get_objects($object){
return $results; return $results;
} }
function islandora_basic_collection_islandora_ingest_get_information($models, $object) {
if(in_array('islandora:collectionCModel', $models) && isset($object['COLLECTION_POLICY'])) {
try {
$return = array();
$xml = new SimpleXMLElement($object['COLLECTION_POLICY']);
$cms = $xml->getElementsByTagName('content_models')->item(0)->getElementsByTagName('content_model');
$return['contentsmodels'] = array();
foreach($cms as $cm) {
$contentmodel = array();
$contentmodel['name'] = (string) $cm['name'];
$contentmodel['namespace'] = (string) $cm['namespace'];
$contentmodel['pid'] = (string) $cm['pid'];
$return['contentsmodels'] = (string) $contentmodel;
}
$return['relationship'] = trim($xml->getElementsByTagName('relationship')->item(0)->nodeValue);
return $return;
}
catch (Exception $e) { }
}
}

Loading…
Cancel
Save