Browse Source

Bug 11616: remove jQuery tablesorter plugin

DataTables has replaced the tablesorter plugin for client-side sorting
of tables in Koha.  There is no table using this plugin, so this patch
removes it and remaining references to it.

REVISED TEST PLAN
-----------------
1) Apply the patch
2) Home -> Koha administration -> Authorized values
3) Change the 'Show category:' drop down value, and play with
    the sorting of columns.
   -- should sort as expected.
4) Search the catalogue -> look for a biblio with high circulation
5) Click one of the name links.
6) Click the Items tab on the left.
7) Scroll down and click the (View item's checkout history)
    link in the History area.
   -- There was no sorting prior to the patch, so afterwards
      it should display the same.
8) git grep -i tablesorter
   -- Only a reference in staff-global.css and release texts.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
3.16.x
Jonathan Druart 10 years ago
committed by Galen Charlton
parent
commit
166720982e
  1. 2
      koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.tablesorter.min.js
  2. 184
      koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.tablesorter.pager.js
  3. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt
  4. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt
  5. 2
      koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.tablesorter.min.js

2
koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.tablesorter.min.js

File diff suppressed because one or more lines are too long

184
koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.tablesorter.pager.js

@ -1,184 +0,0 @@
(function($) {
$.extend({
tablesorterPager: new function() {
function updatePageDisplay(c) {
var s = $(c.cssPageDisplay,c.container).val((c.page+1) + c.seperator + c.totalPages);
}
function setPageSize(table,size) {
var c = table.config;
c.size = size;
c.totalPages = Math.ceil(c.totalRows / c.size);
c.pagerPositionSet = false;
moveToPage(table);
fixPosition(table);
}
function fixPosition(table) {
var c = table.config;
if(!c.pagerPositionSet && c.positionFixed) {
var c = table.config, o = $(table);
if(o.offset) {
c.container.css({
top: o.offset().top + o.height() + 'px',
position: 'absolute'
});
}
c.pagerPositionSet = true;
}
}
function moveToFirstPage(table) {
var c = table.config;
c.page = 0;
moveToPage(table);
}
function moveToLastPage(table) {
var c = table.config;
c.page = (c.totalPages-1);
moveToPage(table);
}
function moveToNextPage(table) {
var c = table.config;
c.page++;
if(c.page >= (c.totalPages-1)) {
c.page = (c.totalPages-1);
}
moveToPage(table);
}
function moveToPrevPage(table) {
var c = table.config;
c.page--;
if(c.page <= 0) {
c.page = 0;
}
moveToPage(table);
}
function moveToPage(table) {
var c = table.config;
if(c.page < 0 || c.page > (c.totalPages-1)) {
c.page = 0;
}
renderTable(table,c.rowsCopy);
}
function renderTable(table,rows) {
var c = table.config;
var l = rows.length;
var s = (c.page * c.size);
var e = (s + c.size);
if(e > rows.length ) {
e = rows.length;
}
var tableBody = $(table.tBodies[0]);
// clear the table body
$.tablesorter.clearTableBody(table);
for(var i = s; i < e; i++) {
//tableBody.append(rows[i]);
var o = rows[i];
var l = o.length;
for(var j=0; j < l; j++) {
tableBody[0].appendChild(o[j]);
}
}
fixPosition(table,tableBody);
$(table).trigger("applyWidgets");
if( c.page >= c.totalPages ) {
moveToLastPage(table);
}
updatePageDisplay(c);
}
this.appender = function(table,rows) {
var c = table.config;
c.rowsCopy = rows;
c.totalRows = rows.length;
c.totalPages = Math.ceil(c.totalRows / c.size);
renderTable(table,rows);
};
this.defaults = {
size: 10,
offset: 0,
page: 0,
totalRows: 0,
totalPages: 0,
container: null,
cssNext: '.next',
cssPrev: '.prev',
cssFirst: '.first',
cssLast: '.last',
cssPageDisplay: '.pagedisplay',
cssPageSize: '.pagesize',
seperator: "/",
positionFixed: true,
appender: this.appender
};
this.construct = function(settings) {
return this.each(function() {
config = $.extend(this.config, $.tablesorterPager.defaults, settings);
var table = this, pager = config.container;
$(this).trigger("appendCache");
config.size = parseInt($(".pagesize",pager).val());
$(config.cssFirst,pager).click(function() {
moveToFirstPage(table);
return false;
});
$(config.cssNext,pager).click(function() {
moveToNextPage(table);
return false;
});
$(config.cssPrev,pager).click(function() {
moveToPrevPage(table);
return false;
});
$(config.cssLast,pager).click(function() {
moveToLastPage(table);
return false;
});
$(config.cssPageSize,pager).change(function() {
setPageSize(table,parseInt($(this).val()));
return false;
});
});
};
}
});
// extend plugin scope
$.fn.extend({
tablesorterPager: $.tablesorterPager.construct
});
})(jQuery);

2
koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt

@ -239,7 +239,7 @@ $(document).ready(function() {
[% IF ( loop ) %]<div id="pagertable_authorized_values">
</div>[% END %]
[% IF ( loop ) %]<table id="table_authorized_values" class="tablesorter">
[% IF ( loop ) %]<table id="table_authorized_values">
<thead><tr>
<th>Authorized value</th>
<th>Description</th>

2
koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt

@ -47,8 +47,6 @@ $(document).ready(function(){
<td>[% branchloo.branchname %]</td>
<td>[% branchloo.issues %]</td>
<td>[% IF ( branchloo.seen ) %]
<span style="display:none;">[% branchloo.seen %][% branchloo.seentime %]</span>
<!-- invisible span for eventual use by tablesorter -->
[% branchloo.seen %] [% branchloo.seentime %]
[% ELSE %]
<span>Never</span>

2
koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.tablesorter.min.js

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save