2
0
forked from Wavyzz/dolibarr

New: update jquery datatables with 1.9.1

This commit is contained in:
Regis Houssin
2012-04-26 13:28:24 +02:00
parent 1dd12db306
commit b48f2ae1f9
38 changed files with 11264 additions and 6754 deletions

View File

@@ -1,9 +1,11 @@
/*
* File: ColReorder.js
* Version: 1.0.2
* Version: 1.0.5
* CVS: $Id$
* Description: Controls for column visiblity in DataTables
* Author: Allan Jardine (www.sprymedia.co.uk)
* Created: Wed Sep 15 18:23:29 BST 2010
* Modified: $Date$ by $Author$
* Language: Javascript
* License: GPL v2 or BSD 3 point style
* Project: DataTables
@@ -107,7 +109,7 @@ function fnDomSwitch( nParent, iFrom, iTo )
*/
$.fn.dataTableExt.oApi.fnColReorder = function ( oSettings, iFrom, iTo )
{
var i, iLen, j, jLen, iCols=oSettings.aoColumns.length, nTrs;
var i, iLen, j, jLen, iCols=oSettings.aoColumns.length, nTrs, oCol;
/* Sanity check in the input */
if ( iFrom == iTo )
@@ -161,7 +163,22 @@ $.fn.dataTableExt.oApi.fnColReorder = function ( oSettings, iFrom, iTo )
/* Data column sorting (the column which the sort for a given column should take place on) */
for ( i=0, iLen=iCols ; i<iLen ; i++ )
{
oSettings.aoColumns[i].iDataSort = aiInvertMapping[ oSettings.aoColumns[i].iDataSort ];
oCol = oSettings.aoColumns[i];
for ( j=0, jLen=oCol.aDataSort.length ; j<jLen ; j++ )
{
oCol.aDataSort[j] = aiInvertMapping[ oCol.aDataSort[j] ];
}
}
/* Update the Get and Set functions for each column */
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 );
}
}
@@ -204,7 +221,10 @@ $.fn.dataTableExt.oApi.fnColReorder = function ( oSettings, iFrom, iTo )
/* Body */
for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
{
fnDomSwitch( oSettings.aoData[i].nTr, iVisibleIndex, iInsertBeforeIndex );
if ( oSettings.aoData[i].nTr !== null )
{
fnDomSwitch( oSettings.aoData[i].nTr, iVisibleIndex, iInsertBeforeIndex );
}
}
}
@@ -324,6 +344,14 @@ ColReorder = function( oTable, oOpts )
*/
"fixed": 0,
/**
* Callback function for once the reorder has been done
* @property dropcallback
* @type function
* @default null
*/
"dropCallback": null,
/**
* @namespace Information used for the mouse drag
*/
@@ -421,6 +449,12 @@ ColReorder.prototype = {
this.s.fixed = this.s.init.iFixedColumns;
}
/* Drop callback initialisation option */
if ( typeof this.s.init.fnReorderCallback != 'undefined' )
{
this.s.dropCallback = this.s.init.fnReorderCallback;
}
/* Add event handlers for the drag and drop, and also mark the original column order */
for ( i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ )
{
@@ -434,12 +468,9 @@ ColReorder.prototype = {
}
/* State saving */
this.s.dt.aoStateSave.push( {
"fn": function (oS, sVal) {
return that._fnStateSave.call( that, sVal );
},
"sName": "ColReorder_State"
} );
this.s.dt.oApi._fnCallbackReg( this.s.dt, 'aoStateSaveParams', function (oS, oData) {
that._fnStateSave.call( that, oData );
}, "ColReorder_State" );
/* An initial column order has been specified */
var aiOrder = null;
@@ -526,72 +557,41 @@ ColReorder.prototype = {
/**
* This function effectively replaces the state saving function in DataTables (this is needed
* because otherwise DataTables would state save the columns in their reordered state, not the
* original which is needed on first draw). This is sensitive to any changes in the DataTables
* state saving method!
* Because we change the indexes of columns in the table, relative to their starting point
* we need to reorder the state columns to what they are at the starting point so we can
* then rearrange them again on state load!
* @method _fnStateSave
* @param string sCurrentVal
* @param object oState DataTables state
* @returns string JSON encoded cookie string for DataTables
* @private
*/
"_fnStateSave": function ( sCurrentVal )
"_fnStateSave": function ( oState )
{
var i, iLen, sTmp;
var sValue = sCurrentVal.split('"aaSorting"')[0];
var a = [];
var i, iLen, aCopy, iOrigColumn;
var oSettings = this.s.dt;
/* Sorting */
sValue += '"aaSorting":[ ';
for ( i=0 ; i<oSettings.aaSorting.length ; i++ )
for ( i=0 ; i<oState.aaSorting.length ; i++ )
{
sValue += '['+oSettings.aoColumns[ oSettings.aaSorting[i][0] ]._ColReorder_iOrigCol+
',"'+oSettings.aaSorting[i][1]+'"],';
oState.aaSorting[i][0] = oSettings.aoColumns[ oState.aaSorting[i][0] ]._ColReorder_iOrigCol;
}
sValue = sValue.substring(0, sValue.length-1);
sValue += "],";
/* Column filter */
aSearchCopy = $.extend( true, [], oState.aoSearchCols );
oState.ColReorder = [];
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{
a[ oSettings.aoColumns[i]._ColReorder_iOrigCol ] = {
"sSearch": encodeURIComponent(oSettings.aoPreSearchCols[i].sSearch),
"bRegex": !oSettings.aoPreSearchCols[i].bRegex
};
}
iOrigColumn = oSettings.aoColumns[i]._ColReorder_iOrigCol;
/* Column filter */
oState.aoSearchCols[ iOrigColumn ] = aSearchCopy[i];
/* Visibility */
oState.abVisCols[ iOrigColumn ] = oSettings.aoColumns[i].bVisible;
sValue += '"aaSearchCols":[ ';
for ( i=0 ; i<a.length ; i++ )
{
sValue += '["'+a[i].sSearch+'",'+a[i].bRegex+'],';
/* Column reordering */
oState.ColReorder.push( iOrigColumn );
}
sValue = sValue.substring(0, sValue.length-1);
sValue += "],";
/* Visibility */
a = [];
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{
a[ oSettings.aoColumns[i]._ColReorder_iOrigCol ] = oSettings.aoColumns[i].bVisible;
}
sValue += '"abVisCols":[ ';
for ( i=0 ; i<a.length ; i++ )
{
sValue += a[i]+",";
}
sValue = sValue.substring(0, sValue.length-1);
sValue += "],";
/* Column reordering */
a = [];
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) {
a.push( oSettings.aoColumns[i]._ColReorder_iOrigCol );
}
sValue += '"ColReorder":['+a.join(',')+']';
return sValue;
},
@@ -774,6 +774,11 @@ ColReorder.prototype = {
this.s.dt.oInstance.fnAdjustColumnSizing();
}
if ( this.s.dropCallback !== null )
{
this.s.dropCallback.call( this );
}
/* Save the state */
this.s.dt.oInstance.oApi._fnSaveState( this.s.dt );
}
@@ -793,6 +798,10 @@ ColReorder.prototype = {
this.dom.drag = $(this.s.dt.nTHead.parentNode).clone(true)[0];
this.dom.drag.className += " DTCR_clonedTable";
while ( this.dom.drag.getElementsByTagName('caption').length > 0 )
{
this.dom.drag.removeChild( this.dom.drag.getElementsByTagName('caption')[0] );
}
while ( this.dom.drag.getElementsByTagName('tbody').length > 0 )
{
this.dom.drag.removeChild( this.dom.drag.getElementsByTagName('tbody')[0] );
@@ -903,9 +912,9 @@ ColReorder.prototype.CLASS = "ColReorder";
* ColReorder version
* @constant VERSION
* @type String
* @default 1.0.2
* @default As code
*/
ColReorder.VERSION = "1.0.2";
ColReorder.VERSION = "1.0.5";
ColReorder.prototype.VERSION = ColReorder.VERSION;
@@ -921,7 +930,7 @@ ColReorder.prototype.VERSION = ColReorder.VERSION;
*/
if ( typeof $.fn.dataTable == "function" &&
typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
$.fn.dataTableExt.fnVersionCheck('1.8.0') )
$.fn.dataTableExt.fnVersionCheck('1.9.0') )
{
$.fn.dataTableExt.aoFeatures.push( {
"fnInit": function( oDTSettings ) {
@@ -942,7 +951,7 @@ if ( typeof $.fn.dataTable == "function" &&
}
else
{
alert( "Warning: ColReorder requires DataTables 1.8.0 or greater - www.datatables.net/download");
alert( "Warning: ColReorder requires DataTables 1.9.0 or greater - www.datatables.net/download");
}
})(jQuery, window, document);

View File

@@ -1,6 +1,6 @@
/*
* File: ColReorder.min.js
* Version: 1.0.2
* Version: 1.0.5
* Author: Allan Jardine (www.sprymedia.co.uk)
*
* Copyright 2010-2011 Allan Jardine, all rights reserved.
@@ -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 l(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 m(a,c,d){for(var b=[],e=0,h=a.childNodes.length;e<h;e++)a.childNodes[e].nodeType==1&&b.push(a.childNodes[e]);c=b[c];d!==null?a.insertBefore(c,b[d]):a.appendChild(c)}f.fn.dataTableExt.oApi.fnColReorder=function(a,c,d){var b,e,h=a.aoColumns.length,g;if(c!=d)if(c<0||c>=h)this.oApi._fnLog(a,1,"ColReorder 'from' index is out of bounds: "+c);else if(d<0||d>=
h)this.oApi._fnLog(a,1,"ColReorder 'to' index is out of bounds: "+d);else{g=[];b=0;for(e=h;b<e;b++)g[b]=b;j(g,c,d);g=l(g);b=0;for(e=a.aaSorting.length;b<e;b++)a.aaSorting[b][0]=g[a.aaSorting[b][0]];if(a.aaSortingFixed!==null){b=0;for(e=a.aaSortingFixed.length;b<e;b++)a.aaSortingFixed[b][0]=g[a.aaSortingFixed[b][0]]}b=0;for(e=h;b<e;b++)a.aoColumns[b].iDataSort=g[a.aoColumns[b].iDataSort];if(a.aoColumns[c].bVisible){var n=this.oApi._fnColumnIndexToVisible(a,c),k=null;for(b=d<c?d:d+1;k===null&&b<h;){k=
this.oApi._fnColumnIndexToVisible(a,b);b++}g=a.nTHead.getElementsByTagName("tr");b=0;for(e=g.length;b<e;b++)m(g[b],n,k);if(a.nTFoot!==null){g=a.nTFoot.getElementsByTagName("tr");b=0;for(e=g.length;b<e;b++)m(g[b],n,k)}b=0;for(e=a.aoData.length;b<e;b++)m(a.aoData[b].nTr,n,k)}j(a.aoColumns,c,d);j(a.aoPreSearchCols,c,d);b=0;for(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)}b=0;for(e=a.aoHeader.length;b<e;b++)j(a.aoHeader[b],c,d);if(a.aoFooter!==
null){b=0;for(e=a.aoFooter.length;b<e;b++)j(a.aoFooter[b],c,d)}b=0;for(e=h;b<e;b++){f(a.aoColumns[b].nTh).unbind("click");this.oApi._fnSortAttachListener(a,a.aoColumns[b].nTh,b)}typeof ColVis!="undefined"&&ColVis.fnRebuild(a.oInstance);typeof a.oInstance._oPluginFixedHeader!="undefined"&&a.oInstance._oPluginFixedHeader.fnUpdate()}};ColReorder=function(a,c){if(!this.CLASS||this.CLASS!="ColReorder")alert("Warning: ColReorder must be initialised with the keyword 'new'");if(typeof c=="undefined")c={};
this.s={dt:null,init:c,fixed:0,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(typeof this.s.init.iFixedColumns!=
"undefined")this.s.fixed=this.s.init.iFixedColumns;c=0;for(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.aoStateSave.push({fn:function(h,g){return a._fnStateSave.call(a,g)},sName:"ColReorder_State"});var b=null;if(typeof this.s.init.aiOrder!="undefined")b=this.s.init.aiOrder.slice();if(this.s.dt.oLoadedState&&typeof this.s.dt.oLoadedState.ColReorder!="undefined"&&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=l(b);a._fnOrderColumns.call(a,c)}else{var e=false;this.s.dt.aoDrawCallback.push({fn:function(){if(!a.s.dt._bInitComplete&&!e){e=true;var h=l(b);a._fnOrderColumns.call(a,h)}},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);if(c!=b){j(a,b,c);this.s.dt.oInstance.fnColReorder(b,c)}}if(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=a.split('"aaSorting"')[0],b=[],e=this.s.dt;d+='"aaSorting":[ ';for(a=0;a<e.aaSorting.length;a++)d+="["+e.aoColumns[e.aaSorting[a][0]]._ColReorder_iOrigCol+',"'+e.aaSorting[a][1]+'"],';d=d.substring(0,d.length-1);d+="],";
a=0;for(c=e.aoColumns.length;a<c;a++)b[e.aoColumns[a]._ColReorder_iOrigCol]={sSearch:encodeURIComponent(e.aoPreSearchCols[a].sSearch),bRegex:!e.aoPreSearchCols[a].bRegex};d+='"aaSearchCols":[ ';for(a=0;a<b.length;a++)d+='["'+b[a].sSearch+'",'+b[a].bRegex+"],";d=d.substring(0,d.length-1);d+="],";b=[];a=0;for(c=e.aoColumns.length;a<c;a++)b[e.aoColumns[a]._ColReorder_iOrigCol]=e.aoColumns[a].bVisible;d+='"abVisCols":[ ';for(a=0;a<b.length;a++)d+=b[a]+",";d=d.substring(0,d.length-1);d+="],";b=[];a=0;
for(c=e.aoColumns.length;a<c;a++)b.push(e.aoColumns[a]._ColReorder_iOrigCol);d+='"ColReorder":['+b.join(",")+"]";return d},_fnMouseListener:function(a,c){var d=this;f(c).bind("mousedown.ColReorder",function(b){d._fnMouseDown.call(d,b,c);return false})},_fnMouseDown:function(a,c){var d=this,b=this.s.dt.aoColumns,e=a.target.nodeName=="TH"?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});c=a=0;for(e=b.length;c<e;c++){c!=this.s.mouse.fromIndex&&a++;b[c].bVisible&&this.s.aoTargets.push({x:f(b[c].nTh).offset().left+f(b[c].nTh).outerWidth(),to:a})}this.s.fixed!==0&&this.s.aoTargets.splice(0,
this.s.fixed);f(i).bind("mousemove.ColReorder",function(h){d._fnMouseMove.call(d,h)});f(i).bind("mouseup.ColReorder",function(h){d._fnMouseUp.call(d,h)})},_fnMouseMove:function(a){if(this.dom.drag===null){if(Math.pow(Math.pow(a.pageX-this.s.mouse.startX,2)+Math.pow(a.pageY-this.s.mouse.startY,2),0.5)<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=false,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=true;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(this.dom.drag!==null){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);if(this.s.dt.oScroll.sX!==""||this.s.dt.oScroll.sY!=="")this.s.dt.oInstance.fnAdjustColumnSizing();this.s.dt.oInstance.oApi._fnSaveState(this.s.dt)}},_fnCreateDragNode:function(){var a=this;this.dom.drag=f(this.s.dt.nTHead.parentNode).clone(true)[0];for(this.dom.drag.className+=" DTCR_clonedTable";this.dom.drag.getElementsByTagName("tbody").length>
0;)this.dom.drag.removeChild(this.dom.drag.getElementsByTagName("tbody")[0]);for(;this.dom.drag.getElementsByTagName("tfoot").length>0;)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";if(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"}else{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.2";ColReorder.prototype.VERSION=ColReorder.VERSION;typeof f.fn.dataTable=="function"&&typeof f.fn.dataTableExt.fnVersionCheck=="function"&&f.fn.dataTableExt.fnVersionCheck("1.8.0")?f.fn.dataTableExt.aoFeatures.push({fnInit:function(a){var c=a.oInstance;if(typeof c._oPluginColReorder=="undefined")c._oPluginColReorder=new ColReorder(a.oInstance,typeof a.oInit.oColReorder!="undefined"?a.oInit.oColReorder:{});else c.oApi._fnLog(a,1,"ColReorder attempted to initialise twice. Ignoring second");
return null},cFeature:"R",sFeature:"ColReorder"}):alert("Warning: ColReorder requires DataTables 1.8.0 or greater - www.datatables.net/download")})(jQuery,window,document);
(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);

View File

@@ -1,11 +1,11 @@
/*
* File: ColVis.js
* Version: 1.0.5
* CVS: $Id: ColVis.js,v 1.1 2011/08/30 18:32:25 hregis Exp $
* Version: 1.0.7
* CVS: $Id$
* Description: Controls for column visiblity in DataTables
* Author: Allan Jardine (www.sprymedia.co.uk)
* Created: Wed Sep 15 18:23:29 BST 2010
* Modified: $Date: 2011/08/30 18:32:25 $ by $Author: hregis $
* Modified: $Date$ by $Author$
* Language: Javascript
* License: GPL v2 or BSD 3 point style
* Project: Just a little bit of fun :-)
@@ -121,6 +121,22 @@ ColVis = function( oDTSettings, oInit )
*/
"abOriginal": [],
/**
* Show Show-All button
* @property bShowAll
* @type Array
* @default []
*/
"bShowAll": false,
/**
* Show All button text
* @property sShowAll
* @type String
* @default Restore original
*/
"sShowAll": "Show All",
/**
* Show restore button
* @property bRestore
@@ -161,7 +177,16 @@ ColVis = function( oDTSettings, oInit )
* @type String
* @default auto
*/
"sSize": "auto"
"sSize": "auto",
/**
* Indicate if the column list should be positioned by Javascript, visually below the button
* or allow CSS to do the positioning
* @property bCssPosition
* @type boolean
* @default false
*/
"bCssPosition": false
};
@@ -352,6 +377,16 @@ ColVis.prototype = {
this.s.sRestore = oConfig.sRestore;
}
if ( typeof oConfig.bShowAll != 'undefined' )
{
this.s.bShowAll = oConfig.bShowAll;
}
if ( typeof oConfig.sShowAll != 'undefined' )
{
this.s.sShowAll = oConfig.sShowAll;
}
if ( typeof oConfig.sAlign != 'undefined' )
{
this.s.sAlign = oConfig.sAlign;
@@ -371,6 +406,16 @@ ColVis.prototype = {
{
this.s.fnLabel = oConfig.fnLabel;
}
if ( typeof oConfig.sSize != 'undefined' )
{
this.s.sSize = oConfig.sSize;
}
if ( typeof oConfig.bCssPosition != 'undefined' )
{
this.s.bCssPosition = oConfig.bCssPosition;
}
},
@@ -435,6 +480,14 @@ ColVis.prototype = {
this.dom.buttons.push( nButton );
this.dom.collection.appendChild( nButton );
}
if ( this.s.bShowAll )
{
nButton = this._fnDomShowAllButton();
nButton.className += " ColVis_ShowAll";
this.dom.buttons.push( nButton );
this.dom.collection.appendChild( nButton );
}
},
@@ -448,8 +501,8 @@ ColVis.prototype = {
{
var
that = this,
nButton = document.createElement('button'),
nSpan = document.createElement('span');
nButton = document.createElement('button'),
nSpan = document.createElement('span');
nButton.className = !this.s.dt.bJUI ? "ColVis_Button TableTools_Button" :
"ColVis_Button TableTools_Button ui-button ui-state-default";
@@ -461,6 +514,41 @@ ColVis.prototype = {
{
that.s.dt.oInstance.fnSetColumnVis( i, that.s.abOriginal[i], false );
}
that._fnAdjustOpenRows();
that.s.dt.oInstance.fnDraw( false );
} );
return nButton;
},
/**
* Create a button which allows a "show all" action
* @method _fnDomShowAllButton
* @returns {Node} Created button
* @private
*/
"_fnDomShowAllButton": function ()
{
var
that = this,
nButton = document.createElement('button'),
nSpan = document.createElement('span');
nButton.className = !this.s.dt.bJUI ? "ColVis_Button TableTools_Button" :
"ColVis_Button TableTools_Button ui-button ui-state-default";
nButton.appendChild( nSpan );
$(nSpan).html( '<span class="ColVis_title">'+this.s.sShowAll+'</span>' );
$(nButton).click( function (e) {
for ( var i=0, iLen=that.s.abOriginal.length ; i<iLen ; i++ )
{
if (that.s.aiExclude.indexOf(i) === -1)
{
that.s.dt.oInstance.fnSetColumnVis( i, true, false );
}
}
that._fnAdjustOpenRows();
that.s.dt.oInstance.fnDraw( false );
} );
@@ -480,15 +568,16 @@ ColVis.prototype = {
var
that = this,
oColumn = this.s.dt.aoColumns[i],
nButton = document.createElement('button'),
nSpan = document.createElement('span');
nButton = document.createElement('button'),
nSpan = document.createElement('span'),
dt = this.s.dt;
nButton.className = !this.s.dt.bJUI ? "ColVis_Button TableTools_Button" :
nButton.className = !dt.bJUI ? "ColVis_Button TableTools_Button" :
"ColVis_Button TableTools_Button ui-button ui-state-default";
nButton.appendChild( nSpan );
var sTitle = this.s.fnLabel===null ? oColumn.sTitle : this.s.fnLabel( i, oColumn.sTitle, oColumn.nTh );
$(nSpan).html(
'<span class="ColVis_radio"><input type="checkbox"></span>'+
'<span class="ColVis_radio"><input type="checkbox"/></span>'+
'<span class="ColVis_title">'+sTitle+'</span>' );
$(nButton).click( function (e) {
@@ -503,7 +592,19 @@ ColVis.prototype = {
*/
var oldIndex = $.fn.dataTableExt.iApiIndex;
$.fn.dataTableExt.iApiIndex = that._fnDataTablesApiIndex.call(that);
that.s.dt.oInstance.fnSetColumnVis( i, showHide );
// Optimisation for server-side processing when scrolling - don't do a full redraw
if ( dt.oFeatures.bServerSide && (dt.oScroll.sX !== "" || dt.oScroll.sY !== "" ) )
{
that.s.dt.oInstance.fnSetColumnVis( i, showHide, false );
that.s.dt.oInstance.oApi._fnScrollDraw( that.s.dt );
that._fnDrawCallback();
}
else
{
that.s.dt.oInstance.fnSetColumnVis( i, showHide );
}
$.fn.dataTableExt.iApiIndex = oldIndex; /* Restore */
if ( that.s.fnStateChange !== null )
@@ -546,8 +647,8 @@ ColVis.prototype = {
{
var
that = this,
nButton = document.createElement('button'),
nSpan = document.createElement('span'),
nButton = document.createElement('button'),
nSpan = document.createElement('span'),
sEvent = this.s.activate=="mouseover" ? "mouseover" : "click";
nButton.className = !this.s.dt.bJUI ? "ColVis_Button TableTools_Button" :
@@ -577,7 +678,11 @@ ColVis.prototype = {
nHidden.style.display = "none";
nHidden.className = !this.s.dt.bJUI ? "ColVis_collection TableTools_collection" :
"ColVis_collection TableTools_collection ui-buttonset ui-buttonset-multi";
nHidden.style.position = "absolute";
if ( !this.s.bCssPosition )
{
nHidden.style.position = "absolute";
}
$(nHidden).css('opacity', 0);
return nHidden;
@@ -658,8 +763,11 @@ ColVis.prototype = {
var iDivX = parseInt(oPos.left, 10);
var iDivY = parseInt(oPos.top + $(this.dom.button).outerHeight(), 10);
nHidden.style.top = iDivY+"px";
nHidden.style.left = iDivX+"px";
if ( !this.s.bCssPosition )
{
nHidden.style.top = iDivY+"px";
nHidden.style.left = iDivX+"px";
}
nHidden.style.display = "block";
$(nHidden).css('opacity',0);
@@ -686,30 +794,38 @@ ColVis.prototype = {
this.dom.collection.style.width = "auto";
for ( i=0, iLen=this.dom.buttons.length ; i<iLen ; i++ )
{
this.dom.buttons[i].style.width = "auto";
aiSizes.push( $(this.dom.buttons[i]).outerWidth() );
if ( this.dom.buttons[i] !== null )
{
this.dom.buttons[i].style.width = "auto";
aiSizes.push( $(this.dom.buttons[i]).outerWidth() );
}
}
iMax = Math.max.apply(window, aiSizes);
for ( i=0, iLen=this.dom.buttons.length ; i<iLen ; i++ )
{
this.dom.buttons[i].style.width = iMax+"px";
if ( this.dom.buttons[i] !== null )
{
this.dom.buttons[i].style.width = iMax+"px";
}
}
this.dom.collection.style.width = iMax+"px";
}
/* Visual corrections to try and keep the collection visible */
nHidden.style.left = this.s.sAlign=="left" ?
iDivX+"px" : (iDivX-$(nHidden).outerWidth()+$(this.dom.button).outerWidth())+"px";
var iDivWidth = $(nHidden).outerWidth();
var iDivHeight = $(nHidden).outerHeight();
if ( iDivX + iDivWidth > iDocWidth )
if ( !this.s.bCssPosition )
{
nHidden.style.left = (iDocWidth-iDivWidth)+"px";
nHidden.style.left = this.s.sAlign=="left" ?
iDivX+"px" : (iDivX-$(nHidden).outerWidth()+$(this.dom.button).outerWidth())+"px";
var iDivWidth = $(nHidden).outerWidth();
var iDivHeight = $(nHidden).outerHeight();
if ( iDivX + iDivWidth > iDocWidth )
{
nHidden.style.left = (iDocWidth-iDivWidth)+"px";
}
}
/* This results in a very small delay for the end user but it allows the animation to be
* much smoother. If you don't want the animation, then the setTimeout can be removed
*/
@@ -753,6 +869,20 @@ ColVis.prototype = {
document.body.removeChild( that.dom.catcher );
} );
}
},
/**
* Alter the colspan on any fnOpen rows
*/
"_fnAdjustOpenRows": function ()
{
var aoOpen = this.s.dt.aoOpenRows;
var iVisible = this.s.dt.oApi._fnVisbleColumns( this.s.dt );
for ( var i=0, iLen=aoOpen.length ; i<iLen ; i++ ) {
aoOpen[i].nTr.getElementsByTagName('td')[0].colSpan = iVisible;
}
}
};
@@ -826,9 +956,9 @@ ColVis.prototype.CLASS = "ColVis";
* ColVis version
* @constant VERSION
* @type String
* @default 1.0.4.dev
* @default See code
*/
ColVis.VERSION = "1.0.5";
ColVis.VERSION = "1.0.7";
ColVis.prototype.VERSION = ColVis.VERSION;

View File

@@ -1,6 +1,6 @@
/*
* File: ColVis.min.js
* Version: 1.0.5
* Version: 1.0.7
* Author: Allan Jardine (www.sprymedia.co.uk)
*
* Copyright 2010-2011 Allan Jardine, all rights reserved.
@@ -12,19 +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(d){ColVis=function(a,b){if(!this.CLASS||this.CLASS!="ColVis")alert("Warning: ColVis must be initialised with the keyword 'new'");if(typeof b=="undefined")b={};this.s={dt:null,oInit:b,fnStateChange:null,activate:"click",sAlign:"left",buttonText:"Show / hide columns",hidden:true,aiExclude:[],abOriginal:[],bRestore:false,sRestore:"Restore original",iOverlayFade:500,fnLabel:null,sSize:"auto"};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;a>=0;a--)this.dom.buttons[a]!==null&&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(typeof a.activate!="undefined")this.s.activate=a.activate;if(typeof a.buttonText!="undefined")this.s.buttonText=a.buttonText;if(typeof a.aiExclude!="undefined")this.s.aiExclude=a.aiExclude;if(typeof a.bRestore!="undefined")this.s.bRestore=a.bRestore;if(typeof a.sRestore!="undefined")this.s.sRestore=a.sRestore;if(typeof a.sAlign!="undefined")this.s.sAlign=a.sAlign;if(typeof a.fnStateChange!="undefined")this.s.fnStateChange=a.fnStateChange;
if(typeof a.iOverlayFade!="undefined")this.s.iOverlayFade=a.iOverlayFade;if(typeof a.fnLabel!="undefined")this.s.fnLabel=a.fnLabel},_fnDrawCallback:function(){for(var a=this.s.dt.aoColumns,b=0,c=a.length;b<c;b++)if(this.dom.buttons[b]!==null)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,e=this.s.dt.aoColumns.length;c<e;c++)if(b.indexOf(","+c+",")==
-1){a=this._fnDomColumnButton(c);this.dom.buttons.push(a);this.dom.collection.appendChild(a)}else this.dom.buttons.push(null);if(this.s.bRestore){a=this._fnDomRestoreButton();a.className+=" ColVis_Restore";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 e=0,f=a.s.abOriginal.length;e<f;e++)a.s.dt.oInstance.fnSetColumnVis(e,a.s.abOriginal[e],false);a.s.dt.oInstance.fnDraw(false)});return b},_fnDomColumnButton:function(a){var b=this,c=this.s.dt.aoColumns[a],e=document.createElement("button"),f=document.createElement("span");e.className=!this.s.dt.bJUI?"ColVis_Button TableTools_Button":"ColVis_Button TableTools_Button ui-button ui-state-default";
e.appendChild(f);c=this.s.fnLabel===null?c.sTitle:this.s.fnLabel(a,c.sTitle,c.nTh);d(f).html('<span class="ColVis_radio"><input type="checkbox"></span><span class="ColVis_title">'+c+"</span>");d(e).click(function(g){var h=!d("input",this).is(":checked");if(g.target.nodeName.toLowerCase()=="input")h=d("input",this).is(":checked");g=d.fn.dataTableExt.iApiIndex;d.fn.dataTableExt.iApiIndex=b._fnDataTablesApiIndex.call(b);b.s.dt.oInstance.fnSetColumnVis(a,h);d.fn.dataTableExt.iApiIndex=g;b.s.fnStateChange!==
null&&b.s.fnStateChange.call(b,a,h)});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"),f=this.s.activate=="mouseover"?"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(f,function(g){b._fnCollectionShow();g.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";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)});this.s.activate=="mouseover"&&d(b).mouseover(function(){a.s.overcollection=false;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,f=this.dom.background,g=parseInt(b.left,10),h=parseInt(b.top+d(this.dom.button).outerHeight(),10);e.style.top=h+"px";e.style.left=g+"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();f.style.height=(c>i?c:i)+"px";f.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=g+
"px";document.body.appendChild(f);document.body.appendChild(e);document.body.appendChild(this.dom.catcher);if(this.s.sSize=="auto"){i=[];this.dom.collection.style.width="auto";b=0;for(c=this.dom.buttons.length;b<c;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++)this.dom.buttons[b].style.width=iMax+"px";this.dom.collection.style.width=iMax+"px"}e.style.left=this.s.sAlign=="left"?g+"px":g-
d(e).outerWidth()+d(this.dom.button).outerWidth()+"px";b=d(e).outerWidth();d(e).outerHeight();if(g+b>h)e.style.left=h-b+"px";setTimeout(function(){d(e).animate({opacity:1},a.s.iOverlayFade);d(f).animate({opacity:0.1},a.s.iOverlayFade,"linear",function(){jQuery.browser.msie&&jQuery.browser.version=="6.0"&&a._fnDrawCallback()})},10);this.s.hidden=false},_fnCollectionHide:function(){var a=this;if(!this.s.hidden&&this.dom.collection!==null){this.s.hidden=true;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)})}}};ColVis.fnRebuild=function(a){var b=null;if(typeof a!="undefined")b=a.fnSettings().nTable;for(var c=0,e=ColVis.aInstances.length;c<e;c++)if(typeof a=="undefined"||b==ColVis.aInstances[c].s.dt.nTable)ColVis.aInstances[c].fnRebuild()};ColVis.aInstances=[];ColVis.prototype.CLASS="ColVis";
ColVis.VERSION="1.0.5";ColVis.prototype.VERSION=ColVis.VERSION;typeof d.fn.dataTable=="function"&&typeof d.fn.dataTableExt.fnVersionCheck=="function"&&d.fn.dataTableExt.fnVersionCheck("1.7.0")?d.fn.dataTableExt.aoFeatures.push({fnInit:function(a){return(new ColVis(a,typeof a.oInit.oColVis=="undefined"?{}:a.oInit.oColVis)).dom.wrapper},cFeature:"C",sFeature:"ColVis"}):alert("Warning: ColVis requires DataTables 1.7 or greater - www.datatables.net/download")})(jQuery);
(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);

View File

@@ -3,29 +3,22 @@
* Description: Styles for TableTools 2
* Author: Allan Jardine (www.sprymedia.co.uk)
* Language: Javascript
* License: LGPL / 3 point BSD
* License: GPL v2 / 3 point BSD
* Project: DataTables
*
* Copyright 2010 Allan Jardine, all rights reserved.
* Copyright 2009-2012 Allan Jardine, all rights reserved.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* CSS name space:
* DTTT DataTables TableTools
*
* Colour dictionary:
* Button border #d0d0d0
* Button border hover #999999
* Hover background #f0f0f0
* Action blue #4b66d9
*
* Style sheet provides:
* CONTAINER TableTools container element and styles applying to all components
* BUTTON_STYLES Action specific button styles
* SELECTING Row selection styles
* COLLECTIONS Drop down list (collection) styles
* PRINTING Print display styles
* MISC Minor misc styles
*/
@@ -34,20 +27,42 @@
* TableTools container element and styles applying to all components
*/
div.DTTT_container {
position: relative;
float: right;
margin-bottom: 1em;
}
button.DTTT_button {
button.DTTT_button,
div.DTTT_button {
position: relative;
float: left;
height: 30px;
margin-right: 3px;
padding: 3px 5px;
border: 1px solid #d0d0d0;
background-color: #fff;
padding: 3px 8px;
border: 1px solid #999;
cursor: pointer;
*cursor: hand;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
-ms-border-radius: 2px;
-o-border-radius: 2px;
border-radius: 2px;
-webkit-box-shadow: 1px 1px 3px #ccc;
-moz-box-shadow: 1px 1px 3px #ccc;
-ms-box-shadow: 1px 1px 3px #ccc;
-o-box-shadow: 1px 1px 3px #ccc;
box-shadow: 1px 1px 3px #ccc;
/* Generated by http://www.colorzilla.com/gradient-editor/ */
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 */
}
button.DTTT_button::-moz-focus-inner {
@@ -55,87 +70,90 @@ button.DTTT_button::-moz-focus-inner {
padding: 0;
}
/* This would of course be better with :hover, but for Flash interaction... */
button.DTTT_button_hover,
div.DTTT_button_hover {
border: 1px solid #666;
-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;
background: #f3f3f3; /* Old browsers */
background: -webkit-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* Chrome10+,Safari5.1+ */
background: -moz-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* FF3.6+ */
background: -ms-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* IE10+ */
background: -o-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* Opera 11.10+ */
background: linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f3f3f3', endColorstr='#f4f4f4',GradientType=0 ); /* IE6-9 */
}
button.DTTT_disabled,
div.DTTT_disabled {
color: #999;
border: 1px solid #d0d0d0;
background: #ffffff; /* Old browsers */
background: -webkit-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* Chrome10+,Safari5.1+ */
background: -moz-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* FF3.6+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* IE10+ */
background: -o-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* Opera 11.10+ */
background: linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#fafafa',GradientType=0 ); /* IE6-9 */
}
/*
* BUTTON_STYLES
* Action specific button styles
* If you want images - comment this back in
button.DTTT_button_csv,
button.DTTT_button_xls,
button.DTTT_button_copy,
button.DTTT_button_pdf,
button.DTTT_button_print {
padding-right: 0px;
}
button.DTTT_button_csv span,
button.DTTT_button_xls span,
button.DTTT_button_copy span,
button.DTTT_button_pdf span,
button.DTTT_button_print span {
display: inline-block;
height: 24px;
line-height: 24px;
padding-right: 30px;
}
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_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_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_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_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_csv {
padding-right: 30px;
background: url(../images/csv.png) no-repeat center right;
}
button.DTTT_button_csv_hover {
padding-right: 30px;
border: 1px solid #999;
background: #f0f0f0 url(../images/csv_hover.png) no-repeat center right;
}
button.DTTT_button_xls {
padding-right: 30px;
background: url(../images/xls.png) no-repeat center right;
}
button.DTTT_button_xls_hover {
padding-right: 30px;
border: 1px solid #999;
background: #f0f0f0 url(../images/xls_hover.png) no-repeat center right;
}
button.DTTT_button_copy {
padding-right: 30px;
background: url(../images/copy.png) no-repeat center right;
}
button.DTTT_button_copy_hover {
padding-right: 30px;
border: 1px solid #999;
background: #f0f0f0 url(../images/copy_hover.png) no-repeat center right;
}
button.DTTT_button_pdf {
padding-right: 30px;
background: url(../images/pdf.png) no-repeat center right;
}
button.DTTT_button_pdf_hover {
padding-right: 30px;
border: 1px solid #999;
background: #f0f0f0 url(../images/pdf_hover.png) no-repeat center right;
}
button.DTTT_button_print {
padding-right: 30px;
background: url(../images/print.png) no-repeat center right;
}
button.DTTT_button_print_hover {
padding-right: 30px;
border: 1px solid #999;
background: #f0f0f0 url(../images/print_hover.png) no-repeat center right;
}
button.DTTT_button_text {
}
button.DTTT_button_text_hover {
border: 1px solid #999;
background-color: #f0f0f0;
}
button.DTTT_button_collection {
button.DTTT_button_collection span {
padding-right: 17px;
background: url(../images/collection.png) no-repeat center right;
}
button.DTTT_button_collection_hover {
button.DTTT_button_collection_hover span {
padding-right: 17px;
border: 1px solid #999;
background: #f0f0f0 url(../images/collection_hover.png) no-repeat center right;
@@ -151,36 +169,36 @@ table.DTTT_selectable tbody tr {
*cursor: hand;
}
tr.DTTT_selected.odd {
table.dataTable tr.DTTT_selected.odd {
background-color: #9FAFD1;
}
tr.DTTT_selected.odd td.sorting_1 {
table.dataTable tr.DTTT_selected.odd td.sorting_1 {
background-color: #9FAFD1;
}
tr.DTTT_selected.odd td.sorting_2 {
table.dataTable tr.DTTT_selected.odd td.sorting_2 {
background-color: #9FAFD1;
}
tr.DTTT_selected.odd td.sorting_3 {
table.dataTable tr.DTTT_selected.odd td.sorting_3 {
background-color: #9FAFD1;
}
tr.DTTT_selected.even {
table.dataTable tr.DTTT_selected.even {
background-color: #B0BED9;
}
tr.DTTT_selected.even td.sorting_1 {
table.dataTable tr.DTTT_selected.even td.sorting_1 {
background-color: #B0BED9;
}
tr.DTTT_selected.even td.sorting_2 {
table.dataTable tr.DTTT_selected.even td.sorting_2 {
background-color: #B0BED9;
}
tr.DTTT_selected.even td.sorting_3 {
table.dataTable tr.DTTT_selected.even td.sorting_3 {
background-color: #B0BED9;
}
@@ -232,13 +250,17 @@ div.DTTT_collection button.DTTT_button {
opacity: 0.9;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
-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);
}
.DTTT_print_info h6 {
@@ -253,12 +275,3 @@ div.DTTT_collection button.DTTT_button {
line-height: 20px;
}
/*
* MISC
* Minor misc styles
*/
.DTTT_disabled {
color: #999;
}

View File

@@ -37,6 +37,7 @@
* TableTools container element and styles applying to all components
*/
div.DTTT_container {
position: relative;
float: left;
}
@@ -68,36 +69,36 @@ table.DTTT_selectable tbody tr {
*cursor: hand;
}
tr.DTTT_selected.odd {
table.dataTable tr.DTTT_selected.odd {
background-color: #9FAFD1;
}
tr.DTTT_selected.odd td.sorting_1 {
table.dataTable tr.DTTT_selected.odd td.sorting_1 {
background-color: #9FAFD1;
}
tr.DTTT_selected.odd td.sorting_2 {
table.dataTable tr.DTTT_selected.odd td.sorting_2 {
background-color: #9FAFD1;
}
tr.DTTT_selected.odd td.sorting_3 {
table.dataTable tr.DTTT_selected.odd td.sorting_3 {
background-color: #9FAFD1;
}
tr.DTTT_selected.even {
table.dataTable tr.DTTT_selected.even {
background-color: #B0BED9;
}
tr.DTTT_selected.even td.sorting_1 {
table.dataTable tr.DTTT_selected.even td.sorting_1 {
background-color: #B0BED9;
}
tr.DTTT_selected.even td.sorting_2 {
table.dataTable tr.DTTT_selected.even td.sorting_2 {
background-color: #B0BED9;
}
tr.DTTT_selected.even td.sorting_3 {
table.dataTable tr.DTTT_selected.even td.sorting_3 {
background-color: #B0BED9;
}

View File

@@ -1,23 +1,23 @@
// Simple Set Clipboard System
// Author: Joseph Huckaby
var ZeroClipboard={version:"1.0.4-TableTools2",clients:{},moviePath:"",nextId:1,$:function(a){if(typeof a=="string")a=document.getElementById(a);if(!a.addClass){a.hide=function(){this.style.display="none"};a.show=function(){this.style.display=""};a.addClass=function(b){this.removeClass(b);this.className+=" "+b};a.removeClass=function(b){this.className=this.className.replace(new RegExp("\\s*"+b+"\\s*")," ").replace(/^\s+/,"").replace(/\s+$/,"")};a.hasClass=function(b){return!!this.className.match(new RegExp("\\s*"+
b+"\\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},
Client:function(a){this.handlers={};this.id=ZeroClipboard.nextId++;this.movieId="ZeroClipboardMovie_"+this.id;ZeroClipboard.register(this.id,this);a&&this.glue(a)}};
ZeroClipboard.Client.prototype={id:0,ready:false,movie:null,clipText:"",fileName:"",action:"copy",handCursorEnabled:true,cssEffects:true,handlers:null,sized:false,glue:function(a,b){this.domElement=ZeroClipboard.$(a);a=99;if(this.domElement.style.zIndex)a=parseInt(this.domElement.style.zIndex)+1;var c=ZeroClipboard.getDOMObjectPosition(this.domElement);this.div=document.createElement("div");var d=this.div.style;d.position="absolute";d.left=this.domElement.offsetLeft+"px";d.top=this.domElement.offsetTop+
"px";d.width=c.width+"px";d.height=c.height+"px";d.zIndex=a;if(typeof b!="undefined"&&b!="")this.div.title=b;if(c.width!=0&&c.height!=0)this.sized=true;this.domElement.parentNode.appendChild(this.div);this.div.innerHTML=this.getHTML(c.width,c.height)},positionElement:function(){var a=ZeroClipboard.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(a.width!=
0&&a.height!=0)this.sized=true;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 f=location.href.match(/^https/i)?"https://":"http://";c+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+f+'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.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.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.$(a))||this.hide();if(this.domElement&&this.div){a=ZeroClipboard.getDOMObjectPosition(this.domElement);var 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=true;return}this.ready=true;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=false;if(this.domElement.hasClass("active")){this.domElement.removeClass("active");this.recoverActive=true}}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=
false}break}if(this.handlers[a])for(var d=0,f=this.handlers[a].length;d<f;d++){var e=this.handlers[a][d];if(typeof e=="function")e(this,b);else if(typeof e=="object"&&e.length==2)e[0][e[1]](this,b);else typeof e=="string"&&window[e](this,b)}}};
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},
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)}}};
/*
* File: TableTools.min.js
* Version: 2.0.1
* Version: 2.0.3
* Author: Allan Jardine (www.sprymedia.co.uk)
*
* Copyright 2009-2011 Allan Jardine, all rights reserved.
@@ -30,49 +30,52 @@ false}break}if(this.handlers[a])for(var d=0,f=this.handlers[a].length;d<f;d++){v
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*/
var TableTools;
(function(e,n,j){TableTools=function(a,b){if(!this.CLASS||this.CLASS!="TableTools")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:false,selectedClass:""},custom:{},swfPath:"",buttonSet:[],master:false};this.dom={container:null,table:null,print:{hidden:[],message:null},collection:{collection:null,
background:null}};this.fnSettings=function(){return this.s};if(typeof b=="undefined")b={};this.s.dt=a.fnSettings();this._fnConstruct(b);return this};TableTools.prototype={fnGetSelected:function(){return this._fnGetMasterSettings().select.selected},fnIsSelected:function(a){for(var b=this.fnGetSelected(),c=0,d=b.length;c<d;c++)if(a==b[c])return true;return false},fnSelectAll:function(){this._fnGetMasterSettings().that._fnRowSelectAll()},fnSelectNone:function(){this._fnGetMasterSettings().that._fnRowDeselectAll()},
fnGetTitle:function(a){var b="";if(typeof a.sTitle!="undefined"&&a.sTitle!=="")b=a.sTitle;else{a=j.getElementsByTagName("title");if(a.length>0)b=a[0].innerHTML}return"\u00a1".toString().length<4?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);var c=[],d=0,f=0,h,g;h=0;for(g=a.length;h<g;h++)if(a[h]){d=b[h].nTh.offsetWidth;f+=d;c.push(d)}h=0;for(g=c.length;h<
g;h++)c[h]/=f;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.clients)if(a){var b=ZeroClipboard.clients[a];typeof b.domElement!="undefined"&&b.domElement.parentNode==this.dom.container&&b.positionElement()}},fnResizeRequired:function(){for(var a in ZeroClipboard.clients)if(a){var b=ZeroClipboard.clients[a];if(typeof b.domElement!="undefined"&&b.domElement.parentNode==
this.dom.container&&b.sized===false)return true}return false},_fnConstruct:function(a){this._fnCustomiseSettings(a);this.dom.container=j.createElement("div");this.dom.container.style.position="relative";this.dom.container.className=!this.s.dt.bJUI?"DTTT_container":"DTTT_container ui-buttonset ui-buttonset-multi";this.s.select.type!="none"&&this._fnRowSelectConfig();this._fnButtonDefinations(this.s.buttonSet,this.dom.container)},_fnCustomiseSettings:function(a){if(typeof this.s.dt._TableToolsInit==
"undefined"){this.s.master=true;this.s.dt._TableToolsInit=true}this.dom.table=this.s.dt.nTable;this.s.custom=e.extend({},TableTools.DEFAULTS,a);this.s.swfPath=this.s.custom.sSwfPath;if(typeof ZeroClipboard!="undefined")ZeroClipboard.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,f=a.length;d<f;d++){if(typeof a[d]=="string"){if(typeof TableTools.BUTTONS[a[d]]=="undefined"){alert("TableTools: Warning - unknown button type: "+a[d]);continue}c=e.extend({},TableTools.BUTTONS[a[d]],true)}else{if(typeof TableTools.BUTTONS[a[d].sExtends]=="undefined"){alert("TableTools: Warning - unknown button type: "+a[d].sExtends);continue}c=e.extend({},TableTools.BUTTONS[a[d].sExtends],true);c=e.extend(c,
a[d],true)}if(this.s.dt.bJUI){c.sButtonClass+=" ui-button ui-state-default";c.sButtonClassHover+=" ui-button ui-state-default ui-state-hover"}b.appendChild(this._fnCreateButton(c))}},_fnCreateButton:function(a){var b=this._fnButtonBase(a);if(a.sAction=="print")this._fnPrintConfig(b,a);else if(a.sAction.match(/flash/))this._fnFlashConfig(b,a);else if(a.sAction=="text")this._fnTextConfig(b,a);else if(a.sAction=="collection"){this._fnTextConfig(b,a);this._fnCollectionConfig(b,a)}return b},_fnButtonBase:function(a){var b=
j.createElement("button"),c=j.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},_fnGetMasterSettings:function(){if(this.s.master)return this.s;else 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){a=j.createElement("div");
a.style.display="none";a.className=!this.s.dt.bJUI?"DTTT_collection":"DTTT_collection ui-buttonset ui-buttonset-multi";b._collection=a;this._fnButtonDefinations(b.aButtons,a)},_fnCollectionShow:function(a,b){var c=this,d=e(a).offset(),f=b._collection;b=d.left;d=d.top+e(a).outerHeight();var h=e(n).height(),g=e(j).height(),k=e(n).width(),m=e(j).width();f.style.position="absolute";f.style.left=b+"px";f.style.top=d+"px";f.style.display="block";e(f).css("opacity",0);var l=j.createElement("div");l.style.position=
"absolute";l.style.left="0px";l.style.top="0px";l.style.height=(h>g?h:g)+"px";l.style.width=(k>m?k:m)+"px";l.className="DTTT_collection_background";e(l).css("opacity",0);j.body.appendChild(l);j.body.appendChild(f);h=e(f).outerWidth();k=e(f).outerHeight();if(b+h>m)f.style.left=m-h+"px";if(d+k>g)f.style.top=d-k-e(a).outerHeight()+"px";this.dom.collection.collection=f;this.dom.collection.background=l;setTimeout(function(){e(f).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(!(b!==null&&b.sExtends=="collection"))if(this.dom.collection.collection!==null){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,b,c,d=this.s.dt.aoOpenRows;e(a.s.dt.nTable).addClass("DTTT_selectable");
e("tr",a.s.dt.nTBody).live("click",function(f){if(this.parentNode==a.s.dt.nTBody){b=0;for(c=d.length;b<c;b++)if(this==d[b].nTr)return;a.s.select.preRowSelect!==null&&!a.s.select.preRowSelect.call(a,f)||(a.s.select.type=="single"?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){if(this.s.master)if(!e("td",a).hasClass(this.s.dt.oClasses.sRowEmpty)){if(e(a).hasClass(this.s.select.selectedClass))this._fnRowDeselect(a);
else{this.s.select.selected.length!==0&&this._fnRowDeselectAll();this.s.select.selected.push(a);e(a).addClass(this.s.select.selectedClass);this.s.select.postSelected!==null&&this.s.select.postSelected.call(this,a)}TableTools._fnEventDispatch(this,"select",a)}},_fnRowSelectMulti:function(a){if(this.s.master)if(!e("td",a).hasClass(this.s.dt.oClasses.sRowEmpty)){if(e(a).hasClass(this.s.select.selectedClass))this._fnRowDeselect(a);else{this.s.select.selected.push(a);e(a).addClass(this.s.select.selectedClass);
this.s.select.postSelected!==null&&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;if(!e(a).hasClass(this.s.select.selectedClass)){this.s.select.selected.push(a);e(a).addClass(this.s.select.selectedClass)}}this.s.select.all=true;TableTools._fnEventDispatch(this,"select",null)}},_fnRowDeselectAll:function(){if(this.s.master){for(var a=
this.s.select.selected.length-1;a>=0;a--)this._fnRowDeselect(a);this.s.select.all=false;TableTools._fnEventDispatch(this,"select",null)}},_fnRowDeselect:function(a){if(typeof a.nodeName!="undefined")a=e.inArray(a,this.s.select.selected);var b=this.s.select.selected[a];e(b).removeClass(this.s.select.selectedClass);this.s.select.selected.splice(a,1);this.s.select.postDeselected!==null&&this.s.select.postDeselected.call(this,b);this.s.select.all=false},_fnTextConfig:function(a,b){var c=this;b.fnInit!==
null&&b.fnInit.call(this,a,b);if(b.sToolTip!=="")a.title=b.sToolTip;e(a).hover(function(){e(a).removeClass(b.sButtonClass).addClass(b.sButtonClassHover);b.fnMouseover!==null&&b.fnMouseover.call(this,a,b,null)},function(){e(a).removeClass(b.sButtonClassHover).addClass(b.sButtonClass);b.fnMouseout!==null&&b.fnMouseout.call(this,a,b,null)});b.fnSelect!==null&&TableTools._fnEventListen(this,"select",function(d){b.fnSelect.call(c,a,b,d)});e(a).click(function(d){d.preventDefault();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.Client;b.fnInit!==null&&b.fnInit.call(this,a,b);d.setHandCursor(true);if(b.sAction=="flash_save"){d.setAction("save");d.setCharSet(b.sCharSet=="utf16le"?"UTF16LE":"UTF8");d.setBomInc(b.bBomInc);d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))}else if(b.sAction=="flash_pdf"){d.setAction("pdf");d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))}else d.setAction("copy");
d.addEventListener("mouseOver",function(){e(a).removeClass(b.sButtonClass).addClass(b.sButtonClassHover);b.fnMouseover!==null&&b.fnMouseover.call(c,a,b,d)});d.addEventListener("mouseOut",function(){e(a).removeClass(b.sButtonClassHover).addClass(b.sButtonClass);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(f,h){b.fnComplete!==null&&b.fnComplete.call(c,a,b,d,h);c._fnCollectionHide(a,
b)});this._fnFlashGlue(d,a,b.sToolTip)},_fnFlashGlue:function(a,b,c){var d=this,f=b.getAttribute("id");if(j.getElementById(f)){a.glue(b,c);if(a.domElement.parentNode!=a.div.parentNode&&typeof d.__bZCWarning=="undefined"){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=true}}else setTimeout(function(){d._fnFlashGlue(a,b,c)},100)},_fnFlashSetText:function(a,
b){b=this._fnChunkData(b,8192);a.clearText();for(var c=0,d=b.length;c<d;c++)a.appendText(b[c])},_fnColumnTargets:function(a){var b=[],c=this.s.dt;if(typeof a=="object"){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(false);i=0;for(iLen=a.length;i<iLen;i++)b[a[i]]=true}else if(a=="visible"){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?true:false)}else if(a=="hidden"){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?false:true)}else{i=0;for(iLen=
c.aoColumns.length;i<iLen;i++)b.push(true)}return b},_fnNewline:function(a){return a.sNewLine=="auto"?navigator.userAgent.match(/Windows/)?"\r\n":"\n":a.sNewLine},_fnGetDataTablesData:function(a){var b,c,d,f,h="",g="",k=this.s.dt,m=new RegExp(a.sFieldBoundary,"g"),l=this._fnColumnTargets(a.mColumns),o=this._fnNewline(a);if(a.bHeader){b=0;for(c=k.aoColumns.length;b<c;b++)if(l[b]){g=k.aoColumns[b].sTitle.replace(/\n/g," ").replace(/<.*?>/g,"");g=this._fnHtmlDecode(g);h+=this._fnBoundData(g,a.sFieldBoundary,
m)+a.sFieldSeperator}h=h.slice(0,a.sFieldSeperator.length*-1);h+=o}d=0;for(f=k.aiDisplay.length;d<f;d++)if(!(typeof a.bSelectedOnly&&a.bSelectedOnly&&!e(k.aoData[k.aiDisplay[d]].nTr).hasClass(this.s.select.selectedClass))){b=0;for(c=k.aoColumns.length;b<c;b++)if(l[b]){g=k.aoData[k.aiDisplay[d]]._aData[b];if(typeof g=="string"){g=g.replace(/\n/g," ");g=g.replace(/<img.*?\s+alt\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+)).*?>/gi,"$1$2$3");g=g.replace(/<.*?>/g,"")}else g=g+"";g=g.replace(/^\s+/,"").replace(/\s+$/,
"");g=this._fnHtmlDecode(g);h+=this._fnBoundData(g,a.sFieldBoundary,m)+a.sFieldSeperator}h=h.slice(0,a.sFieldSeperator.length*-1);h+=o}h.slice(0,-1);if(a.bFooter){b=0;for(c=k.aoColumns.length;b<c;b++)if(l[b]&&k.aoColumns[b].nTf!==null){g=k.aoColumns[b].nTf.innerHTML.replace(/\n/g," ").replace(/<.*?>/g,"");g=this._fnHtmlDecode(g);h+=this._fnBoundData(g,a.sFieldBoundary,m)+a.sFieldSeperator}h=h.slice(0,a.sFieldSeperator.length*-1)}return _sLastData=h},_fnBoundData:function(a,b,c){return b===""?a:b+
a.replace(c,"\\"+b)+b},_fnChunkData:function(a,b){for(var c=[],d=a.length,f=0;f<d;f+=b)f+b<d?c.push(a.substring(f,f+b)):c.push(a.substring(f,d));return c},_fnHtmlDecode:function(a){if(a.indexOf("&")==-1)return a;a=this._fnChunkData(a,2048);var b=j.createElement("div"),c,d,f,h="";c=0;for(d=a.length;c<d;c++){f=a[c].lastIndexOf("&");if(f!=-1&&a[c].length>=8&&f>a[c].length-8){a[c].substr(f);a[c]=a[c].substr(0,f)}b.innerHTML=a[c];h+=b.childNodes[0].nodeValue}return h},_fnPrintConfig:function(a,b){var c=
this;b.fnInit!==null&&b.fnInit.call(this,a,b);e(a).hover(function(){e(a).removeClass(b.sButtonClass).addClass(b.sButtonClassHover)},function(){e(a).removeClass(b.sButtonClassHover).addClass(b.sButtonClass)});b.fnSelect!==null&&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);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)})},
_fnPrintStart:function(a,b){var c=this;a=this.s.dt;this._fnPrintHideNodes(a.nTable);this.s.print.saveStart=a._iDisplayStart;this.s.print.saveLength=a._iDisplayLength;if(b.bShowAll){a._iDisplayStart=0;a._iDisplayLength=-1;a.oApi._fnCalculateEnd(a);a.oApi._fnDraw(a)}if(a.oScroll.sX!==""||a.oScroll.sY!=="")this._fnPrintScrollStart(a);a=a.aanFeatures;for(var d in a)if(d!="i"&&d!="t"&&d.length==1)for(var f=0,h=a[d].length;f<h;f++){this.dom.print.hidden.push({node:a[d][f],display:"block"});a[d][f].style.display=
"none"}e(j.body).addClass("DTTT_Print");if(b.sInfo!==""){var g=j.createElement("div");g.className="DTTT_print_info";g.innerHTML=b.sInfo;j.body.appendChild(g);setTimeout(function(){e(g).fadeOut("normal",function(){j.body.removeChild(g)})},2E3)}if(b.sMessage!==""){this.dom.print.message=j.createElement("div");this.dom.print.message.className="DTTT_PrintMessage";this.dom.print.message.innerHTML=b.sMessage;j.body.insertBefore(this.dom.print.message,j.body.childNodes[0])}this.s.print.saveScroll=e(n).scrollTop();
n.scrollTo(0,0);this.s.print.funcEnd=function(k){c._fnPrintEnd.call(c,k)};e(j).bind("keydown",null,this.s.print.funcEnd)},_fnPrintEnd:function(a){if(a.keyCode==27){a.preventDefault();a=this.s.dt;var b=this.s.print,c=this.dom.print;this._fnPrintShowNodes();if(a.oScroll.sX!==""||a.oScroll.sY!=="")this._fnPrintScrollEnd();n.scrollTo(0,b.saveScroll);if(c.message!==null){j.body.removeChild(c.message);c.message=null}e(j.body).removeClass("DTTT_Print");a._iDisplayStart=b.saveStart;a._iDisplayLength=b.saveLength;
a.oApi._fnCalculateEnd(a);a.oApi._fnDraw(a);e(j).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");c.length>0&&a.nTable.removeChild(c[0]);if(a.nTFoot!==null){c=a.nTable.getElementsByTagName("tfoot");c.length>0&&a.nTable.removeChild(c[0])}c=a.nTHead.cloneNode(true);a.nTable.insertBefore(c,a.nTable.childNodes[0]);
if(a.nTFoot!==null){c=a.nTFoot.cloneNode(true);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,f=0,h=d.length;f<h;f++)if(d[f]!=a&&d[f].nodeType==1){var g=e(d[f]).css("display");if(g!="none"){b.push({node:d[f],display:g});d[f].style.display="none"}}c.nodeName!="BODY"&&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].s);return a};TableTools.fnGetInstance=function(a){if(typeof a!="object")a=j.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,f=0,h=d.length;f<h;f++)a.dom.table==d[f].that.dom.table&&d[f].type==b&&d[f].fn(c)};TableTools.BUTTONS={csv:{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",
bHeader:true,bFooter:true,bSelectedOnly:false,fnMouseover:null,fnMouseout:null,fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))},fnSelect:null,fnComplete:null,fnInit:null},xls:{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(a,b,c){this.fnSetText(c,this.fnGetTableData(b))},fnSelect:null,fnComplete:null,fnInit: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:true,bFooter:true,bSelectedOnly:false,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=this.s.dt.nTFoot===null?a-1:a-2;alert("Copied "+a+" row"+(a==1?"":"s")+" to the clipboard")},fnInit: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:true,bFooter:false,bSelectedOnly:false,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},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: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},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},select:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",
sButtonText:"Select button",mColumns:"all",bHeader:true,bFooter:true,fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:function(a){this.fnGetSelected().length!==0?e(a).removeClass("DTTT_disabled"):e(a).addClass("DTTT_disabled")},fnComplete:null,fnInit:function(a){e(a).addClass("DTTT_disabled")}},select_single:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Select button",mColumns:"all",bHeader:true,bFooter:true,fnMouseover:null,
fnMouseout:null,fnClick:null,fnSelect:function(a){this.fnGetSelected().length==1?e(a).removeClass("DTTT_disabled"):e(a).addClass("DTTT_disabled")},fnComplete:null,fnInit:function(a){e(a).addClass("DTTT_disabled")}},select_all:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Select all",mColumns:"all",bHeader:true,bFooter:true,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},select_none:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Deselect all",mColumns:"all",bHeader:true,bFooter:true,fnMouseover:null,fnMouseout:null,fnClick:function(){this.fnSelectNone()},fnSelect:function(a){this.fnGetSelected().length!==0?e(a).removeClass("DTTT_disabled"):e(a).addClass("DTTT_disabled")},fnComplete:null,
fnInit:function(a){e(a).addClass("DTTT_disabled")}},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:true,bFooter:true,bSelectedOnly:false,fnMouseover:null,fnMouseout:null,fnClick:function(a,b){a=this.fnGetTableData(b);e.ajax({url:b.sAjaxUrl,data:[{name:"tableData",value:a}],success:b.fnAjaxComplete,dataType:"json",type:"POST",
cache:false,error:function(){alert("Error detected when sending table data to server")}})},fnSelect:null,fnComplete:null,fnInit:null,fnAjaxComplete:function(){alert("Ajax complete")}},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}};TableTools.DEFAULTS={sSwfPath:"media/swf/copy_cvs_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.1";TableTools.prototype.VERSION=TableTools.VERSION;typeof e.fn.dataTable=="function"&&typeof e.fn.dataTableExt.fnVersionCheck=="function"&&e.fn.dataTableExt.fnVersionCheck("1.7.0")?e.fn.dataTableExt.aoFeatures.push({fnInit:function(a){a=new TableTools(a.oInstance,typeof a.oInit.oTableTools!=
"undefined"?a.oInit.oTableTools:{});TableTools._aInstances.push(a);return a.dom.container},cFeature:"T",sFeature:"TableTools"}):alert("Warning: TableTools 2 requires DataTables 1.7 or greater - www.datatables.net/download")})(jQuery,window,document);
(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);

View File

@@ -1,7 +1,7 @@
// Simple Set Clipboard System
// Author: Joseph Huckaby
var ZeroClipboard = {
var ZeroClipboard_TableTools = {
version: "1.0.4-TableTools2",
clients: {}, // registered upload clients on page, indexed by id
@@ -73,18 +73,18 @@ var ZeroClipboard = {
this.handlers = {};
// unique ID
this.id = ZeroClipboard.nextId++;
this.movieId = 'ZeroClipboardMovie_' + this.id;
this.id = ZeroClipboard_TableTools.nextId++;
this.movieId = 'ZeroClipboard_TableToolsMovie_' + this.id;
// register client with singleton to receive flash events
ZeroClipboard.register(this.id, this);
ZeroClipboard_TableTools.register(this.id, this);
// create movie
if (elem) this.glue(elem);
}
};
ZeroClipboard.Client.prototype = {
ZeroClipboard_TableTools.Client.prototype = {
id: 0, // unique ID for us
ready: false, // whether movie is ready to receive events or not
@@ -100,7 +100,7 @@ ZeroClipboard.Client.prototype = {
glue: function(elem, title) {
// glue to DOM element
// elem can be ID or actual DOM element object
this.domElement = ZeroClipboard.$(elem);
this.domElement = ZeroClipboard_TableTools.$(elem);
// float just above object, or zIndex 99 if dom element isn't set
var zIndex = 99;
@@ -109,7 +109,7 @@ ZeroClipboard.Client.prototype = {
}
// find X/Y position of domElement
var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);
// create floating DIV above element
this.div = document.createElement('div');
@@ -130,13 +130,14 @@ ZeroClipboard.Client.prototype = {
}
// style.backgroundColor = '#f00'; // debug
this.domElement.parentNode.appendChild(this.div);
this.div.innerHTML = this.getHTML( box.width, box.height );
if ( this.domElement.parentNode ) {
this.domElement.parentNode.appendChild(this.div);
this.div.innerHTML = this.getHTML( box.width, box.height );
}
},
positionElement: function() {
var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);
var style = this.div.style;
style.position = 'absolute';
@@ -147,6 +148,8 @@ ZeroClipboard.Client.prototype = {
if ( box.width != 0 && box.height != 0 ) {
this.sized = true;
} else {
return;
}
var flash = this.div.childNodes[0];
@@ -164,11 +167,11 @@ ZeroClipboard.Client.prototype = {
if (navigator.userAgent.match(/MSIE/)) {
// IE gets an OBJECT tag
var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.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="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+width+'" height="'+height+'" 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="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
}
else {
// all other browsers get an EMBED tag
html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard_TableTools.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
}
return html;
},
@@ -203,12 +206,12 @@ ZeroClipboard.Client.prototype = {
// reposition our floating div, optionally to new container
// warning: container CANNOT change size, only position
if (elem) {
this.domElement = ZeroClipboard.$(elem);
this.domElement = ZeroClipboard_TableTools.$(elem);
if (!this.domElement) this.hide();
}
if (this.domElement && this.div) {
var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);
var style = this.div.style;
style.left = '' + box.left + 'px';
style.top = '' + box.top + 'px';