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. 32
      plugins/FedoraObjectDetailedContent.inc

32
plugins/FedoraObjectDetailedContent.inc

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

Loading…
Cancel
Save