From 0944517607dfe9b0fcb38caf0488967e4add5e70 Mon Sep 17 00:00:00 2001 From: mroy Date: Tue, 7 Dec 2010 12:37:53 -0600 Subject: [PATCH 1/2] Added a method to display exif metadata from the EXIF datstream of an object. --- plugins/Exiftool.inc | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/plugins/Exiftool.inc b/plugins/Exiftool.inc index 7d27bc02..02ff913c 100644 --- a/plugins/Exiftool.inc +++ b/plugins/Exiftool.inc @@ -8,7 +8,15 @@ */ class Exiftool { - function Exiftool() { + + private $pid = NULL; + private $item = NULL; + + function __construct($pid) { + //drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); + $this->pid = $pid; + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $this->item = new Fedora_Item($this->pid); } function extractMetadata($parameterArray, $dsid, $file, $file_ext) { @@ -21,4 +29,35 @@ class Exiftool { $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; return TRUE; } + + function displayMetadata() { + $output=''; + $exifDom = DOMDocument::loadXML($this->item->get_datastream_dissemination('EXIF')); + + $description = $exifDom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#','Description'); + if ($description->length > 0) { + $description=$description->item(0); + $output .= '
'; + + $fieldset = array( + '#title' => t("!text", array('!text' => 'Technical Metadata')), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#value' => $output + ); + $output = theme('fieldset', $fieldset); + } + return $output; + } + } From 09ff6035dfa142a2bcfeda9caee0ed51a5bc27cc Mon Sep 17 00:00:00 2001 From: mroy Date: Tue, 7 Dec 2010 12:39:40 -0600 Subject: [PATCH 2/2] modified to include isMemberOf and isPartOf in addition to isMemberOfCollection in mods:relatedItem --- workflow_client/plugins/mods_extend.inc | 48 +++++++++++++------------ 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/workflow_client/plugins/mods_extend.inc b/workflow_client/plugins/mods_extend.inc index caf13aff..575974e0 100644 --- a/workflow_client/plugins/mods_extend.inc +++ b/workflow_client/plugins/mods_extend.inc @@ -65,35 +65,39 @@ class mods_extend extends Process { break; } } - - $collections= $relsExtDom->getElementsByTagName('isMemberOfCollection'); - for ($i=0; $i < $collections->length; $i++) { - $collection = $collections->item($i); - list(, $ident) = explode('/', $collection->getAttribute('rdf:resource')); + + $relationships = array('isMemberOfCollection','isMemberOf','isPartOf'); + foreach ($relationships as $relationship) + { + $collections= $relsExtDom->getElementsByTagName($relationship); + for ($i=0; $i < $collections->length; $i++) { + $collection = $collections->item($i); + list(, $ident) = explode('/', $collection->getAttribute('rdf:resource')); - $collection = new fedora_item($ident); - $dc = new SimpleXMLElement($collection->get_datastream_dissemination('DC'), NULL, FALSE, 'http://purl.org/dc/elements/1.1/'); + $collection = new fedora_item($ident); + $dc = new SimpleXMLElement($collection->get_datastream_dissemination('DC'), NULL, FALSE, 'http://purl.org/dc/elements/1.1/'); - $relatedItem = $modsDom->createElement('mods:relatedItem'); - $relatedItem->setAttribute('type', 'host'); - $titleInfo = $modsDom->createElement('mods:titleInfo'); - $title = $modsDom->createElement('mods:title', $dc->title); - $titleInfo->appendChild($title); - $relatedItem->appendChild($titleInfo); + $relatedItem = $modsDom->createElement('mods:relatedItem'); + $relatedItem->setAttribute('type', 'host'); + $titleInfo = $modsDom->createElement('mods:titleInfo'); + $title = $modsDom->createElement('mods:title', $dc->title); + $titleInfo->appendChild($title); + $relatedItem->appendChild($titleInfo); - $identifier = $modsDom->createElement('mods:identifier', $ident); - $identifier->setAttribute('type', 'pid'); - $relatedItem->appendChild($identifier); + $identifier = $modsDom->createElement('mods:identifier', $ident); + $identifier->setAttribute('type', 'pid'); + $relatedItem->appendChild($identifier); - $ident = preg_replace('/^.*\:/', '10719/', $ident); + $ident = preg_replace('/^.*\:/', '10719/', $ident); - $identifier = $modsDom->createElement('mods:identifier', $ident); - $identifier->setAttribute('type', 'hdl'); - $relatedItem->appendChild($identifier); + $identifier = $modsDom->createElement('mods:identifier', $ident); + $identifier->setAttribute('type', 'hdl'); + $relatedItem->appendChild($identifier); - $modsRoot->appendChild($relatedItem); + $modsRoot->appendChild($relatedItem); + } } - + $identifier = $modsDom->createElement('mods:identifier', $pid); $identifier->setAttribute('type', 'pid'); $modsRoot->appendChild($identifier);