From f54e2f2acb46021c0e6575379edfbf149d8da926 Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Tue, 3 Jul 2012 08:54:21 -0400 Subject: [PATCH 1/2] Little more checking if there is any tab content... ... If there is none, we don't bother rendering the tab. --- plugins/FedoraObjectDetailedContent.inc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/FedoraObjectDetailedContent.inc b/plugins/FedoraObjectDetailedContent.inc index 3455ea06..593a42a2 100644 --- a/plugins/FedoraObjectDetailedContent.inc +++ b/plugins/FedoraObjectDetailedContent.inc @@ -76,7 +76,7 @@ class FedoraObjectDetailedContent { $dc_array = $dc_returned; $dc_array['#weight'] = $i++; } - else { + elseif (!empty($dc_returned)) { $dc_array = array( '#type' => 'markup', '#value' => $dc_returned, //XXX: This could easily be done in Drupal, instead of using an XSL @@ -87,8 +87,12 @@ class FedoraObjectDetailedContent { $tabset['fedora_object_details']['tabset']['view'] = array( '#type' => 'tabpage', '#title' => t('View'), - 'dc' => $dc_array, ); + + if (!empty($dc_array)) { + $tabset['fedora_object_details']['tabset']['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( @@ -135,7 +139,8 @@ class FedoraObjectDetailedContent { } $ts = $tabset['fedora_object_details']['tabset']; - if (array_key_exists('view', $ts) || array_key_exists('edit', $ts)) { + if ((array_key_exists('view', $ts) && (count(element_children($ts['view'])) > 0)) || + (array_key_exists('edit', $ts) && (count(element_children($ts['edit'])) > 0 || array_key_exists('#content', $ts['edit'])))) { return $tabset; } else { From 6b05e20316b4d5083d828a3edd7d0fbab393d53e Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Tue, 3 Jul 2012 09:42:46 -0400 Subject: [PATCH 2/2] Remove lines creating getDatastream error... --- ObjectHelper.inc | 3 --- 1 file changed, 3 deletions(-) diff --git a/ObjectHelper.inc b/ObjectHelper.inc index d34e64c3..408b2604 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -137,9 +137,6 @@ class ObjectHelper { $fedoraPass = $user->pass; } - $dataStreamInfo = $item->get_datastream_info($dsID); - $contentSize = $dataStreamInfo->datastream->size; - if (function_exists("curl_init")) { $url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/objects/' . $pid . '/datastreams/' . $dsID . '/content'; $query_options = array();