Browse Source

Merge branch 'master' of github.com:Islandora/islandora

pull/105/head
root 14 years ago
parent
commit
a477653128
  1. 41
      plugins/Exiftool.inc
  2. 48
      workflow_client/plugins/mods_extend.inc

41
plugins/Exiftool.inc

@ -8,7 +8,15 @@
*/ */
class Exiftool { 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) { function extractMetadata($parameterArray, $dsid, $file, $file_ext) {
@ -21,4 +29,35 @@ class Exiftool {
$_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix;
return TRUE; 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 .= '<div class="fedora_technical_metadata"><ul>';
for ($i=0;$i<$description->childNodes->length;$i++){
$name=$description->childNodes->item($i)->nodeName;
$value=$description->childNodes->item($i)->nodeValue;
if ($name != '#text' && !preg_match('/^System\:.*$/',$name) && trim($value) != '') {
list($type,$name) = preg_split('/\:/',$name);
$name = trim(preg_replace('/(?<!^)([A-Z][a-z]|(?<=[a-z])[A-Z])/'," $1", $name));
$output .= '<li><b>'.$name. '</b>: '. $value .' </li>';
}
}
$output.='</ul></div>';
$fieldset = array(
'#title' => t("!text", array('!text' => 'Technical Metadata')),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#value' => $output
);
$output = theme('fieldset', $fieldset);
}
return $output;
}
} }

48
workflow_client/plugins/mods_extend.inc

@ -65,35 +65,39 @@ class mods_extend extends Process {
break; break;
} }
} }
$collections= $relsExtDom->getElementsByTagName('isMemberOfCollection'); $relationships = array('isMemberOfCollection','isMemberOf','isPartOf');
for ($i=0; $i < $collections->length; $i++) { foreach ($relationships as $relationship)
$collection = $collections->item($i); {
list(, $ident) = explode('/', $collection->getAttribute('rdf:resource')); $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); $collection = new fedora_item($ident);
$dc = new SimpleXMLElement($collection->get_datastream_dissemination('DC'), NULL, FALSE, 'http://purl.org/dc/elements/1.1/'); $dc = new SimpleXMLElement($collection->get_datastream_dissemination('DC'), NULL, FALSE, 'http://purl.org/dc/elements/1.1/');
$relatedItem = $modsDom->createElement('mods:relatedItem'); $relatedItem = $modsDom->createElement('mods:relatedItem');
$relatedItem->setAttribute('type', 'host'); $relatedItem->setAttribute('type', 'host');
$titleInfo = $modsDom->createElement('mods:titleInfo'); $titleInfo = $modsDom->createElement('mods:titleInfo');
$title = $modsDom->createElement('mods:title', $dc->title); $title = $modsDom->createElement('mods:title', $dc->title);
$titleInfo->appendChild($title); $titleInfo->appendChild($title);
$relatedItem->appendChild($titleInfo); $relatedItem->appendChild($titleInfo);
$identifier = $modsDom->createElement('mods:identifier', $ident); $identifier = $modsDom->createElement('mods:identifier', $ident);
$identifier->setAttribute('type', 'pid'); $identifier->setAttribute('type', 'pid');
$relatedItem->appendChild($identifier); $relatedItem->appendChild($identifier);
$ident = preg_replace('/^.*\:/', '10719/', $ident); $ident = preg_replace('/^.*\:/', '10719/', $ident);
$identifier = $modsDom->createElement('mods:identifier', $ident); $identifier = $modsDom->createElement('mods:identifier', $ident);
$identifier->setAttribute('type', 'hdl'); $identifier->setAttribute('type', 'hdl');
$relatedItem->appendChild($identifier); $relatedItem->appendChild($identifier);
$modsRoot->appendChild($relatedItem); $modsRoot->appendChild($relatedItem);
}
} }
$identifier = $modsDom->createElement('mods:identifier', $pid); $identifier = $modsDom->createElement('mods:identifier', $pid);
$identifier->setAttribute('type', 'pid'); $identifier->setAttribute('type', 'pid');
$modsRoot->appendChild($identifier); $modsRoot->appendChild($identifier);

Loading…
Cancel
Save