@@ -, +, @@ --- C4/Auth.pm | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++ .../prog/en/modules/admin/preferences/opac.pref | 7 +++++ .../opac-tmpl/prog/en/js/googletransliteration.js | 29 ++++++++++++++++++++ opac/opac-main.pl | 5 --- opac/opac-search.pl | 5 --- 6 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/prog/en/js/googletransliteration.js --- a/C4/Auth.pm +++ a/C4/Auth.pm @@ -458,6 +458,7 @@ sub get_template_and_user { ShowReviewerPhoto => C4::Context->preference("ShowReviewerPhoto"), suggestion => "" . C4::Context->preference("suggestion"), virtualshelves => "" . C4::Context->preference("virtualshelves"), + GoogleTransliteration => C4::Context->preference("GoogleTransliteration"), OPACSerialIssueDisplayCount => C4::Context->preference("OPACSerialIssueDisplayCount"), OpacAddMastheadLibraryPulldown => C4::Context->preference("OpacAddMastheadLibraryPulldown"), OPACXSLTDetailsDisplay => C4::Context->preference("OPACXSLTDetailsDisplay"), --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -4370,6 +4370,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion($DBversion); } +$DBversion = '3.05.00.XXX'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('GoogleTransliteration','0','Show GoogleTransliteration on the OPAC Masthead.', '','YesNo')"); + print "Upgrade to $DBversion done (Add GoogleTransliteration on opac page)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -1,4 +1,11 @@ OPAC: + GoogleTransliteration: + - + - pref: GoogleTransliteration + choices: + yes: Show + no: "Don't show" + - Show GoogleTransliteration on the OPAC Masthead. Appearance: - - Use the --- a/koha-tmpl/opac-tmpl/prog/en/js/googletransliteration.js +++ a/koha-tmpl/opac-tmpl/prog/en/js/googletransliteration.js @@ -0,0 +1,29 @@ + // Load the Google Transliteration API + google.load("elements", "1", { + packages: "transliteration" + }); + + function onLoad() { + var options = { + sourceLanguage: 'en', + destinationLanguage: ['hi','kn','ml','ta','te','ar','ur','pa','fa','bn'], + 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 = [ "transl1" ]; + 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); + + --- a/opac/opac-main.pl +++ a/opac/opac-main.pl @@ -90,9 +90,4 @@ $template->param( koha_news_count => $koha_news_count ); -# If GoogleIndicTransliteration system preference is On Set paramter 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; --- a/opac/opac-search.pl +++ a/opac/opac-search.pl @@ -669,9 +669,4 @@ if (defined $barshelves) { my $content_type = ($format eq 'rss' or $format eq 'atom') ? $format : 'html'; -# If GoogleIndicTransliteration system preference is On Set paramter to load Google's javascript in OPAC search screens -if (C4::Context->preference('GoogleIndicTransliteration')) { - $template->param('GoogleIndicTransliteration' => 1); -} - output_with_http_headers $cgi, $cookie, $template->output, $content_type; --