diff --git a/htdocs/includes/jquery/plugins/datatables/css/jquery.dataTables.css b/htdocs/includes/jquery/plugins/datatables/css/jquery.dataTables.css index 83df98ea7114030004e149c3fe036e8e9e47006f..7da7faec89932eb35782b3f34f207e572d39f1ca 100644 --- a/htdocs/includes/jquery/plugins/datatables/css/jquery.dataTables.css +++ b/htdocs/includes/jquery/plugins/datatables/css/jquery.dataTables.css @@ -201,7 +201,8 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; } .sorting_asc_disabled { background: url('../images/sort_asc_disabled.png') no-repeat center right; } .sorting_desc_disabled { background: url('../images/sort_desc_disabled.png') no-repeat center right; } -table.dataTable th:active { +table.dataTable thead th:active, +table.dataTable thead td:active { outline: none; } diff --git a/htdocs/includes/jquery/plugins/datatables/css/jquery.dataTables_jui.css b/htdocs/includes/jquery/plugins/datatables/css/jquery.dataTables_jui.css index de7c842610559ae7f526ffad9d0a4c24d439f647..a210af51ae9a69465353dd48d13008740145b0b0 100644 --- a/htdocs/includes/jquery/plugins/datatables/css/jquery.dataTables_jui.css +++ b/htdocs/includes/jquery/plugins/datatables/css/jquery.dataTables_jui.css @@ -82,7 +82,6 @@ div.dataTables_wrapper .ui-widget-header { table.display thead th div.DataTables_sort_wrapper { position: relative; padding-right: 20px; - padding-right: 20px; } table.display thead th div.DataTables_sort_wrapper span { @@ -147,30 +146,6 @@ table.display thead th div.DataTables_sort_wrapper span { text-align: right; } -/* Pagination nested */ -.paginate_disabled_previous, .paginate_enabled_previous, .paginate_disabled_next, .paginate_enabled_next { - height: 19px; - width: 19px; - margin-left: 3px; - float: left; -} - -.paginate_disabled_previous { - background-image: url('../images/back_disabled.jpg'); -} - -.paginate_enabled_previous { - background-image: url('../images/back_enabled.jpg'); -} - -.paginate_disabled_next { - background-image: url('../images/forward_disabled.jpg'); -} - -.paginate_enabled_next { - background-image: url('../images/forward_enabled.jpg'); -} - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * diff --git a/htdocs/includes/jquery/plugins/datatables/extras/ColReorder/js/ColReorder.js b/htdocs/includes/jquery/plugins/datatables/extras/ColReorder/js/ColReorder.js index 7c7b728a274f51709fc9adf5160aafd72aa9a1ac..35b96594fb883c3f7d37716dc7754be4381c6861 100644 --- a/htdocs/includes/jquery/plugins/datatables/extras/ColReorder/js/ColReorder.js +++ b/htdocs/includes/jquery/plugins/datatables/extras/ColReorder/js/ColReorder.js @@ -1,8 +1,8 @@ /* * File: ColReorder.js - * Version: 1.0.5 + * Version: 1.0.8 * CVS: $Id$ - * Description: Controls for column visiblity in DataTables + * Description: Allow columns to be reordered in a DataTable * Author: Allan Jardine (www.sprymedia.co.uk) * Created: Wed Sep 15 18:23:29 BST 2010 * Modified: $Date$ by $Author$ @@ -174,10 +174,10 @@ $.fn.dataTableExt.oApi.fnColReorder = function ( oSettings, iFrom, iTo ) for ( i=0, iLen=iCols ; i<iLen ; i++ ) { oCol = oSettings.aoColumns[i]; - if ( typeof oCol.mDataProp == 'number' ) { - oCol.mDataProp = aiInvertMapping[ oCol.mDataProp ]; - oCol.fnGetData = oSettings.oApi._fnGetObjectDataFn( oCol.mDataProp ); - oCol.fnSetData = oSettings.oApi._fnSetObjectDataFn( oCol.mDataProp ); + if ( typeof oCol.mData == 'number' ) { + oCol.mData = aiInvertMapping[ oCol.mData ]; + oCol.fnGetData = oSettings.oApi._fnGetObjectDataFn( oCol.mData ); + oCol.fnSetData = oSettings.oApi._fnSetObjectDataFn( oCol.mData ); } } @@ -274,13 +274,12 @@ $.fn.dataTableExt.oApi.fnColReorder = function ( oSettings, iFrom, iTo ) } - /* - * Any extra operations for the other plug-ins - */ - if ( typeof ColVis != 'undefined' ) - { - ColVis.fnRebuild( oSettings.oInstance ); - } + /* Fire an event so other plug-ins can update */ + $(oSettings.oInstance).trigger( 'column-reorder', [ oSettings, { + "iFrom": iFrom, + "iTo": iTo, + "aiInvertMapping": aiInvertMapping + } ] ); if ( typeof oSettings.oInstance._oPluginFixedHeader != 'undefined' ) { @@ -295,10 +294,10 @@ $.fn.dataTableExt.oApi.fnColReorder = function ( oSettings, iFrom, iTo ) * ColReorder provides column visiblity control for DataTables * @class ColReorder * @constructor - * @param {object} DataTables object + * @param {object} DataTables settings object * @param {object} ColReorder options */ -ColReorder = function( oTable, oOpts ) +ColReorder = function( oDTSettings, oOpts ) { /* Santiy check that we are a new instance */ if ( !this.CLASS || this.CLASS != "ColReorder" ) @@ -401,9 +400,12 @@ ColReorder = function( oTable, oOpts ) /* Constructor logic */ - this.s.dt = oTable.fnSettings(); + this.s.dt = oDTSettings.oInstance.fnSettings(); this._fnConstruct(); - + + /* Add destroy callback */ + oDTSettings.oApi._fnCallbackReg(oDTSettings, 'aoDestroyCallback', jQuery.proxy(this._fnDestroy, this), 'ColReorder'); + /* Store the instance for later use */ ColReorder.aoInstances.push( this ); return this; @@ -527,7 +529,7 @@ ColReorder.prototype = { { if ( a.length != this.s.dt.aoColumns.length ) { - this.s.dt.oInstance.oApi._fnLog( oDTSettings, 1, "ColReorder - array reorder does not "+ + this.s.dt.oInstance.oApi._fnLog( this.s.dt, 1, "ColReorder - array reorder does not "+ "match known number of columns. Skipping." ); return; } @@ -611,8 +613,8 @@ ColReorder.prototype = { { var that = this; $(nTh).bind( 'mousedown.ColReorder', function (e) { + e.preventDefault(); that._fnMouseDown.call( that, e, nTh ); - return false; } ); }, @@ -812,7 +814,7 @@ ColReorder.prototype = { } $('thead tr:eq(0)', this.dom.drag).each( function () { - $('th:not(:eq('+that.s.mouse.targetIndex+'))', this).remove(); + $('th', this).eq(that.s.mouse.targetIndex).siblings().remove(); } ); $('tr', this.dom.drag).height( $('tr:eq(0)', that.s.dt.nTHead).height() ); @@ -845,6 +847,29 @@ ColReorder.prototype = { document.body.appendChild( this.dom.pointer ); document.body.appendChild( this.dom.drag ); + }, + + /** + * Clean up ColReorder memory references and event handlers + * @method _fnDestroy + * @returns void + * @private + */ + "_fnDestroy": function () + { + for ( var i=0, iLen=ColReorder.aoInstances.length ; i<iLen ; i++ ) + { + if ( ColReorder.aoInstances[i] === this ) + { + ColReorder.aoInstances.splice( i, 1 ); + break; + } + } + + $(this.s.dt.nTHead).find( '*' ).unbind( '.ColReorder' ); + + this.s.dt.oInstance._oPluginColReorder = null; + this.s = null; } }; @@ -914,7 +939,7 @@ ColReorder.prototype.CLASS = "ColReorder"; * @type String * @default As code */ -ColReorder.VERSION = "1.0.5"; +ColReorder.VERSION = "1.0.8"; ColReorder.prototype.VERSION = ColReorder.VERSION; @@ -930,7 +955,7 @@ ColReorder.prototype.VERSION = ColReorder.VERSION; */ if ( typeof $.fn.dataTable == "function" && typeof $.fn.dataTableExt.fnVersionCheck == "function" && - $.fn.dataTableExt.fnVersionCheck('1.9.0') ) + $.fn.dataTableExt.fnVersionCheck('1.9.3') ) { $.fn.dataTableExt.aoFeatures.push( { "fnInit": function( oDTSettings ) { @@ -938,7 +963,7 @@ if ( typeof $.fn.dataTable == "function" && if ( typeof oTable._oPluginColReorder == 'undefined' ) { var opts = typeof oDTSettings.oInit.oColReorder != 'undefined' ? oDTSettings.oInit.oColReorder : {}; - oTable._oPluginColReorder = new ColReorder( oDTSettings.oInstance, opts ); + oTable._oPluginColReorder = new ColReorder( oDTSettings, opts ); } else { oTable.oApi._fnLog( oDTSettings, 1, "ColReorder attempted to initialise twice. Ignoring second" ); } @@ -951,7 +976,7 @@ if ( typeof $.fn.dataTable == "function" && } else { - alert( "Warning: ColReorder requires DataTables 1.9.0 or greater - www.datatables.net/download"); + alert( "Warning: ColReorder requires DataTables 1.9.3 or greater - www.datatables.net/download"); } })(jQuery, window, document); diff --git a/htdocs/includes/jquery/plugins/datatables/extras/ColReorder/js/ColReorder.min.js b/htdocs/includes/jquery/plugins/datatables/extras/ColReorder/js/ColReorder.min.js index e322c42ce9dd286ecacfd3ff8936602a273294ed..111f4b81888faa49ff2ca348697488c6367d089c 100644 --- a/htdocs/includes/jquery/plugins/datatables/extras/ColReorder/js/ColReorder.min.js +++ b/htdocs/includes/jquery/plugins/datatables/extras/ColReorder/js/ColReorder.min.js @@ -1,9 +1,9 @@ /* * File: ColReorder.min.js - * Version: 1.0.5 + * Version: 1.0.8 * Author: Allan Jardine (www.sprymedia.co.uk) * - * Copyright 2010-2011 Allan Jardine, all rights reserved. + * Copyright 2010-2012 Allan Jardine, all rights reserved. * * This source file is free software, under either the GPL v2 license or a * BSD (3 point) style license, as supplied with this software. @@ -12,22 +12,22 @@ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. */ -(function(f,o,i){function m(a){for(var c=[],d=0,b=a.length;d<b;d++)c[a[d]]=d;return c}function j(a,c,d){c=a.splice(c,1)[0];a.splice(d,0,c)}function n(a,c,d){for(var b=[],e=0,f=a.childNodes.length;e<f;e++)1==a.childNodes[e].nodeType&&b.push(a.childNodes[e]);c=b[c];null!==d?a.insertBefore(c,b[d]):a.appendChild(c)}f.fn.dataTableExt.oApi.fnColReorder=function(a,c,d){var b,e,g,l,k=a.aoColumns.length,h;if(c!=d)if(0>c||c>=k)this.oApi._fnLog(a,1,"ColReorder 'from' index is out of bounds: "+c);else if(0>d|| -d>=k)this.oApi._fnLog(a,1,"ColReorder 'to' index is out of bounds: "+d);else{g=[];for(b=0,e=k;b<e;b++)g[b]=b;j(g,c,d);var i=m(g);for(b=0,e=a.aaSorting.length;b<e;b++)a.aaSorting[b][0]=i[a.aaSorting[b][0]];if(null!==a.aaSortingFixed)for(b=0,e=a.aaSortingFixed.length;b<e;b++)a.aaSortingFixed[b][0]=i[a.aaSortingFixed[b][0]];for(b=0,e=k;b<e;b++){h=a.aoColumns[b];for(g=0,l=h.aDataSort.length;g<l;g++)h.aDataSort[g]=i[h.aDataSort[g]]}for(b=0,e=k;b<e;b++)if(h=a.aoColumns[b],"number"==typeof h.mDataProp)h.mDataProp= -i[h.mDataProp],h.fnGetData=a.oApi._fnGetObjectDataFn(h.mDataProp),h.fnSetData=a.oApi._fnSetObjectDataFn(h.mDataProp);if(a.aoColumns[c].bVisible){l=this.oApi._fnColumnIndexToVisible(a,c);h=null;for(b=d<c?d:d+1;null===h&&b<k;)h=this.oApi._fnColumnIndexToVisible(a,b),b++;g=a.nTHead.getElementsByTagName("tr");for(b=0,e=g.length;b<e;b++)n(g[b],l,h);if(null!==a.nTFoot){g=a.nTFoot.getElementsByTagName("tr");for(b=0,e=g.length;b<e;b++)n(g[b],l,h)}for(b=0,e=a.aoData.length;b<e;b++)null!==a.aoData[b].nTr&& -n(a.aoData[b].nTr,l,h)}j(a.aoColumns,c,d);j(a.aoPreSearchCols,c,d);for(b=0,e=a.aoData.length;b<e;b++)f.isArray(a.aoData[b]._aData)&&j(a.aoData[b]._aData,c,d),j(a.aoData[b]._anHidden,c,d);for(b=0,e=a.aoHeader.length;b<e;b++)j(a.aoHeader[b],c,d);if(null!==a.aoFooter)for(b=0,e=a.aoFooter.length;b<e;b++)j(a.aoFooter[b],c,d);for(b=0,e=k;b<e;b++)f(a.aoColumns[b].nTh).unbind("click"),this.oApi._fnSortAttachListener(a,a.aoColumns[b].nTh,b);"undefined"!=typeof ColVis&&ColVis.fnRebuild(a.oInstance);"undefined"!= -typeof a.oInstance._oPluginFixedHeader&&a.oInstance._oPluginFixedHeader.fnUpdate()}};ColReorder=function(a,c){(!this.CLASS||"ColReorder"!=this.CLASS)&&alert("Warning: ColReorder must be initialised with the keyword 'new'");"undefined"==typeof c&&(c={});this.s={dt:null,init:c,fixed:0,dropCallback:null,mouse:{startX:-1,startY:-1,offsetX:-1,offsetY:-1,target:-1,targetIndex:-1,fromIndex:-1},aoTargets:[]};this.dom={drag:null,pointer:null};this.s.dt=a.fnSettings();this._fnConstruct();ColReorder.aoInstances.push(this); -return this};ColReorder.prototype={fnReset:function(){for(var a=[],c=0,d=this.s.dt.aoColumns.length;c<d;c++)a.push(this.s.dt.aoColumns[c]._ColReorder_iOrigCol);this._fnOrderColumns(a)},_fnConstruct:function(){var a=this,c,d;if("undefined"!=typeof this.s.init.iFixedColumns)this.s.fixed=this.s.init.iFixedColumns;if("undefined"!=typeof this.s.init.fnReorderCallback)this.s.dropCallback=this.s.init.fnReorderCallback;for(c=0,d=this.s.dt.aoColumns.length;c<d;c++)c>this.s.fixed-1&&this._fnMouseListener(c, -this.s.dt.aoColumns[c].nTh),this.s.dt.aoColumns[c]._ColReorder_iOrigCol=c;this.s.dt.oApi._fnCallbackReg(this.s.dt,"aoStateSaveParams",function(b,c){a._fnStateSave.call(a,c)},"ColReorder_State");var b=null;"undefined"!=typeof this.s.init.aiOrder&&(b=this.s.init.aiOrder.slice());if(this.s.dt.oLoadedState&&"undefined"!=typeof this.s.dt.oLoadedState.ColReorder&&this.s.dt.oLoadedState.ColReorder.length==this.s.dt.aoColumns.length)b=this.s.dt.oLoadedState.ColReorder;if(b)if(a.s.dt._bInitComplete)c=m(b), -a._fnOrderColumns.call(a,c);else{var e=!1;this.s.dt.aoDrawCallback.push({fn:function(){if(!a.s.dt._bInitComplete&&!e){e=!0;var c=m(b);a._fnOrderColumns.call(a,c)}},sName:"ColReorder_Pre"})}},_fnOrderColumns:function(a){if(a.length!=this.s.dt.aoColumns.length)this.s.dt.oInstance.oApi._fnLog(oDTSettings,1,"ColReorder - array reorder does not match known number of columns. Skipping.");else{for(var c=0,d=a.length;c<d;c++){var b=f.inArray(c,a);c!=b&&(j(a,b,c),this.s.dt.oInstance.fnColReorder(b,c))}(""!== -this.s.dt.oScroll.sX||""!==this.s.dt.oScroll.sY)&&this.s.dt.oInstance.fnAdjustColumnSizing();this.s.dt.oInstance.oApi._fnSaveState(this.s.dt)}},_fnStateSave:function(a){var c,d,b,e=this.s.dt;for(c=0;c<a.aaSorting.length;c++)a.aaSorting[c][0]=e.aoColumns[a.aaSorting[c][0]]._ColReorder_iOrigCol;aSearchCopy=f.extend(!0,[],a.aoSearchCols);a.ColReorder=[];for(c=0,d=e.aoColumns.length;c<d;c++)b=e.aoColumns[c]._ColReorder_iOrigCol,a.aoSearchCols[b]=aSearchCopy[c],a.abVisCols[b]=e.aoColumns[c].bVisible,a.ColReorder.push(b)}, -_fnMouseListener:function(a,c){var d=this;f(c).bind("mousedown.ColReorder",function(a){d._fnMouseDown.call(d,a,c);return!1})},_fnMouseDown:function(a,c){var d=this,b=this.s.dt.aoColumns,e="TH"==a.target.nodeName?a.target:f(a.target).parents("TH")[0],e=f(e).offset();this.s.mouse.startX=a.pageX;this.s.mouse.startY=a.pageY;this.s.mouse.offsetX=a.pageX-e.left;this.s.mouse.offsetY=a.pageY-e.top;this.s.mouse.target=c;this.s.mouse.targetIndex=f("th",c.parentNode).index(c);this.s.mouse.fromIndex=this.s.dt.oInstance.oApi._fnVisibleToColumnIndex(this.s.dt, -this.s.mouse.targetIndex);this.s.aoTargets.splice(0,this.s.aoTargets.length);this.s.aoTargets.push({x:f(this.s.dt.nTable).offset().left,to:0});for(var g=e=0,j=b.length;g<j;g++)g!=this.s.mouse.fromIndex&&e++,b[g].bVisible&&this.s.aoTargets.push({x:f(b[g].nTh).offset().left+f(b[g].nTh).outerWidth(),to:e});0!==this.s.fixed&&this.s.aoTargets.splice(0,this.s.fixed);f(i).bind("mousemove.ColReorder",function(a){d._fnMouseMove.call(d,a)});f(i).bind("mouseup.ColReorder",function(a){d._fnMouseUp.call(d,a)})}, -_fnMouseMove:function(a){if(null===this.dom.drag){if(5>Math.pow(Math.pow(a.pageX-this.s.mouse.startX,2)+Math.pow(a.pageY-this.s.mouse.startY,2),0.5))return;this._fnCreateDragNode()}this.dom.drag.style.left=a.pageX-this.s.mouse.offsetX+"px";this.dom.drag.style.top=a.pageY-this.s.mouse.offsetY+"px";for(var c=!1,d=1,b=this.s.aoTargets.length;d<b;d++)if(a.pageX<this.s.aoTargets[d-1].x+(this.s.aoTargets[d].x-this.s.aoTargets[d-1].x)/2){this.dom.pointer.style.left=this.s.aoTargets[d-1].x+"px";this.s.mouse.toIndex= -this.s.aoTargets[d-1].to;c=!0;break}if(!c)this.dom.pointer.style.left=this.s.aoTargets[this.s.aoTargets.length-1].x+"px",this.s.mouse.toIndex=this.s.aoTargets[this.s.aoTargets.length-1].to},_fnMouseUp:function(){f(i).unbind("mousemove.ColReorder");f(i).unbind("mouseup.ColReorder");if(null!==this.dom.drag)i.body.removeChild(this.dom.drag),i.body.removeChild(this.dom.pointer),this.dom.drag=null,this.dom.pointer=null,this.s.dt.oInstance.fnColReorder(this.s.mouse.fromIndex,this.s.mouse.toIndex),(""!== -this.s.dt.oScroll.sX||""!==this.s.dt.oScroll.sY)&&this.s.dt.oInstance.fnAdjustColumnSizing(),null!==this.s.dropCallback&&this.s.dropCallback.call(this),this.s.dt.oInstance.oApi._fnSaveState(this.s.dt)},_fnCreateDragNode:function(){var a=this;this.dom.drag=f(this.s.dt.nTHead.parentNode).clone(!0)[0];for(this.dom.drag.className+=" DTCR_clonedTable";0<this.dom.drag.getElementsByTagName("caption").length;)this.dom.drag.removeChild(this.dom.drag.getElementsByTagName("caption")[0]);for(;0<this.dom.drag.getElementsByTagName("tbody").length;)this.dom.drag.removeChild(this.dom.drag.getElementsByTagName("tbody")[0]); -for(;0<this.dom.drag.getElementsByTagName("tfoot").length;)this.dom.drag.removeChild(this.dom.drag.getElementsByTagName("tfoot")[0]);f("thead tr:eq(0)",this.dom.drag).each(function(){f("th:not(:eq("+a.s.mouse.targetIndex+"))",this).remove()});f("tr",this.dom.drag).height(f("tr:eq(0)",a.s.dt.nTHead).height());f("thead tr:gt(0)",this.dom.drag).remove();f("thead th:eq(0)",this.dom.drag).each(function(){this.style.width=f("th:eq("+a.s.mouse.targetIndex+")",a.s.dt.nTHead).width()+"px"});this.dom.drag.style.position= -"absolute";this.dom.drag.style.top="0px";this.dom.drag.style.left="0px";this.dom.drag.style.width=f("th:eq("+a.s.mouse.targetIndex+")",a.s.dt.nTHead).outerWidth()+"px";this.dom.pointer=i.createElement("div");this.dom.pointer.className="DTCR_pointer";this.dom.pointer.style.position="absolute";""===this.s.dt.oScroll.sX&&""===this.s.dt.oScroll.sY?(this.dom.pointer.style.top=f(this.s.dt.nTable).offset().top+"px",this.dom.pointer.style.height=f(this.s.dt.nTable).height()+"px"):(this.dom.pointer.style.top= -f("div.dataTables_scroll",this.s.dt.nTableWrapper).offset().top+"px",this.dom.pointer.style.height=f("div.dataTables_scroll",this.s.dt.nTableWrapper).height()+"px");i.body.appendChild(this.dom.pointer);i.body.appendChild(this.dom.drag)}};ColReorder.aoInstances=[];ColReorder.fnReset=function(a){for(var c=0,d=ColReorder.aoInstances.length;c<d;c++)ColReorder.aoInstances[c].s.dt.oInstance==a&&ColReorder.aoInstances[c].fnReset()};ColReorder.prototype.CLASS="ColReorder";ColReorder.VERSION="1.0.5";ColReorder.prototype.VERSION= -ColReorder.VERSION;"function"==typeof f.fn.dataTable&&"function"==typeof f.fn.dataTableExt.fnVersionCheck&&f.fn.dataTableExt.fnVersionCheck("1.9.0")?f.fn.dataTableExt.aoFeatures.push({fnInit:function(a){var c=a.oInstance;"undefined"==typeof c._oPluginColReorder?c._oPluginColReorder=new ColReorder(a.oInstance,"undefined"!=typeof a.oInit.oColReorder?a.oInit.oColReorder:{}):c.oApi._fnLog(a,1,"ColReorder attempted to initialise twice. Ignoring second");return null},cFeature:"R",sFeature:"ColReorder"}): -alert("Warning: ColReorder requires DataTables 1.9.0 or greater - www.datatables.net/download")})(jQuery,window,document); +(function(f,o,g){function m(a){for(var b=[],d=0,c=a.length;d<c;d++)b[a[d]]=d;return b}function j(a,b,d){b=a.splice(b,1)[0];a.splice(d,0,b)}function n(a,b,d){for(var c=[],e=0,f=a.childNodes.length;e<f;e++)1==a.childNodes[e].nodeType&&c.push(a.childNodes[e]);b=c[b];null!==d?a.insertBefore(b,c[d]):a.appendChild(b)}f.fn.dataTableExt.oApi.fnColReorder=function(a,b,d){var c,e,h,l,k=a.aoColumns.length,i;if(b!=d)if(0>b||b>=k)this.oApi._fnLog(a,1,"ColReorder 'from' index is out of bounds: "+b);else if(0>d|| +d>=k)this.oApi._fnLog(a,1,"ColReorder 'to' index is out of bounds: "+d);else{var g=[];c=0;for(e=k;c<e;c++)g[c]=c;j(g,b,d);g=m(g);c=0;for(e=a.aaSorting.length;c<e;c++)a.aaSorting[c][0]=g[a.aaSorting[c][0]];if(null!==a.aaSortingFixed){c=0;for(e=a.aaSortingFixed.length;c<e;c++)a.aaSortingFixed[c][0]=g[a.aaSortingFixed[c][0]]}c=0;for(e=k;c<e;c++){i=a.aoColumns[c];h=0;for(l=i.aDataSort.length;h<l;h++)i.aDataSort[h]=g[i.aDataSort[h]]}c=0;for(e=k;c<e;c++)i=a.aoColumns[c],"number"==typeof i.mData&&(i.mData= +g[i.mData],i.fnGetData=a.oApi._fnGetObjectDataFn(i.mData),i.fnSetData=a.oApi._fnSetObjectDataFn(i.mData));if(a.aoColumns[b].bVisible){l=this.oApi._fnColumnIndexToVisible(a,b);i=null;for(c=d<b?d:d+1;null===i&&c<k;)i=this.oApi._fnColumnIndexToVisible(a,c),c++;h=a.nTHead.getElementsByTagName("tr");c=0;for(e=h.length;c<e;c++)n(h[c],l,i);if(null!==a.nTFoot){h=a.nTFoot.getElementsByTagName("tr");c=0;for(e=h.length;c<e;c++)n(h[c],l,i)}c=0;for(e=a.aoData.length;c<e;c++)null!==a.aoData[c].nTr&&n(a.aoData[c].nTr, +l,i)}j(a.aoColumns,b,d);j(a.aoPreSearchCols,b,d);c=0;for(e=a.aoData.length;c<e;c++)f.isArray(a.aoData[c]._aData)&&j(a.aoData[c]._aData,b,d),j(a.aoData[c]._anHidden,b,d);c=0;for(e=a.aoHeader.length;c<e;c++)j(a.aoHeader[c],b,d);if(null!==a.aoFooter){c=0;for(e=a.aoFooter.length;c<e;c++)j(a.aoFooter[c],b,d)}c=0;for(e=k;c<e;c++)f(a.aoColumns[c].nTh).unbind("click"),this.oApi._fnSortAttachListener(a,a.aoColumns[c].nTh,c);f(a.oInstance).trigger("column-reorder",[a,{iFrom:b,iTo:d,aiInvertMapping:g}]);"undefined"!= +typeof a.oInstance._oPluginFixedHeader&&a.oInstance._oPluginFixedHeader.fnUpdate()}};ColReorder=function(a,b){(!this.CLASS||"ColReorder"!=this.CLASS)&&alert("Warning: ColReorder must be initialised with the keyword 'new'");"undefined"==typeof b&&(b={});this.s={dt:null,init:b,fixed:0,dropCallback:null,mouse:{startX:-1,startY:-1,offsetX:-1,offsetY:-1,target:-1,targetIndex:-1,fromIndex:-1},aoTargets:[]};this.dom={drag:null,pointer:null};this.s.dt=a.oInstance.fnSettings();this._fnConstruct();a.oApi._fnCallbackReg(a, +"aoDestroyCallback",jQuery.proxy(this._fnDestroy,this),"ColReorder");ColReorder.aoInstances.push(this);return this};ColReorder.prototype={fnReset:function(){for(var a=[],b=0,d=this.s.dt.aoColumns.length;b<d;b++)a.push(this.s.dt.aoColumns[b]._ColReorder_iOrigCol);this._fnOrderColumns(a)},_fnConstruct:function(){var a=this,b,d;"undefined"!=typeof this.s.init.iFixedColumns&&(this.s.fixed=this.s.init.iFixedColumns);"undefined"!=typeof this.s.init.fnReorderCallback&&(this.s.dropCallback=this.s.init.fnReorderCallback); +b=0;for(d=this.s.dt.aoColumns.length;b<d;b++)b>this.s.fixed-1&&this._fnMouseListener(b,this.s.dt.aoColumns[b].nTh),this.s.dt.aoColumns[b]._ColReorder_iOrigCol=b;this.s.dt.oApi._fnCallbackReg(this.s.dt,"aoStateSaveParams",function(c,b){a._fnStateSave.call(a,b)},"ColReorder_State");var c=null;"undefined"!=typeof this.s.init.aiOrder&&(c=this.s.init.aiOrder.slice());this.s.dt.oLoadedState&&("undefined"!=typeof this.s.dt.oLoadedState.ColReorder&&this.s.dt.oLoadedState.ColReorder.length==this.s.dt.aoColumns.length)&& +(c=this.s.dt.oLoadedState.ColReorder);if(c)if(a.s.dt._bInitComplete)b=m(c),a._fnOrderColumns.call(a,b);else{var e=!1;this.s.dt.aoDrawCallback.push({fn:function(){if(!a.s.dt._bInitComplete&&!e){e=true;var b=m(c);a._fnOrderColumns.call(a,b)}},sName:"ColReorder_Pre"})}},_fnOrderColumns:function(a){if(a.length!=this.s.dt.aoColumns.length)this.s.dt.oInstance.oApi._fnLog(this.s.dt,1,"ColReorder - array reorder does not match known number of columns. Skipping.");else{for(var b=0,d=a.length;b<d;b++){var c= +f.inArray(b,a);b!=c&&(j(a,c,b),this.s.dt.oInstance.fnColReorder(c,b))}(""!==this.s.dt.oScroll.sX||""!==this.s.dt.oScroll.sY)&&this.s.dt.oInstance.fnAdjustColumnSizing();this.s.dt.oInstance.oApi._fnSaveState(this.s.dt)}},_fnStateSave:function(a){var b,d,c,e=this.s.dt;for(b=0;b<a.aaSorting.length;b++)a.aaSorting[b][0]=e.aoColumns[a.aaSorting[b][0]]._ColReorder_iOrigCol;aSearchCopy=f.extend(!0,[],a.aoSearchCols);a.ColReorder=[];b=0;for(d=e.aoColumns.length;b<d;b++)c=e.aoColumns[b]._ColReorder_iOrigCol, +a.aoSearchCols[c]=aSearchCopy[b],a.abVisCols[c]=e.aoColumns[b].bVisible,a.ColReorder.push(c)},_fnMouseListener:function(a,b){var d=this;f(b).bind("mousedown.ColReorder",function(a){a.preventDefault();d._fnMouseDown.call(d,a,b)})},_fnMouseDown:function(a,b){var d=this,c=this.s.dt.aoColumns,e="TH"==a.target.nodeName?a.target:f(a.target).parents("TH")[0],e=f(e).offset();this.s.mouse.startX=a.pageX;this.s.mouse.startY=a.pageY;this.s.mouse.offsetX=a.pageX-e.left;this.s.mouse.offsetY=a.pageY-e.top;this.s.mouse.target= +b;this.s.mouse.targetIndex=f("th",b.parentNode).index(b);this.s.mouse.fromIndex=this.s.dt.oInstance.oApi._fnVisibleToColumnIndex(this.s.dt,this.s.mouse.targetIndex);this.s.aoTargets.splice(0,this.s.aoTargets.length);this.s.aoTargets.push({x:f(this.s.dt.nTable).offset().left,to:0});for(var h=e=0,j=c.length;h<j;h++)h!=this.s.mouse.fromIndex&&e++,c[h].bVisible&&this.s.aoTargets.push({x:f(c[h].nTh).offset().left+f(c[h].nTh).outerWidth(),to:e});0!==this.s.fixed&&this.s.aoTargets.splice(0,this.s.fixed); +f(g).bind("mousemove.ColReorder",function(a){d._fnMouseMove.call(d,a)});f(g).bind("mouseup.ColReorder",function(a){d._fnMouseUp.call(d,a)})},_fnMouseMove:function(a){if(null===this.dom.drag){if(5>Math.pow(Math.pow(a.pageX-this.s.mouse.startX,2)+Math.pow(a.pageY-this.s.mouse.startY,2),0.5))return;this._fnCreateDragNode()}this.dom.drag.style.left=a.pageX-this.s.mouse.offsetX+"px";this.dom.drag.style.top=a.pageY-this.s.mouse.offsetY+"px";for(var b=!1,d=1,c=this.s.aoTargets.length;d<c;d++)if(a.pageX< +this.s.aoTargets[d-1].x+(this.s.aoTargets[d].x-this.s.aoTargets[d-1].x)/2){this.dom.pointer.style.left=this.s.aoTargets[d-1].x+"px";this.s.mouse.toIndex=this.s.aoTargets[d-1].to;b=!0;break}b||(this.dom.pointer.style.left=this.s.aoTargets[this.s.aoTargets.length-1].x+"px",this.s.mouse.toIndex=this.s.aoTargets[this.s.aoTargets.length-1].to)},_fnMouseUp:function(){f(g).unbind("mousemove.ColReorder");f(g).unbind("mouseup.ColReorder");null!==this.dom.drag&&(g.body.removeChild(this.dom.drag),g.body.removeChild(this.dom.pointer), +this.dom.drag=null,this.dom.pointer=null,this.s.dt.oInstance.fnColReorder(this.s.mouse.fromIndex,this.s.mouse.toIndex),(""!==this.s.dt.oScroll.sX||""!==this.s.dt.oScroll.sY)&&this.s.dt.oInstance.fnAdjustColumnSizing(),null!==this.s.dropCallback&&this.s.dropCallback.call(this),this.s.dt.oInstance.oApi._fnSaveState(this.s.dt))},_fnCreateDragNode:function(){var a=this;this.dom.drag=f(this.s.dt.nTHead.parentNode).clone(!0)[0];for(this.dom.drag.className+=" DTCR_clonedTable";0<this.dom.drag.getElementsByTagName("caption").length;)this.dom.drag.removeChild(this.dom.drag.getElementsByTagName("caption")[0]); +for(;0<this.dom.drag.getElementsByTagName("tbody").length;)this.dom.drag.removeChild(this.dom.drag.getElementsByTagName("tbody")[0]);for(;0<this.dom.drag.getElementsByTagName("tfoot").length;)this.dom.drag.removeChild(this.dom.drag.getElementsByTagName("tfoot")[0]);f("thead tr:eq(0)",this.dom.drag).each(function(){f("th",this).eq(a.s.mouse.targetIndex).siblings().remove()});f("tr",this.dom.drag).height(f("tr:eq(0)",a.s.dt.nTHead).height());f("thead tr:gt(0)",this.dom.drag).remove();f("thead th:eq(0)", +this.dom.drag).each(function(){this.style.width=f("th:eq("+a.s.mouse.targetIndex+")",a.s.dt.nTHead).width()+"px"});this.dom.drag.style.position="absolute";this.dom.drag.style.top="0px";this.dom.drag.style.left="0px";this.dom.drag.style.width=f("th:eq("+a.s.mouse.targetIndex+")",a.s.dt.nTHead).outerWidth()+"px";this.dom.pointer=g.createElement("div");this.dom.pointer.className="DTCR_pointer";this.dom.pointer.style.position="absolute";""===this.s.dt.oScroll.sX&&""===this.s.dt.oScroll.sY?(this.dom.pointer.style.top= +f(this.s.dt.nTable).offset().top+"px",this.dom.pointer.style.height=f(this.s.dt.nTable).height()+"px"):(this.dom.pointer.style.top=f("div.dataTables_scroll",this.s.dt.nTableWrapper).offset().top+"px",this.dom.pointer.style.height=f("div.dataTables_scroll",this.s.dt.nTableWrapper).height()+"px");g.body.appendChild(this.dom.pointer);g.body.appendChild(this.dom.drag)},_fnDestroy:function(){for(var a=0,b=ColReorder.aoInstances.length;a<b;a++)if(ColReorder.aoInstances[a]===this){ColReorder.aoInstances.splice(a, +1);break}f(this.s.dt.nTHead).find("*").unbind(".ColReorder");this.s=this.s.dt.oInstance._oPluginColReorder=null}};ColReorder.aoInstances=[];ColReorder.fnReset=function(a){for(var b=0,d=ColReorder.aoInstances.length;b<d;b++)ColReorder.aoInstances[b].s.dt.oInstance==a&&ColReorder.aoInstances[b].fnReset()};ColReorder.prototype.CLASS="ColReorder";ColReorder.VERSION="1.0.8";ColReorder.prototype.VERSION=ColReorder.VERSION;"function"==typeof f.fn.dataTable&&"function"==typeof f.fn.dataTableExt.fnVersionCheck&& +f.fn.dataTableExt.fnVersionCheck("1.9.3")?f.fn.dataTableExt.aoFeatures.push({fnInit:function(a){var b=a.oInstance;"undefined"==typeof b._oPluginColReorder?b._oPluginColReorder=new ColReorder(a,"undefined"!=typeof a.oInit.oColReorder?a.oInit.oColReorder:{}):b.oApi._fnLog(a,1,"ColReorder attempted to initialise twice. Ignoring second");return null},cFeature:"R",sFeature:"ColReorder"}):alert("Warning: ColReorder requires DataTables 1.9.3 or greater - www.datatables.net/download")})(jQuery,window,document); diff --git a/htdocs/includes/jquery/plugins/datatables/extras/ColVis/js/ColVis.js b/htdocs/includes/jquery/plugins/datatables/extras/ColVis/js/ColVis.js index 19d91d39b8ea59151a964fc524de6ac574b16605..10d66e15b303b5f6d9aa09b8fd1ca491228a3381 100644 --- a/htdocs/includes/jquery/plugins/datatables/extras/ColVis/js/ColVis.js +++ b/htdocs/includes/jquery/plugins/datatables/extras/ColVis/js/ColVis.js @@ -1,6 +1,6 @@ /* * File: ColVis.js - * Version: 1.0.7 + * Version: 1.0.8 * CVS: $Id$ * Description: Controls for column visiblity in DataTables * Author: Allan Jardine (www.sprymedia.co.uk) @@ -313,6 +313,7 @@ ColVis.prototype = { this._fnApplyCustomisation(); var that = this; + var i, iLen; this.dom.wrapper = document.createElement('div'); this.dom.wrapper.className = "ColVis TableTools"; @@ -327,7 +328,7 @@ ColVis.prototype = { this._fnAddButtons(); /* Store the original visbility information */ - for ( var i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ ) + for ( i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ ) { this.s.abOriginal.push( this.s.dt.aoColumns[i].bVisible ); } @@ -339,6 +340,20 @@ ColVis.prototype = { }, "sName": "ColVis" } ); + + /* If columns are reordered, then we need to update our exclude list and + * rebuild the displayed list + */ + $(this.s.dt.oInstance).bind( 'column-reorder', function ( e, oSettings, oReorder ) { + for ( i=0, iLen=that.s.aiExclude.length ; i<iLen ; i++ ) { + that.s.aiExclude[i] = oReorder.aiInvertMapping[ that.s.aiExclude[i] ]; + } + + var mStore = that.s.abOriginal.splice( oReorder.iFrom, 1 )[0]; + that.s.abOriginal.splice( oReorder.iTo, 0, mStore ); + + that.fnRebuild(); + } ); }, @@ -420,8 +435,8 @@ ColVis.prototype = { /** - * On each table draw, check the visiblity checkboxes as needed. This allows any process to - * update the table's column visiblity and ColVis will still be accurate. + * On each table draw, check the visibility checkboxes as needed. This allows any process to + * update the table's column visibility and ColVis will still be accurate. * @method _fnDrawCallback * @returns void * @private @@ -515,6 +530,7 @@ ColVis.prototype = { that.s.dt.oInstance.fnSetColumnVis( i, that.s.abOriginal[i], false ); } that._fnAdjustOpenRows(); + that.s.dt.oInstance.fnAdjustColumnSizing( false ); that.s.dt.oInstance.fnDraw( false ); } ); @@ -549,6 +565,7 @@ ColVis.prototype = { } } that._fnAdjustOpenRows(); + that.s.dt.oInstance.fnAdjustColumnSizing( false ); that.s.dt.oInstance.fnDraw( false ); } ); @@ -597,6 +614,7 @@ ColVis.prototype = { if ( dt.oFeatures.bServerSide && (dt.oScroll.sX !== "" || dt.oScroll.sY !== "" ) ) { that.s.dt.oInstance.fnSetColumnVis( i, showHide, false ); + that.s.dt.oInstance.fnAdjustColumnSizing( false ); that.s.dt.oInstance.oApi._fnScrollDraw( that.s.dt ); that._fnDrawCallback(); } @@ -923,7 +941,7 @@ ColVis.fnRebuild = function ( oTable ) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Static object propterties + * Static object properties * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** @@ -958,7 +976,7 @@ ColVis.prototype.CLASS = "ColVis"; * @type String * @default See code */ -ColVis.VERSION = "1.0.7"; +ColVis.VERSION = "1.0.8"; ColVis.prototype.VERSION = ColVis.VERSION; diff --git a/htdocs/includes/jquery/plugins/datatables/extras/ColVis/js/ColVis.min.js b/htdocs/includes/jquery/plugins/datatables/extras/ColVis/js/ColVis.min.js index 429d6c72c1a4368b073acc3ba4b40fa3eabcadce..a831fd909448248bdc5a626cce274aaff519576d 100644 --- a/htdocs/includes/jquery/plugins/datatables/extras/ColVis/js/ColVis.min.js +++ b/htdocs/includes/jquery/plugins/datatables/extras/ColVis/js/ColVis.min.js @@ -1,9 +1,9 @@ /* * File: ColVis.min.js - * Version: 1.0.7 + * Version: 1.0.8 * Author: Allan Jardine (www.sprymedia.co.uk) * - * Copyright 2010-2011 Allan Jardine, all rights reserved. + * Copyright 2010-2012 Allan Jardine, all rights reserved. * * This source file is free software, under either the GPL v2 license or a * BSD (3 point) style license, as supplied with this software. @@ -13,21 +13,22 @@ * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. */ (function(d){ColVis=function(a,b){(!this.CLASS||"ColVis"!=this.CLASS)&&alert("Warning: ColVis must be initialised with the keyword 'new'");"undefined"==typeof b&&(b={});this.s={dt:null,oInit:b,fnStateChange:null,activate:"click",sAlign:"left",buttonText:"Show / hide columns",hidden:!0,aiExclude:[],abOriginal:[],bShowAll:!1,sShowAll:"Show All",bRestore:!1,sRestore:"Restore original",iOverlayFade:500,fnLabel:null,sSize:"auto",bCssPosition:!1};this.dom={wrapper:null,button:null,collection:null,background:null, -catcher:null,buttons:[],restore:null};ColVis.aInstances.push(this);this.s.dt=a;this._fnConstruct();return this};ColVis.prototype={fnRebuild:function(){for(var a=this.dom.buttons.length-1;0<=a;a--)null!==this.dom.buttons[a]&&this.dom.collection.removeChild(this.dom.buttons[a]);this.dom.buttons.splice(0,this.dom.buttons.length);this.dom.restore&&this.dom.restore.parentNode(this.dom.restore);this._fnAddButtons();this._fnDrawCallback()},_fnConstruct:function(){this._fnApplyCustomisation();var a=this; -this.dom.wrapper=document.createElement("div");this.dom.wrapper.className="ColVis TableTools";this.dom.button=this._fnDomBaseButton(this.s.buttonText);this.dom.button.className+=" ColVis_MasterButton";this.dom.wrapper.appendChild(this.dom.button);this.dom.catcher=this._fnDomCatcher();this.dom.collection=this._fnDomCollection();this.dom.background=this._fnDomBackground();this._fnAddButtons();for(var b=0,c=this.s.dt.aoColumns.length;b<c;b++)this.s.abOriginal.push(this.s.dt.aoColumns[b].bVisible);this.s.dt.aoDrawCallback.push({fn:function(){a._fnDrawCallback.call(a)}, -sName:"ColVis"})},_fnApplyCustomisation:function(){var a=this.s.oInit;if("undefined"!=typeof a.activate)this.s.activate=a.activate;if("undefined"!=typeof a.buttonText)this.s.buttonText=a.buttonText;if("undefined"!=typeof a.aiExclude)this.s.aiExclude=a.aiExclude;if("undefined"!=typeof a.bRestore)this.s.bRestore=a.bRestore;if("undefined"!=typeof a.sRestore)this.s.sRestore=a.sRestore;if("undefined"!=typeof a.bShowAll)this.s.bShowAll=a.bShowAll;if("undefined"!=typeof a.sShowAll)this.s.sShowAll=a.sShowAll; -if("undefined"!=typeof a.sAlign)this.s.sAlign=a.sAlign;if("undefined"!=typeof a.fnStateChange)this.s.fnStateChange=a.fnStateChange;if("undefined"!=typeof a.iOverlayFade)this.s.iOverlayFade=a.iOverlayFade;if("undefined"!=typeof a.fnLabel)this.s.fnLabel=a.fnLabel;if("undefined"!=typeof a.sSize)this.s.sSize=a.sSize;if("undefined"!=typeof a.bCssPosition)this.s.bCssPosition=a.bCssPosition},_fnDrawCallback:function(){for(var a=this.s.dt.aoColumns,b=0,c=a.length;b<c;b++)null!==this.dom.buttons[b]&&(a[b].bVisible? -d("input",this.dom.buttons[b]).attr("checked","checked"):d("input",this.dom.buttons[b]).removeAttr("checked"))},_fnAddButtons:function(){for(var a,b=","+this.s.aiExclude.join(",")+",",c=0,d=this.s.dt.aoColumns.length;c<d;c++)-1==b.indexOf(","+c+",")?(a=this._fnDomColumnButton(c),this.dom.buttons.push(a),this.dom.collection.appendChild(a)):this.dom.buttons.push(null);this.s.bRestore&&(a=this._fnDomRestoreButton(),a.className+=" ColVis_Restore",this.dom.buttons.push(a),this.dom.collection.appendChild(a)); -this.s.bShowAll&&(a=this._fnDomShowAllButton(),a.className+=" ColVis_ShowAll",this.dom.buttons.push(a),this.dom.collection.appendChild(a))},_fnDomRestoreButton:function(){var a=this,b=document.createElement("button"),c=document.createElement("span");b.className=!this.s.dt.bJUI?"ColVis_Button TableTools_Button":"ColVis_Button TableTools_Button ui-button ui-state-default";b.appendChild(c);d(c).html('<span class="ColVis_title">'+this.s.sRestore+"</span>");d(b).click(function(){for(var b=0,c=a.s.abOriginal.length;b< -c;b++)a.s.dt.oInstance.fnSetColumnVis(b,a.s.abOriginal[b],!1);a._fnAdjustOpenRows();a.s.dt.oInstance.fnDraw(!1)});return b},_fnDomShowAllButton:function(){var a=this,b=document.createElement("button"),c=document.createElement("span");b.className=!this.s.dt.bJUI?"ColVis_Button TableTools_Button":"ColVis_Button TableTools_Button ui-button ui-state-default";b.appendChild(c);d(c).html('<span class="ColVis_title">'+this.s.sShowAll+"</span>");d(b).click(function(){for(var b=0,c=a.s.abOriginal.length;b< -c;b++)-1===a.s.aiExclude.indexOf(b)&&a.s.dt.oInstance.fnSetColumnVis(b,!0,!1);a._fnAdjustOpenRows();a.s.dt.oInstance.fnDraw(!1)});return b},_fnDomColumnButton:function(a){var b=this,c=this.s.dt.aoColumns[a],e=document.createElement("button"),g=document.createElement("span"),f=this.s.dt;e.className=!f.bJUI?"ColVis_Button TableTools_Button":"ColVis_Button TableTools_Button ui-button ui-state-default";e.appendChild(g);c=null===this.s.fnLabel?c.sTitle:this.s.fnLabel(a,c.sTitle,c.nTh);d(g).html('<span class="ColVis_radio"><input type="checkbox"/></span><span class="ColVis_title">'+ -c+"</span>");d(e).click(function(c){var e=!d("input",this).is(":checked");"input"==c.target.nodeName.toLowerCase()&&(e=d("input",this).is(":checked"));c=d.fn.dataTableExt.iApiIndex;d.fn.dataTableExt.iApiIndex=b._fnDataTablesApiIndex.call(b);f.oFeatures.bServerSide&&(""!==f.oScroll.sX||""!==f.oScroll.sY)?(b.s.dt.oInstance.fnSetColumnVis(a,e,!1),b.s.dt.oInstance.oApi._fnScrollDraw(b.s.dt),b._fnDrawCallback()):b.s.dt.oInstance.fnSetColumnVis(a,e);d.fn.dataTableExt.iApiIndex=c;null!==b.s.fnStateChange&& -b.s.fnStateChange.call(b,a,e)});return e},_fnDataTablesApiIndex:function(){for(var a=0,b=this.s.dt.oInstance.length;a<b;a++)if(this.s.dt.oInstance[a]==this.s.dt.nTable)return a;return 0},_fnDomBaseButton:function(a){var b=this,c=document.createElement("button"),e=document.createElement("span"),g="mouseover"==this.s.activate?"mouseover":"click";c.className=!this.s.dt.bJUI?"ColVis_Button TableTools_Button":"ColVis_Button TableTools_Button ui-button ui-state-default";c.appendChild(e);e.innerHTML=a;d(c).bind(g, -function(a){b._fnCollectionShow();a.preventDefault()});return c},_fnDomCollection:function(){var a=document.createElement("div");a.style.display="none";a.className=!this.s.dt.bJUI?"ColVis_collection TableTools_collection":"ColVis_collection TableTools_collection ui-buttonset ui-buttonset-multi";if(!this.s.bCssPosition)a.style.position="absolute";d(a).css("opacity",0);return a},_fnDomCatcher:function(){var a=this,b=document.createElement("div");b.className="ColVis_catcher TableTools_catcher";d(b).click(function(){a._fnCollectionHide.call(a, -null,null)});return b},_fnDomBackground:function(){var a=this,b=document.createElement("div");b.style.position="absolute";b.style.left="0px";b.style.top="0px";b.className="ColVis_collectionBackground TableTools_collectionBackground";d(b).css("opacity",0);d(b).click(function(){a._fnCollectionHide.call(a,null,null)});"mouseover"==this.s.activate&&d(b).mouseover(function(){a.s.overcollection=!1;a._fnCollectionHide.call(a,null,null)});return b},_fnCollectionShow:function(){var a=this,b,c;b=d(this.dom.button).offset(); -var e=this.dom.collection,g=this.dom.background,f=parseInt(b.left,10),h=parseInt(b.top+d(this.dom.button).outerHeight(),10);if(!this.s.bCssPosition)e.style.top=h+"px",e.style.left=f+"px";e.style.display="block";d(e).css("opacity",0);c=d(window).height();var i=d(document).height(),j=d(window).width(),h=d(document).width();g.style.height=(c>i?c:i)+"px";g.style.width=(j<h?j:h)+"px";c=this.dom.catcher.style;c.height=d(this.dom.button).outerHeight()+"px";c.width=d(this.dom.button).outerWidth()+"px";c.top= -b.top+"px";c.left=f+"px";document.body.appendChild(g);document.body.appendChild(e);document.body.appendChild(this.dom.catcher);if("auto"==this.s.sSize){i=[];this.dom.collection.style.width="auto";for(b=0,c=this.dom.buttons.length;b<c;b++)if(null!==this.dom.buttons[b])this.dom.buttons[b].style.width="auto",i.push(d(this.dom.buttons[b]).outerWidth());iMax=Math.max.apply(window,i);for(b=0,c=this.dom.buttons.length;b<c;b++)if(null!==this.dom.buttons[b])this.dom.buttons[b].style.width=iMax+"px";this.dom.collection.style.width= -iMax+"px"}if(!this.s.bCssPosition&&(e.style.left="left"==this.s.sAlign?f+"px":f-d(e).outerWidth()+d(this.dom.button).outerWidth()+"px",b=d(e).outerWidth(),d(e).outerHeight(),f+b>h))e.style.left=h-b+"px";setTimeout(function(){d(e).animate({opacity:1},a.s.iOverlayFade);d(g).animate({opacity:0.1},a.s.iOverlayFade,"linear",function(){jQuery.browser.msie&&"6.0"==jQuery.browser.version&&a._fnDrawCallback()})},10);this.s.hidden=!1},_fnCollectionHide:function(){var a=this;if(!this.s.hidden&&null!==this.dom.collection)this.s.hidden= -!0,d(this.dom.collection).animate({opacity:0},a.s.iOverlayFade,function(){this.style.display="none"}),d(this.dom.background).animate({opacity:0},a.s.iOverlayFade,function(){document.body.removeChild(a.dom.background);document.body.removeChild(a.dom.catcher)})},_fnAdjustOpenRows:function(){for(var a=this.s.dt.aoOpenRows,b=this.s.dt.oApi._fnVisbleColumns(this.s.dt),c=0,d=a.length;c<d;c++)a[c].nTr.getElementsByTagName("td")[0].colSpan=b}};ColVis.fnRebuild=function(a){var b=null;if("undefined"!=typeof a)b= -a.fnSettings().nTable;for(var c=0,d=ColVis.aInstances.length;c<d;c++)("undefined"==typeof a||b==ColVis.aInstances[c].s.dt.nTable)&&ColVis.aInstances[c].fnRebuild()};ColVis.aInstances=[];ColVis.prototype.CLASS="ColVis";ColVis.VERSION="1.0.7";ColVis.prototype.VERSION=ColVis.VERSION;"function"==typeof d.fn.dataTable&&"function"==typeof d.fn.dataTableExt.fnVersionCheck&&d.fn.dataTableExt.fnVersionCheck("1.7.0")?d.fn.dataTableExt.aoFeatures.push({fnInit:function(a){return(new ColVis(a,"undefined"==typeof a.oInit.oColVis? -{}:a.oInit.oColVis)).dom.wrapper},cFeature:"C",sFeature:"ColVis"}):alert("Warning: ColVis requires DataTables 1.7 or greater - www.datatables.net/download")})(jQuery); +catcher:null,buttons:[],restore:null};ColVis.aInstances.push(this);this.s.dt=a;this._fnConstruct();return this};ColVis.prototype={fnRebuild:function(){for(var a=this.dom.buttons.length-1;0<=a;a--)null!==this.dom.buttons[a]&&this.dom.collection.removeChild(this.dom.buttons[a]);this.dom.buttons.splice(0,this.dom.buttons.length);this.dom.restore&&this.dom.restore.parentNode(this.dom.restore);this._fnAddButtons();this._fnDrawCallback()},_fnConstruct:function(){this._fnApplyCustomisation();var a=this, +b,c;this.dom.wrapper=document.createElement("div");this.dom.wrapper.className="ColVis TableTools";this.dom.button=this._fnDomBaseButton(this.s.buttonText);this.dom.button.className+=" ColVis_MasterButton";this.dom.wrapper.appendChild(this.dom.button);this.dom.catcher=this._fnDomCatcher();this.dom.collection=this._fnDomCollection();this.dom.background=this._fnDomBackground();this._fnAddButtons();b=0;for(c=this.s.dt.aoColumns.length;b<c;b++)this.s.abOriginal.push(this.s.dt.aoColumns[b].bVisible);this.s.dt.aoDrawCallback.push({fn:function(){a._fnDrawCallback.call(a)}, +sName:"ColVis"});d(this.s.dt.oInstance).bind("column-reorder",function(d,g,f){b=0;for(c=a.s.aiExclude.length;b<c;b++)a.s.aiExclude[b]=f.aiInvertMapping[a.s.aiExclude[b]];d=a.s.abOriginal.splice(f.iFrom,1)[0];a.s.abOriginal.splice(f.iTo,0,d);a.fnRebuild()})},_fnApplyCustomisation:function(){var a=this.s.oInit;"undefined"!=typeof a.activate&&(this.s.activate=a.activate);"undefined"!=typeof a.buttonText&&(this.s.buttonText=a.buttonText);"undefined"!=typeof a.aiExclude&&(this.s.aiExclude=a.aiExclude); +"undefined"!=typeof a.bRestore&&(this.s.bRestore=a.bRestore);"undefined"!=typeof a.sRestore&&(this.s.sRestore=a.sRestore);"undefined"!=typeof a.bShowAll&&(this.s.bShowAll=a.bShowAll);"undefined"!=typeof a.sShowAll&&(this.s.sShowAll=a.sShowAll);"undefined"!=typeof a.sAlign&&(this.s.sAlign=a.sAlign);"undefined"!=typeof a.fnStateChange&&(this.s.fnStateChange=a.fnStateChange);"undefined"!=typeof a.iOverlayFade&&(this.s.iOverlayFade=a.iOverlayFade);"undefined"!=typeof a.fnLabel&&(this.s.fnLabel=a.fnLabel); +"undefined"!=typeof a.sSize&&(this.s.sSize=a.sSize);"undefined"!=typeof a.bCssPosition&&(this.s.bCssPosition=a.bCssPosition)},_fnDrawCallback:function(){for(var a=this.s.dt.aoColumns,b=0,c=a.length;b<c;b++)null!==this.dom.buttons[b]&&(a[b].bVisible?d("input",this.dom.buttons[b]).attr("checked","checked"):d("input",this.dom.buttons[b]).removeAttr("checked"))},_fnAddButtons:function(){for(var a,b=","+this.s.aiExclude.join(",")+",",c=0,d=this.s.dt.aoColumns.length;c<d;c++)-1==b.indexOf(","+c+",")?(a= +this._fnDomColumnButton(c),this.dom.buttons.push(a),this.dom.collection.appendChild(a)):this.dom.buttons.push(null);this.s.bRestore&&(a=this._fnDomRestoreButton(),a.className+=" ColVis_Restore",this.dom.buttons.push(a),this.dom.collection.appendChild(a));this.s.bShowAll&&(a=this._fnDomShowAllButton(),a.className+=" ColVis_ShowAll",this.dom.buttons.push(a),this.dom.collection.appendChild(a))},_fnDomRestoreButton:function(){var a=this,b=document.createElement("button"),c=document.createElement("span"); +b.className=!this.s.dt.bJUI?"ColVis_Button TableTools_Button":"ColVis_Button TableTools_Button ui-button ui-state-default";b.appendChild(c);d(c).html('<span class="ColVis_title">'+this.s.sRestore+"</span>");d(b).click(function(){for(var b=0,c=a.s.abOriginal.length;b<c;b++)a.s.dt.oInstance.fnSetColumnVis(b,a.s.abOriginal[b],!1);a._fnAdjustOpenRows();a.s.dt.oInstance.fnAdjustColumnSizing(!1);a.s.dt.oInstance.fnDraw(!1)});return b},_fnDomShowAllButton:function(){var a=this,b=document.createElement("button"), +c=document.createElement("span");b.className=!this.s.dt.bJUI?"ColVis_Button TableTools_Button":"ColVis_Button TableTools_Button ui-button ui-state-default";b.appendChild(c);d(c).html('<span class="ColVis_title">'+this.s.sShowAll+"</span>");d(b).click(function(){for(var b=0,c=a.s.abOriginal.length;b<c;b++)-1===a.s.aiExclude.indexOf(b)&&a.s.dt.oInstance.fnSetColumnVis(b,!0,!1);a._fnAdjustOpenRows();a.s.dt.oInstance.fnAdjustColumnSizing(!1);a.s.dt.oInstance.fnDraw(!1)});return b},_fnDomColumnButton:function(a){var b= +this,c=this.s.dt.aoColumns[a],e=document.createElement("button"),g=document.createElement("span"),f=this.s.dt;e.className=!f.bJUI?"ColVis_Button TableTools_Button":"ColVis_Button TableTools_Button ui-button ui-state-default";e.appendChild(g);c=null===this.s.fnLabel?c.sTitle:this.s.fnLabel(a,c.sTitle,c.nTh);d(g).html('<span class="ColVis_radio"><input type="checkbox"/></span><span class="ColVis_title">'+c+"</span>");d(e).click(function(c){var e=!d("input",this).is(":checked");"input"==c.target.nodeName.toLowerCase()&& +(e=d("input",this).is(":checked"));c=d.fn.dataTableExt.iApiIndex;d.fn.dataTableExt.iApiIndex=b._fnDataTablesApiIndex.call(b);f.oFeatures.bServerSide&&(""!==f.oScroll.sX||""!==f.oScroll.sY)?(b.s.dt.oInstance.fnSetColumnVis(a,e,!1),b.s.dt.oInstance.fnAdjustColumnSizing(!1),b.s.dt.oInstance.oApi._fnScrollDraw(b.s.dt),b._fnDrawCallback()):b.s.dt.oInstance.fnSetColumnVis(a,e);d.fn.dataTableExt.iApiIndex=c;null!==b.s.fnStateChange&&b.s.fnStateChange.call(b,a,e)});return e},_fnDataTablesApiIndex:function(){for(var a= +0,b=this.s.dt.oInstance.length;a<b;a++)if(this.s.dt.oInstance[a]==this.s.dt.nTable)return a;return 0},_fnDomBaseButton:function(a){var b=this,c=document.createElement("button"),e=document.createElement("span"),g="mouseover"==this.s.activate?"mouseover":"click";c.className=!this.s.dt.bJUI?"ColVis_Button TableTools_Button":"ColVis_Button TableTools_Button ui-button ui-state-default";c.appendChild(e);e.innerHTML=a;d(c).bind(g,function(a){b._fnCollectionShow();a.preventDefault()});return c},_fnDomCollection:function(){var a= +document.createElement("div");a.style.display="none";a.className=!this.s.dt.bJUI?"ColVis_collection TableTools_collection":"ColVis_collection TableTools_collection ui-buttonset ui-buttonset-multi";this.s.bCssPosition||(a.style.position="absolute");d(a).css("opacity",0);return a},_fnDomCatcher:function(){var a=this,b=document.createElement("div");b.className="ColVis_catcher TableTools_catcher";d(b).click(function(){a._fnCollectionHide.call(a,null,null)});return b},_fnDomBackground:function(){var a= +this,b=document.createElement("div");b.style.position="absolute";b.style.left="0px";b.style.top="0px";b.className="ColVis_collectionBackground TableTools_collectionBackground";d(b).css("opacity",0);d(b).click(function(){a._fnCollectionHide.call(a,null,null)});"mouseover"==this.s.activate&&d(b).mouseover(function(){a.s.overcollection=!1;a._fnCollectionHide.call(a,null,null)});return b},_fnCollectionShow:function(){var a=this,b,c;b=d(this.dom.button).offset();var e=this.dom.collection,g=this.dom.background, +f=parseInt(b.left,10),h=parseInt(b.top+d(this.dom.button).outerHeight(),10);this.s.bCssPosition||(e.style.top=h+"px",e.style.left=f+"px");e.style.display="block";d(e).css("opacity",0);c=d(window).height();var i=d(document).height(),j=d(window).width(),h=d(document).width();g.style.height=(c>i?c:i)+"px";g.style.width=(j<h?j:h)+"px";c=this.dom.catcher.style;c.height=d(this.dom.button).outerHeight()+"px";c.width=d(this.dom.button).outerWidth()+"px";c.top=b.top+"px";c.left=f+"px";document.body.appendChild(g); +document.body.appendChild(e);document.body.appendChild(this.dom.catcher);if("auto"==this.s.sSize){i=[];this.dom.collection.style.width="auto";b=0;for(c=this.dom.buttons.length;b<c;b++)null!==this.dom.buttons[b]&&(this.dom.buttons[b].style.width="auto",i.push(d(this.dom.buttons[b]).outerWidth()));iMax=Math.max.apply(window,i);b=0;for(c=this.dom.buttons.length;b<c;b++)null!==this.dom.buttons[b]&&(this.dom.buttons[b].style.width=iMax+"px");this.dom.collection.style.width=iMax+"px"}this.s.bCssPosition|| +(e.style.left="left"==this.s.sAlign?f+"px":f-d(e).outerWidth()+d(this.dom.button).outerWidth()+"px",b=d(e).outerWidth(),d(e).outerHeight(),f+b>h&&(e.style.left=h-b+"px"));setTimeout(function(){d(e).animate({opacity:1},a.s.iOverlayFade);d(g).animate({opacity:0.1},a.s.iOverlayFade,"linear",function(){jQuery.browser.msie&&jQuery.browser.version=="6.0"&&a._fnDrawCallback()})},10);this.s.hidden=!1},_fnCollectionHide:function(){var a=this;!this.s.hidden&&null!==this.dom.collection&&(this.s.hidden=!0,d(this.dom.collection).animate({opacity:0}, +a.s.iOverlayFade,function(){this.style.display="none"}),d(this.dom.background).animate({opacity:0},a.s.iOverlayFade,function(){document.body.removeChild(a.dom.background);document.body.removeChild(a.dom.catcher)}))},_fnAdjustOpenRows:function(){for(var a=this.s.dt.aoOpenRows,b=this.s.dt.oApi._fnVisbleColumns(this.s.dt),c=0,d=a.length;c<d;c++)a[c].nTr.getElementsByTagName("td")[0].colSpan=b}};ColVis.fnRebuild=function(a){var b=null;"undefined"!=typeof a&&(b=a.fnSettings().nTable);for(var c=0,d=ColVis.aInstances.length;c< +d;c++)("undefined"==typeof a||b==ColVis.aInstances[c].s.dt.nTable)&&ColVis.aInstances[c].fnRebuild()};ColVis.aInstances=[];ColVis.prototype.CLASS="ColVis";ColVis.VERSION="1.0.8";ColVis.prototype.VERSION=ColVis.VERSION;"function"==typeof d.fn.dataTable&&"function"==typeof d.fn.dataTableExt.fnVersionCheck&&d.fn.dataTableExt.fnVersionCheck("1.7.0")?d.fn.dataTableExt.aoFeatures.push({fnInit:function(a){return(new ColVis(a,"undefined"==typeof a.oInit.oColVis?{}:a.oInit.oColVis)).dom.wrapper},cFeature:"C", +sFeature:"ColVis"}):alert("Warning: ColVis requires DataTables 1.7 or greater - www.datatables.net/download")})(jQuery); diff --git a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/css/TableTools.css b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/css/TableTools.css index 0d2ab8a6b1daf0dcd2cfbb264b54e8fed70935ae..46c368d4e96b9a55bd41c4bc167b4e38c4f505c1 100644 --- a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/css/TableTools.css +++ b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/css/TableTools.css @@ -33,15 +33,17 @@ div.DTTT_container { } button.DTTT_button, -div.DTTT_button { +div.DTTT_button, +a.DTTT_button { position: relative; float: left; - height: 30px; margin-right: 3px; - padding: 3px 8px; + padding: 5px 8px; border: 1px solid #999; cursor: pointer; *cursor: hand; + font-size: 0.88em; + color: black !important; -webkit-border-radius: 2px; -moz-border-radius: 2px; @@ -65,15 +67,22 @@ div.DTTT_button { filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f9f9f9',GradientType=0 ); /* IE6-9 */ } -button.DTTT_button::-moz-focus-inner { - border: none !important; - padding: 0; + +/* Buttons are cunning border-box sizing - we can't just use that for A and DIV due to IE6/7 */ +button.DTTT_button { + height: 30px; + padding: 3px 8px; +} + +.DTTT_button embed { + outline: none; } -/* This would of course be better with :hover, but for Flash interaction... */ -button.DTTT_button_hover, -div.DTTT_button_hover { +button.DTTT_button:hover, +div.DTTT_button:hover, +a.DTTT_button:hover { border: 1px solid #666; + text-decoration: none !important; -webkit-box-shadow: 1px 1px 3px #999; -moz-box-shadow: 1px 1px 3px #999; @@ -91,7 +100,8 @@ div.DTTT_button_hover { } button.DTTT_disabled, -div.DTTT_disabled { +div.DTTT_disabled, +a.DTTT_disabled { color: #999; border: 1px solid #d0d0d0; @@ -132,19 +142,19 @@ button.DTTT_button_print span { button.DTTT_button_csv span { background: url(../images/csv.png) no-repeat bottom right; } -button.DTTT_button_csv_hover span { background: url(../images/csv_hover.png) no-repeat center right; } +button.DTTT_button_csv:hover span { background: url(../images/csv_hover.png) no-repeat center right; } button.DTTT_button_xls span { background: url(../images/xls.png) no-repeat center right; } -button.DTTT_button_xls_hover span { background: #f0f0f0 url(../images/xls_hover.png) no-repeat center right; } +button.DTTT_button_xls:hover span { background: #f0f0f0 url(../images/xls_hover.png) no-repeat center right; } button.DTTT_button_copy span { background: url(../images/copy.png) no-repeat center right; } -button.DTTT_button_copy_hover span { background: #f0f0f0 url(../images/copy_hover.png) no-repeat center right; } +button.DTTT_button_copy:hover span { background: #f0f0f0 url(../images/copy_hover.png) no-repeat center right; } button.DTTT_button_pdf span { background: url(../images/pdf.png) no-repeat center right; } -button.DTTT_button_pdf_hover span { background: #f0f0f0 url(../images/pdf_hover.png) no-repeat center right; } +button.DTTT_button_pdf:hover span { background: #f0f0f0 url(../images/pdf_hover.png) no-repeat center right; } button.DTTT_button_print span { background: url(../images/print.png) no-repeat center right; } -button.DTTT_button_print_hover span { background: #f0f0f0 url(../images/print_hover.png) no-repeat center right; } +button.DTTT_button_print:hover span { background: #f0f0f0 url(../images/print_hover.png) no-repeat center right; } */ @@ -153,9 +163,8 @@ button.DTTT_button_collection span { background: url(../images/collection.png) no-repeat center right; } -button.DTTT_button_collection_hover span { +button.DTTT_button_collection:hover span { padding-right: 17px; - border: 1px solid #999; background: #f0f0f0 url(../images/collection_hover.png) no-repeat center right; } @@ -210,11 +219,25 @@ table.dataTable tr.DTTT_selected.even td.sorting_3 { div.DTTT_collection { width: 150px; - padding: 3px; + padding: 8px 8px 4px 8px; border: 1px solid #ccc; + border: 1px solid rgba( 0, 0, 0, 0.4 ); background-color: #f3f3f3; + background-color: rgba( 255, 255, 255, 0.3 ); overflow: hidden; z-index: 2002; + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -ms-border-radius: 5px; + -o-border-radius: 5px; + border-radius: 5px; + + -webkit-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); + -moz-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); + -ms-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); + -o-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); + box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); } div.DTTT_collection_background { @@ -222,11 +245,22 @@ div.DTTT_collection_background { z-index: 2001; } -div.DTTT_collection button.DTTT_button { +div.DTTT_collection button.DTTT_button, +div.DTTT_collection div.DTTT_button, +div.DTTT_collection a.DTTT_button { + position: relative; + left: 0; + right: 0; + + display: block; float: none; - width: 100%; - margin-bottom: 2px; - background-color: white; + margin-bottom: 4px; + + -webkit-box-shadow: 1px 1px 3px #999; + -moz-box-shadow: 1px 1px 3px #999; + -ms-box-shadow: 1px 1px 3px #999; + -o-box-shadow: 1px 1px 3px #999; + box-shadow: 1px 1px 3px #999; } @@ -236,7 +270,7 @@ div.DTTT_collection button.DTTT_button { */ .DTTT_print_info { - position: absolute; + position: fixed; top: 50%; left: 50%; width: 400px; @@ -244,23 +278,33 @@ div.DTTT_collection button.DTTT_button { margin-left: -200px; margin-top: -75px; text-align: center; - background-color: #3f3f3f; - color: white; + color: #333; padding: 10px 30px; + + background: #ffffff; /* Old browsers */ + background: -webkit-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* FF3.6+ */ + background: -ms-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* IE10+ */ + background: -o-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Opera 11.10+ */ + background: linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f9f9f9',GradientType=0 ); /* IE6-9 */ - opacity: 0.9; + opacity: 0.95; + + border: 1px solid black; + border: 1px solid rgba(0, 0, 0, 0.5); - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - -ms-border-radius: 5px; - -o-border-radius: 5px; - border-radius: 5px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + -ms-border-radius: 6px; + -o-border-radius: 6px; + border-radius: 6px; - -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5); - -moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5); - -ms-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5); - -o-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5); - box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5); + -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); + -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); + -ms-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); + -o-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); + box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); } .DTTT_print_info h6 { diff --git a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/css/TableTools_JUI.css b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/css/TableTools_JUI.css index 6a11c8886d58ada1bf6519ba71d31b8ae76042ec..963405f2d5771249b318ce7ee7e2ed911ae5d11e 100644 --- a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/css/TableTools_JUI.css +++ b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/css/TableTools_JUI.css @@ -41,19 +41,19 @@ div.DTTT_container { float: left; } -button.DTTT_button { +.DTTT_button { position: relative; float: left; - height: 24px; margin-right: 3px; padding: 3px 10px; border: 1px solid #d0d0d0; background-color: #fff; + color: #333 !important; cursor: pointer; *cursor: hand; } -button.DTTT_button::-moz-focus-inner { +.DTTT_button::-moz-focus-inner { border: none !important; padding: 0; } @@ -124,7 +124,9 @@ div.DTTT_collection_background { z-index: 2001; } -div.DTTT_collection button.DTTT_button { +div.DTTT_collection button.DTTT_button, +div.DTTT_collection div.DTTT_button, +div.DTTT_collection a.DTTT_button { float: none; width: 100%; margin-bottom: -0.1em; diff --git a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/js/TableTools.js b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/js/TableTools.js index 11c34dd035e6316b3f76ee8b8ea5b31f59480586..9e0cb0099daf6c4b51bd5f3e4ffa1274cfafebe3 100644 --- a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/js/TableTools.js +++ b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/js/TableTools.js @@ -1,6 +1,6 @@ /* * File: TableTools.js - * Version: 2.0.3 + * Version: 2.1.4 * Description: Tools and buttons for DataTables * Author: Allan Jardine (www.sprymedia.co.uk) * Language: Javascript @@ -36,7 +36,7 @@ var TableTools; TableTools = function( oDT, oOpts ) { /* Santiy check that we are a new instance */ - if ( !this.CLASS || this.CLASS != "TableTools" ) + if ( ! this instanceof TableTools ) { alert( "Warning: TableTools must be initialised with the keyword 'new'" ); } @@ -51,7 +51,7 @@ TableTools = function( oDT, oOpts ) */ this.s = { /** - * Store 'this' so the instance can be retreieved from the settings object + * Store 'this' so the instance can be retrieved from the settings object * @property that * @type object * @default this @@ -62,9 +62,9 @@ TableTools = function( oDT, oOpts ) * DataTables settings objects * @property dt * @type object - * @default null + * @default <i>From the oDT init option</i> */ - "dt": null, + "dt": oDT.fnSettings(), /** * @namespace Print specific information @@ -204,7 +204,13 @@ TableTools = function( oDT, oOpts ) * @type boolean * @default false */ - "master": false + "master": false, + + /** + * Tag names that are used for creating collections and buttons + * @namesapce + */ + "tags": {} }; @@ -241,7 +247,7 @@ TableTools = function( oDT, oOpts ) "hidden": [], /** - * The information display saying tellng the user about the print display + * The information display saying telling the user about the print display * @property message * @type node * @default null @@ -270,7 +276,16 @@ TableTools = function( oDT, oOpts ) "background": null } }; - + + /** + * @namespace Name space for the classes that this TableTools instance will use + * @extends TableTools.classes + */ + this.classes = $.extend( true, {}, TableTools.classes ); + if ( this.s.dt.bJUI ) + { + $.extend( true, this.classes, TableTools.classes_themeroller ); + } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -293,7 +308,6 @@ TableTools = function( oDT, oOpts ) oOpts = {}; } - this.s.dt = oDT.fnSettings(); this._fnConstruct( oOpts ); return this; @@ -308,31 +322,64 @@ TableTools.prototype = { /** * Retreieve the settings object from an instance - * @method fnGetSelected * @returns {array} List of TR nodes which are currently selected + * @param {boolean} [filtered=false] Get only selected rows which are + * available given the filtering applied to the table. By default + * this is false - i.e. all rows, regardless of filtering are + selected. */ - "fnGetSelected": function () + "fnGetSelected": function ( filtered ) { - var masterS = this._fnGetMasterSettings(); - return masterS.select.selected; + var + out = [], + data = this.s.dt.aoData, + displayed = this.s.dt.aiDisplay, + i, iLen; + + if ( filtered ) + { + // Only consider filtered rows + for ( i=0, iLen=displayed.length ; i<iLen ; i++ ) + { + if ( data[ displayed[i] ]._DTTT_selected ) + { + out.push( data[ displayed[i] ].nTr ); + } + } + } + else + { + // Use all rows + for ( i=0, iLen=data.length ; i<iLen ; i++ ) + { + if ( data[i]._DTTT_selected ) + { + out.push( data[i].nTr ); + } + } + } + + return out; }, /** * Get the data source objects/arrays from DataTables for the selected rows (same as * fnGetSelected followed by fnGetData on each row from the table) - * @method fnGetSelectedData * @returns {array} Data from the TR nodes which are currently selected */ "fnGetSelectedData": function () { - var masterS = this._fnGetMasterSettings(); - var selected = masterS.select.selected; var out = []; + var data=this.s.dt.aoData; + var i, iLen; - for ( var i=0, iLen=selected.length ; i<iLen ; i++ ) + for ( i=0, iLen=data.length ; i<iLen ; i++ ) { - out.push( this.s.dt.oInstance.fnGetData( selected[i] ) ); + if ( data[i]._DTTT_selected ) + { + out.push( this.s.dt.oInstance.fnGetData(i) ); + } } return out; @@ -341,96 +388,80 @@ TableTools.prototype = { /** * Check to see if a current row is selected or not - * @method fnGetSelected * @param {Node} n TR node to check if it is currently selected or not * @returns {Boolean} true if select, false otherwise */ "fnIsSelected": function ( n ) { - var selected = this.fnGetSelected(); - for ( var i=0, iLen=selected.length ; i<iLen ; i++ ) - { - if ( n == selected[i] ) - { - return true; - } - } - return false; + var pos = this.s.dt.oInstance.fnGetPosition( n ); + return (this.s.dt.aoData[pos]._DTTT_selected===true) ? true : false; }, /** * Select all rows in the table - * @method fnSelectAll - * @returns void + * @param {boolean} [filtered=false] Select only rows which are available + * given the filtering applied to the table. By default this is false - + * i.e. all rows, regardless of filtering are selected. */ - "fnSelectAll": function () + "fnSelectAll": function ( filtered ) { - var masterS = this._fnGetMasterSettings(); - masterS.that._fnRowSelectAll(); + var s = this._fnGetMasterSettings(); + + this._fnRowSelect( (filtered === true) ? + s.dt.aiDisplay : + s.dt.aoData + ); }, /** * Deselect all rows in the table - * @method fnSelectNone - * @returns void + * @param {boolean} [filtered=false] Deselect only rows which are available + * given the filtering applied to the table. By default this is false - + * i.e. all rows, regardless of filtering are deselected. */ - "fnSelectNone": function () + "fnSelectNone": function ( filtered ) { - var masterS = this._fnGetMasterSettings(); - masterS.that._fnRowDeselectAll(); + var s = this._fnGetMasterSettings(); + + this._fnRowDeselect( this.fnGetSelected(filtered) ); }, /** - * Select an individual row - * @method fnSelect - * @returns void + * Select row(s) + * @param {node|object|array} n The row(s) to select. Can be a single DOM + * TR node, an array of TR nodes or a jQuery object. */ "fnSelect": function ( n ) { - /* Check if the row is already selected */ - if ( !this.fnIsSelected( n ) ) + if ( this.s.select.type == "single" ) { - if ( this.s.select.type == "single" ) - { - this._fnRowSelectSingle( n ); - } - else if ( this.s.select.type == "multi" ) - { - this._fnRowSelectMulti( n ); - } + this.fnSelectNone(); + this._fnRowSelect( n ); + } + else if ( this.s.select.type == "multi" ) + { + this._fnRowSelect( n ); } }, /** - * Deselect an individual row - * @method fnDeselect - * @returns void + * Deselect row(s) + * @param {node|object|array} n The row(s) to deselect. Can be a single DOM + * TR node, an array of TR nodes or a jQuery object. */ "fnDeselect": function ( n ) { - /* Check if the row is already deselected */ - if ( this.fnIsSelected( n ) ) - { - if ( this.s.select.type == "single" ) - { - this._fnRowSelectSingle( n ); - } - else if ( this.s.select.type == "multi" ) - { - this._fnRowSelectMulti( n ); - } - } + this._fnRowDeselect( n ); }, /** * Get the title of the document - useful for file names. The title is retrieved from either * the configuration object's 'title' parameter, or the HTML document title - * @method fnGetTitle * @param {Object} oConfig Button configuration object * @returns {String} Button title */ @@ -462,7 +493,6 @@ TableTools.prototype = { * Calculate a unity array with the column width by proportion for a set of columns to be * included for a button. This is particularly useful for PDF creation, where we can use the * column widths calculated by the browser to size the columns in the PDF. - * @method fnCalcColRations * @param {Object} oConfig Button configuration object * @returns {Array} Unity array of column ratios */ @@ -495,7 +525,6 @@ TableTools.prototype = { /** * Get the information contained in a table as a string - * @method fnGetTableData * @param {Object} oConfig Button configuration object * @returns {String} Table data as a string */ @@ -511,10 +540,8 @@ TableTools.prototype = { /** * Pass text to a flash button instance, which will be used on the button's click handler - * @method fnSetText * @param {Object} clip Flash button object * @param {String} text Text to set - * @returns void */ "fnSetText": function ( clip, text ) { @@ -526,8 +553,6 @@ TableTools.prototype = { * Resize the flash elements of the buttons attached to this TableTools instance - this is * useful for when initialising TableTools when it is hidden (display:none) since sizes can't * be calculated at that time. - * @method fnResizeButtons - * @returns void */ "fnResizeButtons": function () { @@ -537,7 +562,7 @@ TableTools.prototype = { { var client = ZeroClipboard_TableTools.clients[cli]; if ( typeof client.domElement != 'undefined' && - client.domElement.parentNode == this.dom.container ) + client.domElement.parentNode ) { client.positionElement(); } @@ -548,8 +573,6 @@ TableTools.prototype = { /** * Check to see if any of the ZeroClipboard client's attached need to be resized - * @method fnResizeRequired - * @returns void */ "fnResizeRequired": function () { @@ -570,6 +593,55 @@ TableTools.prototype = { }, + /** + * Programmatically enable or disable the print view + * @param {boolean} [bView=true] Show the print view if true or not given. If false, then + * terminate the print view and return to normal. + * @param {object} [oConfig={}] Configuration for the print view + * @param {boolean} [oConfig.bShowAll=false] Show all rows in the table if true + * @param {string} [oConfig.sInfo] Information message, displayed as an overlay to the + * user to let them know what the print view is. + * @param {string} [oConfig.sMessage] HTML string to show at the top of the document - will + * be included in the printed document. + */ + "fnPrint": function ( bView, oConfig ) + { + if ( oConfig === undefined ) + { + oConfig = {}; + } + + if ( bView === undefined || bView ) + { + this._fnPrintStart( oConfig ); + } + else + { + this._fnPrintEnd(); + } + }, + + + /** + * Show a message to the end user which is nicely styled + * @param {string} message The HTML string to show to the user + * @param {int} time The duration the message is to be shown on screen for (mS) + */ + "fnInfo": function ( message, time ) { + var nInfo = document.createElement( "div" ); + nInfo.className = this.classes.print.info; + nInfo.innerHTML = message; + + document.body.appendChild( nInfo ); + + setTimeout( function() { + $(nInfo).fadeOut( "normal", function() { + document.body.removeChild( nInfo ); + } ); + }, time ); + }, + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Private methods (they are of course public in JS, but recommended as private) @@ -589,9 +661,8 @@ TableTools.prototype = { this._fnCustomiseSettings( oOpts ); /* Container element */ - this.dom.container = document.createElement('div'); - this.dom.container.className = !this.s.dt.bJUI ? "DTTT_container" : - "DTTT_container ui-buttonset ui-buttonset-multi"; + this.dom.container = document.createElement( this.s.tags.container ); + this.dom.container.className = this.classes.container; /* Row selection config */ if ( this.s.select.type != 'none' ) @@ -646,8 +717,15 @@ TableTools.prototype = { this.s.select.preRowSelect = this.s.custom.fnPreRowSelect; this.s.select.postSelected = this.s.custom.fnRowSelected; this.s.select.postDeselected = this.s.custom.fnRowDeselected; - this.s.select.selectedClass = this.s.custom.sSelectedClass; - + + // Backwards compatibility - allow the user to specify a custom class in the initialiser + if ( this.s.custom.sSelectedClass ) + { + this.classes.select.row = this.s.custom.sSelectedClass; + } + + this.s.tags = this.s.custom.oTags; + /* Button set */ this.s.buttonSet = this.s.custom.aButtons; }, @@ -688,17 +766,10 @@ TableTools.prototype = { buttonDef = $.extend( o, buttonSet[i], true ); } - if ( this.s.dt.bJUI ) - { - buttonDef.sButtonClass += " ui-button ui-state-default"; - buttonDef.sButtonClassHover += " ui-state-hover"; - } - else - { - buttonDef.sButtonClassHover += " DTTT_button_hover"; - } - - wrapper.appendChild( this._fnCreateButton( buttonDef ) ); + wrapper.appendChild( this._fnCreateButton( + buttonDef, + $(wrapper).hasClass(this.classes.collection.container) + ) ); } }, @@ -710,16 +781,11 @@ TableTools.prototype = { * @returns {Node} Button element * @private */ - "_fnCreateButton": function ( oConfig ) + "_fnCreateButton": function ( oConfig, bCollectionButton ) { - var nButton = (oConfig.sAction == 'div') ? - this._fnDivBase( oConfig ) : this._fnButtonBase( oConfig ); + var nButton = this._fnButtonBase( oConfig, bCollectionButton ); - if ( oConfig.sAction == "print" ) - { - this._fnPrintConfig( nButton, oConfig ); - } - else if ( oConfig.sAction.match(/flash/) ) + if ( oConfig.sAction.match(/flash/) ) { this._fnFlashConfig( nButton, oConfig ); } @@ -748,14 +814,29 @@ TableTools.prototype = { * @returns {Node} DIV element for the button * @private */ - "_fnButtonBase": function ( o ) + "_fnButtonBase": function ( o, bCollectionButton ) { + var sTag, sLiner, sClass; + + if ( bCollectionButton ) + { + sTag = o.sTag !== "default" ? o.sTag : this.s.tags.collection.button; + sLiner = o.sLinerTag !== "default" ? o.sLiner : this.s.tags.collection.liner; + sClass = this.classes.collection.buttons.normal; + } + else + { + sTag = o.sTag !== "default" ? o.sTag : this.s.tags.button; + sLiner = o.sLinerTag !== "default" ? o.sLiner : this.s.tags.liner; + sClass = this.classes.buttons.normal; + } + var - nButton = document.createElement('button'), - nSpan = document.createElement('span'), - masterS = this._fnGetMasterSettings(); + nButton = document.createElement( sTag ), + nSpan = document.createElement( sLiner ), + masterS = this._fnGetMasterSettings(); - nButton.className = "DTTT_button "+o.sButtonClass; + nButton.className = sClass+" "+o.sButtonClass; nButton.setAttribute('id', "ToolTables_"+this.s.dt.sInstance+"_"+masterS.buttonCounter ); nButton.appendChild( nSpan ); nSpan.innerHTML = o.sButtonText; @@ -766,34 +847,6 @@ TableTools.prototype = { }, - /** - * Create a DIV element to use for a non-button - * @method _fnDivBase - * @param {o} oConfig Button configuration object - * @returns {Node} DIV element for the button - * @private - */ - "_fnDivBase": function ( o ) - { - var - nDiv = document.createElement('div'), - masterS = this._fnGetMasterSettings(); - - nDiv.className = o.sButtonClass; - nDiv.setAttribute('id', "ToolTables_"+this.s.dt.sInstance+"_"+masterS.buttonCounter ); - nDiv.innerHTML = o.sButtonText; - - if ( o.nContent !== null ) - { - nDiv.appendChild( o.nContent ); - } - - masterS.buttonCounter++; - - return nDiv; - }, - - /** * Get the settings object for the master instance. When more than one TableTools instance is * assigned to a DataTable, only one of them can be the 'master' (for the select rows). As such, @@ -829,7 +882,7 @@ TableTools.prototype = { */ /** - * Create a collection button, when activated will present a drop downlist of other buttons + * Create a collection button, when activated will present a drop down list of other buttons * @param {Node} nButton Button to use for the collection activation * @param {Object} oConfig Button configuration object * @returns void @@ -837,10 +890,9 @@ TableTools.prototype = { */ "_fnCollectionConfig": function ( nButton, oConfig ) { - var nHidden = document.createElement('div'); + var nHidden = document.createElement( this.s.tags.collection.container ); nHidden.style.display = "none"; - nHidden.className = !this.s.dt.bJUI ? "DTTT_collection" : - "DTTT_collection ui-buttonset ui-buttonset-multi"; + nHidden.className = this.classes.collection.container; oConfig._collection = nHidden; document.body.appendChild( nHidden ); @@ -878,7 +930,7 @@ TableTools.prototype = { nBackground.style.top = "0px"; nBackground.style.height = ((iWinHeight>iDocHeight)? iWinHeight : iDocHeight) +"px"; nBackground.style.width = ((iWinWidth>iDocWidth)? iWinWidth : iDocWidth) +"px"; - nBackground.className = "DTTT_collection_background"; + nBackground.className = this.classes.collection.background; $(nBackground).css('opacity',0); document.body.appendChild( nBackground ); @@ -908,6 +960,9 @@ TableTools.prototype = { $(nHidden).animate({"opacity": 1}, 500); $(nBackground).animate({"opacity": 0.25}, 500); }, 10 ); + + /* Resize the buttons to the Flash contents fit */ + this.fnResizeButtons(); /* Event handler to remove the collection display */ $(nBackground).click( function () { @@ -964,229 +1019,197 @@ TableTools.prototype = { var that = this, i, iLen, + dt = this.s.dt, aoOpenRows = this.s.dt.aoOpenRows; - $(that.s.dt.nTable).addClass( 'DTTT_selectable' ); + $(dt.nTable).addClass( this.classes.select.table ); - $('tr', that.s.dt.nTBody).live( 'click', function(e) { + $('tr', dt.nTBody).live( 'click', function(e) { /* Sub-table must be ignored (odd that the selector won't do this with >) */ - if ( this.parentNode != that.s.dt.nTBody ) + if ( this.parentNode != dt.nTBody ) { return; } /* Check that we are actually working with a DataTables controlled row */ - var anTableRows = that.s.dt.oInstance.fnGetNodes(); - if ( $.inArray( this, anTableRows ) === -1 ) { + if ( dt.oInstance.fnGetData(this) === null ) + { return; } - - /* User defined selection function */ - if ( that.s.select.preRowSelect !== null && !that.s.select.preRowSelect.call(that, e) ) + + if ( that.fnIsSelected( this ) ) { - return; + that._fnRowDeselect( this, e ); } - - /* And go */ - if ( that.s.select.type == "single" ) + else if ( that.s.select.type == "single" ) { - that._fnRowSelectSingle.call( that, this ); + that.fnSelectNone(); + that._fnRowSelect( this, e ); } - else + else if ( that.s.select.type == "multi" ) { - that._fnRowSelectMulti.call( that, this ); + that._fnRowSelect( this, e ); } } ); - - /* Add a draw callback handler for when 'select' all is active and we are using server-side - * processing, so TableTools will automatically select the new rows for us - */ - that.s.dt.aoDrawCallback.push( { - "fn": function () { - if ( that.s.select.all && that.s.dt.oFeatures.bServerSide ) - { - that.fnSelectAll(); - } - }, - "sName": "TableTools_select" - } ); + + // Bind a listener to the DataTable for when new rows are created. + // This allows rows to be visually selected when they should be and + // deferred rendering is used. + dt.oApi._fnCallbackReg( dt, 'aoRowCreatedCallback', function (tr, data, index) { + if ( dt.aoData[index]._DTTT_selected ) { + $(tr).addClass( that.classes.select.row ); + } + }, 'TableTools-SelectAll' ); } }, - - + /** - * Select or deselect a row based on its current state when only one row is allowed to be - * selected at a time (i.e. if there is a row already selected, deselect it). If the selected - * row is the one being passed in, just deselect and take no further action. - * @method _fnRowSelectSingle - * @param {Node} nNode TR element which is being 'activated' in some way - * @returns void + * Select rows + * @param {*} src Rows to select - see _fnSelectData for a description of valid inputs * @private */ - "_fnRowSelectSingle": function ( nNode ) + "_fnRowSelect": function ( src, e ) { - if ( this.s.master ) + var + that = this, + data = this._fnSelectData( src ), + firstTr = data.length===0 ? null : data[0].nTr, + anSelected = [], + i, len; + + // Get all the rows that will be selected + for ( i=0, len=data.length ; i<len ; i++ ) { - /* Do nothing on the DataTables 'empty' result set row */ - if ( $('td', nNode).hasClass(this.s.dt.oClasses.sRowEmpty) ) - { - return; - } - - if ( $(nNode).hasClass(this.s.select.selectedClass) ) - { - this._fnRowDeselect( nNode ); - } - else + if ( data[i].nTr ) { - if ( this.s.select.selected.length !== 0 ) - { - this._fnRowDeselectAll(); - } - - this.s.select.selected.push( nNode ); - $(nNode).addClass( this.s.select.selectedClass ); - - if ( this.s.select.postSelected !== null ) - { - this.s.select.postSelected.call( this, nNode ); - } + anSelected.push( data[i].nTr ); } - - TableTools._fnEventDispatch( this, 'select', nNode ); } - }, - - - /** - * Select or deselect a row based on its current state when multiple rows are allowed to be - * selected. - * @method _fnRowSelectMulti - * @param {Node} nNode TR element which is being 'activated' in some way - * @returns void - * @private - */ - "_fnRowSelectMulti": function ( nNode ) - { - if ( this.s.master ) + + // User defined pre-selection function + if ( this.s.select.preRowSelect !== null && !this.s.select.preRowSelect.call(this, e, anSelected, true) ) { - /* Do nothing on the DataTables 'empty' result set row */ - if ( $('td', nNode).hasClass(this.s.dt.oClasses.sRowEmpty) ) - { - return; - } - - if ( $(nNode).hasClass(this.s.select.selectedClass) ) - { - this._fnRowDeselect( nNode ); - } - else - { - this.s.select.selected.push( nNode ); - $(nNode).addClass( this.s.select.selectedClass ); - - if ( this.s.select.postSelected !== null ) - { - this.s.select.postSelected.call( this, nNode ); - } - } - - TableTools._fnEventDispatch( this, 'select', nNode ); + return; } - }, - - - /** - * Select all TR elements in the table. Note that this function will still operate in 'single' - * select mode, which might not be what you desire (in which case, don't call this function!) - * @method _fnRowSelectAll - * @returns void - * @private - */ - "_fnRowSelectAll": function ( ) - { - if ( this.s.master ) + + // Mark them as selected + for ( i=0, len=data.length ; i<len ; i++ ) { - var n; - for ( var i=0, iLen=this.s.dt.aiDisplayMaster.length ; i<iLen ; i++ ) - { - n = this.s.dt.aoData[ this.s.dt.aiDisplayMaster[i] ].nTr; - - if ( !$(n).hasClass(this.s.select.selectedClass) ) - { - this.s.select.selected.push( n ); - $(n).addClass( this.s.select.selectedClass ); - } - } + data[i]._DTTT_selected = true; - if ( this.s.select.postSelected !== null ) + if ( data[i].nTr ) { - this.s.select.postSelected.call( this, null ); + $(data[i].nTr).addClass( that.classes.select.row ); } - - this.s.select.all = true; - TableTools._fnEventDispatch( this, 'select', null ); } + + // Post-selection function + if ( this.s.select.postSelected !== null ) + { + this.s.select.postSelected.call( this, anSelected ); + } + + TableTools._fnEventDispatch( this, 'select', anSelected, true ); }, - - + /** - * Deselect all TR elements in the table. If nothing is currently selected, then no action is - * taken. - * @method _fnRowDeselectAll - * @returns void + * Deselect rows + * @param {*} src Rows to deselect - see _fnSelectData for a description of valid inputs * @private */ - "_fnRowDeselectAll": function ( ) + "_fnRowDeselect": function ( src, e ) { - if ( this.s.master ) + var + that = this, + data = this._fnSelectData( src ), + firstTr = data.length===0 ? null : data[0].nTr, + anDeselectedTrs = [], + i, len; + + // Get all the rows that will be deselected + for ( i=0, len=data.length ; i<len ; i++ ) { - for ( var i=this.s.select.selected.length-1 ; i>=0 ; i-- ) + if ( data[i].nTr ) { - this._fnRowDeselect( i, false ); + anDeselectedTrs.push( data[i].nTr ); } + } + + // User defined pre-selection function + if ( this.s.select.preRowSelect !== null && !this.s.select.preRowSelect.call(this, e, anDeselectedTrs, false) ) + { + return; + } + + // Mark them as deselected + for ( i=0, len=data.length ; i<len ; i++ ) + { + data[i]._DTTT_selected = false; - if ( this.s.select.postDeselected !== null ) + if ( data[i].nTr ) { - this.s.select.postDeselected.call( this, null ); + $(data[i].nTr).removeClass( that.classes.select.row ); } - - this.s.select.all = false; - TableTools._fnEventDispatch( this, 'select', null ); } + + // Post-deselection function + if ( this.s.select.postDeselected !== null ) + { + this.s.select.postDeselected.call( this, anDeselectedTrs ); + } + + TableTools._fnEventDispatch( this, 'select', anDeselectedTrs, false ); }, - /** - * Deselect a single row, based on its index in the selected array, or a TR node (when the - * index is then computed) - * @method _fnRowDeselect - * @param {int|Node} i Node or index of node in selected array, which is to be deselected - * @param {bool} [action=true] Run the post deselected method or not - * @returns void - * @private + * Take a data source for row selection and convert it into aoData points for the DT + * @param {*} src Can be a single DOM TR node, an array of TR nodes (including a + * a jQuery object), a single aoData point from DataTables, an array of aoData + * points or an array of aoData indexes + * @returns {array} An array of aoData points */ - "_fnRowDeselect": function ( i, action ) + "_fnSelectData": function ( src ) { - if ( typeof i.nodeName != 'undefined' ) + var out = [], pos, i, iLen; + + if ( src.nodeName ) { - i = $.inArray( i, this.s.select.selected ); + // Single node + pos = this.s.dt.oInstance.fnGetPosition( src ); + out.push( this.s.dt.aoData[pos] ); } - - var nNode = this.s.select.selected[i]; - $(nNode).removeClass(this.s.select.selectedClass); - this.s.select.selected.splice( i, 1 ); - - if ( (typeof action == 'undefined' || action) && this.s.select.postDeselected !== null ) + else if ( typeof src.length !== 'undefined' ) + { + // jQuery object or an array of nodes, or aoData points + for ( i=0, iLen=src.length ; i<iLen ; i++ ) + { + if ( src[i].nodeName ) + { + pos = this.s.dt.oInstance.fnGetPosition( src[i] ); + out.push( this.s.dt.aoData[pos] ); + } + else if ( typeof src[i] === 'number' ) + { + out.push( this.s.dt.aoData[ src[i] ] ); + } + else + { + out.push( src[i] ); + } + } + + return out; + } + else { - this.s.select.postDeselected.call( this, nNode ); + // A single aoData point + out.push( src ); } - - this.s.select.all = false; + + return out; }, - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Text button functions */ @@ -1214,13 +1237,11 @@ TableTools.prototype = { } $(nButton).hover( function () { - $(nButton).addClass(oConfig.sButtonClassHover ); if ( oConfig.fnMouseover !== null ) { oConfig.fnMouseover.call( this, nButton, oConfig, null ); } }, function () { - $(nButton).removeClass( oConfig.sButtonClassHover ); if ( oConfig.fnMouseout !== null ) { oConfig.fnMouseout.call( this, nButton, oConfig, null ); @@ -1235,7 +1256,7 @@ TableTools.prototype = { } $(nButton).click( function (e) { - e.preventDefault(); + //e.preventDefault(); if ( oConfig.fnClick !== null ) { @@ -1296,8 +1317,6 @@ TableTools.prototype = { } flash.addEventListener('mouseOver', function(client) { - $(nButton).addClass(oConfig.sButtonClassHover ); - if ( oConfig.fnMouseover !== null ) { oConfig.fnMouseover.call( that, nButton, oConfig, flash ); @@ -1305,8 +1324,6 @@ TableTools.prototype = { } ); flash.addEventListener('mouseOut', function(client) { - $(nButton).removeClass( oConfig.sButtonClassHover ); - if ( oConfig.fnMouseout !== null ) { oConfig.fnMouseout.call( that, nButton, oConfig, flash ); @@ -1350,16 +1367,6 @@ TableTools.prototype = { if ( document.getElementById(id) ) { flash.glue( node, text ); - - /* Catch those who are using a TableTools 1 version of ZeroClipboard */ - if ( flash.domElement.parentNode != flash.div.parentNode && - typeof that.__bZCWarning == 'undefined' ) - { - that.s.dt.oApi._fnLog( this.s.dt, 0, "It looks like you are using the version of "+ - "ZeroClipboard which came with TableTools 1. Please update to use the version that "+ - "came with TableTools 2." ); - that.__bZCWarning = true; - } } else { @@ -1374,9 +1381,9 @@ TableTools.prototype = { * Set the text for the flash clip to deal with * * This function is required for large information sets. There is a limit on the - * amount of data that can be transfered between Javascript and Flash in a single call, so + * amount of data that can be transferred between Javascript and Flash in a single call, so * we use this method to build up the text in Flash by sending over chunks. It is estimated - * that the data limit is around 64k, although it is undocuments, and appears to be different + * that the data limit is around 64k, although it is undocumented, and appears to be different * between different flash versions. We chunk at 8KiB. * @method _fnFlashSetText * @param {Object} clip the ZeroClipboard object @@ -1405,7 +1412,7 @@ TableTools.prototype = { * Convert the mixed columns variable into a boolean array the same size as the columns, which * indicates which columns we want to include * @method _fnColumnTargets - * @param {String|Array} mColumns The columns to be included in data retreieval. If a string + * @param {String|Array} mColumns The columns to be included in data retrieval. If a string * then it can take the value of "visible" or "hidden" (to include all visible or * hidden columns respectively). Or an array of column indexes * @returns {Array} A boolean array the length of the columns of the table, which each value @@ -1486,20 +1493,20 @@ TableTools.prototype = { * @method _fnGetDataTablesData * @param {Object} oConfig Button configuration object * @param {String} oConfig.sFieldBoundary Field boundary for the data cells in the string - * @param {String} oConfig.sFieldSeperator Field seperator for the data cells + * @param {String} oConfig.sFieldSeperator Field separator for the data cells * @param {String} oConfig.sNewline New line options * @param {Mixed} oConfig.mColumns Which columns should be included in the output * @param {Boolean} oConfig.bHeader Include the header * @param {Boolean} oConfig.bFooter Include the footer * @param {Boolean} oConfig.bSelectedOnly Include only the selected rows in the output - * @returns {String} Concatinated string of data + * @returns {String} Concatenated string of data * @private */ "_fnGetDataTablesData": function ( oConfig ) { var i, iLen, j, jLen; - var aRow, aData=[], sLoopData=''; - var dt = this.s.dt; + var aRow, aData=[], sLoopData='', arr; + var dt = this.s.dt, tr, child; var regex = new RegExp(oConfig.sFieldBoundary, "g"); /* Do it here for speed */ var aColumnsInc = this._fnColumnTargets( oConfig.mColumns ); var bSelectedOnly = (typeof oConfig.bSelectedOnly != 'undefined') ? oConfig.bSelectedOnly : false; @@ -1528,49 +1535,68 @@ TableTools.prototype = { /* * Body */ - for ( j=0, jLen=dt.aiDisplay.length ; j<jLen ; j++ ) + var aDataIndex = dt.aiDisplay; + var aSelected = this.fnGetSelected(); + if ( this.s.select.type !== "none" && bSelectedOnly && aSelected.length !== 0 ) { - if ( this.s.select.type == "none" || !bSelectedOnly || - (bSelectedOnly && $(dt.aoData[ dt.aiDisplay[j] ].nTr).hasClass( this.s.select.selectedClass )) || - (bSelectedOnly && this.s.select.selected.length == 0) ) + aDataIndex = []; + for ( i=0, iLen=aSelected.length ; i<iLen ; i++ ) { - aRow = []; - - /* Columns */ - for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ ) + aDataIndex.push( dt.oInstance.fnGetPosition( aSelected[i] ) ); + } + } + + for ( j=0, jLen=aDataIndex.length ; j<jLen ; j++ ) + { + tr = dt.aoData[ aDataIndex[j] ].nTr; + aRow = []; + + /* Columns */ + for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ ) + { + if ( aColumnsInc[i] ) { - if ( aColumnsInc[i] ) + /* Convert to strings (with small optimisation) */ + var mTypeData = dt.oApi._fnGetCellData( dt, aDataIndex[j], i, 'display' ); + if ( oConfig.fnCellRender ) + { + sLoopData = oConfig.fnCellRender( mTypeData, i, tr, aDataIndex[j] )+""; + } + else if ( typeof mTypeData == "string" ) { - /* Convert to strings (with small optimisation) */ - var mTypeData = dt.oApi._fnGetCellData( dt, dt.aiDisplay[j], i, 'display' ); - if ( oConfig.fnCellRender ) - { - sLoopData = oConfig.fnCellRender( mTypeData, i )+""; - } - else if ( typeof mTypeData == "string" ) - { - /* Strip newlines, replace img tags with alt attr. and finally strip html... */ - sLoopData = mTypeData.replace(/\n/g," "); - sLoopData = - sLoopData.replace(/<img.*?\s+alt\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+)).*?>/gi, - '$1$2$3'); - sLoopData = sLoopData.replace( /<.*?>/g, "" ); - } - else - { - sLoopData = mTypeData+""; - } - - /* Trim and clean the data */ - sLoopData = sLoopData.replace(/^\s+/, '').replace(/\s+$/, ''); - sLoopData = this._fnHtmlDecode( sLoopData ); - - /* Bound it and add it to the total data */ - aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) ); + /* Strip newlines, replace img tags with alt attr. and finally strip html... */ + sLoopData = mTypeData.replace(/\n/g," "); + sLoopData = + sLoopData.replace(/<img.*?\s+alt\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+)).*?>/gi, + '$1$2$3'); + sLoopData = sLoopData.replace( /<.*?>/g, "" ); } + else + { + sLoopData = mTypeData+""; + } + + /* Trim and clean the data */ + sLoopData = sLoopData.replace(/^\s+/, '').replace(/\s+$/, ''); + sLoopData = this._fnHtmlDecode( sLoopData ); + + /* Bound it and add it to the total data */ + aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) ); + } + } + + aData.push( aRow.join(oConfig.sFieldSeperator) ); + + /* Details rows from fnOpen */ + if ( oConfig.bOpenRows ) + { + arr = $.grep(dt.aoOpenRows, function(o) { return o.nParent === tr; }); + + if ( arr.length === 1 ) + { + sLoopData = this._fnBoundData( $('td', arr[0].nTr).html(), oConfig.sFieldBoundary, regex ); + aData.push( sLoopData ); } - - aData.push( aRow.join(oConfig.sFieldSeperator) ); } } @@ -1605,7 +1631,7 @@ TableTools.prototype = { * @method _fnBoundData * @param {String} sData data to bound * @param {String} sBoundary bounding char(s) - * @param {RegExp} regex search for the bounding chars - constructed outside for efficincy + * @param {RegExp} regex search for the bounding chars - constructed outside for efficiency * in the loop * @returns {String} bound data * @private @@ -1661,36 +1687,24 @@ TableTools.prototype = { */ "_fnHtmlDecode": function ( sData ) { - if ( sData.indexOf('&') == -1 ) + if ( sData.indexOf('&') === -1 ) { return sData; } - var - aData = this._fnChunkData( sData, 2048 ), - n = document.createElement('div'), - i, iLen, iIndex, - sReturn = "", sInner; - - /* nodeValue has a limit in browsers - so we chunk the data into smaller segments to build - * up the string. Note that the 'trick' here is to remember than we might have split over - * an HTML entity, so we backtrack a little to make sure this doesn't happen - */ - for ( i=0, iLen=aData.length ; i<iLen ; i++ ) - { - /* Magic number 8 is because no entity is longer then strlen 8 in ISO 8859-1 */ - iIndex = aData[i].lastIndexOf( '&' ); - if ( iIndex != -1 && aData[i].length >= 8 && iIndex > aData[i].length - 8 ) + var n = document.createElement('div'); + + return sData.replace( /&([^\s]*);/g, function( match, match2 ) { + if ( match.substr(1, 1) === '#' ) { - sInner = aData[i].substr( iIndex ); - aData[i] = aData[i].substr( 0, iIndex ); + return String.fromCharCode( Number(match2.substr(1)) ); } - - n.innerHTML = aData[i]; - sReturn += n.childNodes[0].nodeValue; - } - - return sReturn; + else + { + n.innerHTML = match; + return n.childNodes[0].nodeValue; + } + } ); }, @@ -1699,61 +1713,6 @@ TableTools.prototype = { * Printing functions */ - /** - * Configure a button for printing - * @method _fnPrintConfig - * @param {Node} nButton Button element which is being considered - * @param {Object} oConfig Button configuration object - * @returns void - * @private - */ - "_fnPrintConfig": function ( nButton, oConfig ) - { - var that = this; - - if ( oConfig.fnInit !== null ) - { - oConfig.fnInit.call( this, nButton, oConfig ); - } - - if ( oConfig.sToolTip !== "" ) - { - nButton.title = oConfig.sToolTip; - } - - $(nButton).hover( function () { - $(nButton).addClass(oConfig.sButtonClassHover ); - }, function () { - $(nButton).removeClass( oConfig.sButtonClassHover ); - } ); - - if ( oConfig.fnSelect !== null ) - { - TableTools._fnEventListen( this, 'select', function (n) { - oConfig.fnSelect.call( that, nButton, oConfig, n ); - } ); - } - - $(nButton).click( function (e) { - e.preventDefault(); - - that._fnPrintStart.call( that, e, oConfig); - - if ( oConfig.fnClick !== null ) - { - oConfig.fnClick.call( that, nButton, oConfig, null ); - } - - /* Provide a complete function to match the behaviour of the flash elements */ - if ( oConfig.fnComplete !== null ) - { - oConfig.fnComplete.call( that, nButton, oConfig, null, null ); - } - - that._fnCollectionHide( nButton, oConfig ); - } ); - }, - /** * Show print display * @method _fnPrintStart @@ -1762,7 +1721,7 @@ TableTools.prototype = { * @returns void * @private */ - "_fnPrintStart": function ( e, oConfig ) + "_fnPrintStart": function ( oConfig ) { var that = this; var oSetDT = this.s.dt; @@ -1786,6 +1745,12 @@ TableTools.prototype = { if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" ) { this._fnPrintScrollStart( oSetDT ); + + // If the table redraws while in print view, the DataTables scrolling + // setup would hide the header, so we need to readd it on draw + $(this.s.dt.nTable).bind('draw.DTTT_Print', function () { + that._fnPrintScrollStart( oSetDT ); + } ); } /* Remove the other DataTables feature nodes - but leave the table! and info div */ @@ -1806,40 +1771,38 @@ TableTools.prototype = { } /* Print class can be used for styling */ - $(document.body).addClass( 'DTTT_Print' ); - - /* Add a node telling the user what is going on */ + $(document.body).addClass( this.classes.print.body ); + + /* Show information message to let the user know what is happening */ if ( oConfig.sInfo !== "" ) { - var nInfo = document.createElement( "div" ); - nInfo.className = "DTTT_print_info"; - nInfo.innerHTML = oConfig.sInfo; - document.body.appendChild( nInfo ); - - setTimeout( function() { - $(nInfo).fadeOut( "normal", function() { - document.body.removeChild( nInfo ); - } ); - }, 2000 ); + this.fnInfo( oConfig.sInfo, 3000 ); } - + /* Add a message at the top of the page */ - if ( oConfig.sMessage !== "" ) + if ( oConfig.sMessage ) { this.dom.print.message = document.createElement( "div" ); - this.dom.print.message.className = "DTTT_PrintMessage"; + this.dom.print.message.className = this.classes.print.message; this.dom.print.message.innerHTML = oConfig.sMessage; document.body.insertBefore( this.dom.print.message, document.body.childNodes[0] ); } - /* Cache the scrolling and the jump to the top of the t=page */ + /* Cache the scrolling and the jump to the top of the page */ this.s.print.saveScroll = $(window).scrollTop(); window.scrollTo( 0, 0 ); - - this.s.print.funcEnd = function(e) { - that._fnPrintEnd.call( that, e ); - }; - $(document).bind( "keydown", null, this.s.print.funcEnd ); + + /* Bind a key event listener to the document for the escape key - + * it is removed in the callback + */ + $(document).bind( "keydown.DTTT", function(e) { + /* Only interested in the escape key */ + if ( e.keyCode == 27 ) + { + e.preventDefault(); + that._fnPrintEnd.call( that, e ); + } + } ); }, @@ -1852,47 +1815,42 @@ TableTools.prototype = { */ "_fnPrintEnd": function ( e ) { - /* Only interested in the escape key */ - if ( e.keyCode == 27 ) + var that = this; + var oSetDT = this.s.dt; + var oSetPrint = this.s.print; + var oDomPrint = this.dom.print; + + /* Show all hidden nodes */ + this._fnPrintShowNodes(); + + /* Restore DataTables' scrolling */ + if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" ) { - e.preventDefault(); - - var that = this; - var oSetDT = this.s.dt; - var oSetPrint = this.s.print; - var oDomPrint = this.dom.print; - - /* Show all hidden nodes */ - this._fnPrintShowNodes(); - - /* Restore DataTables' scrolling */ - if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" ) - { - this._fnPrintScrollEnd(); - } - - /* Restore the scroll */ - window.scrollTo( 0, oSetPrint.saveScroll ); - - /* Drop the print message */ - if ( oDomPrint.message !== null ) - { - document.body.removeChild( oDomPrint.message ); - oDomPrint.message = null; - } - - /* Styling class */ - $(document.body).removeClass( 'DTTT_Print' ); - - /* Restore the table length */ - oSetDT._iDisplayStart = oSetPrint.saveStart; - oSetDT._iDisplayLength = oSetPrint.saveLength; - oSetDT.oApi._fnCalculateEnd( oSetDT ); - oSetDT.oApi._fnDraw( oSetDT ); - - $(document).unbind( "keydown", this.s.print.funcEnd ); - this.s.print.funcEnd = null; + $(this.s.dt.nTable).unbind('draw.DTTT_Print'); + + this._fnPrintScrollEnd(); + } + + /* Restore the scroll */ + window.scrollTo( 0, oSetPrint.saveScroll ); + + /* Drop the print message */ + if ( oDomPrint.message !== null ) + { + document.body.removeChild( oDomPrint.message ); + oDomPrint.message = null; } + + /* Styling class */ + $(document.body).removeClass( 'DTTT_Print' ); + + /* Restore the table length */ + oSetDT._iDisplayStart = oSetPrint.saveStart; + oSetDT._iDisplayLength = oSetPrint.saveLength; + oSetDT.oApi._fnCalculateEnd( oSetDT ); + oSetDT.oApi._fnDraw( oSetDT ); + + $(document).unbind( "keydown.DTTT" ); }, @@ -1954,7 +1912,7 @@ TableTools.prototype = { /** * Take account of scrolling in DataTables by showing the full table. Note that the redraw of - * the DataTable that we do will actually deal with the majority of the hardword here + * the DataTable that we do will actually deal with the majority of the hard work here * @returns void * @private */ @@ -2130,24 +2088,25 @@ TableTools._fnEventListen = function ( that, type, fn ) /** - * An event has occured - look up every listener and fire it off. We check that the event we are + * An event has occurred - look up every listener and fire it off. We check that the event we are * going to fire is attached to the same table (using the table node as reference) before firing * @method _fnEventDispatch * @param {Object} that Scope of the listening function (i.e. 'this' in the caller) * @param {String} type Event type - * @param {Node} node Element that the event occured on (may be null) + * @param {Node} node Element that the event occurred on (may be null) + * @param {boolean} [selected] Indicate if the node was selected (true) or deselected (false) * @returns void * @private * @static */ -TableTools._fnEventDispatch = function ( that, type, node ) +TableTools._fnEventDispatch = function ( that, type, node, selected ) { var listeners = TableTools._aListeners; for ( var i=0, iLen=listeners.length ; i<iLen ; i++ ) { if ( that.dom.table == listeners[i].that.dom.table && listeners[i].type == type ) { - listeners[i].fn( node ); + listeners[i].fn( node, selected ); } } }; @@ -2162,110 +2121,92 @@ TableTools._fnEventDispatch = function ( that, type, node ) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +TableTools.buttonBase = { + // Button base + "sAction": "text", + "sTag": "default", + "sLinerTag": "default", + "sButtonClass": "DTTT_button_text", + "sButtonText": "Button text", + "sTitle": "", + "sToolTip": "", + + // Common button specific options + "sCharSet": "utf8", + "bBomInc": false, + "sFileName": "*.csv", + "sFieldBoundary": "", + "sFieldSeperator": "\t", + "sNewLine": "auto", + "mColumns": "all", /* "all", "visible", "hidden" or array of column integers */ + "bHeader": true, + "bFooter": true, + "bOpenRows": false, + "bSelectedOnly": false, + + // Callbacks + "fnMouseover": null, + "fnMouseout": null, + "fnClick": null, + "fnSelect": null, + "fnComplete": null, + "fnInit": null, + "fnCellRender": null +}; + + /** * @namespace Default button configurations */ TableTools.BUTTONS = { - "csv": { + "csv": $.extend( {}, TableTools.buttonBase, { "sAction": "flash_save", - "sCharSet": "utf8", - "bBomInc": false, - "sFileName": "*.csv", - "sFieldBoundary": '"', - "sFieldSeperator": ",", - "sNewLine": "auto", - "sTitle": "", - "sToolTip": "", "sButtonClass": "DTTT_button_csv", - "sButtonClassHover": "DTTT_button_csv_hover", "sButtonText": "CSV", - "mColumns": "all", /* "all", "visible", "hidden" or array of column integers */ - "bHeader": true, - "bFooter": true, - "bSelectedOnly": false, - "fnMouseover": null, - "fnMouseout": null, + "sFieldBoundary": '"', + "sFieldSeperator": ",", "fnClick": function( nButton, oConfig, flash ) { this.fnSetText( flash, this.fnGetTableData(oConfig) ); - }, - "fnSelect": null, - "fnComplete": null, - "fnInit": null, - "fnCellRender": null - }, - "xls": { + } + } ), + + "xls": $.extend( {}, TableTools.buttonBase, { "sAction": "flash_save", "sCharSet": "utf16le", "bBomInc": true, - "sFileName": "*.csv", - "sFieldBoundary": "", - "sFieldSeperator": "\t", - "sNewLine": "auto", - "sTitle": "", - "sToolTip": "", "sButtonClass": "DTTT_button_xls", - "sButtonClassHover": "DTTT_button_xls_hover", "sButtonText": "Excel", - "mColumns": "all", - "bHeader": true, - "bFooter": true, - "bSelectedOnly": false, - "fnMouseover": null, - "fnMouseout": null, "fnClick": function( nButton, oConfig, flash ) { this.fnSetText( flash, this.fnGetTableData(oConfig) ); - }, - "fnSelect": null, - "fnComplete": null, - "fnInit": null, - "fnCellRender": null - }, - "copy": { + } + } ), + + "copy": $.extend( {}, TableTools.buttonBase, { "sAction": "flash_copy", - "sFieldBoundary": "", - "sFieldSeperator": "\t", - "sNewLine": "auto", - "sToolTip": "", "sButtonClass": "DTTT_button_copy", - "sButtonClassHover": "DTTT_button_copy_hover", "sButtonText": "Copy", - "mColumns": "all", - "bHeader": true, - "bFooter": true, - "bSelectedOnly": false, - "fnMouseover": null, - "fnMouseout": null, "fnClick": function( nButton, oConfig, flash ) { this.fnSetText( flash, this.fnGetTableData(oConfig) ); }, - "fnSelect": null, "fnComplete": function(nButton, oConfig, flash, text) { var lines = text.split('\n').length, len = this.s.dt.nTFoot === null ? lines-1 : lines-2, plural = (len==1) ? "" : "s"; - alert( 'Copied '+len+' row'+plural+' to the clipboard' ); - }, - "fnInit": null, - "fnCellRender": null - }, - "pdf": { + this.fnInfo( '<h6>Table copied</h6>'+ + '<p>Copied '+len+' row'+plural+' to the clipboard.</p>', + 1500 + ); + } + } ), + + "pdf": $.extend( {}, TableTools.buttonBase, { "sAction": "flash_pdf", - "sFieldBoundary": "", - "sFieldSeperator": "\t", "sNewLine": "\n", "sFileName": "*.pdf", - "sToolTip": "", - "sTitle": "", "sButtonClass": "DTTT_button_pdf", - "sButtonClassHover": "DTTT_button_pdf_hover", "sButtonText": "PDF", - "mColumns": "all", - "bHeader": true, - "bFooter": false, - "bSelectedOnly": false, - "fnMouseover": null, - "fnMouseout": null, "sPdfOrientation": "portrait", "sPdfSize": "A4", "sPdfMessage": "", @@ -2279,167 +2220,87 @@ TableTools.BUTTONS = { "--/TableToolsOpts--\n" + this.fnGetTableData(oConfig) ); - }, - "fnSelect": null, - "fnComplete": null, - "fnInit": null, - "fnCellRender": null - }, - "print": { - "sAction": "print", + } + } ), + + "print": $.extend( {}, TableTools.buttonBase, { "sInfo": "<h6>Print view</h6><p>Please use your browser's print function to "+ "print this table. Press escape when finished.", - "sMessage": "", + "sMessage": null, "bShowAll": true, "sToolTip": "View print view", "sButtonClass": "DTTT_button_print", - "sButtonClassHover": "DTTT_button_print_hover", "sButtonText": "Print", - "fnMouseover": null, - "fnMouseout": null, - "fnClick": null, - "fnSelect": null, - "fnComplete": null, - "fnInit": null, - "fnCellRender": null - }, - "text": { - "sAction": "text", - "sToolTip": "", - "sButtonClass": "DTTT_button_text", - "sButtonClassHover": "DTTT_button_text_hover", - "sButtonText": "Text button", - "mColumns": "all", - "bHeader": true, - "bFooter": true, - "bSelectedOnly": false, - "fnMouseover": null, - "fnMouseout": null, - "fnClick": null, - "fnSelect": null, - "fnComplete": null, - "fnInit": null, - "fnCellRender": null - }, - "select": { - "sAction": "text", - "sToolTip": "", - "sButtonClass": "DTTT_button_text", - "sButtonClassHover": "DTTT_button_text_hover", + "fnClick": function ( nButton, oConfig ) { + this.fnPrint( true, oConfig ); + } + } ), + + "text": $.extend( {}, TableTools.buttonBase ), + + "select": $.extend( {}, TableTools.buttonBase, { "sButtonText": "Select button", - "mColumns": "all", - "bHeader": true, - "bFooter": true, - "fnMouseover": null, - "fnMouseout": null, - "fnClick": null, "fnSelect": function( nButton, oConfig ) { if ( this.fnGetSelected().length !== 0 ) { - $(nButton).removeClass('DTTT_disabled'); + $(nButton).removeClass( this.classes.buttons.disabled ); } else { - $(nButton).addClass('DTTT_disabled'); + $(nButton).addClass( this.classes.buttons.disabled ); } }, - "fnComplete": null, "fnInit": function( nButton, oConfig ) { - $(nButton).addClass('DTTT_disabled'); - }, - "fnCellRender": null - }, - "select_single": { - "sAction": "text", - "sToolTip": "", - "sButtonClass": "DTTT_button_text", - "sButtonClassHover": "DTTT_button_text_hover", + $(nButton).addClass( this.classes.buttons.disabled ); + } + } ), + + "select_single": $.extend( {}, TableTools.buttonBase, { "sButtonText": "Select button", - "mColumns": "all", - "bHeader": true, - "bFooter": true, - "fnMouseover": null, - "fnMouseout": null, - "fnClick": null, "fnSelect": function( nButton, oConfig ) { var iSelected = this.fnGetSelected().length; if ( iSelected == 1 ) { - $(nButton).removeClass('DTTT_disabled'); + $(nButton).removeClass( this.classes.buttons.disabled ); } else { - $(nButton).addClass('DTTT_disabled'); + $(nButton).addClass( this.classes.buttons.disabled ); } }, - "fnComplete": null, "fnInit": function( nButton, oConfig ) { - $(nButton).addClass('DTTT_disabled'); - }, - "fnCellRender": null - }, - "select_all": { - "sAction": "text", - "sToolTip": "", - "sButtonClass": "DTTT_button_text", - "sButtonClassHover": "DTTT_button_text_hover", + $(nButton).addClass( this.classes.buttons.disabled ); + } + } ), + + "select_all": $.extend( {}, TableTools.buttonBase, { "sButtonText": "Select all", - "mColumns": "all", - "bHeader": true, - "bFooter": true, - "fnMouseover": null, - "fnMouseout": null, "fnClick": function( nButton, oConfig ) { this.fnSelectAll(); }, "fnSelect": function( nButton, oConfig ) { if ( this.fnGetSelected().length == this.s.dt.fnRecordsDisplay() ) { - $(nButton).addClass('DTTT_disabled'); + $(nButton).addClass( this.classes.buttons.disabled ); } else { - $(nButton).removeClass('DTTT_disabled'); + $(nButton).removeClass( this.classes.buttons.disabled ); } - }, - "fnComplete": null, - "fnInit": null, - "fnCellRender": null - }, - "select_none": { - "sAction": "text", - "sToolTip": "", - "sButtonClass": "DTTT_button_text", - "sButtonClassHover": "DTTT_button_text_hover", + } + } ), + + "select_none": $.extend( {}, TableTools.buttonBase, { "sButtonText": "Deselect all", - "mColumns": "all", - "bHeader": true, - "bFooter": true, - "fnMouseover": null, - "fnMouseout": null, "fnClick": function( nButton, oConfig ) { this.fnSelectNone(); }, "fnSelect": function( nButton, oConfig ) { if ( this.fnGetSelected().length !== 0 ) { - $(nButton).removeClass('DTTT_disabled'); + $(nButton).removeClass( this.classes.buttons.disabled ); } else { - $(nButton).addClass('DTTT_disabled'); + $(nButton).addClass( this.classes.buttons.disabled ); } }, - "fnComplete": null, "fnInit": function( nButton, oConfig ) { - $(nButton).addClass('DTTT_disabled'); - }, - "fnCellRender": null - }, - "ajax": { - "sAction": "text", - "sFieldBoundary": "", - "sFieldSeperator": "\t", - "sNewLine": "\n", + $(nButton).addClass( this.classes.buttons.disabled ); + } + } ), + + "ajax": $.extend( {}, TableTools.buttonBase, { "sAjaxUrl": "/xhr.php", - "sToolTip": "", - "sButtonClass": "DTTT_button_text", - "sButtonClassHover": "DTTT_button_text_hover", "sButtonText": "Ajax button", - "mColumns": "all", - "bHeader": true, - "bFooter": true, - "bSelectedOnly": false, - "fnMouseover": null, - "fnMouseout": null, "fnClick": function( nButton, oConfig ) { var sData = this.fnGetTableData(oConfig); $.ajax( { @@ -2456,45 +2317,26 @@ TableTools.BUTTONS = { } } ); }, - "fnSelect": null, - "fnComplete": null, - "fnInit": null, "fnAjaxComplete": function( json ) { alert( 'Ajax complete' ); - }, - "fnCellRender": null - }, - "div": { + } + } ), + + "div": $.extend( {}, TableTools.buttonBase, { "sAction": "div", - "sToolTip": "", + "sTag": "div", "sButtonClass": "DTTT_nonbutton", - "sButtonClassHover": "", - "sButtonText": "Text button", - "fnMouseover": null, - "fnMouseout": null, - "fnClick": null, - "fnSelect": null, - "fnComplete": null, - "fnInit": null, - "nContent": null, - "fnCellRender": null - }, - "collection": { + "sButtonText": "Text button" + } ), + + "collection": $.extend( {}, TableTools.buttonBase, { "sAction": "collection", - "sToolTip": "", "sButtonClass": "DTTT_button_collection", - "sButtonClassHover": "DTTT_button_collection_hover", "sButtonText": "Collection", - "fnMouseover": null, - "fnMouseout": null, "fnClick": function( nButton, oConfig ) { this._fnCollectionShow(nButton, oConfig); - }, - "fnSelect": null, - "fnComplete": null, - "fnInit": null, - "fnCellRender": null - } + } + } ) }; /* * on* callback parameters: @@ -2505,17 +2347,75 @@ TableTools.BUTTONS = { */ + +/** + * @namespace Classes used by TableTools - allows the styles to be override easily. + * Note that when TableTools initialises it will take a copy of the classes object + * and will use its internal copy for the remainder of its run time. + */ +TableTools.classes = { + "container": "DTTT_container", + "buttons": { + "normal": "DTTT_button", + "disabled": "DTTT_disabled" + }, + "collection": { + "container": "DTTT_collection", + "background": "DTTT_collection_background", + "buttons": { + "normal": "DTTT_button", + "disabled": "DTTT_disabled" + } + }, + "select": { + "table": "DTTT_selectable", + "row": "DTTT_selected" + }, + "print": { + "body": "DTTT_Print", + "info": "DTTT_print_info", + "message": "DTTT_PrintMessage" + } +}; + + +/** + * @namespace ThemeRoller classes - built in for compatibility with DataTables' + * bJQueryUI option. + */ +TableTools.classes_themeroller = { + "container": "DTTT_container ui-buttonset ui-buttonset-multi", + "buttons": { + "normal": "DTTT_button ui-button ui-state-default" + }, + "collection": { + "container": "DTTT_collection ui-buttonset ui-buttonset-multi" + } +}; + + /** * @namespace TableTools default settings for initialisation */ TableTools.DEFAULTS = { "sSwfPath": "media/swf/copy_csv_xls_pdf.swf", "sRowSelect": "none", - "sSelectedClass": "DTTT_selected", + "sSelectedClass": null, "fnPreRowSelect": null, "fnRowSelected": null, "fnRowDeselected": null, - "aButtons": [ "copy", "csv", "xls", "pdf", "print" ] + "aButtons": [ "copy", "csv", "xls", "pdf", "print" ], + "oTags": { + "container": "div", + "button": "a", // We really want to use buttons here, but Firefox and IE ignore the + // click on the Flash element in the button (but not mouse[in|out]). + "liner": "span", + "collection": { + "container": "div", + "button": "a", + "liner": "span" + } + } }; @@ -2532,9 +2432,9 @@ TableTools.prototype.CLASS = "TableTools"; * TableTools version * @constant VERSION * @type String - * @default 2.0.3.dev + * @default See code */ -TableTools.VERSION = "2.0.3"; +TableTools.VERSION = "2.1.4"; TableTools.prototype.VERSION = TableTools.VERSION; @@ -2549,7 +2449,7 @@ TableTools.prototype.VERSION = TableTools.VERSION; */ if ( typeof $.fn.dataTable == "function" && typeof $.fn.dataTableExt.fnVersionCheck == "function" && - $.fn.dataTableExt.fnVersionCheck('1.8.2') ) + $.fn.dataTableExt.fnVersionCheck('1.9.0') ) { $.fn.dataTableExt.aoFeatures.push( { "fnInit": function( oDTSettings ) { @@ -2567,7 +2467,9 @@ if ( typeof $.fn.dataTable == "function" && } else { - alert( "Warning: TableTools 2 requires DataTables 1.8.2 or newer - www.datatables.net/download"); + alert( "Warning: TableTools 2 requires DataTables 1.9.0 or newer - www.datatables.net/download"); } +$.fn.DataTable.TableTools = TableTools; + })(jQuery, window, document); diff --git a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/js/TableTools.min.js b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/js/TableTools.min.js index 0fdf175da85e391366d2eee6ad9266d5ce463551..1017ee5ce37f1979d05fc431edba44e32cad9dc2 100644 --- a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/js/TableTools.min.js +++ b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/js/TableTools.min.js @@ -1,26 +1,26 @@ // Simple Set Clipboard System // Author: Joseph Huckaby -var ZeroClipboard_TableTools={version:"1.0.4-TableTools2",clients:{},moviePath:"",nextId:1,$:function(a){"string"==typeof a&&(a=document.getElementById(a));if(!a.addClass)a.hide=function(){this.style.display="none"},a.show=function(){this.style.display=""},a.addClass=function(a){this.removeClass(a);this.className+=" "+a},a.removeClass=function(a){this.className=this.className.replace(RegExp("\\s*"+a+"\\s*")," ").replace(/^\s+/,"").replace(/\s+$/,"")},a.hasClass=function(a){return!!this.className.match(RegExp("\\s*"+ -a+"\\s*"))};return a},setMoviePath:function(a){this.moviePath=a},dispatch:function(a,b,c){(a=this.clients[a])&&a.receiveEvent(b,c)},register:function(a,b){this.clients[a]=b},getDOMObjectPosition:function(a){var b={left:0,top:0,width:a.width?a.width:a.offsetWidth,height:a.height?a.height:a.offsetHeight};if(""!=a.style.width)b.width=a.style.width.replace("px","");if(""!=a.style.height)b.height=a.style.height.replace("px","");for(;a;)b.left+=a.offsetLeft,b.top+=a.offsetTop,a=a.offsetParent;return b}, +var ZeroClipboard_TableTools={version:"1.0.4-TableTools2",clients:{},moviePath:"",nextId:1,$:function(a){"string"==typeof a&&(a=document.getElementById(a));a.addClass||(a.hide=function(){this.style.display="none"},a.show=function(){this.style.display=""},a.addClass=function(a){this.removeClass(a);this.className+=" "+a},a.removeClass=function(a){this.className=this.className.replace(RegExp("\\s*"+a+"\\s*")," ").replace(/^\s+/,"").replace(/\s+$/,"")},a.hasClass=function(a){return!!this.className.match(RegExp("\\s*"+ +a+"\\s*"))});return a},setMoviePath:function(a){this.moviePath=a},dispatch:function(a,b,c){(a=this.clients[a])&&a.receiveEvent(b,c)},register:function(a,b){this.clients[a]=b},getDOMObjectPosition:function(a){var b={left:0,top:0,width:a.width?a.width:a.offsetWidth,height:a.height?a.height:a.offsetHeight};""!=a.style.width&&(b.width=a.style.width.replace("px",""));""!=a.style.height&&(b.height=a.style.height.replace("px",""));for(;a;)b.left+=a.offsetLeft,b.top+=a.offsetTop,a=a.offsetParent;return b}, Client:function(a){this.handlers={};this.id=ZeroClipboard_TableTools.nextId++;this.movieId="ZeroClipboard_TableToolsMovie_"+this.id;ZeroClipboard_TableTools.register(this.id,this);a&&this.glue(a)}}; -ZeroClipboard_TableTools.Client.prototype={id:0,ready:!1,movie:null,clipText:"",fileName:"",action:"copy",handCursorEnabled:!0,cssEffects:!0,handlers:null,sized:!1,glue:function(a,b){this.domElement=ZeroClipboard_TableTools.$(a);var c=99;this.domElement.style.zIndex&&(c=parseInt(this.domElement.style.zIndex)+1);var d=ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);this.div=document.createElement("div");var e=this.div.style;e.position="absolute";e.left=this.domElement.offsetLeft+"px"; -e.top=this.domElement.offsetTop+"px";e.width=d.width+"px";e.height=d.height+"px";e.zIndex=c;if("undefined"!=typeof b&&""!=b)this.div.title=b;if(0!=d.width&&0!=d.height)this.sized=!0;if(this.domElement.parentNode)this.domElement.parentNode.appendChild(this.div),this.div.innerHTML=this.getHTML(d.width,d.height)},positionElement:function(){var a=ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement),b=this.div.style;b.position="absolute";b.left=this.domElement.offsetLeft+"px";b.top=this.domElement.offsetTop+ -"px";b.width=a.width+"px";b.height=a.height+"px";if(0!=a.width&&0!=a.height)this.sized=!0,b=this.div.childNodes[0],b.width=a.width,b.height=a.height},getHTML:function(a,b){var c="",d="id="+this.id+"&width="+a+"&height="+b;if(navigator.userAgent.match(/MSIE/))var e=location.href.match(/^https/i)?"https://":"http://",c=c+('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+e+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+a+'" height="'+ -b+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard_TableTools.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+d+'"/><param name="wmode" value="transparent"/></object>');else c+='<embed id="'+this.movieId+'" src="'+ZeroClipboard_TableTools.moviePath+ -'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+a+'" height="'+b+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+d+'" wmode="transparent" />';return c},hide:function(){if(this.div)this.div.style.left="-2000px"},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML= -"";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.div=this.domElement=null}},reposition:function(a){if(a)(this.domElement=ZeroClipboard_TableTools.$(a))||this.hide();if(this.domElement&&this.div){var a=ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement),b=this.div.style;b.left=""+a.left+"px";b.top=""+a.top+"px"}},clearText:function(){this.clipText="";this.ready&&this.movie.clearText()},appendText:function(a){this.clipText+=a;this.ready&&this.movie.appendText(a)}, -setText:function(a){this.clipText=a;this.ready&&this.movie.setText(a)},setCharSet:function(a){this.charSet=a;this.ready&&this.movie.setCharSet(a)},setBomInc:function(a){this.incBom=a;this.ready&&this.movie.setBomInc(a)},setFileName:function(a){this.fileName=a;this.ready&&this.movie.setFileName(a)},setAction:function(a){this.action=a;this.ready&&this.movie.setAction(a)},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");this.handlers[a]||(this.handlers[a]=[]);this.handlers[a].push(b)}, -setHandCursor:function(a){this.handCursorEnabled=a;this.ready&&this.movie.setHandCursor(a)},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");switch(a){case "load":this.movie=document.getElementById(this.movieId);if(!this.movie){var c=this;setTimeout(function(){c.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){c=this;setTimeout(function(){c.receiveEvent("load", -null)},100);this.ready=!0;return}this.ready=!0;this.movie.clearText();this.movie.appendText(this.clipText);this.movie.setFileName(this.fileName);this.movie.setAction(this.action);this.movie.setCharSet(this.charSet);this.movie.setBomInc(this.incBom);this.movie.setHandCursor(this.handCursorEnabled);break;case "mouseover":this.domElement&&this.cssEffects&&this.recoverActive&&this.domElement.addClass("active");break;case "mouseout":if(this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")))this.domElement.removeClass("active"), -this.recoverActive=!0;break;case "mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case "mouseup":if(this.domElement&&this.cssEffects)this.domElement.removeClass("active"),this.recoverActive=!1}if(this.handlers[a])for(var d=0,e=this.handlers[a].length;d<e;d++){var f=this.handlers[a][d];if("function"==typeof f)f(this,b);else if("object"==typeof f&&2==f.length)f[0][f[1]](this,b);else if("string"==typeof f)window[f](this,b)}}}; +ZeroClipboard_TableTools.Client.prototype={id:0,ready:!1,movie:null,clipText:"",fileName:"",action:"copy",handCursorEnabled:!0,cssEffects:!0,handlers:null,sized:!1,glue:function(a,b){this.domElement=ZeroClipboard_TableTools.$(a);var c=99;this.domElement.style.zIndex&&(c=parseInt(this.domElement.style.zIndex)+1);var d=ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);this.div=document.createElement("div");var e=this.div.style;e.position="absolute";e.left="0px";e.top="0px";e.width=d.width+ +"px";e.height=d.height+"px";e.zIndex=c;"undefined"!=typeof b&&""!=b&&(this.div.title=b);0!=d.width&&0!=d.height&&(this.sized=!0);this.domElement&&(this.domElement.appendChild(this.div),this.div.innerHTML=this.getHTML(d.width,d.height))},positionElement:function(){var a=ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement),b=this.div.style;b.position="absolute";b.width=a.width+"px";b.height=a.height+"px";0!=a.width&&0!=a.height&&(this.sized=!0,b=this.div.childNodes[0],b.width=a.width,b.height= +a.height)},getHTML:function(a,b){var c="",d="id="+this.id+"&width="+a+"&height="+b;if(navigator.userAgent.match(/MSIE/))var e=location.href.match(/^https/i)?"https://":"http://",c=c+('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+e+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+a+'" height="'+b+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ +ZeroClipboard_TableTools.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+d+'"/><param name="wmode" value="transparent"/></object>');else c+='<embed id="'+this.movieId+'" src="'+ZeroClipboard_TableTools.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+a+'" height="'+b+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+ +d+'" wmode="transparent" />';return c},hide:function(){this.div&&(this.div.style.left="-2000px")},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML="";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.div=this.domElement=null}},reposition:function(a){a&&((this.domElement=ZeroClipboard_TableTools.$(a))||this.hide());if(this.domElement&&this.div){var a=ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement), +b=this.div.style;b.left=""+a.left+"px";b.top=""+a.top+"px"}},clearText:function(){this.clipText="";this.ready&&this.movie.clearText()},appendText:function(a){this.clipText+=a;this.ready&&this.movie.appendText(a)},setText:function(a){this.clipText=a;this.ready&&this.movie.setText(a)},setCharSet:function(a){this.charSet=a;this.ready&&this.movie.setCharSet(a)},setBomInc:function(a){this.incBom=a;this.ready&&this.movie.setBomInc(a)},setFileName:function(a){this.fileName=a;this.ready&&this.movie.setFileName(a)}, +setAction:function(a){this.action=a;this.ready&&this.movie.setAction(a)},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");this.handlers[a]||(this.handlers[a]=[]);this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled=a;this.ready&&this.movie.setHandCursor(a)},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");switch(a){case "load":this.movie=document.getElementById(this.movieId); +if(!this.movie){var c=this;setTimeout(function(){c.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){c=this;setTimeout(function(){c.receiveEvent("load",null)},100);this.ready=!0;return}this.ready=!0;this.movie.clearText();this.movie.appendText(this.clipText);this.movie.setFileName(this.fileName);this.movie.setAction(this.action);this.movie.setCharSet(this.charSet);this.movie.setBomInc(this.incBom);this.movie.setHandCursor(this.handCursorEnabled); +break;case "mouseover":this.domElement&&this.cssEffects&&this.recoverActive&&this.domElement.addClass("active");break;case "mouseout":this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")&&(this.domElement.removeClass("active"),this.recoverActive=!0));break;case "mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case "mouseup":this.domElement&&this.cssEffects&&(this.domElement.removeClass("active"),this.recoverActive=!1)}if(this.handlers[a])for(var d= +0,e=this.handlers[a].length;d<e;d++){var f=this.handlers[a][d];if("function"==typeof f)f(this,b);else if("object"==typeof f&&2==f.length)f[0][f[1]](this,b);else if("string"==typeof f)window[f](this,b)}}}; /* * File: TableTools.min.js - * Version: 2.0.3 + * Version: 2.1.4 * Author: Allan Jardine (www.sprymedia.co.uk) * - * Copyright 2009-2011 Allan Jardine, all rights reserved. + * Copyright 2009-2012 Allan Jardine, all rights reserved. * * This source file is free software, under either the GPL v2 license or a * BSD (3 point) style license, as supplied with this software. @@ -30,52 +30,47 @@ this.recoverActive=!0;break;case "mousedown":this.domElement&&this.cssEffects&&t * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. */ var TableTools; -(function(e,m,f){TableTools=function(a,b){(!this.CLASS||"TableTools"!=this.CLASS)&&alert("Warning: TableTools must be initialised with the keyword 'new'");this.s={that:this,dt:null,print:{saveStart:-1,saveLength:-1,saveScroll:-1,funcEnd:function(){}},buttonCounter:0,select:{type:"",selected:[],preRowSelect:null,postSelected:null,postDeselected:null,all:!1,selectedClass:""},custom:{},swfPath:"",buttonSet:[],master:!1};this.dom={container:null,table:null,print:{hidden:[],message:null},collection:{collection:null, -background:null}};this.fnSettings=function(){return this.s};"undefined"==typeof b&&(b={});this.s.dt=a.fnSettings();this._fnConstruct(b);return this};TableTools.prototype={fnGetSelected:function(){return this._fnGetMasterSettings().select.selected},fnGetSelectedData:function(){for(var a=this._fnGetMasterSettings().select.selected,b=[],c=0,d=a.length;c<d;c++)b.push(this.s.dt.oInstance.fnGetData(a[c]));return b},fnIsSelected:function(a){for(var b=this.fnGetSelected(),c=0,d=b.length;c<d;c++)if(a==b[c])return!0; -return!1},fnSelectAll:function(){this._fnGetMasterSettings().that._fnRowSelectAll()},fnSelectNone:function(){this._fnGetMasterSettings().that._fnRowDeselectAll()},fnSelect:function(a){this.fnIsSelected(a)||("single"==this.s.select.type?this._fnRowSelectSingle(a):"multi"==this.s.select.type&&this._fnRowSelectMulti(a))},fnDeselect:function(a){this.fnIsSelected(a)&&("single"==this.s.select.type?this._fnRowSelectSingle(a):"multi"==this.s.select.type&&this._fnRowSelectMulti(a))},fnGetTitle:function(a){var b= -"";if("undefined"!=typeof a.sTitle&&""!==a.sTitle)b=a.sTitle;else if(a=f.getElementsByTagName("title"),0<a.length)b=a[0].innerHTML;return 4>"\u00a1".toString().length?b.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""):b.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g,"")},fnCalcColRatios:function(a){var b=this.s.dt.aoColumns,a=this._fnColumnTargets(a.mColumns),c=[],d=0,e=0,g,f;for(g=0,f=a.length;g<f;g++)if(a[g])d=b[g].nTh.offsetWidth,e+=d,c.push(d);for(g=0,f=c.length;g<f;g++)c[g]/=e;return c.join("\t")}, -fnGetTableData:function(a){if(this.s.dt)return this._fnGetDataTablesData(a)},fnSetText:function(a,b){this._fnFlashSetText(a,b)},fnResizeButtons:function(){for(var a in ZeroClipboard_TableTools.clients)if(a){var b=ZeroClipboard_TableTools.clients[a];"undefined"!=typeof b.domElement&&b.domElement.parentNode==this.dom.container&&b.positionElement()}},fnResizeRequired:function(){for(var a in ZeroClipboard_TableTools.clients)if(a){var b=ZeroClipboard_TableTools.clients[a];if("undefined"!=typeof b.domElement&& -b.domElement.parentNode==this.dom.container&&!1===b.sized)return!0}return!1},_fnConstruct:function(a){var b=this;this._fnCustomiseSettings(a);this.dom.container=f.createElement("div");this.dom.container.className=!this.s.dt.bJUI?"DTTT_container":"DTTT_container ui-buttonset ui-buttonset-multi";"none"!=this.s.select.type&&this._fnRowSelectConfig();this._fnButtonDefinations(this.s.buttonSet,this.dom.container);this.s.dt.aoDestroyCallback.push({sName:"TableTools",fn:function(){b.dom.container.innerHTML= -""}})},_fnCustomiseSettings:function(a){if("undefined"==typeof this.s.dt._TableToolsInit)this.s.master=!0,this.s.dt._TableToolsInit=!0;this.dom.table=this.s.dt.nTable;this.s.custom=e.extend({},TableTools.DEFAULTS,a);this.s.swfPath=this.s.custom.sSwfPath;if("undefined"!=typeof ZeroClipboard_TableTools)ZeroClipboard_TableTools.moviePath=this.s.swfPath;this.s.select.type=this.s.custom.sRowSelect;this.s.select.preRowSelect=this.s.custom.fnPreRowSelect;this.s.select.postSelected=this.s.custom.fnRowSelected; -this.s.select.postDeselected=this.s.custom.fnRowDeselected;this.s.select.selectedClass=this.s.custom.sSelectedClass;this.s.buttonSet=this.s.custom.aButtons},_fnButtonDefinations:function(a,b){for(var c,d=0,j=a.length;d<j;d++){if("string"==typeof a[d]){if("undefined"==typeof TableTools.BUTTONS[a[d]]){alert("TableTools: Warning - unknown button type: "+a[d]);continue}c=e.extend({},TableTools.BUTTONS[a[d]],!0)}else{if("undefined"==typeof TableTools.BUTTONS[a[d].sExtends]){alert("TableTools: Warning - unknown button type: "+ -a[d].sExtends);continue}c=e.extend({},TableTools.BUTTONS[a[d].sExtends],!0);c=e.extend(c,a[d],!0)}this.s.dt.bJUI?(c.sButtonClass+=" ui-button ui-state-default",c.sButtonClassHover+=" ui-state-hover"):c.sButtonClassHover+=" DTTT_button_hover";b.appendChild(this._fnCreateButton(c))}},_fnCreateButton:function(a){var b="div"==a.sAction?this._fnDivBase(a):this._fnButtonBase(a);"print"==a.sAction?this._fnPrintConfig(b,a):a.sAction.match(/flash/)?this._fnFlashConfig(b,a):"text"==a.sAction?this._fnTextConfig(b, -a):"div"==a.sAction?this._fnTextConfig(b,a):"collection"==a.sAction&&(this._fnTextConfig(b,a),this._fnCollectionConfig(b,a));return b},_fnButtonBase:function(a){var b=f.createElement("button"),c=f.createElement("span"),d=this._fnGetMasterSettings();b.className="DTTT_button "+a.sButtonClass;b.setAttribute("id","ToolTables_"+this.s.dt.sInstance+"_"+d.buttonCounter);b.appendChild(c);c.innerHTML=a.sButtonText;d.buttonCounter++;return b},_fnDivBase:function(a){var b=f.createElement("div"),c=this._fnGetMasterSettings(); -b.className=a.sButtonClass;b.setAttribute("id","ToolTables_"+this.s.dt.sInstance+"_"+c.buttonCounter);b.innerHTML=a.sButtonText;null!==a.nContent&&b.appendChild(a.nContent);c.buttonCounter++;return b},_fnGetMasterSettings:function(){if(this.s.master)return this.s;for(var a=TableTools._aInstances,b=0,c=a.length;b<c;b++)if(this.dom.table==a[b].s.dt.nTable)return a[b].s},_fnCollectionConfig:function(a,b){var c=f.createElement("div");c.style.display="none";c.className=!this.s.dt.bJUI?"DTTT_collection": -"DTTT_collection ui-buttonset ui-buttonset-multi";b._collection=c;f.body.appendChild(c);this._fnButtonDefinations(b.aButtons,c)},_fnCollectionShow:function(a,b){var c=this,d=e(a).offset(),j=b._collection,g=d.left,d=d.top+e(a).outerHeight(),o=e(m).height(),h=e(f).height(),k=e(m).width(),n=e(f).width();j.style.position="absolute";j.style.left=g+"px";j.style.top=d+"px";j.style.display="block";e(j).css("opacity",0);var l=f.createElement("div");l.style.position="absolute";l.style.left="0px";l.style.top= -"0px";l.style.height=(o>h?o:h)+"px";l.style.width=(k>n?k:n)+"px";l.className="DTTT_collection_background";e(l).css("opacity",0);f.body.appendChild(l);f.body.appendChild(j);o=e(j).outerWidth();k=e(j).outerHeight();if(g+o>n)j.style.left=n-o+"px";if(d+k>h)j.style.top=d-k-e(a).outerHeight()+"px";this.dom.collection.collection=j;this.dom.collection.background=l;setTimeout(function(){e(j).animate({opacity:1},500);e(l).animate({opacity:0.25},500)},10);e(l).click(function(){c._fnCollectionHide.call(c,null, -null)})},_fnCollectionHide:function(a,b){if(!(null!==b&&"collection"==b.sExtends)&&null!==this.dom.collection.collection)e(this.dom.collection.collection).animate({opacity:0},500,function(){this.style.display="none"}),e(this.dom.collection.background).animate({opacity:0},500,function(){this.parentNode.removeChild(this)}),this.dom.collection.collection=null,this.dom.collection.background=null},_fnRowSelectConfig:function(){if(this.s.master){var a=this;e(a.s.dt.nTable).addClass("DTTT_selectable");e("tr", -a.s.dt.nTBody).live("click",function(b){if(this.parentNode==a.s.dt.nTBody){var c=a.s.dt.oInstance.fnGetNodes();-1===e.inArray(this,c)||null!==a.s.select.preRowSelect&&!a.s.select.preRowSelect.call(a,b)||("single"==a.s.select.type?a._fnRowSelectSingle.call(a,this):a._fnRowSelectMulti.call(a,this))}});a.s.dt.aoDrawCallback.push({fn:function(){a.s.select.all&&a.s.dt.oFeatures.bServerSide&&a.fnSelectAll()},sName:"TableTools_select"})}},_fnRowSelectSingle:function(a){this.s.master&&!e("td",a).hasClass(this.s.dt.oClasses.sRowEmpty)&& -(e(a).hasClass(this.s.select.selectedClass)?this._fnRowDeselect(a):(0!==this.s.select.selected.length&&this._fnRowDeselectAll(),this.s.select.selected.push(a),e(a).addClass(this.s.select.selectedClass),null!==this.s.select.postSelected&&this.s.select.postSelected.call(this,a)),TableTools._fnEventDispatch(this,"select",a))},_fnRowSelectMulti:function(a){this.s.master&&!e("td",a).hasClass(this.s.dt.oClasses.sRowEmpty)&&(e(a).hasClass(this.s.select.selectedClass)?this._fnRowDeselect(a):(this.s.select.selected.push(a), -e(a).addClass(this.s.select.selectedClass),null!==this.s.select.postSelected&&this.s.select.postSelected.call(this,a)),TableTools._fnEventDispatch(this,"select",a))},_fnRowSelectAll:function(){if(this.s.master){for(var a,b=0,c=this.s.dt.aiDisplayMaster.length;b<c;b++)a=this.s.dt.aoData[this.s.dt.aiDisplayMaster[b]].nTr,e(a).hasClass(this.s.select.selectedClass)||(this.s.select.selected.push(a),e(a).addClass(this.s.select.selectedClass));null!==this.s.select.postSelected&&this.s.select.postSelected.call(this, -null);this.s.select.all=!0;TableTools._fnEventDispatch(this,"select",null)}},_fnRowDeselectAll:function(){if(this.s.master){for(var a=this.s.select.selected.length-1;0<=a;a--)this._fnRowDeselect(a,!1);null!==this.s.select.postDeselected&&this.s.select.postDeselected.call(this,null);this.s.select.all=!1;TableTools._fnEventDispatch(this,"select",null)}},_fnRowDeselect:function(a,b){"undefined"!=typeof a.nodeName&&(a=e.inArray(a,this.s.select.selected));var c=this.s.select.selected[a];e(c).removeClass(this.s.select.selectedClass); -this.s.select.selected.splice(a,1);("undefined"==typeof b||b)&&null!==this.s.select.postDeselected&&this.s.select.postDeselected.call(this,c);this.s.select.all=!1},_fnTextConfig:function(a,b){var c=this;null!==b.fnInit&&b.fnInit.call(this,a,b);if(""!==b.sToolTip)a.title=b.sToolTip;e(a).hover(function(){e(a).addClass(b.sButtonClassHover);null!==b.fnMouseover&&b.fnMouseover.call(this,a,b,null)},function(){e(a).removeClass(b.sButtonClassHover);null!==b.fnMouseout&&b.fnMouseout.call(this,a,b,null)}); -null!==b.fnSelect&&TableTools._fnEventListen(this,"select",function(d){b.fnSelect.call(c,a,b,d)});e(a).click(function(d){d.preventDefault();null!==b.fnClick&&b.fnClick.call(c,a,b,null);null!==b.fnComplete&&b.fnComplete.call(c,a,b,null,null);c._fnCollectionHide(a,b)})},_fnFlashConfig:function(a,b){var c=this,d=new ZeroClipboard_TableTools.Client;null!==b.fnInit&&b.fnInit.call(this,a,b);d.setHandCursor(!0);"flash_save"==b.sAction?(d.setAction("save"),d.setCharSet("utf16le"==b.sCharSet?"UTF16LE":"UTF8"), -d.setBomInc(b.bBomInc),d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))):"flash_pdf"==b.sAction?(d.setAction("pdf"),d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))):d.setAction("copy");d.addEventListener("mouseOver",function(){e(a).addClass(b.sButtonClassHover);null!==b.fnMouseover&&b.fnMouseover.call(c,a,b,d)});d.addEventListener("mouseOut",function(){e(a).removeClass(b.sButtonClassHover);null!==b.fnMouseout&&b.fnMouseout.call(c,a,b,d)});d.addEventListener("mouseDown",function(){null!== -b.fnClick&&b.fnClick.call(c,a,b,d)});d.addEventListener("complete",function(e,g){null!==b.fnComplete&&b.fnComplete.call(c,a,b,d,g);c._fnCollectionHide(a,b)});this._fnFlashGlue(d,a,b.sToolTip)},_fnFlashGlue:function(a,b,c){var d=this,e=b.getAttribute("id");if(f.getElementById(e)){if(a.glue(b,c),a.domElement.parentNode!=a.div.parentNode&&"undefined"==typeof d.__bZCWarning)d.s.dt.oApi._fnLog(this.s.dt,0,"It looks like you are using the version of ZeroClipboard which came with TableTools 1. Please update to use the version that came with TableTools 2."), -d.__bZCWarning=!0}else setTimeout(function(){d._fnFlashGlue(a,b,c)},100)},_fnFlashSetText:function(a,b){var c=this._fnChunkData(b,8192);a.clearText();for(var d=0,e=c.length;d<e;d++)a.appendText(c[d])},_fnColumnTargets:function(a){var b=[],c=this.s.dt;if("object"==typeof a){for(i=0,iLen=c.aoColumns.length;i<iLen;i++)b.push(!1);for(i=0,iLen=a.length;i<iLen;i++)b[a[i]]=!0}else if("visible"==a)for(i=0,iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?!0:!1);else if("hidden"==a)for(i=0, -iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?!1:!0);else if("sortable"==a)for(i=0,iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bSortable?!0:!1);else for(i=0,iLen=c.aoColumns.length;i<iLen;i++)b.push(!0);return b},_fnNewline:function(a){return"auto"==a.sNewLine?navigator.userAgent.match(/Windows/)?"\r\n":"\n":a.sNewLine},_fnGetDataTablesData:function(a){var b,c,d,j,g,f=[],h="",k=this.s.dt,n=RegExp(a.sFieldBoundary,"g"),l=this._fnColumnTargets(a.mColumns),m="undefined"!= -typeof a.bSelectedOnly?a.bSelectedOnly:!1;if(a.bHeader){g=[];for(b=0,c=k.aoColumns.length;b<c;b++)l[b]&&(h=k.aoColumns[b].sTitle.replace(/\n/g," ").replace(/<.*?>/g,"").replace(/^\s+|\s+$/g,""),h=this._fnHtmlDecode(h),g.push(this._fnBoundData(h,a.sFieldBoundary,n)));f.push(g.join(a.sFieldSeperator))}for(d=0,j=k.aiDisplay.length;d<j;d++)if("none"==this.s.select.type||!m||m&&e(k.aoData[k.aiDisplay[d]].nTr).hasClass(this.s.select.selectedClass)||m&&0==this.s.select.selected.length){g=[];for(b=0,c=k.aoColumns.length;b< -c;b++)l[b]&&(h=k.oApi._fnGetCellData(k,k.aiDisplay[d],b,"display"),a.fnCellRender?h=a.fnCellRender(h,b)+"":"string"==typeof h?(h=h.replace(/\n/g," "),h=h.replace(/<img.*?\s+alt\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+)).*?>/gi,"$1$2$3"),h=h.replace(/<.*?>/g,"")):h+="",h=h.replace(/^\s+/,"").replace(/\s+$/,""),h=this._fnHtmlDecode(h),g.push(this._fnBoundData(h,a.sFieldBoundary,n)));f.push(g.join(a.sFieldSeperator))}if(a.bFooter&&null!==k.nTFoot){g=[];for(b=0,c=k.aoColumns.length;b<c;b++)l[b]&&null!== -k.aoColumns[b].nTf&&(h=k.aoColumns[b].nTf.innerHTML.replace(/\n/g," ").replace(/<.*?>/g,""),h=this._fnHtmlDecode(h),g.push(this._fnBoundData(h,a.sFieldBoundary,n)));f.push(g.join(a.sFieldSeperator))}return _sLastData=f.join(this._fnNewline(a))},_fnBoundData:function(a,b,c){return""===b?a:b+a.replace(c,b+b)+b},_fnChunkData:function(a,b){for(var c=[],d=a.length,e=0;e<d;e+=b)e+b<d?c.push(a.substring(e,e+b)):c.push(a.substring(e,d));return c},_fnHtmlDecode:function(a){if(-1==a.indexOf("&"))return a;var a= -this._fnChunkData(a,2048),b=f.createElement("div"),c,d,e,g="";for(c=0,d=a.length;c<d;c++)e=a[c].lastIndexOf("&"),-1!=e&&8<=a[c].length&&e>a[c].length-8&&(a[c].substr(e),a[c]=a[c].substr(0,e)),b.innerHTML=a[c],g+=b.childNodes[0].nodeValue;return g},_fnPrintConfig:function(a,b){var c=this;null!==b.fnInit&&b.fnInit.call(this,a,b);if(""!==b.sToolTip)a.title=b.sToolTip;e(a).hover(function(){e(a).addClass(b.sButtonClassHover)},function(){e(a).removeClass(b.sButtonClassHover)});null!==b.fnSelect&&TableTools._fnEventListen(this, -"select",function(d){b.fnSelect.call(c,a,b,d)});e(a).click(function(d){d.preventDefault();c._fnPrintStart.call(c,d,b);null!==b.fnClick&&b.fnClick.call(c,a,b,null);null!==b.fnComplete&&b.fnComplete.call(c,a,b,null,null);c._fnCollectionHide(a,b)})},_fnPrintStart:function(a,b){var c=this,d=this.s.dt;this._fnPrintHideNodes(d.nTable);this.s.print.saveStart=d._iDisplayStart;this.s.print.saveLength=d._iDisplayLength;if(b.bShowAll)d._iDisplayStart=0,d._iDisplayLength=-1,d.oApi._fnCalculateEnd(d),d.oApi._fnDraw(d); -(""!==d.oScroll.sX||""!==d.oScroll.sY)&&this._fnPrintScrollStart(d);var d=d.aanFeatures,j;for(j in d)if("i"!=j&&"t"!=j&&1==j.length)for(var g=0,o=d[j].length;g<o;g++)this.dom.print.hidden.push({node:d[j][g],display:"block"}),d[j][g].style.display="none";e(f.body).addClass("DTTT_Print");if(""!==b.sInfo){var h=f.createElement("div");h.className="DTTT_print_info";h.innerHTML=b.sInfo;f.body.appendChild(h);setTimeout(function(){e(h).fadeOut("normal",function(){f.body.removeChild(h)})},2E3)}if(""!==b.sMessage)this.dom.print.message= -f.createElement("div"),this.dom.print.message.className="DTTT_PrintMessage",this.dom.print.message.innerHTML=b.sMessage,f.body.insertBefore(this.dom.print.message,f.body.childNodes[0]);this.s.print.saveScroll=e(m).scrollTop();m.scrollTo(0,0);this.s.print.funcEnd=function(a){c._fnPrintEnd.call(c,a)};e(f).bind("keydown",null,this.s.print.funcEnd)},_fnPrintEnd:function(a){if(27==a.keyCode){a.preventDefault();var a=this.s.dt,b=this.s.print,c=this.dom.print;this._fnPrintShowNodes();(""!==a.oScroll.sX|| -""!==a.oScroll.sY)&&this._fnPrintScrollEnd();m.scrollTo(0,b.saveScroll);if(null!==c.message)f.body.removeChild(c.message),c.message=null;e(f.body).removeClass("DTTT_Print");a._iDisplayStart=b.saveStart;a._iDisplayLength=b.saveLength;a.oApi._fnCalculateEnd(a);a.oApi._fnDraw(a);e(f).unbind("keydown",this.s.print.funcEnd);this.s.print.funcEnd=null}},_fnPrintScrollStart:function(){var a=this.s.dt;a.nScrollHead.getElementsByTagName("div")[0].getElementsByTagName("table");var b=a.nTable.parentNode,c=a.nTable.getElementsByTagName("thead"); -0<c.length&&a.nTable.removeChild(c[0]);null!==a.nTFoot&&(c=a.nTable.getElementsByTagName("tfoot"),0<c.length&&a.nTable.removeChild(c[0]));c=a.nTHead.cloneNode(!0);a.nTable.insertBefore(c,a.nTable.childNodes[0]);null!==a.nTFoot&&(c=a.nTFoot.cloneNode(!0),a.nTable.insertBefore(c,a.nTable.childNodes[1]));if(""!==a.oScroll.sX)a.nTable.style.width=e(a.nTable).outerWidth()+"px",b.style.width=e(a.nTable).outerWidth()+"px",b.style.overflow="visible";if(""!==a.oScroll.sY)b.style.height=e(a.nTable).outerHeight()+ -"px",b.style.overflow="visible"},_fnPrintScrollEnd:function(){var a=this.s.dt,b=a.nTable.parentNode;if(""!==a.oScroll.sX)b.style.width=a.oApi._fnStringToCss(a.oScroll.sX),b.style.overflow="auto";if(""!==a.oScroll.sY)b.style.height=a.oApi._fnStringToCss(a.oScroll.sY),b.style.overflow="auto"},_fnPrintShowNodes:function(){for(var a=this.dom.print.hidden,b=0,c=a.length;b<c;b++)a[b].node.style.display=a[b].display;a.splice(0,a.length)},_fnPrintHideNodes:function(a){for(var b=this.dom.print.hidden,c=a.parentNode, -d=c.childNodes,j=0,g=d.length;j<g;j++)if(d[j]!=a&&1==d[j].nodeType){var f=e(d[j]).css("display");if("none"!=f)b.push({node:d[j],display:f}),d[j].style.display="none"}"BODY"!=c.nodeName&&this._fnPrintHideNodes(c)}};TableTools._aInstances=[];TableTools._aListeners=[];TableTools.fnGetMasters=function(){for(var a=[],b=0,c=TableTools._aInstances.length;b<c;b++)TableTools._aInstances[b].s.master&&a.push(TableTools._aInstances[b]);return a};TableTools.fnGetInstance=function(a){"object"!=typeof a&&(a=f.getElementById(a)); -for(var b=0,c=TableTools._aInstances.length;b<c;b++)if(TableTools._aInstances[b].s.master&&TableTools._aInstances[b].dom.table==a)return TableTools._aInstances[b];return null};TableTools._fnEventListen=function(a,b,c){TableTools._aListeners.push({that:a,type:b,fn:c})};TableTools._fnEventDispatch=function(a,b,c){for(var d=TableTools._aListeners,e=0,f=d.length;e<f;e++)a.dom.table==d[e].that.dom.table&&d[e].type==b&&d[e].fn(c)};TableTools.BUTTONS={csv:{sAction:"flash_save",sCharSet:"utf8",bBomInc:!1, -sFileName:"*.csv",sFieldBoundary:'"',sFieldSeperator:",",sNewLine:"auto",sTitle:"",sToolTip:"",sButtonClass:"DTTT_button_csv",sButtonClassHover:"DTTT_button_csv_hover",sButtonText:"CSV",mColumns:"all",bHeader:!0,bFooter:!0,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))},fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null},xls:{sAction:"flash_save",sCharSet:"utf16le",bBomInc:!0,sFileName:"*.csv",sFieldBoundary:"",sFieldSeperator:"\t", -sNewLine:"auto",sTitle:"",sToolTip:"",sButtonClass:"DTTT_button_xls",sButtonClassHover:"DTTT_button_xls_hover",sButtonText:"Excel",mColumns:"all",bHeader:!0,bFooter:!0,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))},fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null},copy:{sAction:"flash_copy",sFieldBoundary:"",sFieldSeperator:"\t",sNewLine:"auto",sToolTip:"",sButtonClass:"DTTT_button_copy",sButtonClassHover:"DTTT_button_copy_hover", -sButtonText:"Copy",mColumns:"all",bHeader:!0,bFooter:!0,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))},fnSelect:null,fnComplete:function(a,b,c,d){a=d.split("\n").length;a=null===this.s.dt.nTFoot?a-1:a-2;alert("Copied "+a+" row"+(1==a?"":"s")+" to the clipboard")},fnInit:null,fnCellRender:null},pdf:{sAction:"flash_pdf",sFieldBoundary:"",sFieldSeperator:"\t",sNewLine:"\n",sFileName:"*.pdf",sToolTip:"",sTitle:"",sButtonClass:"DTTT_button_pdf", -sButtonClassHover:"DTTT_button_pdf_hover",sButtonText:"PDF",mColumns:"all",bHeader:!0,bFooter:!1,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,sPdfOrientation:"portrait",sPdfSize:"A4",sPdfMessage:"",fnClick:function(a,b,c){this.fnSetText(c,"title:"+this.fnGetTitle(b)+"\nmessage:"+b.sPdfMessage+"\ncolWidth:"+this.fnCalcColRatios(b)+"\norientation:"+b.sPdfOrientation+"\nsize:"+b.sPdfSize+"\n--/TableToolsOpts--\n"+this.fnGetTableData(b))},fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null}, -print:{sAction:"print",sInfo:"<h6>Print view</h6><p>Please use your browser's print function to print this table. Press escape when finished.",sMessage:"",bShowAll:!0,sToolTip:"View print view",sButtonClass:"DTTT_button_print",sButtonClassHover:"DTTT_button_print_hover",sButtonText:"Print",fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null},text:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover", -sButtonText:"Text button",mColumns:"all",bHeader:!0,bFooter:!0,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null},select:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Select button",mColumns:"all",bHeader:!0,bFooter:!0,fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass("DTTT_disabled"):e(a).addClass("DTTT_disabled")}, -fnComplete:null,fnInit:function(a){e(a).addClass("DTTT_disabled")},fnCellRender:null},select_single:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Select button",mColumns:"all",bHeader:!0,bFooter:!0,fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:function(a){1==this.fnGetSelected().length?e(a).removeClass("DTTT_disabled"):e(a).addClass("DTTT_disabled")},fnComplete:null,fnInit:function(a){e(a).addClass("DTTT_disabled")},fnCellRender:null}, -select_all:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Select all",mColumns:"all",bHeader:!0,bFooter:!0,fnMouseover:null,fnMouseout:null,fnClick:function(){this.fnSelectAll()},fnSelect:function(a){this.fnGetSelected().length==this.s.dt.fnRecordsDisplay()?e(a).addClass("DTTT_disabled"):e(a).removeClass("DTTT_disabled")},fnComplete:null,fnInit:null,fnCellRender:null},select_none:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text", -sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Deselect all",mColumns:"all",bHeader:!0,bFooter:!0,fnMouseover:null,fnMouseout:null,fnClick:function(){this.fnSelectNone()},fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass("DTTT_disabled"):e(a).addClass("DTTT_disabled")},fnComplete:null,fnInit:function(a){e(a).addClass("DTTT_disabled")},fnCellRender:null},ajax:{sAction:"text",sFieldBoundary:"",sFieldSeperator:"\t",sNewLine:"\n",sAjaxUrl:"/xhr.php",sToolTip:"",sButtonClass:"DTTT_button_text", -sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Ajax button",mColumns:"all",bHeader:!0,bFooter:!0,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:function(a,b){var c=this.fnGetTableData(b);e.ajax({url:b.sAjaxUrl,data:[{name:"tableData",value:c}],success:b.fnAjaxComplete,dataType:"json",type:"POST",cache:!1,error:function(){alert("Error detected when sending table data to server")}})},fnSelect:null,fnComplete:null,fnInit:null,fnAjaxComplete:function(){alert("Ajax complete")},fnCellRender:null}, -div:{sAction:"div",sToolTip:"",sButtonClass:"DTTT_nonbutton",sButtonClassHover:"",sButtonText:"Text button",fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:null,fnComplete:null,fnInit:null,nContent:null,fnCellRender:null},collection:{sAction:"collection",sToolTip:"",sButtonClass:"DTTT_button_collection",sButtonClassHover:"DTTT_button_collection_hover",sButtonText:"Collection",fnMouseover:null,fnMouseout:null,fnClick:function(a,b){this._fnCollectionShow(a,b)},fnSelect:null,fnComplete:null,fnInit:null, -fnCellRender:null}};TableTools.DEFAULTS={sSwfPath:"media/swf/copy_csv_xls_pdf.swf",sRowSelect:"none",sSelectedClass:"DTTT_selected",fnPreRowSelect:null,fnRowSelected:null,fnRowDeselected:null,aButtons:["copy","csv","xls","pdf","print"]};TableTools.prototype.CLASS="TableTools";TableTools.VERSION="2.0.3";TableTools.prototype.VERSION=TableTools.VERSION;"function"==typeof e.fn.dataTable&&"function"==typeof e.fn.dataTableExt.fnVersionCheck&&e.fn.dataTableExt.fnVersionCheck("1.8.2")?e.fn.dataTableExt.aoFeatures.push({fnInit:function(a){a= -new TableTools(a.oInstance,"undefined"!=typeof a.oInit.oTableTools?a.oInit.oTableTools:{});TableTools._aInstances.push(a);return a.dom.container},cFeature:"T",sFeature:"TableTools"}):alert("Warning: TableTools 2 requires DataTables 1.8.2 or newer - www.datatables.net/download")})(jQuery,window,document); +(function(f,n,g){TableTools=function(a,b){!this instanceof TableTools&&alert("Warning: TableTools must be initialised with the keyword 'new'");this.s={that:this,dt:a.fnSettings(),print:{saveStart:-1,saveLength:-1,saveScroll:-1,funcEnd:function(){}},buttonCounter:0,select:{type:"",selected:[],preRowSelect:null,postSelected:null,postDeselected:null,all:!1,selectedClass:""},custom:{},swfPath:"",buttonSet:[],master:!1,tags:{}};this.dom={container:null,table:null,print:{hidden:[],message:null},collection:{collection:null, +background:null}};this.classes=f.extend(!0,{},TableTools.classes);this.s.dt.bJUI&&f.extend(!0,this.classes,TableTools.classes_themeroller);this.fnSettings=function(){return this.s};"undefined"==typeof b&&(b={});this._fnConstruct(b);return this};TableTools.prototype={fnGetSelected:function(a){var b=[],c=this.s.dt.aoData,d=this.s.dt.aiDisplay,e;if(a){a=0;for(e=d.length;a<e;a++)c[d[a]]._DTTT_selected&&b.push(c[d[a]].nTr)}else{a=0;for(e=c.length;a<e;a++)c[a]._DTTT_selected&&b.push(c[a].nTr)}return b}, +fnGetSelectedData:function(){var a=[],b=this.s.dt.aoData,c,d;c=0;for(d=b.length;c<d;c++)b[c]._DTTT_selected&&a.push(this.s.dt.oInstance.fnGetData(c));return a},fnIsSelected:function(a){a=this.s.dt.oInstance.fnGetPosition(a);return!0===this.s.dt.aoData[a]._DTTT_selected?!0:!1},fnSelectAll:function(a){var b=this._fnGetMasterSettings();this._fnRowSelect(!0===a?b.dt.aiDisplay:b.dt.aoData)},fnSelectNone:function(a){this._fnGetMasterSettings();this._fnRowDeselect(this.fnGetSelected(a))},fnSelect:function(a){"single"== +this.s.select.type?(this.fnSelectNone(),this._fnRowSelect(a)):"multi"==this.s.select.type&&this._fnRowSelect(a)},fnDeselect:function(a){this._fnRowDeselect(a)},fnGetTitle:function(a){var b="";"undefined"!=typeof a.sTitle&&""!==a.sTitle?b=a.sTitle:(a=g.getElementsByTagName("title"),0<a.length&&(b=a[0].innerHTML));return 4>"\u00a1".toString().length?b.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""):b.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g,"")},fnCalcColRatios:function(a){var b=this.s.dt.aoColumns, +a=this._fnColumnTargets(a.mColumns),c=[],d=0,e=0,f,g;f=0;for(g=a.length;f<g;f++)a[f]&&(d=b[f].nTh.offsetWidth,e+=d,c.push(d));f=0;for(g=c.length;f<g;f++)c[f]/=e;return c.join("\t")},fnGetTableData:function(a){if(this.s.dt)return this._fnGetDataTablesData(a)},fnSetText:function(a,b){this._fnFlashSetText(a,b)},fnResizeButtons:function(){for(var a in ZeroClipboard_TableTools.clients)if(a){var b=ZeroClipboard_TableTools.clients[a];"undefined"!=typeof b.domElement&&b.domElement.parentNode&&b.positionElement()}}, +fnResizeRequired:function(){for(var a in ZeroClipboard_TableTools.clients)if(a){var b=ZeroClipboard_TableTools.clients[a];if("undefined"!=typeof b.domElement&&b.domElement.parentNode==this.dom.container&&!1===b.sized)return!0}return!1},fnPrint:function(a,b){void 0===b&&(b={});void 0===a||a?this._fnPrintStart(b):this._fnPrintEnd()},fnInfo:function(a,b){var c=g.createElement("div");c.className=this.classes.print.info;c.innerHTML=a;g.body.appendChild(c);setTimeout(function(){f(c).fadeOut("normal",function(){g.body.removeChild(c)})}, +b)},_fnConstruct:function(a){var b=this;this._fnCustomiseSettings(a);this.dom.container=g.createElement(this.s.tags.container);this.dom.container.className=this.classes.container;"none"!=this.s.select.type&&this._fnRowSelectConfig();this._fnButtonDefinations(this.s.buttonSet,this.dom.container);this.s.dt.aoDestroyCallback.push({sName:"TableTools",fn:function(){b.dom.container.innerHTML=""}})},_fnCustomiseSettings:function(a){"undefined"==typeof this.s.dt._TableToolsInit&&(this.s.master=!0,this.s.dt._TableToolsInit= +!0);this.dom.table=this.s.dt.nTable;this.s.custom=f.extend({},TableTools.DEFAULTS,a);this.s.swfPath=this.s.custom.sSwfPath;"undefined"!=typeof ZeroClipboard_TableTools&&(ZeroClipboard_TableTools.moviePath=this.s.swfPath);this.s.select.type=this.s.custom.sRowSelect;this.s.select.preRowSelect=this.s.custom.fnPreRowSelect;this.s.select.postSelected=this.s.custom.fnRowSelected;this.s.select.postDeselected=this.s.custom.fnRowDeselected;this.s.custom.sSelectedClass&&(this.classes.select.row=this.s.custom.sSelectedClass); +this.s.tags=this.s.custom.oTags;this.s.buttonSet=this.s.custom.aButtons},_fnButtonDefinations:function(a,b){for(var c,d=0,e=a.length;d<e;d++){if("string"==typeof a[d]){if("undefined"==typeof TableTools.BUTTONS[a[d]]){alert("TableTools: Warning - unknown button type: "+a[d]);continue}c=f.extend({},TableTools.BUTTONS[a[d]],!0)}else{if("undefined"==typeof TableTools.BUTTONS[a[d].sExtends]){alert("TableTools: Warning - unknown button type: "+a[d].sExtends);continue}c=f.extend({},TableTools.BUTTONS[a[d].sExtends], +!0);c=f.extend(c,a[d],!0)}b.appendChild(this._fnCreateButton(c,f(b).hasClass(this.classes.collection.container)))}},_fnCreateButton:function(a,b){var c=this._fnButtonBase(a,b);a.sAction.match(/flash/)?this._fnFlashConfig(c,a):"text"==a.sAction?this._fnTextConfig(c,a):"div"==a.sAction?this._fnTextConfig(c,a):"collection"==a.sAction&&(this._fnTextConfig(c,a),this._fnCollectionConfig(c,a));return c},_fnButtonBase:function(a,b){var c,d,e;b?(c="default"!==a.sTag?a.sTag:this.s.tags.collection.button,d= +"default"!==a.sLinerTag?a.sLiner:this.s.tags.collection.liner,e=this.classes.collection.buttons.normal):(c="default"!==a.sTag?a.sTag:this.s.tags.button,d="default"!==a.sLinerTag?a.sLiner:this.s.tags.liner,e=this.classes.buttons.normal);c=g.createElement(c);d=g.createElement(d);var f=this._fnGetMasterSettings();c.className=e+" "+a.sButtonClass;c.setAttribute("id","ToolTables_"+this.s.dt.sInstance+"_"+f.buttonCounter);c.appendChild(d);d.innerHTML=a.sButtonText;f.buttonCounter++;return c},_fnGetMasterSettings:function(){if(this.s.master)return this.s; +for(var a=TableTools._aInstances,b=0,c=a.length;b<c;b++)if(this.dom.table==a[b].s.dt.nTable)return a[b].s},_fnCollectionConfig:function(a,b){var c=g.createElement(this.s.tags.collection.container);c.style.display="none";c.className=this.classes.collection.container;b._collection=c;g.body.appendChild(c);this._fnButtonDefinations(b.aButtons,c)},_fnCollectionShow:function(a,b){var c=this,d=f(a).offset(),e=b._collection,j=d.left,d=d.top+f(a).outerHeight(),m=f(n).height(),h=f(g).height(),k=f(n).width(), +o=f(g).width();e.style.position="absolute";e.style.left=j+"px";e.style.top=d+"px";e.style.display="block";f(e).css("opacity",0);var l=g.createElement("div");l.style.position="absolute";l.style.left="0px";l.style.top="0px";l.style.height=(m>h?m:h)+"px";l.style.width=(k>o?k:o)+"px";l.className=this.classes.collection.background;f(l).css("opacity",0);g.body.appendChild(l);g.body.appendChild(e);m=f(e).outerWidth();k=f(e).outerHeight();j+m>o&&(e.style.left=o-m+"px");d+k>h&&(e.style.top=d-k-f(a).outerHeight()+ +"px");this.dom.collection.collection=e;this.dom.collection.background=l;setTimeout(function(){f(e).animate({opacity:1},500);f(l).animate({opacity:0.25},500)},10);this.fnResizeButtons();f(l).click(function(){c._fnCollectionHide.call(c,null,null)})},_fnCollectionHide:function(a,b){!(null!==b&&"collection"==b.sExtends)&&null!==this.dom.collection.collection&&(f(this.dom.collection.collection).animate({opacity:0},500,function(){this.style.display="none"}),f(this.dom.collection.background).animate({opacity:0}, +500,function(){this.parentNode.removeChild(this)}),this.dom.collection.collection=null,this.dom.collection.background=null)},_fnRowSelectConfig:function(){if(this.s.master){var a=this,b=this.s.dt;f(b.nTable).addClass(this.classes.select.table);f("tr",b.nTBody).live("click",function(c){this.parentNode==b.nTBody&&null!==b.oInstance.fnGetData(this)&&(a.fnIsSelected(this)?a._fnRowDeselect(this,c):"single"==a.s.select.type?(a.fnSelectNone(),a._fnRowSelect(this,c)):"multi"==a.s.select.type&&a._fnRowSelect(this, +c))});b.oApi._fnCallbackReg(b,"aoRowCreatedCallback",function(c,d,e){b.aoData[e]._DTTT_selected&&f(c).addClass(a.classes.select.row)},"TableTools-SelectAll")}},_fnRowSelect:function(a,b){var c=this._fnSelectData(a),d=[],e,j;e=0;for(j=c.length;e<j;e++)c[e].nTr&&d.push(c[e].nTr);if(null===this.s.select.preRowSelect||this.s.select.preRowSelect.call(this,b,d,!0)){e=0;for(j=c.length;e<j;e++)c[e]._DTTT_selected=!0,c[e].nTr&&f(c[e].nTr).addClass(this.classes.select.row);null!==this.s.select.postSelected&& +this.s.select.postSelected.call(this,d);TableTools._fnEventDispatch(this,"select",d,!0)}},_fnRowDeselect:function(a,b){var c=this._fnSelectData(a),d=[],e,j;e=0;for(j=c.length;e<j;e++)c[e].nTr&&d.push(c[e].nTr);if(null===this.s.select.preRowSelect||this.s.select.preRowSelect.call(this,b,d,!1)){e=0;for(j=c.length;e<j;e++)c[e]._DTTT_selected=!1,c[e].nTr&&f(c[e].nTr).removeClass(this.classes.select.row);null!==this.s.select.postDeselected&&this.s.select.postDeselected.call(this,d);TableTools._fnEventDispatch(this, +"select",d,!1)}},_fnSelectData:function(a){var b=[],c,d,e;if(a.nodeName)c=this.s.dt.oInstance.fnGetPosition(a),b.push(this.s.dt.aoData[c]);else if("undefined"!==typeof a.length){d=0;for(e=a.length;d<e;d++)a[d].nodeName?(c=this.s.dt.oInstance.fnGetPosition(a[d]),b.push(this.s.dt.aoData[c])):"number"===typeof a[d]?b.push(this.s.dt.aoData[a[d]]):b.push(a[d])}else b.push(a);return b},_fnTextConfig:function(a,b){var c=this;null!==b.fnInit&&b.fnInit.call(this,a,b);""!==b.sToolTip&&(a.title=b.sToolTip); +f(a).hover(function(){b.fnMouseover!==null&&b.fnMouseover.call(this,a,b,null)},function(){b.fnMouseout!==null&&b.fnMouseout.call(this,a,b,null)});null!==b.fnSelect&&TableTools._fnEventListen(this,"select",function(d){b.fnSelect.call(c,a,b,d)});f(a).click(function(){b.fnClick!==null&&b.fnClick.call(c,a,b,null);b.fnComplete!==null&&b.fnComplete.call(c,a,b,null,null);c._fnCollectionHide(a,b)})},_fnFlashConfig:function(a,b){var c=this,d=new ZeroClipboard_TableTools.Client;null!==b.fnInit&&b.fnInit.call(this, +a,b);d.setHandCursor(!0);"flash_save"==b.sAction?(d.setAction("save"),d.setCharSet("utf16le"==b.sCharSet?"UTF16LE":"UTF8"),d.setBomInc(b.bBomInc),d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))):"flash_pdf"==b.sAction?(d.setAction("pdf"),d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))):d.setAction("copy");d.addEventListener("mouseOver",function(){b.fnMouseover!==null&&b.fnMouseover.call(c,a,b,d)});d.addEventListener("mouseOut",function(){b.fnMouseout!==null&&b.fnMouseout.call(c, +a,b,d)});d.addEventListener("mouseDown",function(){b.fnClick!==null&&b.fnClick.call(c,a,b,d)});d.addEventListener("complete",function(e,f){b.fnComplete!==null&&b.fnComplete.call(c,a,b,d,f);c._fnCollectionHide(a,b)});this._fnFlashGlue(d,a,b.sToolTip)},_fnFlashGlue:function(a,b,c){var d=this,e=b.getAttribute("id");g.getElementById(e)?a.glue(b,c):setTimeout(function(){d._fnFlashGlue(a,b,c)},100)},_fnFlashSetText:function(a,b){var c=this._fnChunkData(b,8192);a.clearText();for(var d=0,e=c.length;d<e;d++)a.appendText(c[d])}, +_fnColumnTargets:function(a){var b=[],c=this.s.dt;if("object"==typeof a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(!1);i=0;for(iLen=a.length;i<iLen;i++)b[a[i]]=!0}else if("visible"==a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?!0:!1)}else if("hidden"==a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?!1:!0)}else if("sortable"==a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bSortable?!0:!1)}else{i=0;for(iLen=c.aoColumns.length;i< +iLen;i++)b.push(!0)}return b},_fnNewline:function(a){return"auto"==a.sNewLine?navigator.userAgent.match(/Windows/)?"\r\n":"\n":a.sNewLine},_fnGetDataTablesData:function(a){var b,c,d,e,j,g=[],h="",k=this.s.dt,o,l=RegExp(a.sFieldBoundary,"g"),n=this._fnColumnTargets(a.mColumns);d="undefined"!=typeof a.bSelectedOnly?a.bSelectedOnly:!1;if(a.bHeader){j=[];b=0;for(c=k.aoColumns.length;b<c;b++)n[b]&&(h=k.aoColumns[b].sTitle.replace(/\n/g," ").replace(/<.*?>/g,"").replace(/^\s+|\s+$/g,""),h=this._fnHtmlDecode(h), +j.push(this._fnBoundData(h,a.sFieldBoundary,l)));g.push(j.join(a.sFieldSeperator))}var p=k.aiDisplay;e=this.fnGetSelected();if("none"!==this.s.select.type&&d&&0!==e.length){p=[];b=0;for(c=e.length;b<c;b++)p.push(k.oInstance.fnGetPosition(e[b]))}d=0;for(e=p.length;d<e;d++){o=k.aoData[p[d]].nTr;j=[];b=0;for(c=k.aoColumns.length;b<c;b++)n[b]&&(h=k.oApi._fnGetCellData(k,p[d],b,"display"),a.fnCellRender?h=a.fnCellRender(h,b,o,p[d])+"":"string"==typeof h?(h=h.replace(/\n/g," "),h=h.replace(/<img.*?\s+alt\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+)).*?>/gi, +"$1$2$3"),h=h.replace(/<.*?>/g,"")):h+="",h=h.replace(/^\s+/,"").replace(/\s+$/,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));g.push(j.join(a.sFieldSeperator));a.bOpenRows&&(b=f.grep(k.aoOpenRows,function(a){return a.nParent===o}),1===b.length&&(h=this._fnBoundData(f("td",b[0].nTr).html(),a.sFieldBoundary,l),g.push(h)))}if(a.bFooter&&null!==k.nTFoot){j=[];b=0;for(c=k.aoColumns.length;b<c;b++)n[b]&&null!==k.aoColumns[b].nTf&&(h=k.aoColumns[b].nTf.innerHTML.replace(/\n/g, +" ").replace(/<.*?>/g,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));g.push(j.join(a.sFieldSeperator))}return _sLastData=g.join(this._fnNewline(a))},_fnBoundData:function(a,b,c){return""===b?a:b+a.replace(c,b+b)+b},_fnChunkData:function(a,b){for(var c=[],d=a.length,e=0;e<d;e+=b)e+b<d?c.push(a.substring(e,e+b)):c.push(a.substring(e,d));return c},_fnHtmlDecode:function(a){if(-1===a.indexOf("&"))return a;var b=g.createElement("div");return a.replace(/&([^\s]*);/g,function(a, +d){if("#"===a.substr(1,1))return String.fromCharCode(Number(d.substr(1)));b.innerHTML=a;return b.childNodes[0].nodeValue})},_fnPrintStart:function(a){var b=this,c=this.s.dt;this._fnPrintHideNodes(c.nTable);this.s.print.saveStart=c._iDisplayStart;this.s.print.saveLength=c._iDisplayLength;a.bShowAll&&(c._iDisplayStart=0,c._iDisplayLength=-1,c.oApi._fnCalculateEnd(c),c.oApi._fnDraw(c));if(""!==c.oScroll.sX||""!==c.oScroll.sY)this._fnPrintScrollStart(c),f(this.s.dt.nTable).bind("draw.DTTT_Print",function(){b._fnPrintScrollStart(c)}); +var d=c.aanFeatures,e;for(e in d)if("i"!=e&&"t"!=e&&1==e.length)for(var j=0,m=d[e].length;j<m;j++)this.dom.print.hidden.push({node:d[e][j],display:"block"}),d[e][j].style.display="none";f(g.body).addClass(this.classes.print.body);""!==a.sInfo&&this.fnInfo(a.sInfo,3E3);a.sMessage&&(this.dom.print.message=g.createElement("div"),this.dom.print.message.className=this.classes.print.message,this.dom.print.message.innerHTML=a.sMessage,g.body.insertBefore(this.dom.print.message,g.body.childNodes[0]));this.s.print.saveScroll= +f(n).scrollTop();n.scrollTo(0,0);f(g).bind("keydown.DTTT",function(a){if(a.keyCode==27){a.preventDefault();b._fnPrintEnd.call(b,a)}})},_fnPrintEnd:function(){var a=this.s.dt,b=this.s.print,c=this.dom.print;this._fnPrintShowNodes();if(""!==a.oScroll.sX||""!==a.oScroll.sY)f(this.s.dt.nTable).unbind("draw.DTTT_Print"),this._fnPrintScrollEnd();n.scrollTo(0,b.saveScroll);null!==c.message&&(g.body.removeChild(c.message),c.message=null);f(g.body).removeClass("DTTT_Print");a._iDisplayStart=b.saveStart;a._iDisplayLength= +b.saveLength;a.oApi._fnCalculateEnd(a);a.oApi._fnDraw(a);f(g).unbind("keydown.DTTT")},_fnPrintScrollStart:function(){var a=this.s.dt;a.nScrollHead.getElementsByTagName("div")[0].getElementsByTagName("table");var b=a.nTable.parentNode,c=a.nTable.getElementsByTagName("thead");0<c.length&&a.nTable.removeChild(c[0]);null!==a.nTFoot&&(c=a.nTable.getElementsByTagName("tfoot"),0<c.length&&a.nTable.removeChild(c[0]));c=a.nTHead.cloneNode(!0);a.nTable.insertBefore(c,a.nTable.childNodes[0]);null!==a.nTFoot&& +(c=a.nTFoot.cloneNode(!0),a.nTable.insertBefore(c,a.nTable.childNodes[1]));""!==a.oScroll.sX&&(a.nTable.style.width=f(a.nTable).outerWidth()+"px",b.style.width=f(a.nTable).outerWidth()+"px",b.style.overflow="visible");""!==a.oScroll.sY&&(b.style.height=f(a.nTable).outerHeight()+"px",b.style.overflow="visible")},_fnPrintScrollEnd:function(){var a=this.s.dt,b=a.nTable.parentNode;""!==a.oScroll.sX&&(b.style.width=a.oApi._fnStringToCss(a.oScroll.sX),b.style.overflow="auto");""!==a.oScroll.sY&&(b.style.height= +a.oApi._fnStringToCss(a.oScroll.sY),b.style.overflow="auto")},_fnPrintShowNodes:function(){for(var a=this.dom.print.hidden,b=0,c=a.length;b<c;b++)a[b].node.style.display=a[b].display;a.splice(0,a.length)},_fnPrintHideNodes:function(a){for(var b=this.dom.print.hidden,c=a.parentNode,d=c.childNodes,e=0,g=d.length;e<g;e++)if(d[e]!=a&&1==d[e].nodeType){var m=f(d[e]).css("display");"none"!=m&&(b.push({node:d[e],display:m}),d[e].style.display="none")}"BODY"!=c.nodeName&&this._fnPrintHideNodes(c)}};TableTools._aInstances= +[];TableTools._aListeners=[];TableTools.fnGetMasters=function(){for(var a=[],b=0,c=TableTools._aInstances.length;b<c;b++)TableTools._aInstances[b].s.master&&a.push(TableTools._aInstances[b]);return a};TableTools.fnGetInstance=function(a){"object"!=typeof a&&(a=g.getElementById(a));for(var b=0,c=TableTools._aInstances.length;b<c;b++)if(TableTools._aInstances[b].s.master&&TableTools._aInstances[b].dom.table==a)return TableTools._aInstances[b];return null};TableTools._fnEventListen=function(a,b,c){TableTools._aListeners.push({that:a, +type:b,fn:c})};TableTools._fnEventDispatch=function(a,b,c,d){for(var e=TableTools._aListeners,f=0,g=e.length;f<g;f++)a.dom.table==e[f].that.dom.table&&e[f].type==b&&e[f].fn(c,d)};TableTools.buttonBase={sAction:"text",sTag:"default",sLinerTag:"default",sButtonClass:"DTTT_button_text",sButtonText:"Button text",sTitle:"",sToolTip:"",sCharSet:"utf8",bBomInc:!1,sFileName:"*.csv",sFieldBoundary:"",sFieldSeperator:"\t",sNewLine:"auto",mColumns:"all",bHeader:!0,bFooter:!0,bOpenRows:!1,bSelectedOnly:!1,fnMouseover:null, +fnMouseout:null,fnClick:null,fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null};TableTools.BUTTONS={csv:f.extend({},TableTools.buttonBase,{sAction:"flash_save",sButtonClass:"DTTT_button_csv",sButtonText:"CSV",sFieldBoundary:'"',sFieldSeperator:",",fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))}}),xls:f.extend({},TableTools.buttonBase,{sAction:"flash_save",sCharSet:"utf16le",bBomInc:!0,sButtonClass:"DTTT_button_xls",sButtonText:"Excel",fnClick:function(a,b,c){this.fnSetText(c, +this.fnGetTableData(b))}}),copy:f.extend({},TableTools.buttonBase,{sAction:"flash_copy",sButtonClass:"DTTT_button_copy",sButtonText:"Copy",fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))},fnComplete:function(a,b,c,d){a=d.split("\n").length;a=null===this.s.dt.nTFoot?a-1:a-2;this.fnInfo("<h6>Table copied</h6><p>Copied "+a+" row"+(1==a?"":"s")+" to the clipboard.</p>",1500)}}),pdf:f.extend({},TableTools.buttonBase,{sAction:"flash_pdf",sNewLine:"\n",sFileName:"*.pdf",sButtonClass:"DTTT_button_pdf", +sButtonText:"PDF",sPdfOrientation:"portrait",sPdfSize:"A4",sPdfMessage:"",fnClick:function(a,b,c){this.fnSetText(c,"title:"+this.fnGetTitle(b)+"\nmessage:"+b.sPdfMessage+"\ncolWidth:"+this.fnCalcColRatios(b)+"\norientation:"+b.sPdfOrientation+"\nsize:"+b.sPdfSize+"\n--/TableToolsOpts--\n"+this.fnGetTableData(b))}}),print:f.extend({},TableTools.buttonBase,{sInfo:"<h6>Print view</h6><p>Please use your browser's print function to print this table. Press escape when finished.",sMessage:null,bShowAll:!0, +sToolTip:"View print view",sButtonClass:"DTTT_button_print",sButtonText:"Print",fnClick:function(a,b){this.fnPrint(!0,b)}}),text:f.extend({},TableTools.buttonBase),select:f.extend({},TableTools.buttonBase,{sButtonText:"Select button",fnSelect:function(a){0!==this.fnGetSelected().length?f(a).removeClass(this.classes.buttons.disabled):f(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){f(a).addClass(this.classes.buttons.disabled)}}),select_single:f.extend({},TableTools.buttonBase,{sButtonText:"Select button", +fnSelect:function(a){1==this.fnGetSelected().length?f(a).removeClass(this.classes.buttons.disabled):f(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){f(a).addClass(this.classes.buttons.disabled)}}),select_all:f.extend({},TableTools.buttonBase,{sButtonText:"Select all",fnClick:function(){this.fnSelectAll()},fnSelect:function(a){this.fnGetSelected().length==this.s.dt.fnRecordsDisplay()?f(a).addClass(this.classes.buttons.disabled):f(a).removeClass(this.classes.buttons.disabled)}}),select_none:f.extend({}, +TableTools.buttonBase,{sButtonText:"Deselect all",fnClick:function(){this.fnSelectNone()},fnSelect:function(a){0!==this.fnGetSelected().length?f(a).removeClass(this.classes.buttons.disabled):f(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){f(a).addClass(this.classes.buttons.disabled)}}),ajax:f.extend({},TableTools.buttonBase,{sAjaxUrl:"/xhr.php",sButtonText:"Ajax button",fnClick:function(a,b){var c=this.fnGetTableData(b);f.ajax({url:b.sAjaxUrl,data:[{name:"tableData",value:c}],success:b.fnAjaxComplete, +dataType:"json",type:"POST",cache:!1,error:function(){alert("Error detected when sending table data to server")}})},fnAjaxComplete:function(){alert("Ajax complete")}}),div:f.extend({},TableTools.buttonBase,{sAction:"div",sTag:"div",sButtonClass:"DTTT_nonbutton",sButtonText:"Text button"}),collection:f.extend({},TableTools.buttonBase,{sAction:"collection",sButtonClass:"DTTT_button_collection",sButtonText:"Collection",fnClick:function(a,b){this._fnCollectionShow(a,b)}})};TableTools.classes={container:"DTTT_container", +buttons:{normal:"DTTT_button",disabled:"DTTT_disabled"},collection:{container:"DTTT_collection",background:"DTTT_collection_background",buttons:{normal:"DTTT_button",disabled:"DTTT_disabled"}},select:{table:"DTTT_selectable",row:"DTTT_selected"},print:{body:"DTTT_Print",info:"DTTT_print_info",message:"DTTT_PrintMessage"}};TableTools.classes_themeroller={container:"DTTT_container ui-buttonset ui-buttonset-multi",buttons:{normal:"DTTT_button ui-button ui-state-default"},collection:{container:"DTTT_collection ui-buttonset ui-buttonset-multi"}}; +TableTools.DEFAULTS={sSwfPath:"media/swf/copy_csv_xls_pdf.swf",sRowSelect:"none",sSelectedClass:null,fnPreRowSelect:null,fnRowSelected:null,fnRowDeselected:null,aButtons:["copy","csv","xls","pdf","print"],oTags:{container:"div",button:"a",liner:"span",collection:{container:"div",button:"a",liner:"span"}}};TableTools.prototype.CLASS="TableTools";TableTools.VERSION="2.1.4";TableTools.prototype.VERSION=TableTools.VERSION;"function"==typeof f.fn.dataTable&&"function"==typeof f.fn.dataTableExt.fnVersionCheck&& +f.fn.dataTableExt.fnVersionCheck("1.9.0")?f.fn.dataTableExt.aoFeatures.push({fnInit:function(a){a=new TableTools(a.oInstance,"undefined"!=typeof a.oInit.oTableTools?a.oInit.oTableTools:{});TableTools._aInstances.push(a);return a.dom.container},cFeature:"T",sFeature:"TableTools"}):alert("Warning: TableTools 2 requires DataTables 1.9.0 or newer - www.datatables.net/download");f.fn.DataTable.TableTools=TableTools})(jQuery,window,document); diff --git a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/js/ZeroClipboard.js b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/js/ZeroClipboard.js index afb932d6bc753bdff9757c10dc02ac5d94005bc6..de0f6b67b58faf50c4ad1f0cf4e5b096505c6e78 100644 --- a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/js/ZeroClipboard.js +++ b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/js/ZeroClipboard.js @@ -115,13 +115,12 @@ ZeroClipboard_TableTools.Client.prototype = { this.div = document.createElement('div'); var style = this.div.style; style.position = 'absolute'; - style.left = (this.domElement.offsetLeft)+'px'; - //style.left = (this.domElement.offsetLeft+2)+'px'; - style.top = this.domElement.offsetTop+'px'; + style.left = '0px'; + style.top = '0px'; style.width = (box.width) + 'px'; - //style.width = (box.width-4) + 'px'; style.height = box.height + 'px'; style.zIndex = zIndex; + if ( typeof title != "undefined" && title != "" ) { this.div.title = title; } @@ -130,8 +129,8 @@ ZeroClipboard_TableTools.Client.prototype = { } // style.backgroundColor = '#f00'; // debug - if ( this.domElement.parentNode ) { - this.domElement.parentNode.appendChild(this.div); + if ( this.domElement ) { + this.domElement.appendChild(this.div); this.div.innerHTML = this.getHTML( box.width, box.height ); } }, @@ -141,8 +140,8 @@ ZeroClipboard_TableTools.Client.prototype = { var style = this.div.style; style.position = 'absolute'; - style.left = (this.domElement.offsetLeft)+'px'; - style.top = this.domElement.offsetTop+'px'; + //style.left = (this.domElement.offsetLeft)+'px'; + //style.top = this.domElement.offsetTop+'px'; style.width = box.width + 'px'; style.height = box.height + 'px'; diff --git a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf/copy_csv_xls.swf b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf/copy_csv_xls.swf index 5c89a09af3ef713fda7b76700af35ae9667eb0b8..157f5fc45f294b069a528b46fe6b49923588cf91 100644 Binary files a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf/copy_csv_xls.swf and b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf/copy_csv_xls.swf differ diff --git a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf/copy_csv_xls_pdf.swf b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf/copy_csv_xls_pdf.swf index 12b9e7c08db7dce4a1b43c3d6b40b93ab510a646..cdc013b6a4d44a0fe5352b92c899e4cf431a1dab 100644 Binary files a/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf/copy_csv_xls_pdf.swf and b/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf/copy_csv_xls_pdf.swf differ