Bug 15326: Using AdditionalContents for custom pages on OPAC
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-main.tt
1 [% USE raw %]
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% USE Categories %]
6 [% USE Price %]
7 [% USE AdditionalContents %]
8 [% PROCESS 'i18n.inc' %]
9 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
10 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
11 [% SET OpacNavRight = AdditionalContents.get( location => "OpacNavRight", lang => lang, library => logged_in_user.branchcode || default_branch ) %]
12 [% SET OpacMainUserBlock = AdditionalContents.get( location => "OpacMainUserBlock", lang => lang, library => logged_in_user.branchcode || default_branch ) %]
13 [% SET OpacLoginInstructions = AdditionalContents.get( location => "OpacLoginInstructions", lang => lang, library => branchcode || default_branch ) %]
14 [% INCLUDE 'doc-head-open.inc' %]
15 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
16 [% INCLUDE 'doc-head-close.inc' %]
17 [% BLOCK cssinclude %][% END %]
18 </head>
19 [% INCLUDE 'bodytag.inc' bodyid='opac-main' %]
20 [% INCLUDE 'masthead.inc' %]
21
22 <div class="main">
23     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
24         <ol class="breadcrumb">
25             [% IF news_item %]
26                 <li class="breadcrumb-item">
27                     <a href="/cgi-bin/koha/opac-main.pl">Home</a>
28                 </li>
29                 <li class="breadcrumb-item active">
30                     <a href="#" aria-current="page">[% news_item.title | html %]</a>
31                 </li>
32             [% ELSE %]
33                 <li class="breadcrumb-item active">
34                     <a href="#" aria-current="page">Home</a>
35                 </li>
36             [% END %]
37         </ol>
38     </nav> <!-- /#breadcrumbs -->
39
40     [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
41         [% IF ( loggedinusername ) %]
42             <div id="loggedin" class="container-fluid">
43         [% ELSE %]
44             <div id="notloggedin" class="container-fluid">
45         [% END %]
46     [% ELSE %]
47         <div id="notloggedin" class="container-fluid">
48     [% END %]
49
50     <div class="row">
51         [% IF ( OpacNav ||  OpacNavBottom ) %]
52             <div class="col-12 col-lg-2 order-3 order-lg-1">
53                 <div id="navigation">
54                     [% INCLUDE 'navigation.inc' %]
55                 </div>
56             </div>
57         [% END %]
58
59         [% IF ( OpacNav ||  OpacNavBottom  ) && (Koha.Preference( 'opacuserlogin' ) == 1 || OpacNavRight) %]
60             [% #  Three-column layout with right and left sidebars %]
61             <div class="col-12 col-lg-7 order-md-1 maincontent">
62         [% ELSIF (Koha.Preference( 'opacuserlogin' ) == 1 || OpacNavRight) %]
63             [% #  Two-column layout with right sidebar %]
64             <div class="col-12 col-lg-9 order-md-1 maincontent">
65         [% ELSIF ( OpacNav ||  OpacNavBottom  ) %]
66             <div class="col-12 col-lg-10 order-md-1 maincontent">
67         [% ELSE %]
68             <div class="col order-md-1 maincontent">
69         [% END %]
70
71         <h1 class="sr-only">Koha home</h1>
72
73         [% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
74             [% UNLESS news_item %]
75                 <form id="news-branch-select" class="form-inline" name="news-branch-select" method="get" action="/cgi-bin/koha/opac-main.pl">
76                     <legend class="sr-only">News</legend>
77                     <label for="news-branch">Display news for: </label>
78                     <select id="news-branch" name="branch">
79                         [% IF ( branchcode == "" ) %]
80                             <option value="" selected="selected">System-wide only</option>
81                         [% ELSE %]
82                             <option value="">System-wide only</option>
83                         [% END %]
84                         [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
85                     </select>
86                 </form>
87             [% END %]
88         [% END %]
89
90         [% IF koha_news.count %]
91
92             [% IF single_news_error %]
93
94                 <div class="alert alert-error">
95                     This news item does not exist.
96                 </div>
97
98             [% ELSE %]
99
100                 <div id="news" class="newscontainer">
101                     [% SET show_author = Koha.Preference('NewsAuthorDisplay') == 'opac' || Koha.Preference('NewsAuthorDisplay') == 'both' %]
102                     [% FOREACH koha_new IN koha_news %]
103                     [% IF koha_new.category == 'news' %]
104                         <div class="newsitem">
105                             <h4 class="newsheader">
106                                 [% IF ( news_item ) %]
107                                     [% koha_new.title | html %]
108                                 [% ELSE %]
109                                     <a name="newsitem[% koha_new.idnew | html %]" href="/cgi-bin/koha/opac-main.pl?news_id=[% koha_new.idnew | uri %]">[% koha_new.title | html %]</a>
110                                 [% END %]
111                             </h4>
112                             <div class="newsbody">[% koha_new.content | $raw %]</div>
113                             <div class="newsfooter">
114                                 Published on [% koha_new.published_on | $KohaDates %]
115                                 [% IF ( show_author && koha_new.author ) %]
116                                     by <span class="newsauthor">[% INCLUDE 'patron-title.inc' patron=koha_new.author %]</span>
117                                 [% END %]
118                                 [% IF ( news_item ) %]
119                                     &bull; <a href="/cgi-bin/koha/opac-main.pl">Show all news</a>
120                                 [% END %]
121                             </div>
122                         </div>
123                     [% END %]
124                     [% END %]
125
126                     [% UNLESS news_item %]
127                         <div id="rssnews-container">
128                             <!-- Logged in users have a branch code or it could be explicitly set -->
129                             <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-news-rss.pl?branchcode=[% branchcode | uri %]">
130                                 <i class="fa fa-rss" aria-hidden="true"></i>
131                                 [% IF Branches.all.size == 1 %]
132                                     [% IF branchcode %]
133                                         <span>RSS feed for [% Branches.GetName( branchcode ) | html %] library news</span>
134                                     [% ELSE %]
135                                         <span>RSS feed for library news</span>
136                                     [% END %]
137                                 [% ELSE %]
138                                     [% IF branchcode %]
139                                         <span>RSS feed for [% Branches.GetName( branchcode ) | html %] and system-wide library news</span>
140                                     [% ELSE %]
141                                         <span>RSS feed for system-wide library news</span>
142                                     [% END %]
143                                 [% END %]
144                             </a>
145                         </div>
146                     [% END %]
147                 </div>
148
149             [% END # /IF single_news_error %]
150
151         [% ELSE %] <!-- koha news -->
152             [% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
153                 <div id="news" class="newscontainer">
154                     <div class="newsitem">
155                         <div class="newsbody">No news to display.</div>
156                         <div class="newsfooter"></div>
157                     </div>
158                 </div>
159             [% END %]
160
161         [% END # IF koha_news %]
162
163         [% UNLESS news_item # Don't show under single news item %]
164             [% IF ( daily_quote ) %]
165                 <div id="daily-quote">
166                     <h2>Quote of the day</h2>
167                     <div>
168                         <span id="daily-quote-text">[% daily_quote.text | html %]</span><span id="daily-quote-sep"> ~ </span><span id="daily-quote-source">[% daily_quote.source | html %]</span>
169                     </div>
170                 </div>
171             [% END %]
172
173             [% IF ( OpacMainUserBlock ) %]
174                 [% PROCESS koha_news_block news => OpacMainUserBlock %]
175             [% END %]
176         [% END %]
177
178         </div> <!-- / .col 6/8 -->
179
180         [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) || OpacNavRight ) %]
181             <div class="col-12 col-lg-3 order-md-2">
182                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
183                     [% UNLESS ( loggedinusername ) %]
184                         [% UNLESS ( casAuthentication || shibbolethAuthentication || Koha.Preference('opacShibOnly') ) %]
185                             <div id="login">
186                                 <form action="/cgi-bin/koha/opac-user.pl" method="post" name="auth" id="auth" autocomplete="off">
187                                     <input type="hidden" name="koha_login_context" value="opac" />
188                                     <fieldset class="brief">
189                                         <legend>Log in to your account:</legend>
190                                         [% IF ( Koha.Preference('GoogleOpenIDConnect') == 1 ) %]
191                                             <a href="/cgi-bin/koha/svc/auth/googleopenidconnect" class="btn btn-light" id="openid_connect"><i class="fa fa-google" aria-hidden="true"></i> Log in with Google</a>
192                                             <p>If you do not have a Google account, but do have a local account, you can still log in: </p>
193                                         [% END # /IF GoogleOpenIDConnect %]
194                                         <div class="local-login">
195                                             <label for="userid">Login:</label>
196                                             <input class="form-control" type="text" id="userid" name="userid" autocomplete="off" />
197                                             <label for="password">Password:</label>
198                                             <input class="form-control" type="password" id="password" name="password" autocomplete="off" />
199                                             <fieldset class="action">
200                                                 <input type="submit" value="Log in" class="btn btn-primary" />
201                                             </fieldset>
202                                         </div>
203                                         [% IF ( OpacLoginInstructions ) %]
204                                             <div id="nologininstructions-main" class="nologininstructions">
205                                                 [% PROCESS koha_news_block news => OpacLoginInstructions %]
206                                             </div>
207                                         [% END %]
208                                         [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
209                                             <div id="forgotpassword-main" class="forgotpassword">
210                                                 <p><a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a></p>
211                                             </div>
212                                         [% END %]
213                                         [% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %]
214                                             <div id="patronregistration-main" class="patronregistration">
215                                                 <p>Don't have an account? <a href="/cgi-bin/koha/opac-memberentry.pl">Register here.</a></p>
216                                             </div>
217                                         [% END %]
218                                     </fieldset>
219                                 </form>
220                             </div> <!-- /#login -->
221                         [% END # /casAuthentication %]
222                     [% ELSE %]
223                         [% IF Koha.Preference('OPACUserSummary') && dashboard_info %]
224                             <div id="user_summary">
225                                 <h2>User summary</h2>
226                                 <p>Welcome, <a href="/cgi-bin/koha/opac-user.pl"><span class="loggedinusername">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</span></a></p>
227                                 <ul id="user_summary_shortcuts">
228                                     [% IF checkouts && checkouts > 0 %]
229                                         <li>
230                                             <a href="/cgi-bin/koha/opac-user.pl#opac-user-checkouts">
231                                                 <span class="user_checkouts_count count_label">[% checkouts | html %]</span>
232                                                 [% tn('checkout', 'checkouts', checkouts ) | html %]
233                                             </a>
234                                         </li>
235                                     [% END %]
236                                     [% IF overdues && overdues > 0 %]
237                                         <li>
238                                             <a href="/cgi-bin/koha/opac-user.pl#opac-user-overdues">
239                                                 <span class="user_overdues_count count_label">[% overdues | html %]</span>
240                                                 [% tn('overdue', 'overdues', overdues ) | html %]
241                                             </a>
242                                         </li>
243                                     [% END %]
244                                     [% IF holds_pending && holds_pending > 0 %]
245                                         <li>
246                                             <a href="/cgi-bin/koha/opac-user.pl#opac-user-holds">
247                                                 <span class="user_holds_pending_count count_label">[% holds_pending | html %]</span>
248                                                 [% tn('hold pending', 'holds pending', holds_pending ) | html %]
249                                             </a>
250                                         </li>
251                                     [% END %]
252                                     [% IF holds_waiting && holds_waiting > 0 %]
253                                         <li>
254                                             <a href="/cgi-bin/koha/opac-user.pl#opac-user-holds">
255                                                 <span class="user_holds_waiting_count count_label">[% holds_waiting | html %]</span>
256                                                 [% tn('hold waiting', 'holds waiting', holds_waiting ) | html %]
257                                             </a>
258                                         </li>
259                                     [% END %]
260                                     [% IF total_owing && total_owing > 0 %]
261                                         <li>
262                                             <a href="/cgi-bin/koha/opac-account.pl">
263                                                 <span class="user_fines_count count_label">[% total_owing | $Price with_symbol => 1 %]</span>
264                                                 due in fines and charges
265                                             </a>
266                                         </li>
267                                     [% END %]
268                                     [% IF patron_messages && patron_messages.count > 0 || opacnote %]
269                                         [% IF opacnote %]
270                                             <li>
271                                                 <a href="/cgi-bin/koha/opac-user.pl">
272                                                     <span class="count_label">[% patron_messages.count + 1 | html %]</span>
273                                                     [% tn('message', 'messages', patron_messages.count + 1 ) | html %]
274                                                 </a>
275                                             </li>
276                                         [% ELSE %]
277                                             <li>
278                                                 <a href="/cgi-bin/koha/opac-user.pl">
279                                                     <span class="count_label">[% patron_messages.count | html %]</span>
280                                                     [% tn('message', 'messages', patron_messages.count ) | html %]
281                                                 </a>
282                                             </li>
283                                         [% END %]
284                                     [% END %]
285                                 </ul>
286                             </div>
287                         [% END %]
288                     [% END # /loggedinusername %]
289                 [% END # /opacuserlogin %]
290                 [% PROCESS koha_news_block news => OpacNavRight %]
291             </div> <!-- / .col -->
292         [% END # /opacuserlogin || OpacNavRight %]
293
294         </div> <!-- /.container-fluid -->
295     </div> <!-- /.row -->
296 </div> <!-- /.main -->
297
298 [% INCLUDE 'opac-bottom.inc' %]
299 [% BLOCK jsinclude %][% END %]