From 8298250c49b6af3f88415e1daee748d4cd1574eb Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 8 Jul 2011 14:29:19 +0200 Subject: [PATCH] Bug 6836: Add jQuery dataTables plugin This patch add the javascript library, a CSS (and image files from datatables.net) and another javascript file which provides some extra features. It also add a Perl module C4::Utils::Datatables which provides helpful functions for server-side processing Signed-off-by: Chris Cormack Signed-off-by: Katrin Fischer --- C4/Utils/DataTables.pm | 307 ++++++++++++++++++ .../intranet-tmpl/prog/en/css/datatables.css | 114 +++++++ .../prog/en/includes/datatables-strings.inc | 17 + .../intranet-tmpl/prog/en/js/datatables.js | 281 ++++++++++++++++ .../jquery/plugins/jquery.dataTables.min.js | 153 +++++++++ .../prog/img/datatables/back_disabled.jpg | Bin 0 -> 612 bytes .../prog/img/datatables/back_enabled.jpg | Bin 0 -> 807 bytes .../prog/img/datatables/forward_disabled.jpg | Bin 0 -> 635 bytes .../prog/img/datatables/forward_enabled.jpg | Bin 0 -> 852 bytes .../prog/img/datatables/sort_asc.png | Bin 0 -> 263 bytes .../prog/img/datatables/sort_asc_disabled.png | Bin 0 -> 252 bytes .../prog/img/datatables/sort_both.png | Bin 0 -> 282 bytes .../prog/img/datatables/sort_desc.png | Bin 0 -> 260 bytes .../img/datatables/sort_desc_disabled.png | Bin 0 -> 251 bytes .../opac-tmpl/prog/en/css/datatables.css | 114 +++++++ .../prog/en/includes/datatables-strings.inc | 17 + koha-tmpl/opac-tmpl/prog/en/js/datatables.js | 281 ++++++++++++++++ .../jquery/plugins/jquery.dataTables.min.js | 153 +++++++++ .../prog/images/datatables/back_disabled.jpg | Bin 0 -> 612 bytes .../prog/images/datatables/back_enabled.jpg | Bin 0 -> 807 bytes .../images/datatables/forward_disabled.jpg | Bin 0 -> 635 bytes .../images/datatables/forward_enabled.jpg | Bin 0 -> 852 bytes .../prog/images/datatables/sort_asc.png | Bin 0 -> 263 bytes .../images/datatables/sort_asc_disabled.png | Bin 0 -> 252 bytes .../prog/images/datatables/sort_both.png | Bin 0 -> 282 bytes .../prog/images/datatables/sort_desc.png | Bin 0 -> 260 bytes .../images/datatables/sort_desc_disabled.png | Bin 0 -> 251 bytes 27 files changed, 1437 insertions(+) create mode 100644 C4/Utils/DataTables.pm create mode 100644 koha-tmpl/intranet-tmpl/prog/en/css/datatables.css create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/datatables-strings.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/datatables.js create mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js create mode 100644 koha-tmpl/intranet-tmpl/prog/img/datatables/back_disabled.jpg create mode 100644 koha-tmpl/intranet-tmpl/prog/img/datatables/back_enabled.jpg create mode 100644 koha-tmpl/intranet-tmpl/prog/img/datatables/forward_disabled.jpg create mode 100644 koha-tmpl/intranet-tmpl/prog/img/datatables/forward_enabled.jpg create mode 100644 koha-tmpl/intranet-tmpl/prog/img/datatables/sort_asc.png create mode 100644 koha-tmpl/intranet-tmpl/prog/img/datatables/sort_asc_disabled.png create mode 100644 koha-tmpl/intranet-tmpl/prog/img/datatables/sort_both.png create mode 100644 koha-tmpl/intranet-tmpl/prog/img/datatables/sort_desc.png create mode 100644 koha-tmpl/intranet-tmpl/prog/img/datatables/sort_desc_disabled.png create mode 100644 koha-tmpl/opac-tmpl/prog/en/css/datatables.css create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/datatables-strings.inc create mode 100644 koha-tmpl/opac-tmpl/prog/en/js/datatables.js create mode 100644 koha-tmpl/opac-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js create mode 100644 koha-tmpl/opac-tmpl/prog/images/datatables/back_disabled.jpg create mode 100644 koha-tmpl/opac-tmpl/prog/images/datatables/back_enabled.jpg create mode 100644 koha-tmpl/opac-tmpl/prog/images/datatables/forward_disabled.jpg create mode 100644 koha-tmpl/opac-tmpl/prog/images/datatables/forward_enabled.jpg create mode 100644 koha-tmpl/opac-tmpl/prog/images/datatables/sort_asc.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/datatables/sort_asc_disabled.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/datatables/sort_both.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/datatables/sort_desc.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/datatables/sort_desc_disabled.png diff --git a/C4/Utils/DataTables.pm b/C4/Utils/DataTables.pm new file mode 100644 index 0000000000..23656004ba --- /dev/null +++ b/C4/Utils/DataTables.pm @@ -0,0 +1,307 @@ +package C4::Utils::DataTables; + +# Copyright 2011 BibLibre +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; +require Exporter; + +use vars qw($VERSION @ISA @EXPORT); + +BEGIN { + $VERSION = 3.04, + + @ISA = qw(Exporter); + @EXPORT = qw(dt_build_orderby dt_build_having dt_get_params dt_build_query); +} + +=head1 NAME + +C4::Utils::DataTables - Utility subs for building query when DataTables source is AJAX + +=head1 SYNOPSYS + + use CGI; + use C4::Context; + use C4::Utils::DataTables; + + my $input = new CGI; + my $vars = $input->Vars; + + my $query = qq{ + SELECT surname, firstname + FROM borrowers + WHERE borrowernumber = ? + }; + my ($having, $having_params) = dt_build_having($vars); + $query .= $having; + $query .= dt_build_orderby($vars); + $query .= " LIMIT ?,? "; + + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare($query); + $sth->execute( + $vars->{'borrowernumber'}, + @$having_params, + $vars->{'iDisplayStart'}, + $vars->{'iDisplayLength'} + ); + ... + +=head1 DESCRIPTION + + This module provide two utility functions to build a part of the SQL query, + depending on DataTables parameters. + One function build the 'ORDER BY' part, and the other the 'HAVING' part. + +=head1 FUNCTIONS + +=over 2 + +=item dt_build_orderby + + my $orderby = dt_build_orderby($dt_param); + + This function takes a reference to a hash containing DataTables parameters + and build the corresponding 'ORDER BY' clause. + This hash must contains the following keys: + + iSortCol_N, where N is a number from 0 to the number of columns to sort on minus 1 + + sSortDir_N is the sorting order ('asc' or 'desc) for the corresponding column + + mDataProp_N is a mapping between the column index, and the name of a SQL field + +=cut + +sub dt_build_orderby { + my $param = shift; + + my $i = 0; + my $orderby; + my @orderbys; + while(exists $param->{'iSortCol_'.$i}){ + my $iSortCol = $param->{'iSortCol_'.$i}; + my $sSortDir = $param->{'sSortDir_'.$i}; + my $mDataProp = $param->{'mDataProp_'.$iSortCol}; + my @sort_fields = $param->{$mDataProp.'_sorton'} + ? split(' ', $param->{$mDataProp.'_sorton'}) + : (); + if(@sort_fields > 0) { + push @orderbys, "$_ $sSortDir" foreach (@sort_fields); + } else { + push @orderbys, "$mDataProp $sSortDir"; + } + $i++; + } + + $orderby = " ORDER BY " . join(',', @orderbys) . " " if @orderbys; + return $orderby; +} + +=item dt_build_having + + my ($having, $having_params) = dt_build_having($dt_params) + + This function takes a reference to a hash containing DataTables parameters + and build the corresponding 'HAVING' clause. + This hash must contains the following keys: + + sSearch is the text entered in the global filter + + iColumns is the number of columns + + bSearchable_N is a boolean value that is true if the column is searchable + + mDataProp_N is a mapping between the column index, and the name of a SQL field + + sSearch_N is the text entered in individual filter for column N + +=back + +=cut + +sub dt_build_having { + my $param = shift; + + my @filters; + my @params; + + # Global filter + if($param->{'sSearch'}) { + my $sSearch = $param->{'sSearch'}; + my $i = 0; + my @gFilters; + my @gParams; + while($i < $param->{'iColumns'}) { + if($param->{'bSearchable_'.$i} eq 'true') { + my $mDataProp = $param->{'mDataProp_'.$i}; + my @filter_fields = $param->{$mDataProp.'_filteron'} + ? split(' ', $param->{$mDataProp.'_filteron'}) + : (); + if(@filter_fields > 0) { + foreach my $field (@filter_fields) { + push @gFilters, " $field LIKE ? "; + push @gParams, "%$sSearch%"; + } + } else { + push @gFilters, " $mDataProp LIKE ? "; + push @gParams, "%$sSearch%"; + } + } + $i++; + } + push @filters, " (" . join(" OR ", @gFilters) . ") "; + push @params, @gParams; + } + + # Individual filters + my $i = 0; + while($i < $param->{'iColumns'}) { + my $sSearch = $param->{'sSearch_'.$i}; + if($sSearch) { + my $mDataProp = $param->{'mDataProp_'.$i}; + my @filter_fields = $param->{$mDataProp.'_filteron'} + ? split(' ', $param->{$mDataProp.'_filteron'}) + : (); + if(@filter_fields > 0) { + my @localfilters; + foreach my $field (@filter_fields) { + push @localfilters, " $field LIKE ? "; + push @params, "%$sSearch%"; + } + push @filters, " ( ". join(" OR ", @localfilters) ." ) "; + } else { + push @filters, " $mDataProp LIKE ? "; + push @params, "%$sSearch%"; + } + } + $i++; + } + + return (\@filters, \@params); +} + +=item dt_get_params + + my %dtparam = = dt_get_params( $input ) + + This function takes a reference to a new CGI object. + + It prepares a hash containing Datatable parameters. + +=back + +=cut +sub dt_get_params { + my $input = shift; + my %dtparam; + my $vars = $input->Vars; + + foreach(qw/ iDisplayStart iDisplayLength iColumns sSearch bRegex iSortingCols sEcho /) { + $dtparam{$_} = $input->param($_); + } + foreach(grep /(?:_sorton|_filteron)$/, keys %$vars) { + $dtparam{$_} = $vars->{$_}; + } + for(my $i=0; $i<$dtparam{'iColumns'}; $i++) { + foreach(qw/ bSearchable sSearch bRegex bSortable iSortCol mDataProp sSortDir /) { + my $key = $_ . '_' . $i; + $dtparam{$key} = $input->param($key) if defined $input->param($key); + } + } + return %dtparam; +} + +=item dt_build_query_simple + + my ( $query, $params )= dt_build_query_simple( $value, $field ) + + This function takes a value and a field (table.field). + + It returns (undef, []) if not $value. + Else, returns a SQL where string and an arrayref containing parameters + for the execute method of the statement. + +=back + +=cut +sub dt_build_query_simple { + my ( $value, $field ) = @_; + my $query; + my @params; + if( $value ) { + $query .= " AND $field = ? "; + push @params, $value; + } + return ( $query, \@params ); +} + +=item dt_build_query_dates + + my ( $query, $params )= dt_build_query_dates( $datefrom, $dateto, $field) + + This function takes a datefrom, dateto and a field (table.field). + + It returns (undef, []) if not $value. + Else, returns a SQL where string and an arrayref containing parameters + for the execute method of the statement. + +=back + +=cut +sub dt_build_query_dates { + my ( $datefrom, $dateto, $field ) = @_; + my $query; + my @params; + if ( $datefrom ) { + $query .= " AND $field >= ? "; + push @params, C4::Dates->new($datefrom)->output('iso'); + } + if ( $dateto ) { + $query .= " AND $field <= ? "; + push @params, C4::Dates->new($dateto)->output('iso'); + } + return ( $query, \@params ); +} + +=item dt_build_query + + my ( $query, $filter ) = dt_build_query( $type, @params ) + + This function takes a value and a list of parameters. + + It calls dt_build_query_dates or dt_build_query_simple fonction of $type. + + $type can be 'simple' or 'rage_dates'. + +=back + +=cut +sub dt_build_query { + my ( $type, @params ) = @_; + given ( $type ) { + when ( /simple/ ) { + return dt_build_query_simple( @params ); + } + when ( /range_dates/ ) { + return dt_build_query_dates( @params ); + } + } +} + +1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css b/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css new file mode 100644 index 0000000000..e069b93535 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css @@ -0,0 +1,114 @@ +input.search_init { + color: #999999; +} +.sorting_asc { + padding-right: 19px; + background: url("../../img/datatables/sort_asc.png") no-repeat scroll right center #EEEEEE; +} +.sorting_desc { + padding-right: 19px; + background: url("../../img/datatables/sort_desc.png") no-repeat scroll right center #EEEEEE; +} +.sorting { + padding-right: 19px; + background: url("../../img/datatables/sort_both.png") no-repeat scroll right center #EEEEEE; +} +.sorting_asc_disabled { + padding-right: 19px; + background: url("../../img/datatables/sort_asc_disabled.png") no-repeat scroll right center #EEEEEE; +} +.sorting_desc_disabled { + padding-right: 19px; + background: url("../../img/datatables/sort_desc_disabled.png") no-repeat scroll right center #EEEEEE; +} +.sorting_disabled { + padding-right: 19px; + background-color: #EEEEEE; +} + +table.display { + width: 100%; +} +table.display thead th { + border-bottom: 1px solid black; + cursor: pointer; + font-weight: bold; + padding: 3px 18px 3px 10px; +} +.dataTables_wrapper { + clear: both; + position: relative; +} +.dataTables_processing { + background-color: white; + border: 1px solid #DDDDDD; + color: #999999; + font-size: 14px; + height: 30px; + left: 50%; + margin-left: -125px; + margin-top: -15px; + padding: 14px 0 2px; + position: fixed; + text-align: center; + top: 50%; + width: 250px; +} +.dataTables_info { + float: left; + width: 60%; +} +.dataTables_paginate { + float: right; + text-align: right; + width: 44px; +} +.paging_full_numbers { + height: 22px; + line-height: 22px; + width: 400px; +} +.paging_full_numbers span.paginate_button, + .paging_full_numbers span.paginate_active { + border: 1px solid #aaa; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + padding: 2px 5px; + margin: 0 3px; + cursor: pointer; + *cursor: hand; +} + +.paging_full_numbers span.paginate_button { + background-color: #ddd; +} + +.paging_full_numbers span.paginate_button:hover { + background-color: #ccc; +} + +.paging_full_numbers span.paginate_active { + background-color: #99B3FF; +} +.paginate_disabled_previous, .paginate_enabled_previous, .paginate_disabled_next, .paginate_enabled_next { + float: left; + height: 19px; + margin-left: 3px; + width: 19px; +} +.paginate_disabled_previous { + background-image: url("../../img/datatables/back_disabled.jpg"); +} +.paginate_enabled_previous { + background-image: url("../../img/datatables/back_enabled.jpg"); +} +.paginate_disabled_next { + background-image: url("../../img/datatables/forward_disabled.jpg"); +} +.paginate_enabled_next { + background-image: url("../../img/datatables/forward_enabled.jpg"); +} +.spacer { + clear: both; + height: 20px; +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/datatables-strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/datatables-strings.inc new file mode 100644 index 0000000000..183f511df5 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/datatables-strings.inc @@ -0,0 +1,17 @@ + diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js new file mode 100644 index 0000000000..38dd1d5ed1 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js @@ -0,0 +1,281 @@ +// These default options are for translation but can be used +// for any other datatables settings +// MSG_DT_* variables comes from datatables-strings.inc +// To use it, write: +// $("#table_id").dataTable($.extend(true, {}, dataTableDefaults, { +// // other settings +// } ) ); +var dataTablesDefaults = { + "oLanguage": { + "oPaginate": { + "sFirst" : window.MSG_DT_FIRST || "First", + "sLast" : window.MSG_DT_LAST || "Last", + "sNext" : window.MSG_DT_NEXT || "Next", + "sPrevious" : window.MSG_DT_PREVIOUS || "Previous" + }, + "sEmptyTable" : window.MSG_DT_EMPTY_TABLE || "No data available in table", + "sInfo" : window.MSG_DT_INFO || "Showing _START_ to _END_ of _TOTAL_ entries", + "sInfoEmpty" : window.MSG_DT_INFO_EMPTY || "No entries to show", + "sInfoFiltered" : window.MSG_DT_INFO_FILTERED || "(filtered from _MAX_ total entries)", + "sLengthMenu" : window.MSG_DT_LENGTH_MENU || "Show _MENU_ entries", + "sLoadingRecords" : window.MSG_DT_LOADING_RECORDS || "Loading...", + "sProcessing" : window.MSG_DT_PROCESSING || "Processing...", + "sSearch" : window.MSG_DT_SEARCH || "Search:", + "sZeroRecords" : window.MSG_DT_ZERO_RECORDS || "No matching records found" + } +}; + + +// Return an array of string containing the values of a particular column +$.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) { + // check that we have a column id + if ( typeof iColumn == "undefined" ) return new Array(); + // by default we only wany unique data + if ( typeof bUnique == "undefined" ) bUnique = true; + // by default we do want to only look at filtered data + if ( typeof bFiltered == "undefined" ) bFiltered = true; + // by default we do not wany to include empty values + if ( typeof bIgnoreEmpty == "undefined" ) bIgnoreEmpty = true; + // list of rows which we're going to loop through + var aiRows; + // use only filtered rows + if (bFiltered == true) aiRows = oSettings.aiDisplay; + // use all rows + else aiRows = oSettings.aiDisplayMaster; // all row numbers + + // set up data array + var asResultData = new Array(); + for (var i=0,c=aiRows.length; i -1) continue; + // else push the value onto the result data array + else asResultData.push(sValue); + } + return asResultData; +} + +// List of unbind keys (Ctrl, Alt, Direction keys, etc.) +// These keys must not launch filtering +var blacklist_keys = new Array(0, 16, 17, 18, 37, 38, 39, 40); + +// Set a filtering delay for global search field +jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay = function ( oSettings, iDelay ) { + /* + * Inputs: object:oSettings - dataTables settings object - automatically given + * integer:iDelay - delay in milliseconds + * Usage: $('#example').dataTable().fnSetFilteringDelay(250); + * Author: Zygimantas Berziunas (www.zygimantas.com) and Allan Jardine + * License: GPL v2 or BSD 3 point style + * Contact: zygimantas.berziunas /AT\ hotmail.com + */ + var + _that = this, + iDelay = (typeof iDelay == 'undefined') ? 250 : iDelay; + + this.each( function ( i ) { + $.fn.dataTableExt.iApiIndex = i; + var + $this = this, + oTimerId = null, + sPreviousSearch = null, + anControl = $( 'input', _that.fnSettings().aanFeatures.f ); + + anControl.unbind( 'keyup.DT' ).bind( 'keyup.DT', function(event) { + var $$this = $this; + if (blacklist_keys.indexOf(event.keyCode) != -1) { + return this; + }else if ( event.keyCode == '13' ) { + $.fn.dataTableExt.iApiIndex = i; + _that.fnFilter( $(this).val() ); + } else { + if (sPreviousSearch === null || sPreviousSearch != anControl.val()) { + window.clearTimeout(oTimerId); + sPreviousSearch = anControl.val(); + oTimerId = window.setTimeout(function() { + $.fn.dataTableExt.iApiIndex = i; + _that.fnFilter( anControl.val() ); + }, iDelay); + } + } + }); + + return this; + } ); + return this; +} + +// Add a filtering delay on general search and on all input (with a class 'filter') +jQuery.fn.dataTableExt.oApi.fnAddFilters = function ( oSettings, sClass, iDelay ) { + var table = this; + this.fnSetFilteringDelay(iDelay); + var filterTimerId = null; + $("input."+sClass).keyup(function(event) { + if (blacklist_keys.indexOf(event.keyCode) != -1) { + return this; + }else if ( event.keyCode == '13' ) { + table.fnFilter( $(this).val(), $(this).attr('data-column_num') ); + } else { + window.clearTimeout(filterTimerId); + var input = this; + filterTimerId = window.setTimeout(function() { + table.fnFilter($(input).val(), $(input).attr('data-column_num')); + }, iDelay); + } + }); +} + +// Useful if you want to filter on dates with 2 inputs (start date and end date) +// You have to include calendar.inc to use it +function dt_add_rangedate_filter(begindate_id, enddate_id, dateCol) { + $.fn.dataTableExt.afnFiltering.push( + function( oSettings, aData, iDataIndex ) { + + var beginDate = Date_from_syspref($("#"+begindate_id).val()).getTime(); + var endDate = Date_from_syspref($("#"+enddate_id).val()).getTime(); + + var data = Date_from_syspref(aData[dateCol]).getTime(); + + if ( !parseInt(beginDate) && ! parseInt(endDate) ) { + return true; + } + else if ( beginDate <= data && !parseInt(endDate) ) { + return true; + } + else if ( data <= endDate && !parseInt(beginDate) ) { + return true; + } + else if ( beginDate <= data && data <= endDate) { + return true; + } + return false; + } + ); +} + +//Sorting for dates (uk format) +function dt_add_type_uk_date() { + jQuery.fn.dataTableExt.aTypes.unshift( + function ( sData ) + { + if (sData.match(/(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[012])\/(19|20|21)\d\d/)) + { + return 'uk_date'; + } + return null; + } + ); + + jQuery.fn.dataTableExt.oSort['uk_date-asc'] = function(a,b) { + var re = /(\d{2}\/\d{2}\/\d{4})/; + a.match(re); + var ukDatea = RegExp.$1.split("/"); + b.match(re); + var ukDateb = RegExp.$1.split("/"); + + var x = (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1; + var y = (ukDateb[2] + ukDateb[1] + ukDateb[0]) * 1; + + return ((x < y) ? -1 : ((x > y) ? 1 : 0)); + }; + + jQuery.fn.dataTableExt.oSort['uk_date-desc'] = function(a,b) { + var re = /(\d{2}\/\d{2}\/\d{4})/; + a.match(re); + var ukDatea = RegExp.$1.split("/"); + b.match(re); + var ukDateb = RegExp.$1.split("/"); + + var x = (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1; + var y = (ukDateb[2] + ukDateb[1] + ukDateb[0]) * 1; + + return ((x < y) ? 1 : ((x > y) ? -1 : 0)); + }; +} + +// Sorting on html contains +// bar sort on 'bar' +function dt_overwrite_html_sorting_localeCompare() { + jQuery.fn.dataTableExt.oSort['html-asc'] = function(a,b) { + a = a.replace(/<.*?>/g, "").replace(/\s+/g, " "); + b = b.replace(/<.*?>/g, "").replace(/\s+/g, " "); + if (typeof(a.localeCompare == "function")) { + return a.localeCompare(b); + } else { + return (a > b) ? 1 : ((a < b) ? -1 : 0); + } + }; + + jQuery.fn.dataTableExt.oSort['html-desc'] = function(a,b) { + a = a.replace(/<.*?>/g, "").replace(/\s+/g, " "); + b = b.replace(/<.*?>/g, "").replace(/\s+/g, " "); + if(typeof(b.localeCompare == "function")) { + return b.localeCompare(a); + } else { + return (b > a) ? 1 : ((b < a) ? -1 : 0); + } + }; +} + +// Sorting on string without accentued characters +function dt_overwrite_string_sorting_localeCompare() { + jQuery.fn.dataTableExt.oSort['string-asc'] = function(a,b) { + a = a.replace(/<.*?>/g, "").replace(/\s+/g, " "); + b = b.replace(/<.*?>/g, "").replace(/\s+/g, " "); + if (typeof(a.localeCompare == "function")) { + return a.localeCompare(b); + } else { + return (a > b) ? 1 : ((a < b) ? -1 : 0); + } + }; + + jQuery.fn.dataTableExt.oSort['string-desc'] = function(a,b) { + a = a.replace(/<.*?>/g, "").replace(/\s+/g, " "); + b = b.replace(/<.*?>/g, "").replace(/\s+/g, " "); + if(typeof(b.localeCompare == "function")) { + return b.localeCompare(a); + } else { + return (b > a) ? 1 : ((b < a) ? -1 : 0); + } + }; +} + +// Replace a node with a html and js contain. +function replace_html( original_node, type ) { + switch ( $(original_node).attr('data-type') ) { + case "range_dates": + var id = $(original_node).attr("data-id"); + var format = $(original_node).attr("data-format"); + replace_html_date( original_node, id, format ); + break; + default: + alert("_(This node can't be replaced)"); + } +} + +// Replace a node with a "From [date] To [date]" element +// Used on tfoot > td +function replace_html_date( original_node, id, format ) { + var node = $('' + _("From") + '×
' + _("To") + '×'); + $(original_node).replaceWith(node); + var script = document.createElement( 'script' ); + script.type = 'text/javascript'; + var script_content = "Calendar.setup({"; + script_content += " inputField: \"" + id + "from\","; + script_content += " ifFormat: \"" + format + "\","; + script_content += " button: \"" + id + "from\","; + script_content += " onClose: function(){ $(\"#" + id + "from\").change(); this.hide();}"; + script_content += " });"; + script_content += " Calendar.setup({"; + script_content += " inputField: \"" + id + "to\","; + script_content += " ifFormat: \"" + format + "\","; + script_content += " button: \"" + id + "to\","; + script_content += " onClose: function(){ $(\"#" + id + "to\").change(); this.hide();}"; + script_content += " });"; + script.text = script_content; + $(original_node).append( script ); +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js new file mode 100644 index 0000000000..771c00ba06 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js @@ -0,0 +1,153 @@ +/* + * File: jquery.dataTables.min.js + * Version: 1.8.1 + * Author: Allan Jardine (www.sprymedia.co.uk) + * Info: www.datatables.net + * + * Copyright 2008-2010 Allan Jardine, all rights reserved. + * + * This source file is free software, under either the GPL v2 license or a + * BSD style license, available at: + * http://datatables.net/license_gpl2 + * http://datatables.net/license_bsd + * + * This source file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. + */ +(function(i,wa,p){i.fn.dataTableSettings=[];var D=i.fn.dataTableSettings;i.fn.dataTableExt={};var o=i.fn.dataTableExt;o.sVersion="1.8.1";o.sErrMode="alert";o.iApiIndex=0;o.oApi={};o.afnFiltering=[];o.aoFeatures=[];o.ofnSearch={};o.afnSortData=[];o.oStdClasses={sPagePrevEnabled:"paginate_enabled_previous",sPagePrevDisabled:"paginate_disabled_previous",sPageNextEnabled:"paginate_enabled_next",sPageNextDisabled:"paginate_disabled_next",sPageJUINext:"",sPageJUIPrev:"",sPageButton:"paginate_button",sPageButtonActive:"paginate_active", +sPageButtonStaticDisabled:"paginate_button paginate_button_disabled",sPageFirst:"first",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled", +sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:""};o.oJUIClasses={sPagePrevEnabled:"fg-button ui-button ui-state-default ui-corner-left", +sPagePrevDisabled:"fg-button ui-button ui-state-default ui-corner-left ui-state-disabled",sPageNextEnabled:"fg-button ui-button ui-state-default ui-corner-right",sPageNextDisabled:"fg-button ui-button ui-state-default ui-corner-right ui-state-disabled",sPageJUINext:"ui-icon ui-icon-circle-arrow-e",sPageJUIPrev:"ui-icon ui-icon-circle-arrow-w",sPageButton:"fg-button ui-button ui-state-default",sPageButtonActive:"fg-button ui-button ui-state-default ui-state-disabled",sPageButtonStaticDisabled:"fg-button ui-button ui-state-default ui-state-disabled", +sPageFirst:"first ui-corner-tl ui-corner-bl",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last ui-corner-tr ui-corner-br",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"ui-state-default",sSortDesc:"ui-state-default",sSortable:"ui-state-default", +sSortableAsc:"ui-state-default",sSortableDesc:"ui-state-default",sSortableNone:"ui-state-default",sSortColumn:"sorting_",sSortJUIAsc:"css_right ui-icon ui-icon-triangle-1-n",sSortJUIDesc:"css_right ui-icon ui-icon-triangle-1-s",sSortJUI:"css_right ui-icon ui-icon-carat-2-n-s",sSortJUIAscAllowed:"css_right ui-icon ui-icon-carat-1-n",sSortJUIDescAllowed:"css_right ui-icon ui-icon-carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",sScrollWrapper:"dataTables_scroll", +sScrollHead:"dataTables_scrollHead ui-state-default",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot ui-state-default",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:"ui-state-default"};o.oPagination={two_button:{fnInit:function(g,l,r){var s,w,y;if(g.bJUI){s=p.createElement("a");w=p.createElement("a");y=p.createElement("span");y.className=g.oClasses.sPageJUINext;w.appendChild(y);y=p.createElement("span");y.className=g.oClasses.sPageJUIPrev; +s.appendChild(y)}else{s=p.createElement("div");w=p.createElement("div")}s.className=g.oClasses.sPagePrevDisabled;w.className=g.oClasses.sPageNextDisabled;s.title=g.oLanguage.oPaginate.sPrevious;w.title=g.oLanguage.oPaginate.sNext;l.appendChild(s);l.appendChild(w);i(s).bind("click.DT",function(){g.oApi._fnPageChange(g,"previous")&&r(g)});i(w).bind("click.DT",function(){g.oApi._fnPageChange(g,"next")&&r(g)});i(s).bind("selectstart.DT",function(){return false});i(w).bind("selectstart.DT",function(){return false}); +if(g.sTableId!==""&&typeof g.aanFeatures.p=="undefined"){l.setAttribute("id",g.sTableId+"_paginate");s.setAttribute("id",g.sTableId+"_previous");w.setAttribute("id",g.sTableId+"_next")}},fnUpdate:function(g){if(g.aanFeatures.p)for(var l=g.aanFeatures.p,r=0,s=l.length;r=w-s){s=w-r+1;x=w}else{s=y-Math.ceil(r/2)+1;x=s+r-1}for(r=s;r<=x;r++)G+=y!=r?''+r+"":''+r+"";x=g.aanFeatures.p;var z,Y=function(L){g._iDisplayStart=(this.innerHTML*1-1)*g._iDisplayLength;l(g);L.preventDefault()},V=function(){return false};r=0;for(s=x.length;rl?1:0},"string-desc":function(g,l){if(typeof g!="string")g="";if(typeof l!="string")l="";g=g.toLowerCase();l=l.toLowerCase();return gl?-1:0},"html-asc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return g< +l?-1:g>l?1:0},"html-desc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return gl?-1:0},"date-asc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return g-l},"date-desc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return l- +g},"numeric-asc":function(g,l){return(g=="-"||g===""?0:g*1)-(l=="-"||l===""?0:l*1)},"numeric-desc":function(g,l){return(l=="-"||l===""?0:l*1)-(g=="-"||g===""?0:g*1)}};o.aTypes=[function(g){if(typeof g=="number")return"numeric";else if(typeof g!="string")return null;var l,r=false;l=g.charAt(0);if("0123456789-".indexOf(l)==-1)return null;for(var s=1;s")!=-1)return"html";return null}];o.fnVersionCheck=function(g){var l=function(x,v){for(;x.length=parseInt(w,10)};o._oExternConfig={iNextUnique:0};i.fn.dataTable=function(g){function l(){this.fnRecordsTotal= +function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsTotal,10):this.aiDisplayMaster.length};this.fnRecordsDisplay=function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsDisplay,10):this.aiDisplay.length};this.fnDisplayEnd=function(){return this.oFeatures.bServerSide?this.oFeatures.bPaginate===false||this._iDisplayLength==-1?this._iDisplayStart+this.aiDisplay.length:Math.min(this._iDisplayStart+this._iDisplayLength,this._iRecordsDisplay):this._iDisplayEnd};this.sInstance= +this.oInstance=null;this.oFeatures={bPaginate:true,bLengthChange:true,bFilter:true,bSort:true,bInfo:true,bAutoWidth:true,bProcessing:false,bSortClasses:true,bStateSave:false,bServerSide:false,bDeferRender:false};this.oScroll={sX:"",sXInner:"",sY:"",bCollapse:false,bInfinite:false,iLoadGap:100,iBarWidth:0,bAutoCss:true};this.aanFeatures=[];this.oLanguage={sProcessing:"Processing...",sLengthMenu:"Show _MENU_ entries",sZeroRecords:"No matching records found",sEmptyTable:"No data available in table", +sLoadingRecords:"Loading...",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sSearch:"Search:",sUrl:"",oPaginate:{sFirst:"First",sPrevious:"Previous",sNext:"Next",sLast:"Last"},fnInfoCallback:null};this.aoData=[];this.aiDisplay=[];this.aiDisplayMaster=[];this.aoColumns=[];this.aoHeader=[];this.aoFooter=[];this.iNextId=0;this.asDataSearch=[];this.oPreviousSearch={sSearch:"",bRegex:false, +bSmart:true};this.aoPreSearchCols=[];this.aaSorting=[[0,"asc",0]];this.aaSortingFixed=null;this.asStripClasses=[];this.asDestoryStrips=[];this.sDestroyWidth=0;this.fnFooterCallback=this.fnHeaderCallback=this.fnRowCallback=null;this.aoDrawCallback=[];this.fnInitComplete=this.fnPreDrawCallback=null;this.sTableId="";this.nTableWrapper=this.nTBody=this.nTFoot=this.nTHead=this.nTable=null;this.bInitialised=this.bDeferLoading=false;this.aoOpenRows=[];this.sDom="lfrtip";this.sPaginationType="two_button"; +this.iCookieDuration=7200;this.sCookiePrefix="SpryMedia_DataTables_";this.fnCookieCallback=null;this.aoStateSave=[];this.aoStateLoad=[];this.sAjaxSource=this.oLoadedState=null;this.sAjaxDataProp="aaData";this.bAjaxDataGet=true;this.jqXHR=null;this.fnServerData=function(a,b,c,d){d.jqXHR=i.ajax({url:a,data:b,success:c,dataType:"json",cache:false,error:function(f,e){e=="parsererror"&&alert("DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.")}})}; +this.fnFormatNumber=function(a){if(a<1E3)return a;else{var b=a+"";a=b.split("");var c="";b=b.length;for(var d=0;dtr>th",a.nTFoot).addClass(a.oClasses.sFooterTH);if(a.nTFoot!==null){c=S(a,null,a.aoFooter);b=0;for(d=a.aoColumns.length;b=0;e--)!a.aoColumns[e].bVisible&&!c&&h[d].splice(e,1);j.push([])}d=0;for(f=h.length;d=a.fnRecordsDisplay()?0:a.iInitDisplayStart;a.iInitDisplayStart=-1;E(a)}if(a.bDeferLoading){a.bDeferLoading=false;a.iDraw++}else if(a.oFeatures.bServerSide){if(!a.bDestroying&&!za(a))return}else a.iDraw++;if(a.aiDisplay.length!==0){var h=a._iDisplayStart,j=a._iDisplayEnd;if(a.oFeatures.bServerSide){h=0;j=a.aoData.length}for(h=h;htr",a.nTHead)[0],aa(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);typeof a.fnFooterCallback== +"function"&&a.fnFooterCallback.call(a.oInstance,i(">tr",a.nTFoot)[0],aa(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);f=p.createDocumentFragment();b=p.createDocumentFragment();if(a.nTBody){e=a.nTBody.parentNode;b.appendChild(a.nTBody);if(!a.oScroll.bInfinite||!a._bInitComplete||a.bSorted||a.bFiltered){c=a.nTBody.childNodes;for(b=c.length-1;b>=0;b--)c[b].parentNode.removeChild(c[b])}b=0;for(c=d.length;b=0;b--)a.aoDrawCallback[b].fn.call(a.oInstance,a);a.bSorted=false;a.bFiltered=false;a.bDrawing=false;if(a.oFeatures.bServerSide){K(a,false);typeof a._bInitComplete=="undefined"&&w(a)}}}function ba(a){if(a.oFeatures.bSort)R(a,a.oPreviousSearch);else if(a.oFeatures.bFilter)M(a,a.oPreviousSearch);else{E(a);C(a)}}function za(a){if(a.bAjaxDataGet){K(a,true);var b=a.aoColumns.length,c=[],d,f;a.iDraw++;c.push({name:"sEcho",value:a.iDraw});c.push({name:"iColumns",value:b});c.push({name:"sColumns",value:ha(a)}); +c.push({name:"iDisplayStart",value:a._iDisplayStart});c.push({name:"iDisplayLength",value:a.oFeatures.bPaginate!==false?a._iDisplayLength:-1});for(f=0;f")c=c.parentNode;else if(h=="l"&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange){f=Ca(a);e=1}else if(h=="f"&&a.oFeatures.bFilter){f=Da(a);e=1}else if(h=="r"&&a.oFeatures.bProcessing){f=Ea(a);e=1}else if(h=="t"){f=Fa(a);e=1}else if(h=="i"&&a.oFeatures.bInfo){f=Ga(a);e=1}else if(h=="p"&&a.oFeatures.bPaginate){f=Ha(a);e=1}else if(o.aoFeatures.length!== +0){j=o.aoFeatures;t=0;for(k=j.length;tcaption",a.nTable);h=0;for(k=d.length;hi(a.nTable).height()-a.oScroll.iLoadGap)if(a.fnDisplayEnd()0&&a.nTable.removeChild(h[0]);if(a.nTFoot!==null){k=a.nTable.getElementsByTagName("tfoot");k.length>0&&a.nTable.removeChild(k[0])}h=a.nTHead.cloneNode(true);a.nTable.insertBefore(h,a.nTable.childNodes[0]);if(a.nTFoot!==null){k=a.nTFoot.cloneNode(true); +a.nTable.insertBefore(k,a.nTable.childNodes[1])}if(a.oScroll.sX===""){d.style.width="100%";b.parentNode.style.width="100%"}var O=S(a,h);f=0;for(e=O.length;ff-a.oScroll.iBarWidth)a.nTable.style.width=u(f)}else a.nTable.style.width=u(f);f=i(a.nTable).outerWidth();if(a.oScroll.sX===""){d.style.width=u(f+a.oScroll.iBarWidth);b.parentNode.style.width=u(f+a.oScroll.iBarWidth)}e=a.nTHead.getElementsByTagName("tr");h=h.getElementsByTagName("tr");P(function(B,F){m=B.style;m.paddingTop= +"0";m.paddingBottom="0";m.borderTopWidth="0";m.borderBottomWidth="0";m.height=0;q=i(B).width();F.style.width=u(q);I.push(q)},h,e);i(h).height(0);if(a.nTFoot!==null){j=k.getElementsByTagName("tr");k=a.nTFoot.getElementsByTagName("tr");P(function(B,F){m=B.style;m.paddingTop="0";m.paddingBottom="0";m.borderTopWidth="0";m.borderBottomWidth="0";m.height=0;q=i(B).width();F.style.width=u(q);I.push(q)},j,k);i(j).height(0)}P(function(B){B.innerHTML="";B.style.width=u(I.shift())},h);a.nTFoot!==null&&P(function(B){B.innerHTML= +"";B.style.width=u(I.shift())},j);if(i(a.nTable).outerWidth()d.offsetWidth?a.oScroll.iBarWidth:0;if(a.nTable.offsetHeight'):b===""?'':b+' '; +var c=p.createElement("div");c.className=a.oClasses.sFilter;c.innerHTML="";a.sTableId!==""&&typeof a.aanFeatures.f=="undefined"&&c.setAttribute("id",a.sTableId+"_filter");b=i("input",c);b.val(a.oPreviousSearch.sSearch.replace('"',"""));b.bind("keyup.DT",function(){for(var d=a.aanFeatures.f,f=0,e=d.length;f=0;d--){f=ma(H(a,a.aiDisplay[d],c,"filter"),a.aoColumns[c].sType);if(!b.test(f)){a.aiDisplay.splice(d,1);e++}}}}function Ka(a,b,c,d,f){var e=la(b,d,f);if(typeof c=="undefined"||c===null)c=0;if(o.afnFiltering.length!==0)c=1;if(b.length<=0){a.aiDisplay.splice(0,a.aiDisplay.length);a.aiDisplay=a.aiDisplayMaster.slice()}else if(a.aiDisplay.length==a.aiDisplayMaster.length||a.oPreviousSearch.sSearch.length> +b.length||c==1||b.indexOf(a.oPreviousSearch.sSearch)!==0){a.aiDisplay.splice(0,a.aiDisplay.length);ka(a,1);for(c=0;c/g,"");else if(typeof a=="string")return a.replace(/\n/g," ");else if(a===null)return"";return a}function R(a,b){var c,d,f,e,h=[],j=[],k=o.oSort;d=a.aoData;var m=a.aoColumns;if(!a.oFeatures.bServerSide&&(a.aaSorting.length!==0||a.aaSortingFixed!==null)){h=a.aaSortingFixed!== +null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(c=0;c=h)for(b=0;b=0?a._iDisplayStart-a._iDisplayLength:0;if(a._iDisplayStart<0)a._iDisplayStart=0}else if(b=="next")if(a._iDisplayLength>=0){if(a._iDisplayStart+a._iDisplayLength=0){b=parseInt((a.fnRecordsDisplay()-1)/a._iDisplayLength,10)+1;a._iDisplayStart=(b-1)*a._iDisplayLength}else a._iDisplayStart= +0;else J(a,0,"Unknown paging action: "+b);return c!=a._iDisplayStart}function Ga(a){var b=p.createElement("div");b.className=a.oClasses.sInfo;if(typeof a.aanFeatures.i=="undefined"){a.aoDrawCallback.push({fn:Na,sName:"information"});a.sTableId!==""&&b.setAttribute("id",a.sTableId+"_info")}return b}function Na(a){if(!(!a.oFeatures.bInfo||a.aanFeatures.i.length===0)){var b=a._iDisplayStart+1,c=a.fnDisplayEnd(),d=a.fnRecordsTotal(),f=a.fnRecordsDisplay(),e=a.fnFormatNumber(b),h=a.fnFormatNumber(c),j= +a.fnFormatNumber(d),k=a.fnFormatNumber(f);if(a.oScroll.bInfinite)e=a.fnFormatNumber(1);e=a.fnRecordsDisplay()===0&&a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfoEmpty+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()===0?a.oLanguage.sInfoEmpty+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",j)+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfo.replace("_START_",e).replace("_END_",h).replace("_TOTAL_",k)+a.oLanguage.sInfoPostFix:a.oLanguage.sInfo.replace("_START_", +e).replace("_END_",h).replace("_TOTAL_",k)+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+a.oLanguage.sInfoPostFix;if(a.oLanguage.fnInfoCallback!==null)e=a.oLanguage.fnInfoCallback(a,b,c,d,f,e);a=a.aanFeatures.i;b=0;for(c=a.length;b",c,d;if(a.aLengthMenu.length==2&&typeof a.aLengthMenu[0]=="object"&&typeof a.aLengthMenu[1]== +"object"){c=0;for(d=a.aLengthMenu[0].length;c'+a.aLengthMenu[1][c]+""}else{c=0;for(d=a.aLengthMenu.length;c'+a.aLengthMenu[c]+""}b+="";var f=p.createElement("div");a.sTableId!==""&&typeof a.aanFeatures.l=="undefined"&&f.setAttribute("id",a.sTableId+"_length");f.className=a.oClasses.sLength;f.innerHTML="";i('select option[value="'+ +a._iDisplayLength+'"]',f).attr("selected",true);i("select",f).bind("change.DT",function(){var e=i(this).val(),h=a.aanFeatures.l;c=0;for(d=h.length;ca.aiDisplay.length|| +a._iDisplayLength==-1?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}function Oa(a,b){if(!a||a===null||a==="")return 0;if(typeof b=="undefined")b=p.getElementsByTagName("body")[0];var c=p.createElement("div");c.style.width=u(a);b.appendChild(c);a=c.offsetWidth;b.removeChild(c);return a}function ea(a){var b=0,c,d=0,f=a.aoColumns.length,e,h=i("th",a.nTHead);for(e=0;etd",b);h=S(a,e);for(e=d=0;e0)a.aoColumns[e].sWidth=u(c);d++}a.nTable.style.width=u(i(b).outerWidth());b.parentNode.removeChild(b)}}function Qa(a,b){if(a.oScroll.sX===""&&a.oScroll.sY!==""){i(b).width();b.style.width=u(i(b).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sX!=="")b.style.width=u(i(b).outerWidth())}function Pa(a,b){var c= +Ra(a,b);if(c<0)return null;if(a.aoData[c].nTr===null){var d=p.createElement("td");d.innerHTML=H(a,c,b,"");return d}return Q(a,c)[b]}function Ra(a,b){for(var c=-1,d=-1,f=0;f/g,"");if(e.length>c){c=e.length;d=f}}return d}function u(a){if(a===null)return"0px";if(typeof a=="number"){if(a<0)return"0px";return a+"px"}var b=a.charCodeAt(a.length-1);if(b<48||b>57)return a;return a+"px"}function Va(a,b){if(a.length!=b.length)return 1;for(var c= +0;cb&&a[d]--;c!=-1&&a.splice(c,1)}function Ba(a,b){b=b.split(",");for(var c=[],d=0,f=a.aoColumns.length;d4096){a=p.cookie.split(";");for(var j=0,k=a.length;j=d.aiDisplay.length){d._iDisplayStart-=d._iDisplayLength;if(d._iDisplayStart<0)d._iDisplayStart=0}if(typeof c=="undefined"||c){E(d);C(d)}return f};this.fnClearTable=function(a){var b=A(this[o.iApiIndex]);ia(b);if(typeof a=="undefined"||a)C(b)};this.fnOpen=function(a,b,c){var d=A(this[o.iApiIndex]);this.fnClose(a);var f=p.createElement("tr"),e=p.createElement("td");f.appendChild(e);e.className=c;e.colSpan=X(d);if(typeof b.jquery!="undefined"||typeof b== +"object")e.appendChild(b);else e.innerHTML=b;b=i("tr",d.nTBody);i.inArray(a,b)!=-1&&i(f).insertAfter(a);d.aoOpenRows.push({nTr:f,nParent:a});return f};this.fnClose=function(a){for(var b=A(this[o.iApiIndex]),c=0;c=X(d);if(!j)for(f=a;ftr>td."+a.oClasses.sRowEmpty,a.nTable).parent().remove();if(a.nTable!=a.nTHead.parentNode){i(">thead",a.nTable).remove();a.nTable.appendChild(a.nTHead)}if(a.nTFoot&& +a.nTable!=a.nTFoot.parentNode){i(">tfoot",a.nTable).remove();a.nTable.appendChild(a.nTFoot)}a.nTable.parentNode.removeChild(a.nTable);i(a.nTableWrapper).remove();a.aaSorting=[];a.aaSortingFixed=[];T(a);i($(a)).removeClass(a.asStripClasses.join(" "));if(a.bJUI){i("th",a.nTHead).removeClass([o.oStdClasses.sSortable,o.oJUIClasses.sSortableAsc,o.oJUIClasses.sSortableDesc,o.oJUIClasses.sSortableNone].join(" "));i("th span."+o.oJUIClasses.sSortIcon,a.nTHead).remove();i("th",a.nTHead).each(function(){var e= +i("div."+o.oJUIClasses.sSortJUIWrapper,this),h=e.contents();i(this).append(h);e.remove()})}else i("th",a.nTHead).removeClass([o.oStdClasses.sSortable,o.oStdClasses.sSortableAsc,o.oStdClasses.sSortableDesc,o.oStdClasses.sSortableNone].join(" "));a.nTableReinsertBefore?b.insertBefore(a.nTable,a.nTableReinsertBefore):b.appendChild(a.nTable);d=0;for(f=a.aoData.length;dtr:even",c).addClass(a.asDestoryStrips[0]);i(">tr:odd",c).addClass(a.asDestoryStrips[1]);d=0;for(f=D.length;dt<"F"ip>'}if(e.oScroll.sX!==""||e.oScroll.sY!=="")e.oScroll.iBarWidth=Ua();if(typeof g.iDisplayStart!="undefined"&&typeof e.iInitDisplayStart=="undefined"){e.iInitDisplayStart= +g.iDisplayStart;e._iDisplayStart=g.iDisplayStart}if(typeof g.bStateSave!="undefined"){e.oFeatures.bStateSave=g.bStateSave;Ta(e,g);e.aoDrawCallback.push({fn:sa,sName:"state_save"})}if(typeof g.iDeferLoading!="undefined"){e.bDeferLoading=true;e._iRecordsTotal=g.iDeferLoading;e._iRecordsDisplay=g.iDeferLoading}if(typeof g.aaData!="undefined")j=true;if(typeof g!="undefined"&&typeof g.aoData!="undefined")g.aoColumns=g.aoData;if(typeof g.oLanguage!="undefined")if(typeof g.oLanguage.sUrl!="undefined"&&g.oLanguage.sUrl!== +""){e.oLanguage.sUrl=g.oLanguage.sUrl;i.getJSON(e.oLanguage.sUrl,null,function(t){y(e,t,true)});h=true}else y(e,g.oLanguage,false)}else g={};if(typeof g.asStripClasses=="undefined"){e.asStripClasses.push(e.oClasses.sStripOdd);e.asStripClasses.push(e.oClasses.sStripEven)}c=false;d=i(">tbody>tr",this);a=0;for(b=e.asStripClasses.length;a=0;a--){var m=g.aoColumnDefs[a].aTargets;i.isArray(m)||J(e,1,"aTargets must be an array of targets, not a "+typeof m);c=0;for(d=m.length;c=0){for(;e.aoColumns.length<=m[c];)G(e);x(e,m[c],g.aoColumnDefs[a])}else if(typeof m[c]== +"number"&&m[c]<0)x(e,e.aoColumns.length+m[c],g.aoColumnDefs[a]);else if(typeof m[c]=="string"){b=0;for(f=e.aoColumns.length;b=e.aoColumns.length)e.aaSorting[a][0]=0;k=e.aoColumns[e.aaSorting[a][0]];if(typeof e.aaSorting[a][2]=="undefined")e.aaSorting[a][2]=0;if(typeof g.aaSorting=="undefined"&& +typeof e.saved_aaSorting=="undefined")e.aaSorting[a][1]=k.asSorting[0];c=0;for(d=k.asSorting.length;cthead",this);if(a.length===0){a=[p.createElement("thead")];this.appendChild(a[0])}e.nTHead=a[0];a=i(">tbody",this);if(a.length===0){a=[p.createElement("tbody")];this.appendChild(a[0])}e.nTBody=a[0];a=i(">tfoot",this);if(a.length>0){e.nTFoot=a[0];W(e.aoFooter,e.nTFoot)}if(j)for(a=0;aC5UDGKfoZ!!63{a%*-grz$D1XEXer(2tyUn z+02YUSHb}sD?0}l&^EXLguy7lz`(-H!phDIlVN0HVHIR%V-ON%S2Pq6HFFG{Xryc+ zmRQ($@S#&sld*HEn>dFcBLmQ_$YwDLDjGT#PW*q1fd^^;oX+iLI)z|@;wX;U8Xr> zT8Qgxn;R!Cottl}#(8Ri${a3d=J*$R5qBRbK9bRJe*4BYwq9(uIM4mLS9%TSY?*y6 zE==owYH)vf>dq6(Uzum+IyVJqc3N&dRPD57vW(=l(=(DZ-K_!LSx zwPk@>bN@4B-OI9gCf>Wc_;CDAS%c@BJZ}kBlbDz~@y-*&Y^_U+@};q`xNUthN} On^Cj9W}Eu@|2F})$f79# literal 0 HcmV?d00001 diff --git a/koha-tmpl/intranet-tmpl/prog/img/datatables/back_enabled.jpg b/koha-tmpl/intranet-tmpl/prog/img/datatables/back_enabled.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a6d764c79c7a2047b6bf65bf9d96fcafd5161e38 GIT binary patch literal 807 zcmex=C5UDGKfoZ!!63{a%*-grz$D1XEXer(2*U&h z1}0{pBN2d|gO!bok%5r~RhW^Pm5qg+Lx6#Sm5Gs^od+h%$i&RTD#*spplB#0EW!~u z(MZ`u)XXulu<_tSr=TWdXR%Z_aiE1jZ7eM8Fl&IpCkWK1$Y$s$#2&a&N#sM~M5iWU z<^Q)Bc$gW1&SMs2uxGfw`}E06etb^r9k|jMc@Dlk(IlSD-Wwx*G{%4ThHhR%HnTsw zbu3z!=BtbC=-In5f5nt;je{+vrKZdWckk$U`c^FEYC6}Jn=lG)17QB>6z3khm7PHhg<-pEGSO0F>VA}N6`w53!8pr$>MbUW| zMEsFn=(%w+^5v0yp7Lmb+~3PpI4(#G~bQ$y_;t)oo+U5`bnSHZcn){CH~m7Ys2rz z2!R@xgGrCtcPz?eOPOzKr2P26p~(mTGjR1-c3?psA>uUGsyt|R2Ts3~!B zN71DGSrW%W*`w8#2{O$LX)%%8*<4Ycyr;tN(Hm8|M=_HtvR>P P+Rcr(b5Xx$|NkZcT0jT? literal 0 HcmV?d00001 diff --git a/koha-tmpl/intranet-tmpl/prog/img/datatables/forward_disabled.jpg b/koha-tmpl/intranet-tmpl/prog/img/datatables/forward_disabled.jpg new file mode 100644 index 0000000000000000000000000000000000000000..28a9dc53fa232919299ac980dc9b61167c1868bd GIT binary patch literal 635 zcmex=C5UDGKfoZ!!63{a%*-grz$D1XEXer(2tySE z1JEp>E8&2Nm4%I+g9~UMTnNHo6kuRrVP;|B;)Y2uGBL9Vva&GlzGLeh=CM*_u2I6%$1L~6;-1yGa|?*FvavCW+Av>{Flt>+*?d?iZ`9)^O?_H|D3t8;Og6lD<#WHQvW(mo1ETsD>A@mr8@sqg(?1R z%d@qrmWLWmIn1#pQuo}{brVW*C8t%EDXbOt_DabwXgGW3;wDX1;~7hWrYL+ZX=qre z&-y^2q0zm?-FJb#(AWJTHOJ-3`S`D|JEhzC{KvY_h0kZinXP-?w!g_L@p#JQO^!z$ mYCgVwS7#SryXs@?>&L&t^Z(SozHVt~@Z#>58}s)6zX<@qORf(9 literal 0 HcmV?d00001 diff --git a/koha-tmpl/intranet-tmpl/prog/img/datatables/forward_enabled.jpg b/koha-tmpl/intranet-tmpl/prog/img/datatables/forward_enabled.jpg new file mode 100644 index 0000000000000000000000000000000000000000..598c075f13ab0e4bbe05a4eeea7cf777ba73cf03 GIT binary patch literal 852 zcmex=C5UDGKfoZ!!63{a%*-grz$D1XEXer(2tywO z0~0eN(3Nn&%Fe>Z!NthH$ciG&$iU3P%Em6hz`z1zu=B#yGcqx=2(q#<2(fb*3M-3< zDh5t8G7&R#Oe}1C=oHjs?40T*F37+LbR`oj+(bq}CT0c}Rz*W0Hg?Cv#)(EB0yioN zi~PUEzyov)lOVGogFVA5dn3uE%Z<*rn&ugY^FIG9<<=87L*?mOy^~u`Rq(Eg+UDw^ z@^Uh}zJ$t~P2YpRT#sm2p`oEt8zJ-EBRfY;>b?DxZo!24Z)Q(O&}!Mbt}27`dKa(x zr)AHkZg5MjKa&4$syaupXWNXgp32dQs_rj-?|M=Q9pN^hZg^mV7=UWs>}D5 z$40(ME7Q1T4h8p}ZJ8O!G-Xk84;P~#ci!&o`A5I3kG@gLm*VlJbn%kvSqIh?3Y?HQ zAX0NL>XIkpf=MN83*!%}9-aN5)p7^py2Am>F9gW&pFSp#V0dxX#ZPW;UoD(gaI@8E z(rNQz1DBIiM13!LtZ|85lHB@$wW~n0fhRz-$?R&m{@z;uI}N|35As;}zdXB<I#+N1k=r*G-&mI78vJ_Ezs!yIV%J}l7d*c9>7Bn;xyLT84V&`$ z@9WMTAJ6DZyR)~=FS6P2e3MDv7lHB>{C&1H^7EJ9PIf=EdUwUYtGE9%$X9(m*ZWLf M_rC2^{;K~s0TRp{r2qf` literal 0 HcmV?d00001 diff --git a/koha-tmpl/intranet-tmpl/prog/img/datatables/sort_asc.png b/koha-tmpl/intranet-tmpl/prog/img/datatables/sort_asc.png new file mode 100644 index 0000000000000000000000000000000000000000..a56d0e21902ce620cd57f87fa58a6d3e804135cf GIT binary patch literal 263 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S3?yCqj{O5tEa{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i>l2Ka=y{`vF&J9*~+_wWBdfBFCW_y37A{>@tOZ^^2EJ(K_a|Nno&o$%d2jr=7+e!)O45@5J; zXU0OHl&hzUV@SoVE9Xw~GAQscA1s)^?0*rXqM}DeLv7?|BU8z@QCOGupVzP9Hek5&L+Gnl%BD>~0~tJB{an^LB{Ts5b0m7= literal 0 HcmV?d00001 diff --git a/koha-tmpl/intranet-tmpl/prog/img/datatables/sort_asc_disabled.png b/koha-tmpl/intranet-tmpl/prog/img/datatables/sort_asc_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..b7e621ef1c68da839ce077cec6e201a55c1ba168 GIT binary patch literal 252 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S3?yCqj{O5tEa{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=)2l#}z{`>du$&)AV-@pIyd9;k)4B*-rq$b|z2+ZRf0KnW*L z7srr_TUXBQ7GeV6G?@}f$7k6Jhw{qGm$-QDzD`qrDaZ3s$b2XF;fBBPU nqjNDy&Nw~puHFA+-v&m8`?>-yUFVHK{$ucT^>bP0l+XkKhw^g= literal 0 HcmV?d00001 diff --git a/koha-tmpl/intranet-tmpl/prog/img/datatables/sort_both.png b/koha-tmpl/intranet-tmpl/prog/img/datatables/sort_both.png new file mode 100644 index 0000000000000000000000000000000000000000..839ac4bb5b0b414834c950de9deafff6dd94ed2d GIT binary patch literal 282 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S3?yCqj{O5tEa{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=)2l#}z{`>du$&)AV-@pIyd9;k)4B*-rq$b|z2+ZRf0K#2rT z7srr_TRjsz`4|*ASOSl%eg6Ob+(JtRwX|O@S}a^IESQCgTe~DWM4fR9b+X literal 0 HcmV?d00001 diff --git a/koha-tmpl/intranet-tmpl/prog/img/datatables/sort_desc.png b/koha-tmpl/intranet-tmpl/prog/img/datatables/sort_desc.png new file mode 100644 index 0000000000000000000000000000000000000000..90b295159df995329b3a84340d32761f3d1dbade GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S3?yCqj{O5tEa{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i>l2Ka=y{`vF&J9*~+_wWBdfBFCW_y37A{>@tOZ^^2EJ(K_a|Nno&o$%d2jr=7+e!)O45@5J; zXU0OHl#{26V@SoVqz8vtc$~v}dc~O{CLEF2anNavMpdMP)0v(X&o(k0opIq!LdvtJ wj~up7@0`wiSoe($&y07EkGxK6U|?nlJSz0{?wJWUfu=Edy85}Sb4q9e0C9MGu>b%7 literal 0 HcmV?d00001 diff --git a/koha-tmpl/intranet-tmpl/prog/img/datatables/sort_desc_disabled.png b/koha-tmpl/intranet-tmpl/prog/img/datatables/sort_desc_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..2409653dc94cd21a281a31c0e3819323b84704b7 GIT binary patch literal 251 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S3?yCqj{O5tEa{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=)2l#}z{`>du$&)AV-@pIyd9;k)4B*-rq$b|z2+ZRf0KnX`r z7srr_TS*TNvhX;E^>j)zMNBv%VR68zN24n8K+>5N&kUJbBQCy4c=qgBiu3mAQ)hD? n)_oJhGvi(If!Apb49pB3GXz|UGFKJ=4P)?h^>bP0l+XkK*57ji literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/en/css/datatables.css b/koha-tmpl/opac-tmpl/prog/en/css/datatables.css new file mode 100644 index 0000000000..e069b93535 --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/css/datatables.css @@ -0,0 +1,114 @@ +input.search_init { + color: #999999; +} +.sorting_asc { + padding-right: 19px; + background: url("../../img/datatables/sort_asc.png") no-repeat scroll right center #EEEEEE; +} +.sorting_desc { + padding-right: 19px; + background: url("../../img/datatables/sort_desc.png") no-repeat scroll right center #EEEEEE; +} +.sorting { + padding-right: 19px; + background: url("../../img/datatables/sort_both.png") no-repeat scroll right center #EEEEEE; +} +.sorting_asc_disabled { + padding-right: 19px; + background: url("../../img/datatables/sort_asc_disabled.png") no-repeat scroll right center #EEEEEE; +} +.sorting_desc_disabled { + padding-right: 19px; + background: url("../../img/datatables/sort_desc_disabled.png") no-repeat scroll right center #EEEEEE; +} +.sorting_disabled { + padding-right: 19px; + background-color: #EEEEEE; +} + +table.display { + width: 100%; +} +table.display thead th { + border-bottom: 1px solid black; + cursor: pointer; + font-weight: bold; + padding: 3px 18px 3px 10px; +} +.dataTables_wrapper { + clear: both; + position: relative; +} +.dataTables_processing { + background-color: white; + border: 1px solid #DDDDDD; + color: #999999; + font-size: 14px; + height: 30px; + left: 50%; + margin-left: -125px; + margin-top: -15px; + padding: 14px 0 2px; + position: fixed; + text-align: center; + top: 50%; + width: 250px; +} +.dataTables_info { + float: left; + width: 60%; +} +.dataTables_paginate { + float: right; + text-align: right; + width: 44px; +} +.paging_full_numbers { + height: 22px; + line-height: 22px; + width: 400px; +} +.paging_full_numbers span.paginate_button, + .paging_full_numbers span.paginate_active { + border: 1px solid #aaa; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + padding: 2px 5px; + margin: 0 3px; + cursor: pointer; + *cursor: hand; +} + +.paging_full_numbers span.paginate_button { + background-color: #ddd; +} + +.paging_full_numbers span.paginate_button:hover { + background-color: #ccc; +} + +.paging_full_numbers span.paginate_active { + background-color: #99B3FF; +} +.paginate_disabled_previous, .paginate_enabled_previous, .paginate_disabled_next, .paginate_enabled_next { + float: left; + height: 19px; + margin-left: 3px; + width: 19px; +} +.paginate_disabled_previous { + background-image: url("../../img/datatables/back_disabled.jpg"); +} +.paginate_enabled_previous { + background-image: url("../../img/datatables/back_enabled.jpg"); +} +.paginate_disabled_next { + background-image: url("../../img/datatables/forward_disabled.jpg"); +} +.paginate_enabled_next { + background-image: url("../../img/datatables/forward_enabled.jpg"); +} +.spacer { + clear: both; + height: 20px; +} diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/datatables-strings.inc b/koha-tmpl/opac-tmpl/prog/en/includes/datatables-strings.inc new file mode 100644 index 0000000000..183f511df5 --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/includes/datatables-strings.inc @@ -0,0 +1,17 @@ + diff --git a/koha-tmpl/opac-tmpl/prog/en/js/datatables.js b/koha-tmpl/opac-tmpl/prog/en/js/datatables.js new file mode 100644 index 0000000000..38dd1d5ed1 --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/js/datatables.js @@ -0,0 +1,281 @@ +// These default options are for translation but can be used +// for any other datatables settings +// MSG_DT_* variables comes from datatables-strings.inc +// To use it, write: +// $("#table_id").dataTable($.extend(true, {}, dataTableDefaults, { +// // other settings +// } ) ); +var dataTablesDefaults = { + "oLanguage": { + "oPaginate": { + "sFirst" : window.MSG_DT_FIRST || "First", + "sLast" : window.MSG_DT_LAST || "Last", + "sNext" : window.MSG_DT_NEXT || "Next", + "sPrevious" : window.MSG_DT_PREVIOUS || "Previous" + }, + "sEmptyTable" : window.MSG_DT_EMPTY_TABLE || "No data available in table", + "sInfo" : window.MSG_DT_INFO || "Showing _START_ to _END_ of _TOTAL_ entries", + "sInfoEmpty" : window.MSG_DT_INFO_EMPTY || "No entries to show", + "sInfoFiltered" : window.MSG_DT_INFO_FILTERED || "(filtered from _MAX_ total entries)", + "sLengthMenu" : window.MSG_DT_LENGTH_MENU || "Show _MENU_ entries", + "sLoadingRecords" : window.MSG_DT_LOADING_RECORDS || "Loading...", + "sProcessing" : window.MSG_DT_PROCESSING || "Processing...", + "sSearch" : window.MSG_DT_SEARCH || "Search:", + "sZeroRecords" : window.MSG_DT_ZERO_RECORDS || "No matching records found" + } +}; + + +// Return an array of string containing the values of a particular column +$.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) { + // check that we have a column id + if ( typeof iColumn == "undefined" ) return new Array(); + // by default we only wany unique data + if ( typeof bUnique == "undefined" ) bUnique = true; + // by default we do want to only look at filtered data + if ( typeof bFiltered == "undefined" ) bFiltered = true; + // by default we do not wany to include empty values + if ( typeof bIgnoreEmpty == "undefined" ) bIgnoreEmpty = true; + // list of rows which we're going to loop through + var aiRows; + // use only filtered rows + if (bFiltered == true) aiRows = oSettings.aiDisplay; + // use all rows + else aiRows = oSettings.aiDisplayMaster; // all row numbers + + // set up data array + var asResultData = new Array(); + for (var i=0,c=aiRows.length; i -1) continue; + // else push the value onto the result data array + else asResultData.push(sValue); + } + return asResultData; +} + +// List of unbind keys (Ctrl, Alt, Direction keys, etc.) +// These keys must not launch filtering +var blacklist_keys = new Array(0, 16, 17, 18, 37, 38, 39, 40); + +// Set a filtering delay for global search field +jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay = function ( oSettings, iDelay ) { + /* + * Inputs: object:oSettings - dataTables settings object - automatically given + * integer:iDelay - delay in milliseconds + * Usage: $('#example').dataTable().fnSetFilteringDelay(250); + * Author: Zygimantas Berziunas (www.zygimantas.com) and Allan Jardine + * License: GPL v2 or BSD 3 point style + * Contact: zygimantas.berziunas /AT\ hotmail.com + */ + var + _that = this, + iDelay = (typeof iDelay == 'undefined') ? 250 : iDelay; + + this.each( function ( i ) { + $.fn.dataTableExt.iApiIndex = i; + var + $this = this, + oTimerId = null, + sPreviousSearch = null, + anControl = $( 'input', _that.fnSettings().aanFeatures.f ); + + anControl.unbind( 'keyup.DT' ).bind( 'keyup.DT', function(event) { + var $$this = $this; + if (blacklist_keys.indexOf(event.keyCode) != -1) { + return this; + }else if ( event.keyCode == '13' ) { + $.fn.dataTableExt.iApiIndex = i; + _that.fnFilter( $(this).val() ); + } else { + if (sPreviousSearch === null || sPreviousSearch != anControl.val()) { + window.clearTimeout(oTimerId); + sPreviousSearch = anControl.val(); + oTimerId = window.setTimeout(function() { + $.fn.dataTableExt.iApiIndex = i; + _that.fnFilter( anControl.val() ); + }, iDelay); + } + } + }); + + return this; + } ); + return this; +} + +// Add a filtering delay on general search and on all input (with a class 'filter') +jQuery.fn.dataTableExt.oApi.fnAddFilters = function ( oSettings, sClass, iDelay ) { + var table = this; + this.fnSetFilteringDelay(iDelay); + var filterTimerId = null; + $("input."+sClass).keyup(function(event) { + if (blacklist_keys.indexOf(event.keyCode) != -1) { + return this; + }else if ( event.keyCode == '13' ) { + table.fnFilter( $(this).val(), $(this).attr('data-column_num') ); + } else { + window.clearTimeout(filterTimerId); + var input = this; + filterTimerId = window.setTimeout(function() { + table.fnFilter($(input).val(), $(input).attr('data-column_num')); + }, iDelay); + } + }); +} + +// Useful if you want to filter on dates with 2 inputs (start date and end date) +// You have to include calendar.inc to use it +function dt_add_rangedate_filter(begindate_id, enddate_id, dateCol) { + $.fn.dataTableExt.afnFiltering.push( + function( oSettings, aData, iDataIndex ) { + + var beginDate = Date_from_syspref($("#"+begindate_id).val()).getTime(); + var endDate = Date_from_syspref($("#"+enddate_id).val()).getTime(); + + var data = Date_from_syspref(aData[dateCol]).getTime(); + + if ( !parseInt(beginDate) && ! parseInt(endDate) ) { + return true; + } + else if ( beginDate <= data && !parseInt(endDate) ) { + return true; + } + else if ( data <= endDate && !parseInt(beginDate) ) { + return true; + } + else if ( beginDate <= data && data <= endDate) { + return true; + } + return false; + } + ); +} + +//Sorting for dates (uk format) +function dt_add_type_uk_date() { + jQuery.fn.dataTableExt.aTypes.unshift( + function ( sData ) + { + if (sData.match(/(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[012])\/(19|20|21)\d\d/)) + { + return 'uk_date'; + } + return null; + } + ); + + jQuery.fn.dataTableExt.oSort['uk_date-asc'] = function(a,b) { + var re = /(\d{2}\/\d{2}\/\d{4})/; + a.match(re); + var ukDatea = RegExp.$1.split("/"); + b.match(re); + var ukDateb = RegExp.$1.split("/"); + + var x = (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1; + var y = (ukDateb[2] + ukDateb[1] + ukDateb[0]) * 1; + + return ((x < y) ? -1 : ((x > y) ? 1 : 0)); + }; + + jQuery.fn.dataTableExt.oSort['uk_date-desc'] = function(a,b) { + var re = /(\d{2}\/\d{2}\/\d{4})/; + a.match(re); + var ukDatea = RegExp.$1.split("/"); + b.match(re); + var ukDateb = RegExp.$1.split("/"); + + var x = (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1; + var y = (ukDateb[2] + ukDateb[1] + ukDateb[0]) * 1; + + return ((x < y) ? 1 : ((x > y) ? -1 : 0)); + }; +} + +// Sorting on html contains +// bar sort on 'bar' +function dt_overwrite_html_sorting_localeCompare() { + jQuery.fn.dataTableExt.oSort['html-asc'] = function(a,b) { + a = a.replace(/<.*?>/g, "").replace(/\s+/g, " "); + b = b.replace(/<.*?>/g, "").replace(/\s+/g, " "); + if (typeof(a.localeCompare == "function")) { + return a.localeCompare(b); + } else { + return (a > b) ? 1 : ((a < b) ? -1 : 0); + } + }; + + jQuery.fn.dataTableExt.oSort['html-desc'] = function(a,b) { + a = a.replace(/<.*?>/g, "").replace(/\s+/g, " "); + b = b.replace(/<.*?>/g, "").replace(/\s+/g, " "); + if(typeof(b.localeCompare == "function")) { + return b.localeCompare(a); + } else { + return (b > a) ? 1 : ((b < a) ? -1 : 0); + } + }; +} + +// Sorting on string without accentued characters +function dt_overwrite_string_sorting_localeCompare() { + jQuery.fn.dataTableExt.oSort['string-asc'] = function(a,b) { + a = a.replace(/<.*?>/g, "").replace(/\s+/g, " "); + b = b.replace(/<.*?>/g, "").replace(/\s+/g, " "); + if (typeof(a.localeCompare == "function")) { + return a.localeCompare(b); + } else { + return (a > b) ? 1 : ((a < b) ? -1 : 0); + } + }; + + jQuery.fn.dataTableExt.oSort['string-desc'] = function(a,b) { + a = a.replace(/<.*?>/g, "").replace(/\s+/g, " "); + b = b.replace(/<.*?>/g, "").replace(/\s+/g, " "); + if(typeof(b.localeCompare == "function")) { + return b.localeCompare(a); + } else { + return (b > a) ? 1 : ((b < a) ? -1 : 0); + } + }; +} + +// Replace a node with a html and js contain. +function replace_html( original_node, type ) { + switch ( $(original_node).attr('data-type') ) { + case "range_dates": + var id = $(original_node).attr("data-id"); + var format = $(original_node).attr("data-format"); + replace_html_date( original_node, id, format ); + break; + default: + alert("_(This node can't be replaced)"); + } +} + +// Replace a node with a "From [date] To [date]" element +// Used on tfoot > td +function replace_html_date( original_node, id, format ) { + var node = $('' + _("From") + '×
' + _("To") + '×'); + $(original_node).replaceWith(node); + var script = document.createElement( 'script' ); + script.type = 'text/javascript'; + var script_content = "Calendar.setup({"; + script_content += " inputField: \"" + id + "from\","; + script_content += " ifFormat: \"" + format + "\","; + script_content += " button: \"" + id + "from\","; + script_content += " onClose: function(){ $(\"#" + id + "from\").change(); this.hide();}"; + script_content += " });"; + script_content += " Calendar.setup({"; + script_content += " inputField: \"" + id + "to\","; + script_content += " ifFormat: \"" + format + "\","; + script_content += " button: \"" + id + "to\","; + script_content += " onClose: function(){ $(\"#" + id + "to\").change(); this.hide();}"; + script_content += " });"; + script.text = script_content; + $(original_node).append( script ); +} diff --git a/koha-tmpl/opac-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js b/koha-tmpl/opac-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js new file mode 100644 index 0000000000..771c00ba06 --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js @@ -0,0 +1,153 @@ +/* + * File: jquery.dataTables.min.js + * Version: 1.8.1 + * Author: Allan Jardine (www.sprymedia.co.uk) + * Info: www.datatables.net + * + * Copyright 2008-2010 Allan Jardine, all rights reserved. + * + * This source file is free software, under either the GPL v2 license or a + * BSD style license, available at: + * http://datatables.net/license_gpl2 + * http://datatables.net/license_bsd + * + * This source file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. + */ +(function(i,wa,p){i.fn.dataTableSettings=[];var D=i.fn.dataTableSettings;i.fn.dataTableExt={};var o=i.fn.dataTableExt;o.sVersion="1.8.1";o.sErrMode="alert";o.iApiIndex=0;o.oApi={};o.afnFiltering=[];o.aoFeatures=[];o.ofnSearch={};o.afnSortData=[];o.oStdClasses={sPagePrevEnabled:"paginate_enabled_previous",sPagePrevDisabled:"paginate_disabled_previous",sPageNextEnabled:"paginate_enabled_next",sPageNextDisabled:"paginate_disabled_next",sPageJUINext:"",sPageJUIPrev:"",sPageButton:"paginate_button",sPageButtonActive:"paginate_active", +sPageButtonStaticDisabled:"paginate_button paginate_button_disabled",sPageFirst:"first",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled", +sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:""};o.oJUIClasses={sPagePrevEnabled:"fg-button ui-button ui-state-default ui-corner-left", +sPagePrevDisabled:"fg-button ui-button ui-state-default ui-corner-left ui-state-disabled",sPageNextEnabled:"fg-button ui-button ui-state-default ui-corner-right",sPageNextDisabled:"fg-button ui-button ui-state-default ui-corner-right ui-state-disabled",sPageJUINext:"ui-icon ui-icon-circle-arrow-e",sPageJUIPrev:"ui-icon ui-icon-circle-arrow-w",sPageButton:"fg-button ui-button ui-state-default",sPageButtonActive:"fg-button ui-button ui-state-default ui-state-disabled",sPageButtonStaticDisabled:"fg-button ui-button ui-state-default ui-state-disabled", +sPageFirst:"first ui-corner-tl ui-corner-bl",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last ui-corner-tr ui-corner-br",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"ui-state-default",sSortDesc:"ui-state-default",sSortable:"ui-state-default", +sSortableAsc:"ui-state-default",sSortableDesc:"ui-state-default",sSortableNone:"ui-state-default",sSortColumn:"sorting_",sSortJUIAsc:"css_right ui-icon ui-icon-triangle-1-n",sSortJUIDesc:"css_right ui-icon ui-icon-triangle-1-s",sSortJUI:"css_right ui-icon ui-icon-carat-2-n-s",sSortJUIAscAllowed:"css_right ui-icon ui-icon-carat-1-n",sSortJUIDescAllowed:"css_right ui-icon ui-icon-carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",sScrollWrapper:"dataTables_scroll", +sScrollHead:"dataTables_scrollHead ui-state-default",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot ui-state-default",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:"ui-state-default"};o.oPagination={two_button:{fnInit:function(g,l,r){var s,w,y;if(g.bJUI){s=p.createElement("a");w=p.createElement("a");y=p.createElement("span");y.className=g.oClasses.sPageJUINext;w.appendChild(y);y=p.createElement("span");y.className=g.oClasses.sPageJUIPrev; +s.appendChild(y)}else{s=p.createElement("div");w=p.createElement("div")}s.className=g.oClasses.sPagePrevDisabled;w.className=g.oClasses.sPageNextDisabled;s.title=g.oLanguage.oPaginate.sPrevious;w.title=g.oLanguage.oPaginate.sNext;l.appendChild(s);l.appendChild(w);i(s).bind("click.DT",function(){g.oApi._fnPageChange(g,"previous")&&r(g)});i(w).bind("click.DT",function(){g.oApi._fnPageChange(g,"next")&&r(g)});i(s).bind("selectstart.DT",function(){return false});i(w).bind("selectstart.DT",function(){return false}); +if(g.sTableId!==""&&typeof g.aanFeatures.p=="undefined"){l.setAttribute("id",g.sTableId+"_paginate");s.setAttribute("id",g.sTableId+"_previous");w.setAttribute("id",g.sTableId+"_next")}},fnUpdate:function(g){if(g.aanFeatures.p)for(var l=g.aanFeatures.p,r=0,s=l.length;r=w-s){s=w-r+1;x=w}else{s=y-Math.ceil(r/2)+1;x=s+r-1}for(r=s;r<=x;r++)G+=y!=r?''+r+"":''+r+"";x=g.aanFeatures.p;var z,Y=function(L){g._iDisplayStart=(this.innerHTML*1-1)*g._iDisplayLength;l(g);L.preventDefault()},V=function(){return false};r=0;for(s=x.length;rl?1:0},"string-desc":function(g,l){if(typeof g!="string")g="";if(typeof l!="string")l="";g=g.toLowerCase();l=l.toLowerCase();return gl?-1:0},"html-asc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return g< +l?-1:g>l?1:0},"html-desc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return gl?-1:0},"date-asc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return g-l},"date-desc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return l- +g},"numeric-asc":function(g,l){return(g=="-"||g===""?0:g*1)-(l=="-"||l===""?0:l*1)},"numeric-desc":function(g,l){return(l=="-"||l===""?0:l*1)-(g=="-"||g===""?0:g*1)}};o.aTypes=[function(g){if(typeof g=="number")return"numeric";else if(typeof g!="string")return null;var l,r=false;l=g.charAt(0);if("0123456789-".indexOf(l)==-1)return null;for(var s=1;s")!=-1)return"html";return null}];o.fnVersionCheck=function(g){var l=function(x,v){for(;x.length=parseInt(w,10)};o._oExternConfig={iNextUnique:0};i.fn.dataTable=function(g){function l(){this.fnRecordsTotal= +function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsTotal,10):this.aiDisplayMaster.length};this.fnRecordsDisplay=function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsDisplay,10):this.aiDisplay.length};this.fnDisplayEnd=function(){return this.oFeatures.bServerSide?this.oFeatures.bPaginate===false||this._iDisplayLength==-1?this._iDisplayStart+this.aiDisplay.length:Math.min(this._iDisplayStart+this._iDisplayLength,this._iRecordsDisplay):this._iDisplayEnd};this.sInstance= +this.oInstance=null;this.oFeatures={bPaginate:true,bLengthChange:true,bFilter:true,bSort:true,bInfo:true,bAutoWidth:true,bProcessing:false,bSortClasses:true,bStateSave:false,bServerSide:false,bDeferRender:false};this.oScroll={sX:"",sXInner:"",sY:"",bCollapse:false,bInfinite:false,iLoadGap:100,iBarWidth:0,bAutoCss:true};this.aanFeatures=[];this.oLanguage={sProcessing:"Processing...",sLengthMenu:"Show _MENU_ entries",sZeroRecords:"No matching records found",sEmptyTable:"No data available in table", +sLoadingRecords:"Loading...",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sSearch:"Search:",sUrl:"",oPaginate:{sFirst:"First",sPrevious:"Previous",sNext:"Next",sLast:"Last"},fnInfoCallback:null};this.aoData=[];this.aiDisplay=[];this.aiDisplayMaster=[];this.aoColumns=[];this.aoHeader=[];this.aoFooter=[];this.iNextId=0;this.asDataSearch=[];this.oPreviousSearch={sSearch:"",bRegex:false, +bSmart:true};this.aoPreSearchCols=[];this.aaSorting=[[0,"asc",0]];this.aaSortingFixed=null;this.asStripClasses=[];this.asDestoryStrips=[];this.sDestroyWidth=0;this.fnFooterCallback=this.fnHeaderCallback=this.fnRowCallback=null;this.aoDrawCallback=[];this.fnInitComplete=this.fnPreDrawCallback=null;this.sTableId="";this.nTableWrapper=this.nTBody=this.nTFoot=this.nTHead=this.nTable=null;this.bInitialised=this.bDeferLoading=false;this.aoOpenRows=[];this.sDom="lfrtip";this.sPaginationType="two_button"; +this.iCookieDuration=7200;this.sCookiePrefix="SpryMedia_DataTables_";this.fnCookieCallback=null;this.aoStateSave=[];this.aoStateLoad=[];this.sAjaxSource=this.oLoadedState=null;this.sAjaxDataProp="aaData";this.bAjaxDataGet=true;this.jqXHR=null;this.fnServerData=function(a,b,c,d){d.jqXHR=i.ajax({url:a,data:b,success:c,dataType:"json",cache:false,error:function(f,e){e=="parsererror"&&alert("DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.")}})}; +this.fnFormatNumber=function(a){if(a<1E3)return a;else{var b=a+"";a=b.split("");var c="";b=b.length;for(var d=0;dtr>th",a.nTFoot).addClass(a.oClasses.sFooterTH);if(a.nTFoot!==null){c=S(a,null,a.aoFooter);b=0;for(d=a.aoColumns.length;b=0;e--)!a.aoColumns[e].bVisible&&!c&&h[d].splice(e,1);j.push([])}d=0;for(f=h.length;d=a.fnRecordsDisplay()?0:a.iInitDisplayStart;a.iInitDisplayStart=-1;E(a)}if(a.bDeferLoading){a.bDeferLoading=false;a.iDraw++}else if(a.oFeatures.bServerSide){if(!a.bDestroying&&!za(a))return}else a.iDraw++;if(a.aiDisplay.length!==0){var h=a._iDisplayStart,j=a._iDisplayEnd;if(a.oFeatures.bServerSide){h=0;j=a.aoData.length}for(h=h;htr",a.nTHead)[0],aa(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);typeof a.fnFooterCallback== +"function"&&a.fnFooterCallback.call(a.oInstance,i(">tr",a.nTFoot)[0],aa(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);f=p.createDocumentFragment();b=p.createDocumentFragment();if(a.nTBody){e=a.nTBody.parentNode;b.appendChild(a.nTBody);if(!a.oScroll.bInfinite||!a._bInitComplete||a.bSorted||a.bFiltered){c=a.nTBody.childNodes;for(b=c.length-1;b>=0;b--)c[b].parentNode.removeChild(c[b])}b=0;for(c=d.length;b=0;b--)a.aoDrawCallback[b].fn.call(a.oInstance,a);a.bSorted=false;a.bFiltered=false;a.bDrawing=false;if(a.oFeatures.bServerSide){K(a,false);typeof a._bInitComplete=="undefined"&&w(a)}}}function ba(a){if(a.oFeatures.bSort)R(a,a.oPreviousSearch);else if(a.oFeatures.bFilter)M(a,a.oPreviousSearch);else{E(a);C(a)}}function za(a){if(a.bAjaxDataGet){K(a,true);var b=a.aoColumns.length,c=[],d,f;a.iDraw++;c.push({name:"sEcho",value:a.iDraw});c.push({name:"iColumns",value:b});c.push({name:"sColumns",value:ha(a)}); +c.push({name:"iDisplayStart",value:a._iDisplayStart});c.push({name:"iDisplayLength",value:a.oFeatures.bPaginate!==false?a._iDisplayLength:-1});for(f=0;f")c=c.parentNode;else if(h=="l"&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange){f=Ca(a);e=1}else if(h=="f"&&a.oFeatures.bFilter){f=Da(a);e=1}else if(h=="r"&&a.oFeatures.bProcessing){f=Ea(a);e=1}else if(h=="t"){f=Fa(a);e=1}else if(h=="i"&&a.oFeatures.bInfo){f=Ga(a);e=1}else if(h=="p"&&a.oFeatures.bPaginate){f=Ha(a);e=1}else if(o.aoFeatures.length!== +0){j=o.aoFeatures;t=0;for(k=j.length;tcaption",a.nTable);h=0;for(k=d.length;hi(a.nTable).height()-a.oScroll.iLoadGap)if(a.fnDisplayEnd()0&&a.nTable.removeChild(h[0]);if(a.nTFoot!==null){k=a.nTable.getElementsByTagName("tfoot");k.length>0&&a.nTable.removeChild(k[0])}h=a.nTHead.cloneNode(true);a.nTable.insertBefore(h,a.nTable.childNodes[0]);if(a.nTFoot!==null){k=a.nTFoot.cloneNode(true); +a.nTable.insertBefore(k,a.nTable.childNodes[1])}if(a.oScroll.sX===""){d.style.width="100%";b.parentNode.style.width="100%"}var O=S(a,h);f=0;for(e=O.length;ff-a.oScroll.iBarWidth)a.nTable.style.width=u(f)}else a.nTable.style.width=u(f);f=i(a.nTable).outerWidth();if(a.oScroll.sX===""){d.style.width=u(f+a.oScroll.iBarWidth);b.parentNode.style.width=u(f+a.oScroll.iBarWidth)}e=a.nTHead.getElementsByTagName("tr");h=h.getElementsByTagName("tr");P(function(B,F){m=B.style;m.paddingTop= +"0";m.paddingBottom="0";m.borderTopWidth="0";m.borderBottomWidth="0";m.height=0;q=i(B).width();F.style.width=u(q);I.push(q)},h,e);i(h).height(0);if(a.nTFoot!==null){j=k.getElementsByTagName("tr");k=a.nTFoot.getElementsByTagName("tr");P(function(B,F){m=B.style;m.paddingTop="0";m.paddingBottom="0";m.borderTopWidth="0";m.borderBottomWidth="0";m.height=0;q=i(B).width();F.style.width=u(q);I.push(q)},j,k);i(j).height(0)}P(function(B){B.innerHTML="";B.style.width=u(I.shift())},h);a.nTFoot!==null&&P(function(B){B.innerHTML= +"";B.style.width=u(I.shift())},j);if(i(a.nTable).outerWidth()d.offsetWidth?a.oScroll.iBarWidth:0;if(a.nTable.offsetHeight'):b===""?'':b+' '; +var c=p.createElement("div");c.className=a.oClasses.sFilter;c.innerHTML="";a.sTableId!==""&&typeof a.aanFeatures.f=="undefined"&&c.setAttribute("id",a.sTableId+"_filter");b=i("input",c);b.val(a.oPreviousSearch.sSearch.replace('"',"""));b.bind("keyup.DT",function(){for(var d=a.aanFeatures.f,f=0,e=d.length;f=0;d--){f=ma(H(a,a.aiDisplay[d],c,"filter"),a.aoColumns[c].sType);if(!b.test(f)){a.aiDisplay.splice(d,1);e++}}}}function Ka(a,b,c,d,f){var e=la(b,d,f);if(typeof c=="undefined"||c===null)c=0;if(o.afnFiltering.length!==0)c=1;if(b.length<=0){a.aiDisplay.splice(0,a.aiDisplay.length);a.aiDisplay=a.aiDisplayMaster.slice()}else if(a.aiDisplay.length==a.aiDisplayMaster.length||a.oPreviousSearch.sSearch.length> +b.length||c==1||b.indexOf(a.oPreviousSearch.sSearch)!==0){a.aiDisplay.splice(0,a.aiDisplay.length);ka(a,1);for(c=0;c/g,"");else if(typeof a=="string")return a.replace(/\n/g," ");else if(a===null)return"";return a}function R(a,b){var c,d,f,e,h=[],j=[],k=o.oSort;d=a.aoData;var m=a.aoColumns;if(!a.oFeatures.bServerSide&&(a.aaSorting.length!==0||a.aaSortingFixed!==null)){h=a.aaSortingFixed!== +null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(c=0;c=h)for(b=0;b=0?a._iDisplayStart-a._iDisplayLength:0;if(a._iDisplayStart<0)a._iDisplayStart=0}else if(b=="next")if(a._iDisplayLength>=0){if(a._iDisplayStart+a._iDisplayLength=0){b=parseInt((a.fnRecordsDisplay()-1)/a._iDisplayLength,10)+1;a._iDisplayStart=(b-1)*a._iDisplayLength}else a._iDisplayStart= +0;else J(a,0,"Unknown paging action: "+b);return c!=a._iDisplayStart}function Ga(a){var b=p.createElement("div");b.className=a.oClasses.sInfo;if(typeof a.aanFeatures.i=="undefined"){a.aoDrawCallback.push({fn:Na,sName:"information"});a.sTableId!==""&&b.setAttribute("id",a.sTableId+"_info")}return b}function Na(a){if(!(!a.oFeatures.bInfo||a.aanFeatures.i.length===0)){var b=a._iDisplayStart+1,c=a.fnDisplayEnd(),d=a.fnRecordsTotal(),f=a.fnRecordsDisplay(),e=a.fnFormatNumber(b),h=a.fnFormatNumber(c),j= +a.fnFormatNumber(d),k=a.fnFormatNumber(f);if(a.oScroll.bInfinite)e=a.fnFormatNumber(1);e=a.fnRecordsDisplay()===0&&a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfoEmpty+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()===0?a.oLanguage.sInfoEmpty+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",j)+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfo.replace("_START_",e).replace("_END_",h).replace("_TOTAL_",k)+a.oLanguage.sInfoPostFix:a.oLanguage.sInfo.replace("_START_", +e).replace("_END_",h).replace("_TOTAL_",k)+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+a.oLanguage.sInfoPostFix;if(a.oLanguage.fnInfoCallback!==null)e=a.oLanguage.fnInfoCallback(a,b,c,d,f,e);a=a.aanFeatures.i;b=0;for(c=a.length;b",c,d;if(a.aLengthMenu.length==2&&typeof a.aLengthMenu[0]=="object"&&typeof a.aLengthMenu[1]== +"object"){c=0;for(d=a.aLengthMenu[0].length;c'+a.aLengthMenu[1][c]+""}else{c=0;for(d=a.aLengthMenu.length;c'+a.aLengthMenu[c]+""}b+="";var f=p.createElement("div");a.sTableId!==""&&typeof a.aanFeatures.l=="undefined"&&f.setAttribute("id",a.sTableId+"_length");f.className=a.oClasses.sLength;f.innerHTML="";i('select option[value="'+ +a._iDisplayLength+'"]',f).attr("selected",true);i("select",f).bind("change.DT",function(){var e=i(this).val(),h=a.aanFeatures.l;c=0;for(d=h.length;ca.aiDisplay.length|| +a._iDisplayLength==-1?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}function Oa(a,b){if(!a||a===null||a==="")return 0;if(typeof b=="undefined")b=p.getElementsByTagName("body")[0];var c=p.createElement("div");c.style.width=u(a);b.appendChild(c);a=c.offsetWidth;b.removeChild(c);return a}function ea(a){var b=0,c,d=0,f=a.aoColumns.length,e,h=i("th",a.nTHead);for(e=0;etd",b);h=S(a,e);for(e=d=0;e0)a.aoColumns[e].sWidth=u(c);d++}a.nTable.style.width=u(i(b).outerWidth());b.parentNode.removeChild(b)}}function Qa(a,b){if(a.oScroll.sX===""&&a.oScroll.sY!==""){i(b).width();b.style.width=u(i(b).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sX!=="")b.style.width=u(i(b).outerWidth())}function Pa(a,b){var c= +Ra(a,b);if(c<0)return null;if(a.aoData[c].nTr===null){var d=p.createElement("td");d.innerHTML=H(a,c,b,"");return d}return Q(a,c)[b]}function Ra(a,b){for(var c=-1,d=-1,f=0;f/g,"");if(e.length>c){c=e.length;d=f}}return d}function u(a){if(a===null)return"0px";if(typeof a=="number"){if(a<0)return"0px";return a+"px"}var b=a.charCodeAt(a.length-1);if(b<48||b>57)return a;return a+"px"}function Va(a,b){if(a.length!=b.length)return 1;for(var c= +0;cb&&a[d]--;c!=-1&&a.splice(c,1)}function Ba(a,b){b=b.split(",");for(var c=[],d=0,f=a.aoColumns.length;d4096){a=p.cookie.split(";");for(var j=0,k=a.length;j=d.aiDisplay.length){d._iDisplayStart-=d._iDisplayLength;if(d._iDisplayStart<0)d._iDisplayStart=0}if(typeof c=="undefined"||c){E(d);C(d)}return f};this.fnClearTable=function(a){var b=A(this[o.iApiIndex]);ia(b);if(typeof a=="undefined"||a)C(b)};this.fnOpen=function(a,b,c){var d=A(this[o.iApiIndex]);this.fnClose(a);var f=p.createElement("tr"),e=p.createElement("td");f.appendChild(e);e.className=c;e.colSpan=X(d);if(typeof b.jquery!="undefined"||typeof b== +"object")e.appendChild(b);else e.innerHTML=b;b=i("tr",d.nTBody);i.inArray(a,b)!=-1&&i(f).insertAfter(a);d.aoOpenRows.push({nTr:f,nParent:a});return f};this.fnClose=function(a){for(var b=A(this[o.iApiIndex]),c=0;c=X(d);if(!j)for(f=a;ftr>td."+a.oClasses.sRowEmpty,a.nTable).parent().remove();if(a.nTable!=a.nTHead.parentNode){i(">thead",a.nTable).remove();a.nTable.appendChild(a.nTHead)}if(a.nTFoot&& +a.nTable!=a.nTFoot.parentNode){i(">tfoot",a.nTable).remove();a.nTable.appendChild(a.nTFoot)}a.nTable.parentNode.removeChild(a.nTable);i(a.nTableWrapper).remove();a.aaSorting=[];a.aaSortingFixed=[];T(a);i($(a)).removeClass(a.asStripClasses.join(" "));if(a.bJUI){i("th",a.nTHead).removeClass([o.oStdClasses.sSortable,o.oJUIClasses.sSortableAsc,o.oJUIClasses.sSortableDesc,o.oJUIClasses.sSortableNone].join(" "));i("th span."+o.oJUIClasses.sSortIcon,a.nTHead).remove();i("th",a.nTHead).each(function(){var e= +i("div."+o.oJUIClasses.sSortJUIWrapper,this),h=e.contents();i(this).append(h);e.remove()})}else i("th",a.nTHead).removeClass([o.oStdClasses.sSortable,o.oStdClasses.sSortableAsc,o.oStdClasses.sSortableDesc,o.oStdClasses.sSortableNone].join(" "));a.nTableReinsertBefore?b.insertBefore(a.nTable,a.nTableReinsertBefore):b.appendChild(a.nTable);d=0;for(f=a.aoData.length;dtr:even",c).addClass(a.asDestoryStrips[0]);i(">tr:odd",c).addClass(a.asDestoryStrips[1]);d=0;for(f=D.length;dt<"F"ip>'}if(e.oScroll.sX!==""||e.oScroll.sY!=="")e.oScroll.iBarWidth=Ua();if(typeof g.iDisplayStart!="undefined"&&typeof e.iInitDisplayStart=="undefined"){e.iInitDisplayStart= +g.iDisplayStart;e._iDisplayStart=g.iDisplayStart}if(typeof g.bStateSave!="undefined"){e.oFeatures.bStateSave=g.bStateSave;Ta(e,g);e.aoDrawCallback.push({fn:sa,sName:"state_save"})}if(typeof g.iDeferLoading!="undefined"){e.bDeferLoading=true;e._iRecordsTotal=g.iDeferLoading;e._iRecordsDisplay=g.iDeferLoading}if(typeof g.aaData!="undefined")j=true;if(typeof g!="undefined"&&typeof g.aoData!="undefined")g.aoColumns=g.aoData;if(typeof g.oLanguage!="undefined")if(typeof g.oLanguage.sUrl!="undefined"&&g.oLanguage.sUrl!== +""){e.oLanguage.sUrl=g.oLanguage.sUrl;i.getJSON(e.oLanguage.sUrl,null,function(t){y(e,t,true)});h=true}else y(e,g.oLanguage,false)}else g={};if(typeof g.asStripClasses=="undefined"){e.asStripClasses.push(e.oClasses.sStripOdd);e.asStripClasses.push(e.oClasses.sStripEven)}c=false;d=i(">tbody>tr",this);a=0;for(b=e.asStripClasses.length;a=0;a--){var m=g.aoColumnDefs[a].aTargets;i.isArray(m)||J(e,1,"aTargets must be an array of targets, not a "+typeof m);c=0;for(d=m.length;c=0){for(;e.aoColumns.length<=m[c];)G(e);x(e,m[c],g.aoColumnDefs[a])}else if(typeof m[c]== +"number"&&m[c]<0)x(e,e.aoColumns.length+m[c],g.aoColumnDefs[a]);else if(typeof m[c]=="string"){b=0;for(f=e.aoColumns.length;b=e.aoColumns.length)e.aaSorting[a][0]=0;k=e.aoColumns[e.aaSorting[a][0]];if(typeof e.aaSorting[a][2]=="undefined")e.aaSorting[a][2]=0;if(typeof g.aaSorting=="undefined"&& +typeof e.saved_aaSorting=="undefined")e.aaSorting[a][1]=k.asSorting[0];c=0;for(d=k.asSorting.length;cthead",this);if(a.length===0){a=[p.createElement("thead")];this.appendChild(a[0])}e.nTHead=a[0];a=i(">tbody",this);if(a.length===0){a=[p.createElement("tbody")];this.appendChild(a[0])}e.nTBody=a[0];a=i(">tfoot",this);if(a.length>0){e.nTFoot=a[0];W(e.aoFooter,e.nTFoot)}if(j)for(a=0;aC5UDGKfoZ!!63{a%*-grz$D1XEXer(2tyUn z+02YUSHb}sD?0}l&^EXLguy7lz`(-H!phDIlVN0HVHIR%V-ON%S2Pq6HFFG{Xryc+ zmRQ($@S#&sld*HEn>dFcBLmQ_$YwDLDjGT#PW*q1fd^^;oX+iLI)z|@;wX;U8Xr> zT8Qgxn;R!Cottl}#(8Ri${a3d=J*$R5qBRbK9bRJe*4BYwq9(uIM4mLS9%TSY?*y6 zE==owYH)vf>dq6(Uzum+IyVJqc3N&dRPD57vW(=l(=(DZ-K_!LSx zwPk@>bN@4B-OI9gCf>Wc_;CDAS%c@BJZ}kBlbDz~@y-*&Y^_U+@};q`xNUthN} On^Cj9W}Eu@|2F})$f79# literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/datatables/back_enabled.jpg b/koha-tmpl/opac-tmpl/prog/images/datatables/back_enabled.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a6d764c79c7a2047b6bf65bf9d96fcafd5161e38 GIT binary patch literal 807 zcmex=C5UDGKfoZ!!63{a%*-grz$D1XEXer(2*U&h z1}0{pBN2d|gO!bok%5r~RhW^Pm5qg+Lx6#Sm5Gs^od+h%$i&RTD#*spplB#0EW!~u z(MZ`u)XXulu<_tSr=TWdXR%Z_aiE1jZ7eM8Fl&IpCkWK1$Y$s$#2&a&N#sM~M5iWU z<^Q)Bc$gW1&SMs2uxGfw`}E06etb^r9k|jMc@Dlk(IlSD-Wwx*G{%4ThHhR%HnTsw zbu3z!=BtbC=-In5f5nt;je{+vrKZdWckk$U`c^FEYC6}Jn=lG)17QB>6z3khm7PHhg<-pEGSO0F>VA}N6`w53!8pr$>MbUW| zMEsFn=(%w+^5v0yp7Lmb+~3PpI4(#G~bQ$y_;t)oo+U5`bnSHZcn){CH~m7Ys2rz z2!R@xgGrCtcPz?eOPOzKr2P26p~(mTGjR1-c3?psA>uUGsyt|R2Ts3~!B zN71DGSrW%W*`w8#2{O$LX)%%8*<4Ycyr;tN(Hm8|M=_HtvR>P P+Rcr(b5Xx$|NkZcT0jT? literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/datatables/forward_disabled.jpg b/koha-tmpl/opac-tmpl/prog/images/datatables/forward_disabled.jpg new file mode 100644 index 0000000000000000000000000000000000000000..28a9dc53fa232919299ac980dc9b61167c1868bd GIT binary patch literal 635 zcmex=C5UDGKfoZ!!63{a%*-grz$D1XEXer(2tySE z1JEp>E8&2Nm4%I+g9~UMTnNHo6kuRrVP;|B;)Y2uGBL9Vva&GlzGLeh=CM*_u2I6%$1L~6;-1yGa|?*FvavCW+Av>{Flt>+*?d?iZ`9)^O?_H|D3t8;Og6lD<#WHQvW(mo1ETsD>A@mr8@sqg(?1R z%d@qrmWLWmIn1#pQuo}{brVW*C8t%EDXbOt_DabwXgGW3;wDX1;~7hWrYL+ZX=qre z&-y^2q0zm?-FJb#(AWJTHOJ-3`S`D|JEhzC{KvY_h0kZinXP-?w!g_L@p#JQO^!z$ mYCgVwS7#SryXs@?>&L&t^Z(SozHVt~@Z#>58}s)6zX<@qORf(9 literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/datatables/forward_enabled.jpg b/koha-tmpl/opac-tmpl/prog/images/datatables/forward_enabled.jpg new file mode 100644 index 0000000000000000000000000000000000000000..598c075f13ab0e4bbe05a4eeea7cf777ba73cf03 GIT binary patch literal 852 zcmex=C5UDGKfoZ!!63{a%*-grz$D1XEXer(2tywO z0~0eN(3Nn&%Fe>Z!NthH$ciG&$iU3P%Em6hz`z1zu=B#yGcqx=2(q#<2(fb*3M-3< zDh5t8G7&R#Oe}1C=oHjs?40T*F37+LbR`oj+(bq}CT0c}Rz*W0Hg?Cv#)(EB0yioN zi~PUEzyov)lOVGogFVA5dn3uE%Z<*rn&ugY^FIG9<<=87L*?mOy^~u`Rq(Eg+UDw^ z@^Uh}zJ$t~P2YpRT#sm2p`oEt8zJ-EBRfY;>b?DxZo!24Z)Q(O&}!Mbt}27`dKa(x zr)AHkZg5MjKa&4$syaupXWNXgp32dQs_rj-?|M=Q9pN^hZg^mV7=UWs>}D5 z$40(ME7Q1T4h8p}ZJ8O!G-Xk84;P~#ci!&o`A5I3kG@gLm*VlJbn%kvSqIh?3Y?HQ zAX0NL>XIkpf=MN83*!%}9-aN5)p7^py2Am>F9gW&pFSp#V0dxX#ZPW;UoD(gaI@8E z(rNQz1DBIiM13!LtZ|85lHB@$wW~n0fhRz-$?R&m{@z;uI}N|35As;}zdXB<I#+N1k=r*G-&mI78vJ_Ezs!yIV%J}l7d*c9>7Bn;xyLT84V&`$ z@9WMTAJ6DZyR)~=FS6P2e3MDv7lHB>{C&1H^7EJ9PIf=EdUwUYtGE9%$X9(m*ZWLf M_rC2^{;K~s0TRp{r2qf` literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/datatables/sort_asc.png b/koha-tmpl/opac-tmpl/prog/images/datatables/sort_asc.png new file mode 100644 index 0000000000000000000000000000000000000000..a56d0e21902ce620cd57f87fa58a6d3e804135cf GIT binary patch literal 263 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S3?yCqj{O5tEa{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i>l2Ka=y{`vF&J9*~+_wWBdfBFCW_y37A{>@tOZ^^2EJ(K_a|Nno&o$%d2jr=7+e!)O45@5J; zXU0OHl&hzUV@SoVE9Xw~GAQscA1s)^?0*rXqM}DeLv7?|BU8z@QCOGupVzP9Hek5&L+Gnl%BD>~0~tJB{an^LB{Ts5b0m7= literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/datatables/sort_asc_disabled.png b/koha-tmpl/opac-tmpl/prog/images/datatables/sort_asc_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..b7e621ef1c68da839ce077cec6e201a55c1ba168 GIT binary patch literal 252 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S3?yCqj{O5tEa{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=)2l#}z{`>du$&)AV-@pIyd9;k)4B*-rq$b|z2+ZRf0KnW*L z7srr_TUXBQ7GeV6G?@}f$7k6Jhw{qGm$-QDzD`qrDaZ3s$b2XF;fBBPU nqjNDy&Nw~puHFA+-v&m8`?>-yUFVHK{$ucT^>bP0l+XkKhw^g= literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/datatables/sort_both.png b/koha-tmpl/opac-tmpl/prog/images/datatables/sort_both.png new file mode 100644 index 0000000000000000000000000000000000000000..839ac4bb5b0b414834c950de9deafff6dd94ed2d GIT binary patch literal 282 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S3?yCqj{O5tEa{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=)2l#}z{`>du$&)AV-@pIyd9;k)4B*-rq$b|z2+ZRf0K#2rT z7srr_TRjsz`4|*ASOSl%eg6Ob+(JtRwX|O@S}a^IESQCgTe~DWM4fR9b+X literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/datatables/sort_desc.png b/koha-tmpl/opac-tmpl/prog/images/datatables/sort_desc.png new file mode 100644 index 0000000000000000000000000000000000000000..90b295159df995329b3a84340d32761f3d1dbade GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S3?yCqj{O5tEa{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i>l2Ka=y{`vF&J9*~+_wWBdfBFCW_y37A{>@tOZ^^2EJ(K_a|Nno&o$%d2jr=7+e!)O45@5J; zXU0OHl#{26V@SoVqz8vtc$~v}dc~O{CLEF2anNavMpdMP)0v(X&o(k0opIq!LdvtJ wj~up7@0`wiSoe($&y07EkGxK6U|?nlJSz0{?wJWUfu=Edy85}Sb4q9e0C9MGu>b%7 literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/datatables/sort_desc_disabled.png b/koha-tmpl/opac-tmpl/prog/images/datatables/sort_desc_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..2409653dc94cd21a281a31c0e3819323b84704b7 GIT binary patch literal 251 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S3?yCqj{O5tEa{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=)2l#}z{`>du$&)AV-@pIyd9;k)4B*-rq$b|z2+ZRf0KnX`r z7srr_TS*TNvhX;E^>j)zMNBv%VR68zN24n8K+>5N&kUJbBQCy4c=qgBiu3mAQ)hD? n)_oJhGvi(If!Apb49pB3GXz|UGFKJ=4P)?h^>bP0l+XkK*57ji literal 0 HcmV?d00001 -- 2.39.5