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