From 24eb1ba4258e5c5f0e5f45a6ec2345888212d16c Mon Sep 17 00:00:00 2001
From: Aleisha Amohia <aleishaamohia@hotmail.com>
Date: Tue, 14 Feb 2017 01:12:43 +0000
Subject: [PATCH] Bug 14854: Add DataTables on upload results table
Content-Type: text/plain; charset=utf-8

This patch adds datatables to the upload results table.
Tools -> Upload

To test:
1) Go to Tools -> Upload
2) Put any search term in search box, click Search
3) Confirm table shows as datatable and sorting works on all columns
EXCEPT Actions

Sponsored-by: Catalyst IT

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
---
 koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt
index 45c6b79..5b61b6b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt
@@ -6,6 +6,7 @@
     <title>Koha &rsaquo; Tools &rsaquo; Upload</title>
 [% END %]
 [% INCLUDE 'doc-head-close.inc' %]
+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
 
 [% BLOCK plugin_pars %]
     [% IF plugin %]
@@ -147,7 +148,7 @@
 [% END %]
 
 [% BLOCK table_results %]
-    <table>
+    <table id="uploadresults">
     <thead>
     <tr>
         <th>Filename</th>
@@ -156,7 +157,7 @@
         <th>Category</th>
         [% IF !plugin %]<th>Public</th>[% END %]
         [% IF !plugin %]<th>Temporary</th>[% END %]
-        <th>Actions</th>
+        <th class="nosort">Actions</th>
     </tr>
     </thead>
     <tbody>
@@ -185,6 +186,7 @@
    </table>
 [% END %]
 
+[% INCLUDE 'datatables.inc' %]
 <style type="text/css">
     #fileuploadstatus,#fileuploadfailed { display : none; }
     #fileuploadstatus { margin:.4em; }
@@ -304,6 +306,12 @@ function Choose(hashval) {
     window.close();
 }
 $(document).ready(function() {
+    $("#uploadresults").dataTable($.extend(true, {}, dataTablesDefaults, {
+        "aoColumnDefs": [
+            { 'bSortable': false, 'aTargets': [ 'nosort' ] }
+        ],
+        "sPaginationType": "four_button"
+    }));
     [% IF msg %]
         ShowAlerts( [% msg %] );
     [% END %]
-- 
2.1.4