Bug 10988 - Fixes for comments 57 and 58
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / includes / masthead.inc
index c8dff49..b2aceaa 100644 (file)
@@ -1,4 +1,5 @@
 [% USE Koha %]
+[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
 <div id="wrap">
     <div id="header-region" class="noprint">
         <div class="navbar navbar-inverse navbar-static-top">
                             <li class="dropdown">
                                 <a href="#" title="Show lists" class="dropdown-toggle" id="listsmenu" data-toggle="dropdown" role="button"><i class="icon-list icon-white"></i> <span class="listslabel">Lists</span> <b class="caret"></b></a>
                                 <ul aria-labelledby="listsmenu" role="menu" class="dropdown-menu">
-                                    [% IF ( pubshelves ) %]
-                                            <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves" tabindex="-1" role="menuitem"><strong>Public lists</strong></a></li>
-                                        [% FOREACH pubshelvesloo IN pubshelvesloop %]
-                                            <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% pubshelvesloo.shelfnumber %]&amp;sortfield=[% pubshelvesloo.sortfield %]" tabindex="-1" role="menuitem">[% pubshelvesloo.shelfname |html %]</a></li>
-                                        [% END %]
-                                            <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves" tabindex="-1" role="menuitem" class="listmenulink">View All</a></li>
-                                    [% ELSE %]
-                                        <li role="presentation"><a href="#" tabindex="-1" class="menu-inactive" role="menuitem">No public lists</a></li>
+                                [% IF some_public_shelves.count %]
+                                    <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=2" tabindex="-1" role="menuitem"><strong>Public lists</strong></a></li>
+                                    [% SET number_of_public_shelves = 0 %]
+                                    [% FOREACH s IN some_public_shelves %]
+                                        <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber %]&amp;sortfield=[% s.sortfield %]" tabindex="-1" role="menuitem">[% s.shelfname |html %]</a></li>
+                                        [% SET number_of_public_shelves = number_of_public_shelves + 1 %]
+                                        [% IF number_of_public_shelves >= 10 %][% LAST %][% END %]
                                     [% END %]
-                                    <li class="divider" role="presentation"></li>
-                                    [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
-                                        <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves" tabindex="-1" role="menuitem"><strong>Your lists</strong></a></li>
-                                        [% IF ( loggedinusername ) %]
-                                            [% IF ( barshelves ) %]
-                                                [% FOREACH barshelvesloo IN barshelvesloop %]
-                                                    <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% barshelvesloo.shelfnumber %]&amp;sortfield=[% barshelvesloo.sortfield %]" tabindex="-1" role="menuitem">[% barshelvesloo.shelfname |html %]</a></li>
-                                                [% END %]
-                                                <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves" tabindex="-1" role="menuitem" class="listmenulink">View all</a></li>
-                                            [% ELSE %]
-                                                <li role="presentation"><a href="#" tabindex="-1" class="menu-inactive" role="menuitem">No private lists</a></li>
-                                                <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves" tabindex="-1" role="menuitem" class="listmenulink">New list</a></li>
+                                    [% IF some_public_shelves > 10 %]
+                                        <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=2" tabindex="-1" role="menuitem" class="listmenulink">View All</a></li>
+                                    [% END %]
+                                [% ELSE %]
+                                    <li role="presentation"><a href="#" tabindex="-1" class="menu-inactive" role="menuitem">No public lists</a></li>
+                                [% END %]
+                                <li class="divider" role="presentation"></li>
+                                [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
+                                    <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=1" tabindex="-1" role="menuitem"><strong>Your lists</strong></a></li>
+                                    [% IF loggedinusername %]
+                                        [% IF some_private_shelves.count %]
+                                            [% SET number_of_private_shelves = 0 %]
+                                            [% FOREACH s IN some_private_shelves %]
+                                                <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber %]&amp;sortfield=[% s.sortfield %]" tabindex="-1" role="menuitem">[% s.shelfname |html %]</a></li>
+                                                [% SET number_of_private_shelves = number_of_private_shelves + 1 %]
+                                                [% IF number_of_private_shelves >= 10 %][% LAST %][% END %]
+                                            [% END %]
+                                            [% IF some_private_shelves > 10 %]
+                                                <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=1" tabindex="-1" role="menuitem" class="listmenulink">View All</a></li>
                                             [% END %]
                                         [% ELSE %]
-                                            <li role="presentation"><a href="/cgi-bin/koha/opac-user.pl" tabindex="-1" class="menu-inactive loginModal-trigger" role="menuitem">Log in to create your own lists</a></li>
-                                        [% END # / IF loggedinusername %]
-                                    [% END # / IF opacuserlogin %]
+                                            <li role="presentation"><a href="#" tabindex="-1" class="menu-inactive" role="menuitem">No private lists</a></li>
+                                            <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=1" tabindex="-1" role="menuitem" class="listmenulink">New list</a></li>
+                                        [% END %]
+                                    [% ELSE %]
+                                        <li role="presentation"><a href="/cgi-bin/koha/opac-user.pl" tabindex="-1" class="menu-inactive loginModal-trigger" role="menuitem">Log in to create your own lists</a></li>
+                                    [% END # / IF loggedinusername %]
+                                [% END # / IF opacuserlogin %]
                                 </ul> <!-- / .dropdown-menu -->
                             </li> <!-- / .dropdown -->
                         [% END # / IF virtualshelves %]
                     </ul> <!-- / .nav -->
                     [% IF Koha.Preference( 'virtualshelves' ) == 1 %]<div id="listsDetails"></div>[% END %]
-                    [% IF Koha.Preference( 'opacuserlogin' ) == 1 || EnableOpacSearchHistory %]
+                    [% IF Koha.Preference( 'opacuserlogin' ) == 1 || opaclanguagesdisplay || EnableOpacSearchHistory %]
                         <a id="user-menu-trigger" class="pull-right" href="#"><i class="icon-user"></i> <span class="caret"></span></a>
                         <div id="members">
                             <ul class="nav pull-right">
-                            [% IF ( Koha.Preference( 'OpacLangSelectorMode' ) == 'both' ) || ( Koha.Preference( 'OpacLangSelectorMode' ) == 'head' ) %]
-                            [% IF ( opaclanguagesdisplay ) %]
-                                [% IF ( languages_loop && opaclanguagesdisplay ) %]
-                                    [% UNLESS ( one_language_enabled ) %]
-                                    <li class="dropdown">
-                                       <a href="#" title="Switch languages" class="dropdown-toggle" id="langmenu" data-toggle="dropdown" role="button"><i class="icon-flag icon-white"></i> <span class="langlabel">Languages</span> <b class="caret"></b></a>
-                                       <ul aria-labelledby="langmenu" role="menu" class="dropdown-menu">
-                                       [% FOREACH languages_loo IN languages_loop.sort('rfc4646_subtag') %]
-                                           [% 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 ) %]
-                                                             <li role="presentation"> <a href="#" tabindex="-1" class="menu-inactive" role="menuitem">[% sublanguages_loo.native_description %] [% sublanguages_loo.script_description %] [% sublanguages_loo.region_description %] [% sublanguages_loo.variant_description %]&nbsp;<i class="icon-ok"></i></a></li>
-                                                             [% ELSE %]
-                                                             <li role="presentation"><a href="/cgi-bin/koha/opac-changelanguage.pl?language=[% sublanguages_loo.rfc4646_subtag %]"  tabindex="-1" role="menuitem" class="listmenulink"> [% sublanguages_loo.native_description %] [% sublanguages_loo.script_description %] [% sublanguages_loo.region_description %] [% sublanguages_loo.variant_description %]</a></li>
-                                                             [% END %]
-                                                         [% END # / IF sublanguages_loo.enabled %]
-                                                     [% END # / FOREACH sublanguages_loo %]
-                                               [% ELSE %]
-                                                   [% IF ( languages_loo.group_enabled ) %]
-                                                       [% IF ( languages_loo.current ) %]
-                                                       <li role="presentation"><a href="#" tabindex="-1" class="menu-inactive" role="menuitem">[% IF ( languages_loo.native_description ) %][% languages_loo.native_description %][% ELSE %][% languages_loo.rfc4646_subtag %][% END %]&nbsp;<i class="icon-ok"></i></a></li>
-                                                       [% ELSE %]
-                                                       <li role="presentation"><a href="/cgi-bin/koha/opac-changelanguage.pl?language=[% languages_loo.rfc4646_subtag %]"  tabindex="-1" role="menuitem" class="listmenulink">[% IF ( languages_loo.native_description ) %][% languages_loo.native_description %][% ELSE %][% languages_loo.rfc4646_subtag %][% END %]</a></li>
-                                                       [% END %]
-                                                       [% END # / IF languages_loo.current %]
-                                               [% END # / IF ( languages_loo.plural ) %]
-                                           [% END # / IF ( languages_loo.group_enabled ) %]
-                                       [% END # / FOREACH languages_loo IN languages_loop %]
-                                       </ul> <!-- /# .dropdown-menu -->
-                                    </li> <!-- / .dropdown -->
-                                    [% END # / UNLESS ( one_language_enabled ) %]
-                                [% END # / IF ( languages_loop && opaclanguagesdisplay ) %]
-                            [% END # / IF opaclanguagesdisplay %]
-                            [% END # / IF OpacLangSelectorMode %]
+
+                                [% INCLUDE 'masthead-langmenu.inc' %]
+
                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
                                     [% UNLESS ( loggedinusername ) %]
                                         [% IF Koha.Preference('casAuthentication') %]
                                             [%# CAS authentication is too complicated for modal window %]
                                             <li><a href="/cgi-bin/koha/opac-user.pl">Log in to your account</a></li>
+                                        [% ELSIF ( Koha.Preference('GoogleOpenIDConnect') == 1 ) %]
+                                            <li><a href="/cgi-bin/koha/svc/auth/googleopenidconnect" role="button" data-toggle="modal">Log in to your account</a></li>
                                         [% ELSE %]
                                             <li><a href="/cgi-bin/koha/opac-user.pl" class="loginModal-trigger" role="button" data-toggle="modal">Log in to your account</a></li>
                                         [% END %]
                                     [% END %]
                                     [% IF ( loggedinusername ) %]
-                                        <li><p class="members navbar-text">Welcome, <a href="/cgi-bin/koha/opac-user.pl"><span class="loggedinusername">[% FOREACH USER_INF IN USER_INFO %][% USER_INF.title %] [% USER_INF.firstname %] [% USER_INF.surname %][% END %]</span></a></p></li>
+                                        <li><p class="members navbar-text">Welcome, <a href="/cgi-bin/koha/opac-user.pl"><span class="loggedinusername">[% USER_INFO.title %] [% USER_INFO.firstname %] [% USER_INFO.surname %]</span></a></p></li>
                                         <li class="divider-vertical"></li>
                                     [% END %]
                                 [% END %]
                                                 </optgroup>
                                                 <optgroup label="Groups">
                                                     [% FOREACH bc IN BranchCategoriesLoop %]
-                                                        [% IF ( bc.selected ) %]
+                                                        [% IF bc.categorycode == opac_name %]
                                                             <option selected="selected" value="multibranchlimit-[% bc.categorycode %]">[% bc.categoryname %]</option>
                                                         [% ELSE %]
                                                             <option value="multibranchlimit-[% bc.categorycode %]">[% bc.categoryname %]</option>
                     <fieldset class="brief">
                         <label for="muserid">Login:</label><input type="text" id="muserid" name="userid" />
                         <label for="mpassword">Password:</label><input type="password" id="mpassword" name="password" />
+                    [% IF Koha.Preference('OpacPasswordChange') && Koha.Preference('OpacResetPassword') %]
+                        <div id="forgotpassword-modal">
+                            <a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a>
+                        </div>
+                    [% END %]
                     [% IF Koha.Preference( 'NoLoginInstructions' ) %]
                         <div id="nologininstructions-modal">
                             [% Koha.Preference( 'NoLoginInstructions' ) %]