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,9 +796,7 @@ 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/authtokens');
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/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/theme.inc b/theme/theme.inc
index 7cac4d1a..1622d810 100644
--- a/theme/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();