Browse Source

Refine "Object Details" handling.

- Allow "form" structure to be returned by the hook call in
  addition to markup.
- Fix permissions.
pull/141/head
Adam Vessey 13 years ago
parent
commit
efbd0da51e
  1. 38
      plugins/FedoraObjectDetailedContent.inc

38
plugins/FedoraObjectDetailedContent.inc

@ -55,14 +55,14 @@ class FedoraObjectDetailedContent {
if (!isset($profile)) { if (!isset($profile)) {
// default behaviour // default behaviour
watchdog('fedora_repository', "Error while reading the default object details display profile: @e", array("@e" => $e->getMessage()), WATCHDOG_WARNING); watchdog('fedora_repository', "Error while reading the default object details display profile: @e", array("@e" => $e->getMessage()), WATCHDOG_WARNING);
$dc_html = $objectHelper->getFormattedDC($this->item); $dc_returned = $objectHelper->getFormattedDC($this->item);
} }
else { else {
// invoke the requested display profile // invoke the requested display profile
require_once(drupal_get_path('module', $profile['module']) ."/". $profile['file']); require_once(drupal_get_path('module', $profile['module']) ."/". $profile['file']);
$details_function = $profile['function']; $details_function = $profile['function'];
if (function_exists($details_function)) { if (function_exists($details_function)) {
$dc_html = $details_function($this->item); $dc_returned = $details_function($this->item);
} }
else { else {
// problem - display profile not found // problem - display profile not found
@ -70,16 +70,27 @@ class FedoraObjectDetailedContent {
} }
} }
$dc_array = array();
$i = 0; $i = 0;
if (fedora_repository_access(OBJECTHELPER :: $VIEW_DETAILED_CONTENT_LIST, $this->pid, $user)) { if (is_array($dc_returned)) {
$tabset['fedora_object_details']['tabset']['view'] = array( $dc_array = $dc_returned;
'#type' => 'tabpage', $dc_array['#weight'] = $i++;
'#title' => t('View'), }
'dc' => array( else {
'#type' => 'markup', $dc_array = array(
'#value' => $dc_html, //XXX: This could easily be done in Drupal, instead of using an XSL '#type' => 'markup',
'#weight' => $i++ '#value' => $dc_returned, //XXX: This could easily be done in Drupal, instead of using an XSL
), '#weight' => $i++
);
}
$tabset['fedora_object_details']['tabset']['view'] = array(
'#type' => 'tabpage',
'#title' => t('View'),
'dc' => $dc_array,
);
if (fedora_repository_access(ObjectHelper :: $VIEW_DETAILED_CONTENT_LIST, $this->pid, $user)) {
$tabset['fedora_object_details']['tabset']['view'] += array(
'list' => array( 'list' => array(
'#type' => 'fieldset', '#type' => 'fieldset',
'#title' => t('Detailed List of Content'), '#title' => t('Detailed List of Content'),
@ -100,6 +111,11 @@ class FedoraObjectDetailedContent {
'#weight' => $i++, '#weight' => $i++,
), ),
), ),
);
}
if (fedora_repository_access(ObjectHelper :: $PURGE_FEDORA_OBJECTSANDSTREAMS, $this->pid, $user)) {
$tabset['fedora_object_details']['tabset']['view'] += array(
'purge' => array( 'purge' => array(
'#type' => 'markup', '#type' => 'markup',
'#value' => $purge_form, '#value' => $purge_form,

Loading…
Cancel
Save