Bug 22880: (follow-up) Loose ends: Better DB update, global inclusion, etc.
[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 KohaNews %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 [% BLOCK cssinclude %][% END %]
12 </head>
13 [% INCLUDE 'bodytag.inc' bodyid='opac-main' %]
14 [% INCLUDE 'masthead.inc' %]
15
16 <div class="main">
17     <ul class="breadcrumb">
18         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a>
19         [% IF news_item %]
20             <span class="divider">&rsaquo;</span></li>
21             <li>[% news_item.title | html %]</li>
22         [% END %]
23         </li>
24     </ul>
25
26     [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
27         [% IF ( loggedinusername ) %]
28             <div id="loggedin" class="container-fluid">
29         [% ELSE %]
30             <div id="notloggedin" class="container-fluid">
31         [% END %]
32     [% ELSE %]
33         <div id="notloggedin" class="container-fluid">
34     [% END %]
35
36     <div class="row-fluid">
37     [% IF ( OpacNav ||  OpacNavBottom ) %]
38         <div class="span2">
39             <div id="navigation">
40                 [% INCLUDE 'navigation.inc' %]
41             </div>
42         </div>
43     [% END %]
44
45     [% SET OpacNavRight = KohaNews.get( location => "OpacNavRight", lang => lang, library => branchcode ) %]
46     [% IF ( OpacNav ||  OpacNavBottom  ) && (Koha.Preference( 'opacuserlogin' ) == 1 || OpacNavRight) %]
47         <div class="span7">
48     [% ELSIF (Koha.Preference( 'opacuserlogin' ) == 1 || OpacNavRight) %]
49         <div class="span9">
50     [% ELSIF ( OpacNav ||  OpacNavBottom  ) %]
51         <div class="span10">
52     [% ELSE %]
53         <div class="span12">
54     [% END %]
55
56         [% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
57             [% UNLESS news_item %]
58                 <form id="news-branch-select" class="form-inline" name="news-branch-select" method="get" action="/cgi-bin/koha/opac-main.pl">
59                     <label for="news-branch">Display news for: </label>
60                     <select id="news-branch" name="branch">
61                         [% IF ( branchcode == "" ) %]
62                             <option value="" selected="selected">System-wide only</option>
63                         [% ELSE %]
64                             <option value="">System-wide only</option>
65                         [% END %]
66                         [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
67                     </select>
68                 </form>
69             [% END %]
70         [% END %]
71
72         [% IF ( koha_news ) %]
73
74             [% IF single_news_error %]
75
76                 <div class="alert alert-error">
77                     This news item does not exist.
78                 </div>
79
80             [% ELSE %]
81
82                 <div id="news" class="newscontainer">
83                     [% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %]
84                     [% FOREACH koha_new IN koha_news %]
85                         <div class="newsitem">
86                             <h4 class="newsheader">
87                                 [% IF ( news_item ) %]
88                                     [% koha_new.title | html %]
89                                 [% ELSE %]
90                                     <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>
91                                 [% END %]
92                             </h4>
93                             <div class="newsbody">[% koha_new.content | $raw %]</div>
94                             <div class="newsfooter">
95                                 Published on [% koha_new.timestamp | $KohaDates with_hours = 1 %]
96                                 [% IF ( (newsdisp == 'opac' || newsdisp == 'both') && koha_new.borrowernumber ) %]
97                                     by <span class="newsauthor_title">[% koha_new.author_title | html %] </span>[% koha_new.author_firstname | html %] [% koha_new.author_surname | html %]
98                                 [% END %]
99                                 [% IF ( news_item ) %]
100                                     &bull; <a href="/cgi-bin/koha/opac-main.pl">Show all news</a>
101                                 [% END %]
102                             </div>
103                         </div>
104
105                     [% END %]
106                     [% UNLESS news_item %]
107                         <div id="rssnews-container">
108                             <!-- Logged in users have a branch code or it could be explicitly set -->
109                             <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-news-rss.pl?branchcode=[% branchcode | uri %]">
110                                 <i class="fa fa-rss"></i>
111                                 [% IF Branches.all.size == 1 %]
112                                     [% IF branchcode %]
113                                         RSS feed for [% Branches.GetName( branchcode ) | html %] library news
114                                     [% ELSE %]
115                                         RSS feed for library news
116                                     [% END %]
117                                 [% ELSE %]
118                                     [% IF branchcode %]
119                                         RSS feed for [% Branches.GetName( branchcode ) | html %] and system-wide library news
120                                     [% ELSE %]
121                                         RSS feed for system-wide library news
122                                     [% END %]
123                                 [% END %]
124                             </a>
125                         </div>
126                     [% END %]
127                 </div>
128
129             [% END # /IF single_news_error %]
130
131         [% ELSE %] <!-- koha news -->
132             [% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
133                 <div id="news" class="newscontainer">
134                     <div class="newsitem">
135                         <div class="newsbody">No news to display.</div>
136                         <div class="newsfooter"></div>
137                     </div>
138                 </div>
139             [% END %]
140
141         [% END # IF koha_news %]
142
143         [% UNLESS news_item # Don't show under single news item %]
144             [% IF ( display_daily_quote && daily_quote ) %]
145                 <div id="daily-quote">
146                     <h3>Quote of the day</h3>
147                     <div>
148                         <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>
149                     </div>
150                 </div>
151             [% END %]
152
153             [% IF ( OpacMainUserBlock ) %]<div id="opacmainuserblock">[% OpacMainUserBlock | $raw %]</div>[% END %]
154         [% END %]
155
156         </div> <!-- / .span 7/9 -->
157
158         [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) || OpacNavRight ) %]
159             <div class="span3">
160                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
161                     [% UNLESS ( loggedinusername ) %]
162                         [% UNLESS ( casAuthentication || shibbolethAuthentication ) %]
163                             <div id="login">
164                                 <form action="/cgi-bin/koha/opac-user.pl" method="post" name="auth" id="auth" autocomplete="off">
165                                     <input type="hidden" name="koha_login_context" value="opac" />
166                                     <fieldset class="brief">
167                                         <legend>Log in to your account:</legend>
168                                         <label for="userid">Login:</label><input type="text" id="userid" name="userid" />
169                                         <label for="password">Password:</label><input type="password" id="password" name="password" />
170                                         <fieldset class="action">
171                                             <input type="submit" value="Log in" class="btn" />
172                                         </fieldset>
173                                         [% IF Koha.Preference( 'OpacLoginInstructions' ) %]
174                                             <div id="nologininstructions-main" class="nologininstructions">
175                                                 [% Koha.Preference( 'OpacLoginInstructions' ) | $raw %]
176                                             </div>
177                                         [% END %]
178                                         [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
179                                             <div id="forgotpassword-main" class="forgotpassword">
180                                                 <p><a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a></p>
181                                             </div>
182                                         [% END %]
183                                         [% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %]
184                                             <div id="patronregistration-main" class="patronregistration">
185                                                 <p>Don't have an account? <a href="/cgi-bin/koha/opac-memberentry.pl">Register here.</a></p>
186                                             </div>
187                                         [% END %]
188                                     </fieldset>
189                                 </form>
190                             </div> <!-- /#login -->
191                         [% END # /casAuthentication %]
192                     [% ELSE %]
193                         [% IF Koha.Preference('OPACUserSummary') && dashboard_info %]
194                             <div id="user_summary">
195                                 <h3>Welcome, <a href="/cgi-bin/koha/opac-user.pl"><span class="loggedinusername">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</span></a></h3>
196                                 <ul id="user_summary_shortcuts">
197                                     [% IF checkouts && checkouts > 0 %]
198                                         <li><a href="/cgi-bin/koha/opac-user.pl#opac-user-checkouts"><span class="user_checkouts_count count_label">[% checkouts | html %]</span> checkout(s)</a></li>
199                                     [% END %]
200                                     [% IF overdues && overdues > 0 %]
201                                         <li><a href="/cgi-bin/koha/opac-user.pl#opac-user-overdues"><span class="user_overdues_count count_label">[% overdues | html %]</span> overdue(s)</a></li>
202                                     [% END %]
203                                     [% IF holds_pending && holds_pending > 0 %]
204                                         <li><a href="/cgi-bin/koha/opac-user.pl#opac-user-holds"><span class="user_holds_pending_count count_label">[% holds_pending | html %]</span> hold(s) pending</a></li>
205                                     [% END %]
206                                     [% IF holds_waiting && holds_waiting > 0 %]
207                                         <li><a href="/cgi-bin/koha/opac-user.pl#opac-user-holds"><span class="user_holds_waiting_count count_label">[% holds_waiting | html %]</span> hold(s) waiting</a></li>
208                                     [% END %]
209                                     [% IF total_owing && total_owing > 0 %]
210                                         <li><a href="/cgi-bin/koha/opac-account.pl"><span class="user_fines_count count_label">[% total_owing | $Price with_symbol => 1 %]</span> due in fines and charges</a></li>
211                                     [% END %]
212                                 </ul>
213                             </div>
214                         [% END %]
215                     [% END # /loggedinusername %]
216                 [% END # /opacuserlogin %]
217                 [% PROCESS koha_news_block news => OpacNavRight %]
218             </div> <!-- / .span3 -->
219         [% END # /opacuserlogin || OpacNavRight %]
220
221         </div> <!-- /.container-fluid -->
222     </div> <!-- /.row-fluid -->
223 </div> <!-- /.main -->
224
225 [% INCLUDE 'opac-bottom.inc' %]
226 [% BLOCK jsinclude %][% END %]