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