From 332f7d64c9af01dd90ae78707c9c8544a02050f0 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Marc=20V=C3=A9ron?= Date: Fri, 2 Jun 2017 12:11:47 +0200 Subject: [PATCH] Bug 18718: Language selector in staff header menu similar to OPAC Content-Type: text/plain; charset=utf-8 This patch adds a language selector menu to the top menu of staff client similar to the OPAC. Display of language selectors at top, bottom or both can be configured with system preference StaffLangSelectorModer. It defaults to bottom. To test: - Apply patch - Udate database - Restart plack and memchached - Go to staff client, verify that language selector displays at the bottom of the page (as before) - Go to system preferences, verify that there is a new preference StaffLanguageSelectorMode (name similar to the sypref ror OPAC), and that it is set to 'footer' - Change mode for top, both and footer and verify, go to staff client and verify for each that the language selector displays as appropriate (Amended for comment #2 2017-06-02 mv) Signed-off-by: Josef Moravec Signed-off-by: Marcel de Rooy --- ...icupdate_bug_18718_Language_Selector_Staff.perl | 13 +++++++++ installer/data/mysql/sysprefs.sql | 3 ++- .../intranet-tmpl/prog/en/includes/header.inc | 1 + .../prog/en/includes/intranet-bottom.inc | 4 +-- .../prog/en/includes/langmenu-staff-top.inc | 31 ++++++++++++++++++++++ .../en/modules/admin/preferences/staff_client.pref | 7 +++++ 6 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/atomicupdate_bug_18718_Language_Selector_Staff.perl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/langmenu-staff-top.inc diff --git a/installer/data/mysql/atomicupdate/atomicupdate_bug_18718_Language_Selector_Staff.perl b/installer/data/mysql/atomicupdate/atomicupdate_bug_18718_Language_Selector_Staff.perl new file mode 100644 index 0000000..8a49955 --- /dev/null +++ b/installer/data/mysql/atomicupdate/atomicupdate_bug_18718_Language_Selector_Staff.perl @@ -0,0 +1,13 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do("INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('StaffLangSelectorMode','footer','top|both|footer','Select the location to display the language selector in staff client','Choice')" ); + + # or perform some test and warn + # if( !column_exists( 'biblio', 'biblionumber' ) ) { + # warn "There is something wrong"; + # } + + # Always end with this (adjust the bug info) + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 18718 - Language selector in staff header menu similar to OPAC )\n"; +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 1cad43e..5155fe7 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -340,7 +340,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','top|both|footer','Select the location to display the language selector','Choice'), +('OpacLangSelectorMode','both','top|both|footer','Select the location to display the language selector in OPAC','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'), @@ -496,6 +496,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('SpineLabelShowPrintOnBibDetails','0','','If turned on, a \"Print Label\" link will appear for each item on the bib details page in the staff interface.','YesNo'), ('staffClientBaseURL','',NULL,'Specify the base URL of the staff client','free'), ('StaffDetailItemSelection', '1', NULL, 'Enable item selection in record detail page', 'YesNo'), +('StaffLangSelectorMode','footer','top|both|footer','Select the location to display the language selector in staff client','Choice'), ('StaffSearchResultsDisplayBranch','holdingbranch','holdingbranch|homebranch','Controls the display of the home or holding branch for staff search results','Choice'), ('StaffSerialIssueDisplayCount','3','','Number of serial issues to display per subscription in the Staff client','Integer'), ('StaticHoldsQueueWeight','0',NULL,'Specify a list of library location codes separated by commas -- the list of codes will be traversed and weighted with first values given higher weight for holds fulfillment -- alternatively, if RandomizeHoldsQueueWeight is set, the list will be randomly selective','Integer'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc index 2c88c6c..7573ac2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc @@ -97,6 +97,7 @@ + [% INCLUDE 'langmenu-staff-top.inc' %]
  • Help
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc index fb6ffbb..5361307 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc @@ -1,6 +1,6 @@ +[% USE Koha %] - -[% IF ( languages_loop && ! popup_window ) %] +[% IF ( ( languages_loop ) && ( ! popup_window ) && ( Koha.Preference('StaffLangSelectorMode') == 'both' || Koha.Preference('StaffLangSelectorMode') == 'footer') ) %] [% UNLESS ( one_language_enabled ) %]