From 85ea633825313e60f7728885df3f1cf7f28edbb8 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 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 --- ...icupdate_bug_18718_Language_Selector_Staff.perl | 14 ++++++++++ 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, 57 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..e43494a --- /dev/null +++ b/installer/data/mysql/atomicupdate/atomicupdate_bug_18718_Language_Selector_Staff.perl @@ -0,0 +1,14 @@ +$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 0bd8cac..c04d77d 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -337,7 +337,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'), @@ -493,6 +493,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 ) %]