Bug 13234: On-site checkouts - OPAC
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 12 Nov 2014 10:52:46 +0000 (11:52 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 19 Nov 2014 14:33:31 +0000 (11:33 -0300)
This patch introduces the code lost in bug 10860 for the OPAC side.

Test plan:
Go on opac-readingrecord.pl and verify the tabs work as expected and the
"show all items" and "show 50 items" links.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt
opac/opac-readingrecord.pl

index e23fb91..9a57af8 100644 (file)
@@ -31,7 +31,7 @@
                     [% IF READING_RECORD.size == 0 %]
                         You have never borrowed anything from this library.
                     [% ELSE %]
-                        <div id="opac-user-readingrec" class="statictabs">
+                        <div id="opac-user-readingrec" class="statictabs2">
                             <div class="resultscontrol resort">
                                 <form id="sortform" action="/cgi-bin/koha/opac-readingrecord.pl" method="get">
                                     [% UNLESS ( limit ) %]<input type="hidden" name="limit" value="full" />[% END %]
                                 </form>
                             </div>
 
-                            <ul>
-                                [% IF ( showfulllink ) %]
-                                    [% IF ( limit ) %]
-                                        <li><a href="/cgi-bin/koha/opac-readingrecord.pl?limit=full[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Show all items</a></li><li class="active"><a href="#readingrec">Showing last 50 items</a></li>
-                                    [% ELSE %]
-                                        <li class="active"><a href="/cgi-bin/koha/opac-readingrecord.pl#readingrec">Showing all items</a></li><li><a href="/cgi-bin/koha/opac-readingrecord.pl?limit=50[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Show last 50 items only</a></li>
-                                    [% END %]
-                                [% ELSE %]
-                                    <li class="active"><a href="/cgi-bin/koha/opac-readingrecord.pl#readingrec">Showing all items</a></li>
-                                [% END %]
-                            </ul>
-
-                            <div class="tabs-container">
-                                <table id="readingrec" class="table table-bordered table-striped">
-                                    <tr>
-                                    <th colspan="2">Title</th>
-                                    <th>Item type</th>
-                                    <th>Call no.</th>
-                                    <th>Date</th>
-                                    [% IF ( OPACMySummaryHTML ) %]
-                                    <th>Links</th>
-                                    [% END %]
-                                    </tr>
+                            [% IF limit %]
+                                <a href="/cgi-bin/koha/opac-readingrecord.pl?limit=full[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Show all items</a>
+                            [% ELSE %]
+                                <a href="/cgi-bin/koha/opac-readingrecord.pl?limit=50[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Showing last 50 items</a>
+                            [% END %]
 
+                            <div id="tabs" class="toptabs">
+                                <ul>
+                                    <li><a href="#tabs-container" id="tab_all">All</a></li>
+                                    <li><a href="#tabs-container" id="tab_checkout">Checkouts</a></li>
+                                    <li><a href="#tabs-container" id="tab_onsite_checkout">On-site checkouts</a></li>
+                                </ul>
+                                <div id="tabs-container" style="overflow:hidden">
+                                    <table id="readingrec" class="table table-bordered table-striped">
+                                        <thead>
+                                            <tr>
+                                                <th style="display:none;">Type</th>
+                                                <th></th>
+                                                <th>Title</th>
+                                                <th>Item type</th>
+                                                <th>Call no.</th>
+                                                <th>Date</th>
+                                                [% IF ( OPACMySummaryHTML ) %]
+                                                    <th>Links</th>
+                                                [% END %]
+                                            </tr>
+                                        </thead>
+                                        <tbody>
                                     [% FOREACH issue IN READING_RECORD %]
-                                        [% IF loop.even  %]<tr class="highlight">[% ELSE %]<tr>[% END %]
+                                        <tr>
+                                            <td style="display:none;">
+                                              [% IF issue.onsite_checkout %]
+                                                onsite
+                                              [% ELSE %]
+                                                checkout
+                                              [% END %]
+                                            </td>
                                         <td>
                                             [% IF  OPACAmazonCoverImages %]
                                                 [% IF  issue.normalized_isbn %]
                                                 <img src="http://www.syndetics.com/index.aspx?isbn=[% issue.normalized_isbn %]/SC.GIF&amp;client=[% SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% issue.normalized_upc %]&amp;oclc=[% issue.normalized_oclc %]" alt="" class="item-thumbnail" />
                                            [% END %]
                                         [% END %]
-                                    </td>
-                                    <td>
+                                        </td>
+                                        <td>
                                         [% IF  issue.BiblioDefaultViewmarc %]
                                              <a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% issue.biblionumber |url %]">[% issue.title |html %] [% IF  issue.subtitle  %][% FOREACH subtitl IN issue.subtitle %][% subtitl.subfield %][% END %][% END %]</a>
                                         [% ELSIF issue.BiblioDefaultViewisbd %]
                                              <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% issue.biblionumber |url %]">[% issue.title |html %] [% IF issue.subtitle %][% FOREACH subtitl IN issue.subtitle %][% subtitl.subfield %][% END %][% END %]</a>
                                         [% END %]
                                         <span class="item-details">[% issue.author %]</span>
-                                    </td>
-                                    <td>
+                                        </td>
+                                        <td>
                                         [% UNLESS ( noItemTypeImages ) %]
                                             [% IF ( issue.imageurl ) %]
                                                 <img src="[% issue.imageurl %]" alt="" />
                                         [% END %]
                                         <span class="tdlabel">Item type:</span>
                                         [% issue.description %]</td>
-                                    <td>
+                                        <td>
                                         <span class="tdlabel">Call number:</span>
                                         [% issue.itemcallnumber %]
-                                    </td>
-                                    <td>
+                                        </td>
+                                        <td>
                                         [% IF issue.returndate %]
                                             <span class="tdlabel">Check-in date:</span>
                                             [% issue.returndate | $KohaDates %]
                                         [% ELSE %]
                                             <em>(Checked out)</em>
                                         [% END %]
-                                    </td>
-                                    [% IF OPACMySummaryHTML %]
-                                        <td>[% issue.MySummaryHTML %]</td>
+                                        </td>
+                                        [% IF OPACMySummaryHTML %]
+                                            <td>[% issue.MySummaryHTML %]</td>
+                                        [% END %]
+                                        </tr>
                                     [% END %]
-                                    </tr>
-                                [% END %]
+                                </tbody>
                             </table>
                         </div> <!-- / .tabs-container -->
                     </div> <!-- / .opac-user-readingrec -->
 
 [% INCLUDE 'opac-bottom.inc' %]
 [% BLOCK jsinclude %]
+[% INCLUDE 'datatables.inc' %]
 <script type="text/javascript">
 //<![CDATA[
     $(document).ready(function(){
         $('#order').change(function() {
             $('#sortform').submit();
         });
+
+        var table = $("#readingrec").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "sPaginationType": "four_button",
+        }));
+        var tabs = $("#tabs").tabs({
+            select: function(e, ui) {
+                var id = $(ui.tab).attr("id");
+                if ( id == "tab_checkout" ) {
+                    table.fnFilter("checkout", 0);
+                } else if ( id == "tab_onsite_checkout" ) {
+                    table.fnFilter("onsite", 0);
+                } else { // all
+                    table.fnFilter('', 0);
+                }
+            }
+        });
     });
 //]]>
 </script>
index 6d9e2fc..6e38cfd 100755 (executable)
@@ -139,7 +139,6 @@ for(qw(AmazonCoverImages GoogleJackets)) {  # BakerTaylorEnabled handled above
 $template->param(
     READING_RECORD => $issues,
     limit          => $limit,
-    showfulllink   => 1,
     readingrecview => 1,
     OPACMySummaryHTML => $opac_summary_html ? 1 : 0,
 );