From 3b0345ae95de995b91ec5c793bf982ab7c1570d6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 27 Jan 2014 12:22:21 +0100 Subject: [PATCH] Bug 11616: tablesorter is no longer in use DataTables has replaced the tablesorter plugin to sort tables into Koha. There is no table using this plugin and all references could be removed. Test plan: - Verify there is no regression on the circ/bookcount.pl tables and that git grep tablesorter does no return any use of this plugin. --- .../lib/jquery/plugins/jquery.tablesorter.min.js | 2 - .../lib/jquery/plugins/jquery.tablesorter.pager.js | 184 -------------------- .../prog/en/modules/admin/authorised_values.tt | 2 +- .../prog/en/modules/circ/bookcount.tt | 2 - .../lib/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 64c7007..0000000 --- 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 afdd882..e0a22e6 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 cabb45c..725ca4b 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 64c7007..0000000 --- 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($('