Browse Source

Merge branch 'master' of github.com:Islandora/islandora into ISLANDORA-171

pull/105/head
Alexander O'Neill 14 years ago
parent
commit
3985480112
  1. 2
      CollectionPolicy.inc
  2. 3
      MimeClass.inc
  3. 12
      ObjectHelper.inc
  4. 10
      XMLDatastream.inc
  5. 33
      ilives/fedora_ilives.test
  6. 8
      tests/fedora_repository.test

2
CollectionPolicy.inc

@ -133,7 +133,7 @@ class CollectionPolicy extends XMLDatastream {
*/
public static function ingestBlankPolicy($pid, $name, $policyDsid, $model_pid, $model_namespace, $relationship, $searchField, $searchValue) {
$ret = FALSE;
if (($cp = self::loadFromCollection($pid, $modelDsid)) === FALSE) {
if (($cp = self::loadFromCollection($pid )) === FALSE) { //removed second, non-existant variable
module_load_include('inc', 'fedora_repository', 'ContentModel');
if (($cm = ContentModel::loadFromModel($model_pid)) !== FALSE && $cm->validate()) {
$newDom = new DOMDocument('1.0', 'utf-8');

3
MimeClass.inc

@ -223,7 +223,8 @@ class MimeClass {
*/
public function get_mimetype( $filename, $debug = FALSE ) {
$ext = strtolower( array_pop( explode( '.', $filename ) ) );
$file_name_and_extension = explode( '.', $filename );
$ext = strtolower( array_pop( $file_name_and_extension ) );
if ( ! empty( $this->private_mime_types[$ext] ) ) {
if ( TRUE === $debug )

12
ObjectHelper.inc

@ -876,7 +876,8 @@ class ObjectHelper {
*/
function getBreadcrumbs($pid, &$breadcrumbs, $level=10) {
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>
where (<info:fedora/' . $pid . '> <dc:title> $title
and $parentObject <fedora-model:hasModel> $content
@ -893,18 +894,21 @@ class ObjectHelper {
$result = preg_split('/[\r\n]+/',do_curl($url));
array_shift($result); // throw away first line
$matches =str_getcsv(join("\n",$result));
if ($matches !== NULL) {
if ($matches !== FALSE) {
$parent = preg_replace('/^info:fedora\//','',$matches[0]);
$breadcrumbs[] = l($matches[1], 'fedora/repository/' . $pid);
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) {
$this->getBreadcrumbs($parent, $breadcrumbs, $level - 1);
}
}
}
function warnIfMisconfigured($app) {
public static function warnIfMisconfigured($app) {
$messMap = array(
'Kakadu' => 'Full installation instructions for Kakadu can be found
<a href=http://www.kakadusoftware.com/index.php?option=com_content&task=view&id=27&Itemid=23>Here</a>',

10
XMLDatastream.inc

@ -92,11 +92,17 @@ abstract class XMLDatastream {
*/
public function __construct($xmlStr, $pid = NULL, $dsid = NULL) {
libxml_use_internal_errors(true);
$this->pid = $pid;
$this->dsid = $dsid;
if ($xmlStr !== NULL) {
$this->xml = (is_object($xmlStr) && get_class($xmlStr) == DOMDocument) ? $xmlStr : DOMDocument::loadXML($xmlStr);
if(is_object($xmlStr) && get_class($xmlStr) == DOMDocument) {
$this->xml = $xmlStr;
}
else {
$this->xml = new DOMDocument();
$this->xml->loadXML($xmlStr);
}
}
}

33
ilives/fedora_ilives.test

@ -1,33 +0,0 @@
<?php
class fedoraBookTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Fedora Ilives',
'description' => t('The Fedora repository book module.'),
'group' => t('fedora repository'),
);
}
protected function setUp() {
parent::setUp('fedora_ilives', 'fedora_repository');
// Create and login user.
$drupal_user = $this->drupalCreateUser(array('add fedora datastreams',
'edit fedora meta data',
'edit tags datastream',
'ingest new fedora objects',
'purge objects and datastreams',
'view fedora collection'));
$this->drupalLogin($drupal_user);
}
public function testFedoraIlives() {
// Initially we are just testing that the module installs successfully from a clean Drupal. ISLANDORA-165.
$this->pass(drupal_get_path('module', 'fedora_ilives'));
}
}

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');
// Required fields are file location, dc:title and dc:description
$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['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');
@ -79,6 +80,11 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase {
$this->assertPattern('/Item .* created successfully./', "Verified item created.");
$pid = $this->getIngestedPid();
$this->drupalGet("fedora/repository/$pid");
$this->assertLink('Home');
$this->assertLink('Digital Repository');
$this->assertLink($ingest_title);
$pid_list[] = $pid;
$this->pass('Now attempting to ingest a PDF into the new collection.');
// Now try ingesting a PDF

Loading…
Cancel
Save