LP#1772680: add global flag to control display of digital search tab
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 20 Sep 2018 20:23:10 +0000 (16:23 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 4 Jun 2019 21:33:17 +0000 (17:33 -0400)
This patch introduces a new global flag, extras.enable_digital_resource_search_tab,
that controls whether the public catalog search tab for digital
resources is displayed. If that flag is not turned on, the tab
is not displayed and unnecessary RBDigital initialization code
is bypassed.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting.ebook-api-rbdigital.sql
Open-ILS/src/templates/opac/parts/topnav.tt2

index 74196c8..70c087c 100644 (file)
@@ -163,7 +163,7 @@ sub load {
     return $self->load_temp_warn_post if $path =~ m|opac/temp_warn/post|;
     return $self->load_temp_warn if $path =~ m|opac/temp_warn|;
 
-    # Load EbookAPI modules 
+    # Load RBDigital EbookAPI modules 
     return $self->load_rbdigital_advanced if $path =~ m|opac/ebook_api/rbdigital/advanced|;
     return $self->load_rbdigital_manage_search_fields if $path =~ m|opac/ebook_api/rbdigital/manage_search_fields|;
     return $self->load_rbdigital_results if $path =~ m|opac/ebook_api/rbdigital/results|;
@@ -393,7 +393,13 @@ sub load_common {
         return $rows;
     };
 
-    $self->load_rbdigital_common();
+
+    $ctx->{digital_resource_search_tab_enabled} = 0;
+    my $flag = $e->retrieve_config_global_flag('extras.enable_digital_resource_search_tab');
+    if ($flag && $U->is_true($flag->enabled)) {
+        $self->load_rbdigital_common();
+        $ctx->{digital_resource_search_tab_enabled} = 1;
+    }
 
     return Apache2::Const::OK;
 }
index 39ffba9..47f7df5 100644 (file)
@@ -20019,3 +20019,14 @@ VALUES (
     'string'
 );
 
+INSERT INTO config.global_flag (name, label, enabled) VALUES (
+    'extras.enable_digital_resource_search_tab',
+    oils_i18n_gettext(
+        'extras.enable_digital_resource_search_tab',
+        'Extras: Enable public catalog search tab for digital resource searches (e.g., RBDigital)',
+        'cgf',
+        'label'
+    ),
+    FALSE
+);
+
index 4e525f3..8cf46e9 100644 (file)
@@ -2,6 +2,17 @@ BEGIN;
 
 -- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
 
+INSERT INTO config.global_flag (name, label, enabled) VALUES (
+    'extras.enable_digital_resource_search_tab',
+    oils_i18n_gettext(
+        'extras.enable_digital_resource_search_tab',
+        'Extras: Enable public catalog search tab for digital resource searches (e.g., RBDigital)',
+        'cgf',
+        'label'
+    ),
+    FALSE
+);
+
 INSERT INTO config.org_unit_setting_type
     (name, label, description, grp, datatype) 
 VALUES (
index 5fc4a6f..7dbe734 100644 (file)
 </div>
 </div>
 [% INCLUDE "opac/parts/topnav_links.tt2" %]
-[% INCLUDE "opac/parts/vendor_tabs.tt2" %]
+[% IF ctx.digital_resource_search_tab_enabled;
+      INCLUDE "opac/parts/vendor_tabs.tt2";
+   END %]
 [% END %]