content);
+ // @TODO, need better check for $object
+ if ($object && $object[$dsid]) {
+ $doc = simplexml_load_string($object[$dsid]->content);
}
elseif (!empty($datastream_file)) {
$doc = simplexml_load_file($datastream_file);
}
- if (!empty($doc) && $version = (int)$doc->attributes()->version) {
+ if (!empty($doc) && $version = (int) $doc->attributes()->version) {
$return = $version;
}
@@ -710,18 +717,18 @@ function islandora_get_islandora_datastream_version($item = NULL, $dsid = NULL,
*/
function islandora_islandora_required_objects(IslandoraTuque $connection) {
$module_path = drupal_get_path('module', 'islandora');
- // Root Collection
+ // Root Collection.
$root_collection = $connection->repository->constructObject('islandora:root');
$root_collection->owner = 'fedoraAdmin';
$root_collection->label = 'Top-level Collection';
$root_collection->models = 'islandora:collectionCModel';
- // Collection Policy Datastream
+ // Collection Policy Datastream.
$datastream = $root_collection->constructDatastream('COLLECTION_POLICY', 'X');
$datastream->label = 'Collection policy';
$datastream->mimetype = 'text/xml';
$datastream->setContentFromFile("$module_path/xml/islandora_collection_policy.xml", FALSE);
$root_collection->ingestDatastream($datastream);
- // TN Datastream
+ // TN Datastream.
$datastream = $root_collection->constructDatastream('TN', 'M');
$datastream->label = 'Thumbnail';
$datastream->mimetype = 'image/png';
@@ -731,9 +738,9 @@ function islandora_islandora_required_objects(IslandoraTuque $connection) {
'islandora' => array(
'title' => 'Islandora',
'objects' => array(
- $root_collection
- )
- )
+ $root_collection,
+ ),
+ ),
);
}
@@ -789,12 +796,10 @@ function islandora_delete_datastream(FedoraDatastream &$datastream) {
}
/**
- * Implements hook_cron()
- *
- * Removes expired authentication tokens.
+ * Implements hook_cron().
*/
function islandora_cron() {
- module_load_include('inc', 'islandora', 'includes/islandora_authtokens');
+ module_load_include('inc', 'islandora', 'includes/authtokens');
islandora_remove_expired_tokens();
}
diff --git a/islandora.rules.inc b/islandora.rules.inc
index bda999b3..7a97e44a 100644
--- a/islandora.rules.inc
+++ b/islandora.rules.inc
@@ -1,5 +1,10 @@
array(
'type' => 'islandora_object',
'label' => t('Subject'),
- 'description' => t('An object of which we should check the ' .
- 'relationships (The "subject" of the relationship).'),
+ 'description' => t('An object of which we should check the relationships (The "subject" of the relationship).'),
),
'pred_uri' => array(
'type' => 'text',
@@ -112,4 +116,3 @@ function islandora_object_remove_relationship($sub, $pred_uri, $pred, $object, $
function islandora_object_add_relationship($sub, $pred_uri, $pred, $object, $type) {
$sub->relationships->add($pred_uri, $pred, $object, $type);
}
-
diff --git a/tests/islandora_authtokens.test b/tests/authtokens.test
similarity index 94%
rename from tests/islandora_authtokens.test
rename to tests/authtokens.test
index 326225f2..ccd3088a 100644
--- a/tests/islandora_authtokens.test
+++ b/tests/authtokens.test
@@ -29,7 +29,7 @@ class IslandoraAuthtokensTestCase extends IslandoraWebTestCase {
* Test redeeming invalid tokens.
*/
public function testRedeemInvalidToken() {
- module_load_include('inc', 'islandora', 'includes/islandora_authtokens');
+ module_load_include('inc', 'islandora', 'includes/authtokens');
$token = islandora_get_object_token('test:pid', 'woot', 1);
$this->assertTrue($token, 'Token was generated correctly.', 'Unit Tests');
// Redeem a token that doesn't exist with real pid and dsid.
@@ -41,7 +41,7 @@ class IslandoraAuthtokensTestCase extends IslandoraWebTestCase {
* Test redeeming valid tokens.
*/
public function testRedeemValidToken() {
- module_load_include('inc', 'islandora', 'includes/islandora_authtokens');
+ module_load_include('inc', 'islandora', 'includes/authtokens');
// Change the current user.
global $user;
$user_backup = $user;
@@ -82,7 +82,7 @@ class IslandoraAuthtokensTestCase extends IslandoraWebTestCase {
// Do some voodoo to get a token as the user we are connecting as
// to do this we need to change the user we are logged in as.
- module_load_include('inc', 'islandora', 'includes/islandora_authtokens');
+ module_load_include('inc', 'islandora', 'includes/authtokens');
global $user;
$backup = $user;
$user = $account;
diff --git a/tests/islandora_hooks.test b/tests/hooks.test
similarity index 100%
rename from tests/islandora_hooks.test
rename to tests/hooks.test
diff --git a/tests/islandora_hooks_test.info b/tests/islandora_test.info
similarity index 62%
rename from tests/islandora_hooks_test.info
rename to tests/islandora_test.info
index 9d211978..c6cb57ad 100644
--- a/tests/islandora_hooks_test.info
+++ b/tests/islandora_test.info
@@ -1,7 +1,6 @@
-name = Islandora Hook testing
+name = Islandora Test Module
description = Tests Hooks. Do not enable.
core = 7.x
package = Testing
hidden = TRUE
dependencies[] = islandora
-files[] = islandora_hooks_test.module
diff --git a/tests/islandora_hooks_test.module b/tests/islandora_test.module
similarity index 100%
rename from tests/islandora_hooks_test.module
rename to tests/islandora_test.module
diff --git a/tests/islandora_web_test_case.inc b/tests/web_test_case.inc
similarity index 100%
rename from tests/islandora_web_test_case.inc
rename to tests/web_test_case.inc
diff --git a/theme/islandora-object-edit.tpl.php b/theme/islandora-object-edit.tpl.php
index 266a1259..ea9cec64 100644
--- a/theme/islandora-object-edit.tpl.php
+++ b/theme/islandora-object-edit.tpl.php
@@ -2,9 +2,7 @@
/**
* @file
- *
- * islandora-object-edit.tpl.php: This is a template for objects that do not
- * have a module to registered to build their display.
+ * The default manage datastreams view for objects.
*
* islandora_object is a fedora tuque Object
* $object->label
@@ -17,7 +15,6 @@
* and each element has an array of values.
* dc.title can have none, one or many titles
* this is the case for all dc elements.
- *
*/
?>
diff --git a/theme/islandora-object.tpl.php b/theme/islandora-object.tpl.php
index 753232c5..13b40ba0 100644
--- a/theme/islandora-object.tpl.php
+++ b/theme/islandora-object.tpl.php
@@ -2,6 +2,7 @@
/**
* @file
+ * The default object view.
*
* This is a template for objects that do not have a module to registered to
* build their display.
@@ -55,7 +56,6 @@
* foreach ($object as $ds) {
* do something here
* }
- *
*/
?>
diff --git a/theme/islandora.theme.inc b/theme/theme.inc
similarity index 65%
rename from theme/islandora.theme.inc
rename to theme/theme.inc
index 7cac4d1a..1622d810 100644
--- a/theme/islandora.theme.inc
+++ b/theme/theme.inc
@@ -2,18 +2,13 @@
/**
* @file
- *
* This file contains all theme and preprocess functions.
*/
/**
- * Preprocess the edit template
- *
- * @global string $base_url
- * @param array $variables
- * theme variables for the edit template
+ * Implements hook_preprocess_theme().
*/
-function islandora_preprocess_islandora_default_edit(&$variables) {
+function islandora_preprocess_islandora_default_edit(array &$variables) {
global $base_url;
$islandora_object = $variables['islandora_object'];
$datastreams = array();
@@ -32,27 +27,55 @@ function islandora_preprocess_islandora_default_edit(&$variables) {
$rows = array();
foreach ($islandora_object as $ds) {
$rows[] = array(
- array('class' => 'datastream-id', 'data' => l($ds->id, islandora_datastream_get_url($ds, 'view'))),
- array('class' => 'datastream-label', 'data' => $ds->label),
- array('class' => 'datastream-control', 'data' => islandora_control_group_to_human_readable($ds->controlGroup)),
- array('class' => 'datastream-mime', 'data' => $ds->mimeType),
- array('class' => 'datastream-size', 'data' => islandora_datastream_get_human_readable_size($ds)),
- array('class' => 'datastream-download', 'data' => l(t('download'), islandora_datastream_get_url($ds, 'download'))),
- array('class' => 'datstream-edit', 'data' => islandora_datastream_edit_get_link($ds)),
- array('class' => 'datastream-delete', 'data' => islandora_datastream_get_delete_link($ds)),
+ array(
+ 'class' => 'datastream-id',
+ 'data' => l($ds->id, islandora_datastream_get_url($ds, 'view')),
+ ),
+ array(
+ 'class' => 'datastream-label',
+ 'data' => $ds->label,
+ ),
+ array(
+ 'class' => 'datastream-control',
+ 'data' => islandora_control_group_to_human_readable($ds->controlGroup),
+ ),
+ array(
+ 'class' => 'datastream-mime',
+ 'data' => $ds->mimeType,
+ ),
+ array(
+ 'class' => 'datastream-size',
+ 'data' => islandora_datastream_get_human_readable_size($ds),
+ ),
+ array(
+ 'class' => 'datastream-download',
+ 'data' => l(t('download'), islandora_datastream_get_url($ds, 'download')),
+ ),
+ array(
+ 'class' => 'datstream-edit',
+ 'data' => islandora_datastream_edit_get_link($ds),
+ ),
+ array(
+ 'class' => 'datastream-delete',
+ 'data' => islandora_datastream_get_delete_link($ds),
+ ),
);
}
$caption = $islandora_object->label . ' - ' . $islandora_object->id;
- $table = array('colgroups' => NULL, 'sticky' => TRUE, 'empty' => 'Error loading datastreams', 'caption' => $caption, 'header' => $header, 'rows' => $rows, 'attributes' => $table_attributes);
+ $table = array(
+ 'colgroups' => NULL,
+ 'sticky' => TRUE,
+ 'empty' => 'Error loading datastreams',
+ 'caption' => $caption,
+ 'header' => $header,
+ 'rows' => $rows,
+ 'attributes' => $table_attributes,
+ );
$variables['datastream_table'] = $table;
}
-
/**
- * Preprocess for the default view template
- *
- * @global string $base_url
- * @param array $variables
+ * Implements hook_preprocess_theme().
*/
function islandora_preprocess_islandora_default(&$variables) {
drupal_add_js('misc/form.js');
@@ -86,9 +109,10 @@ function islandora_preprocess_islandora_default(&$variables) {
$variables['datastreams'] = $datastreams;
try {
$dc = $islandora_object['DC']->content;
- $dc_object = DublinCore::import_from_xml_string($dc);
- $dc_array = $dc_object->as_formatted_array();
- } catch (Exception $e) {
+ $dc_object = DublinCore::importFromXMLString($dc);
+ $dc_array = $dc_object->asArray();
+ }
+ catch (Exception $e) {
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error', FALSE);
}
$variables['dc_array'] = isset($dc_array) ? $dc_array : array();