Browse Source

fulfilling request for config options for FITS support in ISLANDORA-680

pull/152/head
nruest 13 years ago
parent
commit
5d95a7c30f
  1. 18
      formClass.inc
  2. 16
      plugins/fits.inc

18
formClass.inc

@ -1,7 +1,5 @@
<?php <?php
/** /**
* @file * @file
* formClass class * formClass class
@ -370,6 +368,22 @@ class formClass {
'#default_value' => variable_get('fedora_control_group_control_during_ingest', FALSE), '#default_value' => variable_get('fedora_control_group_control_during_ingest', FALSE),
); );
//FITS functionality
$form['advanced']['enable_fits'] = array(
'#type' => 'checkbox',
'#title' => t('Enable FITS support?'),
'#description' => t('Whether or not we should create a FITS datastream upon object ingest.'),
'#default_value' => variable_get('enable_fits', TRUE),
);
//FITS Path
$form['advanced']['fits_path'] = array(
'#type' => 'textfield',
'#title' => t('Path to FITS executable'),
'#description' => t("Path to FITS program on your server. It must be accessible by Drupal (i.e. apache user)."),
'#default_value' => variable_get('fits_path','/usr/local/bin/fits.sh'),
);
//Export functionality //Export functionality
$form['advanced']['module']['export_area'] = array( $form['advanced']['module']['export_area'] = array(
'#type' => 'textfield', '#type' => 'textfield',

16
plugins/fits.inc

@ -41,14 +41,16 @@ class fits {
* @return type * @return type
*/ */
function extractFits($parameterArray, $dsid, $file, $file_ext) { function extractFits($parameterArray, $dsid, $file, $file_ext) {
$file_name = '_' . $dsid . '.xml'; if (variable_get('enable_fits', TRUE) == 1) {
$output = array(); $file_name = '_' . $dsid . '.xml';
exec('fits.sh -i ' . escapeshellarg($file) . '', $output); $output = array();
if ( !file_put_contents($file . $file_name, implode("\n", $output)) ) { exec(variable_get('fits_path', '/usr/local/bin/fits.sh') .' -i ' . escapeshellarg($file) . '', $output);
exit("Error writing file: ". $file_name); if ( !file_put_contents($file . $file_name, implode("\n", $output)) ) {
exit("Error writing file: ". $file.$file_name);
}
$_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_name;
return TRUE;
} }
$_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_name;
return TRUE;
} }
/** /**

Loading…
Cancel
Save