Browse Source

Add support to default to DC for Object Details on table view if datastream is missing

pull/185/head
Mitch MacKenzie 12 years ago
parent
commit
bc708b1574
  1. 9
      ObjectDetails.inc

9
ObjectDetails.inc

@ -138,6 +138,9 @@ function fedora_repository_object_details_table($item) {
}
$xmlstr = $item->get_datastream_dissemination($dsid);
if (empty($xmlstr) && variable_get('islandora_object_details_table_default_dc', FALSE) && $dsid != 'DC' && $dsid != 'QDC') {
$xmlstr = $item->get_datastream_dissemination('DC');
}
if (empty($xmlstr)) {
return t('Error - could not find datastream @dsid on object @pid<br/>Please contact the site administrator.',
array('@dsid' => $dsid, '@pid' => $item->pid));
@ -270,6 +273,11 @@ function fedora_repository_object_details_table_config() {
'#default_value' => variable_get('islandora_object_details_table_datastream', 'DC'),
'#required' => TRUE,
);
$form['config']['default_dc'] = array(
'#type' => 'checkbox',
'#title' => t("If the datastream to transform is unavailable, attempt to transform using the DC datastream"),
'#default_value' => variable_get('islandora_object_details_table_default_dc', FALSE),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t("Submit"),
@ -289,5 +297,6 @@ function fedora_repository_object_details_table_config() {
function fedora_repository_object_details_table_config_submit($form, &$form_state) {
variable_set('islandora_object_details_display_table', 'table');
variable_set('islandora_object_details_table_datastream', $form_state['values']['dsid']);
variable_set('islandora_object_details_table_default_dc', $form_state['values']['default_dc']);
drupal_set_message('Object Details view has been set to Table and your configuration has been saved');
}

Loading…
Cancel
Save