From 6a65cdfe06e857e4489f70725714b4560ec008b8 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Wed, 23 May 2012 15:02:54 -0300 Subject: [PATCH] Added some initial ingest function. --- includes/add-menu.inc | 31 ------------------- includes/ingest-menu.inc | 4 +-- islandora.module | 17 ++++++++++ .../islandora_basic_collection.module | 21 +++++++++++++ 4 files changed, 40 insertions(+), 33 deletions(-) delete mode 100644 includes/add-menu.inc diff --git a/includes/add-menu.inc b/includes/add-menu.inc deleted file mode 100644 index 6bc0fd75..00000000 --- a/includes/add-menu.inc +++ /dev/null @@ -1,31 +0,0 @@ -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 - ); - } -} \ No newline at end of file diff --git a/includes/ingest-menu.inc b/includes/ingest-menu.inc index b2e795a2..a27892b0 100644 --- a/includes/ingest-menu.inc +++ b/includes/ingest-menu.inc @@ -22,7 +22,7 @@ function islandora_ingest_callback($collection_pid) { } elseif ($registry_count == 1) { // One registry implementation, go there - drupal_goto($ingest_registry[0]['url']); + drupal_goto($ingest_registry[0]['url'] . "/$collection_pid"); } else { // Multiple ingest routes registered @@ -37,7 +37,7 @@ function islandora_ingest_registry_render($ingest_registry) { '#markup' => '', ); foreach ($ingest_registry AS $ingest_route) { - $output['#markup'] .= l($ingest_route['name'], $ingest_route['url']) . '
'; + $output['#markup'] .= l($ingest_route['name'], $ingest_route['url']. "/$collection_pid") . '
'; } return $output; } \ No newline at end of file diff --git a/islandora.module b/islandora.module index b2c3773a..8dfffc80 100644 --- a/islandora.module +++ b/islandora.module @@ -172,6 +172,14 @@ function islandora_menu() { '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; } @@ -394,3 +402,12 @@ function islandora_preprocess_islandora_default(&$variables) { $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'; +} \ No newline at end of file diff --git a/islandora_basic_collection/islandora_basic_collection.module b/islandora_basic_collection/islandora_basic_collection.module index e09765a8..8214a5d7 100644 --- a/islandora_basic_collection/islandora_basic_collection.module +++ b/islandora_basic_collection/islandora_basic_collection.module @@ -132,3 +132,24 @@ function islandora_basic_collection_get_objects($object){ 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) { } + } +}