From 32f2f7d75397d0d146419ccbd1e174bfc60d876b Mon Sep 17 00:00:00 2001 From: nruest Date: Thu, 28 Jun 2012 16:35:36 -0400 Subject: [PATCH 01/10] sketching out fits support --- plugins/fits.inc | 85 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 plugins/fits.inc diff --git a/plugins/fits.inc b/plugins/fits.inc new file mode 100644 index 00000000..1de5a559 --- /dev/null +++ b/plugins/fits.inc @@ -0,0 +1,85 @@ +pid = $pid; + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $this->item = new Fedora_Item($this->pid); + } + + /** + * extract metadata + * @param type $parameterArray + * @param type $dsid + * @param type $file + * @param type $file_ext + * @return type + */ + function extractMetadata($parameterArray, $dsid, $file, $file_ext) { + $system = getenv('System'); + $file_suffix = '_' . $dsid . '.xml'; + $returnValue = TRUE; + $output = array(); + exec('fits ' . escapeshellarg($file) . '', $output); + file_put_contents($file . $file_suffix, implode("\n", $output)); + $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; + return TRUE; + } + + /** + * display metadata + * @return type + */ + function displayMetadata() { + $output = ''; + $exif = $this->item->get_datastream_dissemination('FITS'); + if (trim($exif) != '') { + $exifDom = DOMDocument::loadXML($this->item->get_datastream_dissemination('FITS')); + if ($exifDom != NULL) { + $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' => 'FITS Technical Metadata')), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#value' => $output + ); + $output = theme('fieldset', $fieldset); + } + } + } + return $output; + } + +} From a0e8b599003e7efe13192da07156371d317706f9 Mon Sep 17 00:00:00 2001 From: nruest Date: Thu, 19 Jul 2012 12:20:59 -0400 Subject: [PATCH 02/10] ready to test --- plugins/fits.inc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/fits.inc b/plugins/fits.inc index 1de5a559..abc9074f 100644 --- a/plugins/fits.inc +++ b/plugins/fits.inc @@ -38,7 +38,7 @@ class fits { $file_suffix = '_' . $dsid . '.xml'; $returnValue = TRUE; $output = array(); - exec('fits ' . escapeshellarg($file) . '', $output); + exec('fits.sh -h' . escapeshellarg($file) . '', $output); file_put_contents($file . $file_suffix, implode("\n", $output)); $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; return TRUE; @@ -50,11 +50,11 @@ class fits { */ function displayMetadata() { $output = ''; - $exif = $this->item->get_datastream_dissemination('FITS'); - if (trim($exif) != '') { - $exifDom = DOMDocument::loadXML($this->item->get_datastream_dissemination('FITS')); - if ($exifDom != NULL) { - $description = $exifDom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description'); + $fits = $this->item->get_datastream_dissemination('FITS'); + if (trim($fits) != '') { + $fitsDom = DOMDocument::loadXML($this->item->get_datastream_dissemination('FITS')); + if ($fitsDom != NULL) { + $description = $fitsDom->getElementsByTagNameNS('http://hul.harvard.edu/ois/xml/ns/fits/fits_output', 'fits'); if ($description->length > 0) { $description = $description->item(0); $output .= '