Bug 10807: Add an authority search history for the OPAC - bootstrap
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 19 Dec 2013 14:22:02 +0000 (15:22 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 5 May 2014 02:37:57 +0000 (02:37 +0000)
Patch for the bootstrap theme

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt

index 1edc244..07703d5 100644 (file)
@@ -77,7 +77,7 @@
                                     <li><p class="members navbar-text">Welcome, <a href="/cgi-bin/koha/opac-user.pl"><span class="loggedinusername">[% FOREACH USER_INF IN USER_INFO %][% USER_INF.title %] [% USER_INF.firstname %] [% USER_INF.surname %][% END %]</span></a></p></li>
                                     <li class="divider-vertical"></li>
                                 [% END %]
-                                [% IF ( ShowOpacRecentSearchLink ) %]
+                                [% IF EnableOpacSearchHistory %]
                                     <li><p class="navbar-text"><a href="/cgi-bin/koha/opac-search-history.pl" title="View your search history">Search history</a> [<a class="logout" href="/cgi-bin/koha/opac-search-history.pl?action=delete" title="Delete your search history" onclick="return confirm(MSG_DELETE_SEARCH_HISTORY);">x</a>]</p></li>
                                     <li class="divider-vertical"></li>
                                 [% END %]
                 <a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Cancel</a>
             </div>
         </form> <!-- /#auth -->
-    </div>  <!-- /#modalAuth  -->
\ No newline at end of file
+    </div>  <!-- /#modalAuth  -->
index f1185d3..182543b 100644 (file)
@@ -41,7 +41,7 @@
                 <a href="/cgi-bin/koha/opac-passwd.pl">change your password</a></li>
             [% END %]
 
-            [% IF ( ShowOpacRecentSearchLink ) %]
+            [% IF EnableOpacSearchHistory %]
                 [% IF ( searchhistoryview ) %]
                     <li class="active">
                 [% ELSE %]
index d833346..4e44705 100644 (file)
             [% ELSE %]
                 <div class="span12">
             [% END %]
-
                 <div id="searchhistory" class="maincontent">
                     <h1>Search history</h1>
-                        [% IF ( recentSearches ) %]<form action="/cgi-bin/koha/opac-search-history.pl" method="get"><input type="hidden" name="action" value="delete" /><input type="submit" class="btn btn-danger" value="Delete your search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" /></form>[% ELSE %][% IF ( previousSearches ) %]<form action="/cgi-bin/koha/opac-search-history.pl" method="get"><input type="hidden" name="action" value="delete" /><input type="submit" class="btn btn-danger" value="Delete your search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" /></form>[% END %][% END %]
 
-                        [% IF ( recentSearches ) %]
-                            <table class="historyt table table-bordered table-condensed table-striped">
-                            [% IF ( previousSearches ) %]
-                                <caption>Current session</caption>
+                    [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
+                      <div id="tabs" class="toptabs">
+                        <ul>
+                          <li><a href="#biblio_tab">Catalog</a></li>
+                          <li><a href="#authority_tab">Authority</a></li>
+                        </ul>
+                    [% END %]
+                      <div id="biblio_tab">
+                        [% IF ( current_biblio_searches ) %]
+                          <h2>Current session</h2>
+                          <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
+                            <input type="hidden" name="action" value="delete" />
+                            <input type="hidden" name="previous" value="0" />
+                            <input type="hidden" name="type" value="biblio" />
+                            <input type="submit" class="deleteshelf" value="Delete your current catalog history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
+                          </form>
+                          <table class="historyt table table-bordered table-condensed table-striped">
+                            <thead>
+                              <tr>
+                                <th>Date</th>
+                                <th>Search</th>
+                                <th>Results</th>
+                              </tr>
+                            </thead>
+                            <tbody>
+                            [% FOREACH s IN current_biblio_searches %]
+                              <tr>
+                                <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
+                                <td><a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
+                                <td>[% s.total %]</td>
+                              </tr>
                             [% END %]
-                                <thead>
-                                    <tr><th>Date</th><th>Search</th><th>Results</th></tr>
-                                </thead>
-                                <tbody>
-                                [% FOREACH recentSearche IN recentSearches %]
-                                    <tr>
-                                        <td><span title="[% recentSearche.time %]">[% recentSearche.time |$KohaDates with_hours => 1 %]</span></td>
-                                        <td><a href="/cgi-bin/koha/opac-search.pl?[% recentSearche.query_cgi |html %]">[% recentSearche.query_desc |html %]</a></td>
-                                        <td>[% recentSearche.total %]</td>
-                                    </tr>
-                                [% END %]
-                                </tbody>
-                            </table>
+                            </tbody>
+                          </table>
                         [% END %]
 
-                        [% IF ( previousSearches ) %]
-                        <table class="historyt table table-bordered table-condensed table-striped">
-                            <caption>Previous sessions</caption>
+                        [% IF ( previous_biblio_searches ) %]
+                          <h2>Previous sessions</h2>
+                          <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
+                            <input type="hidden" name="action" value="delete" />
+                            <input type="hidden" name="previous" value="1" />
+                            <input type="hidden" name="type" value="biblio" />
+                            <input type="submit" class="deleteshelf" value="Delete your previous catalog search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
+                          </form>
+                          <table class="historyt table table-bordered table-condensed table-striped">
                             <thead>
-                                <tr><th>Date</th><th>Search</th><th>Results</th></tr>
+                              <tr>
+                                <th>Date</th>
+                                <th>Search</th>
+                                <th>Results</th>
+                              </tr>
                             </thead>
                             <tbody>
-                                [% FOREACH previousSearche IN previousSearches %]
-                                    <tr>
-                                        <td><span title="[% previousSearche.time %]">[% previousSearche.time |$KohaDates with_hours => 1 %]</span></td>
-                                        <td><a href="/cgi-bin/koha/opac-search.pl?[% previousSearche.query_cgi |html %]">[% previousSearche.query_desc |html %]</a></td>
-                                        <td>[% previousSearche.total %]</td>
-                                    </tr>
-                                [% END %]
+                            [% FOREACH s IN previous_biblio_searches %]
+                              <tr>
+                                <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
+                                <td><a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
+                                <td>[% s.total %]</td>
+                              </tr>
+                            [% END %]
                             </tbody>
-                        </table>
+                          </table>
                         [% END %]
 
-                        [% UNLESS ( recentSearches ) %]
-                           [% UNLESS ( previousSearches ) %]
-                                <p>Your search history is empty.</p>
+                        [% IF !current_biblio_searches && !previous_biblio_searches %]
+                          <p>Your catalog search history is empty.</p>
+                        [% END %]
+                      </div>
+
+
+                    [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
+                      <div id="authority_tab">
+                        [% IF ( current_authority_searches ) %]
+                          <h2>Current session</h2>
+                          <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
+                            <input type="hidden" name="action" value="delete" />
+                            <input type="hidden" name="previous" value="0" />
+                            <input type="hidden" name="type" value="authority" />
+                            <input type="submit" class="deleteshelf" value="Delete your current authority search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
+                          </form>
+                          <table class="historyt table table-bordered table-condensed table-striped">
+                            <thead>
+                              <tr>
+                                <th>Date</th>
+                                <th>Search</th>
+                                <th>Results</th>
+                              </tr>
+                            </thead>
+                            <tbody>
+                            [% FOREACH s IN current_authority_searches %]
+                              <tr>
+                                <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
+                                <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
+                                <td>[% s.total %]</td>
+                              </tr>
                             [% END %]
+                            </tbody>
+                          </table>
                         [% END %]
-                     </div>
+
+                        [% IF ( previous_authority_searches ) %]
+                          <h2>Previous sessions</h2>
+                          <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
+                            <input type="hidden" name="action" value="delete" />
+                            <input type="hidden" name="previous" value="1" />
+                            <input type="hidden" name="type" value="authority" />
+                            <input type="submit" class="deleteshelf" value="Delete your previous authority search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" />
+                          </form>
+                          <table class="historyt table table-bordered table-condensed table-striped">
+                            <thead>
+                              <tr>
+                                <th>Date</th>
+                                <th>Search</th>
+                                <th>Results</th>
+                              </tr>
+                            </thead>
+                            <tbody>
+                            [% FOREACH s IN previous_authority_searches %]
+                              <tr>
+                                <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
+                                <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
+                                <td>[% s.total %]</td>
+                              </tr>
+                            [% END %]
+                            </tbody>
+                          </table>
+                        [% END %]
+
+                        [% IF !current_authority_searches && !previous_authority_searches %]
+                          <p>Your authority search history is empty.</p>
+                        [% END %]
+                      </div>
+                    </div>
+                    [% END %]
+                    </div>
                 </div>
             </div>
         </div>
                 ]
             }));
         });
+
+    [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]$('#tabs').tabs();[% END %]
 //]]>
 
 </script>