From 166720982e59a929aac9191d89af57a57545ff15 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 27 Jan 2014 12:22:21 +0100 Subject: [PATCH] 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 Signed-off-by: Marcel de Rooy Signed-off-by: Galen Charlton --- .../jquery/plugins/jquery.tablesorter.min.js | 2 - .../plugins/jquery.tablesorter.pager.js | 184 ------------------ .../en/modules/admin/authorised_values.tt | 2 +- .../prog/en/modules/circ/bookcount.tt | 2 - .../jquery/plugins/jquery.tablesorter.min.js | 2 - 5 files changed, 1 insertion(+), 191 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.tablesorter.min.js delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.tablesorter.pager.js delete mode 100644 koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.tablesorter.min.js diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.tablesorter.min.js b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.tablesorter.min.js deleted file mode 100644 index 64c7007129..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.tablesorter.min.js +++ /dev/null @@ -1,2 +0,0 @@ - -(function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'.',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}var rows=table.tBodies[0].rows;if(table.tBodies[0].rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;ib)?1:0));};function sortTextDesc(a,b){return((ba)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){$this.trigger("sortStart");var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){var $cell=$(this);var i=this.column;this.order=this.count++%2;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i= (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); \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt index afdd88292d..e0a22e6718 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt @@ -239,7 +239,7 @@ $(document).ready(function() { [% IF ( loop ) %]
[% END %] -[% IF ( loop ) %] +[% IF ( loop ) %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt index cabb45c648..725ca4b6c0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt @@ -47,8 +47,6 @@ $(document).ready(function(){ ').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;ib)?1:0));};function sortTextDesc(a,b){return((ba)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){$this.trigger("sortStart");var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){var $cell=$(this);var i=this.column;this.order=this.count++%2;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i
Authorized value Description[% branchloo.branchname %] [% branchloo.issues %] [% IF ( branchloo.seen ) %] - [% branchloo.seen %][% branchloo.seentime %] - [% branchloo.seen %] [% branchloo.seentime %] [% ELSE %] Never diff --git a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.tablesorter.min.js b/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.tablesorter.min.js deleted file mode 100644 index 64c7007129..0000000000 --- a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.tablesorter.min.js +++ /dev/null @@ -1,2 +0,0 @@ - -(function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'.',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}var rows=table.tBodies[0].rows;if(table.tBodies[0].rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('