From e22886b1a2c2488a5e3ba3e59e81d97ff8f90287 Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Wed, 23 Jan 2013 12:25:39 -0500
Subject: [PATCH] Bug 9463 - Use DataTables on patron sent notices page
Content-Type: text/plain; charset="utf-8"

Replace the tablesorter plugin with the DataTables plugin on the
patron sent notices page.

This patch adds default sorting by time (descending).

To test, open the sent notices page for a patron who has multiple sent
notices. Confirm that table sorting works correctly.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
---
 .../prog/en/modules/members/notices.tt             |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt
index 59848c2..96c52d7 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt
@@ -1,15 +1,19 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Sent notices for [% INCLUDE 'patron-title.inc' %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
+[% INCLUDE 'datatables-strings.inc' %]
+<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
 <script type="text/javascript">
 //<![CDATA[
     $(document).ready(function() {
-	$("#noticestable").tablesorter({
-	    [% IF ( dateformat == 'metric' ) %]
-		dateFormat: 'uk'
-	    [% END %]
-	});
+    $("#noticestable").dataTable($.extend(true, {}, dataTablesDefaults, {
+        "aaSorting": [[ 3, "desc" ]],
+        "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
+        "iDisplayLength": 20,
+        "sPaginationType": "four_button"
+    }));
 
     $(".message").hide();
     $(".message-title").click(function(e){
-- 
1.7.9.5