Bugzilla – Attachment 171154 Details for
Bug 37833
Incorrect logic controlling display of OPAC language selection menus
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37833: Incorrect logic controlling display of OPAC language selection menus
Bug-37833-Incorrect-logic-controlling-display-of-O.patch (text/plain), 17.99 KB, created by
David Nind
on 2024-09-06 21:54:29 UTC
(
hide
)
Description:
Bug 37833: Incorrect logic controlling display of OPAC language selection menus
Filename:
MIME Type:
Creator:
David Nind
Created:
2024-09-06 21:54:29 UTC
Size:
17.99 KB
patch
obsolete
>From 85f4ff3fec926285094904545a17d12500b7d14c Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 4 Sep 2024 16:03:07 +0000 >Subject: [PATCH] Bug 37833: Incorrect logic controlling display of OPAC > language selection menus > >This patch corrects the logic around how the OPAC language menus are >displayed. Because the footer and header lanugage menus have been >combined into one, the logic for whether the menu should appear has to >live outside the include. The patch also makes corrections to ensure >that the footer menu appears even if the footer language menu is hidden. > >NOTE: This patch contains whitespace changes, so please view the diff >accordingly. > >To test you should have at least one additional language installed. > >- Apply the patch and make sure the OPACLanguages system preference has > more than one language checked. >- Set opaclanguagesdisplay to "Allow." >- In the OPAC, test that the various settings of the > OpacLangSelectorMode preference work correctly (only top, only footer, > both top and footer). >- Test with OPACReportProblem on and off, and CookieConsent on and off. >- Test with OPACReportProblem or CookieConsent enabled and > opaclanguagesdisplay disabled. > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../bootstrap/en/includes/langmenu.inc | 99 +++++++++---------- > .../bootstrap/en/includes/masthead.inc | 3 +- > .../bootstrap/en/includes/opac-bottom.inc | 77 +++++++-------- > 3 files changed, 87 insertions(+), 92 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/langmenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/langmenu.inc >index d4ed17a752..10aa714682 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/langmenu.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/langmenu.inc >@@ -1,52 +1,49 @@ >-[%# Following on one line for translatability %] >-[% IF ( ( opaclanguagesdisplay ) && ( ! one_language_enabled ) && ( languages_loop ) && ( OpacLangSelectorMode == 'both' || OpacLangSelectorMode == 'top') ) %] >- <div id="header_langmenu"> >- <ul class="navbar-nav"> >- [% IF ( context == "footer" ) -%] >- <li class="nav-item dropup"> >- [% ELSE -%] >- <li class="nav-item dropdown"> >- [% END %] >- <a href="#" title="Switch languages" class="nav-link dropdown-toggle" id="langmenu" data-bs-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-flag fa-fw fa-icon-[% context | html %]" aria-hidden="true"></i> <span class="langlabel">Languages</span> <b class="caret"></b></a> >- <div aria-labelledby="langmenu" role="menu" class="dropdown-menu dropdown-menu-end"> >- [% FOREACH languages_loo IN languages_loop %] >- [% IF ( languages_loo.group_enabled ) %] >- [% IF ( languages_loo.plural ) %] >- [% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %] >- [% IF ( sublanguages_loo.enabled ) %] >- [% IF ( sublanguages_loo.sublanguage_current ) %] >- <a class="dropdown-item" href="#" tabindex="-1" role="menuitem">[% sublanguages_loo.native_description | html %] [% sublanguages_loo.script_description | html %] [% sublanguages_loo.region_description | html %] [% sublanguages_loo.variant_description | html %] <i class="fa fa-check" aria-hidden="true"></i></a> >- [% ELSE %] >- <a class="dropdown-item" href="/cgi-bin/koha/opac-changelanguage.pl?language=[% sublanguages_loo.rfc4646_subtag | uri %]" tabindex="-1" role="menuitem"> [% sublanguages_loo.native_description | html %] [% sublanguages_loo.script_description | html %] [% sublanguages_loo.region_description | html %] [% sublanguages_loo.variant_description | html %]</a> >- [% END # /IF ( sublanguages_loo.sublanguage_current ) %] >- [% END # / IF sublanguages_loo.enabled %] >- [% END # / FOREACH sublanguages_loo %] >- [% ELSE %] >- [% IF ( languages_loo.group_enabled ) %] >- [% IF ( languages_loo.current ) %] >- <a class="dropdown-item menu-inactive" href="#" tabindex="-1" role="menuitem"> >- [% IF ( languages_loo.native_description ) %] >- [% languages_loo.native_description | html %] >- [% ELSE %] >- [% languages_loo.rfc4646_subtag | html %] >- [% END %] <i class="fa fa-check" aria-hidden="true"></i> >- </a> >+<div id="header_langmenu"> >+ <ul class="navbar-nav"> >+ [% IF ( context == "footer" ) -%] >+ <li class="nav-item dropup"> >+ [% ELSE -%] >+ <li class="nav-item dropdown"> >+ [% END %] >+ <a href="#" title="Switch languages" class="nav-link dropdown-toggle" id="langmenu" data-bs-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-flag fa-fw fa-icon-[% context | html %]" aria-hidden="true"></i> <span class="langlabel">Languages</span> <b class="caret"></b></a> >+ <div aria-labelledby="langmenu" role="menu" class="dropdown-menu dropdown-menu-end"> >+ [% FOREACH languages_loo IN languages_loop %] >+ [% IF ( languages_loo.group_enabled ) %] >+ [% IF ( languages_loo.plural ) %] >+ [% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %] >+ [% IF ( sublanguages_loo.enabled ) %] >+ [% IF ( sublanguages_loo.sublanguage_current ) %] >+ <a class="dropdown-item" href="#" tabindex="-1" role="menuitem">[% sublanguages_loo.native_description | html %] [% sublanguages_loo.script_description | html %] [% sublanguages_loo.region_description | html %] [% sublanguages_loo.variant_description | html %] <i class="fa fa-check" aria-hidden="true"></i></a> > [% ELSE %] >- <a class="dropdown-item" href="/cgi-bin/koha/opac-changelanguage.pl?language=[% languages_loo.rfc4646_subtag | uri %]" tabindex="-1" role="menuitem"> >- [% IF ( languages_loo.native_description ) %] >- [% languages_loo.native_description | html %] >- [% ELSE %] >- [% languages_loo.rfc4646_subtag | html %] >- [% END %] >- </a> >- [% END # / IF ( languages_loo.current )%] >- [% END # / IF languages_loo.current %] >- [% END # / IF ( languages_loo.plural ) %] >- [% END # / IF ( languages_loo.group_enabled ) %] >- [% END # / FOREACH languages_loo IN languages_loop %] >- </div> <!-- /# .dropdown-menu --> >- </li> <!-- / .dropdown --> >- <li class="divider-vertical" aria-hidden="false"></li> >- </ul> <!-- /.nav.pull-right --> >- </div> <!-- /#header_langmenu --> >-[% END # / IF opaclanguagedisplay %] >+ <a class="dropdown-item" href="/cgi-bin/koha/opac-changelanguage.pl?language=[% sublanguages_loo.rfc4646_subtag | uri %]" tabindex="-1" role="menuitem"> [% sublanguages_loo.native_description | html %] [% sublanguages_loo.script_description | html %] [% sublanguages_loo.region_description | html %] [% sublanguages_loo.variant_description | html %]</a> >+ [% END # /IF ( sublanguages_loo.sublanguage_current ) %] >+ [% END # / IF sublanguages_loo.enabled %] >+ [% END # / FOREACH sublanguages_loo %] >+ [% ELSE %] >+ [% IF ( languages_loo.group_enabled ) %] >+ [% IF ( languages_loo.current ) %] >+ <a class="dropdown-item menu-inactive" href="#" tabindex="-1" role="menuitem"> >+ [% IF ( languages_loo.native_description ) %] >+ [% languages_loo.native_description | html %] >+ [% ELSE %] >+ [% languages_loo.rfc4646_subtag | html %] >+ [% END %] <i class="fa fa-check" aria-hidden="true"></i> >+ </a> >+ [% ELSE %] >+ <a class="dropdown-item" href="/cgi-bin/koha/opac-changelanguage.pl?language=[% languages_loo.rfc4646_subtag | uri %]" tabindex="-1" role="menuitem"> >+ [% IF ( languages_loo.native_description ) %] >+ [% languages_loo.native_description | html %] >+ [% ELSE %] >+ [% languages_loo.rfc4646_subtag | html %] >+ [% END %] >+ </a> >+ [% END # / IF ( languages_loo.current )%] >+ [% END # / IF languages_loo.current %] >+ [% END # / IF ( languages_loo.plural ) %] >+ [% END # / IF ( languages_loo.group_enabled ) %] >+ [% END # / FOREACH languages_loo IN languages_loop %] >+ </div> <!-- /# .dropdown-menu --> >+ </li> <!-- / .dropdown --> >+ <li class="divider-vertical" aria-hidden="false"></li> >+ </ul> <!-- /.nav.pull-right --> >+</div> <!-- /#header_langmenu --> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index 09051280df..266309c1ef 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -99,7 +99,8 @@ > </ul> <!-- / .navbar-nav --> > [% END # /IF OpacPublic %] > [% IF Koha.Preference( 'opacuserlogin' ) == 1 || Koha.Preference( 'EnableOpacSearchHistory') || Koha.Preference( 'opaclanguagesdisplay' ) %] >- [% IF ( Koha.Preference( 'opaclanguagesdisplay' ) ) %] >+ [%# Following on one line for translatability %] >+ [% IF ( ( opaclanguagesdisplay ) && ( ! one_language_enabled ) && ( languages_loop ) && ( OpacLangSelectorMode == 'both' || OpacLangSelectorMode == 'top') ) %] > [% context = "header" %] > [% INCLUDE 'langmenu.inc' %] > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >index 6cc819a1a9..50d78ea97b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >@@ -22,46 +22,43 @@ > [% END #/ opaccredits %] > </div> <!-- / #wrapper in masthead.inc --> > >- [% IF OpacLangSelectorMode == 'both' || OpacLangSelectorMode == 'footer' %] >- [% IF ( Koha.Preference('opaclanguagesdisplay') ) %] >- [% IF ( languages_loop ) %] >- [% UNLESS ( one_language_enabled ) %] >- <footer id="changelanguage" class="navbar navbar-expand navbar-light bg-light noprint"> >- <div class="container-fluid"> >- <div class="collapse navbar-collapse"> >- [% context = "footer" %] >- [% INCLUDE 'langmenu.inc' %] >- >- <div class="navbar-nav flex-grow-1"> >- [% IF Koha.Preference('OPACReportProblem') && Koha.Preference('KohaAdminEmailAddress') %] >- <a id="report_a_problem" class="nav-link" href="/cgi-bin/koha/opac-reportproblem.pl"> >- <i class="fa fa-warning fa-fw fa-icon-footer" aria-hidden="true"></i> >- <span class="report_a_problem_text">Report a problem</span> >- </a> >- [% END %] >- >- [% IF Koha.Preference( 'CookieConsent' ) %] >- <a id="cookieConsentFooter" class="nav-link" href="#"> >- <i class="fa fa-cookie fa-fw fa-icon-footer" aria-hidden="true"></i> >- <span class="cookieConsentFooter_text">Cookies</span> >- </a> >- [% END %] >- </div> >- [% IF OpacKohaUrl %] >- <div class="navbar-nav"> >- <a id="koha_url" class="nav-link koha_url" href="http://koha-community.org"> >- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="currentColor" d="M7.394.75c.82-.45 1.75-.72 2.69-.75.5.015.99.1 1.45.27.92.35 1.68 1.05 2.15 1.9.53.865.76 1.875.87 2.875.25 3.315-.98 6.635-3.07 9.18-.825.82-1.835 1.52-3 1.735-.96.135-2-.07-2.775-.675-.48-.365-.67-1-.63-1.575.425.6 1.12 1.015 1.86 1.035.675.03 1.35-.275 1.8-.765.75-.825.835-2.21.12-3.08-.325-.375-.7-.715-1.15-.95-.44-.265-.95-.38-1.46-.45-.93-.06-1.9.11-2.72.57a3.22 3.22 0 0 0-1.565 2.15c-.2.7-.125 1.43-.05 2.14-.31-.81-.43-1.67-.5-2.53v-.64c.12-3.13 1.43-6.2 3.53-8.515.725-.75 1.53-1.43 2.45-1.92Zm0 0" style="stroke-width:.500008"/></svg> >- <span class="koha_url_text">Powered by Koha</span> >- </a> >- </div> >- [% END # /IF OpacKohaUrl %] >- </ul> <!-- /.navbar-nav --> >- </div> <!-- /.collapse.navbar-collapse --> >- </div> <!-- /.container-fluid --> >- </footer> <!-- / #changelanguage --> >- [% END # / UNLESS ( one_language_enabled ) %] >- [% END # / IF ( languages_loop && opaclanguagesdisplay ) %] >- [% END # / IF opaclanguagesdisplay %] >+ [% IF ( Koha.Preference('OPACReportProblem') && Koha.Preference('KohaAdminEmailAddress') ) || Koha.Preference( 'CookieConsent' ) || OpacKohaUrl || ( ( OpacLangSelectorMode == 'both' || OpacLangSelectorMode == 'footer') ) %] >+ <footer id="changelanguage" class="navbar navbar-expand navbar-light bg-light noprint"> >+ <div class="container-fluid"> >+ <div class="collapse navbar-collapse"> >+ [%# Following on one line for translatability %] >+ [% IF ( ( opaclanguagesdisplay ) && ( ! one_language_enabled ) && ( languages_loop ) && ( OpacLangSelectorMode == 'both' || OpacLangSelectorMode == 'footer') ) %] >+ [% context = "footer" %] >+ [% INCLUDE 'langmenu.inc' %] >+ [% END # / IF opaclanguagedisplay %] >+ >+ <div class="navbar-nav flex-grow-1"> >+ [% IF Koha.Preference('OPACReportProblem') && Koha.Preference('KohaAdminEmailAddress') %] >+ <a id="report_a_problem" class="nav-link" href="/cgi-bin/koha/opac-reportproblem.pl"> >+ <i class="fa fa-warning fa-fw fa-icon-footer" aria-hidden="true"></i> >+ <span class="report_a_problem_text">Report a problem</span> >+ </a> >+ [% END %] >+ >+ [% IF Koha.Preference( 'CookieConsent' ) %] >+ <a id="cookieConsentFooter" class="nav-link" href="#"> >+ <i class="fa fa-cookie fa-fw fa-icon-footer" aria-hidden="true"></i> >+ <span class="cookieConsentFooter_text">Cookies</span> >+ </a> >+ [% END %] >+ </div> >+ [% IF OpacKohaUrl %] >+ <div class="navbar-nav"> >+ <a id="koha_url" class="nav-link koha_url" href="http://koha-community.org"> >+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="currentColor" d="M7.394.75c.82-.45 1.75-.72 2.69-.75.5.015.99.1 1.45.27.92.35 1.68 1.05 2.15 1.9.53.865.76 1.875.87 2.875.25 3.315-.98 6.635-3.07 9.18-.825.82-1.835 1.52-3 1.735-.96.135-2-.07-2.775-.675-.48-.365-.67-1-.63-1.575.425.6 1.12 1.015 1.86 1.035.675.03 1.35-.275 1.8-.765.75-.825.835-2.21.12-3.08-.325-.375-.7-.715-1.15-.95-.44-.265-.95-.38-1.46-.45-.93-.06-1.9.11-2.72.57a3.22 3.22 0 0 0-1.565 2.15c-.2.7-.125 1.43-.05 2.14-.31-.81-.43-1.67-.5-2.53v-.64c.12-3.13 1.43-6.2 3.53-8.515.725-.75 1.53-1.43 2.45-1.92Zm0 0" style="stroke-width:.500008"/></svg> >+ <span class="koha_url_text">Powered by Koha</span> >+ </a> >+ </div> >+ [% END # /IF OpacKohaUrl %] >+ </ul> <!-- /.navbar-nav --> >+ </div> <!-- /.collapse.navbar-collapse --> >+ </div> <!-- /.container-fluid --> >+ </footer> <!-- / #changelanguage --> > [% END # /IF OpacLangSelectorMode == 'both' || OpacLangSelectorMode == 'footer' %] > [% END # / UNLESS is_popup %] > >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37833
:
171035
|
171062
|
171154
|
171155
|
171156
|
171355