Bug 26070: Remove GoogleIndicTransliteration system preference
authorOwen Leonard <oleonard@myacpl.org>
Mon, 27 Jul 2020 19:16:07 +0000 (19:16 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 30 Jul 2020 15:44:27 +0000 (17:44 +0200)
The Google Transliterate API was deprecated on May 26, 2011. This patch
removes the feature and associated system preference.

To test, apply the patch and run the database update process.

 - Go to Administration -> System preferences and search for
   'GoogleIndicTransliteration.' There should be no results.
 - Search the Koha codebase for references to
   'GoogleIndicTransliteration.' There should be no current references..

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

installer/data/mysql/atomicupdate/bug-26070-remove-google-transliteration.perl [new file with mode: 0644]
installer/data/mysql/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
koha-tmpl/opac-tmpl/bootstrap/js/googleindictransliteration.js [deleted file]
opac/opac-main.pl
opac/opac-search.pl

diff --git a/installer/data/mysql/atomicupdate/bug-26070-remove-google-transliteration.perl b/installer/data/mysql/atomicupdate/bug-26070-remove-google-transliteration.perl
new file mode 100644 (file)
index 0000000..13a57e7
--- /dev/null
@@ -0,0 +1,8 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+    # Remove from the systempreferences table
+    $dbh->do("DELETE FROM systempreferences WHERE variable = 'GoogleIndicTransliteration'");
+
+    # Always end with this (adjust the bug info)
+    NewVersion( $DBversion, 26070, "Remove references to deprecated Google Transliterate API");
+}
index 5fcb9b1..e33407e 100644 (file)
@@ -206,7 +206,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('FRBRizeEditions','0','','If ON, Koha will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'),
 ('GDPR_Policy','','Enforced|Permissive|Disabled','General Data Protection Regulation - policy', 'Choice'),
 ('gist','0','','Default Goods and Services tax rate NOT in %, but in numeric form (0.12 for 12%), set to 0 to disable GST','Integer'),
-('GoogleIndicTransliteration','0','','GoogleIndicTransliteration on the OPAC.','YesNo'),
 ('GoogleJackets','0',NULL,'if ON, displays jacket covers from Google Books API','YesNo'),
 ('GoogleOpenIDConnect', '0', NULL, 'if ON, allows the use of Google OpenID Connect for login', 'YesNo'),
 ('GoogleOAuth2ClientID', '', NULL, 'Client ID for the web app registered with Google', 'Free'),
index 6f6e549..edc6ec4 100644 (file)
@@ -197,13 +197,6 @@ OPAC:
                   no: "Don't show"
             - a link to recent comments in the OPAC masthead.
         -
-            - pref: GoogleIndicTransliteration
-              default: 0
-              choices:
-                  yes: Show
-                  no: "Don't show"
-            - GoogleIndicTransliteration on the OPAC.
-        -
             - pref: OpacHighlightedWords
               choices:
                   yes: Highlight
index a6f6709..d4d8b23 100644 (file)
@@ -261,10 +261,6 @@ $.widget.bridge('uitooltip', $.ui.tooltip);
         //]]>
     </script>
 [% END %]
-[% IF ( GoogleIndicTransliteration ) %]
-    <script src="https://www.google.com/jsapi"></script>
-    [% Asset.js("js/googleindictransliteration.js") | $raw %]
-[% END %]
 
 [% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
 <script>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/googleindictransliteration.js b/koha-tmpl/opac-tmpl/bootstrap/js/googleindictransliteration.js
deleted file mode 100644 (file)
index 027ad61..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-      // Load the Google Transliteration API
-      google.load("elements", "1", {
-            packages: "transliteration"
-          });
-
-       function onLoad() {
-        var options = {
-          sourceLanguage: 'en',
-          destinationLanguage: ['hi','kn','ml','ta','te'],
-          shortcutKey: 'ctrl+g',
-          transliterationEnabled: false
-        };
-
-        // Create an instance on TransliterationControl with the required
-        // options.
-        var control =
-            new google.elements.transliteration.TransliterationControl(options);
-
-        // Enable transliteration in the textfields with the given ids.
-        var ids = [ "translControl1" ];
-        control.makeTransliteratable(ids);
-
-        // Show the transliteration control which can be used to toggle between
-        // English and Hindi and also choose other destination language.
-        control.showControl('translControl');
-      }
-      google.setOnLoadCallback(onLoad);
index de5ad8e..78b8d74 100755 (executable)
@@ -105,9 +105,4 @@ $template->param(
     daily_quote         => $quote,
 );
 
-# If GoogleIndicTransliteration system preference is On Set parameter to load Google's javascript in OPAC search screens
-if (C4::Context->preference('GoogleIndicTransliteration')) {
-        $template->param('GoogleIndicTransliteration' => 1);
-}
-
 output_html_with_http_headers $input, $cookie, $template->output;
index 70e140b..cf2e9e9 100755 (executable)
@@ -1025,11 +1025,6 @@ $template->param(
 
 my $content_type = ($format eq 'rss' or $format eq 'atom' or $format eq 'opensearchdescription') ? $format : 'html';
 
-# If GoogleIndicTransliteration system preference is On Set parameter to load Google's javascript in OPAC search screens
-if (C4::Context->preference('GoogleIndicTransliteration')) {
-        $template->param('GoogleIndicTransliteration' => 1);
-}
-
 $template->{VARS}->{DidYouMean} =
   ( defined C4::Context->preference('OPACdidyoumean')
       && C4::Context->preference('OPACdidyoumean') =~ m/enable/ );