diff options
Diffstat (limited to 'wqflask')
53 files changed, 12595 insertions, 389 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 96e04df0..beb62bd7 100755 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -436,8 +436,13 @@ class DataSet(object): print("Dataset {} is not yet available in GeneNetwork.".format(self.name)) pass - def get_trait_data(self): - self.samplelist = self.group.samplelist + self.group.parlist + self.group.f1list + def get_trait_data(self, sample_list=None): + if sample_list: + self.samplelist = sample_list + self.group.parlist + self.group.f1list + else: + self.samplelist = self.group.samplelist + self.group.parlist + self.group.f1list + + query = """ SELECT Strain.Name, Strain.Id FROM Strain, Species WHERE Strain.Name IN {} @@ -1055,7 +1060,6 @@ class MrnaAssayDataSet(DataSet): """ % (escape(self.name), escape(self.dataset.name)) results = g.db.execute(query).fetchone() return results[0] - def retrieve_sample_data(self, trait): query = """ @@ -1076,6 +1080,47 @@ class MrnaAssayDataSet(DataSet): """ % (escape(trait), escape(self.name)) results = g.db.execute(query).fetchall() return results + + + def retrieve_genes(self, column_name): + query = """ + select ProbeSet.Name, ProbeSet.%s + from ProbeSet,ProbeSetXRef + where ProbeSetXRef.ProbeSetFreezeId = %s and + ProbeSetXRef.ProbeSetId=ProbeSet.Id; + """ % (column_name, escape(str(self.id))) + results = g.db.execute(query).fetchall() + + return dict(results) + + #def retrieve_gene_symbols(self): + # query = """ + # select ProbeSet.Name, ProbeSet.Symbol, ProbeSet.GeneId + # from ProbeSet,ProbeSetXRef + # where ProbeSetXRef.ProbeSetFreezeId = %s and + # ProbeSetXRef.ProbeSetId=ProbeSet.Id; + # """ % (self.id) + # results = g.db.execute(query).fetchall() + # symbol_dict = {} + # for item in results: + # symbol_dict[item[0]] = item[1] + # return symbol_dict + # + #def retrieve_gene_ids(self): + # query = """ + # select ProbeSet.Name, ProbeSet.GeneId + # from ProbeSet,ProbeSetXRef + # where ProbeSetXRef.ProbeSetFreezeId = %s and + # ProbeSetXRef.ProbeSetId=ProbeSet.Id; + # """ % (self.id) + # return process_and_run_query(query) + # results = g.db.execute(query).fetchall() + # symbol_dict = {} + # for item in results: + # symbol_dict[item[0]] = item[1] + # return symbol_dict + + class TempDataSet(DataSet): diff --git a/wqflask/base/mrna_assay_tissue_data.py b/wqflask/base/mrna_assay_tissue_data.py new file mode 100644 index 00000000..be5df657 --- /dev/null +++ b/wqflask/base/mrna_assay_tissue_data.py @@ -0,0 +1,146 @@ +from __future__ import absolute_import, print_function, division + +import collections + +from flask import g + +from utility import db_tools +from utility import Bunch + +from MySQLdb import escape_string as escape + +from pprint import pformat as pf + +class MrnaAssayTissueData(object): + + def __init__(self, gene_symbols=None): + self.gene_symbols = gene_symbols + self.have_data = False + if self.gene_symbols == None: + self.gene_symbols = [] + + self.data = collections.defaultdict(Bunch) + + #self.gene_id_dict ={} + #self.data_id_dict = {} + #self.chr_dict = {} + #self.mb_dict = {} + #self.desc_dict = {} + #self.probe_target_desc_dict = {} + + query = '''select t.Symbol, t.GeneId, t.DataId,t.Chr, t.Mb, t.description, t.Probe_Target_Description + from ( + select Symbol, max(Mean) as maxmean + from TissueProbeSetXRef + where TissueProbeSetFreezeId=1 and ''' + + # Note that inner join is necessary in this query to get distinct record in one symbol group + # with highest mean value + # Due to the limit size of TissueProbeSetFreezeId table in DB, + # performance of inner join is acceptable.MrnaAssayTissueData(gene_symbols=symbol_list) + #print("len(gene_symbols): ", len(gene_symbols)) + if len(gene_symbols) == 0: + query += '''Symbol!='' and Symbol Is Not Null group by Symbol) + as x inner join TissueProbeSetXRef as t on t.Symbol = x.Symbol + and t.Mean = x.maxmean; + ''' + else: + in_clause = db_tools.create_in_clause(gene_symbols) + + query += ''' Symbol in {} group by Symbol) + as x inner join TissueProbeSetXRef as t on t.Symbol = x.Symbol + and t.Mean = x.maxmean; + '''.format(in_clause) + + results = g.db.execute(query).fetchall() + for result in results: + symbol = result[0] + if symbol in gene_symbols: + #gene_symbols.append(symbol) + symbol = symbol.lower() + + self.data[symbol].gene_id = result.GeneId + self.data[symbol].data_id = result.DataId + self.data[symbol].chr = result.Chr + self.data[symbol].mb = result.Mb + self.data[symbol].description = result.description + self.data[symbol].probe_target_description = result.Probe_Target_Description + + #print("self.data: ", pf(self.data)) + + ########################################################################### + #Input: cursor, symbolList (list), dataIdDict(Dict) + #output: symbolValuepairDict (dictionary):one dictionary of Symbol and Value Pair, + # key is symbol, value is one list of expression values of one probeSet; + #function: get one dictionary whose key is gene symbol and value is tissue expression data (list type). + #Attention! All keys are lower case! + ########################################################################### + + def get_symbol_values_pairs(self): + id_list = [self.data[symbol].data_id for symbol in self.data] + + symbol_values_dict = {} + + query = """SELECT TissueProbeSetXRef.Symbol, TissueProbeSetData.value + FROM TissueProbeSetXRef, TissueProbeSetData + WHERE TissueProbeSetData.Id IN {} and + TissueProbeSetXRef.DataId = TissueProbeSetData.Id""".format(db_tools.create_in_clause(id_list)) + + results = g.db.execute(query).fetchall() + for result in results: + if result.Symbol.lower() not in symbol_values_dict: + symbol_values_dict[result.Symbol.lower()] = [result.value] + else: + symbol_values_dict[result.Symbol.lower()].append(result.value) + + #for symbol in self.data: + # data_id = self.data[symbol].data_id + # symbol_values_dict[symbol] = self.get_tissue_values(data_id) + + + return symbol_values_dict + + + #def get_tissue_values(self, data_id): + # """Gets the tissue values for a particular gene""" + # + # tissue_values=[] + # + # query = """SELECT value, id + # FROM TissueProbeSetData + # WHERE Id IN {}""".format(db_tools.create_in_clause(data_id)) + # + # #try : + # results = g.db.execute(query).fetchall() + # for result in results: + # tissue_values.append(result.value) + # #symbol_values_dict[symbol] = value_list + # #except: + # # symbol_values_pairs[symbol] = None + # + # return tissue_values + +######################################################################################################## +#input: cursor, symbolList (list), dataIdDict(Dict): key is symbol +#output: SymbolValuePairDict(dictionary):one dictionary of Symbol and Value Pair. +# key is symbol, value is one list of expression values of one probeSet. +#function: wrapper function for getSymbolValuePairDict function +# build gene symbol list if necessary, cut it into small lists if necessary, +# then call getSymbolValuePairDict function and merge the results. +######################################################################################################## + +#def get_trait_symbol_and_tissue_values(symbol_list=None): +# tissue_data = MrnaAssayTissueData(gene_symbols=symbol_list) +# +# #symbolList, +# #geneIdDict, +# #dataIdDict, +# #ChrDict, +# #MbDict, +# #descDict, +# #pTargetDescDict = getTissueProbeSetXRefInfo( +# # GeneNameLst=GeneNameLst,TissueProbeSetFreezeId=TissueProbeSetFreezeId) +# +# if len(tissue_data.gene_symbols): +# return get_symbol_values_pairs(tissue_data) + diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index c893c887..6a64eeaf 100755 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -286,7 +286,6 @@ class GeneralTrait(object): escape(self.dataset.name), escape(self.name)) trait_info = g.db.execute(query).fetchone() - #print("trait_info is: ", pf(trait_info)) #XZ, 05/08/2009: We also should use Geno.Id to find marker instead of just using Geno.Name # to avoid the problem of same marker name from different species. elif self.dataset.type == 'Geno': @@ -359,7 +358,6 @@ class GeneralTrait(object): InbredSet.SpeciesId = Species.Id AND Species.TaxonomyId = Homologene.TaxonomyId """ % (escape(str(self.geneid)), escape(self.dataset.group.name)) - print("-> query is:", query) result = g.db.execute(query).fetchone() #else: # result = None @@ -391,7 +389,6 @@ class GeneralTrait(object): Geno.Name = '{}' and Geno.SpeciesId = Species.Id """.format(self.dataset.group.species, self.locus) - print("query is:", query) result = g.db.execute(query).fetchone() self.locus_chr = result[0] self.locus_mb = result[1] @@ -603,4 +600,4 @@ class GeneralTrait(object): else: ZValue = 0.5*log((1.0+self.correlation)/(1.0-self.correlation)) ZValue = ZValue*sqrt(self.overlap-3) - self.p_value = 2.0*(1.0 - reaper.normp(abs(ZValue)))
\ No newline at end of file + self.p_value = 2.0*(1.0 - reaper.normp(abs(ZValue))) diff --git a/wqflask/maintenance/quick_search_table.py b/wqflask/maintenance/quick_search_table.py index 9cd792ef..eef61857 100644 --- a/wqflask/maintenance/quick_search_table.py +++ b/wqflask/maintenance/quick_search_table.py @@ -11,10 +11,10 @@ each trait, its dataset, and several columns determined by its trait type (pheno """ -from __future__ import print_function, division, absolute_import +from __future__ import absolute_import, division, print_function -import sys -sys.path.append("../../..") +#import sys +#sys.path.append("../../..") import simplejson as json diff --git a/wqflask/utility/db_tools.py b/wqflask/utility/db_tools.py new file mode 100644 index 00000000..4034f39c --- /dev/null +++ b/wqflask/utility/db_tools.py @@ -0,0 +1,15 @@ +from __future__ import absolute_import, print_function, division + +from MySQLdb import escape_string as escape + +def create_in_clause(items): + """Create an in clause for mysql""" + in_clause = ', '.join("'{}'".format(x) for x in mescape(*items)) + in_clause = '( {} )'.format(in_clause) + return in_clause + +def mescape(*items): + """Multiple escape""" + escaped = [escape(str(item)) for item in items] + #print("escaped is:", escaped) + return escaped diff --git a/wqflask/wqflask/correlation/correlation_function.py b/wqflask/wqflask/correlation/correlation_functions.py index 7d4b58a9..da5c3197 100644 --- a/wqflask/wqflask/correlation/correlation_function.py +++ b/wqflask/wqflask/correlation/correlation_functions.py @@ -24,17 +24,19 @@ # # Last updated by NL 2011/03/23 +from __future__ import absolute_import, print_function, division import math -#import rpy2.robjects +import rpy2.robjects import pp import string from utility import webqtlUtil +from base.mrna_assay_tissue_data import MrnaAssayTissueData from base.trait import GeneralTrait from dbFunction import webqtlDatabaseFunction - +from flask import Flask, g #XZ: The input 'controls' is String. It contains the full name of control traits. #XZ: The input variable 'strainlst' is List. It contains the strain names of primary trait. @@ -492,7 +494,7 @@ pcor.rec <- function(x,y,z,method="p",na.rm=T){ #XZ, April 30, 2010: The input primaryTrait and targetTrait are instance of webqtlTrait #XZ: The primaryTrait and targetTrait should have executed retrieveData function -def calZeroOrderCorr (primaryTrait, targetTrait, method='pearson'): +def calZeroOrderCorr(primaryTrait, targetTrait, method='pearson'): #primaryTrait.retrieveData() @@ -558,7 +560,7 @@ def calZeroOrderCorr (primaryTrait, targetTrait, method='pearson'): #the same tissue order ##################################################################################### -def calZeroOrderCorrForTiss (primaryValue=[], targetValue=[], method='pearson'): +def cal_zero_order_corr_for_tiss (primaryValue=[], targetValue=[], method='pearson'): R_primary = rpy2.robjects.FloatVector(range(len(primaryValue))) N = len(primaryValue) @@ -676,7 +678,7 @@ def batchCalTissueCorr(primaryTraitValue=[], SymbolValueDict={}, method='pearson # getGeneSymbolTissueValueDict to build dict to get CorrPvArray #Note: If there are multiple probesets for one gene, select the one with highest mean. ########################################################################### -def getTissueProbeSetXRefInfo(cursor=None,GeneNameLst=[],TissueProbeSetFreezeId=0): +def getTissueProbeSetXRefInfo(GeneNameLst=[],TissueProbeSetFreezeId=0): Symbols ="" symbolList =[] geneIdDict ={} @@ -720,7 +722,6 @@ def getTissueProbeSetXRefInfo(cursor=None,GeneNameLst=[],TissueProbeSetFreezeId= '''% (TissueProbeSetFreezeId,Symbols) try: - cursor.execute(query) results =cursor.fetchall() resultCount = len(results) @@ -755,28 +756,43 @@ def getTissueProbeSetXRefInfo(cursor=None,GeneNameLst=[],TissueProbeSetFreezeId= #function: get one dictionary whose key is gene symbol and value is tissue expression data (list type). #Attention! All keys are lower case! ########################################################################### -def getSymbolValuePairDict(cursor=None,symbolList=None,dataIdDict={}): - symbolList = map(string.lower, symbolList) - symbolValuepairDict={} - valueList=[] - - for key in symbolList: - if dataIdDict.has_key(key): - DataId = dataIdDict[key] - - valueQuery = "select value from TissueProbeSetData where Id=%s" % DataId - try : - cursor.execute(valueQuery) - valueResults = cursor.fetchall() - for item in valueResults: - item =item[0] - valueList.append(item) - symbolValuepairDict[key] = valueList - valueList=[] - except: - symbolValuepairDict[key] = None - - return symbolValuepairDict +def get_symbol_value_pairs(tissue_data): + + id_list = [tissue_data[symbol.lower()].data_id for item in tissue_data] + + symbol_value_pairs = {} + value_list=[] + + query = """SELECT value, id + FROM TissueProbeSetData + WHERE Id IN {}""".format(create_in_clause(id_list)) + + try : + results = g.db.execute(query).fetchall() + for result in results: + value_list.append(result.value) + symbol_value_pairs[symbol] = value_list + except: + symbol_value_pairs[symbol] = None + + #for symbol in symbol_list: + # if tissue_data.has_key(symbol): + # data_id = tissue_data[symbol].data_id + # + # query = """select value, id + # from TissueProbeSetData + # where Id={}""".format(escape(data_id)) + # try : + # results = g.db.execute(query).fetchall() + # for item in results: + # item = item[0] + # value_list.append(item) + # symbol_value_pairs[symbol] = value_list + # value_list=[] + # except: + # symbol_value_pairs[symbol] = None + + return symbol_value_pairs ######################################################################################################## @@ -788,36 +804,49 @@ def getSymbolValuePairDict(cursor=None,symbolList=None,dataIdDict={}): # then call getSymbolValuePairDict function and merge the results. ######################################################################################################## -def getGeneSymbolTissueValueDict(cursor=None,symbolList=None,dataIdDict={}): - limitNum=1000 - count = len(symbolList) - - SymbolValuePairDict = {} - - if count !=0 and count <=limitNum: - SymbolValuePairDict = getSymbolValuePairDict(cursor=cursor,symbolList=symbolList,dataIdDict=dataIdDict) - - elif count >limitNum: - SymbolValuePairDict={} - n = count/limitNum - start =0 - stop =0 - - for i in range(n): - stop =limitNum*(i+1) - gList1 = symbolList[start:stop] - PairDict1 = getSymbolValuePairDict(cursor=cursor,symbolList=gList1,dataIdDict=dataIdDict) - start =limitNum*(i+1) - - SymbolValuePairDict.update(PairDict1) - - if stop < count: - stop = count - gList2 = symbolList[start:stop] - PairDict2 = getSymbolValuePairDict(cursor=cursor,symbolList=gList2,dataIdDict=dataIdDict) - SymbolValuePairDict.update(PairDict2) - - return SymbolValuePairDict +def get_trait_symbol_and_tissue_values(symbol_list=None): + tissue_data = MrnaAssayTissueData(gene_symbols=symbol_list) + + if len(tissue_data.gene_symbols): + return tissue_data.get_symbol_values_pairs() + + #symbolList, + #geneIdDict, + #dataIdDict, + #ChrDict, + #MbDict, + #descDict, + #pTargetDescDict = getTissueProbeSetXRefInfo( + # GeneNameLst=GeneNameLst,TissueProbeSetFreezeId=TissueProbeSetFreezeId) + + #limit_num=1000 + #count = len(symbol_list) + # + #symbol_value_pairs = {} + # + #if count !=0 and count <= limit_num: + # symbol_value_pairs = getSymbolValuePairDict(cursor=cursor,symbolList=symbol_list,dataIdDict=dataIdDict) + # + #elif count > limit_num: + # n = count/limit_num + # start = 0 + # stop = 0 + # + # for i in range(n): + # stop =limit_num*(i+1) + # gList1 = symbolList[start:stop] + # PairDict1 = getSymbolValuePairDict(cursor=cursor,symbolList=gList1,dataIdDict=dataIdDict) + # start =limit_num*(i+1) + # + # SymbolValuePairDict.update(PairDict1) + # + # if stop < count: + # stop = count + # gList2 = symbolList[start:stop] + # PairDict2 = getSymbolValuePairDict(cursor=cursor,symbolList=gList2,dataIdDict=dataIdDict) + # SymbolValuePairDict.update(PairDict2) + # + #return SymbolValuePairDict ######################################################################################################## #input: cursor, GeneNameLst (list), TissueProbeSetFreezeId(int) @@ -827,12 +856,17 @@ def getGeneSymbolTissueValueDict(cursor=None,symbolList=None,dataIdDict={}): # for CorrelationPage.py ######################################################################################################## -def getGeneSymbolTissueValueDictForTrait(cursor=None,GeneNameLst=[],TissueProbeSetFreezeId=0): - SymbolValuePairDict={} - symbolList,geneIdDict,dataIdDict,ChrDict,MbDict,descDict,pTargetDescDict = getTissueProbeSetXRefInfo(cursor=cursor,GeneNameLst=GeneNameLst,TissueProbeSetFreezeId=TissueProbeSetFreezeId) - if symbolList: - SymbolValuePairDict = getGeneSymbolTissueValueDict(cursor=cursor,symbolList=symbolList,dataIdDict=dataIdDict) - return SymbolValuePairDict +#def get_trait_symbol_and_tissue_values(cursor=None,GeneNameLst=[],TissueProbeSetFreezeId=0): +# SymbolValuePairDict={} +# +# symbolList,geneIdDict,dataIdDict,ChrDict,MbDict,descDict,pTargetDescDict = getTissueProbeSetXRefInfo( +# cursor=cursor,GeneNameLst=GeneNameLst,TissueProbeSetFreezeId=TissueProbeSetFreezeId) +# +# if symbolList: +# SymbolValuePairDict = get_gene_symbol_and_tissue_values(symbolList=symbolList, +# dataIdDict=dataIdDict) +# +# return SymbolValuePairDict ######################################################################################################## #Input: cursor(cursor): MySQL connnection cursor; diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 1615fe21..a5c80674 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -49,13 +49,15 @@ from base.templatePage import templatePage from utility import webqtlUtil, helper_functions, corr_result_helpers from dbFunction import webqtlDatabaseFunction import utility.webqtlUtil #this is for parallel computing only. -from wqflask.correlation import correlation_function +from wqflask.correlation import correlation_functions from utility.benchmark import Bench from MySQLdb import escape_string as escape from pprint import pformat as pf +from flask import Flask, g + METHOD_SAMPLE_PEARSON = "1" METHOD_SAMPLE_RANK = "2" METHOD_LIT = "3" @@ -68,7 +70,7 @@ TISSUE_MOUSE_DB = 1 def print_mem(stage=""): mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss - print("{}: {}".format(stage, mem/1024)) + #print("{}: {}".format(stage, mem/1024)) class AuthException(Exception): @@ -91,10 +93,6 @@ class CorrelationResults(object): # get trait list from db (database name) # calculate correlation with Base vector and targets - #self.this_trait = GeneralTrait(dataset=self.dataset.name, - # name=start_vars['trait_id'], - # cellid=None) - #print("start_vars: ", pf(start_vars)) with Bench("Doing correlations"): helper_functions.get_species_dataset_trait(self, start_vars) self.dataset.group.read_genotype_file() @@ -102,8 +100,9 @@ class CorrelationResults(object): corr_samples_group = start_vars['corr_samples_group'] self.sample_data = {} + self.corr_type = start_vars['corr_type'] self.corr_method = start_vars['corr_sample_method'] - self.return_number = 500 + self.return_number = 50 #The two if statements below append samples to the sample list based upon whether the user #rselected Primary Samples Only, Other Samples Only, or All Samples @@ -112,99 +111,81 @@ class CorrelationResults(object): self.dataset.group.f1list + self.dataset.group.samplelist) - #If either BXD/whatever Only or All Samples, append all of that group's samplelist + #If either BXD/whatever Only or All Samples, append all of that group's samplelist if corr_samples_group != 'samples_other': - self.process_samples(start_vars, primary_samples, ()) + self.process_samples(start_vars, primary_samples) #If either Non-BXD/whatever or All Samples, get all samples from this_trait.data and #exclude the primary samples (because they would have been added in the previous #if statement if the user selected All Samples) if corr_samples_group != 'samples_primary': + if corr_samples_group == 'samples_other': + primary_samples = [x for x in primary_samples if x not in ( + self.dataset.group.parlist + self.dataset.group.f1list)] + print("primary_samples:", primary_samples) self.process_samples(start_vars, self.this_trait.data.keys(), primary_samples) self.target_dataset = data_set.create_dataset(start_vars['corr_dataset']) - self.target_dataset.get_trait_data() - - - self.correlation_data = {} - for trait, values in self.target_dataset.trait_data.iteritems(): - this_trait_vals = [] - target_vals = [] - for index, sample in enumerate(self.target_dataset.samplelist): - if sample in self.sample_data: - sample_value = self.sample_data[sample] - target_sample_value = values[index] - this_trait_vals.append(sample_value) - target_vals.append(target_sample_value) - - this_trait_vals, target_vals, num_overlap = corr_result_helpers.normalize_values( - this_trait_vals, target_vals) - - if self.corr_method == 'pearson': - sample_r, sample_p = scipy.stats.pearsonr(this_trait_vals, target_vals) - else: - sample_r, sample_p = scipy.stats.spearmanr(this_trait_vals, target_vals) - - self.correlation_data[trait] = [sample_r, sample_p, num_overlap] - - self.correlation_data = collections.OrderedDict(sorted(self.correlation_data.items(), - key=lambda t: -abs(t[1][0]))) + self.target_dataset.get_trait_data(self.sample_data.keys()) self.correlation_results = [] - #self.correlation_data_slice = collections.OrderedDict() + self.correlation_data = {} - for trait_counter, trait in enumerate(self.correlation_data.keys()[:self.return_number]): + if self.corr_type == "tissue": + self.trait_symbol_dict = self.dataset.retrieve_genes("Symbol") + + tissue_corr_data = self.do_tissue_correlation_for_all_traits() + for trait in tissue_corr_data.keys()[:self.return_number]: + self.get_sample_r_and_p_values(trait, self.target_dataset.trait_data[trait]) + + elif self.corr_type == "lit": + self.trait_geneid_dict = self.dataset.retrieve_genes("GeneId") + lit_corr_data = self.do_lit_correlation_for_all_traits() + + for trait in lit_corr_data.keys()[:self.return_number]: + self.get_sample_r_and_p_values(trait, self.target_dataset.trait_data[trait]) + + elif self.corr_type == "sample": + for trait, values in self.target_dataset.trait_data.iteritems(): + self.get_sample_r_and_p_values(trait, values) + + self.correlation_data = collections.OrderedDict(sorted(self.correlation_data.items(), + key=lambda t: -abs(t[1][0]))) + + + for _trait_counter, trait in enumerate(self.correlation_data.keys()[:self.return_number]): trait_object = GeneralTrait(dataset=self.dataset, name=trait, get_qtl_info=True) - trait_object.sample_r = self.correlation_data[trait][0] - trait_object.sample_p = self.correlation_data[trait][1] - trait_object.num_overlap = self.correlation_data[trait][2] - self.correlation_results.append(trait_object) + (trait_object.sample_r, + trait_object.sample_p, + trait_object.num_overlap) = self.correlation_data[trait] + + #trait_object.sample_p = self.correlation_data[trait][1] + #trait_object.num_overlap = self.correlation_data[trait][2] + + #Get symbol for trait and call function that gets each tissue value from the database (tables TissueProbeSetXRef, + #TissueProbeSetData, etc) and calculates the correlation (cal_zero_order_corr_for_tissue in correlation_functions) + + # Set some sane defaults + trait_object.tissue_corr = 0 + trait_object.tissue_pvalue = 0 + trait_object.lit_corr = 0 + if self.corr_type == "tissue": + trait_object.tissue_corr = tissue_corr_data[trait][1] + trait_object.tissue_pvalue = tissue_corr_data[trait][2] + elif self.corr_type == "lit": + trait_object.lit_corr = lit_corr_data[trait][1] + self.correlation_results.append(trait_object) + + if self.corr_type != "lit": + self.do_lit_correlation_for_trait_list() + + if self.corr_type != "tissue": + self.do_tissue_correlation_for_trait_list() + #print("self.correlation_results: ", pf(self.correlation_results)) - #self.correlation_data_slice[trait] = self.correlation_data[trait] - #self.correlation_data_slice[trait].append(trait_object) - #if self.dataset.type == 'ProbeSet': - # trait_info = collections.OrderedDict( - # correlation = float(self.correlation_data[trait][0]), - # p_value = float(self.correlation_data[trait][1]), - # symbol = trait_object.symbol, - # alias = trait_object.alias, - # description = trait_object.description, - # chromosome = trait_object.chr, - # mb = trait_object.mb - # ) - # if trait_object.mean: - # trait_info[mean] = trait_object.mean - # if hasattr(trait_object, 'mean'): - # trait_info[mean] = trait_object.mean - # if hasattr(trait_object, 'lrs'): - # trait_info[lrs] = trait_object.lrs - # if hasattr(trait_object, 'locus_chr'): - # trait_info[locus_chr] = trait_object.locus_chr - # if hasattr(trait_object, 'locus_mb'): - # trait_info[locus_mb] = trait_object.locus_mb - #elif self.dataset.type == 'Geno': - # trait_info = collections.OrderedDict( - # correlation = float(self.correlation_data[trait][0]), - # p_value = float(self.correlation_data[trait][1]), - # symbol = trait_object.symbol, - # alias = trait_object.alias, - # description = trait_object.description, - # chromosome = trait_object.chr, - # mb = trait_object.mb - # ) - #else: # 'Publish' - # trait_info = collections.OrderedDict( - # correlation = float(self.correlation_data[trait][0]), - # p_value = float(self.correlation_data[trait][1]), - # symbol = trait_object.symbol, - # alias = trait_object.alias, - # description = trait_object.description, - # chromosome = trait_object.chr, - # mb = trait_object.mb - # ) #XZ, 09/18/2008: get all information about the user selected database. #target_db_name = fd.corr_dataset @@ -258,6 +239,346 @@ class CorrelationResults(object): ############################################################################################################################################ + def do_tissue_correlation_for_trait_list(self, tissue_dataset_id=1): + """Given a list of correlation results (self.correlation_results), gets the tissue correlation value for each""" + + #Gets tissue expression values for the primary trait + primary_trait_tissue_vals_dict = correlation_functions.get_trait_symbol_and_tissue_values( + symbol_list = [self.this_trait.symbol]) + + if self.this_trait.symbol.lower() in primary_trait_tissue_vals_dict: + primary_trait_tissue_values = primary_trait_tissue_vals_dict[self.this_trait.symbol.lower()] + + #gene_symbol_list = [] + # + #for trait in self.correlation_results: + # if hasattr(trait, 'symbol'): + # gene_symbol_list.append(trait.symbol) + + gene_symbol_list = [trait.symbol for trait in self.correlation_results if trait.symbol] + + corr_result_tissue_vals_dict= correlation_functions.get_trait_symbol_and_tissue_values( + symbol_list=gene_symbol_list) + + for trait in self.correlation_results: + if trait.symbol and trait.symbol.lower() in corr_result_tissue_vals_dict: + this_trait_tissue_values = corr_result_tissue_vals_dict[trait.symbol.lower()] + + result = correlation_functions.cal_zero_order_corr_for_tiss(primary_trait_tissue_values, + this_trait_tissue_values, + self.corr_method) + + trait.tissue_corr = result[0] + trait.tissue_pvalue = result[2] + + # else: + # trait.tissue_corr = None + # trait.tissue_pvalue = None + #else: + # for trait in self.correlation_results: + # trait.tissue_corr = None + # trait.tissue_pvalue = None + + #return self.correlation_results + + + def do_tissue_correlation_for_all_traits(self, tissue_dataset_id=1): + #Gets tissue expression values for the primary trait + primary_trait_tissue_vals_dict = correlation_functions.get_trait_symbol_and_tissue_values( + symbol_list = [self.this_trait.symbol]) + + if self.this_trait.symbol.lower() in primary_trait_tissue_vals_dict: + primary_trait_tissue_values = primary_trait_tissue_vals_dict[self.this_trait.symbol.lower()] + + #print("trait_gene_symbols: ", pf(trait_gene_symbols.values())) + corr_result_tissue_vals_dict= correlation_functions.get_trait_symbol_and_tissue_values( + symbol_list=self.trait_symbol_dict.values()) + + #print("corr_result_tissue_vals: ", pf(corr_result_tissue_vals_dict)) + + #print("trait_gene_symbols: ", pf(trait_gene_symbols)) + + tissue_corr_data = {} + for trait, symbol in self.trait_symbol_dict.iteritems(): + if symbol and symbol.lower() in corr_result_tissue_vals_dict: + this_trait_tissue_values = corr_result_tissue_vals_dict[symbol.lower()] + #print("this_trait_tissue_values: ", pf(this_trait_tissue_values)) + + result = correlation_functions.cal_zero_order_corr_for_tiss(primary_trait_tissue_values, + this_trait_tissue_values, + self.corr_method) + + tissue_corr_data[trait] = [symbol, result[0], result[2]] + + tissue_corr_data = collections.OrderedDict(sorted(tissue_corr_data.items(), + key=lambda t: -abs(t[1][1]))) + + return tissue_corr_data + + + def do_lit_correlation_for_trait_list(self): + + input_trait_mouse_gene_id = self.convert_to_mouse_gene_id(self.dataset.group.species.lower(), self.this_trait.geneid) + + for trait in self.correlation_results: + + if trait.geneid: + trait.mouse_gene_id = self.convert_to_mouse_gene_id(self.dataset.group.species.lower(), trait.geneid) + else: + trait.mouse_gene_id = None + + if trait.mouse_gene_id and str(trait.mouse_gene_id).find(";") == -1: + result = g.db.execute( + """SELECT value + FROM LCorrRamin3 + WHERE GeneId1='%s' and + GeneId2='%s' + """ % (escape(trait.mouse_gene_id), escape(input_trait_mouse_gene_id)) + ).fetchone() + if not result: + result = g.db.execute("""SELECT value + FROM LCorrRamin3 + WHERE GeneId2='%s' and + GeneId1='%s' + """ % (escape(trait.mouse_gene_id), escape(input_trait_mouse_gene_id)) + ).fetchone() + + if result: + lit_corr = result.value + trait.lit_corr = lit_corr + else: + trait.lit_corr = 0 + else: + trait.lit_corr = 0 + + + def do_lit_correlation_for_all_traits(self): + input_trait_mouse_gene_id = self.convert_to_mouse_gene_id(self.dataset.group.species.lower(), self.this_trait.geneid) + + lit_corr_data = {} + for trait, gene_id in self.trait_geneid_dict.iteritems(): + mouse_gene_id = self.convert_to_mouse_gene_id(self.dataset.group.species.lower(), gene_id) + + if mouse_gene_id and str(mouse_gene_id).find(";") == -1: + #print("gene_symbols:", input_trait_mouse_gene_id + " / " + mouse_gene_id) + result = g.db.execute( + """SELECT value + FROM LCorrRamin3 + WHERE GeneId1='%s' and + GeneId2='%s' + """ % (escape(mouse_gene_id), escape(input_trait_mouse_gene_id)) + ).fetchone() + if not result: + result = g.db.execute("""SELECT value + FROM LCorrRamin3 + WHERE GeneId2='%s' and + GeneId1='%s' + """ % (escape(mouse_gene_id), escape(input_trait_mouse_gene_id)) + ).fetchone() + if result: + #print("result:", result) + lit_corr = result.value + lit_corr_data[trait] = [gene_id, lit_corr] + else: + lit_corr_data[trait] = [gene_id, 0] + else: + lit_corr_data[trait] = [gene_id, 0] + + lit_corr_data = collections.OrderedDict(sorted(lit_corr_data.items(), + key=lambda t: -abs(t[1][1]))) + + return lit_corr_data + + def convert_to_mouse_gene_id(self, species=None, gene_id=None): + """If the species is rat or human, translate the gene_id to the mouse geneid + + If there is no input gene_id or there's no corresponding mouse gene_id, return None + + """ + if not gene_id: + return None + + mouse_gene_id = None + + if species == 'mouse': + mouse_gene_id = gene_id + + elif species == 'rat': + mouse_gene_id = g.db.execute( + """SELECT mouse + FROM GeneIDXRef + WHERE rat='%d' + """, escape(int(gene_id))).fetchone().mouse + + elif species == 'human': + mouse_gene_id = g.db.execute( + """SELECT mouse + FROM GeneIDXRef + WHERE human='%d' + """, escape(int(gene_id))).fetchone().mouse + + #print("mouse_geneid:", mouse_geneid) + + return mouse_gene_id + + def get_sample_r_and_p_values(self, trait, target_samples): + """Calculates the sample r (or rho) and p-value + + Given a primary trait and a target trait's sample values, + calculates either the pearson r or spearman rho and the p-value + using the corresponding scipy functions. + + """ + + print("len(self.sample_data):", len(self.sample_data)) + + this_trait_vals = [] + target_vals = [] + for index, sample in enumerate(self.target_dataset.samplelist): + if sample in self.sample_data: + sample_value = self.sample_data[sample] + target_sample_value = target_samples[index] + this_trait_vals.append(sample_value) + target_vals.append(target_sample_value) + + this_trait_vals, target_vals, num_overlap = corr_result_helpers.normalize_values( + this_trait_vals, target_vals) + + if self.corr_method == 'pearson': + sample_r, sample_p = scipy.stats.pearsonr(this_trait_vals, target_vals) + else: + sample_r, sample_p = scipy.stats.spearmanr(this_trait_vals, target_vals) + + self.correlation_data[trait] = [sample_r, sample_p, num_overlap] + + + + def do_tissue_corr_for_all_traits_2(self): + """Comments Possibly Out of Date!!!!! + + Uses get_temp_tissue_corr_table to generate table of tissue correlations + + This function then gathers that data and pairs it with the TraitID string. + Takes as its arguments a formdata instance, and a dataset instance. + Returns a dictionary of 'TraitID':(tissueCorr, tissuePValue) + for the requested correlation + + Used when the user selects the tissue correlation method; i.e. not for the + column that is appended to all probeset trait correlation tables + + """ + + # table name string + temp_table = self.get_temp_tissue_corr_table(tissue_probesetfreeze_id=TISSUE_MOUSE_DB, + method=method) + + query = """SELECT ProbeSet.Name, {}.Correlation, {}.PValue + FROM (ProbeSet, ProbeSetXRef, ProbeSetFreeze) + LEFT JOIN {} ON {}.Symbol=ProbeSet.Symbol + WHERE ProbeSetFreeze.Name = '{}' + and ProbeSetFreeze.Id=ProbeSetXRef.ProbeSetFreezeId + and ProbeSet.Id = ProbeSetXRef.ProbeSetId + and ProbeSet.Symbol IS NOT NULL + and {}.Correlation IS NOT NULL""".format(dataset.mescape( + temp_table, temp_table, temp_table, temp_table, + self.dataset.name, temp_table)) + + results = g.db.execute(query).fetchall() + + tissue_corr_dict = {} + + for entry in results: + trait_name, tissue_corr, tissue_pvalue = entry + tissue_corr_dict[trait_name] = (tissue_corr, tissue_pvalue) + #symbolList, + #geneIdDict, + #dataIdDict, + #ChrDict, + #MbDict, + #descDict, + #pTargetDescDict = getTissueProbeSetXRefInfo( + # GeneNameLst=GeneNameLst,TissueProbeSetFreezeId=TissueProbeSetFreezeId) + + g.db.execute('DROP TEMPORARY TABLE {}'.format(escape(temp_table))) + + return tissue_corr_dict + + + #XZ, 09/23/2008: In tissue correlation tables, there is no record of GeneId1 == GeneId2 + #XZ, 09/24/2008: Note that the correlation value can be negative. + def get_temp_tissue_corr_table(self, + tissue_probesetfreeze_id=0, + method="", + return_number=0): + + + def cmp_tisscorr_absolute_value(A, B): + try: + if abs(A[1]) < abs(B[1]): return 1 + elif abs(A[1]) == abs(B[1]): + return 0 + else: return -1 + except: + return 0 + + symbol_corr_dict, symbol_pvalue_dict = self.calculate_corr_for_all_tissues( + tissue_dataset_id=TISSUE_MOUSE_DB) + + symbol_corr_list = symbol_corr_dict.items() + + symbol_corr_list.sort(cmp_tisscorr_absolute_value) + symbol_corr_list = symbol_corr_list[0 : 2*return_number] + + tmp_table_name = webqtlUtil.genRandStr(prefix="TOPTISSUE") + + q1 = 'CREATE TEMPORARY TABLE %s (Symbol varchar(100) PRIMARY KEY, Correlation float, PValue float)' % tmp_table_name + self.cursor.execute(q1) + + for one_pair in symbol_corr_list: + one_symbol = one_pair[0] + one_corr = one_pair[1] + one_p_value = symbol_pvalue_dict[one_symbol] + + self.cursor.execute( "INSERT INTO %s (Symbol, Correlation, PValue) VALUES ('%s',%f,%f)" % (tmpTableName, one_symbol, float(one_corr), float(one_p_value)) ) + + return tmp_table_name + + + def calculate_corr_for_all_tissues(self, tissue_dataset_id=None): + + symbol_corr_dict = {} + symbol_pvalue_dict = {} + + primary_trait_symbol_value_dict = correlation_functions.make_gene_tissue_value_dict( + GeneNameLst=[self.this_trait.symbol], + TissueProbeSetFreezeId=tissue_dataset_id) + primary_trait_value = primary_trait_symbol_value_dict.values()[0] + + symbol_value_dict = correlation_functions.make_gene_tissue_value_dict( + gene_name_list=[], + tissue_dataset_id=tissue_dataset_id) + + symbol_corr_dict, symbol_pvalue_dict = correlation_functions.batch_cal_tissue_corr( + primaryTraitValue, + SymbolValueDict, + method=self.corr_method) + #else: + # symbol_corr_dict, symbol_pvalue_dict = correlation_functions.batch_cal_tissue_corr( + # primaryTraitValue, + # SymbolValueDict) + + return (symbolCorrDict, symbolPvalueDict) + + ##XZ, 12/16/2008: the input geneid is of mouse type + #def checkSymbolForTissueCorr(self, tissueProbeSetFreezeId=0, symbol=""): + # q = "SELECT 1 FROM TissueProbeSetXRef WHERE TissueProbeSetFreezeId=%s and Symbol='%s' LIMIT 1" % (tissueProbeSetFreezeId,symbol) + # self.cursor.execute(q) + # try: + # x = self.cursor.fetchone() + # if x: return True + # else: raise + # except: return False + def get_all_dataset_data(self): @@ -291,7 +612,10 @@ class CorrelationResults(object): ProbeSet.Id = ProbeSetXRef.ProbeSetId order by ProbeSet.Id """ - def process_samples(self, start_vars, sample_names, excluded_samples): + def process_samples(self, start_vars, sample_names, excluded_samples=None): + if not excluded_samples: + excluded_samples = () + for sample in sample_names: if sample not in excluded_samples: value = start_vars['value:' + sample] @@ -301,37 +625,6 @@ class CorrelationResults(object): self.sample_data[str(sample)] = float(value) - #XZ, 12/12/2008: if the species is rat or human, translate the geneid to mouse geneid - #XZ, 12/12/2008: if the input geneid is 'None', return 0 - #XZ, 12/12/2008: if the input geneid has no corresponding mouse geneid, return 0 - def translateToMouseGeneID(self, species, geneid): - #mouse_geneid = 0 - - if not geneid: - return 0 - - #self.id, self.name, self.fullname, self.shortname = g.db.execute(""" - # SELECT Id, Name, FullName, ShortName - # FROM %s - # WHERE public > %s AND - # (Name = '%s' OR FullName = '%s' OR ShortName = '%s') - # """ % (query_args)).fetchone() - - if species == 'mouse': - mouse_geneid = geneid - elif species == 'rat': - mouse_geneid = g.db.execute( - """SELECT mouse FROM GeneIDXRef WHERE rat='%d'""", int(geneid)).fetchone().mouse - #if record: - # mouse_geneid = record[0] - elif species == 'human': - mouse_geneid = g.db.execute( - """SELECT mouse FROM GeneIDXRef WHERE human='%d'""", int(geneid)).fetchone().mouse - #if record: - # mouse_geneid = record[0] - print("mouse_geneid:", mouse_geneid) - return mouse_geneid - ##XZ, 12/16/2008: the input geneid is of mouse type #def checkForLitInfo(self,geneId): @@ -344,16 +637,6 @@ class CorrelationResults(object): # except: return False - ##XZ, 12/16/2008: the input geneid is of mouse type - #def checkSymbolForTissueCorr(self, tissueProbeSetFreezeId=0, symbol=""): - # q = "SELECT 1 FROM TissueProbeSetXRef WHERE TissueProbeSetFreezeId=%s and Symbol='%s' LIMIT 1" % (tissueProbeSetFreezeId,symbol) - # self.cursor.execute(q) - # try: - # x = self.cursor.fetchone() - # if x: return True - # else: raise - # except: return False - def fetchAllDatabaseData(self, species, GeneId, GeneSymbol, strains, db, method, returnNumber, tissueProbeSetFreezeId): @@ -525,46 +808,6 @@ class CorrelationResults(object): - #XZ, 09/23/2008: In tissue correlation tables, there is no record of GeneId1 == GeneId2 - #XZ, 09/24/2008: Note that the correlation value can be negative. - def get_temp_tissue_corr_table(self, - tissue_probesetfreeze_id=0, - method="", - return_number=0): - - - def cmp_tisscorr_absolute_value(A, B): - try: - if abs(A[1]) < abs(B[1]): return 1 - elif abs(A[1]) == abs(B[1]): - return 0 - else: return -1 - except: - return 0 - - symbol_corr_dict, symbol_pvalue_dict = self.calculate_corr_for_all_tissues( - tissue_dataset_id=TISSUE_MOUSE_DB) - - symbol_corr_list = symbol_corr_dict.items() - - symbol_corr_list.sort(cmp_tisscorr_absolute_value) - symbol_corr_list = symbol_corr_list[0 : 2*return_number] - - tmp_table_name = webqtlUtil.genRandStr(prefix="TOPTISSUE") - - q1 = 'CREATE TEMPORARY TABLE %s (Symbol varchar(100) PRIMARY KEY, Correlation float, PValue float)' % tmp_table_name - self.cursor.execute(q1) - - for one_pair in symbol_corr_list: - one_symbol = one_pair[0] - one_corr = one_pair[1] - one_p_value = symbol_pvalue_dict[one_symbol] - - self.cursor.execute( "INSERT INTO %s (Symbol, Correlation, PValue) VALUES ('%s',%f,%f)" % (tmpTableName, one_symbol, float(one_corr), float(one_p_value)) ) - - return tmp_table_name - - #XZ, 01/09/2009: This function was created by David Crowell. Xiaodong cleaned up and modified it. def fetchLitCorrelations(self, species, GeneId, db, returnNumber): ### Used to generate Lit Correlations when calculations are done from text file. dcrowell August 2008 """Uses getTempLiteratureTable to generate table of literatire correlations. This function then gathers that data and @@ -592,87 +835,6 @@ class CorrelationResults(object): return litCorrDict - def fetch_tissue_correlations(self): - """Comments Possibly Out of Date!!!!! - - - Uses getTempTissueCorrTable to generate table of tissue correlations - - This function then gathers that data and pairs it with the TraitID string. - Takes as its arguments a formdata instance, and a database instance. - Returns a dictionary of 'TraitID':(tissueCorr, tissuePValue) - for the requested correlation - - Used when the user selects the tissue correlation method; i.e. not for the - column that is appended to all probeset trait correlation tables - - """ - - # table name string - temp_table = self.get_temp_tissue_corr_table(tissue_probesetfreeze_id=TISSUE_MOUSE_DB, - method=method) - - query = """SELECT ProbeSet.Name, {}.Correlation, {}.PValue - FROM (ProbeSet, ProbeSetXRef, ProbeSetFreeze) - LEFT JOIN {} ON {}.Symbol=ProbeSet.Symbol - WHERE ProbeSetFreeze.Name = '{}' - and ProbeSetFreeze.Id=ProbeSetXRef.ProbeSetFreezeId - and ProbeSet.Id = ProbeSetXRef.ProbeSetId - and ProbeSet.Symbol IS NOT NULL - and {}.Correlation IS NOT NULL""".format(dataset.mescape( - temp_table, temp_table, temp_table, temp_table, - self.dataset.name, temp_table)) - - results = g.db.execute(query).fetchall() - - tissue_corr_dict = {} - - for entry in results: - trait_name, tissue_corr, tissue_pvalue = entry - tissue_corr_dict[trait_name] = (tissue_corr, tissue_pvalue) - - g.db.execute('DROP TEMPORARY TABLE {}'.format(escape(temp_table))) - - return tissue_corr_dict - - - def getLiteratureCorrelationByList(self, input_trait_mouse_geneid=None, species=None, traitList=None): - - tmpTableName = webqtlUtil.genRandStr(prefix="LITERATURE") - - q1 = 'CREATE TEMPORARY TABLE %s (GeneId1 int(12) unsigned, GeneId2 int(12) unsigned PRIMARY KEY, value double)' % tmpTableName - q2 = 'INSERT INTO %s (GeneId1, GeneId2, value) SELECT GeneId1,GeneId2,value FROM LCorrRamin3 WHERE GeneId1=%s' % (tmpTableName, input_trait_mouse_geneid) - q3 = 'INSERT INTO %s (GeneId1, GeneId2, value) SELECT GeneId2,GeneId1,value FROM LCorrRamin3 WHERE GeneId2=%s AND GeneId1!=%s' % (tmpTableName, input_trait_mouse_geneid, input_trait_mouse_geneid) - - for x in [q1,q2,q3]: - self.cursor.execute(x) - - for thisTrait in traitList: - try: - if thisTrait.geneid: - thisTrait.mouse_geneid = self.translateToMouseGeneID(species, thisTrait.geneid) - else: - thisTrait.mouse_geneid = 0 - except: - thisTrait.mouse_geneid = 0 - - if thisTrait.mouse_geneid and str(thisTrait.mouse_geneid).find(";") == -1: - try: - self.cursor.execute("SELECT value FROM %s WHERE GeneId2 = %s" % (tmpTableName, thisTrait.mouse_geneid)) - result = self.cursor.fetchone() - if result: - thisTrait.LCorr = result[0] - else: - thisTrait.LCorr = None - except: - thisTrait.LCorr = None - else: - thisTrait.LCorr = None - - self.cursor.execute("DROP TEMPORARY TABLE %s" % tmpTableName) - - return traitList - def get_traits(self, vals): #Todo: Redo cached stuff using memcached @@ -791,7 +953,30 @@ class CorrelationResults(object): allcorrelations.append( one_traitinfo ) _log.info("Appending the results") + def calculate_corr_for_all_tissues(self, tissue_dataset_id=None): + + symbol_corr_dict = {} + symbol_pvalue_dict = {} + + primary_trait_symbol_value_dict = correlation_functions.make_gene_tissue_value_dict( + GeneNameLst=[self.this_trait.symbol], + TissueProbeSetFreezeId=tissue_dataset_id) + primary_trait_value = primary_trait_symbol_value_dict.values()[0] + symbol_value_dict = correlation_functions.make_gene_tissue_value_dict( + gene_name_list=[], + tissue_dataset_id=tissue_dataset_id) + + symbol_corr_dict, symbol_pvalue_dict = correlation_functions.batch_cal_tissue_corr( + primaryTraitValue, + SymbolValueDict, + method=self.corr_method) + #else: + # symbol_corr_dict, symbol_pvalue_dict = correlation_functions.batch_cal_tissue_corr( + # primaryTraitValue, + # SymbolValueDict) + + return (symbolCorrDict, symbolPvalueDict) datasetFile.close() totalTraits = len(allcorrelations) _log.info("Done correlating using the fast method") @@ -810,7 +995,6 @@ class CorrelationResults(object): values_2.append(target_value) correlation = calCorrelation(values_1, values_2) self.correlation_data[trait] = correlation - print ('correlation result: %s %s' % (trait, correlation)) """ correlations = [] @@ -911,66 +1095,6 @@ class CorrelationResults(object): return trait_list """ - def calculate_corr_for_all_tissues(self, tissue_dataset_id=None): - - symbol_corr_dict = {} - symbol_pvalue_dict = {} - - primary_trait_symbol_value_dict = correlation_function.make_gene_tissue_value_dict( - GeneNameLst=[self.this_trait.symbol], - TissueProbeSetFreezeId=tissue_dataset_id) - primary_trait_value = primary_trait_symbol_value_dict.values()[0] - - symbol_value_dict = correlation_function.make_gene_tissue_value_dict( - gene_name_list=[], - tissue_dataset_id=tissue_dataset_id) - - symbol_corr_dict, symbol_pvalue_dict = correlation_function.batch_cal_tissue_corr( - primaryTraitValue, - SymbolValueDict, - method=self.corr_method) - #else: - # symbol_corr_dict, symbol_pvalue_dict = correlation_function.batch_cal_tissue_corr( - # primaryTraitValue, - # SymbolValueDict) - - - return (symbolCorrDict, symbolPvalueDict) - #XZ, 10/13/2010 - def getTissueCorrelationByList(self, primaryTraitSymbol=None, traitList=None, TissueProbeSetFreezeId=None, method=None): - - primaryTraitSymbolValueDict = correlationFunction.getGeneSymbolTissueValueDictForTrait(cursor=self.cursor, GeneNameLst=[primaryTraitSymbol], TissueProbeSetFreezeId=TISSUE_MOUSE_DB) - - if primaryTraitSymbol.lower() in primaryTraitSymbolValueDict: - primaryTraitValue = primaryTraitSymbolValueDict[primaryTraitSymbol.lower()] - - geneSymbolList = [] - - for thisTrait in traitList: - if hasattr(thisTrait, 'symbol'): - geneSymbolList.append(thisTrait.symbol) - - SymbolValueDict = correlationFunction.getGeneSymbolTissueValueDictForTrait(cursor=self.cursor, GeneNameLst=geneSymbolList, TissueProbeSetFreezeId=TISSUE_MOUSE_DB) - - for thisTrait in traitList: - if hasattr(thisTrait, 'symbol') and thisTrait.symbol and thisTrait.symbol.lower() in SymbolValueDict: - oneTraitValue = SymbolValueDict[thisTrait.symbol.lower()] - if method in ["2","5"]: - result = correlationFunction.calZeroOrderCorrForTiss( primaryTraitValue, oneTraitValue, method='spearman' ) - else: - result = correlationFunction.calZeroOrderCorrForTiss( primaryTraitValue, oneTraitValue) - thisTrait.tissueCorr = result[0] - thisTrait.tissuePValue = result[2] - else: - thisTrait.tissueCorr = None - thisTrait.tissuePValue = None - else: - for thisTrait in traitList: - thisTrait.tissueCorr = None - thisTrait.tissuePValue = None - - return traitList - diff --git a/wqflask/wqflask/static/packages/TableTools/alt_init.html b/wqflask/wqflask/static/packages/TableTools/alt_init.html new file mode 100755 index 00000000..73853150 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/alt_init.html @@ -0,0 +1,520 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table.css"; + @import "media/css/TableTools.css"; + tr.selected { + background-color: red !important; + } + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + var oTable = $('#example').dataTable(); + var oTableTools = new TableTools( oTable, { + "buttons": [ + "copy", + "csv", + "xls", + "pdf", + { "type": "print", "buttonText": "Print me!" } + ] + } ); + + $('#demo').before( oTableTools.dom.container ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example - initialisation with 'new TableTools()' + </div> + + <h1>Preamble</h1> + <p>Typically when working with TableTools, the initialisation and insertion into the DOM will be done automatically by DataTables, through the use of the sDom parameter. However, it is also possible to initialise TableTools manually as shown in the example below. Once initialised you can insert the TableTools tool bar node anywhere you wish into the DOM using the <i>instance</i>.dom.container parameter.</p> + + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + var oTable = $('#example').dataTable(); + var oTableTools = new TableTools( oTable, { + "buttons": [ + "copy", + "csv", + "xls", + "pdf", + { "type": "print", "buttonText": "Print me!" } + ] + } ); + + $('#demo').before( oTableTools.dom.container ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/alter_buttons.html b/wqflask/wqflask/static/packages/TableTools/alter_buttons.html new file mode 100755 index 00000000..771b0b86 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/alter_buttons.html @@ -0,0 +1,505 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table.css"; + @import "media/css/TableTools.css"; + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "aButtons": [ "copy", "print" ] + } + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example - button arrangement + </div> + + <h1>Preamble</h1> + <p>TableTools makes it very simple to arrange the buttons in the toolbar as you see fit. Using the <i>aButtons</i> parameter you can use any of the <a href="http://datatables.net/extras/tabletools/buttons">predefined buttons</a> or <a href="http://datatables.net/extras/tabletools/button_options">customised buttons</a>. The example below shows how TableTools can be initialised to provide only the 'copy-to-clipboard' and 'print view' options (i.e. no save to local file option is available).</p> + + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "aButtons": [ "copy", "print" ] + } + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/bootstrap.html b/wqflask/wqflask/static/packages/TableTools/bootstrap.html new file mode 100755 index 00000000..664bde3d --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/bootstrap.html @@ -0,0 +1,551 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + + <style type="text/css"> + @import "../../media/css/demo_page.css"; + @import "http://twitter.github.com/bootstrap/assets/css/bootstrap.css"; + @import "http://datatables.github.com/Plugins/integration/bootstrap/dataTables.bootstrap.css"; + </style> + + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8" src="http://datatables.github.com/Plugins/integration/bootstrap/dataTables.bootstrap.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + $('#example').dataTable( { + "sDom": "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>", + "oTableTools": { + "aButtons": [ + "copy", + "print", + { + "sExtends": "collection", + "sButtonText": 'Save <span class="caret" />', + "aButtons": [ "csv", "xls", "pdf" ] + } + ] + } + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools with Twitter Bootstrap + </div> + + <h1>Preamble</h1> + <p><a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a> is a very powerful design framework for allowing you to very quickly create applications with a unified look and feel. <a href="http://datatables.net/blog/Twitter_Bootstrap_2">DataTables integrates well</a> with Bootstrap, and so does TableTools.</p> + <p>This example shows the default Bootstrap theme being used with a Bootstrap styled DataTable. sDom is supplied to the DataTable with a setup suitable for Bootstrap styling, and a TableTools collection is used to show how it can be used in this environment.</p> + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€ היצוא)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + $('#example').dataTable( { + "sDom": "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>", + "oTableTools": { + "aButtons": [ + "copy", + "print", + { + "sExtends": "collection", + "sButtonText": 'Save <span class="caret" />', + "aButtons": [ "csv", "xls", "pdf" ] + } + ] + } + } ); +} );</pre> + + <p>The following code is included from the <a href="http://datatables.github.com/Plugins/integration/bootstrap/dataTables.bootstrap.js">DataTables bootstrap integration file</a>:</p> + + <pre>// Set the classes that TableTools uses to something suitable for Bootstrap +$.extend( true, $.fn.DataTable.TableTools.classes, { + "container": "btn-group", + "buttons": { + "normal": "btn", + "disabled": "btn disabled" + }, + "collection": { + "container": "DTTT_dropdown dropdown-menu", + "buttons": { + "normal": "", + "disabled": "disabled" + } + } +} ); + +// Have the collection use a bootstrap compatible dropdown +$.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, { + "collection": { + "container": "ul", + "button": "li", + "liner": "a" + } +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/button_text.html b/wqflask/wqflask/static/packages/TableTools/button_text.html new file mode 100755 index 00000000..6828eb94 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/button_text.html @@ -0,0 +1,531 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table.css"; + @import "media/css/TableTools.css"; + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "aButtons": [ + { + "sExtends": "copy", + "sButtonText": "Copy to clipboard" + }, + { + "sExtends": "csv", + "sButtonText": "Save to CSV" + }, + { + "sExtends": "xls", + "sButtonText": "Save for Excel" + } + ] + } + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example - customised button text + </div> + + <h1>Preamble</h1> + <p>You may wish to set your own text for the buttons in the TableTools toolbar, rather than relying on the default built-in text. This is done by overriding the <i>sButtonText</i> parameter of whatever button you wish to alter. The way TableTools allows you to alter a predefined button is by 'extending' it (using the <i>sExtends</i> parameter) and then setting the overriding parameter. A full list of the parameters which can be used is <a href="http://datatables.net/extras/tabletools/button_options">available on the DataTables.net web-site</a>. This example shows how to set the button text as required.</p> + + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "aButtons": [ + { + "sExtends": "copy", + "sButtonText": "Copy to clipboard" + }, + { + "sExtends": "csv", + "sButtonText": "Save to CSV" + }, + { + "sExtends": "xls", + "sButtonText": "Save for Excel" + } + ] + } + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/collection.html b/wqflask/wqflask/static/packages/TableTools/collection.html new file mode 100755 index 00000000..4eb3141b --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/collection.html @@ -0,0 +1,522 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table.css"; + @import "media/css/TableTools.css"; + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "aButtons": [ + "copy", + "print", + { + "sExtends": "collection", + "sButtonText": "Save", + "aButtons": [ "csv", "xls", "pdf" ] + } + ] + } + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example - button collections + </div> + + <h1>Preamble</h1> + <p>TableTools provides the ability to group buttons into a hidden drop down list, which is activated by clicking on a top-level button. This is achieved by extending the 'collection' predefined button type and setting it's <i>aButtons</i> parameter with the same options as the top level buttons (note that you cannot currently use a collection within a collection).</p> + <p>The example below shows the file save buttons grouped into a collection, while the copy and print buttons are left on the top level.</p> + + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "aButtons": [ + "copy", + "print", + { + "sExtends": "collection", + "sButtonText": "Save", + "aButtons": [ "csv", "xls", "pdf" ] + } + ] + } + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/defaults.html b/wqflask/wqflask/static/packages/TableTools/defaults.html new file mode 100755 index 00000000..5ef74a68 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/defaults.html @@ -0,0 +1,503 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table.css"; + @import "media/css/TableTools.css"; + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + TableTools.DEFAULTS.aButtons = [ "copy", "csv", "xls" ]; + + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip' + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example - changing the initialisation defaults + </div> + + <h1>Preamble</h1> + <p>TableTools provides the ability to override the default initialisation parameters that are used when creating a new instance. This this particularly useful if you have multiple tables which you want to have the same TableTools behaviour - rather than declaring the structure multiple times, you can just set the defaults once. This example shows how to alter the default buttons.</p> + + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + TableTools.DEFAULTS.aButtons = [ "copy", "csv", "xls" ]; + + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip' + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/index.html b/wqflask/wqflask/static/packages/TableTools/index.html new file mode 100755 index 00000000..06a2442d --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/index.html @@ -0,0 +1,499 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table.css"; + @import "media/css/TableTools.css"; + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip' + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example + </div> + + <h1>Preamble</h1> + <p>This example shows the basic initialisation of TableTools by simply including the 'T' marker in DataTables' sDom parameter. This tell DataTables to insert the TableTools toolbar in that location. Remember to include the Javascript and CSS source files as well!</p> + <p>It is worth noting that you might need to <a href="swf_path.html">set the <i>sSwfPath</i> parameter</a> to tell TableTools where to find the SWF file for copy and file save.</p> + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€ היצוא)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip' + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/media/as3/ZeroClipboard.as b/wqflask/wqflask/static/packages/TableTools/media/as3/ZeroClipboard.as new file mode 100755 index 00000000..d6b9c072 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/as3/ZeroClipboard.as @@ -0,0 +1,221 @@ +/* Compile using: mxmlc --target-player=10.0.0 ZeroClipboard.as */ +package { + import flash.display.Stage; + import flash.display.Sprite; + import flash.display.LoaderInfo; + import flash.display.StageScaleMode; + import flash.events.*; + import flash.display.StageAlign; + import flash.display.StageScaleMode; + import flash.external.ExternalInterface; + import flash.system.Security; + import flash.utils.*; + import flash.system.System; + import flash.net.FileReference; + import flash.net.FileFilter; + + public class ZeroClipboard extends Sprite { + + private var domId:String = ''; + private var button:Sprite; + private var clipText:String = 'blank'; + private var fileName:String = ''; + private var action:String = 'copy'; + private var incBom:Boolean = true; + private var charSet:String = 'utf8'; + + + public function ZeroClipboard() { + // constructor, setup event listeners and external interfaces + stage.scaleMode = StageScaleMode.EXACT_FIT; + flash.system.Security.allowDomain("*"); + + // import flashvars + var flashvars:Object = LoaderInfo( this.root.loaderInfo ).parameters; + domId = flashvars.id.split("\\").join("\\\\"); + + // invisible button covers entire stage + button = new Sprite(); + button.buttonMode = true; + button.useHandCursor = true; + button.graphics.beginFill(0x00FF00); + button.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight); + button.alpha = 0.0; + addChild(button); + + button.addEventListener(MouseEvent.CLICK, clickHandler); + button.addEventListener(MouseEvent.MOUSE_OVER, function(event:Event):void { + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseOver', null ); + } ); + button.addEventListener(MouseEvent.MOUSE_OUT, function(event:Event):void { + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseOut', null ); + } ); + button.addEventListener(MouseEvent.MOUSE_DOWN, function(event:Event):void { + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseDown', null ); + } ); + button.addEventListener(MouseEvent.MOUSE_UP, function(event:Event):void { + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseUp', null ); + } ); + + // External functions - readd whenever the stage is made active for IE + addCallbacks(); + stage.addEventListener(Event.ACTIVATE, addCallbacks); + + // signal to the browser that we are ready + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'load', null ); + } + + public function addCallbacks (evt:Event = null):void { + ExternalInterface.addCallback("setHandCursor", setHandCursor); + ExternalInterface.addCallback("clearText", clearText); + ExternalInterface.addCallback("setText", setText); + ExternalInterface.addCallback("appendText", appendText); + ExternalInterface.addCallback("setFileName", setFileName); + ExternalInterface.addCallback("setAction", setAction); + ExternalInterface.addCallback("setCharSet", setCharSet); + ExternalInterface.addCallback("setBomInc", setBomInc); + } + + + public function setCharSet(newCharSet:String):void { + if ( newCharSet == 'UTF16LE' ) { + charSet = newCharSet; + } else { + charSet = 'UTF8'; + } + } + + public function setBomInc(newBomInc:Boolean):void { + incBom = newBomInc; + } + + public function clearText():void { + clipText = ''; + } + + public function appendText(newText:String):void { + clipText += newText; + } + + public function setText(newText:String):void { + clipText = newText; + } + + public function setFileName(newFileName:String):void { + fileName = newFileName; + } + + public function setAction(newAction:String):void { + action = newAction; + } + + public function setHandCursor(enabled:Boolean):void { + // control whether the hand cursor is shown on rollover (true) + // or the default arrow cursor (false) + button.useHandCursor = enabled; + } + + + private function clickHandler(event:Event):void { + var fileRef:FileReference = new FileReference(); + fileRef.addEventListener(Event.COMPLETE, saveComplete); + + if ( action == "save" ) { + /* Save as a file */ + if ( charSet == 'UTF16LE' ) { + fileRef.save( strToUTF16LE(clipText), fileName ); + } else { + fileRef.save( strToUTF8(clipText), fileName ); + } + } else if ( action == "pdf" ) { + fileRef.save( "This instance of ZeroClipboard is not configured for PDF export. "+ + "Please use the PDF export version.", fileName+".txt" ); + } else { + /* Copy the text to the clipboard. Note charset and BOM have no effect here */ + System.setClipboard( clipText ); + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'complete', clipText ); + } + } + + + private function saveComplete(event:Event):void { + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'complete', clipText ); + } + + + private function getProp( prop:String, opts:Array ):String + { + var i:int, iLen:int; + for ( i=0, iLen=opts.length ; i<iLen ; i++ ) + { + if ( opts[i].indexOf( prop+":" ) != -1 ) + { + return opts[i].replace( prop+":", "" ); + } + } + return ""; + } + + + /* + * Function: strToUTF8 + * Purpose: Convert a string to the output utf-8 + * Returns: ByteArray + * Inputs: String + */ + private function strToUTF8( str:String ):ByteArray { + var utf8:ByteArray = new ByteArray(); + + /* BOM first */ + if ( incBom ) { + utf8.writeByte( 0xEF ); + utf8.writeByte( 0xBB ); + utf8.writeByte( 0xBF ); + } + utf8.writeUTFBytes( str ); + + return utf8; + } + + + /* + * Function: strToUTF16LE + * Purpose: Convert a string to the output utf-16 + * Returns: ByteArray + * Inputs: String + * Notes: The fact that this function is needed is a little annoying. Basically, strings in + * AS3 are UTF-16 (with surrogate pairs and everything), but characters which take up less + * than 8 bytes appear to be stored as only 8 bytes. This function effective adds the + * padding required, and the BOM + */ + private function strToUTF16LE( str:String ):ByteArray { + var utf16:ByteArray = new ByteArray(); + var iChar:uint; + var i:uint=0, iLen:uint = str.length; + + /* BOM first */ + if ( incBom ) { + utf16.writeByte( 0xFF ); + utf16.writeByte( 0xFE ); + } + + while ( i < iLen ) { + iChar = str.charCodeAt(i); + + if ( iChar < 0xFF ) { + /* one byte char */ + utf16.writeByte( iChar ); + utf16.writeByte( 0 ); + } else { + /* two byte char */ + utf16.writeByte( iChar & 0x00FF ); + utf16.writeByte( iChar >> 8 ); + } + + i++; + } + + return utf16; + } + } +} diff --git a/wqflask/wqflask/static/packages/TableTools/media/as3/ZeroClipboardPdf.as b/wqflask/wqflask/static/packages/TableTools/media/as3/ZeroClipboardPdf.as new file mode 100755 index 00000000..158d5f18 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/as3/ZeroClipboardPdf.as @@ -0,0 +1,310 @@ +/* Compile using: mxmlc --target-player=10.0.0 -static-link-runtime-shared-libraries=true -library-path+=lib ZeroClipboardPdf.as */ +package { + import flash.display.Stage; + import flash.display.Sprite; + import flash.display.LoaderInfo; + import flash.display.StageScaleMode; + import flash.events.*; + import flash.display.StageAlign; + import flash.display.StageScaleMode; + import flash.external.ExternalInterface; + import flash.system.Security; + import flash.utils.*; + import flash.system.System; + import flash.net.FileReference; + import flash.net.FileFilter; + + /* PDF imports */ + import org.alivepdf.pdf.PDF; + import org.alivepdf.data.Grid; + import org.alivepdf.data.GridColumn; + import org.alivepdf.layout.Orientation; + import org.alivepdf.layout.Size; + import org.alivepdf.layout.Unit; + import org.alivepdf.display.Display; + import org.alivepdf.saving.Method; + import org.alivepdf.fonts.FontFamily; + import org.alivepdf.fonts.Style; + import org.alivepdf.fonts.CoreFont; + import org.alivepdf.colors.RGBColor; + + public class ZeroClipboard extends Sprite { + + private var domId:String = ''; + private var button:Sprite; + private var clipText:String = 'blank'; + private var fileName:String = ''; + private var action:String = 'copy'; + private var incBom:Boolean = true; + private var charSet:String = 'utf8'; + + + public function ZeroClipboard() { + // constructor, setup event listeners and external interfaces + stage.scaleMode = StageScaleMode.EXACT_FIT; + flash.system.Security.allowDomain("*"); + + // import flashvars + var flashvars:Object = LoaderInfo( this.root.loaderInfo ).parameters; + domId = flashvars.id.split("\\").join("\\\\"); + + // invisible button covers entire stage + button = new Sprite(); + button.buttonMode = true; + button.useHandCursor = true; + button.graphics.beginFill(0x00FF00); + button.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight); + button.alpha = 0.0; + addChild(button); + + button.addEventListener(MouseEvent.CLICK, function(event:Event):void { + clickHandler(event); + } ); + button.addEventListener(MouseEvent.MOUSE_OVER, function(event:Event):void { + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseOver', null ); + } ); + button.addEventListener(MouseEvent.MOUSE_OUT, function(event:Event):void { + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseOut', null ); + } ); + button.addEventListener(MouseEvent.MOUSE_DOWN, function(event:Event):void { + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseDown', null ); + } ); + button.addEventListener(MouseEvent.MOUSE_UP, function(event:Event):void { + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseUp', null ); + } ); + + // External functions - readd whenever the stage is made active for IE + addCallbacks(); + stage.addEventListener(Event.ACTIVATE, addCallbacks); + + // signal to the browser that we are ready + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'load', null ); + } + + public function addCallbacks (evt:Event = null):void { + ExternalInterface.addCallback("setHandCursor", setHandCursor); + ExternalInterface.addCallback("clearText", clearText); + ExternalInterface.addCallback("setText", setText); + ExternalInterface.addCallback("appendText", appendText); + ExternalInterface.addCallback("setFileName", setFileName); + ExternalInterface.addCallback("setAction", setAction); + ExternalInterface.addCallback("setCharSet", setCharSet); + ExternalInterface.addCallback("setBomInc", setBomInc); + } + + + public function setCharSet(newCharSet:String):void { + if ( newCharSet == 'UTF16LE' ) { + charSet = newCharSet; + } else { + charSet = 'UTF8'; + } + } + + public function setBomInc(newBomInc:Boolean):void { + incBom = newBomInc; + } + + public function clearText():void { + clipText = ''; + } + + public function appendText(newText:String):void { + clipText += newText; + } + + public function setText(newText:String):void { + clipText = newText; + } + + public function setFileName(newFileName:String):void { + fileName = newFileName; + } + + public function setAction(newAction:String):void { + action = newAction; + } + + public function setHandCursor(enabled:Boolean):void { + // control whether the hand cursor is shown on rollover (true) + // or the default arrow cursor (false) + button.useHandCursor = enabled; + } + + + private function clickHandler(event:Event):void { + var fileRef:FileReference = new FileReference(); + fileRef.addEventListener(Event.COMPLETE, saveComplete); + + if ( action == "save" ) { + /* Save as a file */ + if ( charSet == 'UTF16LE' ) { + fileRef.save( strToUTF16LE(clipText), fileName ); + } else { + fileRef.save( strToUTF8(clipText), fileName ); + } + } else if ( action == "pdf" ) { + /* Save as a PDF */ + var pdf:PDF = configPdf(); + fileRef.save( pdf.save( Method.LOCAL ), fileName ); + } else { + /* Copy the text to the clipboard. Note charset and BOM have no effect here */ + System.setClipboard( clipText ); + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'complete', clipText ); + } + } + + + private function saveComplete(event:Event):void { + ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'complete', clipText ); + } + + + private function getProp( prop:String, opts:Array ):String + { + var i:int, iLen:int; + for ( i=0, iLen=opts.length ; i<iLen ; i++ ) + { + if ( opts[i].indexOf( prop+":" ) != -1 ) + { + return opts[i].replace( prop+":", "" ); + } + } + return ""; + } + + + private function configPdf():PDF + { + var + pdf:PDF, + i:int, iLen:int, + splitText:Array = clipText.split("--/TableToolsOpts--\n"), + opts:Array = splitText[0].split("\n"), + dataIn:Array = splitText[1].split("\n"), + aColRatio:Array = getProp( 'colWidth', opts ).split('\t'), + title:String = getProp( 'title', opts ), + message:String = getProp( 'message', opts ), + orientation:String = getProp( 'orientation', opts ), + size:String = getProp( 'size', opts ), + iPageWidth:int = 0, + dataOut:Array = [], + columns:Array = [], + headers:Array, + y:int = 0; + + /* Create the PDF */ + pdf = new PDF( Orientation[orientation.toUpperCase()], Unit.MM, Size[size.toUpperCase()] ); + pdf.setDisplayMode( Display.FULL_WIDTH ); + pdf.addPage(); + iPageWidth = pdf.getCurrentPage().w-20; + pdf.textStyle( new RGBColor(0), 1 ); + + /* Add the title / message if there is one */ + pdf.setFont( new CoreFont(FontFamily.HELVETICA), 14 ); + if ( title != "" ) + { + pdf.writeText(11, title+"\n"); + } + + pdf.setFont( new CoreFont(FontFamily.HELVETICA), 11 ); + if ( message != "" ) + { + pdf.writeText(11, message+"\n"); + } + + /* Data setup. Split up the headers, and then construct the columns */ + for ( i=0, iLen=dataIn.length ; i<iLen ; i++ ) + { + if ( dataIn[i] != "" ) + { + dataOut.push( dataIn[i].split("\t") ); + } + } + headers = dataOut.shift(); + + for ( i=0, iLen=headers.length ; i<iLen ; i++ ) + { + columns.push( new GridColumn( " \n"+headers[i]+"\n ", i.toString(), aColRatio[i]*iPageWidth, 'C' ) ); + } + + var grid:Grid = new Grid( + dataOut, /* 1. data */ + iPageWidth, /* 2. width */ + 100, /* 3. height */ + new RGBColor (0xE0E0E0), /* 4. headerColor */ + new RGBColor (0xFFFFFF), /* 5. backgroundColor */ + true, /* 6. alternateRowColor */ + new RGBColor ( 0x0 ), /* 7. borderColor */ + .1, /* 8. border alpha */ + null, /* 9. joins */ + columns /* 10. columns */ + ); + + pdf.addGrid( grid, 0, y ); + return pdf; + } + + + /* + * Function: strToUTF8 + * Purpose: Convert a string to the output utf-8 + * Returns: ByteArray + * Inputs: String + */ + private function strToUTF8( str:String ):ByteArray { + var utf8:ByteArray = new ByteArray(); + + /* BOM first */ + if ( incBom ) { + utf8.writeByte( 0xEF ); + utf8.writeByte( 0xBB ); + utf8.writeByte( 0xBF ); + } + utf8.writeUTFBytes( str ); + + return utf8; + } + + + /* + * Function: strToUTF16LE + * Purpose: Convert a string to the output utf-16 + * Returns: ByteArray + * Inputs: String + * Notes: The fact that this function is needed is a little annoying. Basically, strings in + * AS3 are UTF-16 (with surrogate pairs and everything), but characters which take up less + * than 8 bytes appear to be stored as only 8 bytes. This function effective adds the + * padding required, and the BOM + */ + private function strToUTF16LE( str:String ):ByteArray { + var utf16:ByteArray = new ByteArray(); + var iChar:uint; + var i:uint=0, iLen:uint = str.length; + + /* BOM first */ + if ( incBom ) { + utf16.writeByte( 0xFF ); + utf16.writeByte( 0xFE ); + } + + while ( i < iLen ) { + iChar = str.charCodeAt(i); + + if ( iChar < 0xFF ) { + /* one byte char */ + utf16.writeByte( iChar ); + utf16.writeByte( 0 ); + } else { + /* two byte char */ + utf16.writeByte( iChar & 0x00FF ); + utf16.writeByte( iChar >> 8 ); + } + + i++; + } + + return utf16; + } + } +} diff --git a/wqflask/wqflask/static/packages/TableTools/media/as3/lib/AlivePDF.swc b/wqflask/wqflask/static/packages/TableTools/media/as3/lib/AlivePDF.swc Binary files differnew file mode 100644 index 00000000..ee0f3f8f --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/as3/lib/AlivePDF.swc diff --git a/wqflask/wqflask/static/packages/TableTools/media/css/TableTools.css b/wqflask/wqflask/static/packages/TableTools/media/css/TableTools.css new file mode 100755 index 00000000..705008b0 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/css/TableTools.css @@ -0,0 +1,321 @@ +/* + * File: TableTools.css + * Description: Styles for TableTools 2 + * Author: Allan Jardine (www.sprymedia.co.uk) + * Language: Javascript + * License: GPL v2 / 3 point BSD + * Project: DataTables + * + * Copyright 2009-2012 Allan Jardine, all rights reserved. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * CSS name space: + * DTTT DataTables TableTools + * + * 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 + */ + + +/* + * CONTAINER + * TableTools container element and styles applying to all components + */ +div.DTTT_container { + position: relative; + float: right; + margin-bottom: 1em; +} + +button.DTTT_button, +div.DTTT_button, +a.DTTT_button { + position: relative; + float: left; + margin-right: 3px; + padding: 5px 8px; + border: 1px solid #999; + cursor: pointer; + *cursor: hand; + font-size: 0.88em; + color: black !important; + + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + -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 */ +} + + +/* Buttons are cunning border-box sizing - we can't just use that for A and DIV due to IE6/7 */ +button.DTTT_button { + height: 30px; + padding: 3px 8px; +} + +.DTTT_button embed { + outline: none; +} + +button.DTTT_button:hover, +div.DTTT_button:hover, +a.DTTT_button:hover { + border: 1px solid #666; + text-decoration: none !important; + + -webkit-box-shadow: 1px 1px 3px #999; + -moz-box-shadow: 1px 1px 3px #999; + -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, +a.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 + +a.DTTT_button_csv, +a.DTTT_button_xls, +a.DTTT_button_copy, +a.DTTT_button_pdf, +a.DTTT_button_print { + padding-right: 0px; +} + +a.DTTT_button_csv span, +a.DTTT_button_xls span, +a.DTTT_button_copy span, +a.DTTT_button_pdf span, +a.DTTT_button_print span { + display: inline-block; + height: 24px; + line-height: 24px; + padding-right: 30px; +} + + +a.DTTT_button_csv span { background: url(../images/csv.png) no-repeat bottom right; } +a.DTTT_button_csv:hover span { background: url(../images/csv_hover.png) no-repeat center right; } + +a.DTTT_button_xls span { background: url(../images/xls.png) no-repeat center right; } +a.DTTT_button_xls:hover span { background: #f0f0f0 url(../images/xls_hover.png) no-repeat center right; } + +a.DTTT_button_copy span { background: url(../images/copy.png) no-repeat center right; } +a.DTTT_button_copy:hover span { background: #f0f0f0 url(../images/copy_hover.png) no-repeat center right; } + +a.DTTT_button_pdf span { background: url(../images/pdf.png) no-repeat center right; } +a.DTTT_button_pdf:hover span { background: #f0f0f0 url(../images/pdf_hover.png) no-repeat center right; } + +a.DTTT_button_print span { background: url(../images/print.png) no-repeat center right; } +a.DTTT_button_print:hover span { background: #f0f0f0 url(../images/print_hover.png) no-repeat center right; } + + */ + +button.DTTT_button_collection span { + padding-right: 17px; + background: url(../images/collection.png) no-repeat center right; +} + +button.DTTT_button_collection:hover span { + padding-right: 17px; + background: #f0f0f0 url(../images/collection_hover.png) no-repeat center right; +} + + +/* + * SELECTING + * Row selection styles + */ +table.DTTT_selectable tbody tr { + cursor: pointer; + *cursor: hand; +} + +table.dataTable tr.DTTT_selected.odd { + background-color: #9FAFD1; +} + +table.dataTable tr.DTTT_selected.odd td.sorting_1 { + background-color: #9FAFD1; +} + +table.dataTable tr.DTTT_selected.odd td.sorting_2 { + background-color: #9FAFD1; +} + +table.dataTable tr.DTTT_selected.odd td.sorting_3 { + background-color: #9FAFD1; +} + + +table.dataTable tr.DTTT_selected.even { + background-color: #B0BED9; +} + +table.dataTable tr.DTTT_selected.even td.sorting_1 { + background-color: #B0BED9; +} + +table.dataTable tr.DTTT_selected.even td.sorting_2 { + background-color: #B0BED9; +} + +table.dataTable tr.DTTT_selected.even td.sorting_3 { + background-color: #B0BED9; +} + + +/* + * COLLECTIONS + * Drop down list (collection) styles + */ + +div.DTTT_collection { + width: 150px; + padding: 8px 8px 4px 8px; + border: 1px solid #ccc; + border: 1px solid rgba( 0, 0, 0, 0.4 ); + background-color: #f3f3f3; + background-color: rgba( 255, 255, 255, 0.3 ); + overflow: hidden; + z-index: 2002; + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -ms-border-radius: 5px; + -o-border-radius: 5px; + border-radius: 5px; + + -webkit-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); + -moz-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); + -ms-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); + -o-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); + box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); +} + +div.DTTT_collection_background { + background: transparent url(../images/background.png) repeat top left; + z-index: 2001; +} + +div.DTTT_collection button.DTTT_button, +div.DTTT_collection div.DTTT_button, +div.DTTT_collection a.DTTT_button { + position: relative; + left: 0; + right: 0; + + display: block; + float: none; + margin-bottom: 4px; + + -webkit-box-shadow: 1px 1px 3px #999; + -moz-box-shadow: 1px 1px 3px #999; + -ms-box-shadow: 1px 1px 3px #999; + -o-box-shadow: 1px 1px 3px #999; + box-shadow: 1px 1px 3px #999; +} + + +/* + * PRINTING + * Print display styles + */ + +.DTTT_print_info { + position: fixed; + top: 50%; + left: 50%; + width: 400px; + height: 150px; + margin-left: -200px; + margin-top: -75px; + text-align: center; + color: #333; + padding: 10px 30px; + + background: #ffffff; /* Old browsers */ + background: -webkit-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* FF3.6+ */ + background: -ms-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* IE10+ */ + background: -o-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Opera 11.10+ */ + background: linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f9f9f9',GradientType=0 ); /* IE6-9 */ + + opacity: 0.95; + + border: 1px solid black; + border: 1px solid rgba(0, 0, 0, 0.5); + + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + -ms-border-radius: 6px; + -o-border-radius: 6px; + border-radius: 6px; + + -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); + -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); + -ms-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); + -o-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); + box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); +} + +.DTTT_print_info h6 { + font-weight: normal; + font-size: 28px; + line-height: 28px; + margin: 1em; +} + +.DTTT_print_info p { + font-size: 14px; + line-height: 20px; +} + diff --git a/wqflask/wqflask/static/packages/TableTools/media/css/TableTools_JUI.css b/wqflask/wqflask/static/packages/TableTools/media/css/TableTools_JUI.css new file mode 100755 index 00000000..4c41138e --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/css/TableTools_JUI.css @@ -0,0 +1,185 @@ +/* + * File: TableTools.css + * Description: Styles for TableTools 2 with JUI theming + * Author: Allan Jardine (www.sprymedia.co.uk) + * Language: Javascript + * License: LGPL / 3 point BSD + * Project: DataTables + * + * Copyright 2010 Allan Jardine, all rights reserved. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Notes: + * Generally speaking, please refer to the TableTools.css file - this file contains basic + * modifications to that 'master' stylesheet for ThemeRoller. + * + * 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 + * SELECTING Row selection styles + * COLLECTIONS Drop down list (collection) styles + * PRINTING Print display styles + * MISC Minor misc styles + */ + + +/* + * CONTAINER + * TableTools container element and styles applying to all components + */ +div.DTTT_container { + position: relative; + float: left; +} + +.DTTT_button { + position: relative; + float: left; + margin-right: 3px; + padding: 3px 10px; + border: 1px solid #d0d0d0; + background-color: #fff; + color: #333 !important; + cursor: pointer; + *cursor: hand; +} + +.DTTT_button::-moz-focus-inner { + border: none !important; + padding: 0; +} + + + +/* + * SELECTING + * Row selection styles + */ +table.DTTT_selectable tbody tr { + cursor: pointer; + *cursor: hand; +} + +table.dataTable tr.DTTT_selected.odd { + background-color: #9FAFD1; +} + +table.dataTable tr.DTTT_selected.odd td.sorting_1 { + background-color: #9FAFD1; +} + +table.dataTable tr.DTTT_selected.odd td.sorting_2 { + background-color: #9FAFD1; +} + +table.dataTable tr.DTTT_selected.odd td.sorting_3 { + background-color: #9FAFD1; +} + + +table.dataTable tr.DTTT_selected.even { + background-color: #B0BED9; +} + +table.dataTable tr.DTTT_selected.even td.sorting_1 { + background-color: #B0BED9; +} + +table.dataTable tr.DTTT_selected.even td.sorting_2 { + background-color: #B0BED9; +} + +table.dataTable tr.DTTT_selected.even td.sorting_3 { + background-color: #B0BED9; +} + + +/* + * COLLECTIONS + * Drop down list (collection) styles + */ + +div.DTTT_collection { + width: 150px; + background-color: #f3f3f3; + overflow: hidden; + z-index: 2002; + + 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); +} + +div.DTTT_collection_background { + background: url(../images/background.png) repeat top left; + z-index: 2001; +} + +div.DTTT_collection button.DTTT_button, +div.DTTT_collection div.DTTT_button, +div.DTTT_collection a.DTTT_button { + float: none; + width: 100%; + margin-bottom: -0.1em; +} + + +/* + * PRINTING + * Print display styles + */ + +.DTTT_print_info { + position: fixed; + top: 50%; + left: 50%; + width: 400px; + height: 150px; + margin-left: -200px; + margin-top: -75px; + text-align: center; + background-color: #3f3f3f; + color: white; + padding: 10px 30px; + + opacity: 0.9; + + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-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); +} + +.DTTT_print_info h6 { + font-weight: normal; + font-size: 28px; + line-height: 28px; + margin: 1em; +} + +.DTTT_print_info p { + font-size: 14px; + line-height: 20px; +} + + +/* + * MISC + * Minor misc styles + */ + +.DTTT_disabled { + color: #999; +} diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/background.png b/wqflask/wqflask/static/packages/TableTools/media/images/background.png Binary files differnew file mode 100644 index 00000000..915efba6 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/background.png diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/collection.png b/wqflask/wqflask/static/packages/TableTools/media/images/collection.png Binary files differnew file mode 100644 index 00000000..5dd4dfdf --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/collection.png diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/collection_hover.png b/wqflask/wqflask/static/packages/TableTools/media/images/collection_hover.png Binary files differnew file mode 100644 index 00000000..7b37b1e9 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/collection_hover.png diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/copy.png b/wqflask/wqflask/static/packages/TableTools/media/images/copy.png Binary files differnew file mode 100755 index 00000000..5b01ab16 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/copy.png diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/copy_hover.png b/wqflask/wqflask/static/packages/TableTools/media/images/copy_hover.png Binary files differnew file mode 100755 index 00000000..039a7fc3 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/copy_hover.png diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/csv.png b/wqflask/wqflask/static/packages/TableTools/media/images/csv.png Binary files differnew file mode 100755 index 00000000..43df1559 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/csv.png diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/csv_hover.png b/wqflask/wqflask/static/packages/TableTools/media/images/csv_hover.png Binary files differnew file mode 100755 index 00000000..10b34d3b --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/csv_hover.png diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/pdf.png b/wqflask/wqflask/static/packages/TableTools/media/images/pdf.png Binary files differnew file mode 100644 index 00000000..1b038d08 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/pdf.png diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/pdf_hover.png b/wqflask/wqflask/static/packages/TableTools/media/images/pdf_hover.png Binary files differnew file mode 100644 index 00000000..eb06855f --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/pdf_hover.png diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/print.png b/wqflask/wqflask/static/packages/TableTools/media/images/print.png Binary files differnew file mode 100755 index 00000000..2db08242 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/print.png diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/print_hover.png b/wqflask/wqflask/static/packages/TableTools/media/images/print_hover.png Binary files differnew file mode 100755 index 00000000..9808a9cc --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/print_hover.png diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/psd/collection.psd b/wqflask/wqflask/static/packages/TableTools/media/images/psd/collection.psd Binary files differnew file mode 100644 index 00000000..7eb7caf2 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/psd/collection.psd diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/psd/copy document.psd b/wqflask/wqflask/static/packages/TableTools/media/images/psd/copy document.psd Binary files differnew file mode 100755 index 00000000..ca207adc --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/psd/copy document.psd diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/psd/file_types.psd b/wqflask/wqflask/static/packages/TableTools/media/images/psd/file_types.psd Binary files differnew file mode 100755 index 00000000..0f280ad5 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/psd/file_types.psd diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/psd/printer.psd b/wqflask/wqflask/static/packages/TableTools/media/images/psd/printer.psd Binary files differnew file mode 100755 index 00000000..8c33f7aa --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/psd/printer.psd diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/xls.png b/wqflask/wqflask/static/packages/TableTools/media/images/xls.png Binary files differnew file mode 100755 index 00000000..5aaf40d0 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/xls.png diff --git a/wqflask/wqflask/static/packages/TableTools/media/images/xls_hover.png b/wqflask/wqflask/static/packages/TableTools/media/images/xls_hover.png Binary files differnew file mode 100755 index 00000000..5b1930af --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/images/xls_hover.png diff --git a/wqflask/wqflask/static/packages/TableTools/media/js/TableTools.js b/wqflask/wqflask/static/packages/TableTools/media/js/TableTools.js new file mode 100755 index 00000000..3c3ae911 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/js/TableTools.js @@ -0,0 +1,2476 @@ +/* + * File: TableTools.js + * Version: 2.1.5 + * Description: Tools and buttons for DataTables + * Author: Allan Jardine (www.sprymedia.co.uk) + * Language: Javascript + * License: GPL v2 or BSD 3 point style + * Project: DataTables + * + * Copyright 2009-2013 Allan Jardine, all rights reserved. + * + * This source file is free software, under either the GPL v2 license or a + * BSD style license, available at: + * http://datatables.net/license_gpl2 + * http://datatables.net/license_bsd + */ + +/* Global scope for TableTools */ +var TableTools; + +(function($, window, document) { + +/** + * TableTools provides flexible buttons and other tools for a DataTables enhanced table + * @class TableTools + * @constructor + * @param {Object} oDT DataTables instance + * @param {Object} oOpts TableTools options + * @param {String} oOpts.sSwfPath ZeroClipboard SWF path + * @param {String} oOpts.sRowSelect Row selection options - 'none', 'single' or 'multi' + * @param {Function} oOpts.fnPreRowSelect Callback function just prior to row selection + * @param {Function} oOpts.fnRowSelected Callback function just after row selection + * @param {Function} oOpts.fnRowDeselected Callback function when row is deselected + * @param {Array} oOpts.aButtons List of buttons to be used + */ +TableTools = function( oDT, oOpts ) +{ + /* Santiy check that we are a new instance */ + if ( ! this instanceof TableTools ) + { + alert( "Warning: TableTools must be initialised with the keyword 'new'" ); + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public class variables + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + /** + * @namespace Settings object which contains customisable information for TableTools instance + */ + this.s = { + /** + * Store 'this' so the instance can be retrieved from the settings object + * @property that + * @type object + * @default this + */ + "that": this, + + /** + * DataTables settings objects + * @property dt + * @type object + * @default <i>From the oDT init option</i> + */ + "dt": oDT.fnSettings(), + + /** + * @namespace Print specific information + */ + "print": { + /** + * DataTables draw 'start' point before the printing display was shown + * @property saveStart + * @type int + * @default -1 + */ + "saveStart": -1, + + /** + * DataTables draw 'length' point before the printing display was shown + * @property saveLength + * @type int + * @default -1 + */ + "saveLength": -1, + + /** + * Page scrolling point before the printing display was shown so it can be restored + * @property saveScroll + * @type int + * @default -1 + */ + "saveScroll": -1, + + /** + * Wrapped function to end the print display (to maintain scope) + * @property funcEnd + * @type Function + * @default function () {} + */ + "funcEnd": function () {} + }, + + /** + * A unique ID is assigned to each button in each instance + * @property buttonCounter + * @type int + * @default 0 + */ + "buttonCounter": 0, + + /** + * @namespace Select rows specific information + */ + "select": { + /** + * Select type - can be 'none', 'single' or 'multi' + * @property type + * @type string + * @default "" + */ + "type": "", + + /** + * Array of nodes which are currently selected + * @property selected + * @type array + * @default [] + */ + "selected": [], + + /** + * Function to run before the selection can take place. Will cancel the select if the + * function returns false + * @property preRowSelect + * @type Function + * @default null + */ + "preRowSelect": null, + + /** + * Function to run when a row is selected + * @property postSelected + * @type Function + * @default null + */ + "postSelected": null, + + /** + * Function to run when a row is deselected + * @property postDeselected + * @type Function + * @default null + */ + "postDeselected": null, + + /** + * Indicate if all rows are selected (needed for server-side processing) + * @property all + * @type boolean + * @default false + */ + "all": false, + + /** + * Class name to add to selected TR nodes + * @property selectedClass + * @type String + * @default "" + */ + "selectedClass": "" + }, + + /** + * Store of the user input customisation object + * @property custom + * @type object + * @default {} + */ + "custom": {}, + + /** + * SWF movie path + * @property swfPath + * @type string + * @default "" + */ + "swfPath": "", + + /** + * Default button set + * @property buttonSet + * @type array + * @default [] + */ + "buttonSet": [], + + /** + * When there is more than one TableTools instance for a DataTable, there must be a + * master which controls events (row selection etc) + * @property master + * @type boolean + * @default false + */ + "master": false, + + /** + * Tag names that are used for creating collections and buttons + * @namesapce + */ + "tags": {} + }; + + + /** + * @namespace Common and useful DOM elements for the class instance + */ + this.dom = { + /** + * DIV element that is create and all TableTools buttons (and their children) put into + * @property container + * @type node + * @default null + */ + "container": null, + + /** + * The table node to which TableTools will be applied + * @property table + * @type node + * @default null + */ + "table": null, + + /** + * @namespace Nodes used for the print display + */ + "print": { + /** + * Nodes which have been removed from the display by setting them to display none + * @property hidden + * @type array + * @default [] + */ + "hidden": [], + + /** + * The information display saying telling the user about the print display + * @property message + * @type node + * @default null + */ + "message": null + }, + + /** + * @namespace Nodes used for a collection display. This contains the currently used collection + */ + "collection": { + /** + * The div wrapper containing the buttons in the collection (i.e. the menu) + * @property collection + * @type node + * @default null + */ + "collection": null, + + /** + * Background display to provide focus and capture events + * @property background + * @type node + * @default null + */ + "background": null + } + }; + + /** + * @namespace Name space for the classes that this TableTools instance will use + * @extends TableTools.classes + */ + this.classes = $.extend( true, {}, TableTools.classes ); + if ( this.s.dt.bJUI ) + { + $.extend( true, this.classes, TableTools.classes_themeroller ); + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public class methods + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + /** + * Retreieve the settings object from an instance + * @method fnSettings + * @returns {object} TableTools settings object + */ + this.fnSettings = function () { + return this.s; + }; + + + /* Constructor logic */ + if ( typeof oOpts == 'undefined' ) + { + oOpts = {}; + } + + this._fnConstruct( oOpts ); + + return this; +}; + + + +TableTools.prototype = { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + /** + * Retreieve the settings object from an instance + * @returns {array} List of TR nodes which are currently selected + * @param {boolean} [filtered=false] Get only selected rows which are + * available given the filtering applied to the table. By default + * this is false - i.e. all rows, regardless of filtering are + selected. + */ + "fnGetSelected": function ( filtered ) + { + var + out = [], + data = this.s.dt.aoData, + displayed = this.s.dt.aiDisplay, + i, iLen; + + if ( filtered ) + { + // Only consider filtered rows + for ( i=0, iLen=displayed.length ; i<iLen ; i++ ) + { + if ( data[ displayed[i] ]._DTTT_selected ) + { + out.push( data[ displayed[i] ].nTr ); + } + } + } + else + { + // Use all rows + for ( i=0, iLen=data.length ; i<iLen ; i++ ) + { + if ( data[i]._DTTT_selected ) + { + out.push( data[i].nTr ); + } + } + } + + return out; + }, + + + /** + * Get the data source objects/arrays from DataTables for the selected rows (same as + * fnGetSelected followed by fnGetData on each row from the table) + * @returns {array} Data from the TR nodes which are currently selected + */ + "fnGetSelectedData": function () + { + var out = []; + var data=this.s.dt.aoData; + var i, iLen; + + for ( i=0, iLen=data.length ; i<iLen ; i++ ) + { + if ( data[i]._DTTT_selected ) + { + out.push( this.s.dt.oInstance.fnGetData(i) ); + } + } + + return out; + }, + + + /** + * Check to see if a current row is selected or not + * @param {Node} n TR node to check if it is currently selected or not + * @returns {Boolean} true if select, false otherwise + */ + "fnIsSelected": function ( n ) + { + var pos = this.s.dt.oInstance.fnGetPosition( n ); + return (this.s.dt.aoData[pos]._DTTT_selected===true) ? true : false; + }, + + + /** + * Select all rows in the table + * @param {boolean} [filtered=false] Select only rows which are available + * given the filtering applied to the table. By default this is false - + * i.e. all rows, regardless of filtering are selected. + */ + "fnSelectAll": function ( filtered ) + { + var s = this._fnGetMasterSettings(); + + this._fnRowSelect( (filtered === true) ? + s.dt.aiDisplay : + s.dt.aoData + ); + }, + + + /** + * Deselect all rows in the table + * @param {boolean} [filtered=false] Deselect only rows which are available + * given the filtering applied to the table. By default this is false - + * i.e. all rows, regardless of filtering are deselected. + */ + "fnSelectNone": function ( filtered ) + { + var s = this._fnGetMasterSettings(); + + this._fnRowDeselect( this.fnGetSelected(filtered) ); + }, + + + /** + * Select row(s) + * @param {node|object|array} n The row(s) to select. Can be a single DOM + * TR node, an array of TR nodes or a jQuery object. + */ + "fnSelect": function ( n ) + { + if ( this.s.select.type == "single" ) + { + this.fnSelectNone(); + this._fnRowSelect( n ); + } + else if ( this.s.select.type == "multi" ) + { + this._fnRowSelect( n ); + } + }, + + + /** + * Deselect row(s) + * @param {node|object|array} n The row(s) to deselect. Can be a single DOM + * TR node, an array of TR nodes or a jQuery object. + */ + "fnDeselect": function ( n ) + { + this._fnRowDeselect( n ); + }, + + + /** + * Get the title of the document - useful for file names. The title is retrieved from either + * the configuration object's 'title' parameter, or the HTML document title + * @param {Object} oConfig Button configuration object + * @returns {String} Button title + */ + "fnGetTitle": function( oConfig ) + { + var sTitle = ""; + if ( typeof oConfig.sTitle != 'undefined' && oConfig.sTitle !== "" ) { + sTitle = oConfig.sTitle; + } else { + var anTitle = document.getElementsByTagName('title'); + if ( anTitle.length > 0 ) + { + sTitle = anTitle[0].innerHTML; + } + } + + /* Strip characters which the OS will object to - checking for UTF8 support in the scripting + * engine + */ + if ( "\u00A1".toString().length < 4 ) { + return sTitle.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g, ""); + } else { + return sTitle.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g, ""); + } + }, + + + /** + * Calculate a unity array with the column width by proportion for a set of columns to be + * included for a button. This is particularly useful for PDF creation, where we can use the + * column widths calculated by the browser to size the columns in the PDF. + * @param {Object} oConfig Button configuration object + * @returns {Array} Unity array of column ratios + */ + "fnCalcColRatios": function ( oConfig ) + { + var + aoCols = this.s.dt.aoColumns, + aColumnsInc = this._fnColumnTargets( oConfig.mColumns ), + aColWidths = [], + iWidth = 0, iTotal = 0, i, iLen; + + for ( i=0, iLen=aColumnsInc.length ; i<iLen ; i++ ) + { + if ( aColumnsInc[i] ) + { + iWidth = aoCols[i].nTh.offsetWidth; + iTotal += iWidth; + aColWidths.push( iWidth ); + } + } + + for ( i=0, iLen=aColWidths.length ; i<iLen ; i++ ) + { + aColWidths[i] = aColWidths[i] / iTotal; + } + + return aColWidths.join('\t'); + }, + + + /** + * Get the information contained in a table as a string + * @param {Object} oConfig Button configuration object + * @returns {String} Table data as a string + */ + "fnGetTableData": function ( oConfig ) + { + /* In future this could be used to get data from a plain HTML source as well as DataTables */ + if ( this.s.dt ) + { + return this._fnGetDataTablesData( oConfig ); + } + }, + + + /** + * Pass text to a flash button instance, which will be used on the button's click handler + * @param {Object} clip Flash button object + * @param {String} text Text to set + */ + "fnSetText": function ( clip, text ) + { + this._fnFlashSetText( clip, text ); + }, + + + /** + * Resize the flash elements of the buttons attached to this TableTools instance - this is + * useful for when initialising TableTools when it is hidden (display:none) since sizes can't + * be calculated at that time. + */ + "fnResizeButtons": function () + { + for ( var cli in ZeroClipboard_TableTools.clients ) + { + if ( cli ) + { + var client = ZeroClipboard_TableTools.clients[cli]; + if ( typeof client.domElement != 'undefined' && + client.domElement.parentNode ) + { + client.positionElement(); + } + } + } + }, + + + /** + * Check to see if any of the ZeroClipboard client's attached need to be resized + */ + "fnResizeRequired": function () + { + for ( var cli in ZeroClipboard_TableTools.clients ) + { + if ( cli ) + { + var client = ZeroClipboard_TableTools.clients[cli]; + if ( typeof client.domElement != 'undefined' && + client.domElement.parentNode == this.dom.container && + client.sized === false ) + { + return true; + } + } + } + return false; + }, + + + /** + * Programmatically enable or disable the print view + * @param {boolean} [bView=true] Show the print view if true or not given. If false, then + * terminate the print view and return to normal. + * @param {object} [oConfig={}] Configuration for the print view + * @param {boolean} [oConfig.bShowAll=false] Show all rows in the table if true + * @param {string} [oConfig.sInfo] Information message, displayed as an overlay to the + * user to let them know what the print view is. + * @param {string} [oConfig.sMessage] HTML string to show at the top of the document - will + * be included in the printed document. + */ + "fnPrint": function ( bView, oConfig ) + { + if ( oConfig === undefined ) + { + oConfig = {}; + } + + if ( bView === undefined || bView ) + { + this._fnPrintStart( oConfig ); + } + else + { + this._fnPrintEnd(); + } + }, + + + /** + * Show a message to the end user which is nicely styled + * @param {string} message The HTML string to show to the user + * @param {int} time The duration the message is to be shown on screen for (mS) + */ + "fnInfo": function ( message, time ) { + var nInfo = document.createElement( "div" ); + nInfo.className = this.classes.print.info; + nInfo.innerHTML = message; + + document.body.appendChild( nInfo ); + + setTimeout( function() { + $(nInfo).fadeOut( "normal", function() { + document.body.removeChild( nInfo ); + } ); + }, time ); + }, + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private methods (they are of course public in JS, but recommended as private) + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + /** + * Constructor logic + * @method _fnConstruct + * @param {Object} oOpts Same as TableTools constructor + * @returns void + * @private + */ + "_fnConstruct": function ( oOpts ) + { + var that = this; + + this._fnCustomiseSettings( oOpts ); + + /* Container element */ + this.dom.container = document.createElement( this.s.tags.container ); + this.dom.container.className = this.classes.container; + + /* Row selection config */ + if ( this.s.select.type != 'none' ) + { + this._fnRowSelectConfig(); + } + + /* Buttons */ + this._fnButtonDefinations( this.s.buttonSet, this.dom.container ); + + /* Destructor */ + this.s.dt.aoDestroyCallback.push( { + "sName": "TableTools", + "fn": function () { + $(that.s.dt.nTBody).off( 'click.DTTT_Select', 'tr' ); + $(that.dom.container).empty(); + } + } ); + }, + + + /** + * Take the user defined settings and the default settings and combine them. + * @method _fnCustomiseSettings + * @param {Object} oOpts Same as TableTools constructor + * @returns void + * @private + */ + "_fnCustomiseSettings": function ( oOpts ) + { + /* Is this the master control instance or not? */ + if ( typeof this.s.dt._TableToolsInit == 'undefined' ) + { + this.s.master = true; + this.s.dt._TableToolsInit = true; + } + + /* We can use the table node from comparisons to group controls */ + this.dom.table = this.s.dt.nTable; + + /* Clone the defaults and then the user options */ + this.s.custom = $.extend( {}, TableTools.DEFAULTS, oOpts ); + + /* Flash file location */ + this.s.swfPath = this.s.custom.sSwfPath; + if ( typeof ZeroClipboard_TableTools != 'undefined' ) + { + ZeroClipboard_TableTools.moviePath = this.s.swfPath; + } + + /* Table row selecting */ + 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; + + // Backwards compatibility - allow the user to specify a custom class in the initialiser + if ( this.s.custom.sSelectedClass ) + { + this.classes.select.row = this.s.custom.sSelectedClass; + } + + this.s.tags = this.s.custom.oTags; + + /* Button set */ + this.s.buttonSet = this.s.custom.aButtons; + }, + + + /** + * Take the user input arrays and expand them to be fully defined, and then add them to a given + * DOM element + * @method _fnButtonDefinations + * @param {array} buttonSet Set of user defined buttons + * @param {node} wrapper Node to add the created buttons to + * @returns void + * @private + */ + "_fnButtonDefinations": function ( buttonSet, wrapper ) + { + var buttonDef; + + for ( var i=0, iLen=buttonSet.length ; i<iLen ; i++ ) + { + if ( typeof buttonSet[i] == "string" ) + { + if ( typeof TableTools.BUTTONS[ buttonSet[i] ] == 'undefined' ) + { + alert( "TableTools: Warning - unknown button type: "+buttonSet[i] ); + continue; + } + buttonDef = $.extend( {}, TableTools.BUTTONS[ buttonSet[i] ], true ); + } + else + { + if ( typeof TableTools.BUTTONS[ buttonSet[i].sExtends ] == 'undefined' ) + { + alert( "TableTools: Warning - unknown button type: "+buttonSet[i].sExtends ); + continue; + } + var o = $.extend( {}, TableTools.BUTTONS[ buttonSet[i].sExtends ], true ); + buttonDef = $.extend( o, buttonSet[i], true ); + } + + wrapper.appendChild( this._fnCreateButton( + buttonDef, + $(wrapper).hasClass(this.classes.collection.container) + ) ); + } + }, + + + /** + * Create and configure a TableTools button + * @method _fnCreateButton + * @param {Object} oConfig Button configuration object + * @returns {Node} Button element + * @private + */ + "_fnCreateButton": function ( oConfig, bCollectionButton ) + { + var nButton = this._fnButtonBase( oConfig, bCollectionButton ); + + if ( oConfig.sAction.match(/flash/) ) + { + this._fnFlashConfig( nButton, oConfig ); + } + else if ( oConfig.sAction == "text" ) + { + this._fnTextConfig( nButton, oConfig ); + } + else if ( oConfig.sAction == "div" ) + { + this._fnTextConfig( nButton, oConfig ); + } + else if ( oConfig.sAction == "collection" ) + { + this._fnTextConfig( nButton, oConfig ); + this._fnCollectionConfig( nButton, oConfig ); + } + + return nButton; + }, + + + /** + * Create the DOM needed for the button and apply some base properties. All buttons start here + * @method _fnButtonBase + * @param {o} oConfig Button configuration object + * @returns {Node} DIV element for the button + * @private + */ + "_fnButtonBase": function ( o, bCollectionButton ) + { + var sTag, sLiner, sClass; + + if ( bCollectionButton ) + { + sTag = o.sTag !== "default" ? o.sTag : this.s.tags.collection.button; + sLiner = o.sLinerTag !== "default" ? o.sLiner : this.s.tags.collection.liner; + sClass = this.classes.collection.buttons.normal; + } + else + { + sTag = o.sTag !== "default" ? o.sTag : this.s.tags.button; + sLiner = o.sLinerTag !== "default" ? o.sLiner : this.s.tags.liner; + sClass = this.classes.buttons.normal; + } + + var + nButton = document.createElement( sTag ), + nSpan = document.createElement( sLiner ), + masterS = this._fnGetMasterSettings(); + + nButton.className = sClass+" "+o.sButtonClass; + nButton.setAttribute('id', "ToolTables_"+this.s.dt.sInstance+"_"+masterS.buttonCounter ); + nButton.appendChild( nSpan ); + nSpan.innerHTML = o.sButtonText; + + masterS.buttonCounter++; + + return nButton; + }, + + + /** + * Get the settings object for the master instance. When more than one TableTools instance is + * assigned to a DataTable, only one of them can be the 'master' (for the select rows). As such, + * we will typically want to interact with that master for global properties. + * @method _fnGetMasterSettings + * @returns {Object} TableTools settings object + * @private + */ + "_fnGetMasterSettings": function () + { + if ( this.s.master ) + { + return this.s; + } + else + { + /* Look for the master which has the same DT as this one */ + var instances = TableTools._aInstances; + for ( var i=0, iLen=instances.length ; i<iLen ; i++ ) + { + if ( this.dom.table == instances[i].s.dt.nTable ) + { + return instances[i].s; + } + } + } + }, + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Button collection functions + */ + + /** + * Create a collection button, when activated will present a drop down list of other buttons + * @param {Node} nButton Button to use for the collection activation + * @param {Object} oConfig Button configuration object + * @returns void + * @private + */ + "_fnCollectionConfig": function ( nButton, oConfig ) + { + var nHidden = document.createElement( this.s.tags.collection.container ); + nHidden.style.display = "none"; + nHidden.className = this.classes.collection.container; + oConfig._collection = nHidden; + document.body.appendChild( nHidden ); + + this._fnButtonDefinations( oConfig.aButtons, nHidden ); + }, + + + /** + * Show a button collection + * @param {Node} nButton Button to use for the collection + * @param {Object} oConfig Button configuration object + * @returns void + * @private + */ + "_fnCollectionShow": function ( nButton, oConfig ) + { + var + that = this, + oPos = $(nButton).offset(), + nHidden = oConfig._collection, + iDivX = oPos.left, + iDivY = oPos.top + $(nButton).outerHeight(), + iWinHeight = $(window).height(), iDocHeight = $(document).height(), + iWinWidth = $(window).width(), iDocWidth = $(document).width(); + + nHidden.style.position = "absolute"; + nHidden.style.left = iDivX+"px"; + nHidden.style.top = iDivY+"px"; + nHidden.style.display = "block"; + $(nHidden).css('opacity',0); + + var nBackground = document.createElement('div'); + nBackground.style.position = "absolute"; + nBackground.style.left = "0px"; + nBackground.style.top = "0px"; + nBackground.style.height = ((iWinHeight>iDocHeight)? iWinHeight : iDocHeight) +"px"; + nBackground.style.width = ((iWinWidth>iDocWidth)? iWinWidth : iDocWidth) +"px"; + nBackground.className = this.classes.collection.background; + $(nBackground).css('opacity',0); + + document.body.appendChild( nBackground ); + document.body.appendChild( nHidden ); + + /* Visual corrections to try and keep the collection visible */ + var iDivWidth = $(nHidden).outerWidth(); + var iDivHeight = $(nHidden).outerHeight(); + + if ( iDivX + iDivWidth > iDocWidth ) + { + nHidden.style.left = (iDocWidth-iDivWidth)+"px"; + } + + if ( iDivY + iDivHeight > iDocHeight ) + { + nHidden.style.top = (iDivY-iDivHeight-$(nButton).outerHeight())+"px"; + } + + this.dom.collection.collection = nHidden; + this.dom.collection.background = nBackground; + + /* 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 + */ + setTimeout( function () { + $(nHidden).animate({"opacity": 1}, 500); + $(nBackground).animate({"opacity": 0.25}, 500); + }, 10 ); + + /* Resize the buttons to the Flash contents fit */ + this.fnResizeButtons(); + + /* Event handler to remove the collection display */ + $(nBackground).click( function () { + that._fnCollectionHide.call( that, null, null ); + } ); + }, + + + /** + * Hide a button collection + * @param {Node} nButton Button to use for the collection + * @param {Object} oConfig Button configuration object + * @returns void + * @private + */ + "_fnCollectionHide": function ( nButton, oConfig ) + { + if ( oConfig !== null && oConfig.sExtends == 'collection' ) + { + return; + } + + if ( this.dom.collection.collection !== null ) + { + $(this.dom.collection.collection).animate({"opacity": 0}, 500, function (e) { + this.style.display = "none"; + } ); + + $(this.dom.collection.background).animate({"opacity": 0}, 500, function (e) { + this.parentNode.removeChild( this ); + } ); + + this.dom.collection.collection = null; + this.dom.collection.background = null; + } + }, + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Row selection functions + */ + + /** + * Add event handlers to a table to allow for row selection + * @method _fnRowSelectConfig + * @returns void + * @private + */ + "_fnRowSelectConfig": function () + { + if ( this.s.master ) + { + var + that = this, + i, iLen, + dt = this.s.dt, + aoOpenRows = this.s.dt.aoOpenRows; + + $(dt.nTable).addClass( this.classes.select.table ); + + $(dt.nTBody).on( 'click.DTTT_Select', 'tr', function(e) { + /* Sub-table must be ignored (odd that the selector won't do this with >) */ + if ( this.parentNode != dt.nTBody ) + { + return; + } + + /* Check that we are actually working with a DataTables controlled row */ + if ( dt.oInstance.fnGetData(this) === null ) + { + return; + } + + if ( that.fnIsSelected( this ) ) + { + that._fnRowDeselect( this, e ); + } + else if ( that.s.select.type == "single" ) + { + that.fnSelectNone(); + that._fnRowSelect( this, e ); + } + else if ( that.s.select.type == "multi" ) + { + that._fnRowSelect( this, e ); + } + } ); + + // Bind a listener to the DataTable for when new rows are created. + // This allows rows to be visually selected when they should be and + // deferred rendering is used. + dt.oApi._fnCallbackReg( dt, 'aoRowCreatedCallback', function (tr, data, index) { + if ( dt.aoData[index]._DTTT_selected ) { + $(tr).addClass( that.classes.select.row ); + } + }, 'TableTools-SelectAll' ); + } + }, + + /** + * Select rows + * @param {*} src Rows to select - see _fnSelectData for a description of valid inputs + * @private + */ + "_fnRowSelect": function ( src, e ) + { + var + that = this, + data = this._fnSelectData( src ), + firstTr = data.length===0 ? null : data[0].nTr, + anSelected = [], + i, len; + + // Get all the rows that will be selected + for ( i=0, len=data.length ; i<len ; i++ ) + { + if ( data[i].nTr ) + { + anSelected.push( data[i].nTr ); + } + } + + // User defined pre-selection function + if ( this.s.select.preRowSelect !== null && !this.s.select.preRowSelect.call(this, e, anSelected, true) ) + { + return; + } + + // Mark them as selected + for ( i=0, len=data.length ; i<len ; i++ ) + { + data[i]._DTTT_selected = true; + + if ( data[i].nTr ) + { + $(data[i].nTr).addClass( that.classes.select.row ); + } + } + + // Post-selection function + if ( this.s.select.postSelected !== null ) + { + this.s.select.postSelected.call( this, anSelected ); + } + + TableTools._fnEventDispatch( this, 'select', anSelected, true ); + }, + + /** + * Deselect rows + * @param {*} src Rows to deselect - see _fnSelectData for a description of valid inputs + * @private + */ + "_fnRowDeselect": function ( src, e ) + { + var + that = this, + data = this._fnSelectData( src ), + firstTr = data.length===0 ? null : data[0].nTr, + anDeselectedTrs = [], + i, len; + + // Get all the rows that will be deselected + for ( i=0, len=data.length ; i<len ; i++ ) + { + if ( data[i].nTr ) + { + anDeselectedTrs.push( data[i].nTr ); + } + } + + // User defined pre-selection function + if ( this.s.select.preRowSelect !== null && !this.s.select.preRowSelect.call(this, e, anDeselectedTrs, false) ) + { + return; + } + + // Mark them as deselected + for ( i=0, len=data.length ; i<len ; i++ ) + { + data[i]._DTTT_selected = false; + + if ( data[i].nTr ) + { + $(data[i].nTr).removeClass( that.classes.select.row ); + } + } + + // Post-deselection function + if ( this.s.select.postDeselected !== null ) + { + this.s.select.postDeselected.call( this, anDeselectedTrs ); + } + + TableTools._fnEventDispatch( this, 'select', anDeselectedTrs, false ); + }, + + /** + * Take a data source for row selection and convert it into aoData points for the DT + * @param {*} src Can be a single DOM TR node, an array of TR nodes (including a + * a jQuery object), a single aoData point from DataTables, an array of aoData + * points or an array of aoData indexes + * @returns {array} An array of aoData points + */ + "_fnSelectData": function ( src ) + { + var out = [], pos, i, iLen; + + if ( src.nodeName ) + { + // Single node + pos = this.s.dt.oInstance.fnGetPosition( src ); + out.push( this.s.dt.aoData[pos] ); + } + else if ( typeof src.length !== 'undefined' ) + { + // jQuery object or an array of nodes, or aoData points + for ( i=0, iLen=src.length ; i<iLen ; i++ ) + { + if ( src[i].nodeName ) + { + pos = this.s.dt.oInstance.fnGetPosition( src[i] ); + out.push( this.s.dt.aoData[pos] ); + } + else if ( typeof src[i] === 'number' ) + { + out.push( this.s.dt.aoData[ src[i] ] ); + } + else + { + out.push( src[i] ); + } + } + + return out; + } + else + { + // A single aoData point + out.push( src ); + } + + return out; + }, + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Text button functions + */ + + /** + * Configure a text based button for interaction events + * @method _fnTextConfig + * @param {Node} nButton Button element which is being considered + * @param {Object} oConfig Button configuration object + * @returns void + * @private + */ + "_fnTextConfig": function ( nButton, oConfig ) + { + var that = this; + + if ( oConfig.fnInit !== null ) + { + oConfig.fnInit.call( this, nButton, oConfig ); + } + + if ( oConfig.sToolTip !== "" ) + { + nButton.title = oConfig.sToolTip; + } + + $(nButton).hover( function () { + if ( oConfig.fnMouseover !== null ) + { + oConfig.fnMouseover.call( this, nButton, oConfig, null ); + } + }, function () { + if ( oConfig.fnMouseout !== null ) + { + oConfig.fnMouseout.call( this, nButton, oConfig, null ); + } + } ); + + if ( oConfig.fnSelect !== null ) + { + TableTools._fnEventListen( this, 'select', function (n) { + oConfig.fnSelect.call( that, nButton, oConfig, n ); + } ); + } + + $(nButton).click( function (e) { + //e.preventDefault(); + + if ( oConfig.fnClick !== null ) + { + oConfig.fnClick.call( that, nButton, oConfig, null, e ); + } + + /* Provide a complete function to match the behaviour of the flash elements */ + if ( oConfig.fnComplete !== null ) + { + oConfig.fnComplete.call( that, nButton, oConfig, null, null ); + } + + that._fnCollectionHide( nButton, oConfig ); + } ); + }, + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Flash button functions + */ + + /** + * Configure a flash based button for interaction events + * @method _fnFlashConfig + * @param {Node} nButton Button element which is being considered + * @param {o} oConfig Button configuration object + * @returns void + * @private + */ + "_fnFlashConfig": function ( nButton, oConfig ) + { + var that = this; + var flash = new ZeroClipboard_TableTools.Client(); + + if ( oConfig.fnInit !== null ) + { + oConfig.fnInit.call( this, nButton, oConfig ); + } + + flash.setHandCursor( true ); + + if ( oConfig.sAction == "flash_save" ) + { + flash.setAction( 'save' ); + flash.setCharSet( (oConfig.sCharSet=="utf16le") ? 'UTF16LE' : 'UTF8' ); + flash.setBomInc( oConfig.bBomInc ); + flash.setFileName( oConfig.sFileName.replace('*', this.fnGetTitle(oConfig)) ); + } + else if ( oConfig.sAction == "flash_pdf" ) + { + flash.setAction( 'pdf' ); + flash.setFileName( oConfig.sFileName.replace('*', this.fnGetTitle(oConfig)) ); + } + else + { + flash.setAction( 'copy' ); + } + + flash.addEventListener('mouseOver', function(client) { + if ( oConfig.fnMouseover !== null ) + { + oConfig.fnMouseover.call( that, nButton, oConfig, flash ); + } + } ); + + flash.addEventListener('mouseOut', function(client) { + if ( oConfig.fnMouseout !== null ) + { + oConfig.fnMouseout.call( that, nButton, oConfig, flash ); + } + } ); + + flash.addEventListener('mouseDown', function(client) { + if ( oConfig.fnClick !== null ) + { + oConfig.fnClick.call( that, nButton, oConfig, flash ); + } + } ); + + flash.addEventListener('complete', function (client, text) { + if ( oConfig.fnComplete !== null ) + { + oConfig.fnComplete.call( that, nButton, oConfig, flash, text ); + } + that._fnCollectionHide( nButton, oConfig ); + } ); + + this._fnFlashGlue( flash, nButton, oConfig.sToolTip ); + }, + + + /** + * Wait until the id is in the DOM before we "glue" the swf. Note that this function will call + * itself (using setTimeout) until it completes successfully + * @method _fnFlashGlue + * @param {Object} clip Zero clipboard object + * @param {Node} node node to glue swf to + * @param {String} text title of the flash movie + * @returns void + * @private + */ + "_fnFlashGlue": function ( flash, node, text ) + { + var that = this; + var id = node.getAttribute('id'); + + if ( document.getElementById(id) ) + { + flash.glue( node, text ); + } + else + { + setTimeout( function () { + that._fnFlashGlue( flash, node, text ); + }, 100 ); + } + }, + + + /** + * Set the text for the flash clip to deal with + * + * This function is required for large information sets. There is a limit on the + * amount of data that can be transferred between Javascript and Flash in a single call, so + * we use this method to build up the text in Flash by sending over chunks. It is estimated + * that the data limit is around 64k, although it is undocumented, and appears to be different + * between different flash versions. We chunk at 8KiB. + * @method _fnFlashSetText + * @param {Object} clip the ZeroClipboard object + * @param {String} sData the data to be set + * @returns void + * @private + */ + "_fnFlashSetText": function ( clip, sData ) + { + var asData = this._fnChunkData( sData, 8192 ); + + clip.clearText(); + for ( var i=0, iLen=asData.length ; i<iLen ; i++ ) + { + clip.appendText( asData[i] ); + } + }, + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Data retrieval functions + */ + + /** + * Convert the mixed columns variable into a boolean array the same size as the columns, which + * indicates which columns we want to include + * @method _fnColumnTargets + * @param {String|Array} mColumns The columns to be included in data retrieval. If a string + * then it can take the value of "visible" or "hidden" (to include all visible or + * hidden columns respectively). Or an array of column indexes + * @returns {Array} A boolean array the length of the columns of the table, which each value + * indicating if the column is to be included or not + * @private + */ + "_fnColumnTargets": function ( mColumns ) + { + var aColumns = []; + var dt = this.s.dt; + + if ( typeof mColumns == "object" ) + { + for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ ) + { + aColumns.push( false ); + } + + for ( i=0, iLen=mColumns.length ; i<iLen ; i++ ) + { + aColumns[ mColumns[i] ] = true; + } + } + else if ( mColumns == "visible" ) + { + for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ ) + { + aColumns.push( dt.aoColumns[i].bVisible ? true : false ); + } + } + else if ( mColumns == "hidden" ) + { + for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ ) + { + aColumns.push( dt.aoColumns[i].bVisible ? false : true ); + } + } + else if ( mColumns == "sortable" ) + { + for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ ) + { + aColumns.push( dt.aoColumns[i].bSortable ? true : false ); + } + } + else /* all */ + { + for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ ) + { + aColumns.push( true ); + } + } + + return aColumns; + }, + + + /** + * New line character(s) depend on the platforms + * @method method + * @param {Object} oConfig Button configuration object - only interested in oConfig.sNewLine + * @returns {String} Newline character + */ + "_fnNewline": function ( oConfig ) + { + if ( oConfig.sNewLine == "auto" ) + { + return navigator.userAgent.match(/Windows/) ? "\r\n" : "\n"; + } + else + { + return oConfig.sNewLine; + } + }, + + + /** + * Get data from DataTables' internals and format it for output + * @method _fnGetDataTablesData + * @param {Object} oConfig Button configuration object + * @param {String} oConfig.sFieldBoundary Field boundary for the data cells in the string + * @param {String} oConfig.sFieldSeperator Field separator for the data cells + * @param {String} oConfig.sNewline New line options + * @param {Mixed} oConfig.mColumns Which columns should be included in the output + * @param {Boolean} oConfig.bHeader Include the header + * @param {Boolean} oConfig.bFooter Include the footer + * @param {Boolean} oConfig.bSelectedOnly Include only the selected rows in the output + * @returns {String} Concatenated string of data + * @private + */ + "_fnGetDataTablesData": function ( oConfig ) + { + var i, iLen, j, jLen; + var aRow, aData=[], sLoopData='', arr; + var dt = this.s.dt, tr, child; + var regex = new RegExp(oConfig.sFieldBoundary, "g"); /* Do it here for speed */ + var aColumnsInc = this._fnColumnTargets( oConfig.mColumns ); + var bSelectedOnly = (typeof oConfig.bSelectedOnly != 'undefined') ? oConfig.bSelectedOnly : false; + + /* + * Header + */ + if ( oConfig.bHeader ) + { + aRow = []; + + for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ ) + { + if ( aColumnsInc[i] ) + { + sLoopData = dt.aoColumns[i].sTitle.replace(/\n/g," ").replace( /<.*?>/g, "" ).replace(/^\s+|\s+$/g,""); + sLoopData = this._fnHtmlDecode( sLoopData ); + + aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) ); + } + } + + aData.push( aRow.join(oConfig.sFieldSeperator) ); + } + + /* + * Body + */ + var aDataIndex = dt.aiDisplay; + var aSelected = this.fnGetSelected(); + if ( this.s.select.type !== "none" && bSelectedOnly && aSelected.length !== 0 ) + { + aDataIndex = []; + for ( i=0, iLen=aSelected.length ; i<iLen ; i++ ) + { + aDataIndex.push( dt.oInstance.fnGetPosition( aSelected[i] ) ); + } + } + + for ( j=0, jLen=aDataIndex.length ; j<jLen ; j++ ) + { + tr = dt.aoData[ aDataIndex[j] ].nTr; + aRow = []; + + /* Columns */ + for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ ) + { + if ( aColumnsInc[i] ) + { + /* Convert to strings (with small optimisation) */ + var mTypeData = dt.oApi._fnGetCellData( dt, aDataIndex[j], i, 'display' ); + if ( oConfig.fnCellRender ) + { + sLoopData = oConfig.fnCellRender( mTypeData, i, tr, aDataIndex[j] )+""; + } + else if ( typeof mTypeData == "string" ) + { + /* Strip newlines, replace img tags with alt attr. and finally strip html... */ + sLoopData = mTypeData.replace(/\n/g," "); + sLoopData = + sLoopData.replace(/<img.*?\s+alt\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+)).*?>/gi, + '$1$2$3'); + sLoopData = sLoopData.replace( /<.*?>/g, "" ); + } + else + { + sLoopData = mTypeData+""; + } + + /* Trim and clean the data */ + sLoopData = sLoopData.replace(/^\s+/, '').replace(/\s+$/, ''); + sLoopData = this._fnHtmlDecode( sLoopData ); + + /* Bound it and add it to the total data */ + aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) ); + } + } + + aData.push( aRow.join(oConfig.sFieldSeperator) ); + + /* Details rows from fnOpen */ + if ( oConfig.bOpenRows ) + { + arr = $.grep(dt.aoOpenRows, function(o) { return o.nParent === tr; }); + + if ( arr.length === 1 ) + { + sLoopData = this._fnBoundData( $('td', arr[0].nTr).html(), oConfig.sFieldBoundary, regex ); + aData.push( sLoopData ); + } + } + } + + /* + * Footer + */ + if ( oConfig.bFooter && dt.nTFoot !== null ) + { + aRow = []; + + for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ ) + { + if ( aColumnsInc[i] && dt.aoColumns[i].nTf !== null ) + { + sLoopData = dt.aoColumns[i].nTf.innerHTML.replace(/\n/g," ").replace( /<.*?>/g, "" ); + sLoopData = this._fnHtmlDecode( sLoopData ); + + aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) ); + } + } + + aData.push( aRow.join(oConfig.sFieldSeperator) ); + } + + _sLastData = aData.join( this._fnNewline(oConfig) ); + return _sLastData; + }, + + + /** + * Wrap data up with a boundary string + * @method _fnBoundData + * @param {String} sData data to bound + * @param {String} sBoundary bounding char(s) + * @param {RegExp} regex search for the bounding chars - constructed outside for efficiency + * in the loop + * @returns {String} bound data + * @private + */ + "_fnBoundData": function ( sData, sBoundary, regex ) + { + if ( sBoundary === "" ) + { + return sData; + } + else + { + return sBoundary + sData.replace(regex, sBoundary+sBoundary) + sBoundary; + } + }, + + + /** + * Break a string up into an array of smaller strings + * @method _fnChunkData + * @param {String} sData data to be broken up + * @param {Int} iSize chunk size + * @returns {Array} String array of broken up text + * @private + */ + "_fnChunkData": function ( sData, iSize ) + { + var asReturn = []; + var iStrlen = sData.length; + + for ( var i=0 ; i<iStrlen ; i+=iSize ) + { + if ( i+iSize < iStrlen ) + { + asReturn.push( sData.substring( i, i+iSize ) ); + } + else + { + asReturn.push( sData.substring( i, iStrlen ) ); + } + } + + return asReturn; + }, + + + /** + * Decode HTML entities + * @method _fnHtmlDecode + * @param {String} sData encoded string + * @returns {String} decoded string + * @private + */ + "_fnHtmlDecode": function ( sData ) + { + if ( sData.indexOf('&') === -1 ) + { + return sData; + } + + var n = document.createElement('div'); + + return sData.replace( /&([^\s]*);/g, function( match, match2 ) { + if ( match.substr(1, 1) === '#' ) + { + return String.fromCharCode( Number(match2.substr(1)) ); + } + else + { + n.innerHTML = match; + return n.childNodes[0].nodeValue; + } + } ); + }, + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Printing functions + */ + + /** + * Show print display + * @method _fnPrintStart + * @param {Event} e Event object + * @param {Object} oConfig Button configuration object + * @returns void + * @private + */ + "_fnPrintStart": function ( oConfig ) + { + var that = this; + var oSetDT = this.s.dt; + + /* Parse through the DOM hiding everything that isn't needed for the table */ + this._fnPrintHideNodes( oSetDT.nTable ); + + /* Show the whole table */ + this.s.print.saveStart = oSetDT._iDisplayStart; + this.s.print.saveLength = oSetDT._iDisplayLength; + + if ( oConfig.bShowAll ) + { + oSetDT._iDisplayStart = 0; + oSetDT._iDisplayLength = -1; + oSetDT.oApi._fnCalculateEnd( oSetDT ); + oSetDT.oApi._fnDraw( oSetDT ); + } + + /* Adjust the display for scrolling which might be done by DataTables */ + if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" ) + { + this._fnPrintScrollStart( oSetDT ); + + // If the table redraws while in print view, the DataTables scrolling + // setup would hide the header, so we need to readd it on draw + $(this.s.dt.nTable).bind('draw.DTTT_Print', function () { + that._fnPrintScrollStart( oSetDT ); + } ); + } + + /* Remove the other DataTables feature nodes - but leave the table! and info div */ + var anFeature = oSetDT.aanFeatures; + for ( var cFeature in anFeature ) + { + if ( cFeature != 'i' && cFeature != 't' && cFeature.length == 1 ) + { + for ( var i=0, iLen=anFeature[cFeature].length ; i<iLen ; i++ ) + { + this.dom.print.hidden.push( { + "node": anFeature[cFeature][i], + "display": "block" + } ); + anFeature[cFeature][i].style.display = "none"; + } + } + } + + /* Print class can be used for styling */ + $(document.body).addClass( this.classes.print.body ); + + /* Show information message to let the user know what is happening */ + if ( oConfig.sInfo !== "" ) + { + this.fnInfo( oConfig.sInfo, 3000 ); + } + + /* Add a message at the top of the page */ + if ( oConfig.sMessage ) + { + this.dom.print.message = document.createElement( "div" ); + this.dom.print.message.className = this.classes.print.message; + this.dom.print.message.innerHTML = oConfig.sMessage; + document.body.insertBefore( this.dom.print.message, document.body.childNodes[0] ); + } + + /* Cache the scrolling and the jump to the top of the page */ + this.s.print.saveScroll = $(window).scrollTop(); + window.scrollTo( 0, 0 ); + + /* Bind a key event listener to the document for the escape key - + * it is removed in the callback + */ + $(document).bind( "keydown.DTTT", function(e) { + /* Only interested in the escape key */ + if ( e.keyCode == 27 ) + { + e.preventDefault(); + that._fnPrintEnd.call( that, e ); + } + } ); + }, + + + /** + * Printing is finished, resume normal display + * @method _fnPrintEnd + * @param {Event} e Event object + * @returns void + * @private + */ + "_fnPrintEnd": function ( e ) + { + var that = this; + var oSetDT = this.s.dt; + var oSetPrint = this.s.print; + var oDomPrint = this.dom.print; + + /* Show all hidden nodes */ + this._fnPrintShowNodes(); + + /* Restore DataTables' scrolling */ + if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" ) + { + $(this.s.dt.nTable).unbind('draw.DTTT_Print'); + + this._fnPrintScrollEnd(); + } + + /* Restore the scroll */ + window.scrollTo( 0, oSetPrint.saveScroll ); + + /* Drop the print message */ + if ( oDomPrint.message !== null ) + { + document.body.removeChild( oDomPrint.message ); + oDomPrint.message = null; + } + + /* Styling class */ + $(document.body).removeClass( 'DTTT_Print' ); + + /* Restore the table length */ + oSetDT._iDisplayStart = oSetPrint.saveStart; + oSetDT._iDisplayLength = oSetPrint.saveLength; + oSetDT.oApi._fnCalculateEnd( oSetDT ); + oSetDT.oApi._fnDraw( oSetDT ); + + $(document).unbind( "keydown.DTTT" ); + }, + + + /** + * Take account of scrolling in DataTables by showing the full table + * @returns void + * @private + */ + "_fnPrintScrollStart": function () + { + var + oSetDT = this.s.dt, + nScrollHeadInner = oSetDT.nScrollHead.getElementsByTagName('div')[0], + nScrollHeadTable = nScrollHeadInner.getElementsByTagName('table')[0], + nScrollBody = oSetDT.nTable.parentNode; + + /* Copy the header in the thead in the body table, this way we show one single table when + * in print view. Note that this section of code is more or less verbatim from DT 1.7.0 + */ + var nTheadSize = oSetDT.nTable.getElementsByTagName('thead'); + if ( nTheadSize.length > 0 ) + { + oSetDT.nTable.removeChild( nTheadSize[0] ); + } + + if ( oSetDT.nTFoot !== null ) + { + var nTfootSize = oSetDT.nTable.getElementsByTagName('tfoot'); + if ( nTfootSize.length > 0 ) + { + oSetDT.nTable.removeChild( nTfootSize[0] ); + } + } + + nTheadSize = oSetDT.nTHead.cloneNode(true); + oSetDT.nTable.insertBefore( nTheadSize, oSetDT.nTable.childNodes[0] ); + + if ( oSetDT.nTFoot !== null ) + { + nTfootSize = oSetDT.nTFoot.cloneNode(true); + oSetDT.nTable.insertBefore( nTfootSize, oSetDT.nTable.childNodes[1] ); + } + + /* Now adjust the table's viewport so we can actually see it */ + if ( oSetDT.oScroll.sX !== "" ) + { + oSetDT.nTable.style.width = $(oSetDT.nTable).outerWidth()+"px"; + nScrollBody.style.width = $(oSetDT.nTable).outerWidth()+"px"; + nScrollBody.style.overflow = "visible"; + } + + if ( oSetDT.oScroll.sY !== "" ) + { + nScrollBody.style.height = $(oSetDT.nTable).outerHeight()+"px"; + nScrollBody.style.overflow = "visible"; + } + }, + + + /** + * Take account of scrolling in DataTables by showing the full table. Note that the redraw of + * the DataTable that we do will actually deal with the majority of the hard work here + * @returns void + * @private + */ + "_fnPrintScrollEnd": function () + { + var + oSetDT = this.s.dt, + nScrollBody = oSetDT.nTable.parentNode; + + if ( oSetDT.oScroll.sX !== "" ) + { + nScrollBody.style.width = oSetDT.oApi._fnStringToCss( oSetDT.oScroll.sX ); + nScrollBody.style.overflow = "auto"; + } + + if ( oSetDT.oScroll.sY !== "" ) + { + nScrollBody.style.height = oSetDT.oApi._fnStringToCss( oSetDT.oScroll.sY ); + nScrollBody.style.overflow = "auto"; + } + }, + + + /** + * Resume the display of all TableTools hidden nodes + * @method _fnPrintShowNodes + * @returns void + * @private + */ + "_fnPrintShowNodes": function ( ) + { + var anHidden = this.dom.print.hidden; + + for ( var i=0, iLen=anHidden.length ; i<iLen ; i++ ) + { + anHidden[i].node.style.display = anHidden[i].display; + } + anHidden.splice( 0, anHidden.length ); + }, + + + /** + * Hide nodes which are not needed in order to display the table. Note that this function is + * recursive + * @method _fnPrintHideNodes + * @param {Node} nNode Element which should be showing in a 'print' display + * @returns void + * @private + */ + "_fnPrintHideNodes": function ( nNode ) + { + var anHidden = this.dom.print.hidden; + + var nParent = nNode.parentNode; + var nChildren = nParent.childNodes; + for ( var i=0, iLen=nChildren.length ; i<iLen ; i++ ) + { + if ( nChildren[i] != nNode && nChildren[i].nodeType == 1 ) + { + /* If our node is shown (don't want to show nodes which were previously hidden) */ + var sDisplay = $(nChildren[i]).css("display"); + if ( sDisplay != "none" ) + { + /* Cache the node and it's previous state so we can restore it */ + anHidden.push( { + "node": nChildren[i], + "display": sDisplay + } ); + nChildren[i].style.display = "none"; + } + } + } + + if ( nParent.nodeName != "BODY" ) + { + this._fnPrintHideNodes( nParent ); + } + } +}; + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Static variables + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/** + * Store of all instances that have been created of TableTools, so one can look up other (when + * there is need of a master) + * @property _aInstances + * @type Array + * @default [] + * @private + */ +TableTools._aInstances = []; + + +/** + * Store of all listeners and their callback functions + * @property _aListeners + * @type Array + * @default [] + */ +TableTools._aListeners = []; + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Static methods + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/** + * Get an array of all the master instances + * @method fnGetMasters + * @returns {Array} List of master TableTools instances + * @static + */ +TableTools.fnGetMasters = function () +{ + var a = []; + for ( var i=0, iLen=TableTools._aInstances.length ; i<iLen ; i++ ) + { + if ( TableTools._aInstances[i].s.master ) + { + a.push( TableTools._aInstances[i] ); + } + } + return a; +}; + +/** + * Get the master instance for a table node (or id if a string is given) + * @method fnGetInstance + * @returns {Object} ID of table OR table node, for which we want the TableTools instance + * @static + */ +TableTools.fnGetInstance = function ( node ) +{ + if ( typeof node != 'object' ) + { + node = document.getElementById(node); + } + + for ( var i=0, iLen=TableTools._aInstances.length ; i<iLen ; i++ ) + { + if ( TableTools._aInstances[i].s.master && TableTools._aInstances[i].dom.table == node ) + { + return TableTools._aInstances[i]; + } + } + return null; +}; + + +/** + * Add a listener for a specific event + * @method _fnEventListen + * @param {Object} that Scope of the listening function (i.e. 'this' in the caller) + * @param {String} type Event type + * @param {Function} fn Function + * @returns void + * @private + * @static + */ +TableTools._fnEventListen = function ( that, type, fn ) +{ + TableTools._aListeners.push( { + "that": that, + "type": type, + "fn": fn + } ); +}; + + +/** + * An event has occurred - look up every listener and fire it off. We check that the event we are + * going to fire is attached to the same table (using the table node as reference) before firing + * @method _fnEventDispatch + * @param {Object} that Scope of the listening function (i.e. 'this' in the caller) + * @param {String} type Event type + * @param {Node} node Element that the event occurred on (may be null) + * @param {boolean} [selected] Indicate if the node was selected (true) or deselected (false) + * @returns void + * @private + * @static + */ +TableTools._fnEventDispatch = function ( that, type, node, selected ) +{ + var listeners = TableTools._aListeners; + for ( var i=0, iLen=listeners.length ; i<iLen ; i++ ) + { + if ( that.dom.table == listeners[i].that.dom.table && listeners[i].type == type ) + { + listeners[i].fn( node, selected ); + } + } +}; + + + + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Constants + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + + +TableTools.buttonBase = { + // Button base + "sAction": "text", + "sTag": "default", + "sLinerTag": "default", + "sButtonClass": "DTTT_button_text", + "sButtonText": "Button text", + "sTitle": "", + "sToolTip": "", + + // Common button specific options + "sCharSet": "utf8", + "bBomInc": false, + "sFileName": "*.csv", + "sFieldBoundary": "", + "sFieldSeperator": "\t", + "sNewLine": "auto", + "mColumns": "all", /* "all", "visible", "hidden" or array of column integers */ + "bHeader": true, + "bFooter": true, + "bOpenRows": false, + "bSelectedOnly": false, + + // Callbacks + "fnMouseover": null, + "fnMouseout": null, + "fnClick": null, + "fnSelect": null, + "fnComplete": null, + "fnInit": null, + "fnCellRender": null +}; + + +/** + * @namespace Default button configurations + */ +TableTools.BUTTONS = { + "csv": $.extend( {}, TableTools.buttonBase, { + "sAction": "flash_save", + "sButtonClass": "DTTT_button_csv", + "sButtonText": "CSV", + "sFieldBoundary": '"', + "sFieldSeperator": ",", + "fnClick": function( nButton, oConfig, flash ) { + this.fnSetText( flash, this.fnGetTableData(oConfig) ); + } + } ), + + "xls": $.extend( {}, TableTools.buttonBase, { + "sAction": "flash_save", + "sCharSet": "utf16le", + "bBomInc": true, + "sButtonClass": "DTTT_button_xls", + "sButtonText": "Excel", + "fnClick": function( nButton, oConfig, flash ) { + this.fnSetText( flash, this.fnGetTableData(oConfig) ); + } + } ), + + "copy": $.extend( {}, TableTools.buttonBase, { + "sAction": "flash_copy", + "sButtonClass": "DTTT_button_copy", + "sButtonText": "Copy", + "fnClick": function( nButton, oConfig, flash ) { + this.fnSetText( flash, this.fnGetTableData(oConfig) ); + }, + "fnComplete": function(nButton, oConfig, flash, text) { + var + lines = text.split('\n').length, + len = this.s.dt.nTFoot === null ? lines-1 : lines-2, + plural = (len==1) ? "" : "s"; + this.fnInfo( '<h6>Table copied</h6>'+ + '<p>Copied '+len+' row'+plural+' to the clipboard.</p>', + 1500 + ); + } + } ), + + "pdf": $.extend( {}, TableTools.buttonBase, { + "sAction": "flash_pdf", + "sNewLine": "\n", + "sFileName": "*.pdf", + "sButtonClass": "DTTT_button_pdf", + "sButtonText": "PDF", + "sPdfOrientation": "portrait", + "sPdfSize": "A4", + "sPdfMessage": "", + "fnClick": function( nButton, oConfig, flash ) { + this.fnSetText( flash, + "title:"+ this.fnGetTitle(oConfig) +"\n"+ + "message:"+ oConfig.sPdfMessage +"\n"+ + "colWidth:"+ this.fnCalcColRatios(oConfig) +"\n"+ + "orientation:"+ oConfig.sPdfOrientation +"\n"+ + "size:"+ oConfig.sPdfSize +"\n"+ + "--/TableToolsOpts--\n" + + this.fnGetTableData(oConfig) + ); + } + } ), + + "print": $.extend( {}, TableTools.buttonBase, { + "sInfo": "<h6>Print view</h6><p>Please use your browser's print function to "+ + "print this table. Press escape when finished.", + "sMessage": null, + "bShowAll": true, + "sToolTip": "View print view", + "sButtonClass": "DTTT_button_print", + "sButtonText": "Print", + "fnClick": function ( nButton, oConfig ) { + this.fnPrint( true, oConfig ); + } + } ), + + "text": $.extend( {}, TableTools.buttonBase ), + + "select": $.extend( {}, TableTools.buttonBase, { + "sButtonText": "Select button", + "fnSelect": function( nButton, oConfig ) { + if ( this.fnGetSelected().length !== 0 ) { + $(nButton).removeClass( this.classes.buttons.disabled ); + } else { + $(nButton).addClass( this.classes.buttons.disabled ); + } + }, + "fnInit": function( nButton, oConfig ) { + $(nButton).addClass( this.classes.buttons.disabled ); + } + } ), + + "select_single": $.extend( {}, TableTools.buttonBase, { + "sButtonText": "Select button", + "fnSelect": function( nButton, oConfig ) { + var iSelected = this.fnGetSelected().length; + if ( iSelected == 1 ) { + $(nButton).removeClass( this.classes.buttons.disabled ); + } else { + $(nButton).addClass( this.classes.buttons.disabled ); + } + }, + "fnInit": function( nButton, oConfig ) { + $(nButton).addClass( this.classes.buttons.disabled ); + } + } ), + + "select_all": $.extend( {}, TableTools.buttonBase, { + "sButtonText": "Select all", + "fnClick": function( nButton, oConfig ) { + this.fnSelectAll(); + }, + "fnSelect": function( nButton, oConfig ) { + if ( this.fnGetSelected().length == this.s.dt.fnRecordsDisplay() ) { + $(nButton).addClass( this.classes.buttons.disabled ); + } else { + $(nButton).removeClass( this.classes.buttons.disabled ); + } + } + } ), + + "select_none": $.extend( {}, TableTools.buttonBase, { + "sButtonText": "Deselect all", + "fnClick": function( nButton, oConfig ) { + this.fnSelectNone(); + }, + "fnSelect": function( nButton, oConfig ) { + if ( this.fnGetSelected().length !== 0 ) { + $(nButton).removeClass( this.classes.buttons.disabled ); + } else { + $(nButton).addClass( this.classes.buttons.disabled ); + } + }, + "fnInit": function( nButton, oConfig ) { + $(nButton).addClass( this.classes.buttons.disabled ); + } + } ), + + "ajax": $.extend( {}, TableTools.buttonBase, { + "sAjaxUrl": "/xhr.php", + "sButtonText": "Ajax button", + "fnClick": function( nButton, oConfig ) { + var sData = this.fnGetTableData(oConfig); + $.ajax( { + "url": oConfig.sAjaxUrl, + "data": [ + { "name": "tableData", "value": sData } + ], + "success": oConfig.fnAjaxComplete, + "dataType": "json", + "type": "POST", + "cache": false, + "error": function () { + alert( "Error detected when sending table data to server" ); + } + } ); + }, + "fnAjaxComplete": function( json ) { + alert( 'Ajax complete' ); + } + } ), + + "div": $.extend( {}, TableTools.buttonBase, { + "sAction": "div", + "sTag": "div", + "sButtonClass": "DTTT_nonbutton", + "sButtonText": "Text button" + } ), + + "collection": $.extend( {}, TableTools.buttonBase, { + "sAction": "collection", + "sButtonClass": "DTTT_button_collection", + "sButtonText": "Collection", + "fnClick": function( nButton, oConfig ) { + this._fnCollectionShow(nButton, oConfig); + } + } ) +}; +/* + * on* callback parameters: + * 1. node - button element + * 2. object - configuration object for this button + * 3. object - ZeroClipboard reference (flash button only) + * 4. string - Returned string from Flash (flash button only - and only on 'complete') + */ + + + +/** + * @namespace Classes used by TableTools - allows the styles to be override easily. + * Note that when TableTools initialises it will take a copy of the classes object + * and will use its internal copy for the remainder of its run time. + */ +TableTools.classes = { + "container": "DTTT_container", + "buttons": { + "normal": "DTTT_button", + "disabled": "DTTT_disabled" + }, + "collection": { + "container": "DTTT_collection", + "background": "DTTT_collection_background", + "buttons": { + "normal": "DTTT_button", + "disabled": "DTTT_disabled" + } + }, + "select": { + "table": "DTTT_selectable", + "row": "DTTT_selected" + }, + "print": { + "body": "DTTT_Print", + "info": "DTTT_print_info", + "message": "DTTT_PrintMessage" + } +}; + + +/** + * @namespace ThemeRoller classes - built in for compatibility with DataTables' + * bJQueryUI option. + */ +TableTools.classes_themeroller = { + "container": "DTTT_container ui-buttonset ui-buttonset-multi", + "buttons": { + "normal": "DTTT_button ui-button ui-state-default" + }, + "collection": { + "container": "DTTT_collection ui-buttonset ui-buttonset-multi" + } +}; + + +/** + * @namespace TableTools default settings for initialisation + */ +TableTools.DEFAULTS = { + "sSwfPath": "media/swf/copy_csv_xls_pdf.swf", + "sRowSelect": "none", + "sSelectedClass": null, + "fnPreRowSelect": null, + "fnRowSelected": null, + "fnRowDeselected": null, + "aButtons": [ "copy", "csv", "xls", "pdf", "print" ], + "oTags": { + "container": "div", + "button": "a", // We really want to use buttons here, but Firefox and IE ignore the + // click on the Flash element in the button (but not mouse[in|out]). + "liner": "span", + "collection": { + "container": "div", + "button": "a", + "liner": "span" + } + } +}; + + +/** + * Name of this class + * @constant CLASS + * @type String + * @default TableTools + */ +TableTools.prototype.CLASS = "TableTools"; + + +/** + * TableTools version + * @constant VERSION + * @type String + * @default See code + */ +TableTools.VERSION = "2.1.5"; +TableTools.prototype.VERSION = TableTools.VERSION; + + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Initialisation + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Register a new feature with DataTables + */ +if ( typeof $.fn.dataTable == "function" && + typeof $.fn.dataTableExt.fnVersionCheck == "function" && + $.fn.dataTableExt.fnVersionCheck('1.9.0') ) +{ + $.fn.dataTableExt.aoFeatures.push( { + "fnInit": function( oDTSettings ) { + var oOpts = typeof oDTSettings.oInit.oTableTools != 'undefined' ? + oDTSettings.oInit.oTableTools : {}; + + var oTT = new TableTools( oDTSettings.oInstance, oOpts ); + TableTools._aInstances.push( oTT ); + + return oTT.dom.container; + }, + "cFeature": "T", + "sFeature": "TableTools" + } ); +} +else +{ + alert( "Warning: TableTools 2 requires DataTables 1.9.0 or newer - www.datatables.net/download"); +} + +$.fn.DataTable.TableTools = TableTools; + +})(jQuery, window, document); diff --git a/wqflask/wqflask/static/packages/TableTools/media/js/TableTools.min.js b/wqflask/wqflask/static/packages/TableTools/media/js/TableTools.min.js new file mode 100644 index 00000000..e580c993 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/js/TableTools.min.js @@ -0,0 +1,77 @@ +// Simple Set Clipboard System +// Author: Joseph Huckaby +var ZeroClipboard_TableTools={version:"1.0.4-TableTools2",clients:{},moviePath:"",nextId:1,$:function(a){"string"==typeof a&&(a=document.getElementById(a));a.addClass||(a.hide=function(){this.style.display="none"},a.show=function(){this.style.display=""},a.addClass=function(a){this.removeClass(a);this.className+=" "+a},a.removeClass=function(a){this.className=this.className.replace(RegExp("\\s*"+a+"\\s*")," ").replace(/^\s+/,"").replace(/\s+$/,"")},a.hasClass=function(a){return!!this.className.match(RegExp("\\s*"+ +a+"\\s*"))});return a},setMoviePath:function(a){this.moviePath=a},dispatch:function(a,b,c){(a=this.clients[a])&&a.receiveEvent(b,c)},register:function(a,b){this.clients[a]=b},getDOMObjectPosition:function(a){var b={left:0,top:0,width:a.width?a.width:a.offsetWidth,height:a.height?a.height:a.offsetHeight};""!=a.style.width&&(b.width=a.style.width.replace("px",""));""!=a.style.height&&(b.height=a.style.height.replace("px",""));for(;a;)b.left+=a.offsetLeft,b.top+=a.offsetTop,a=a.offsetParent;return b}, +Client:function(a){this.handlers={};this.id=ZeroClipboard_TableTools.nextId++;this.movieId="ZeroClipboard_TableToolsMovie_"+this.id;ZeroClipboard_TableTools.register(this.id,this);a&&this.glue(a)}}; +ZeroClipboard_TableTools.Client.prototype={id:0,ready:!1,movie:null,clipText:"",fileName:"",action:"copy",handCursorEnabled:!0,cssEffects:!0,handlers:null,sized:!1,glue:function(a,b){this.domElement=ZeroClipboard_TableTools.$(a);var c=99;this.domElement.style.zIndex&&(c=parseInt(this.domElement.style.zIndex)+1);var d=ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);this.div=document.createElement("div");var e=this.div.style;e.position="absolute";e.left="0px";e.top="0px";e.width=d.width+ +"px";e.height=d.height+"px";e.zIndex=c;"undefined"!=typeof b&&""!=b&&(this.div.title=b);0!=d.width&&0!=d.height&&(this.sized=!0);this.domElement&&(this.domElement.appendChild(this.div),this.div.innerHTML=this.getHTML(d.width,d.height))},positionElement:function(){var a=ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement),b=this.div.style;b.position="absolute";b.width=a.width+"px";b.height=a.height+"px";0!=a.width&&0!=a.height&&(this.sized=!0,b=this.div.childNodes[0],b.width=a.width,b.height= +a.height)},getHTML:function(a,b){var c="",d="id="+this.id+"&width="+a+"&height="+b;if(navigator.userAgent.match(/MSIE/))var e=location.href.match(/^https/i)?"https://":"http://",c=c+('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+e+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+a+'" height="'+b+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ +ZeroClipboard_TableTools.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+d+'"/><param name="wmode" value="transparent"/></object>');else c+='<embed id="'+this.movieId+'" src="'+ZeroClipboard_TableTools.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+a+'" height="'+b+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+ +d+'" wmode="transparent" />';return c},hide:function(){this.div&&(this.div.style.left="-2000px")},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML="";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.div=this.domElement=null}},reposition:function(a){a&&((this.domElement=ZeroClipboard_TableTools.$(a))||this.hide());if(this.domElement&&this.div){var a=ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement), +b=this.div.style;b.left=""+a.left+"px";b.top=""+a.top+"px"}},clearText:function(){this.clipText="";this.ready&&this.movie.clearText()},appendText:function(a){this.clipText+=a;this.ready&&this.movie.appendText(a)},setText:function(a){this.clipText=a;this.ready&&this.movie.setText(a)},setCharSet:function(a){this.charSet=a;this.ready&&this.movie.setCharSet(a)},setBomInc:function(a){this.incBom=a;this.ready&&this.movie.setBomInc(a)},setFileName:function(a){this.fileName=a;this.ready&&this.movie.setFileName(a)}, +setAction:function(a){this.action=a;this.ready&&this.movie.setAction(a)},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");this.handlers[a]||(this.handlers[a]=[]);this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled=a;this.ready&&this.movie.setHandCursor(a)},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");switch(a){case "load":this.movie=document.getElementById(this.movieId); +if(!this.movie){var c=this;setTimeout(function(){c.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){c=this;setTimeout(function(){c.receiveEvent("load",null)},100);this.ready=!0;return}this.ready=!0;this.movie.clearText();this.movie.appendText(this.clipText);this.movie.setFileName(this.fileName);this.movie.setAction(this.action);this.movie.setCharSet(this.charSet);this.movie.setBomInc(this.incBom);this.movie.setHandCursor(this.handCursorEnabled); +break;case "mouseover":this.domElement&&this.cssEffects&&this.recoverActive&&this.domElement.addClass("active");break;case "mouseout":this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")&&(this.domElement.removeClass("active"),this.recoverActive=!0));break;case "mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case "mouseup":this.domElement&&this.cssEffects&&(this.domElement.removeClass("active"),this.recoverActive=!1)}if(this.handlers[a])for(var d= +0,e=this.handlers[a].length;d<e;d++){var f=this.handlers[a][d];if("function"==typeof f)f(this,b);else if("object"==typeof f&&2==f.length)f[0][f[1]](this,b);else if("string"==typeof f)window[f](this,b)}}}; + + +/* + * File: TableTools.min.js + * Version: 2.1.5 + * Author: Allan Jardine (www.sprymedia.co.uk) + * + * Copyright 2009-2012 Allan Jardine, all rights reserved. + * + * This source file is free software, under either the GPL v2 license or a + * BSD (3 point) style license, as supplied with this software. + * + * This source file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. + */ +var TableTools; +(function(e,n,g){TableTools=function(a,b){!this instanceof TableTools&&alert("Warning: TableTools must be initialised with the keyword 'new'");this.s={that:this,dt:a.fnSettings(),print:{saveStart:-1,saveLength:-1,saveScroll:-1,funcEnd:function(){}},buttonCounter:0,select:{type:"",selected:[],preRowSelect:null,postSelected:null,postDeselected:null,all:!1,selectedClass:""},custom:{},swfPath:"",buttonSet:[],master:!1,tags:{}};this.dom={container:null,table:null,print:{hidden:[],message:null},collection:{collection:null, +background:null}};this.classes=e.extend(!0,{},TableTools.classes);this.s.dt.bJUI&&e.extend(!0,this.classes,TableTools.classes_themeroller);this.fnSettings=function(){return this.s};"undefined"==typeof b&&(b={});this._fnConstruct(b);return this};TableTools.prototype={fnGetSelected:function(a){var b=[],c=this.s.dt.aoData,d=this.s.dt.aiDisplay,f;if(a){a=0;for(f=d.length;a<f;a++)c[d[a]]._DTTT_selected&&b.push(c[d[a]].nTr)}else{a=0;for(f=c.length;a<f;a++)c[a]._DTTT_selected&&b.push(c[a].nTr)}return b}, +fnGetSelectedData:function(){var a=[],b=this.s.dt.aoData,c,d;c=0;for(d=b.length;c<d;c++)b[c]._DTTT_selected&&a.push(this.s.dt.oInstance.fnGetData(c));return a},fnIsSelected:function(a){a=this.s.dt.oInstance.fnGetPosition(a);return!0===this.s.dt.aoData[a]._DTTT_selected?!0:!1},fnSelectAll:function(a){var b=this._fnGetMasterSettings();this._fnRowSelect(!0===a?b.dt.aiDisplay:b.dt.aoData)},fnSelectNone:function(a){this._fnGetMasterSettings();this._fnRowDeselect(this.fnGetSelected(a))},fnSelect:function(a){"single"== +this.s.select.type?(this.fnSelectNone(),this._fnRowSelect(a)):"multi"==this.s.select.type&&this._fnRowSelect(a)},fnDeselect:function(a){this._fnRowDeselect(a)},fnGetTitle:function(a){var b="";"undefined"!=typeof a.sTitle&&""!==a.sTitle?b=a.sTitle:(a=g.getElementsByTagName("title"),0<a.length&&(b=a[0].innerHTML));return 4>"\u00a1".toString().length?b.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""):b.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g,"")},fnCalcColRatios:function(a){var b=this.s.dt.aoColumns, +a=this._fnColumnTargets(a.mColumns),c=[],d=0,f=0,e,g;e=0;for(g=a.length;e<g;e++)a[e]&&(d=b[e].nTh.offsetWidth,f+=d,c.push(d));e=0;for(g=c.length;e<g;e++)c[e]/=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_TableTools.clients)if(a){var b=ZeroClipboard_TableTools.clients[a];"undefined"!=typeof b.domElement&&b.domElement.parentNode&&b.positionElement()}}, +fnResizeRequired:function(){for(var a in ZeroClipboard_TableTools.clients)if(a){var b=ZeroClipboard_TableTools.clients[a];if("undefined"!=typeof b.domElement&&b.domElement.parentNode==this.dom.container&&!1===b.sized)return!0}return!1},fnPrint:function(a,b){void 0===b&&(b={});void 0===a||a?this._fnPrintStart(b):this._fnPrintEnd()},fnInfo:function(a,b){var c=g.createElement("div");c.className=this.classes.print.info;c.innerHTML=a;g.body.appendChild(c);setTimeout(function(){e(c).fadeOut("normal",function(){g.body.removeChild(c)})}, +b)},_fnConstruct:function(a){var b=this;this._fnCustomiseSettings(a);this.dom.container=g.createElement(this.s.tags.container);this.dom.container.className=this.classes.container;"none"!=this.s.select.type&&this._fnRowSelectConfig();this._fnButtonDefinations(this.s.buttonSet,this.dom.container);this.s.dt.aoDestroyCallback.push({sName:"TableTools",fn:function(){e(b.s.dt.nTBody).off("click.DTTT_Select","tr");e(b.dom.container).empty()}})},_fnCustomiseSettings:function(a){"undefined"==typeof this.s.dt._TableToolsInit&& +(this.s.master=!0,this.s.dt._TableToolsInit=!0);this.dom.table=this.s.dt.nTable;this.s.custom=e.extend({},TableTools.DEFAULTS,a);this.s.swfPath=this.s.custom.sSwfPath;"undefined"!=typeof ZeroClipboard_TableTools&&(ZeroClipboard_TableTools.moviePath=this.s.swfPath);this.s.select.type=this.s.custom.sRowSelect;this.s.select.preRowSelect=this.s.custom.fnPreRowSelect;this.s.select.postSelected=this.s.custom.fnRowSelected;this.s.select.postDeselected=this.s.custom.fnRowDeselected;this.s.custom.sSelectedClass&& +(this.classes.select.row=this.s.custom.sSelectedClass);this.s.tags=this.s.custom.oTags;this.s.buttonSet=this.s.custom.aButtons},_fnButtonDefinations:function(a,b){for(var c,d=0,f=a.length;d<f;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)}b.appendChild(this._fnCreateButton(c,e(b).hasClass(this.classes.collection.container)))}},_fnCreateButton:function(a,b){var c=this._fnButtonBase(a,b);a.sAction.match(/flash/)?this._fnFlashConfig(c,a):"text"==a.sAction?this._fnTextConfig(c,a):"div"==a.sAction?this._fnTextConfig(c,a):"collection"==a.sAction&&(this._fnTextConfig(c,a),this._fnCollectionConfig(c,a));return c},_fnButtonBase:function(a,b){var c,d,f;b?(c="default"!== +a.sTag?a.sTag:this.s.tags.collection.button,d="default"!==a.sLinerTag?a.sLiner:this.s.tags.collection.liner,f=this.classes.collection.buttons.normal):(c="default"!==a.sTag?a.sTag:this.s.tags.button,d="default"!==a.sLinerTag?a.sLiner:this.s.tags.liner,f=this.classes.buttons.normal);c=g.createElement(c);d=g.createElement(d);var e=this._fnGetMasterSettings();c.className=f+" "+a.sButtonClass;c.setAttribute("id","ToolTables_"+this.s.dt.sInstance+"_"+e.buttonCounter);c.appendChild(d);d.innerHTML=a.sButtonText; +e.buttonCounter++;return c},_fnGetMasterSettings:function(){if(this.s.master)return this.s;for(var a=TableTools._aInstances,b=0,c=a.length;b<c;b++)if(this.dom.table==a[b].s.dt.nTable)return a[b].s},_fnCollectionConfig:function(a,b){var c=g.createElement(this.s.tags.collection.container);c.style.display="none";c.className=this.classes.collection.container;b._collection=c;g.body.appendChild(c);this._fnButtonDefinations(b.aButtons,c)},_fnCollectionShow:function(a,b){var c=this,d=e(a).offset(),f=b._collection, +j=d.left,d=d.top+e(a).outerHeight(),m=e(n).height(),h=e(g).height(),k=e(n).width(),o=e(g).width();f.style.position="absolute";f.style.left=j+"px";f.style.top=d+"px";f.style.display="block";e(f).css("opacity",0);var l=g.createElement("div");l.style.position="absolute";l.style.left="0px";l.style.top="0px";l.style.height=(m>h?m:h)+"px";l.style.width=(k>o?k:o)+"px";l.className=this.classes.collection.background;e(l).css("opacity",0);g.body.appendChild(l);g.body.appendChild(f);m=e(f).outerWidth();k=e(f).outerHeight(); +j+m>o&&(f.style.left=o-m+"px");d+k>h&&(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);this.fnResizeButtons();e(l).click(function(){c._fnCollectionHide.call(c,null,null)})},_fnCollectionHide:function(a,b){!(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,b=this.s.dt;e(b.nTable).addClass(this.classes.select.table);e(b.nTBody).on("click.DTTT_Select","tr",function(c){this.parentNode==b.nTBody&&null!==b.oInstance.fnGetData(this)&&(a.fnIsSelected(this)?a._fnRowDeselect(this,c):"single"==a.s.select.type?(a.fnSelectNone(), +a._fnRowSelect(this,c)):"multi"==a.s.select.type&&a._fnRowSelect(this,c))});b.oApi._fnCallbackReg(b,"aoRowCreatedCallback",function(c,d,f){b.aoData[f]._DTTT_selected&&e(c).addClass(a.classes.select.row)},"TableTools-SelectAll")}},_fnRowSelect:function(a,b){var c=this._fnSelectData(a),d=[],f,j;f=0;for(j=c.length;f<j;f++)c[f].nTr&&d.push(c[f].nTr);if(null===this.s.select.preRowSelect||this.s.select.preRowSelect.call(this,b,d,!0)){f=0;for(j=c.length;f<j;f++)c[f]._DTTT_selected=!0,c[f].nTr&&e(c[f].nTr).addClass(this.classes.select.row); +null!==this.s.select.postSelected&&this.s.select.postSelected.call(this,d);TableTools._fnEventDispatch(this,"select",d,!0)}},_fnRowDeselect:function(a,b){var c=this._fnSelectData(a),d=[],f,j;f=0;for(j=c.length;f<j;f++)c[f].nTr&&d.push(c[f].nTr);if(null===this.s.select.preRowSelect||this.s.select.preRowSelect.call(this,b,d,!1)){f=0;for(j=c.length;f<j;f++)c[f]._DTTT_selected=!1,c[f].nTr&&e(c[f].nTr).removeClass(this.classes.select.row);null!==this.s.select.postDeselected&&this.s.select.postDeselected.call(this, +d);TableTools._fnEventDispatch(this,"select",d,!1)}},_fnSelectData:function(a){var b=[],c,d,f;if(a.nodeName)c=this.s.dt.oInstance.fnGetPosition(a),b.push(this.s.dt.aoData[c]);else if("undefined"!==typeof a.length){d=0;for(f=a.length;d<f;d++)a[d].nodeName?(c=this.s.dt.oInstance.fnGetPosition(a[d]),b.push(this.s.dt.aoData[c])):"number"===typeof a[d]?b.push(this.s.dt.aoData[a[d]]):b.push(a[d])}else b.push(a);return b},_fnTextConfig:function(a,b){var c=this;null!==b.fnInit&&b.fnInit.call(this,a,b);""!== +b.sToolTip&&(a.title=b.sToolTip);e(a).hover(function(){b.fnMouseover!==null&&b.fnMouseover.call(this,a,b,null)},function(){b.fnMouseout!==null&&b.fnMouseout.call(this,a,b,null)});null!==b.fnSelect&&TableTools._fnEventListen(this,"select",function(d){b.fnSelect.call(c,a,b,d)});e(a).click(function(d){b.fnClick!==null&&b.fnClick.call(c,a,b,null,d);b.fnComplete!==null&&b.fnComplete.call(c,a,b,null,null);c._fnCollectionHide(a,b)})},_fnFlashConfig:function(a,b){var c=this,d=new ZeroClipboard_TableTools.Client; +null!==b.fnInit&&b.fnInit.call(this,a,b);d.setHandCursor(!0);"flash_save"==b.sAction?(d.setAction("save"),d.setCharSet("utf16le"==b.sCharSet?"UTF16LE":"UTF8"),d.setBomInc(b.bBomInc),d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))):"flash_pdf"==b.sAction?(d.setAction("pdf"),d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))):d.setAction("copy");d.addEventListener("mouseOver",function(){b.fnMouseover!==null&&b.fnMouseover.call(c,a,b,d)});d.addEventListener("mouseOut",function(){b.fnMouseout!== +null&&b.fnMouseout.call(c,a,b,d)});d.addEventListener("mouseDown",function(){b.fnClick!==null&&b.fnClick.call(c,a,b,d)});d.addEventListener("complete",function(f,e){b.fnComplete!==null&&b.fnComplete.call(c,a,b,d,e);c._fnCollectionHide(a,b)});this._fnFlashGlue(d,a,b.sToolTip)},_fnFlashGlue:function(a,b,c){var d=this,f=b.getAttribute("id");g.getElementById(f)?a.glue(b,c):setTimeout(function(){d._fnFlashGlue(a,b,c)},100)},_fnFlashSetText:function(a,b){var c=this._fnChunkData(b,8192);a.clearText();for(var d= +0,f=c.length;d<f;d++)a.appendText(c[d])},_fnColumnTargets:function(a){var b=[],c=this.s.dt;if("object"==typeof a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(!1);i=0;for(iLen=a.length;i<iLen;i++)b[a[i]]=!0}else if("visible"==a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?!0:!1)}else if("hidden"==a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?!1:!0)}else if("sortable"==a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bSortable? +!0:!1)}else{i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(!0)}return b},_fnNewline:function(a){return"auto"==a.sNewLine?navigator.userAgent.match(/Windows/)?"\r\n":"\n":a.sNewLine},_fnGetDataTablesData:function(a){var b,c,d,f,j,g=[],h="",k=this.s.dt,o,l=RegExp(a.sFieldBoundary,"g"),n=this._fnColumnTargets(a.mColumns);d="undefined"!=typeof a.bSelectedOnly?a.bSelectedOnly:!1;if(a.bHeader){j=[];b=0;for(c=k.aoColumns.length;b<c;b++)n[b]&&(h=k.aoColumns[b].sTitle.replace(/\n/g," ").replace(/<.*?>/g, +"").replace(/^\s+|\s+$/g,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));g.push(j.join(a.sFieldSeperator))}var p=k.aiDisplay;f=this.fnGetSelected();if("none"!==this.s.select.type&&d&&0!==f.length){p=[];b=0;for(c=f.length;b<c;b++)p.push(k.oInstance.fnGetPosition(f[b]))}d=0;for(f=p.length;d<f;d++){o=k.aoData[p[d]].nTr;j=[];b=0;for(c=k.aoColumns.length;b<c;b++)n[b]&&(h=k.oApi._fnGetCellData(k,p[d],b,"display"),a.fnCellRender?h=a.fnCellRender(h,b,o,p[d])+"":"string"==typeof h? +(h=h.replace(/\n/g," "),h=h.replace(/<img.*?\s+alt\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+)).*?>/gi,"$1$2$3"),h=h.replace(/<.*?>/g,"")):h+="",h=h.replace(/^\s+/,"").replace(/\s+$/,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));g.push(j.join(a.sFieldSeperator));a.bOpenRows&&(b=e.grep(k.aoOpenRows,function(a){return a.nParent===o}),1===b.length&&(h=this._fnBoundData(e("td",b[0].nTr).html(),a.sFieldBoundary,l),g.push(h)))}if(a.bFooter&&null!==k.nTFoot){j=[];b=0;for(c=k.aoColumns.length;b< +c;b++)n[b]&&null!==k.aoColumns[b].nTf&&(h=k.aoColumns[b].nTf.innerHTML.replace(/\n/g," ").replace(/<.*?>/g,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));g.push(j.join(a.sFieldSeperator))}return _sLastData=g.join(this._fnNewline(a))},_fnBoundData:function(a,b,c){return""===b?a:b+a.replace(c,b+b)+b},_fnChunkData:function(a,b){for(var c=[],d=a.length,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(-1===a.indexOf("&"))return a; +var b=g.createElement("div");return a.replace(/&([^\s]*);/g,function(a,d){if("#"===a.substr(1,1))return String.fromCharCode(Number(d.substr(1)));b.innerHTML=a;return b.childNodes[0].nodeValue})},_fnPrintStart:function(a){var b=this,c=this.s.dt;this._fnPrintHideNodes(c.nTable);this.s.print.saveStart=c._iDisplayStart;this.s.print.saveLength=c._iDisplayLength;a.bShowAll&&(c._iDisplayStart=0,c._iDisplayLength=-1,c.oApi._fnCalculateEnd(c),c.oApi._fnDraw(c));if(""!==c.oScroll.sX||""!==c.oScroll.sY)this._fnPrintScrollStart(c), +e(this.s.dt.nTable).bind("draw.DTTT_Print",function(){b._fnPrintScrollStart(c)});var d=c.aanFeatures,f;for(f in d)if("i"!=f&&"t"!=f&&1==f.length)for(var j=0,m=d[f].length;j<m;j++)this.dom.print.hidden.push({node:d[f][j],display:"block"}),d[f][j].style.display="none";e(g.body).addClass(this.classes.print.body);""!==a.sInfo&&this.fnInfo(a.sInfo,3E3);a.sMessage&&(this.dom.print.message=g.createElement("div"),this.dom.print.message.className=this.classes.print.message,this.dom.print.message.innerHTML= +a.sMessage,g.body.insertBefore(this.dom.print.message,g.body.childNodes[0]));this.s.print.saveScroll=e(n).scrollTop();n.scrollTo(0,0);e(g).bind("keydown.DTTT",function(a){if(a.keyCode==27){a.preventDefault();b._fnPrintEnd.call(b,a)}})},_fnPrintEnd:function(){var a=this.s.dt,b=this.s.print,c=this.dom.print;this._fnPrintShowNodes();if(""!==a.oScroll.sX||""!==a.oScroll.sY)e(this.s.dt.nTable).unbind("draw.DTTT_Print"),this._fnPrintScrollEnd();n.scrollTo(0,b.saveScroll);null!==c.message&&(g.body.removeChild(c.message), +c.message=null);e(g.body).removeClass("DTTT_Print");a._iDisplayStart=b.saveStart;a._iDisplayLength=b.saveLength;a.oApi._fnCalculateEnd(a);a.oApi._fnDraw(a);e(g).unbind("keydown.DTTT")},_fnPrintScrollStart:function(){var a=this.s.dt;a.nScrollHead.getElementsByTagName("div")[0].getElementsByTagName("table");var b=a.nTable.parentNode,c=a.nTable.getElementsByTagName("thead");0<c.length&&a.nTable.removeChild(c[0]);null!==a.nTFoot&&(c=a.nTable.getElementsByTagName("tfoot"),0<c.length&&a.nTable.removeChild(c[0])); +c=a.nTHead.cloneNode(!0);a.nTable.insertBefore(c,a.nTable.childNodes[0]);null!==a.nTFoot&&(c=a.nTFoot.cloneNode(!0),a.nTable.insertBefore(c,a.nTable.childNodes[1]));""!==a.oScroll.sX&&(a.nTable.style.width=e(a.nTable).outerWidth()+"px",b.style.width=e(a.nTable).outerWidth()+"px",b.style.overflow="visible");""!==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;""!==a.oScroll.sX&&(b.style.width= +a.oApi._fnStringToCss(a.oScroll.sX),b.style.overflow="auto");""!==a.oScroll.sY&&(b.style.height=a.oApi._fnStringToCss(a.oScroll.sY),b.style.overflow="auto")},_fnPrintShowNodes:function(){for(var a=this.dom.print.hidden,b=0,c=a.length;b<c;b++)a[b].node.style.display=a[b].display;a.splice(0,a.length)},_fnPrintHideNodes:function(a){for(var b=this.dom.print.hidden,c=a.parentNode,d=c.childNodes,f=0,g=d.length;f<g;f++)if(d[f]!=a&&1==d[f].nodeType){var m=e(d[f]).css("display");"none"!=m&&(b.push({node:d[f], +display:m}),d[f].style.display="none")}"BODY"!=c.nodeName&&this._fnPrintHideNodes(c)}};TableTools._aInstances=[];TableTools._aListeners=[];TableTools.fnGetMasters=function(){for(var a=[],b=0,c=TableTools._aInstances.length;b<c;b++)TableTools._aInstances[b].s.master&&a.push(TableTools._aInstances[b]);return a};TableTools.fnGetInstance=function(a){"object"!=typeof a&&(a=g.getElementById(a));for(var b=0,c=TableTools._aInstances.length;b<c;b++)if(TableTools._aInstances[b].s.master&&TableTools._aInstances[b].dom.table== +a)return TableTools._aInstances[b];return null};TableTools._fnEventListen=function(a,b,c){TableTools._aListeners.push({that:a,type:b,fn:c})};TableTools._fnEventDispatch=function(a,b,c,d){for(var f=TableTools._aListeners,e=0,g=f.length;e<g;e++)a.dom.table==f[e].that.dom.table&&f[e].type==b&&f[e].fn(c,d)};TableTools.buttonBase={sAction:"text",sTag:"default",sLinerTag:"default",sButtonClass:"DTTT_button_text",sButtonText:"Button text",sTitle:"",sToolTip:"",sCharSet:"utf8",bBomInc:!1,sFileName:"*.csv", +sFieldBoundary:"",sFieldSeperator:"\t",sNewLine:"auto",mColumns:"all",bHeader:!0,bFooter:!0,bOpenRows:!1,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null};TableTools.BUTTONS={csv:e.extend({},TableTools.buttonBase,{sAction:"flash_save",sButtonClass:"DTTT_button_csv",sButtonText:"CSV",sFieldBoundary:'"',sFieldSeperator:",",fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))}}),xls:e.extend({},TableTools.buttonBase, +{sAction:"flash_save",sCharSet:"utf16le",bBomInc:!0,sButtonClass:"DTTT_button_xls",sButtonText:"Excel",fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))}}),copy:e.extend({},TableTools.buttonBase,{sAction:"flash_copy",sButtonClass:"DTTT_button_copy",sButtonText:"Copy",fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))},fnComplete:function(a,b,c,d){a=d.split("\n").length;a=null===this.s.dt.nTFoot?a-1:a-2;this.fnInfo("<h6>Table copied</h6><p>Copied "+a+" row"+(1==a?"":"s")+ +" to the clipboard.</p>",1500)}}),pdf:e.extend({},TableTools.buttonBase,{sAction:"flash_pdf",sNewLine:"\n",sFileName:"*.pdf",sButtonClass:"DTTT_button_pdf",sButtonText:"PDF",sPdfOrientation:"portrait",sPdfSize:"A4",sPdfMessage:"",fnClick:function(a,b,c){this.fnSetText(c,"title:"+this.fnGetTitle(b)+"\nmessage:"+b.sPdfMessage+"\ncolWidth:"+this.fnCalcColRatios(b)+"\norientation:"+b.sPdfOrientation+"\nsize:"+b.sPdfSize+"\n--/TableToolsOpts--\n"+this.fnGetTableData(b))}}),print:e.extend({},TableTools.buttonBase, +{sInfo:"<h6>Print view</h6><p>Please use your browser's print function to print this table. Press escape when finished.",sMessage:null,bShowAll:!0,sToolTip:"View print view",sButtonClass:"DTTT_button_print",sButtonText:"Print",fnClick:function(a,b){this.fnPrint(!0,b)}}),text:e.extend({},TableTools.buttonBase),select:e.extend({},TableTools.buttonBase,{sButtonText:"Select button",fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)}, +fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),select_single:e.extend({},TableTools.buttonBase,{sButtonText:"Select button",fnSelect:function(a){1==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),select_all:e.extend({},TableTools.buttonBase,{sButtonText:"Select all",fnClick:function(){this.fnSelectAll()},fnSelect:function(a){this.fnGetSelected().length== +this.s.dt.fnRecordsDisplay()?e(a).addClass(this.classes.buttons.disabled):e(a).removeClass(this.classes.buttons.disabled)}}),select_none:e.extend({},TableTools.buttonBase,{sButtonText:"Deselect all",fnClick:function(){this.fnSelectNone()},fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),ajax:e.extend({},TableTools.buttonBase,{sAjaxUrl:"/xhr.php", +sButtonText:"Ajax button",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")}})},fnAjaxComplete:function(){alert("Ajax complete")}}),div:e.extend({},TableTools.buttonBase,{sAction:"div",sTag:"div",sButtonClass:"DTTT_nonbutton",sButtonText:"Text button"}),collection:e.extend({},TableTools.buttonBase,{sAction:"collection", +sButtonClass:"DTTT_button_collection",sButtonText:"Collection",fnClick:function(a,b){this._fnCollectionShow(a,b)}})};TableTools.classes={container:"DTTT_container",buttons:{normal:"DTTT_button",disabled:"DTTT_disabled"},collection:{container:"DTTT_collection",background:"DTTT_collection_background",buttons:{normal:"DTTT_button",disabled:"DTTT_disabled"}},select:{table:"DTTT_selectable",row:"DTTT_selected"},print:{body:"DTTT_Print",info:"DTTT_print_info",message:"DTTT_PrintMessage"}};TableTools.classes_themeroller= +{container:"DTTT_container ui-buttonset ui-buttonset-multi",buttons:{normal:"DTTT_button ui-button ui-state-default"},collection:{container:"DTTT_collection ui-buttonset ui-buttonset-multi"}};TableTools.DEFAULTS={sSwfPath:"media/swf/copy_csv_xls_pdf.swf",sRowSelect:"none",sSelectedClass:null,fnPreRowSelect:null,fnRowSelected:null,fnRowDeselected:null,aButtons:["copy","csv","xls","pdf","print"],oTags:{container:"div",button:"a",liner:"span",collection:{container:"div",button:"a",liner:"span"}}};TableTools.prototype.CLASS= +"TableTools";TableTools.VERSION="2.1.5";TableTools.prototype.VERSION=TableTools.VERSION;"function"==typeof e.fn.dataTable&&"function"==typeof e.fn.dataTableExt.fnVersionCheck&&e.fn.dataTableExt.fnVersionCheck("1.9.0")?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.9.0 or newer - www.datatables.net/download"); +e.fn.DataTable.TableTools=TableTools})(jQuery,window,document); diff --git a/wqflask/wqflask/static/packages/TableTools/media/js/TableTools.min.js.gz b/wqflask/wqflask/static/packages/TableTools/media/js/TableTools.min.js.gz Binary files differnew file mode 100644 index 00000000..01ce7c04 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/js/TableTools.min.js.gz diff --git a/wqflask/wqflask/static/packages/TableTools/media/js/ZeroClipboard.js b/wqflask/wqflask/static/packages/TableTools/media/js/ZeroClipboard.js new file mode 100755 index 00000000..de0f6b67 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/js/ZeroClipboard.js @@ -0,0 +1,367 @@ +// Simple Set Clipboard System +// Author: Joseph Huckaby + +var ZeroClipboard_TableTools = { + + version: "1.0.4-TableTools2", + clients: {}, // registered upload clients on page, indexed by id + moviePath: '', // URL to movie + nextId: 1, // ID of next movie + + $: function(thingy) { + // simple DOM lookup utility function + if (typeof(thingy) == 'string') thingy = document.getElementById(thingy); + if (!thingy.addClass) { + // extend element with a few useful methods + thingy.hide = function() { this.style.display = 'none'; }; + thingy.show = function() { this.style.display = ''; }; + thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; }; + thingy.removeClass = function(name) { + this.className = this.className.replace( new RegExp("\\s*" + name + "\\s*"), " ").replace(/^\s+/, '').replace(/\s+$/, ''); + }; + thingy.hasClass = function(name) { + return !!this.className.match( new RegExp("\\s*" + name + "\\s*") ); + } + } + return thingy; + }, + + setMoviePath: function(path) { + // set path to ZeroClipboard.swf + this.moviePath = path; + }, + + dispatch: function(id, eventName, args) { + // receive event from flash movie, send to client + var client = this.clients[id]; + if (client) { + client.receiveEvent(eventName, args); + } + }, + + register: function(id, client) { + // register new client to receive events + this.clients[id] = client; + }, + + getDOMObjectPosition: function(obj) { + // get absolute coordinates for dom element + var info = { + left: 0, + top: 0, + width: obj.width ? obj.width : obj.offsetWidth, + height: obj.height ? obj.height : obj.offsetHeight + }; + + if ( obj.style.width != "" ) + info.width = obj.style.width.replace("px",""); + + if ( obj.style.height != "" ) + info.height = obj.style.height.replace("px",""); + + while (obj) { + info.left += obj.offsetLeft; + info.top += obj.offsetTop; + obj = obj.offsetParent; + } + + return info; + }, + + Client: function(elem) { + // constructor for new simple upload client + this.handlers = {}; + + // unique ID + this.id = ZeroClipboard_TableTools.nextId++; + this.movieId = 'ZeroClipboard_TableToolsMovie_' + this.id; + + // register client with singleton to receive flash events + ZeroClipboard_TableTools.register(this.id, this); + + // create movie + if (elem) this.glue(elem); + } +}; + +ZeroClipboard_TableTools.Client.prototype = { + + id: 0, // unique ID for us + ready: false, // whether movie is ready to receive events or not + movie: null, // reference to movie object + clipText: '', // text to copy to clipboard + fileName: '', // default file save name + action: 'copy', // action to perform + handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor + cssEffects: true, // enable CSS mouse effects on dom container + handlers: null, // user event handlers + sized: false, + + glue: function(elem, title) { + // glue to DOM element + // elem can be ID or actual DOM element object + this.domElement = ZeroClipboard_TableTools.$(elem); + + // float just above object, or zIndex 99 if dom element isn't set + var zIndex = 99; + if (this.domElement.style.zIndex) { + zIndex = parseInt(this.domElement.style.zIndex) + 1; + } + + // find X/Y position of domElement + var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement); + + // create floating DIV above element + this.div = document.createElement('div'); + var style = this.div.style; + style.position = 'absolute'; + style.left = '0px'; + style.top = '0px'; + style.width = (box.width) + 'px'; + style.height = box.height + 'px'; + style.zIndex = zIndex; + + if ( typeof title != "undefined" && title != "" ) { + this.div.title = title; + } + if ( box.width != 0 && box.height != 0 ) { + this.sized = true; + } + + // style.backgroundColor = '#f00'; // debug + if ( this.domElement ) { + this.domElement.appendChild(this.div); + this.div.innerHTML = this.getHTML( box.width, box.height ); + } + }, + + positionElement: function() { + var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement); + var style = this.div.style; + + style.position = 'absolute'; + //style.left = (this.domElement.offsetLeft)+'px'; + //style.top = this.domElement.offsetTop+'px'; + style.width = box.width + 'px'; + style.height = box.height + 'px'; + + if ( box.width != 0 && box.height != 0 ) { + this.sized = true; + } else { + return; + } + + var flash = this.div.childNodes[0]; + flash.width = box.width; + flash.height = box.height; + }, + + getHTML: function(width, height) { + // return HTML for movie + var html = ''; + var flashvars = 'id=' + this.id + + '&width=' + width + + '&height=' + height; + + 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_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_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; + }, + + hide: function() { + // temporarily hide floater offscreen + if (this.div) { + this.div.style.left = '-2000px'; + } + }, + + show: function() { + // show ourselves after a call to hide() + this.reposition(); + }, + + destroy: function() { + // destroy control and floater + if (this.domElement && this.div) { + this.hide(); + this.div.innerHTML = ''; + + var body = document.getElementsByTagName('body')[0]; + try { body.removeChild( this.div ); } catch(e) {;} + + this.domElement = null; + this.div = null; + } + }, + + reposition: function(elem) { + // reposition our floating div, optionally to new container + // warning: container CANNOT change size, only position + if (elem) { + this.domElement = ZeroClipboard_TableTools.$(elem); + if (!this.domElement) this.hide(); + } + + if (this.domElement && this.div) { + var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement); + var style = this.div.style; + style.left = '' + box.left + 'px'; + style.top = '' + box.top + 'px'; + } + }, + + clearText: function() { + // clear the text to be copy / saved + this.clipText = ''; + if (this.ready) this.movie.clearText(); + }, + + appendText: function(newText) { + // append text to that which is to be copied / saved + this.clipText += newText; + if (this.ready) { this.movie.appendText(newText) ;} + }, + + setText: function(newText) { + // set text to be copied to be copied / saved + this.clipText = newText; + if (this.ready) { this.movie.setText(newText) ;} + }, + + setCharSet: function(charSet) { + // set the character set (UTF16LE or UTF8) + this.charSet = charSet; + if (this.ready) { this.movie.setCharSet(charSet) ;} + }, + + setBomInc: function(bomInc) { + // set if the BOM should be included or not + this.incBom = bomInc; + if (this.ready) { this.movie.setBomInc(bomInc) ;} + }, + + setFileName: function(newText) { + // set the file name + this.fileName = newText; + if (this.ready) this.movie.setFileName(newText); + }, + + setAction: function(newText) { + // set action (save or copy) + this.action = newText; + if (this.ready) this.movie.setAction(newText); + }, + + addEventListener: function(eventName, func) { + // add user event listener for event + // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel + eventName = eventName.toString().toLowerCase().replace(/^on/, ''); + if (!this.handlers[eventName]) this.handlers[eventName] = []; + this.handlers[eventName].push(func); + }, + + setHandCursor: function(enabled) { + // enable hand cursor (true), or default arrow cursor (false) + this.handCursorEnabled = enabled; + if (this.ready) this.movie.setHandCursor(enabled); + }, + + setCSSEffects: function(enabled) { + // enable or disable CSS effects on DOM container + this.cssEffects = !!enabled; + }, + + receiveEvent: function(eventName, args) { + // receive event from flash + eventName = eventName.toString().toLowerCase().replace(/^on/, ''); + + // special behavior for certain events + switch (eventName) { + case 'load': + // movie claims it is ready, but in IE this isn't always the case... + // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function + this.movie = document.getElementById(this.movieId); + if (!this.movie) { + var self = this; + setTimeout( function() { self.receiveEvent('load', null); }, 1 ); + return; + } + + // firefox on pc needs a "kick" in order to set these in certain cases + if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) { + var self = this; + setTimeout( function() { self.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': + if (this.domElement && this.cssEffects) { + //this.domElement.addClass('hover'); + if (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; + } + //this.domElement.removeClass('hover'); + } + break; + + case 'mousedown': + if (this.domElement && this.cssEffects) { + this.domElement.addClass('active'); + } + break; + + case 'mouseup': + if (this.domElement && this.cssEffects) { + this.domElement.removeClass('active'); + this.recoverActive = false; + } + break; + } // switch eventName + + if (this.handlers[eventName]) { + for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) { + var func = this.handlers[eventName][idx]; + + if (typeof(func) == 'function') { + // actual function reference + func(this, args); + } + else if ((typeof(func) == 'object') && (func.length == 2)) { + // PHP style object + method, i.e. [myObject, 'myMethod'] + func[0][ func[1] ](this, args); + } + else if (typeof(func) == 'string') { + // name of function + window[func](this, args); + } + } // foreach event handler defined + } // user defined handler for event + } + +}; diff --git a/wqflask/wqflask/static/packages/TableTools/media/swf/copy_csv_xls.swf b/wqflask/wqflask/static/packages/TableTools/media/swf/copy_csv_xls.swf Binary files differnew file mode 100644 index 00000000..082c7acb --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/swf/copy_csv_xls.swf diff --git a/wqflask/wqflask/static/packages/TableTools/media/swf/copy_csv_xls_pdf.swf b/wqflask/wqflask/static/packages/TableTools/media/swf/copy_csv_xls_pdf.swf Binary files differnew file mode 100644 index 00000000..063131df --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/media/swf/copy_csv_xls_pdf.swf diff --git a/wqflask/wqflask/static/packages/TableTools/multi_instance.html b/wqflask/wqflask/static/packages/TableTools/multi_instance.html new file mode 100755 index 00000000..14e1e63e --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/multi_instance.html @@ -0,0 +1,499 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table.css"; + @import "media/css/TableTools.css"; + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip<"clear spacer">T' + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example - multiple toolbars + </div> + + <h1>Preamble</h1> + <p>Like all DataTables control elements, TableTools can have multiple instances specified in the <i>sDom</i> parameter of DataTables. This will create two TableTools toolbars next to the table, providing the same functions. An example of when this might be useful is to show the toolbar both above and below the table - as is done in this example.</p> + + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip<"clear spacer">T' + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/multiple_tables.html b/wqflask/wqflask/static/packages/TableTools/multiple_tables.html new file mode 100755 index 00000000..8cd8aef9 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/multiple_tables.html @@ -0,0 +1,296 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table.css"; + @import "media/css/TableTools.css"; + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + $('table.display').dataTable( { + "sDom": 'T<"clear">lfrtip' + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example - multiple tables + </div> + + <h1>Preamble</h1> + <p>This example shows how multiple tables can be initialised with DataTables and TableTools in a single call to the $().dataTable() function. Basically it works as you would expect - no special considerations need be made!</p> + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + </tbody> +</table> + + +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example2"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip' + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/pdf_message.html b/wqflask/wqflask/static/packages/TableTools/pdf_message.html new file mode 100755 index 00000000..e8f66e12 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/pdf_message.html @@ -0,0 +1,524 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table.css"; + @import "media/css/TableTools.css"; + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "aButtons": [ + "copy", + "csv", + "xls", + { + "sExtends": "pdf", + "sPdfOrientation": "landscape", + "sPdfMessage": "Your custom message would go here." + }, + "print" + ] + } + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example + </div> + + <h1>Preamble</h1> + <p>This example shows how you can add a message to the saved PDF using the 'sPdfMessage' parameter. It also shows that the orientation of the output PDF can be changed to landscape which is useful if you have a lot of columns.</p> + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "aButtons": [ + "copy", + "csv", + "xls", + { + "sExtends": "pdf", + "sPdfOrientation": "landscape", + "sPdfMessage": "Your custom message would go here." + } + "print" + ] + } + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/plug-in.html b/wqflask/wqflask/static/packages/TableTools/plug-in.html new file mode 100755 index 00000000..08a055bf --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/plug-in.html @@ -0,0 +1,539 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table.css"; + @import "media/css/TableTools.css"; + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + TableTools.BUTTONS.copy_to_div = $.extend( true, TableTools.buttonBase, { + "sNewLine": "<br>", + "sButtonText": "Copy to element", + "sDiv": "", + "fnClick": function( nButton, oConfig ) { + document.getElementById(oConfig.sDiv).innerHTML = + this.fnGetTableData(oConfig); + } + } ); + + $(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "aButtons": [ + { + "sExtends": "copy_to_div", + "sButtonText": "Copy to div", + "sDiv": "copy", + } + ] + } + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example - plug-ins + </div> + + <h1>Preamble</h1> + <p>Plug-ins in TableTools take the form of additional buttons types, which provide extra options and flexibility for TableTools. This example shows how a plug-in button type can be defined and then used in the TableTools initialisation. Note that the <i>TableTools.buttonBase</i> object is extended with our required parameters - this base object provides default values for all of the options TableTools can work with, so they don't all have to be defined in our button.</p> + <p>Additional plug-ins for TableTools can be found <a href="http://datatables.net/extras/tabletools/plug-ins">on the DataTables.net site</a>. The example plug-in here shows a button which is used to insert the data from the table into a given element.</p> + + <h1>Live example</h1> + + <div id="copy" class="box" style="height: 100px; overflow: auto"></div> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>TableTools.BUTTONS.copy_to_div = $.extend( true, TableTools.buttonBase, { + "sNewLine": "<br>", + "sButtonText": "Copy to element", + "sDiv": "", + "fnClick": function( nButton, oConfig ) { + document.getElementById(oConfig.sDiv).innerHTML = + this.fnGetTableData(oConfig); + } +} ); + +$(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "aButtons": [ + { + "sExtends": "copy_to_div", + "sButtonText": "Copy to div", + "sDiv": "copy", + } + ] + } + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/select_multi.html b/wqflask/wqflask/static/packages/TableTools/select_multi.html new file mode 100755 index 00000000..ee94789c --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/select_multi.html @@ -0,0 +1,507 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table.css"; + @import "media/css/TableTools.css"; + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "sRowSelect": "multi", + "aButtons": [ "select_all", "select_none" ] + } + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example - multi-row select + </div> + + <h1>Preamble</h1> + <p>As well as providing a button toolbar, TableTools provides everything needed to have selectable rows in the table. Row selection is turned off by default in TableTools, but can be enabled using the <i>sRowSelect</i> parameter, set to either 'multi' or 'single'. When set the end user can select rows by simply clicking on them. TableTools provides <a href="http://datatables.net/extras/tabletools/api">a set of API methods</a> and <a href="http://datatables.net/extras/tabletools/initialisation">callbacks</a> for controlling and monitoring the row selection in TableTools. There are also a number of <a href="http://datatables.net/extras/tabletools/buttons">pre-defined buttons</a> to provide functions such as select-all and select-none, as shown in this example.</p> + + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "sRowSelect": "multi", + "aButtons": [ "select_all", "select_none" ] + } + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/select_single.html b/wqflask/wqflask/static/packages/TableTools/select_single.html new file mode 100755 index 00000000..94a47893 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/select_single.html @@ -0,0 +1,505 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table.css"; + @import "media/css/TableTools.css"; + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "sRowSelect": "single" + } + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example - single row selection + </div> + + <h1>Preamble</h1> + <p>As well as providing a button toolbar, TableTools provides everything needed to have selectable rows in the table. Row selection is turned off by default in TableTools, but can be enabled using the <i>sRowSelect</i> parameter, set to either 'multi' or 'single'. When set the end user can select rows by simply clicking on them. TableTools provides <a href="http://datatables.net/extras/tabletools/api">a set of API methods</a> and <a href="http://datatables.net/extras/tabletools/initialisation">callbacks</a> for controlling and monitoring the row selection in TableTools. This example shows single row selection enabled.</p> + + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "sRowSelect": "single" + } + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/swf_path.html b/wqflask/wqflask/static/packages/TableTools/swf_path.html new file mode 100755 index 00000000..c82633b4 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/swf_path.html @@ -0,0 +1,505 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table.css"; + @import "media/css/TableTools.css"; + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "sSwfPath": "media/swf/copy_csv_xls_pdf.swf" + } + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example - setting SWF path + </div> + + <h1>Preamble</h1> + <p>TableTools uses a Flash SWF file to provide the ability to copy text to the system clipboard and save files locally. TableTools must be able to load the SWF file in order to provide these facilities. If you aren't using the same directory structure as the TableTools package, you will need to set this parameter.</p> + <p>Note that TableTools ships with two different SWF files - the only difference between them is that one of them provides the ability to save PDF files while the other doesn't. The trade off is that the PDF capable file is significantly larger in size (56K v 2K).</p> + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip', + "oTableTools": { + "sSwfPath": "media/swf/copy_csv_xls_pdf.swf" + } + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/tabs.html b/wqflask/wqflask/static/packages/TableTools/tabs.html new file mode 100755 index 00000000..915cc821 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/tabs.html @@ -0,0 +1,348 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table_jui.css"; + @import "../../examples/examples_support/themes/smoothness/jquery-ui-1.8.4.custom.css"; + @import "media/css/TableTools_JUI.css"; + .ui-tabs .ui-tabs-panel { padding: 10px } + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="../../examples/examples_support/jquery-ui-tabs.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready(function() { + $("#tabs").tabs( { + "show": function(event, ui) { + var jqTable = $('table.display', ui.panel); + if ( jqTable.length > 0 ) { + var oTableTools = TableTools.fnGetInstance( jqTable[0] ); + if ( oTableTools != null && oTableTools.fnResizeRequired() ) + { + /* A resize of TableTools' buttons and DataTables' columns is only required on the + * first visible draw of the table + */ + jqTable.dataTable().fnAdjustColumnSizing(); + oTableTools.fnResizeButtons(); + } + } + } + } ); + + $('#example1').dataTable( { + "bJQueryUI": true, + "sPaginationType": "full_numbers", + "sDom": '<"H"Tfr>t<"F"ip>' + } ); + + $('#example2').dataTable( { + "bJQueryUI": true, + "sPaginationType": "full_numbers", + "sDom": '<"H"Tfr>t<"F"ip>' + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example + </div> + + <h1>Preamble</h1> + <p>This example shows the basic initialisation of TableTools by simply including the 'T' marker in DataTables' sDom parameter. This tell DataTables to insert the TableTools toolbar in that location. Remember to include the Javascript and CSS source files as well!</p> + <p>It is worth noting that you might need to <a href="swf_path.html">set the <i>sSwfPath</i> parameter</a> to tell TableTools where to find the SWF file for copy and file save.</p> + + <h1>Live example</h1> + <div id="demo"> + <div id="tabs"> + <ul> + <li><a href="#tabs-1">Trident browsers</a></li> + <li><a href="#tabs-2">Gecko browsers</a></li> + </ul> + + <div id="tabs-1"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example1"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>Grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>Grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd gradeX"> + <td>Trident</td> + <td>Internet + Explorer 4.0</td> + <td>Win 95+</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="odd gradeC"> + <td>Trident</td> + <td>Internet + Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd gradeA"> + <td>Trident</td> + <td>Internet + Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="odd gradeA"> + <td>Trident</td> + <td>Internet + Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="odd gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tbody> +</table> + </div> + + + <div id="tabs-2"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example2"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>Grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>Grade</th> + </tr> + </tfoot> + <tbody> + <tr class="gradeA"> + <td>Gecko</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + </tbody> +</table> + </div> + </div> + </div> + <div class="spacer"></div> + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + $('#example').dataTable( { + "sDom": 'T<"clear">lfrtip' + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/static/packages/TableTools/theme.html b/wqflask/wqflask/static/packages/TableTools/theme.html new file mode 100755 index 00000000..fcda07a0 --- /dev/null +++ b/wqflask/wqflask/static/packages/TableTools/theme.html @@ -0,0 +1,524 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico"> + + <title>TableTools example</title> + <style type="text/css" title="currentStyle"> + @import "../../media/css/demo_page.css"; + @import "../../media/css/demo_table_jui.css"; + @import "../../examples/examples_support/themes/smoothness/jquery-ui-1.8.4.custom.css"; + @import "media/css/TableTools_JUI.css"; + </style> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script> + <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/ZeroClipboard.js"></script> + <script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + $('#example').dataTable( { + "bJQueryUI": true, + "sPaginationType": "full_numbers", + "sDom": '<"H"Tfr>t<"F"ip>', + "oTableTools": { + "aButtons": [ + "copy", "csv", "xls", "pdf", + { + "sExtends": "collection", + "sButtonText": "Save", + "aButtons": [ "csv", "xls", "pdf" ] + } + ] + } + } ); + } ); + </script> + </head> + <body id="dt_example"> + <div id="container"> + <div class="full_width big"> + TableTools example - jQuery UI theming + </div> + + <h1>Preamble</h1> + <p>Like DataTables, TableTools can be styled by a jQuery UI theme. The required classes for the theming with TableTools are added automatically when the <i>bJQueryUI</i> option is detected from DataTables. This example shows that in action, and also defines a button collection to show the themeing there.</p> + + + <h1>Live example</h1> + <div id="demo"> +<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> + <thead> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </thead> + <tfoot> + <tr> + <th>Rendering engine</th> + <th>Browser</th> + <th>Platform(s)</th> + <th>Engine version</th> + <th>CSS grade</th> + </tr> + </tfoot> + <tbody> + <tr class="odd_gradeX"> + <td>Trident</td> + <td>Internet Explorer 4.0</td> + <td>Win 95+ (Entity: &)</td> + <td class="center">4</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Trident</td> + <td>Internet Explorer 5.0</td> + <td>Win 95+</td> + <td class="center">5</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 5.5</td> + <td>Win 95+</td> + <td class="center">5.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>Internet Explorer 6</td> + <td>Win 98+</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Trident</td> + <td>Internet Explorer 7</td> + <td>Win XP SP2+</td> + <td class="center">7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Trident</td> + <td>AOL browser (AOL desktop)</td> + <td>Win XP</td> + <td class="center">6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko (UTF-8: $¢€)</td> + <td>Firefox 1.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 1.5</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Firefox 2.0</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Firefox 3.0</td> + <td>Win 2k+ / OSX.3+</td> + <td class="center">1.9</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Camino 1.0</td> + <td>OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Camino 1.5</td> + <td>OSX.3+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape 7.2</td> + <td>Win 95+ / Mac OS 8.6-9.2</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Netscape Browser 8</td> + <td>Win 98SE+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Netscape Navigator 9</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.1</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.1</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.2</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.2</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.3</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.4</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.4</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.5</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.6</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">1.6</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.7</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.7</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Mozilla 1.8</td> + <td>Win 98+ / OSX.1+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Gecko</td> + <td>Seamonkey 1.1</td> + <td>Win 98+ / OSX.2+</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Gecko</td> + <td>Epiphany 2.20</td> + <td>Gnome</td> + <td class="center">1.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 1.2</td> + <td>OSX.3</td> + <td class="center">125.5</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 1.3</td> + <td>OSX.3</td> + <td class="center">312.8</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>Safari 2.0</td> + <td>OSX.4+</td> + <td class="center">419.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>Safari 3.0</td> + <td>OSX.4+</td> + <td class="center">522.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>OmniWeb 5.5</td> + <td>OSX.4+</td> + <td class="center">420</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Webkit</td> + <td>iPod Touch / iPhone</td> + <td>iPod</td> + <td class="center">420.1</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Webkit</td> + <td>S60</td> + <td>S60</td> + <td class="center">413</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 7.0</td> + <td>Win 95+ / OSX.1+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 7.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 8.0</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 8.5</td> + <td>Win 95+ / OSX.2+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.0</td> + <td>Win 95+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera 9.2</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Opera 9.5</td> + <td>Win 88+ / OSX.3+</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Opera for Wii</td> + <td>Wii</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>Presto</td> + <td>Nokia N800</td> + <td>N800</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeA"> + <td>Presto</td> + <td>Nintendo DS browser</td> + <td>Nintendo DS</td> + <td class="center">8.5</td> + <td class="center">C/A<sup>1</sup></td> + </tr> + <tr class="even_gradeC"> + <td>KHTML</td> + <td>Konqureror 3.1</td> + <td>KDE 3.1</td> + <td class="center">3.1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.3</td> + <td>KDE 3.3</td> + <td class="center">3.3</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeA"> + <td>KHTML</td> + <td>Konqureror 3.5</td> + <td>KDE 3.5</td> + <td class="center">3.5</td> + <td class="center">A</td> + </tr> + <tr class="odd_gradeX"> + <td>Tasman</td> + <td>Internet Explorer 4.5</td> + <td>Mac OS 8-9</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.1</td> + <td>Mac OS 7.6-9</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeC"> + <td>Tasman</td> + <td>Internet Explorer 5.2</td> + <td>Mac OS 8-X</td> + <td class="center">1</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeA"> + <td>Misc</td> + <td>NetFront 3.1</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeA"> + <td>Misc</td> + <td>NetFront 3.4</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">A</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Dillo 0.8</td> + <td>Embedded devices</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeX"> + <td>Misc</td> + <td>Links</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="even_gradeX"> + <td>Misc</td> + <td>Lynx</td> + <td>Text only</td> + <td class="center">-</td> + <td class="center">X</td> + </tr> + <tr class="odd_gradeC"> + <td>Misc</td> + <td>IE Mobile</td> + <td>Windows Mobile 6</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="even_gradeC"> + <td>Misc</td> + <td>PSP browser</td> + <td>PSP</td> + <td class="center">-</td> + <td class="center">C</td> + </tr> + <tr class="odd_gradeU"> + <td>Other browsers</td> + <td>All others</td> + <td>-</td> + <td class="center">-</td> + <td class="center">U</td> + </tr> + </tbody> +</table> + </div> + <div class="spacer"></div> + + + <h1>Initialisation code</h1> + <pre>$(document).ready( function () { + $('#example').dataTable( { + "bJQueryUI": true, + "sPaginationType": "full_numbers", + "sDom": '<"H"Tfr>t<"F"ip>', + "oTableTools": { + "aButtons": [ + "copy", "csv", "xls", "pdf", + { + "sExtends": "collection", + "sButtonText": "Save", + "aButtons": [ "csv", "xls", "pdf" ] + } + ] + } + } ); +} );</pre> + + + <h1>Other examples</h1> + <ul> + <li><a href="index.html">Basic initialisation</a></li> + <li><a href="swf_path.html">Setting the SWF path</a></li> + <li><a href="alter_buttons.html">Custom button arrangement</a></li> + <li><a href="button_text.html">Button text alteration</a></li> + <li><a href="collection.html">Using button collections</a></li> + <li><a href="theme.html">Using jQuery UI themes</a></li> + <li><a href="bootstrap.html">Styling with Twitter Bootstrap</a></li> + <li><a href="multi_instance.html">Multiple TableTools toolbars for a single table</a></li> + <li><a href="multiple_tables.html">Multiple DataTables with a single initialisation</a></li> + <li><a href="select_multi.html">User selectable rows (multiple rows)</a></li> + <li><a href="select_single.html">User selectable rows (single row)</a></li> + <li><a href="alt_init.html">Alternative initialisation using 'new TableTools()'</a></li> + <li><a href="defaults.html">Altering the TableTools defaults</a></li> + <li><a href="plug-in.html">TableTools plug-in buttons</a></li> + <li><a href="pdf_message.html">Customising the PDF output (adding text and orientation)</a></li> + </ul> + + + <div id="footer" style="text-align:center;"> + <span style="font-size:10px;"> + TableTools and DataTables © Allan Jardine 2009-2011.<br> + Flash 10 save / copy operations are performed by a modified version of <a href="http://code.google.com/p/zeroclipboard/">Zero Clipboard</a>.<br> + The icons used in the toolbar are modified from <a href="http://www.addictedtocoffee.de/">Oliver Twardowski's</a> <a href="http://www.smashingmagazine.com/2009/05/20/flavour-extended-the-ultimate-icon-set-for-web-designers/">Flavours Icon set</a>. + </span> + </div> + </div> + </body> +</html>
\ No newline at end of file diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index efbf689c..4d09cf20 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -28,26 +28,36 @@ <th>Sample r</th> <th>N Cases</th> <th>Sample p(r)</th> + <th>Lit Corr</th> + <th>Tissue r</th> + <th>Tissue p(r)</th> {% else %} <th>Sample rho</th> <th>Sample p(rho)</th> + <th>Lit Corr</th> + <th>Tissue rho</th> + <th>Tissue p(rho)</th> {% endif %} + </tr> </thead> <tbody> {% for trait in correlation_results %} <tr> - <td>{{ trait.name }}</td> + <td><a href="/show_trait?trait_id={{trait.name}}&dataset={{trait.dataset.name}}">{{ trait.name }}</a></td> <td>{{ trait.symbol }}</td> <td>{{ trait.alias }}</td> <td>{{ trait.description }}</td> - <td>Chr{{ trait.chr }}: {{ trait.mb }}</td> - <td>{{ trait.mean }}</td> - <td>{{ trait.lrs }}</td> - <td>Chr{{ trait.locus_chr }}: {{ trait.locus_mb }}</td> - <td>{{ trait.sample_r }}</td> + <td>Chr{{ trait.chr }}:{{trait.mb}}</td> + <td>{{'%0.3f'|format(trait.mean)}}</td> + <td>{{'%0.3f'|format(trait.lrs)}}</td> + <td>Chr{{ trait.locus_chr }}:{{'%0.6f'|format(trait.locus_mb)}}</td> + <td>{{'%0.3f'|format(trait.sample_r)}}</td> <td>{{ trait.num_overlap }}</td> - <td>{{ trait.sample_p }}</td> + <td>{{'%0.3e'|format(trait.sample_p)}}</td> + <td>{{'%0.3f'|format(trait.lit_corr)}}</td> + <td>{{'%0.3f'|format(trait.tissue_corr)}}</td> + <td>{{'%0.3e'|format(trait.tissue_pvalue)}}</td> </tr> {% endfor %} </tbody> diff --git a/wqflask/wqflask/templates/show_trait_calculate_correlations.html b/wqflask/wqflask/templates/show_trait_calculate_correlations.html index 12a064c0..73502392 100644 --- a/wqflask/wqflask/templates/show_trait_calculate_correlations.html +++ b/wqflask/wqflask/templates/show_trait_calculate_correlations.html @@ -5,7 +5,7 @@ <div class="control-group"> <label for="corr_method" class="control-label">Method</label> <div class="controls"> - <select name="corr_method"> + <select name="corr_type"> <option value="sample">Sample r</option> <option value="lit">Literature r</option> <option value="tissue">Tissue r</option> |