Browse Source

Added some more warnings.

pull/125/head
jonathangreen 13 years ago
parent
commit
0934bae3f8
  1. 25
      admin/islandora.admin.inc
  2. 7
      includes/datastream.inc
  3. 4
      islandora_basic_collection/islandora_basic_collection.module
  4. 4
      islandora_basic_collection/theme/islandora-basic-collection.tpl.php
  5. 6
      islandora_basic_collection/theme/islandora_basic_collection.theme.inc
  6. 2
      islandora_basic_image/islandora-basic-image.tpl.php
  7. 6
      islandora_basic_image/islandora_basic_image.module
  8. 10
      theme/islandora.theme.inc

25
admin/islandora.admin.inc

@ -24,13 +24,34 @@ function islandora_repository_admin($form, &$form_state) {
$url = variable_get('islandora_base_url', 'http://localhost:8080/fedora'); $url = variable_get('islandora_base_url', 'http://localhost:8080/fedora');
} }
// Connect to Fedora module_load_include('inc', 'islandora', 'includes/tuque');
$info = islandora_describe_repository($url); $connection = new IslandoraTuque(NULL, $url);
try {
$info = $connection->api->a->describeRepository();
}
catch (RepositoryException $e) {
$info = FALSE;
}
if($info) { if($info) {
try {
$dc = $connection->api->m->getDatastream('fedora-system:ContentModel-3.0', 'DC');
}
catch (RepositoryException $e) {
$dc = FALSE;
}
}
if($info) {
if($dc) {
$confirmation_message = '<img src="' . url('misc/watchdog-ok.png') . '"/>' $confirmation_message = '<img src="' . url('misc/watchdog-ok.png') . '"/>'
. t('Successfully connected to Fedora Server (Version !version).', array('!version' => $info['repositoryVersion'])); . t('Successfully connected to Fedora Server (Version !version).', array('!version' => $info['repositoryVersion']));
} }
else {
$confirmation_message = '<img src="' . url('misc/watchdog-warning.png') . '"/>'
. t('Unable to authenticate when connecting to to Fedora Server (Version !version). Please configure the !filter.', array('!version' => $info['repositoryVersion'], '!filter' => 'Drupal Filter'));
}
}
else { else {
$confirmation_message = '<img src="' . url('misc/watchdog-error.png') . '"/> ' $confirmation_message = '<img src="' . url('misc/watchdog-error.png') . '"/> '
. t('Unable to connect to Fedora server at !islandora_url', array('!islandora_url' => $url)); . t('Unable to connect to Fedora server at !islandora_url', array('!islandora_url' => $url));

7
includes/datastream.inc

@ -33,9 +33,16 @@ function islandora_view_datastream($object, $dsid, $method = 'view') {
function islandora_datastream_get_parents($islandora_object) { function islandora_datastream_get_parents($islandora_object) {
$parent_collections = array(); $parent_collections = array();
try {
$repository = $islandora_object->repository; $repository = $islandora_object->repository;
$collections1 = $islandora_object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOfCollection'); $collections1 = $islandora_object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOfCollection');
$collections2 = $islandora_object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOf'); $collections2 = $islandora_object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOf');
}
catch (RepositoryException $e) {
$collections1 = array();
$collections2 = array();
}
$collections = array_merge($collections1, $collections2); $collections = array_merge($collections1, $collections2);
foreach($collections as $collection) { foreach($collections as $collection) {

4
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['relationship'] = $policy->getRelationship();
return $return; return $return;
} catch (Exception $e) { } catch (Exception $e) {}
drupal_set_message(t('Islandora Error getting collection info for %s', array('%s' => $object->id)), 'error');
}
} }
} }

4
islandora_basic_collection/theme/islandora-basic-collection.tpl.php

@ -31,10 +31,10 @@
<dt> <dt>
<?php print $associated_object['thumb_link']; ?> <?php print $associated_object['thumb_link']; ?>
</dt> </dt>
<dd class="collection-value <?php print $associated_object['dc_array']['dc:title']['class']; ?> <?php print $row_field == 0 ? ' first' : ''; ?>"> <dd class="collection-value <?php print isset($associated_object['dc_array']['dc:title']['class']) ? $associated_object['dc_array']['dc:title']['class'] : ''; ?> <?php print $row_field == 0 ? ' first' : ''; ?>">
<strong><?php print $associated_object['title_link']; ?></strong> <strong><?php print $associated_object['title_link']; ?></strong>
</dd> </dd>
<?php if ($associated_object['dc_array']['dc:description']['value']): ?> <?php if (isset($associated_object['dc_array']['dc:description']['value'])): ?>
<dd class="collection-value <?php print $associated_object['dc_array']['dc:description']['class']; ?>"> <dd class="collection-value <?php print $associated_object['dc_array']['dc:description']['class']; ?>">
<?php print $associated_object['dc_array']['dc:description']['value']; ?> <?php print $associated_object['dc_array']['dc:description']['value']; ?>
</dd> </dd>

6
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 = $islandora_object['DC']->content;
$dc_object = Dublin_Core::import_from_xml_string($dc); $dc_object = Dublin_Core::import_from_xml_string($dc);
} catch (Exception $e) { } 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_number = (empty($_GET['page'])) ? 0 : $_GET['page'];
$page_size = (empty($_GET['pagesize'])) ? variable_get('islandora_basic_collection_page_size', '10') : $_GET['pagesize']; $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); $results = $variables['collection_results']; //islandora_basic_collection_get_objects($islandora_object, $page_number, $page_size);
$total_count = count($results); $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; $variables['islandora_object_label'] = $islandora_object->label;
$display = (empty($_GET['display'])) ? 'list' : $_GET['display']; $display = (empty($_GET['display'])) ? 'list' : $_GET['display'];
if ($display == 'grid') { 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); $dc_object = Dublin_Core::import_from_xml_string($dc);
$associated_objects_array[$pid]['dc_array'] = $dc_object->as_formatted_array(); $associated_objects_array[$pid]['dc_array'] = $dc_object->as_formatted_array();
} catch (Exception $e) { } 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; $object_url = 'islandora/object/' . $pid;
$thumbnail_img = '<img src="' . $base_path . $object_url . '/datastream/TN/view"' . '/>'; $thumbnail_img = '<img src="' . $base_path . $object_url . '/datastream/TN/view"' . '/>';

2
islandora_basic_image/islandora-basic-image.tpl.php

@ -37,7 +37,7 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="islandora-basic-image-sidebar"> <div class="islandora-basic-image-sidebar">
<?php if($dc_array['dc:description']['value']): ?> <?php if(isset($dc_array['dc:description']['value'])): ?>
<h2><?php print $dc_array['dc:description']['label']; ?></h2> <h2><?php print $dc_array['dc:description']['label']; ?></h2>
<p><?php print $dc_array['dc:description']['value']; ?></p> <p><?php print $dc_array['dc:description']['value']; ?></p>
<?php endif; ?> <?php endif; ?>

6
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 = $islandora_object['DC']->content;
$dc_object = Dublin_Core::import_from_xml_string($dc); $dc_object = Dublin_Core::import_from_xml_string($dc);
} catch (Exception $e) { } 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['islandora_dublin_core'] = isset($dc_object) ? $dc_object : NULL;
$variables['dc_array'] = $dc_object->as_formatted_array(); $variables['dc_array'] = isset($dc_object) ? $dc_object->as_formatted_array() : array();
$variables['islandora_object_label'] = $islandora_object->label; $variables['islandora_object_label'] = $islandora_object->label;
$variables['theme_hook_suggestions'][] = 'islandora_basic_image__' . str_replace(':', '_', $islandora_object->id); $variables['theme_hook_suggestions'][] = 'islandora_basic_image__' . str_replace(':', '_', $islandora_object->id);
$variables['parent_collections'] = islandora_datastream_get_parents($islandora_object); $variables['parent_collections'] = islandora_datastream_get_parents($islandora_object);

10
theme/islandora.theme.inc

@ -60,6 +60,7 @@ function islandora_preprocess_islandora_default(&$variables) {
$datastreams = array(); $datastreams = array();
foreach ($islandora_object as $ds) { foreach ($islandora_object as $ds) {
try {
$pid = $islandora_object->id; $pid = $islandora_object->id;
$id = $ds->id; $id = $ds->id;
$label = $ds->label; $label = $ds->label;
@ -73,16 +74,19 @@ function islandora_preprocess_islandora_default(&$variables) {
$datastreams[$id]['created_date'] = $ds->createdDate->format("Y-m-d"); $datastreams[$id]['created_date'] = $ds->createdDate->format("Y-m-d");
$datastreams[$id]['class'] = strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $id)); $datastreams[$id]['class'] = strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $id));
} }
catch (RepositoryException $e) {}
}
$variables['datastreams'] = $datastreams; $variables['datastreams'] = $datastreams;
try { try {
$dc = $islandora_object['DC']->content; $dc = $islandora_object['DC']->content;
//$dc_xml = simplexml_load_string($dc); //$dc_xml = simplexml_load_string($dc);
$dc_object = Dublin_Core::import_from_xml_string($dc); $dc_object = Dublin_Core::import_from_xml_string($dc);
$dc_array = $dc_object->as_formatted_array();
} catch (Exception $e) { } 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['dc_array'] = isset($dc_array) ? $dc_array : array();
$variables['islandora_dublin_core'] = $dc_object; $variables['islandora_dublin_core'] = isset($dc_object) ? $dc_object : NULL;
$variables['islandora_object_label'] = $islandora_object->label; $variables['islandora_object_label'] = $islandora_object->label;
global $base_url; global $base_url;
if (isset($islandora_object['TN'])) { if (isset($islandora_object['TN'])) {

Loading…
Cancel
Save