diff --git a/config/vufind/config.ini b/config/vufind/config.ini index f1d3740e4328ff28b1f414845d887487146b8086..176cea68a6c3a9895213466efe0507b274be1325 100644 --- a/config/vufind/config.ini +++ b/config/vufind/config.ini @@ -766,7 +766,7 @@ url = "https://api.vlb.de/api/v1/cover/" ; Tab makes a tab with an embedded preview appear on record view ; Default is "GoogleOptions['link'] = full,partial" if nothing ; is set here. -; see code.google.com/apis/books/docs/dynamic-links.html#JSONformat +; see https://developers.google.com/books/docs/dynamic-links#json-results-format ;GoogleOptions['link'] = full,partial ;GoogleOptions['tab'] = partial diff --git a/module/VuFind/src/VuFind/RecordTab/Factory.php b/module/VuFind/src/VuFind/RecordTab/Factory.php index f8faf7277a829329d0e9f7ff7d79cd5e27e0f99e..9288dfb474699b92a90d91d95d4c92724b0354dc 100644 --- a/module/VuFind/src/VuFind/RecordTab/Factory.php +++ b/module/VuFind/src/VuFind/RecordTab/Factory.php @@ -195,19 +195,14 @@ class Factory // and googleoptions[tab] is not empty. $active = false; if (isset($cfg->Content->previews)) { - $content_previews = explode( - ',', strtolower(str_replace(' ', '', $cfg->Content->previews)) + $previews = array_map( + 'trim', explode(',', strtolower($cfg->Content->previews)) ); - if (in_array('google', $content_previews) - && isset($cfg->Content->GoogleOptions) + if (in_array('google', $previews) + && isset($cfg->Content->GoogleOptions['tab']) + && strlen(trim($cfg->Content->GoogleOptions['tab'])) > 0 ) { - $g_options = $cfg->Content->GoogleOptions; - if (isset($g_options->tab)) { - $tabs = explode(',', $g_options->tab); - if (count($tabs) > 0) { - $active = true; - } - } + $active = true; } } return new Preview($active); diff --git a/module/VuFind/src/VuFind/RecordTab/Preview.php b/module/VuFind/src/VuFind/RecordTab/Preview.php index 27b995b5da6cac1d91351552c221d643b32f2d7a..4b5a5a7feb4366bb1e2029e90949355fb82f31ea 100644 --- a/module/VuFind/src/VuFind/RecordTab/Preview.php +++ b/module/VuFind/src/VuFind/RecordTab/Preview.php @@ -93,4 +93,15 @@ class Preview extends AbstractBase // until there is content return false; } + + /** + * Can this tab be loaded via AJAX? + * + * @return bool + */ + public function supportsAjax() + { + // No, Google script magic required + return false; + } } diff --git a/themes/bootstrap3/js/preview.js b/themes/bootstrap3/js/preview.js index c61bfd5830c3fe86d447efc50d75a996ceef86e2..718f92d03a12af9247021fc524e6c58da16b1bcd 100644 --- a/themes/bootstrap3/js/preview.js +++ b/themes/bootstrap3/js/preview.js @@ -68,7 +68,7 @@ function processGBSBookInfo(booksInfo) { if (viewOptions['tab'].indexOf(bookInfo.preview)>= 0 && (bookInfo.embeddable)) { // make tab visible - $('ul.recordTabs li.hidden a#preview').parent().removeClass('hidden'); + $('ul.nav-tabs li.hidden a.preview').parent().removeClass('hidden'); } } } diff --git a/themes/bootstrap3/templates/RecordTab/preview.phtml b/themes/bootstrap3/templates/RecordTab/preview.phtml index 554efc456cf62ebcaf2e61181a01afff864bbf58..06bb49936f2a473bcfe4b4fd35860613d98ad5f9 100644 --- a/themes/bootstrap3/templates/RecordTab/preview.phtml +++ b/themes/bootstrap3/templates/RecordTab/preview.phtml @@ -6,4 +6,4 @@ $this->headScript()->appendFile('https://www.google.com/jsapi'); $this->headScript()->appendFile('embedGBS.js'); ?> -<div id="gbsViewer" ></div> +<div id="gbsViewer" style="height: 600px;"></div>