From a2478a708ba72893d435365a5f00025e709d495f Mon Sep 17 00:00:00 2001 From: Indranil Das Gupta Date: Thu, 28 May 2015 04:18:44 +0530 Subject: [PATCH] Bug 14252: (followup) Adds OpacLangSelectorMode syspref MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Based on discussion, this followup does the following: 1/ brings back the switcher on opac-bottom.inc 2/ adds a syspref OpacLangSelectorMode to toggle between the three modes: (a) show switcher both on masthead and footer (default) (b) footer only (b) masthead only Test plan ========= 1/ apply earlier patches attached to this bug in their correct order 2/ apply this followup patch 3/ run updatedatabase.pl to add in the atomic update 4/ goto admin/preferences.pl?tab=opac 5/ look up OpacLangSelectorMode, it should be set with default value "both masthead and footer" 6/ check OPAC to see if both locations show the selectors 7/ change OpacLangSelectorMode to 'only header' and 'only footer' at each iteration, and check if the selection has correctly toggled the selectors. It should Note: make sure you do not have the patch 11057 applied on the branch from before, otherwise merge conflict might happen. http://bugs.koha-community.org/show_bug.cgi?id=14252 Followed test plan. Works as expected. Signed-off-by: Marc Véron Signed-off-by: Mark Tompsett Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- ...bug_14252-OpacLangSelectorMode_syspref.sql | 4 ++ installer/data/mysql/sysprefs.sql | 1 + .../en/modules/admin/preferences/opac.pref | 7 +++ .../bootstrap/en/includes/masthead.inc | 2 + .../bootstrap/en/includes/opac-bottom.inc | 44 ++++++++++++++++++- 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_14252-OpacLangSelectorMode_syspref.sql diff --git a/installer/data/mysql/atomicupdate/bug_14252-OpacLangSelectorMode_syspref.sql b/installer/data/mysql/atomicupdate/bug_14252-OpacLangSelectorMode_syspref.sql new file mode 100644 index 0000000000..edaed6c43b --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_14252-OpacLangSelectorMode_syspref.sql @@ -0,0 +1,4 @@ +-- +-- Adds OpacLangSelectorMode syspref for bug 14252 +-- +INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('OpacLangSelectorMode','both','both|head|foot','Select the location to display the language selector','Choice'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 8fd6bf5711..004ebadee4 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -269,6 +269,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpacItemLocation','callnum','callnum|ccode|location','Show the shelving location of items in the opac','Choice'), ('OPACItemsResultsDisplay','0','','If OFF : show only the status of items in result list.If ON : show full location of items (branch+location+callnumber) as in staff interface','YesNo'), ('OpacKohaUrl','1',NULL,'Show \'Powered by Koha\' text on OPAC footer.',NULL), +('OpacLangSelectorMode','both','both|head|foot','Select the location to display the language selector','Choice'), ('opaclanguages','en',NULL,'Set the default language in the OPAC.','Languages'), ('opaclanguagesdisplay','0','','If ON, enables display of Change Language feature on OPAC','YesNo'), ('opaclayoutstylesheet','opac.css','','Enter the name of the layout CSS stylesheet to use in the OPAC','free'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 0c7c50749a..af7872122b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -317,6 +317,13 @@ OPAC: - pref: OpacCustomSearch type: textarea class: code + - + - "Display language selector on " + - pref: OpacLangSelectorMode + choices: + both: "both masthead and footer" + head: "only header" + foot: "only footer" Features: - - pref: opacuserlogin diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index a43430467b..c8dff498be 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -71,6 +71,7 @@
- +[% IF ( Koha.Preference( 'OpacLangSelectorMode' ) == 'both' ) || ( Koha.Preference( 'OpacLangSelectorMode' ) == 'foot' ) %] + [% IF ( opaclanguagesdisplay ) %] + [% IF ( languages_loop && opaclanguagesdisplay ) %] + [% UNLESS ( one_language_enabled ) %] + + [% END # / UNLESS ( one_language_enabled ) %] + [% END # / IF ( languages_loop && opaclanguagesdisplay ) %] + [% END # / IF opaclanguagesdisplay %] +[% END %] [% END # / UNLESS is_popup %] -- 2.39.2