Bug 15039: Move top language menu to include and streamline logic
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / includes / masthead.inc
1 [% USE Koha %]
2 [% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
3 <div id="wrap">
4     <div id="header-region" class="noprint">
5         <div class="navbar navbar-inverse navbar-static-top">
6             <div class="navbar-inner">
7                 <div class="container-fluid">
8                     <h1 id="logo">
9                         <a class="brand" href="/cgi-bin/koha/opac-main.pl">
10                             [% IF ( LibraryNameTitle ) %]
11                                 [% LibraryNameTitle %]
12                             [% ELSE %]
13                                 Koha online
14                             [% END %]
15                         </a>
16                     </h1>
17                     [% IF ( Koha.Preference( 'opacbookbag' ) == 1 ) %]
18                         <div id="cartDetails" class="cart-message">Your cart is empty.</div>
19                     [% END %]
20                     <ul class="nav">
21                         [% IF ( Koha.Preference( 'opacbookbag' ) == 1 ) %]
22                             <li class="dropdown">
23                                 <a href="#" title="Collect items you are interested in" class="dropdown-toggle" id="cartmenulink" data-toggle="dropdown" role="button">
24                                     <i id="carticon" class="icon-shopping-cart icon-white"></i> <span class="cartlabel">Cart</span> <span id="basketcount"></span> <b class="caret"></b>
25                                 </a>
26                                 <ul aria-labelledby="cartmenulink" role="menu" class="dropdown-menu">
27                                     <li role="presentation">
28                                         <a href="#" id="cartmenuitem" class="cart-message" tabindex="-1" role="menuitem">Your cart is empty.</a>
29                                     </li>
30                                 </ul>
31                             </li>
32                         [% END %]
33                         [% IF ( Koha.Preference( 'virtualshelves' ) == 1 ) && ( Koha.Preference( 'opacbookbag' ) == 1 ) %]
34                             <li class="divider-vertical"></li>
35                         [% END %]
36                         [% IF ( Koha.Preference( 'virtualshelves' ) == 1 ) %]
37                             <li class="dropdown">
38                                 <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>
39                                 <ul aria-labelledby="listsmenu" role="menu" class="dropdown-menu">
40                                     [% IF ( pubshelves ) %]
41                                             <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves" tabindex="-1" role="menuitem"><strong>Public lists</strong></a></li>
42                                         [% FOREACH pubshelvesloo IN pubshelvesloop %]
43                                             <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>
44                                         [% END %]
45                                             <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves" tabindex="-1" role="menuitem" class="listmenulink">View All</a></li>
46                                     [% ELSE %]
47                                         <li role="presentation"><a href="#" tabindex="-1" class="menu-inactive" role="menuitem">No public lists</a></li>
48                                     [% END %]
49                                     <li class="divider" role="presentation"></li>
50                                     [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
51                                         <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves" tabindex="-1" role="menuitem"><strong>Your lists</strong></a></li>
52                                         [% IF ( loggedinusername ) %]
53                                             [% IF ( barshelves ) %]
54                                                 [% FOREACH barshelvesloo IN barshelvesloop %]
55                                                     <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>
56                                                 [% END %]
57                                                 <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves" tabindex="-1" role="menuitem" class="listmenulink">View all</a></li>
58                                             [% ELSE %]
59                                                 <li role="presentation"><a href="#" tabindex="-1" class="menu-inactive" role="menuitem">No private lists</a></li>
60                                                 <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves" tabindex="-1" role="menuitem" class="listmenulink">New list</a></li>
61                                             [% END %]
62                                         [% ELSE %]
63                                             <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>
64                                         [% END # / IF loggedinusername %]
65                                     [% END # / IF opacuserlogin %]
66                                 </ul> <!-- / .dropdown-menu -->
67                             </li> <!-- / .dropdown -->
68                         [% END # / IF virtualshelves %]
69                     </ul> <!-- / .nav -->
70                     [% IF Koha.Preference( 'virtualshelves' ) == 1 %]<div id="listsDetails"></div>[% END %]
71                     [% IF Koha.Preference( 'opacuserlogin' ) == 1 || opaclanguagesdisplay || EnableOpacSearchHistory %]
72                         <a id="user-menu-trigger" class="pull-right" href="#"><i class="icon-user"></i> <span class="caret"></span></a>
73                         <div id="members">
74                             <ul class="nav pull-right">
75
76                                 [% INCLUDE 'masthead-langmenu.inc' %]
77
78                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
79                                     [% UNLESS ( loggedinusername ) %]
80                                         [% IF Koha.Preference('casAuthentication') %]
81                                             [%# CAS authentication is too complicated for modal window %]
82                                             <li><a href="/cgi-bin/koha/opac-user.pl">Log in to your account</a></li>
83                                         [% ELSE %]
84                                             <li><a href="/cgi-bin/koha/opac-user.pl" class="loginModal-trigger" role="button" data-toggle="modal">Log in to your account</a></li>
85                                         [% END %]
86                                     [% END %]
87                                     [% IF ( loggedinusername ) %]
88                                         <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>
89                                         <li class="divider-vertical"></li>
90                                     [% END %]
91                                 [% END %]
92                                 [% IF EnableOpacSearchHistory %]
93                                     <li><p class="navbar-text"><a href="/cgi-bin/koha/opac-search-history.pl" title="View your search history">Search history</a> [<a class="logout" href="/cgi-bin/koha/opac-search-history.pl?action=delete" title="Delete your search history" onclick="return confirm(MSG_DELETE_SEARCH_HISTORY);">x</a>]</p></li>
94                                     <li class="divider-vertical"></li>
95                                 [% END %]
96                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
97                                     [% IF ( loggedinusername ) %]
98                                         <li><p class="navbar-text">
99                                             [% IF persona %]
100                                                 <a class="logout" id="logout" href="/cgi-bin/koha/opac-main.pl?logout.x=1" onclick='navigator.id.logout();'>
101                                             [% ELSE %]
102                                                 <a class="logout" id="logout" href="/cgi-bin/koha/opac-main.pl?logout.x=1">
103                                             [% END %]
104                                             Log out</a></p></li>
105                                     [% END %]
106                                 [% END %]
107                             </ul>
108                         </div> <!-- /members -->
109                     [% END # IF opacuserlogin %]
110                 </div> <!-- /container-fluid -->
111             </div> <!-- /navbar-inner -->
112         </div> <!-- /navbar -->
113
114         [% IF ( opacheader ) %]
115             <div class="container-fluid">
116                 <div class="row-fluid">
117                     <div id="opacheader">
118                         [% opacheader %]
119                     </div>
120                 </div>
121             </div>
122         [% END %]
123     </div> <!-- / header-region -->
124
125     <div class="container-fluid">
126         <div class="row-fluid">
127             <div id="opac-main-search">
128     <!--             <div class="span2">
129         [% IF ( opacsmallimage ) %]
130             <h1 id="libraryname" style="background-image: url('[% opacsmallimage %]');">
131         [% ELSE %]
132             <h1 id="libraryname">
133         [% END %]
134             <a href="/cgi-bin/koha/opac-main.pl">[% IF ( LibraryName ) %][% LibraryName %][% ELSE %]Koha Online Catalog[% END %]</a></h1>
135     </div> /.span2 -->
136             <div class="span12">
137                 [% IF ( OpacPublic ) %]
138                     [% UNLESS ( advsearch ) %]
139                         [% IF ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
140                             <div class="mastheadsearch librarypulldown">
141                         [% ELSE %]
142                             <div class="mastheadsearch">
143                         [% END %]
144                         [% IF Koha.Preference('OpacCustomSearch') == '' %]
145                             <form name="searchform" method="get" action="/cgi-bin/koha/opac-search.pl" id="searchform" class="form-inline">
146                                 <label for="masthead_search"> Search
147                                     [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
148                                         [% IF ( mylibraryfirst ) %]
149                                             (in [% mylibraryfirst %] only)
150                                         [% END %]
151                                     [% END %]
152                                 </label>
153
154                                 <select name="idx" id="masthead_search">
155                                 [% IF ( ms_kw ) %]
156                                     <option selected="selected" value="">Library catalog</option>
157                                 [% ELSE %]
158                                     <option value="">Library catalog</option>
159                                 [% END # /ms_kw %]
160                                 [% IF ( ms_ti ) %]
161                                     <option selected="selected" value="ti">Title</option>
162                                 [% ELSE %]
163                                     <option value="ti">Title</option>
164                                 [% END # /ms_ti %]
165                                 [% IF ( ms_au ) %]
166                                     <option selected="selected" value="au">Author</option>
167                                 [% ELSE %]
168                                     <option value="au">Author</option>
169                                 [% END # /ms_au%]
170                                 [% IF ( ms_su ) %]
171                                     <option selected="selected" value="su">Subject</option>
172                                 [% ELSE %]
173                                     <option value="su">Subject</option>
174                                 [% END # /ms_su %]
175                                 [% IF ( ms_nb ) %]
176                                     <option selected="selected" value="nb">ISBN</option>
177                                 [% ELSE %]
178                                     <option value="nb">ISBN</option>
179                                 [% END # /ms_nb%]
180                                 [% IF ( ms_se ) %]
181                                     <option selected="selected" value="se">Series</option>
182                                 [% ELSE %]
183                                     <option value="se">Series</option>
184                                 [% END # /ms_se %]
185                                 [% IF ( numbersphr ) %]
186                                     [% IF ( ms_callnum ) %]
187                                             <option selected="selected" value="callnum,phr">Call number</option>
188                                     [% ELSE %]
189                                         <option value="callnum,phr">Call number</option>
190                                     [% END #/ms_callnum %]
191                                 [% ELSE %]
192                                     [% IF ( ms_callnum ) %]
193                                         <option selected="selected" value="callnum">Call number</option>
194                                     [% ELSE %]
195                                         <option value="callnum">Call number</option>
196                                     [% END # /ms_callnum %]
197                                 [% END # /numbersphr %]
198                                 </select>
199
200                                 [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
201                                     <div class="input-append nolibrarypulldown">
202                                 [% END %]
203                                 [% IF ( ms_value ) %]
204                                     <input type="text" title="Type search term" class="transl1" id = "translControl1" name="q" value="[% ms_value |html %]" /><span id="translControl"></span>
205                                 [% ELSE %]
206                                     <input type="text" title="Type search term" class="transl1" id = "translControl1" name="q" /><span id="translControl"></span>
207                                 [% END # /ms_value %]
208
209                                 [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
210                                     <button type="submit" id="searchsubmit" class="btn btn-primary">Go</button>
211                                     </div>
212                                 [% END %]
213
214                                 [% IF ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
215                                     <div class="input-append">
216                                         <select name="branch_group_limit" id="select_library">
217                                             <option value="">All libraries</option>
218                                             [% IF BranchCategoriesLoop %]<optgroup label="Libraries">[% END %]
219                                                 [% FOREACH BranchesLoo IN BranchesLoop %]
220                                                     [% IF ( BranchesLoo.selected ) %]<option selected="selected" value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>
221                                                     [% ELSE %]<option value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>[% END %]
222                                                 [% END %]
223                                             [% IF BranchCategoriesLoop %]
224                                                 </optgroup>
225                                                 <optgroup label="Groups">
226                                                     [% FOREACH bc IN BranchCategoriesLoop %]
227                                                         [% IF ( bc.selected ) %]
228                                                             <option selected="selected" value="multibranchlimit-[% bc.categorycode %]">[% bc.categoryname %]</option>
229                                                         [% ELSE %]
230                                                             <option value="multibranchlimit-[% bc.categorycode %]">[% bc.categoryname %]</option>
231                                                         [% END # / bc.selected %]
232                                                     [% END %]
233                                                 </optgroup>
234                                             [% END # / BranchCategoriesLoop %]
235                                         </select>
236                                         <button type="submit" id="searchsubmit" class="btn btn-primary">Go</button>
237                                     </div>
238                                 [% ELSE %]
239                                     [% IF ( opac_limit_override ) %]
240                                         [% IF ( opac_search_limit ) %]
241                                             <input name="limit" value="[% opac_search_limit %]" type="hidden" />
242                                         [% END %]
243                                     [% ELSE %]
244                                         [% IF ( mylibraryfirst ) %]
245                                             <input name="limit" value="branch:[% mylibraryfirst %]" type="hidden" />
246                                         [% END %]
247                                     [% END # / opac_limit_override %]
248                                 [% END # / OpacAddMastheadLibraryPulldown %]
249
250                             </form>
251                         [% ELSE # / Koha.Preference('OpacCustomSearch') == '' %]
252                             [% Koha.Preference('OpacCustomSearch') %]
253                         [% END # / Koha.Preference('OpacCustomSearch') == '' %]
254                         </div> <!-- / .mastheadsearch -->
255                     [% END # / UNLESS advsearch %]
256
257                     <div class="row-fluid">
258                             <div id="moresearches">
259                                 <ul>
260                                     <li><a href="/cgi-bin/koha/opac-search.pl">Advanced search</a></li>
261                                     [% IF ( Koha.Preference( 'UseCourseReserves' ) == 1 ) %]<li><a href="/cgi-bin/koha/opac-course-reserves.pl">Course reserves</a></li>[% END %]
262                                     [% IF Koha.Preference( 'OpacBrowser' ) == 1 %]<li><a href="/cgi-bin/koha/opac-browser.pl">Browse by hierarchy</a></li>[% END %]
263                                     [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]<li><a href="/cgi-bin/koha/opac-authorities-home.pl">Authority search</a></li>[% END %]
264                                     [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'reviewson' ) == 1 ) && ( Koha.Preference( 'OpacShowRecentComments' ) == 1 ) ) %]<li><a href="/cgi-bin/koha/opac-showreviews.pl">Recent comments</a></li>[% END %]
265                                     [% IF Koha.Preference( 'TagsEnabled' ) == 1 %]<li><a href="/cgi-bin/koha/opac-tags.pl">Tag cloud</a></li>[% END %]
266                                     [% IF Koha.Preference( 'OpacCloud' ) == 1 %]<li><a href="/cgi-bin/koha/opac-tags_subject.pl">Subject cloud</a></li>[% END %]
267                                     [% IF Koha.Preference( 'OpacTopissue' ) == 1 %]<li><a href="/cgi-bin/koha/opac-topissues.pl">Most popular</a></li>[% END %]
268                                     [% IF Koha.Preference( 'suggestion' ) == 1 %]
269                                         [% IF Koha.Preference( 'AnonSuggestions' ) == 1 %]
270                                             <li><a href="/cgi-bin/koha/opac-suggestions.pl">Purchase suggestions</a></li>
271                                         [% ELSIF ( ( Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 ) ) %]
272                                             <li><a href="/cgi-bin/koha/opac-suggestions.pl">Purchase suggestions</a></li>
273                                         [% END %]
274                                     [% END %]
275                                 </ul>
276                             </div> <!-- /#moresearches -->
277                     </div> <!-- /.row-fluid -->
278
279                 [% END # / OpacPublic %]
280             </div> <!-- /.span10 -->
281             </div> <!-- /.opac-main-search -->
282         </div> <!-- / .row-fluid -->
283     </div> <!-- /.container-fluid -->
284
285     <!-- Login form hidden by default, used for modal window -->
286     <div id="loginModal" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="modalLoginLabel" aria-hidden="true">
287         <div class="modal-header">
288             <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
289             <h3 id="modalLoginLabel">Log in to your account</h3>
290         </div>
291         <form action="/cgi-bin/koha/opac-user.pl" method="post" name="auth" id="modalAuth">
292             <div class="modal-body">
293                     [% IF ( shibbolethAuthentication ) %]
294                     [% IF ( invalidShibLogin ) %]
295                     <!-- This is what is displayed if shibboleth login has failed to match a koha user -->
296                     <div class="alert alert-info">
297                         <p>Sorry, your Shibboleth identity does not match a valid library identity. If you have a local login, you may use that below.</p>
298                     </div>
299                     [% ELSE %]
300                     <h4>Shibboleth Login</h4>
301                     <p>If you have a Shibboleth account, please <a href="[% shibbolethLoginUrl %]">click here to login</a>.</p>
302                     <h4>Local Login</h4>
303                     [% END %]
304             [% END %]
305                     <input type="hidden" name="koha_login_context" value="opac" />
306                     <fieldset class="brief">
307                         <label for="muserid">Login:</label><input type="text" id="muserid" name="userid" />
308                         <label for="mpassword">Password:</label><input type="password" id="mpassword" name="password" />
309                     [% IF Koha.Preference( 'NoLoginInstructions' ) %]
310                         <div id="nologininstructions-modal">
311                             [% Koha.Preference( 'NoLoginInstructions' ) %]
312                         </div>
313                     [% END %]
314                         [% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %]<div id="mpatronregistration"><p>Don't have an account? <a href="/cgi-bin/koha/opac-memberentry.pl">Register here.</a></p></div>[% END %]
315                     </fieldset>
316             </div>
317             <div class="modal-footer">
318                 <input type="submit" class="btn btn-primary" value="Log in" />
319                 <a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Cancel</a>
320             </div>
321         </form> <!-- /#auth -->
322     </div>  <!-- /#modalAuth  -->