From 28fed7c94659dd95e059794c2cb8c08fdefe0f39 Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Fri, 18 May 2012 18:42:05 -0300 Subject: [PATCH] added datastream view implementation --- islandora.module | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/islandora.module b/islandora.module index d53356f6..5d8d7d9c 100644 --- a/islandora.module +++ b/islandora.module @@ -313,6 +313,22 @@ function islandora_theme() { ); } +function islandora_datastream_as_attachment($object_id, $dsid){ + module_load_include('inc', 'islandora', 'RestConnection'); + $user = new stdClass(); + $user->name = 'fedoraAdmin'; + $user->password = 'islandora'; + try { + $restConnection = new RestConnection($user); + $fedora_object = new FedoraObject($object_id, $restConnection->repository); + } catch (Exception $e) { + drupal_set_message(t('Error getting Islanndora datastream $d for object %s', array('%s' => $object_id, '%d' => $dsid)), 'error'); + return""; + } + print($fedora_object[$dsid]->content); + exit(); +} + /** * drupal hook_permissions function * @return array