Bug 16371: Quote of the Day (QOTD) - Display in different interfaces
[srvgit] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-main.tt
index b025260..2288fc6 100644 (file)
@@ -2,7 +2,12 @@
 [% USE Koha %]
 [% USE KohaDates %]
 [% USE Branches %]
+[% USE Categories %]
 [% USE Price %]
+[% USE KohaNews %]
+[% SET OpacNavRight = KohaNews.get( location => "OpacNavRight", lang => lang, library => branchcode ) %]
+[% SET OpacMainUserBlock = KohaNews.get( location => "OpacMainUserBlock", lang => lang, library => branchcode ) %]
+[% SET OpacLoginInstructions = KohaNews.get( location => "OpacLoginInstructions", lang => lang, library => branchcode ) %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
 [% INCLUDE 'doc-head-close.inc' %]
     [% END %]
 
     [% IF ( OpacNav ||  OpacNavBottom  ) && (Koha.Preference( 'opacuserlogin' ) == 1 || OpacNavRight) %]
-        <div class="span7">
+        <div class="span7 maincontent">
     [% ELSIF (Koha.Preference( 'opacuserlogin' ) == 1 || OpacNavRight) %]
-        <div class="span9">
+        <div class="span9 maincontent">
     [% ELSIF ( OpacNav ||  OpacNavBottom  ) %]
-        <div class="span10">
+        <div class="span10 maincontent">
     [% ELSE %]
-        <div class="span12">
+        <div class="span12 maincontent">
     [% END %]
-            [% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
+
+        [% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
+            [% UNLESS news_item %]
                 <form id="news-branch-select" class="form-inline" name="news-branch-select" method="get" action="/cgi-bin/koha/opac-main.pl">
-                <label for="news-branch">Display news for: </label>
-                <select id="news-branch" name="branch">
-                [% IF ( branchcode == "" ) %]
-                <option value="" selected="selected">system-wide only</option>
-                [% ELSE %]
-                <option value=""         >system-wide only</option>
-                [% END %]
-                [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
-                </select>
+                    <label for="news-branch">Display news for: </label>
+                    <select id="news-branch" name="branch">
+                        [% IF ( branchcode == "" ) %]
+                            <option value="" selected="selected">System-wide only</option>
+                        [% ELSE %]
+                            <option value="">System-wide only</option>
+                        [% END %]
+                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
+                    </select>
                 </form>
             [% END %]
+        [% END %]
 
         [% IF ( koha_news ) %]
 
 
             [% ELSE %]
 
-            <div id="news" class="newscontainer">
-                [% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %]
-                [% FOREACH koha_new IN koha_news %]
-                    <div class="newsitem">
-                        <a name="newsitem[% koha_new.idnew | html %]" href="/cgi-bin/koha/opac-main.pl?news_id=[% koha_new.idnew | uri %]"><h4 class="newsheader">[% koha_new.title | html %]</h4></a>
-                        <div class="newsbody">[% koha_new.content | $raw %]</div>
-                        <div class="newsfooter">(published on [% koha_new.timestamp | $KohaDates with_hours = 1 | html %][% IF ( (newsdisp == 'opac' || newsdisp == 'both') && koha_new.borrowernumber ) %] by <span class="newsauthor_title">[% koha_new.author_title | html %] </span>[% koha_new.author_firstname | html %] [% koha_new.author_surname | html %][% END %])</div>
-                    </div>
-                [% END %]
-            </div>
-
-            [% END %]
-
-            [% UNLESS news_item %] <!-- unless single news item -->
+                <div id="news" class="newscontainer">
+                    [% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %]
+                    [% FOREACH koha_new IN koha_news %]
+                        <div class="newsitem">
+                            <h4 class="newsheader">
+                                [% IF ( news_item ) %]
+                                    [% koha_new.title | html %]
+                                [% ELSE %]
+                                    <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>
+                                [% END %]
+                            </h4>
+                            <div class="newsbody">[% koha_new.content | $raw %]</div>
+                            <div class="newsfooter">
+                                Published on [% koha_new.timestamp | $KohaDates with_hours = 1 %]
+                                [% IF ( (newsdisp == 'opac' || newsdisp == 'both') && koha_new.borrowernumber ) %]
+                                    by <span class="newsauthor_title">[% koha_new.author_title | html %] </span>[% koha_new.author_firstname | html %] [% koha_new.author_surname | html %]
+                                [% END %]
+                                [% IF ( news_item ) %]
+                                    &bull; <a href="/cgi-bin/koha/opac-main.pl">Show all news</a>
+                                [% END %]
+                            </div>
+                        </div>
 
-            <div id="rssnews-container">
-                <!-- Logged in users have a branch code or it could be explicitly set -->
-                <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-news-rss.pl?branchcode=[% branchcode | uri %]"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png"></a>
-                [% IF Branches.all.size == 1 %]
-                    [% IF branchcode %]
-                        RSS feed for [% Branches.GetName( branchcode ) | html %] library news.
-                    [% ELSE %]
-                        RSS feed for library news.
                     [% END %]
-                [% ELSE %]
-                    [% IF branchcode %]
-                        RSS feed for [% Branches.GetName( branchcode ) | html %] and system-wide library news.
-                    [% ELSE %]
-                        RSS feed for system-wide library news.
+                    [% UNLESS news_item %]
+                        <div id="rssnews-container">
+                            <!-- Logged in users have a branch code or it could be explicitly set -->
+                            <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-news-rss.pl?branchcode=[% branchcode | uri %]">
+                                <i class="fa fa-rss" aria-hidden="true"></i>
+                                [% IF Branches.all.size == 1 %]
+                                    [% IF branchcode %]
+                                        RSS feed for [% Branches.GetName( branchcode ) | html %] library news
+                                    [% ELSE %]
+                                        RSS feed for library news
+                                    [% END %]
+                                [% ELSE %]
+                                    [% IF branchcode %]
+                                        RSS feed for [% Branches.GetName( branchcode ) | html %] and system-wide library news
+                                    [% ELSE %]
+                                        RSS feed for system-wide library news
+                                    [% END %]
+                                [% END %]
+                            </a>
+                        </div>
                     [% END %]
-                [% END %]
-            </div>
+                </div>
 
-            [% END %] <!-- single news item -->
+            [% END # /IF single_news_error %]
 
         [% ELSE %] <!-- koha news -->
             [% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
                 </div>
             [% END %]
 
-            [% IF ( display_daily_quote && daily_quote ) %]
+        [% END # IF koha_news %]
+
+        [% UNLESS news_item # Don't show under single news item %]
+            [% IF ( daily_quote ) %]
                 <div id="daily-quote">
                     <h3>Quote of the day</h3>
                     <div>
                 </div>
             [% END %]
 
-            [% IF ( OpacMainUserBlock ) %]<div id="opacmainuserblock">[% OpacMainUserBlock | $raw %]</div>[% END %]
+            [% IF ( OpacMainUserBlock ) %]
+                <div id="opacmainuserblock">
+                    [% PROCESS koha_news_block news => OpacMainUserBlock %]
+                </div>
+            [% END %]
+        [% END %]
 
-        [% END %] <!-- koha news -->
         </div> <!-- / .span 7/9 -->
 
         [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) || OpacNavRight ) %]
                                         <fieldset class="action">
                                             <input type="submit" value="Log in" class="btn" />
                                         </fieldset>
-                                        [% IF Koha.Preference( 'OpacLoginInstructions' ) %]
+                                        [% IF ( OpacLoginInstructions ) %]
                                             <div id="nologininstructions-main" class="nologininstructions">
-                                                [% Koha.Preference( 'OpacLoginInstructions' ) | $raw %]
+                                                [% PROCESS koha_news_block news => OpacLoginInstructions %]
                                             </div>
                                         [% END %]
-                                        [% IF Koha.Preference('OpacPasswordChange') && Koha.Preference('OpacResetPassword') %]
+                                        [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
                                             <div id="forgotpassword-main" class="forgotpassword">
                                                 <p><a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a></p>
                                             </div>
                         [% END %]
                     [% END # /loggedinusername %]
                 [% END # /opacuserlogin %]
-                [% IF ( OpacNavRight ) %]
-                    <div id="opacnavright">
-                        [% OpacNavRight | $raw %]
-                    </div>
-                [% END # /OpacNavRight %]
+                [% PROCESS koha_news_block news => OpacNavRight %]
             </div> <!-- / .span3 -->
         [% END # /opacuserlogin || OpacNavRight %]