Browse Source

Merge branch 'ISLANDORA-195'

pull/105/head
Alexander O'Neill 14 years ago
parent
commit
31d0fa450e
  1. 10
      ObjectHelper.inc
  2. 8
      tests/fedora_repository.test

10
ObjectHelper.inc

@ -998,7 +998,8 @@ class ObjectHelper {
*/ */
function getBreadcrumbs($pid, &$breadcrumbs, $level=10) { function getBreadcrumbs($pid, &$breadcrumbs, $level=10) {
module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
// Before executing the query, we hve a base case of accessing the top-level collection
global $base_url;
$query_string = 'select $parentObject $title $content from <#ri> $query_string = 'select $parentObject $title $content from <#ri>
where (<info:fedora/' . $pid . '> <dc:title> $title where (<info:fedora/' . $pid . '> <dc:title> $title
and $parentObject <fedora-model:hasModel> $content and $parentObject <fedora-model:hasModel> $content
@ -1015,11 +1016,14 @@ class ObjectHelper {
$result = preg_split('/[\r\n]+/',do_curl($url)); $result = preg_split('/[\r\n]+/',do_curl($url));
array_shift($result); // throw away first line array_shift($result); // throw away first line
$matches =str_getcsv(join("\n",$result)); $matches =str_getcsv(join("\n",$result));
if ($matches !== NULL) { if ($matches !== FALSE) {
$parent = preg_replace('/^info:fedora\//','',$matches[0]); $parent = preg_replace('/^info:fedora\//','',$matches[0]);
$breadcrumbs[] = l($matches[1], 'fedora/repository/' . $pid); $breadcrumbs[] = l($matches[1], 'fedora/repository/' . $pid);
if ($parent == variable_get('fedora_repository_pid', 'islandora:top')) { if ($parent == variable_get('fedora_repository_pid', 'islandora:top')) {
$breadcrumbs[] = l(t('Home'), ''); // l(t('Digital repository'), 'fedora/repository'); $breadcrumbs[] = l(t('Digital repository'), 'fedora/repository');
$breadcrumbs[] = l(t('Home'), $base_url);
} elseif ($level > 0) { } elseif ($level > 0) {
$this->getBreadcrumbs($parent, $breadcrumbs, $level - 1); $this->getBreadcrumbs($parent, $breadcrumbs, $level - 1);
} }

8
tests/fedora_repository.test

@ -71,7 +71,8 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase {
$this->drupalPost('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection', $ingest_form, 'Next'); $this->drupalPost('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection', $ingest_form, 'Next');
// Required fields are file location, dc:title and dc:description // Required fields are file location, dc:title and dc:description
$ingest_form_step_2 = array(); $ingest_form_step_2 = array();
$ingest_form_step_2['dc:title'] = $this->randomName(32); $ingest_title = $this->randomName(32);
$ingest_form_step_2['dc:title'] = $ingest_title;
$ingest_form_step_2['dc:description'] = $this->randomName(256); $ingest_form_step_2['dc:description'] = $this->randomName(256);
$ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'fedora_repository') . '/collection_policies/PDF-COLLECTION POLICY.xml'); $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'fedora_repository') . '/collection_policies/PDF-COLLECTION POLICY.xml');
$this->drupalPost(NULL, $ingest_form_step_2, 'Ingest'); $this->drupalPost(NULL, $ingest_form_step_2, 'Ingest');
@ -79,6 +80,11 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase {
$this->assertPattern('/Item .* created successfully./', "Verified item created."); $this->assertPattern('/Item .* created successfully./', "Verified item created.");
$pid = $this->getIngestedPid(); $pid = $this->getIngestedPid();
$this->drupalGet("fedora/repository/$pid");
$this->assertLink('Home');
$this->assertLink('Digital Repository');
$this->assertLink($ingest_title);
$pid_list[] = $pid; $pid_list[] = $pid;
$this->pass('Now attempting to ingest a PDF into the new collection.'); $this->pass('Now attempting to ingest a PDF into the new collection.');
// Now try ingesting a PDF // Now try ingesting a PDF

Loading…
Cancel
Save