diff --git a/admin/islandora.admin.inc b/admin/islandora.admin.inc index e22fa433..d82b8ef7 100644 --- a/admin/islandora.admin.inc +++ b/admin/islandora.admin.inc @@ -24,12 +24,33 @@ function islandora_repository_admin($form, &$form_state) { $url = variable_get('islandora_base_url', 'http://localhost:8080/fedora'); } - // Connect to Fedora - $info = islandora_describe_repository($url); + module_load_include('inc', 'islandora', 'includes/tuque'); + $connection = new IslandoraTuque(NULL, $url); + try { + $info = $connection->api->a->describeRepository(); + } + catch (RepositoryException $e) { + $info = FALSE; + } + + if($info) { + try { + $dc = $connection->api->m->getDatastream('fedora-system:ContentModel-3.0', 'DC'); + } + catch (RepositoryException $e) { + $dc = FALSE; + } + } if($info) { - $confirmation_message = '' - . t('Successfully connected to Fedora Server (Version !version).', array('!version' => $info['repositoryVersion'])); + if($dc) { + $confirmation_message = '' + . t('Successfully connected to Fedora Server (Version !version).', array('!version' => $info['repositoryVersion'])); + } + else { + $confirmation_message = '' + . t('Unable to authenticate when connecting to to Fedora Server (Version !version). Please configure the !filter.', array('!version' => $info['repositoryVersion'], '!filter' => 'Drupal Filter')); + } } else { $confirmation_message = ' ' diff --git a/includes/datastream.inc b/includes/datastream.inc index 4c9060e4..6a2e8724 100644 --- a/includes/datastream.inc +++ b/includes/datastream.inc @@ -33,9 +33,16 @@ function islandora_view_datastream($object, $dsid, $method = 'view') { function islandora_datastream_get_parents($islandora_object) { $parent_collections = array(); - $repository = $islandora_object->repository; - $collections1 = $islandora_object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOfCollection'); - $collections2 = $islandora_object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOf'); + + try { + $repository = $islandora_object->repository; + $collections1 = $islandora_object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOfCollection'); + $collections2 = $islandora_object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOf'); + } + catch (RepositoryException $e) { + $collections1 = array(); + $collections2 = array(); + } $collections = array_merge($collections1, $collections2); foreach($collections as $collection) { diff --git a/islandora_basic_collection/islandora_basic_collection.module b/islandora_basic_collection/islandora_basic_collection.module index 2a2eb7f8..001e17cd 100644 --- a/islandora_basic_collection/islandora_basic_collection.module +++ b/islandora_basic_collection/islandora_basic_collection.module @@ -284,9 +284,7 @@ function islandora_basic_collection_islandora_ingest_get_information($models, $o $return['relationship'] = $policy->getRelationship(); return $return; - } catch (Exception $e) { - drupal_set_message(t('Islandora Error getting collection info for %s', array('%s' => $object->id)), 'error'); - } + } catch (Exception $e) {} } } diff --git a/islandora_basic_collection/theme/islandora-basic-collection.tpl.php b/islandora_basic_collection/theme/islandora-basic-collection.tpl.php index 33ad0462..7f7ac994 100644 --- a/islandora_basic_collection/theme/islandora-basic-collection.tpl.php +++ b/islandora_basic_collection/theme/islandora-basic-collection.tpl.php @@ -31,10 +31,10 @@
-
+
- +
diff --git a/islandora_basic_collection/theme/islandora_basic_collection.theme.inc b/islandora_basic_collection/theme/islandora_basic_collection.theme.inc index d146805f..40feef8d 100644 --- a/islandora_basic_collection/theme/islandora_basic_collection.theme.inc +++ b/islandora_basic_collection/theme/islandora_basic_collection.theme.inc @@ -57,13 +57,13 @@ function islandora_basic_collection_preprocess_islandora_basic_collection(&$vari $dc = $islandora_object['DC']->content; $dc_object = Dublin_Core::import_from_xml_string($dc); } catch (Exception $e) { - drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error'); + drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error', FALSE); } $page_number = (empty($_GET['page'])) ? 0 : $_GET['page']; $page_size = (empty($_GET['pagesize'])) ? variable_get('islandora_basic_collection_page_size', '10') : $_GET['pagesize']; $results = $variables['collection_results']; //islandora_basic_collection_get_objects($islandora_object, $page_number, $page_size); $total_count = count($results); - $variables['islandora_dublin_core'] = $dc_object; + $variables['islandora_dublin_core'] = isset($dc_object) ? $dc_object : array(); $variables['islandora_object_label'] = $islandora_object->label; $display = (empty($_GET['display'])) ? 'list' : $_GET['display']; if ($display == 'grid') { @@ -101,7 +101,7 @@ function islandora_basic_collection_preprocess_islandora_basic_collection(&$vari $dc_object = Dublin_Core::import_from_xml_string($dc); $associated_objects_array[$pid]['dc_array'] = $dc_object->as_formatted_array(); } catch (Exception $e) { - drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error'); + drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error', FALSE); } $object_url = 'islandora/object/' . $pid; $thumbnail_img = ''; diff --git a/islandora_basic_image/islandora-basic-image.tpl.php b/islandora_basic_image/islandora-basic-image.tpl.php index 561c8a63..fa570094 100644 --- a/islandora_basic_image/islandora-basic-image.tpl.php +++ b/islandora_basic_image/islandora-basic-image.tpl.php @@ -37,7 +37,7 @@
- +

diff --git a/islandora_basic_image/islandora_basic_image.module b/islandora_basic_image/islandora_basic_image.module index 885d5ba8..9e68cfb6 100644 --- a/islandora_basic_image/islandora_basic_image.module +++ b/islandora_basic_image/islandora_basic_image.module @@ -206,10 +206,10 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$variables) { $dc = $islandora_object['DC']->content; $dc_object = Dublin_Core::import_from_xml_string($dc); } catch (Exception $e) { - drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error'); + drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error', FALSE); } - $variables['islandora_dublin_core'] = $dc_object; - $variables['dc_array'] = $dc_object->as_formatted_array(); + $variables['islandora_dublin_core'] = isset($dc_object) ? $dc_object : NULL; + $variables['dc_array'] = isset($dc_object) ? $dc_object->as_formatted_array() : array(); $variables['islandora_object_label'] = $islandora_object->label; $variables['theme_hook_suggestions'][] = 'islandora_basic_image__' . str_replace(':', '_', $islandora_object->id); $variables['parent_collections'] = islandora_datastream_get_parents($islandora_object); diff --git a/theme/islandora.theme.inc b/theme/islandora.theme.inc index 97321e54..6f4ffce4 100644 --- a/theme/islandora.theme.inc +++ b/theme/islandora.theme.inc @@ -60,29 +60,33 @@ function islandora_preprocess_islandora_default(&$variables) { $datastreams = array(); foreach ($islandora_object as $ds) { - $pid = $islandora_object->id; - $id = $ds->id; - $label = $ds->label; - $download_path = islandora_datastream_get_url($ds, 'download'); - $datastreams[$id]['id'] = $id; - $datastreams[$id]['label'] = $label; - $datastreams[$id]['label_link'] = l($label, $download_path); - $datastreams[$id]['download_url'] = $download_path; - $datastreams[$id]['mimetype'] = $ds->mimetype; - $datastreams[$id]['size'] = islandora_datastream_get_human_readable_size($ds); - $datastreams[$id]['created_date'] = $ds->createdDate->format("Y-m-d"); - $datastreams[$id]['class'] = strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $id)); + try { + $pid = $islandora_object->id; + $id = $ds->id; + $label = $ds->label; + $download_path = islandora_datastream_get_url($ds, 'download'); + $datastreams[$id]['id'] = $id; + $datastreams[$id]['label'] = $label; + $datastreams[$id]['label_link'] = l($label, $download_path); + $datastreams[$id]['download_url'] = $download_path; + $datastreams[$id]['mimetype'] = $ds->mimetype; + $datastreams[$id]['size'] = islandora_datastream_get_human_readable_size($ds); + $datastreams[$id]['created_date'] = $ds->createdDate->format("Y-m-d"); + $datastreams[$id]['class'] = strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $id)); + } + catch (RepositoryException $e) {} } $variables['datastreams'] = $datastreams; try { $dc = $islandora_object['DC']->content; //$dc_xml = simplexml_load_string($dc); $dc_object = Dublin_Core::import_from_xml_string($dc); + $dc_array = $dc_object->as_formatted_array(); } catch (Exception $e) { - drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error'); + drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error', FALSE); } - $variables['dc_array'] = $dc_object->as_formatted_array(); - $variables['islandora_dublin_core'] = $dc_object; + $variables['dc_array'] = isset($dc_array) ? $dc_array : array(); + $variables['islandora_dublin_core'] = isset($dc_object) ? $dc_object : NULL; $variables['islandora_object_label'] = $islandora_object->label; global $base_url; if (isset($islandora_object['TN'])) {