Bug 22880: (follow-up) Loose ends: Better DB update, global inclusion, etc.
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / includes / masthead.inc
1 [% USE raw %]
2 [% USE Koha %]
3 [% USE Branches %]
4 [% USE Categories %]
5 [% USE KohaNews %]
6 [% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
7 [% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
8 <div id="wrap">
9     <div id="header-region" class="noprint">
10         <div class="navbar navbar-inverse navbar-static-top">
11             <div class="navbar-inner">
12                 <div class="container-fluid">
13                     <h1 id="logo">
14                         <a class="brand" href="/cgi-bin/koha/opac-main.pl">
15                             [% IF ( LibraryNameTitle ) %]
16                                 [% LibraryNameTitle | html %]
17                             [% ELSE %]
18                                 Koha online
19                             [% END %]
20                         </a>
21                     </h1>
22                     [% IF ( Koha.Preference( 'opacbookbag' ) == 1 ) %]
23                         <div id="cartDetails" class="cart-message">Your cart is empty.</div>
24                     [% END %]
25                     <ul class="nav">
26                         [% IF ( Koha.Preference( 'opacbookbag' ) == 1 ) %]
27                             <li>
28                                 <a href="#" title="Collect items you are interested in" id="cartmenulink" role="button">
29                                     <i id="carticon" class="fa fa-shopping-cart fa-icon-white"></i> <span class="cartlabel">Cart</span> <span id="basketcount"></span>
30                                 </a>
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="fa fa-list fa-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 some_public_shelves.count %]
41                                     <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>
42                                     [% SET number_of_public_shelves = 0 %]
43                                     [% FOREACH s IN some_public_shelves %]
44                                         <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber | uri %]&amp;sortfield=[% s.sortfield | uri %]" tabindex="-1" role="menuitem">[% s.shelfname | html %]</a></li>
45                                         [% SET number_of_public_shelves = number_of_public_shelves + 1 %]
46                                         [% IF number_of_public_shelves >= 10 %][% LAST %][% END %]
47                                     [% END %]
48                                     [% IF some_public_shelves > 10 %]
49                                         <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>
50                                     [% END %]
51                                 [% END %]
52                                 [% IF some_public_shelves.count > 0 %]
53                                     <li class="divider" role="presentation"></li>
54                                 [% END %]
55                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
56                                     <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>
57                                     [% IF loggedinusername %]
58                                         [% IF some_private_shelves.count %]
59                                             [% SET number_of_private_shelves = 0 %]
60                                             [% FOREACH s IN some_private_shelves %]
61                                                 <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber | uri %]&amp;sortfield=[% s.sortfield | uri %]" tabindex="-1" role="menuitem">[% s.shelfname | html %]</a></li>
62                                                 [% SET number_of_private_shelves = number_of_private_shelves + 1 %]
63                                                 [% IF number_of_private_shelves >= 10 %][% LAST %][% END %]
64                                             [% END %]
65                                             [% IF some_private_shelves > 10 %]
66                                                 <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>
67                                             [% END %]
68                                         [% ELSE %]
69                                             <li role="presentation"><a href="#" tabindex="-1" class="menu-inactive" role="menuitem">No private lists</a></li>
70                                         [% END %]
71                                             <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=add_form" tabindex="-1" role="menuitem" class="listmenulink">New list</a></li>
72                                     [% ELSE %]
73                                         <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=add_form" tabindex="-1" class="menu-inactive" role="menuitem">Log in to create your own lists</a></li>
74                                     [% END # / IF loggedinusername %]
75                                 [% END # / IF opacuserlogin %]
76                                 </ul> <!-- / .dropdown-menu -->
77                             </li> <!-- / .dropdown -->
78                         [% END # / IF virtualshelves %]
79                     </ul> <!-- / .nav -->
80
81                     [% IF Koha.Preference( 'opacuserlogin' ) == 1 ||  Koha.Preference( 'EnableOpacSearchHistory') || Koha.Preference( 'opaclanguagesdisplay' ) %]
82
83                         <div id="members" class="pull-right">
84                             [% IF ( Koha.Preference( 'opaclanguagesdisplay' ) ) %]
85                                 [% INCLUDE 'masthead-langmenu.inc' %]
86                             [% END %]
87                             <ul class="nav">
88                                 <li class="dropdown">
89                                     [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) %]
90                                         [% IF ( loggedinusername ) %]
91                                             <a href="#" class="dropdown-toggle" id="user-menu" data-toggle="dropdown" role="button">
92                                                 <i class="fa fa-user fa-icon-white fa-fw"></i>
93                                                 <span class="userlabel">Welcome, [% INCLUDE 'patron-title.inc' patron = logged_in_user no_html = 1 %]</span>
94                                                 <b class="caret"></b>
95                                             </a>
96                                         [% ELSE %]
97                                             [% IF Koha.Preference('casAuthentication') %]
98                                                 [%# CAS authentication is too complicated for modal window %]
99                                                     <a class="login-link" href="/cgi-bin/koha/opac-user.pl"><i class="fa fa-user fa-icon-white fa-fw"></i> <span class="userlabel">Log in to your account</span></a>
100                                             [% ELSIF ( Koha.Preference('GoogleOpenIDConnect') == 1 ) %]
101                                                 <a class="login-link" href="/cgi-bin/koha/svc/auth/googleopenidconnect" role="button" data-toggle="modal"><i class="fa fa-user fa-icon-white fa-fw"></i> <span class="userlabel">Log in to your account</span></a>
102                                             [% ELSE %]
103                                                 <a href="/cgi-bin/koha/opac-user.pl" class="login-link loginModal-trigger" role="button" data-toggle="modal"><i class="fa fa-user fa-icon-white fa-fw"></i> <span class="userlabel">Log in to your account</span></a>
104                                             [% END %]
105                                         [% END %]
106                                     [% END %]
107
108                                     [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 && loggedinusername ) %]
109                                         <ul aria-labelledby="user-menu" role="menu" class="dropdown-menu dropdown-menu-right">
110                                             <li role="presentation">
111                                                 <div id="loggedinuser-menu">
112                                                     <p>
113                                                         <a class="login-link" href="/cgi-bin/koha/opac-user.pl"><span class="loggedinusername" data-borrowernumber="[% logged_in_user.borrowernumber | html %]" data-branchcode="[% logged_in_user.branchcode | html %]" >Your account</span></a>
114                                                     </p>
115                                                     [% IF Koha.Preference( 'EnableOpacSearchHistory' ) %]
116                                                         <p class="search_history">
117                                                             <a tabindex="-1" role="menuitem" class="login-link" href="/cgi-bin/koha/opac-search-history.pl" title="View your search history">Search history</a>
118                                                             <span class="divider-vertical"></span>
119                                                             <a class="logout clearsh" href="/cgi-bin/koha/opac-search-history.pl?action=delete" title="Delete your search history"><i class="fa fa-trash"></i> Clear</a>
120                                                         </p>
121                                                     [% END %]
122                                                     <p>
123                                                         <a tabindex="-1" role="menuitem" class="logout" id="logout" href="/cgi-bin/koha/opac-main.pl?logout.x=1">
124                                                         Log out</a>
125                                                     </p>
126                                                 </div>
127                                             </li>
128                                         </ul>
129                                     [% END %]
130                                 </li>
131                                 [% IF ( !Koha.Preference( 'opacuserlogin') || !loggedinusername ) %]
132                                     [% IF Koha.Preference( 'EnableOpacSearchHistory' ) %]
133                                         <li class="search_history">
134                                             <a href="/cgi-bin/koha/opac-search-history.pl" title="View your search history">Search history</a>
135                                             <span class="divider-vertical"></span>
136                                             <a class="logout clearsh" href="/cgi-bin/koha/opac-search-history.pl?action=delete" title="Delete your search history"><i class="fa fa-trash"></i> Clear</a>
137                                         </li>
138                                     [% END %]
139                                 [% END %]
140                             </ul>
141                         </div> <!-- /members -->
142                     [% END # IF opacuserlogin || EnableOpacSearchHistory || opaclanguagesdisplay %]
143
144                 </div> <!-- /container-fluid -->
145             </div> <!-- /navbar-inner -->
146         </div> <!-- /navbar -->
147
148         [% PROCESS koha_news_block news => KohaNews.get( location => "opacheader", lang => news_lang, library => branchcode, blocktitle => 0 ) %]
149
150     </div> <!-- / header-region -->
151
152     <div class="container-fluid">
153         <div class="row-fluid">
154             <div id="opac-main-search">
155             <div class="span12">
156                 [% IF ( OpacPublic ) %]
157                     [% UNLESS ( advsearch ) %]
158                         [% IF ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
159                             <div class="mastheadsearch librarypulldown">
160                         [% ELSE %]
161                             <div class="mastheadsearch">
162                         [% END %]
163                         [% IF Koha.Preference('OpacCustomSearch') == '' %]
164                             <form name="searchform" method="get" action="/cgi-bin/koha/opac-search.pl" id="searchform" class="form-inline">
165                                 <label for="masthead_search"> Search
166                                     [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
167                                         [% IF ( mylibraryfirst ) %]
168                                             (in [% Branches.GetName( mylibraryfirst ) | html %] only)
169                                         [% END %]
170                                     [% END %]
171                                 </label>
172
173                                 <select name="idx" id="masthead_search">
174                                 [% IF ( ms_kw ) %]
175                                     <option selected="selected" value="">Library catalog</option>
176                                 [% ELSE %]
177                                     <option value="">Library catalog</option>
178                                 [% END # /ms_kw %]
179                                 [% IF ( ms_ti ) %]
180                                     <option selected="selected" value="ti">Title</option>
181                                 [% ELSE %]
182                                     <option value="ti">Title</option>
183                                 [% END # /ms_ti %]
184                                 [% IF ( ms_au ) %]
185                                     <option selected="selected" value="au">Author</option>
186                                 [% ELSE %]
187                                     <option value="au">Author</option>
188                                 [% END # /ms_au%]
189                                 [% IF ( ms_su ) %]
190                                     <option selected="selected" value="su">Subject</option>
191                                 [% ELSE %]
192                                     <option value="su">Subject</option>
193                                 [% END # /ms_su %]
194                                 [% IF ( ms_nb ) %]
195                                     <option selected="selected" value="nb">ISBN</option>
196                                 [% ELSE %]
197                                     <option value="nb">ISBN</option>
198                                 [% END # /ms_nb%]
199                                 [% IF ( ms_ns ) %]
200                                     <option selected="selected" value="ns">ISSN</option>
201                                 [% ELSE %]
202                                     <option value="ns">ISSN</option>
203                                 [% END # /ms_ns%]
204                                 [% IF ( ms_se ) %]
205                                     <option selected="selected" value="se">Series</option>
206                                 [% ELSE %]
207                                     <option value="se">Series</option>
208                                 [% END # /ms_se %]
209                                 [% IF ( Koha.Preference('OPACNumbersPreferPhrase') ) %]
210                                     [% IF ( ms_callnumcommaphr ) %]
211                                         <option selected="selected" value="callnum,phr">Call number</option>
212                                     [% ELSE %]
213                                         <option value="callnum,phr">Call number</option>
214                                     [% END #/ms_callnumcommaphr %]
215                                 [% ELSE %]
216                                     [% IF ( ms_callnum ) %]
217                                         <option selected="selected" value="callnum">Call number</option>
218                                     [% ELSE %]
219                                         <option value="callnum">Call number</option>
220                                     [% END # /ms_callnum %]
221                                 [% END # /IF OPACNumbersPreferPhrase %]
222                                 </select>
223
224                                 [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
225                                     <div class="input-append nolibrarypulldown">
226                                 [% END %]
227                                 [% IF ( ms_value ) %]
228                                     <input type="text" title="Type search term" class="transl1" id = "translControl1" name="q" value="[% ms_value | html %]" /><span id="translControl"></span>
229                                 [% ELSE %]
230                                     <input type="text" title="Type search term" class="transl1" id = "translControl1" name="q" /><span id="translControl"></span>
231                                 [% END # /ms_value %]
232
233                                 [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
234                                     <button type="submit" id="searchsubmit" class="btn btn-primary">Go</button>
235                                     </div>
236                                 [% END %]
237
238                                 [% IF ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
239                                     <div class="input-append">
240                                         <select name="branch_group_limit" id="select_library">
241                                             <option value="">All libraries</option>
242
243                                             [% IF LibrarySearchGroups %]<optgroup label="Libraries">[% END %]
244
245                                             [% FOREACH library IN Branches.all( selected => opac_name ) %]
246                                                 [% IF library.selected %]
247                                                     <option selected="selected" value="branch:[% library.branchcode | html %]">[% library.branchname | html %]</option>
248                                                 [% ELSE %]
249                                                     <option value="branch:[% library.branchcode | html %]">[% library.branchname | html %]</option>
250                                                 [% END %]
251                                             [% END %]
252
253                                             [% IF LibrarySearchGroups %]
254                                                 </optgroup>
255                                                 <optgroup label="Groups">
256                                                     [% FOREACH lsg IN LibrarySearchGroups %]
257                                                         [% IF lsg.id == opac_name %]
258                                                             <option selected="selected" value="multibranchlimit-[% lsg.id | html %]">[% lsg.title | html %]</option>
259                                                         [% ELSE %]
260                                                             <option value="multibranchlimit-[% lsg.id | html %]">[% lsg.title | html %]</option>
261                                                         [% END # / bc.selected %]
262                                                     [% END %]
263                                                 </optgroup>
264                                             [% END # / BranchCategoriesLoop %]
265                                         </select>
266                                         <button type="submit" id="searchsubmit" class="btn btn-primary">Go</button>
267                                     </div>
268                                 [% ELSE %]
269                                     [% IF ( opac_limit_override ) %]
270                                         [% IF ( opac_search_limit ) %]
271                                             [% IF ( multibranchlimit = opac_search_limit.match( 'branch:(multibranchlimit-\d+)' ) ) %]
272                                                 <input name="branch_group_limit" value="[% multibranchlimit.0 | html %]" type="hidden" />
273                                             [% ELSE %]
274                                                 <input name="limit" value="[% opac_search_limit | html %]" type="hidden" />
275                                             [% END %]
276                                         [% END %]
277                                     [% ELSE %]
278                                         [% IF ( mylibraryfirst ) %]
279                                             <input name="limit" value="branch:[% mylibraryfirst | html %]" type="hidden" />
280                                         [% END %]
281                                     [% END # / opac_limit_override %]
282                                 [% END # / OpacAddMastheadLibraryPulldown %]
283
284                             </form>
285                         [% ELSE # / Koha.Preference('OpacCustomSearch') == '' %]
286                             [% Koha.Preference('OpacCustomSearch') | $raw %]
287                         [% END # / Koha.Preference('OpacCustomSearch') == '' %]
288                         </div> <!-- / .mastheadsearch -->
289                     [% END # / UNLESS advsearch %]
290
291                     <div class="row-fluid">
292                             <div id="moresearches">
293                                 <ul>
294                                     <li><a href="/cgi-bin/koha/opac-search.pl">Advanced search</a></li>
295                                     [% IF ( Koha.Preference( 'UseCourseReserves' ) == 1 ) %]<li><a href="/cgi-bin/koha/opac-course-reserves.pl">Course reserves</a></li>[% END %]
296                                     [% IF Koha.Preference( 'OpacBrowser' ) == 1 %]<li><a href="/cgi-bin/koha/opac-browser.pl">Browse by hierarchy</a></li>[% END %]
297                                     [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]<li><a href="/cgi-bin/koha/opac-authorities-home.pl">Authority search</a></li>[% END %]
298                                     [% 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 %]
299                                     [% IF Koha.Preference( 'TagsEnabled' ) == 1 %]<li><a href="/cgi-bin/koha/opac-tags.pl">Tag cloud</a></li>[% END %]
300                                     [% IF Koha.Preference( 'OpacCloud' ) == 1 %]<li><a href="/cgi-bin/koha/opac-tags_subject.pl">Subject cloud</a></li>[% END %]
301                                     [% IF Koha.Preference( 'OpacTopissue' ) == 1 %]<li><a href="/cgi-bin/koha/opac-topissues.pl">Most popular</a></li>[% END %]
302                                     [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' && Koha.Preference( 'OpacBrowseSearch' ) == 1 %]<li><a href="/cgi-bin/koha/opac-browse.pl">Browse search</a></li>[% END %]
303                                     [% IF Koha.Preference( 'suggestion' ) == 1 %]
304                                         [% IF Koha.Preference( 'AnonSuggestions' ) == 1 %]
305                                             <li><a href="/cgi-bin/koha/opac-suggestions.pl">Purchase suggestions</a></li>
306                                         [% ELSIF ( ( Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 ) ) %]
307                                             <li><a href="/cgi-bin/koha/opac-suggestions.pl">Purchase suggestions</a></li>
308                                         [% END %]
309                                     [% END %]
310                                     [% Koha.Preference('OpacMoreSearches') | $raw %]
311                                 </ul>
312                             </div> <!-- /#moresearches -->
313                     </div> <!-- /.row-fluid -->
314
315                 [% END # / OpacPublic %]
316             </div> <!-- /.span10 -->
317             </div> <!-- /.opac-main-search -->
318         </div> <!-- / .row-fluid -->
319     </div> <!-- /.container-fluid -->
320
321     <!-- Login form hidden by default, used for modal window -->
322     <div id="loginModal" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="modalLoginLabel" aria-hidden="true">
323         <div class="modal-header">
324             <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
325             <h3 id="modalLoginLabel">Log in to your account</h3>
326         </div>
327         <form action="/cgi-bin/koha/opac-user.pl" method="post" name="auth" id="modalAuth">
328             <input type="hidden" name="has-search-query" id="has-search-query" value="" />
329             <div class="modal-body">
330                 [% IF ( shibbolethAuthentication ) %]
331                     [% IF ( invalidShibLogin ) %]
332                         <!-- This is what is displayed if shibboleth login has failed to match a koha user -->
333                         <div class="alert alert-info">
334                             <p>Sorry, your Shibboleth identity does not match a valid library identity. If you have a local login, you may use that below.</p>
335                         </div>
336                     [% ELSE %]
337                         <h4>Shibboleth login</h4>
338                         <p>If you have a Shibboleth account, please <a href="[% shibbolethLoginUrl | $raw %]">click here to login</a>.</p>
339                         <h4>Local Login</h4>
340                     [% END %]
341                 [% END %]
342                 <input type="hidden" name="koha_login_context" value="opac" />
343                 <fieldset class="brief">
344                     <label for="muserid">Login:</label><input type="text" id="muserid" name="userid" />
345                     <label for="mpassword">Password:</label><input type="password" id="mpassword" name="password" />
346                     [% IF Koha.Preference( 'OpacLoginInstructions' ) %]
347                         <div id="nologininstructions-modal" class="nologininstructions">
348                             [% Koha.Preference( 'OpacLoginInstructions' ) | $raw %]
349                         </div>
350                     [% END %]
351                     [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
352                         <div id="forgotpassword-modal" class="forgotpassword">
353                             <a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a>
354                         </div>
355                     [% END %]
356                     [% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %]
357                         <div id="patronregistration-modal" class="patronregistration">
358                             <p>Don't have an account? <a href="/cgi-bin/koha/opac-memberentry.pl">Register here.</a></p>
359                         </div>
360                     [% END %]
361                 </fieldset>
362             </div>
363             <div class="modal-footer">
364                 <input type="submit" class="btn btn-primary" value="Log in" />
365             </div>
366         </form> <!-- /#auth -->
367     </div>  <!-- /#modalAuth  -->