Commit d138f1af716d46f3ab650b77876be6fc9214039c

Authored by Luigi Serra
2 parents bbfe6cb7 38742d5a

Merge branch 'master' of http://service.routetopa.eu:7480/WebCompDev/COMPONENTS

bower_components/JSDataChecker/.bower.json
1 { 1 {
2 "name": "JSDataChecker", 2 "name": "JSDataChecker",
3 - "version": "0.0.7", 3 + "version": "0.0.8",
4 "homepage": "https://github.com/donpir/JSDataChecker", 4 "homepage": "https://github.com/donpir/JSDataChecker",
5 "authors": [ 5 "authors": [
6 "'Donato Pirozzi <'donatopirozzi@gmail.com'>" 6 "'Donato Pirozzi <'donatopirozzi@gmail.com'>"
@@ -22,11 +22,11 @@ @@ -22,11 +22,11 @@
22 "polywc": "https://github.com/donpir/polywc.git#master" 22 "polywc": "https://github.com/donpir/polywc.git#master"
23 }, 23 },
24 "private": false, 24 "private": false,
25 - "_release": "0.0.7", 25 + "_release": "0.0.8",
26 "_resolution": { 26 "_resolution": {
27 "type": "version", 27 "type": "version",
28 - "tag": "v0.0.7",  
29 - "commit": "f6d2d47543510eeefc2e0a9bda86dec09ac4b092" 28 + "tag": "v0.0.8",
  29 + "commit": "862e4d5fe56d629ae7ef8aadb728b1add3af01d9"
30 }, 30 },
31 "_source": "https://github.com/donpir/JSDataChecker.git", 31 "_source": "https://github.com/donpir/JSDataChecker.git",
32 "_target": "~0.0.6", 32 "_target": "~0.0.6",
bower_components/JSDataChecker/bower.json
1 { 1 {
2 "name": "JSDataChecker", 2 "name": "JSDataChecker",
3 - "version": "v0.0.7", 3 + "version": "v0.0.8",
4 "homepage": "https://github.com/donpir/JSDataChecker", 4 "homepage": "https://github.com/donpir/JSDataChecker",
5 "authors": [ 5 "authors": [
6 "'Donato Pirozzi <'donatopirozzi@gmail.com'>" 6 "'Donato Pirozzi <'donatopirozzi@gmail.com'>"
bower_components/JSDataChecker/build.cmd
1 del jsdatachecker.min.js 1 del jsdatachecker.min.js
2 -uglifyjs src\ArrayUtils.js src\DataTypeConverter.js src\DataTypesUtils.js --compress -o jsdatachecker.min.js  
3 \ No newline at end of file 2 \ No newline at end of file
  3 +uglifyjs src\ArrayUtils.js src\DataTypeConverter.js src\DataTypesUtils.js src\DataTypeHierarchy.js --compress -o jsdatachecker.min.js
4 \ No newline at end of file 4 \ No newline at end of file
bower_components/JSDataChecker/jsdatachecker.min.js
1 -function ArrayUtils(){}function DataTypeConverter(){this._fields=[],this._numOfRows=0}function DataTypesUtils(){}ArrayUtils.TestAndSet=function(arr,key,object){return"undefined"==typeof arr?null:0==Array.isArray(arr)?null:("undefined"==typeof arr[key]&&(arr[key]=object),arr[key])},ArrayUtils.TestAndInitializeKey=function(obj,key,value){return"undefined"==typeof obj?null:("undefined"==typeof obj[key]&&(obj[key]=value),obj[key])},ArrayUtils.TestAndIncrement=function(arr,key){var exists=arr[key];return"undefined"==typeof exists&&(arr[key]=0),arr[key]++,arr},ArrayUtils.toFieldsArray=function(obj){var fields=[];return ArrayUtils.IteratorOverKeys(obj,function(field,key){field.key=key,fields.push(field)}),fields},ArrayUtils.IteratorOverKeys=function(arr,callback){for(var property in arr)if(arr.hasOwnProperty(property)){var item=arr[property];callback(item,property)}},ArrayUtils.FindMinMax=function(arr,fncompare){var max1=null,max2=null;for(var key in arr)null==max1||fncompare(arr[key],max1.value)?(max2=max1,max1={index:-1,key:key,value:arr[key]}):(null==max2||fncompare(arr[key],max2.value))&&(max2={index:-1,key:key,value:arr[key]});return{first:max1,second:max2}},ArrayUtils.isArray=function(arr){return Array.isArray(arr)?arr.length>0:!1},DataTypeConverter.TYPES={TEXT:{value:0,name:"TEXT"},CODE:{value:1,name:"CODE"},NUMBER:{value:2,name:"NUMBER"},OBJECT:{value:3,name:"OBJECT"},BOOL:{value:5,name:"BOOL"},CONST:{value:6,name:"CONST"},CATEGORY:{value:7,name:"CATEGORY"},DATETIME:{value:8,name:"DATETIME"},EMPTY:{value:101,name:"NULL"}},DataTypeConverter.SUBTYPES={PERCENTAGE:{value:1e3,name:"PERCENTAGE"},LATITUDE:{value:1001,name:"LATITUDE"},LONGITUDE:{value:1002,name:"LONGITUDE"}},DataTypeConverter.prototype=function(){var _analyseDataTypes=function(fields){ArrayUtils.IteratorOverKeys(fields,function(field){if(field._inferredTypes[DataTypeConverter.TYPES.CODE.name]){var confidence=field._inferredTypes[DataTypeConverter.TYPES.CODE.name]/field.numOfItems,_numericalInferredType=field._inferredTypes[DataTypeConverter.TYPES.NUMBER.name];return"undefined"!=typeof _numericalInferredType&&(confidence+=_numericalInferredType/field.numOfItems),field.type=DataTypeConverter.TYPES.CODE.name,void(field.typeConfidence=confidence)}var max=ArrayUtils.FindMinMax(field._inferredTypes,function(curval,lastval){return curval>lastval}),tkey=max.first.key;tkey===DataTypeConverter.TYPES.EMPTY.name&&null!=max.second&&"undefined"!=typeof max.second&&(tkey=max.second.key),field.type=tkey,field.typeConfidence=field._inferredTypes[max.first.key]/field.numOfItems})},_processInferType=function(value){if(null===value||"undefined"==typeof value)return DataTypeConverter.TYPES.EMPTY;if("object"==typeof value)return DataTypeConverter.TYPES.OBJECT;if(/^0[0-9]+$/.test(value))return DataTypeConverter.TYPES.CODE;var isnumber=DataTypesUtils.FilterFloat(value);if(isNaN(isnumber)!==!0)return DataTypeConverter.TYPES.NUMBER;var _date=DataTypesUtils.FilterDateTime(value);return 0==isNaN(_date)&&null!=_date?DataTypeConverter.TYPES.DATETIME:DataTypeConverter.TYPES.TEXT},jsonTraverse=function(json,fieldKeys,callback){var stack=[],numOfRows=0;for(stack.push({item:json,fieldKeyIndex:0});stack.length>0;){var stackTask=stack.pop(),item=stackTask.item,fieldKeyIndex=stackTask.fieldKeyIndex,fieldKey=fieldKeys[fieldKeyIndex];if("*"!=fieldKey||0!=ArrayUtils.isArray(item))if("*"!=fieldKey||1!=ArrayUtils.isArray(item)){var jsonSubtree=item[fieldKey];if(Array.isArray(jsonSubtree))for(var j=0;j<jsonSubtree.length;j++){var jsonItem=jsonSubtree[j];stack.push({item:jsonItem,fieldKeyIndex:fieldKeyIndex+1})}else stack.push({item:jsonSubtree,fieldKeyIndex:fieldKeyIndex+1})}else for(var cell,j=0;j<item.length&&(cell=item[j]);j++)stack.push({item:cell,fieldKeyIndex:fieldKeyIndex}),numOfRows++;else{var sProcessedKeys=fieldKeys.slice(0,fieldKeyIndex).toString();ArrayUtils.IteratorOverKeys(item,function(value,key){var curKey=sProcessedKeys+(sProcessedKeys.length>0?",":"")+key,_value=callback(value,key,curKey,numOfRows);item[key]=_value}),numOfRows++}}};return{constructor:DataTypeConverter,cast:function(metadata,options){return"undefined"!=typeof options&&null!=options||(options={castThresholdConfidence:1,castIfNull:!1}),this.convert(metadata,options)},convert:function(metadata,options){var lastRowIndex=0,numOfRows=0,numOfValues=0,datasetErrors=0,datasetMissingValues=0;return"undefined"!=typeof options&&null!=options||(options={castThresholdConfidence:1,castIfNull:!1}),jsonTraverse(metadata.dataset,metadata.fieldKeys,function(value,key,traversedKeys,rowIndex){var inferredType=metadata.types[traversedKeys];numOfValues++,lastRowIndex!=rowIndex&&(lastRowIndex=rowIndex,numOfRows++),null==value||"undefined"==typeof value||0==(value+"").length;var isCast=inferredType.typeConfidence>=options.castThresholdConfidence;if(inferredType.type==DataTypeConverter.TYPES.NUMBER.name&&isCast){var number=parseFloat(value);return isNaN(number)?(datasetErrors++,value):number}return value}),metadata.qualityIndex.notNullValues=(numOfValues-datasetMissingValues)/numOfValues,metadata.qualityIndex.errors=(numOfValues-datasetErrors)/numOfValues,metadata},inferJsonDataType:function(json,fieldKeys){var stack=[],fieldsType={},numOfRows=0;if("undefined"==typeof fieldKeys)throw"IllegalArgumentException: undefined json path to analyse.";for(stack.push({item:json,fieldKeyIndex:0});stack.length>0;){var stackTask=stack.pop(),item=stackTask.item,fieldKeyIndex=stackTask.fieldKeyIndex,fieldKey=fieldKeys[fieldKeyIndex];if("*"!=fieldKey||0!=ArrayUtils.isArray(item))if("*"==fieldKey&&ArrayUtils.isArray(item))for(var cell,j=0;j<item.length&&(cell=item[j]);j++)stack.push({item:cell,fieldKeyIndex:fieldKeyIndex}),numOfRows++;else{var jsonSubtree=item[fieldKey];if(Array.isArray(jsonSubtree))for(var j=0;j<jsonSubtree.length;j++){var jsonItem=jsonSubtree[j];stack.push({item:jsonItem,fieldKeyIndex:fieldKeyIndex+1})}else stack.push({item:jsonSubtree,fieldKeyIndex:fieldKeyIndex+1})}else{var sProcessedKeys=fieldKeys.slice(0,fieldKeyIndex).toString();ArrayUtils.IteratorOverKeys(item,function(item,key){var inferredType=_processInferType(item),curKey=sProcessedKeys+(0==sProcessedKeys.length?"":",")+key,fieldType=ArrayUtils.TestAndInitializeKey(fieldsType,curKey,{name:curKey,_inferredTypes:[],_inferredValues:[],numOfItems:0});fieldType.numOfItems++,ArrayUtils.TestAndIncrement(fieldType._inferredTypes,inferredType.name),inferredType===DataTypeConverter.TYPES.TEXT&&ArrayUtils.TestAndIncrement(fieldType._inferredValues,item)}),numOfRows++}}_analyseDataTypes(fieldsType);var quality={homogeneity:1,completeness:1,totalNullValues:0,totalValues:0};ArrayUtils.IteratorOverKeys(fieldsType,function(fieldType){quality.totalValues+=fieldType.numOfItems,quality.homogeneity*=fieldType.typeConfidence,fieldType.totalNullValues=0,fieldType._inferredTypes.hasOwnProperty(DataTypeConverter.TYPES.EMPTY.name)&&(fieldType.totalNullValues=fieldType._inferredTypes[DataTypeConverter.TYPES.EMPTY.name],quality.totalNullValues+=fieldType.totalNullValues)}),quality.homogeneity=Math.round(100*quality.homogeneity)/100;var totFullValues=quality.totalValues-quality.totalNullValues;quality.completeness=Math.round(totFullValues/quality.totalValues*100)/100;var warningsTextual="";return ArrayUtils.IteratorOverKeys(fieldsType,function(fieldType){fieldType.errorsDescription="";var description="";if(fieldType.typeConfidence<1){var incorrect=fieldType.numOfItems-fieldType.totalNullValues-fieldType._inferredTypes[fieldType.type];if(incorrect>0){description+="The column <"+fieldType.name+"> has the type <"+fieldType.type+">";var verb=1==incorrect?" value is":" values are";description+=", but "+incorrect+verb+" not a "+fieldType.type}}fieldType.totalNullValues>0&&(description+="The column <"+fieldType.name+"> has "+fieldType.totalNullValues+" EMPTY value",fieldType.totalNullValues>1&&(description+="s")),description.length>0&&(description+="."),fieldType.errorsDescription=description,warningsTextual+=description}),{dataset:json,fieldKeys:fieldKeys,types:fieldsType,qualityIndex:quality,warningsTextual:warningsTextual}},inferDataTypeOfValue:function(value){return _processInferType(value)}}}(),DataTypesUtils.FilterTime=function(value){var expTime=/^[0-9]{2}:[0-9]{2}(:[0-9]{2})?(\+[0-9]{2}:[0-9]{2})?$/;if(0==expTime.test(value))return null;var splitted=value.split(/[:|\+]/),expNumber=/^[0-9]{2}$/,HH=expNumber.test(splitted[0])?parseInt(splitted[0]):0,MM=expNumber.test(splitted[1])?parseInt(splitted[1]):0,SS=splitted.length>=3&&expNumber.test(splitted[2])?parseInt(splitted[2]):0,dt=new Date;return dt.setHours(HH),dt.setMinutes(MM),dt.setSeconds(SS),dt},DataTypesUtils.FilterDateTime=function(value){var _dtSplitted=value.split(/[T|\s]/);if(2==_dtSplitted.length){var dtTime=DataTypesUtils.FilterTime(_dtSplitted[1]);if(null==dtTime)return null;var dtDateTime=DataTypesUtils.FilterDate(_dtSplitted[0],dtTime);return dtDateTime}var dtDate=DataTypesUtils.FilterDate(value);if(null!=dtDate)return dtDate;var dtTime=DataTypesUtils.FilterTime(value);return dtTime},DataTypesUtils.FilterDate=function(value,dtDate){if(null==dtDate&&(dtDate=new Date),/^[0-9][0-9][0-9][0-9]\-[0-9][0-9]$/.test(value)){var year=parseInt(value.substring(0,4)),month=parseInt(value.substring(5));return dtDate.setYear(year),dtDate.setMonth(month),dtDate}var expDate=/^[0-9]{4}(\-|\/)[0-9]{2}((\-|\/)[0-9]{2})?$/;if(expDate.test(value)){var splitted=value.split(/[\-|\/]/),year=parseInt(splitted[0]),month=parseInt(splitted[1]),day=3==splitted.length?parseInt(splitted[2]):0;return dtDate.setYear(year),dtDate.setMonth(month),dtDate.setDate(day),dtDate}if(expDate=/^[0-9]{2}(\-|\/)[0-9]{2}(\-|\/)[0-9]{4}$/,expDate.test(value)){var splitted=value.split(/[\-|\/]/),year=parseInt(splitted[2]),month=parseInt(splitted[1]),day=parseInt(splitted[0]);return dtDate.setYear(year),dtDate.setMonth(month),dtDate.setDate(day),dtDate}return null},DataTypesUtils.FilterFloat=function(value){return/^(\-|\+)?((0|([1-9][0-9]*))(\.[0-9]+)?|Infinity)$/.test(value)?Number(value):NaN},DataTypesUtils.DecimalPlaces=function(num){var match=(""+num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return match?Math.max(0,(match[1]?match[1].length:0)-(match[2]?+match[2]:0)):0};  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +function ArrayUtils(){}function DataTypeConverter(){this._fields=[],this._numOfRows=0}function DataTypesUtils(){}function DataTypeHierarchy(){}ArrayUtils.TestAndSet=function(arr,key,object){return"undefined"==typeof arr?null:0==Array.isArray(arr)?null:("undefined"==typeof arr[key]&&(arr[key]=object),arr[key])},ArrayUtils.TestAndInitializeKey=function(obj,key,value){return"undefined"==typeof obj?null:("undefined"==typeof obj[key]&&(obj[key]=value),obj[key])},ArrayUtils.TestAndIncrement=function(arr,key){var exists=arr[key];return"undefined"==typeof exists&&(arr[key]=0),arr[key]++,arr},ArrayUtils.toFieldsArray=function(obj){var fields=[];return ArrayUtils.IteratorOverKeys(obj,function(field,key){field.key=key,fields.push(field)}),fields},ArrayUtils.IteratorOverKeys=function(arr,callback){for(var property in arr)if(arr.hasOwnProperty(property)){var item=arr[property];callback(item,property)}},ArrayUtils.FindMinMax=function(arr,fncompare){var max1=null,max2=null;for(var key in arr)null==max1||fncompare(arr[key],max1.value)?(max2=max1,max1={index:-1,key:key,value:arr[key]}):(null==max2||fncompare(arr[key],max2.value))&&(max2={index:-1,key:key,value:arr[key]});return{first:max1,second:max2}},ArrayUtils.isArray=function(arr){return Array.isArray(arr)?arr.length>0:!1},DataTypeConverter.TYPES={TEXT:{value:0,name:"TEXT"},CODE:{value:1,name:"CODE"},NUMBER:{value:2,name:"NUMBER"},OBJECT:{value:3,name:"OBJECT"},BOOL:{value:5,name:"BOOL"},CONST:{value:6,name:"CONST"},CATEGORY:{value:7,name:"CATEGORY"},DATETIME:{value:8,name:"DATETIME"},EMPTY:{value:101,name:"NULL"}},DataTypeConverter.SUBTYPES={PERCENTAGE:{value:1e3,name:"PERCENTAGE"},LATITUDE:{value:1001,name:"LATITUDE"},LONGITUDE:{value:1002,name:"LONGITUDE"}},DataTypeConverter.prototype=function(){var _analyseDataTypes=function(fields){ArrayUtils.IteratorOverKeys(fields,function(field){if(field._inferredTypes[DataTypeConverter.TYPES.CODE.name]){var confidence=field._inferredTypes[DataTypeConverter.TYPES.CODE.name]/field.numOfItems,_numericalInferredType=field._inferredTypes[DataTypeConverter.TYPES.NUMBER.name];return"undefined"!=typeof _numericalInferredType&&(confidence+=_numericalInferredType/field.numOfItems),field.type=DataTypeConverter.TYPES.CODE.name,void(field.typeConfidence=confidence)}var max=ArrayUtils.FindMinMax(field._inferredTypes,function(curval,lastval){return curval>lastval}),tkey=max.first.key;tkey===DataTypeConverter.TYPES.EMPTY.name&&null!=max.second&&"undefined"!=typeof max.second&&(tkey=max.second.key),field.type=tkey,field.typeConfidence=field._inferredTypes[max.first.key]/field.numOfItems})},_processInferType=function(value){if(null===value||"undefined"==typeof value)return DataTypeConverter.TYPES.EMPTY;if("object"==typeof value)return DataTypeConverter.TYPES.OBJECT;if(/^0[0-9]+$/.test(value))return DataTypeConverter.TYPES.CODE;var isnumber=DataTypesUtils.FilterFloat(value);if(isNaN(isnumber)!==!0)return DataTypeConverter.TYPES.NUMBER;var _date=DataTypesUtils.FilterDateTime(value);return 0==isNaN(_date)&&null!=_date?DataTypeConverter.TYPES.DATETIME:DataTypeConverter.TYPES.TEXT},jsonTraverse=function(json,fieldKeys,callback){var stack=[],numOfRows=0;for(stack.push({item:json,fieldKeyIndex:0});stack.length>0;){var stackTask=stack.pop(),item=stackTask.item,fieldKeyIndex=stackTask.fieldKeyIndex,fieldKey=fieldKeys[fieldKeyIndex];if("*"!=fieldKey||0!=ArrayUtils.isArray(item))if("*"!=fieldKey||1!=ArrayUtils.isArray(item)){var jsonSubtree=item[fieldKey];if(Array.isArray(jsonSubtree))for(var j=0;j<jsonSubtree.length;j++){var jsonItem=jsonSubtree[j];stack.push({item:jsonItem,fieldKeyIndex:fieldKeyIndex+1})}else stack.push({item:jsonSubtree,fieldKeyIndex:fieldKeyIndex+1})}else for(var cell,j=0;j<item.length&&(cell=item[j]);j++)stack.push({item:cell,fieldKeyIndex:fieldKeyIndex}),numOfRows++;else{var sProcessedKeys=fieldKeys.slice(0,fieldKeyIndex).toString();ArrayUtils.IteratorOverKeys(item,function(value,key){var curKey=sProcessedKeys+(sProcessedKeys.length>0?",":"")+key,_value=callback(value,key,curKey,numOfRows);item[key]=_value}),numOfRows++}}};return{constructor:DataTypeConverter,cast:function(metadata,options){return"undefined"!=typeof options&&null!=options||(options={castThresholdConfidence:1,castIfNull:!1}),this.convert(metadata,options)},convert:function(metadata,options){var lastRowIndex=0,numOfRows=0,numOfValues=0,datasetErrors=0,datasetMissingValues=0;return"undefined"!=typeof options&&null!=options||(options={castThresholdConfidence:1,castIfNull:!1}),jsonTraverse(metadata.dataset,metadata.fieldKeys,function(value,key,traversedKeys,rowIndex){var inferredType=metadata.types[traversedKeys];numOfValues++,lastRowIndex!=rowIndex&&(lastRowIndex=rowIndex,numOfRows++),null==value||"undefined"==typeof value||0==(value+"").length;var isCast=inferredType.typeConfidence>=options.castThresholdConfidence;if(inferredType.type==DataTypeConverter.TYPES.NUMBER.name&&isCast){var number=parseFloat(value);return isNaN(number)?(datasetErrors++,value):number}return value}),metadata.qualityIndex.notNullValues=(numOfValues-datasetMissingValues)/numOfValues,metadata.qualityIndex.errors=(numOfValues-datasetErrors)/numOfValues,metadata},inferJsonDataType:function(json,fieldKeys){var stack=[],fieldsType={},numOfRows=0;if("undefined"==typeof fieldKeys)throw"IllegalArgumentException: undefined json path to analyse.";for(stack.push({item:json,fieldKeyIndex:0});stack.length>0;){var stackTask=stack.pop(),item=stackTask.item,fieldKeyIndex=stackTask.fieldKeyIndex,fieldKey=fieldKeys[fieldKeyIndex];if("*"!=fieldKey||0!=ArrayUtils.isArray(item))if("*"==fieldKey&&ArrayUtils.isArray(item))for(var cell,j=0;j<item.length&&(cell=item[j]);j++)stack.push({item:cell,fieldKeyIndex:fieldKeyIndex}),numOfRows++;else{var jsonSubtree=item[fieldKey];if(Array.isArray(jsonSubtree))for(var j=0;j<jsonSubtree.length;j++){var jsonItem=jsonSubtree[j];stack.push({item:jsonItem,fieldKeyIndex:fieldKeyIndex+1})}else stack.push({item:jsonSubtree,fieldKeyIndex:fieldKeyIndex+1})}else{var sProcessedKeys=fieldKeys.slice(0,fieldKeyIndex).toString();ArrayUtils.IteratorOverKeys(item,function(item,key){var inferredType=_processInferType(item),curKey=sProcessedKeys+(0==sProcessedKeys.length?"":",")+key,fieldType=ArrayUtils.TestAndInitializeKey(fieldsType,curKey,{name:curKey,_inferredTypes:[],_inferredValues:[],numOfItems:0});fieldType.numOfItems++,ArrayUtils.TestAndIncrement(fieldType._inferredTypes,inferredType.name),inferredType===DataTypeConverter.TYPES.TEXT&&ArrayUtils.TestAndIncrement(fieldType._inferredValues,item)}),numOfRows++}}_analyseDataTypes(fieldsType);var quality={homogeneity:1,completeness:1,totalNullValues:0,totalValues:0};ArrayUtils.IteratorOverKeys(fieldsType,function(fieldType){quality.totalValues+=fieldType.numOfItems,quality.homogeneity*=fieldType.typeConfidence,fieldType.totalNullValues=0,fieldType._inferredTypes.hasOwnProperty(DataTypeConverter.TYPES.EMPTY.name)&&(fieldType.totalNullValues=fieldType._inferredTypes[DataTypeConverter.TYPES.EMPTY.name],quality.totalNullValues+=fieldType.totalNullValues)}),quality.homogeneity=Math.round(100*quality.homogeneity)/100;var totFullValues=quality.totalValues-quality.totalNullValues;quality.completeness=Math.round(totFullValues/quality.totalValues*100)/100;var warningsTextual="";return ArrayUtils.IteratorOverKeys(fieldsType,function(fieldType){fieldType.errorsDescription="";var description="";if(fieldType.typeConfidence<1){var incorrect=fieldType.numOfItems-fieldType.totalNullValues-fieldType._inferredTypes[fieldType.type];if(incorrect>0){description+="The column <"+fieldType.name+"> has the type <"+fieldType.type+">";var verb=1==incorrect?" value is":" values are";description+=", but "+incorrect+verb+" not a "+fieldType.type}}fieldType.totalNullValues>0&&(description+="The column <"+fieldType.name+"> has "+fieldType.totalNullValues+" EMPTY value",fieldType.totalNullValues>1&&(description+="s")),description.length>0&&(description+="."),fieldType.errorsDescription=description,warningsTextual+=description}),{dataset:json,fieldKeys:fieldKeys,types:fieldsType,qualityIndex:quality,warningsTextual:warningsTextual}},inferDataTypeOfValue:function(value){return _processInferType(value)}}}(),DataTypesUtils.FilterTime=function(value){var expTime=/^[0-9]{2}:[0-9]{2}(:[0-9]{2})?(\+[0-9]{2}:[0-9]{2})?$/;if(0==expTime.test(value))return null;var splitted=value.split(/[:|\+]/),expNumber=/^[0-9]{2}$/,HH=expNumber.test(splitted[0])?parseInt(splitted[0]):0,MM=expNumber.test(splitted[1])?parseInt(splitted[1]):0,SS=splitted.length>=3&&expNumber.test(splitted[2])?parseInt(splitted[2]):0,dt=new Date;return dt.setHours(HH),dt.setMinutes(MM),dt.setSeconds(SS),dt},DataTypesUtils.FilterDateTime=function(value){var _dtSplitted=value.split(/[T|\s]/);if(2==_dtSplitted.length){var dtTime=DataTypesUtils.FilterTime(_dtSplitted[1]);if(null==dtTime)return null;var dtDateTime=DataTypesUtils.FilterDate(_dtSplitted[0],dtTime);return dtDateTime}var dtDate=DataTypesUtils.FilterDate(value);if(null!=dtDate)return dtDate;var dtTime=DataTypesUtils.FilterTime(value);return dtTime},DataTypesUtils.FilterDate=function(value,dtDate){if(null==dtDate&&(dtDate=new Date),/^[0-9][0-9][0-9][0-9]\-[0-9][0-9]$/.test(value)){var year=parseInt(value.substring(0,4)),month=parseInt(value.substring(5));return dtDate.setYear(year),dtDate.setMonth(month),dtDate}var expDate=/^[0-9]{4}(\-|\/)[0-9]{2}((\-|\/)[0-9]{2})?$/;if(expDate.test(value)){var splitted=value.split(/[\-|\/]/),year=parseInt(splitted[0]),month=parseInt(splitted[1]),day=3==splitted.length?parseInt(splitted[2]):0;return dtDate.setYear(year),dtDate.setMonth(month),dtDate.setDate(day),dtDate}if(expDate=/^[0-9]{2}(\-|\/)[0-9]{2}(\-|\/)[0-9]{4}$/,expDate.test(value)){var splitted=value.split(/[\-|\/]/),year=parseInt(splitted[2]),month=parseInt(splitted[1]),day=parseInt(splitted[0]);return dtDate.setYear(year),dtDate.setMonth(month),dtDate.setDate(day),dtDate}return null},DataTypesUtils.FilterFloat=function(value){return/^(\-|\+)?((0|([1-9][0-9]*))(\.[0-9]+)?|Infinity)$/.test(value)?Number(value):NaN},DataTypesUtils.DecimalPlaces=function(num){var match=(""+num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return match?Math.max(0,(match[1]?match[1].length:0)-(match[2]?+match[2]:0)):0},DataTypeHierarchy.HIERARCHY=[],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.TEXT.name]=[DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.NUMBER.name]=[DataTypeConverter.TYPES.NUMBER.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.DATETIME.name]=[DataTypeConverter.TYPES.DATETIME.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.SUBTYPES.LATITUDE.name]=[DataTypeConverter.SUBTYPES.LATITUDE.name,DataTypeConverter.TYPES.NUMBER.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.SUBTYPES.LONGITUDE.name]=[DataTypeConverter.SUBTYPES.LONGITUDE.name,DataTypeConverter.TYPES.NUMBER.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.canConvert=function(fromType,toType){var arrConvertableTypes=DataTypeHierarchy.HIERARCHY[fromType],idx=arrConvertableTypes.indexOf(toType);return idx>=0};
3 \ No newline at end of file 3 \ No newline at end of file
bower_components/JSDataChecker/src/DataTypeConverter.js
@@ -38,8 +38,6 @@ DataTypeConverter.TYPES = { @@ -38,8 +38,6 @@ DataTypeConverter.TYPES = {
38 38
39 DATETIME : { value: 8, name: "DATETIME" }, 39 DATETIME : { value: 8, name: "DATETIME" },
40 40
41 -  
42 -  
43 EMPTY : { value: 101, name: "NULL" } 41 EMPTY : { value: 101, name: "NULL" }
44 }; 42 };
45 43
@@ -138,14 +136,14 @@ DataTypeConverter.prototype = (function () { @@ -138,14 +136,14 @@ DataTypeConverter.prototype = (function () {
138 field.typeConfidence = field._inferredTypes[max.first.key] / field.numOfItems; 136 field.typeConfidence = field._inferredTypes[max.first.key] / field.numOfItems;
139 137
140 138
141 - /*//TODO: improve this piece of code. 139 + //TODO: improve this piece of code.
142 //LAT/LNG. 140 //LAT/LNG.
143 - var fieldName = field.name.toLowerCase(); 141 + /*var fieldName = field.name.toLowerCase();
144 var isLatType = (field.type === DataTypeConverter.TYPES.LATITUDE.name); 142 var isLatType = (field.type === DataTypeConverter.TYPES.LATITUDE.name);
145 var fieldNameContainsLat = fieldName.indexOf('lat') >= 0; 143 var fieldNameContainsLat = fieldName.indexOf('lat') >= 0;
146 var fieldNameContainsLon = fieldName.indexOf('ng') >= 0; //It could be 'lng'. 144 var fieldNameContainsLon = fieldName.indexOf('ng') >= 0; //It could be 'lng'.
147 if (isLatType == true && fieldNameContainsLat == false && fieldNameContainsLon == true) { 145 if (isLatType == true && fieldNameContainsLat == false && fieldNameContainsLon == true) {
148 - field.type = DataTypeConverter.TYPES.LONGITUDE.name; 146 + field.type = DataTypeConverter.TYPES.LONGITUDE.name;
149 }*/ 147 }*/
150 148
151 //BOOLEAN. 149 //BOOLEAN.
bower_components/JSDataChecker/src/DataTypeHierarchy.js 0 โ†’ 100644
  1 +/*
  2 + ** This file is part of JSDataChecker.
  3 + **
  4 + ** JSDataChecker is free software: you can redistribute it and/or modify
  5 + ** it under the terms of the GNU General Public License as published by
  6 + ** the Free Software Foundation, either version 3 of the License, or
  7 + ** (at your option) any later version.
  8 + **
  9 + ** JSDataChecker is distributed in the hope that it will be useful,
  10 + ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  11 + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12 + ** GNU General Public License for more details.
  13 + **
  14 + ** You should have received a copy of the GNU General Public License
  15 + ** along with JSDataChecker. If not, see <http://www.gnu.org/licenses/>.
  16 + **
  17 + ** Copyright (C) 2016 JSDataChecker - Donato Pirozzi (donatopirozzi@gmail.com)
  18 + ** Distributed under the GNU GPL v3. For full terms see the file LICENSE.
  19 + ** License: http://www.gnu.org/licenses/gpl.html GPL version 3 or higher
  20 + **/
  21 +
  22 +function DataTypeHierarchy() {
  23 +
  24 +};//EndConstructor.
  25 +
  26 +DataTypeHierarchy.HIERARCHY = [ ];
  27 +
  28 +DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.TEXT.name] = [ DataTypeConverter.TYPES.TEXT.name ];
  29 +DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.NUMBER.name] = [ DataTypeConverter.TYPES.NUMBER.name, DataTypeConverter.TYPES.TEXT.name];
  30 +DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.DATETIME.name] = [ DataTypeConverter.TYPES.DATETIME.name, DataTypeConverter.TYPES.TEXT.name ];
  31 +
  32 +DataTypeHierarchy.HIERARCHY[DataTypeConverter.SUBTYPES.LATITUDE.name] = [ DataTypeConverter.SUBTYPES.LATITUDE.name,
  33 + DataTypeConverter.TYPES.NUMBER.name, DataTypeConverter.TYPES.TEXT.name];
  34 +DataTypeHierarchy.HIERARCHY[DataTypeConverter.SUBTYPES.LONGITUDE.name] = [ DataTypeConverter.SUBTYPES.LONGITUDE.name,
  35 + DataTypeConverter.TYPES.NUMBER.name, DataTypeConverter.TYPES.TEXT.name];
  36 +
  37 +DataTypeHierarchy.canConvert = function (fromType, toType) {
  38 + var arrConvertableTypes = DataTypeHierarchy.HIERARCHY[fromType];
  39 + var idx = arrConvertableTypes.indexOf(toType);
  40 + return (idx >= 0);
  41 +};//EndFunction.
controllets/data-sevc-controllet/demo/index.html
@@ -15,15 +15,16 @@ @@ -15,15 +15,16 @@
15 15
16 <body> 16 <body>
17 17
18 - <!--<data-sevc-controllet deep-url="http://172.16.15.38/DEEalerProvider/DEEP/"-->  
19 - <!--datalets-list-url="http://172.16.15.38/DEEalerProvider/DEEP/datalets-list"--> 18 + <data-sevc-controllet deep-url="http://172.16.15.38/DEEalerProvider/DEEP/"
  19 + datalets-list-url="http://172.16.15.38/DEEalerProvider/DEEP/datalets-list"
  20 + datasets='{"result":{"providers":{"1":{"title":"CKAN","api_url":"http:\/\/ckan.routetopa.eu","image_hash":"11","id":"1"}},"datasets":[{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 2","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b056c5e6-76af-4526-a35d-7dee664fb6ee\/download\/isislab.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/818c2edb-0cb7-4288-b340-e4dd1933d817\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New---Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination - dl","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/fd8c4d6f-315d-4aa0-b7bd-4fdde7bf641b\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New---Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) dissemination of ROUTE-TO-PA project","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/b0ef6017-8c64-4e11-8046-7e51a8561856\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New---Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"test dissemination with link","resource_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/ba5054af-7561-4f99-9504-76ea004a1e85\/resource\/4cc2349d-bf7b-4bbe-a7ca-db5312bb6c94\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New---Link.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Dissemination activity of the first year","resource_name":"Dissemination activity of the first year (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/61f07087-210a-4c35-9606-2aafe183633b\/resource\/5f9d8d8b-1c41-45f7-9dbb-61b9a7bcd076\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"City of the Hague Municipality","package_name":"Test 3- Buurten","resource_name":"Test Buurten - 3","url":"http:\/\/ckan.routetopa.eu\/dataset\/1248d447-2901-4beb-91ae-c2f249fd8a99\/resource\/1fdbc765-8945-4271-8dce-9c7eba45a67d\/download\/Test-3-Compare.csv","metas":"{\"organization\":\"City of the Hague Municipality\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"}]}}'
20 <!--datasets='{"result":{"providers":{"1":{"title":"CKAN","api_url":"http:\/\/ckan.routetopa.eu","image_hash":"11","id":"1"}},"datasets":[{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 2","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b056c5e6-76af-4526-a35d-7dee664fb6ee\/download\/isislab.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/818c2edb-0cb7-4288-b340-e4dd1933d817\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination - dl","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/fd8c4d6f-315d-4aa0-b7bd-4fdde7bf641b\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) dissemination of ROUTE-TO-PA project","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/b0ef6017-8c64-4e11-8046-7e51a8561856\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"test dissemination with link","resource_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/ba5054af-7561-4f99-9504-76ea004a1e85\/resource\/4cc2349d-bf7b-4bbe-a7ca-db5312bb6c94\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Dissemination activity of the first year","resource_name":"Dissemination activity of the first year (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/61f07087-210a-4c35-9606-2aafe183633b\/resource\/5f9d8d8b-1c41-45f7-9dbb-61b9a7bcd076\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"City of the Hague Municipality","package_name":"Test 3- Buurten","resource_name":"Test Buurten - 3","url":"http:\/\/ckan.routetopa.eu\/dataset\/1248d447-2901-4beb-91ae-c2f249fd8a99\/resource\/1fdbc765-8945-4271-8dce-9c7eba45a67d\/download\/Test-3-Compare.csv","metas":"{\"organization\":\"City of the Hague Municipality\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"}]}}'--> 21 <!--datasets='{"result":{"providers":{"1":{"title":"CKAN","api_url":"http:\/\/ckan.routetopa.eu","image_hash":"11","id":"1"}},"datasets":[{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 2","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b056c5e6-76af-4526-a35d-7dee664fb6ee\/download\/isislab.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/818c2edb-0cb7-4288-b340-e4dd1933d817\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination - dl","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/fd8c4d6f-315d-4aa0-b7bd-4fdde7bf641b\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) dissemination of ROUTE-TO-PA project","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/b0ef6017-8c64-4e11-8046-7e51a8561856\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"test dissemination with link","resource_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/ba5054af-7561-4f99-9504-76ea004a1e85\/resource\/4cc2349d-bf7b-4bbe-a7ca-db5312bb6c94\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Dissemination activity of the first year","resource_name":"Dissemination activity of the first year (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/61f07087-210a-4c35-9606-2aafe183633b\/resource\/5f9d8d8b-1c41-45f7-9dbb-61b9a7bcd076\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"City of the Hague Municipality","package_name":"Test 3- Buurten","resource_name":"Test Buurten - 3","url":"http:\/\/ckan.routetopa.eu\/dataset\/1248d447-2901-4beb-91ae-c2f249fd8a99\/resource\/1fdbc765-8945-4271-8dce-9c7eba45a67d\/download\/Test-3-Compare.csv","metas":"{\"organization\":\"City of the Hague Municipality\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"}]}}'-->
21 <!--suggested-datasets='[{"resource_name":"SUGGESTED 1","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"},{"resource_name":"SUGGESTED 2","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"},{"resource_name":"SUGGESTED 3","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"}]'--> 22 <!--suggested-datasets='[{"resource_name":"SUGGESTED 1","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"},{"resource_name":"SUGGESTED 2","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"},{"resource_name":"SUGGESTED 3","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"}]'-->
22 - <!--</data-sevc-controllet>--> 23 + </data-sevc-controllet>
23 24
24 - <co-datalets-creator-controllet data='[{"a":"0", "b":"1"},{"a":"2", "b":"3a"},{"a":"2", "b":"3"}]' deep-url="http://172.16.15.38/DEEalerProvider/DEEP/"  
25 - datalets-list-url="http://172.16.15.38/DEEalerProvider/DEEP/datalets-list">  
26 - </co-datalets-creator-controllet> 25 + <!--<co-datalets-creator-controllet data='[{"a":"0", "b":"1"},{"a":"2", "b":"3a"},{"a":"2", "b":"3"}]' deep-url="http://172.16.15.38/DEEalerProvider/DEEP/"-->
  26 + <!--datalets-list-url="http://172.16.15.38/DEEalerProvider/DEEP/datalets-list">-->
  27 + <!--</co-datalets-creator-controllet>-->
27 28
28 </body> 29 </body>
29 30
controllets/data-table-controllet/data-table-controllet.html
@@ -216,6 +216,9 @@ @@ -216,6 +216,9 @@
216 <paper-tooltip for="{{_fieldId(index)}}" offset="8"> 216 <paper-tooltip for="{{_fieldId(index)}}" offset="8">
217 <p> 217 <p>
218 <span class="type">{{_type()}}:</span> {{item.type}} 218 <span class="type">{{_type()}}:</span> {{item.type}}
  219 + <!--<template is="dom-if" if={{item.errorsDescription}}>-->
  220 + <!--({{item.subType}})-->
  221 + <!--</template>-->
219 <template is="dom-if" if={{item.errorsDescription.length}}> 222 <template is="dom-if" if={{item.errorsDescription.length}}>
220 <br/> 223 <br/>
221 <span class="warning">{{_warning()}}:</span> {{item.errorsDescription}} 224 <span class="warning">{{_warning()}}:</span> {{item.errorsDescription}}
@@ -301,6 +304,7 @@ @@ -301,6 +304,7 @@
301 var result = converter.inferJsonDataType(data, ["*"]); 304 var result = converter.inferJsonDataType(data, ["*"]);
302 result = converter.cast(result); 305 result = converter.cast(result);
303 this.fields = ArrayUtils.toFieldsArray(result.types); 306 this.fields = ArrayUtils.toFieldsArray(result.types);
  307 +// console.log(this.fields);
304 this.data = result.dataset; 308 this.data = result.dataset;
305 309
306 this.filter = ""; 310 this.filter = "";
controllets/dataset-table-controllet/dataset-table-controllet.html
@@ -275,10 +275,10 @@ @@ -275,10 +275,10 @@
275 </template> 275 </template>
276 </template> 276 </template>
277 <td> 277 <td>
278 - <paper-icon-button room_id$="{{item.ID}}" version$="{{item.VER}}" class="tools" icon="open-in-new" on-click="_onOpenDatasetClick"></paper-icon-button>  
279 - <paper-icon-button room_id$="{{item.ID}}" version$="{{item.VER}}" class="tools" icon="file-download" on-click="_onDownloadDatasetClick"></paper-icon-button>  
280 - <paper-icon-button room_id$="{{item.ID}}" version$="{{item.VER}}" class="tools" icon="content-copy" on-click="_onCopyDatasetClick"></paper-icon-button>  
281 - <paper-icon-button room_id$="{{item.ID}}" version$="{{item.VER}}" class="tools" icon="description" on-click="_onDownloadInfoClick"></paper-icon-button> 278 + <paper-icon-button title="Open" room_id$="{{item.ID}}" version$="{{item.VER}}" class="tools" icon="open-in-new" on-click="_onOpenDatasetClick"></paper-icon-button>
  279 + <paper-icon-button title="Download as CSV" room_id$="{{item.ID}}" version$="{{item.VER}}" class="tools" icon="file-download" on-click="_onDownloadDatasetClick"></paper-icon-button>
  280 + <paper-icon-button title="Copy link" room_id$="{{item.ID}}" version$="{{item.VER}}" class="tools" icon="content-copy" on-click="_onCopyDatasetClick"></paper-icon-button>
  281 + <paper-icon-button title="Download docs" room_id$="{{item.ID}}" version$="{{item.VER}}" class="tools" icon="description" on-click="_onDownloadInfoClick"></paper-icon-button>
282 </td> 282 </td>
283 </tr> 283 </tr>
284 </template> 284 </template>
@@ -633,11 +633,11 @@ @@ -633,11 +633,11 @@
633 return Object.keys(obj).map(function(key) { 633 return Object.keys(obj).map(function(key) {
634 if(key != "ID" && key != "cssClass") { 634 if(key != "ID" && key != "cssClass") {
635 //var test = regExp.test(obj[key]); 635 //var test = regExp.test(obj[key]);
636 - var test = (obj[key].constructor === Array); 636 + var isLink = (obj[key].constructor === Array);
637 return { 637 return {
638 key: key, 638 key: key,
639 value: obj[key], //test ? obj[key].split(",") : obj[key], 639 value: obj[key], //test ? obj[key].split(",") : obj[key],
640 - isLink: test 640 + isLink: isLink
641 } 641 }
642 } 642 }
643 }); 643 });
controllets/providers-utility-controllet/providers-utility-controllet.html
@@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
16 } 16 }
17 }; 17 };
18 18
  19 + //utility non legato al provider, aggiungere copy e creare un altro js!!!
  20 +
19 //jsdatachecker 21 //jsdatachecker
20 utility_getFields = function(types) { 22 utility_getFields = function(types) {
21 return Object.keys(types).map(function(key) { return key; }); 23 return Object.keys(types).map(function(key) { return key; });
@@ -36,26 +38,7 @@ @@ -36,26 +38,7 @@
36 return selectedIndices; 38 return selectedIndices;
37 }; 39 };
38 40
39 - // utility_getResourceUrl = function(url) {  
40 - // //CKAN  
41 - // var strDatasetPos = url.indexOf('/dataset/');  
42 - // var strResourcePos = url.indexOf('/resource/');  
43 - // if (strDatasetPos >= 0 && strResourcePos > strDatasetPos) {  
44 - // var urlSegment1 = url.substring(0, strDatasetPos);  
45 - // var urlResourceEnd = url.indexOf('/', strResourcePos + 10);  
46 - // var resourceId = url.substring(strResourcePos + 10, urlResourceEnd);  
47 - // return urlSegment1 + "/api/action/datastore_search?resource_id=" + resourceId;  
48 - // }  
49 - // //OPENDATASOFT  
50 - // var strExploreDatasetPos = url.indexOf('/explore/dataset/');  
51 - // if (strExploreDatasetPos >= 0) {  
52 - // var urlSegment1 = url.substring(0, strExploreDatasetPos);  
53 - // var datasetEnd = url.indexOf(strExploreDatasetPos + 17, '/');  
54 - // var datasetId = url.substring(strExploreDatasetPos + 17, datasetEnd >= 0 ? datasetEnd : url.length);  
55 - // return urlSegment1 + '/api/records/1.0/search?dataset=' + datasetId;  
56 - // }  
57 - // return "";  
58 - // }; 41 +
59 </script> 42 </script>
60 43
61 <dom-module id="providers-utility-controllet"> 44 <dom-module id="providers-utility-controllet">
controllets/select-data-controllet/select-data-controllet.html
@@ -130,7 +130,15 @@ @@ -130,7 +130,15 @@
130 }, 130 },
131 131
132 getData : function() { 132 getData : function() {
133 - return this.data; 133 + //return datatable.getData
  134 + //this.fields = "*"
  135 + var data = alasql_selectData(this.data, this.fields, this.filters);
  136 + var converter = new DataTypeConverter();
  137 + var result = converter.inferJsonDataType(data, ["*"]);
  138 + result = converter.cast(result);
  139 + data = result.dataset;
  140 +
  141 + return data;
134 }, 142 },
135 143
136 setSelectedFields : function(selectedFields) { 144 setSelectedFields : function(selectedFields) {
controllets/select-dataset-controllet/select-dataset-controllet.html
@@ -485,11 +485,11 @@ @@ -485,11 +485,11 @@
485 // this.datasets = that.datasets["result"]["datasets"]; 485 // this.datasets = that.datasets["result"]["datasets"];
486 486
487 $.ajax({ 487 $.ajax({
488 - url: "/cocreation/ajax/get-all-dataset", 488 + url: "http://172.16.15.77/cocreation/ajax/get-all-dataset",
489 dataType: "json", 489 dataType: "json",
490 success: function(spodDatasets){ 490 success: function(spodDatasets){
491 491
492 - that.providers = $.extend(that.datasets["result"]["providers"], {99: {api_url: "/cocreation/ajax/get-all-dataset", id: "99", image_hash: "SPOD", title: "SPOD"}}); 492 + that.providers = $.extend(that.datasets["result"]["providers"], {99: {api_url: "http://172.16.15.77/cocreation/ajax/get-all-dataset", id: "99", image_hash: "SPOD", title: "SPOD"}});
493 that.datasets = $.merge(spodDatasets, that.datasets["result"]["datasets"]); 493 that.datasets = $.merge(spodDatasets, that.datasets["result"]["datasets"]);
494 494
495 if(that.suggestedDatasets) { 495 if(that.suggestedDatasets) {
controllets/select-visualization-controllet/demo/index.html
@@ -9,6 +9,10 @@ @@ -9,6 +9,10 @@
9 <link rel="stylesheet" href="../../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css"> 9 <link rel="stylesheet" href="../../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">
10 10
11 <script src="../../../locales/controllet_ln.js"></script> 11 <script src="../../../locales/controllet_ln.js"></script>
  12 +
  13 + <script type="text/javascript" src="../../../alasql-utility/alasql.min.js"></script>
  14 + <script type="text/javascript" src="../../../alasql-utility/alasql-utility.js"></script>
  15 +
12 <script> 16 <script>
13 ln["localization"] = "en"; 17 ln["localization"] = "en";
14 </script> 18 </script>
controllets/select-visualization-controllet/select-datalet-inputs.html
@@ -303,9 +303,21 @@ @@ -303,9 +303,21 @@
303 // temp.push({name: name + " " + (i-4), description: description, selection: selection}); 303 // temp.push({name: name + " " + (i-4), description: description, selection: selection});
304 // } 304 // }
305 305
  306 + else if (inputs.length == 2 && inputs[1].selection == "*") {//
  307 + name = inputs[1].name;
  308 + description = inputs[1].description;
  309 + selection = inputs[1].selection;
  310 + temp = [inputs[0]];
  311 + temp.push({name: name + " 1", description: description, selection: selection});
  312 + for (var i = 3; i < this.fields.length; i++)
  313 + temp.push({name: name + " " +(i-1), description: description, selection: selection});
  314 + }
  315 +
306 this.inputs = this._copy(temp); 316 this.inputs = this._copy(temp);
307 317
308 this.selectedFields = new Array(temp.length); 318 this.selectedFields = new Array(temp.length);
  319 +
  320 + this.selectedFields2 = new Array(temp.length);
309 }, 321 },
310 322
311 fireReady : function() { 323 fireReady : function() {
@@ -381,15 +393,23 @@ @@ -381,15 +393,23 @@
381 this.expert = !this.expert; 393 this.expert = !this.expert;
382 }, 394 },
383 395
  396 + getFields : function () {
  397 + return this.selectedFields2;
  398 + },
  399 +
384 _addInput : function(e){ 400 _addInput : function(e){
385 var selectedFields = this._copy(this.selectedFields); 401 var selectedFields = this._copy(this.selectedFields);
386 402
387 var ddl_index = $(e.target).parents("paper-dropdown-menu")[0].id; 403 var ddl_index = $(e.target).parents("paper-dropdown-menu")[0].id;
  404 +
388 var index = e.target.id; 405 var index = e.target.id;
389 selectedFields[ddl_index] = this.fields[index]; 406 selectedFields[ddl_index] = this.fields[index];
390 407
391 this.selectedFields = this._copy(selectedFields); 408 this.selectedFields = this._copy(selectedFields);
392 409
  410 +// console.log(this.inputs[ddl_index].name);
  411 + this.selectedFields2[ddl_index] = {field: this.fields[index], input: this.inputs[ddl_index].name};
  412 +
393 if(!this._isReady()) { 413 if(!this._isReady()) {
394 this.$.group_by.setAttribute("disabled", ""); 414 this.$.group_by.setAttribute("disabled", "");
395 415
@@ -518,6 +538,9 @@ @@ -518,6 +538,9 @@
518 // if(key.indexOf("BubbleContent") > -1) { 538 // if(key.indexOf("BubbleContent") > -1) {
519 // return ln["BubbleContent" + "_" +ln["localization"]] + key.slice(-2); 539 // return ln["BubbleContent" + "_" +ln["localization"]] + key.slice(-2);
520 // } 540 // }
  541 + if(key.indexOf("NumericYAxis") > -1) {
  542 + return ln["NumericYAxis" + "_" +ln["localization"]] + key.slice(-2);
  543 + }
521 544
522 return ln[key + "_" +ln["localization"]]; 545 return ln[key + "_" +ln["localization"]];
523 }, 546 },
controllets/select-visualization-controllet/select-datalet-inputs_series.html
@@ -302,6 +302,10 @@ @@ -302,6 +302,10 @@
302 } 302 }
303 }, 303 },
304 304
  305 + getFields : function () {
  306 + return null;
  307 + },
  308 +
305 setInputs : function(inputs) { 309 setInputs : function(inputs) {
306 this.inputs = this._copy(inputs); 310 this.inputs = this._copy(inputs);
307 }, 311 },
controllets/select-visualization-controllet/select-datalet-options.html
@@ -137,11 +137,11 @@ @@ -137,11 +137,11 @@
137 137
138 <template is="dom-repeat" items={{options}} index-as="index"> 138 <template is="dom-repeat" items={{options}} index-as="index">
139 <div class="inputs"> 139 <div class="inputs">
140 - <template is="dom-if" if="{{_checkType(item.type, 'text')}}"> 140 + <template is="dom-if" if="{{_checkType(item.type, 'TEXT')}}">
141 <paper-input label={{_getLabelName(item.name)}} on-change="_updateParams"></paper-input> 141 <paper-input label={{_getLabelName(item.name)}} on-change="_updateParams"></paper-input>
142 </template> 142 </template>
143 143
144 - <template is="dom-if" if="{{_checkType(item.type, 'list')}}"> 144 + <template is="dom-if" if="{{_checkType(item.type, 'LIST')}}">
145 <paper-dropdown-menu label={{_getLabelName(item.name)}}> 145 <paper-dropdown-menu label={{_getLabelName(item.name)}}>
146 <paper-menu class="dropdown-content" selected = 0> 146 <paper-menu class="dropdown-content" selected = 0>
147 <!--<paper-item on-tap="_updateParams"></paper-item>--> 147 <!--<paper-item on-tap="_updateParams"></paper-item>-->
controllets/select-visualization-controllet/select-visualization-controllet.html
@@ -342,9 +342,13 @@ @@ -342,9 +342,13 @@
342 342
343 this.selectedFields = inputs.getSelectedFields(); 343 this.selectedFields = inputs.getSelectedFields();
344 344
  345 +// console.log(inputs.getFields());
  346 +
345 this.params = {'data-url' : this.dataUrl};//?????????????????? 347 this.params = {'data-url' : this.dataUrl};//??????????????????
346 // this.params = {}; 348 // this.params = {};
347 349
  350 + this.params["selectedFields"] = JSON.stringify(inputs.getFields());
  351 +
348 this.params["filters"] = JSON.stringify(this.filters); 352 this.params["filters"] = JSON.stringify(this.filters);
349 this.params["aggregators"] = JSON.stringify(inputs.getAggregators()); 353 this.params["aggregators"] = JSON.stringify(inputs.getAggregators());
350 this.params["orders"] = JSON.stringify(inputs.getOrders()); 354 this.params["orders"] = JSON.stringify(inputs.getOrders());
@@ -356,7 +360,9 @@ @@ -356,7 +360,9 @@
356 360
357 var data = alasql_complexSelectData(this.data, this.selectedFields, this.filters, inputs.getAggregators(), inputs.getOrders()); 361 var data = alasql_complexSelectData(this.data, this.selectedFields, this.filters, inputs.getAggregators(), inputs.getOrders());
358 data = transformData(data, this.selectedFields, true); 362 data = transformData(data, this.selectedFields, true);
359 - this.params["data"] = JSON.stringify(data).replace(/'/g, "&#39;"); 363 +
  364 + //use cache
  365 +// this.params["data"] = JSON.stringify(data).replace(/'/g, "&#39;");
360 366
361 var dataletParams ={ 367 var dataletParams ={
362 component: this.selectedDatalet+"-datalet", 368 component: this.selectedDatalet+"-datalet",
datalets/base-ajax-json-alasql-datalet/static/js/AjaxJsonAlasqlBehavior.js
@@ -85,11 +85,13 @@ var AjaxJsonAlasqlBehavior = { @@ -85,11 +85,13 @@ var AjaxJsonAlasqlBehavior = {
85 selectData : function() { 85 selectData : function() {
86 var fields = this._component.fields = JSON.parse(this._component.fields); 86 var fields = this._component.fields = JSON.parse(this._component.fields);
87 87
  88 + //var selectedFields = JSON.parse(this._component.getAttribute("selectedFields"));
  89 +
88 var filters = JSON.parse(this._component.getAttribute("filters")); 90 var filters = JSON.parse(this._component.getAttribute("filters"));
89 var aggregators = JSON.parse(this._component.getAttribute("aggregators")); 91 var aggregators = JSON.parse(this._component.getAttribute("aggregators"));
90 var orders = JSON.parse(this._component.getAttribute("orders")); 92 var orders = JSON.parse(this._component.getAttribute("orders"));
91 93
92 - //preview my space 94 + //preview my space ?
93 if(filters && filters[0] && filters[0].constructor == Array){ 95 if(filters && filters[0] && filters[0].constructor == Array){
94 filters = filters[0]; 96 filters = filters[0];
95 aggregators = aggregators[0]; 97 aggregators = aggregators[0];
@@ -100,12 +102,28 @@ var AjaxJsonAlasqlBehavior = { @@ -100,12 +102,28 @@ var AjaxJsonAlasqlBehavior = {
100 var provider = f.getProvider(this._component.dataUrl); 102 var provider = f.getProvider(this._component.dataUrl);
101 var data = provider.selectData(this.properties.json_results.value); 103 var data = provider.selectData(this.properties.json_results.value);
102 104
  105 + //if(selectedFields) {
  106 + // fields = [];
  107 + // var inputs = [];
  108 + // for (var i=0; i < selectedFields.length; i++) {
  109 + // if (selectedFields[i]) {
  110 + // fields.push(selectedFields[i].field);
  111 + // inputs.push(selectedFields[i].input);
  112 + // }
  113 + // }
  114 + //}
  115 +
103 var converter = new DataTypeConverter(); 116 var converter = new DataTypeConverter();
104 var result = converter.inferJsonDataType(data, ["*"]); 117 var result = converter.inferJsonDataType(data, ["*"]);
105 result = converter.cast(result); 118 result = converter.cast(result);
106 data = result.dataset; 119 data = result.dataset;
107 120
108 - //data = alasql_selectData(data, fields, filters); 121 + data = alasql_selectData(data, fields, filters);//funziona senza?
  122 +
  123 + result = converter.inferJsonDataType(data, ["*"]);
  124 + result = converter.cast(result);
  125 + data = result.dataset;
  126 +
109 data = alasql_complexSelectData(data, fields, filters, aggregators, orders); 127 data = alasql_complexSelectData(data, fields, filters, aggregators, orders);
110 128
111 this.data = transformData(data, fields, true); 129 this.data = transformData(data, fields, true);
datalets/highcharts-datalet/highcharts-datalet.html
@@ -140,15 +140,20 @@ Example : @@ -140,15 +140,20 @@ Example :
140 // }, 140 // },
141 141
142 transformData: function () { 142 transformData: function () {
  143 + var selectedFields = JSON.parse(this._component.getAttribute("selectedFields"));
  144 +
143 if(this.data.length == 0) 145 if(this.data.length == 0)
144 return; 146 return;
145 147
146 - if(this.data.length == 2){  
147 - this.properties.categories.value = this.data[0].data;  
148 - this.properties.series.value = [this.data[1]];  
149 - } 148 + categories = this.data[0].data;
  149 + series = [];
  150 + for(var i = 1; i < this.data.length; i++)
  151 + series.push(this.data[i]);
  152 +
  153 + this.properties.categories.value = categories;
  154 + this.properties.series.value = series;
150 155
151 - if(this.data.length == 3){//multi series 156 + if(this.data.length == 3 && !selectedFields){//split cat
152 var x = this.data[0]["data"]; 157 var x = this.data[0]["data"];
153 var gb = this.data[1]["data"]; 158 var gb = this.data[1]["data"];
154 var y = this.data[2]["data"]; 159 var y = this.data[2]["data"];
@@ -166,19 +171,21 @@ Example : @@ -166,19 +171,21 @@ Example :
166 series.push({name: s[i], data: new Array(categories.length+1).join('0').split('').map(parseFloat)}); 171 series.push({name: s[i], data: new Array(categories.length+1).join('0').split('').map(parseFloat)});
167 } 172 }
168 173
169 - for (var i = 0; i < y.length; i++){ 174 + for(var i = 0; i < y.length; i++){
170 var index = categories.indexOf(x[i]); 175 var index = categories.indexOf(x[i]);
171 var s = series.filter(function( obj ) { 176 var s = series.filter(function( obj ) {
172 return obj.name == gb[i]; 177 return obj.name == gb[i];
173 }); 178 });
174 - s[0]["data"][index] = y[i]; 179 + s[0]["data"][index] = y[i];
175 } 180 }
176 181
177 this.properties.categories.value = categories; 182 this.properties.categories.value = categories;
178 this.properties.series.value = series; 183 this.properties.series.value = series;
179 } 184 }
  185 +
180 }, 186 },
181 187
  188 +
182 // setParameters: function(params) 189 // setParameters: function(params)
183 // { 190 // {
184 // this._component.title = params['title']; 191 // this._component.title = params['title'];
datalets/leafletjs-datalet/leafletjs-datalet.html
@@ -89,16 +89,28 @@ Example: @@ -89,16 +89,28 @@ Example:
89 L.Icon.Default.imagePath = 'http://services.routetopa.eu/DEEalerProvider/COMPONENTS/datalets/leafletjs-datalet/leafletsjs/images'; 89 L.Icon.Default.imagePath = 'http://services.routetopa.eu/DEEalerProvider/COMPONENTS/datalets/leafletjs-datalet/leafletsjs/images';
90 90
91 var coordinates = []; 91 var coordinates = [];
  92 + var coordinates_index = 0;
92 var isArray = t.data[0].data[0].constructor === Array; 93 var isArray = t.data[0].data[0].constructor === Array;
93 94
94 for(var i=0; i<t.data[0].data.length; i++) 95 for(var i=0; i<t.data[0].data.length; i++)
95 { 96 {
96 if(isArray) 97 if(isArray)
97 - coordinates.push([parseFloat(t.data[0].data[i][0]), parseFloat(t.data[0].data[i][1])]); 98 + {
  99 + if(!isNaN(t.data[0].data[i][0]) && !isNaN(t.data[0].data[i][1]))
  100 + coordinates.push([parseFloat(t.data[0].data[i][0]), parseFloat(t.data[0].data[i][1])]);
  101 + else
  102 + continue;
  103 + }
98 else 104 else
99 - coordinates.push([parseFloat(t.data[0].data[i]), parseFloat(t.data[1].data[i])]); 105 + {
  106 + if(!isNaN(t.data[0].data[i]) && !isNaN(t.data[1].data[i]))
  107 + coordinates.push([parseFloat(t.data[0].data[i]), parseFloat(t.data[1].data[i])]);
  108 + else
  109 + continue;
  110 + }
100 111
101 - var marker = L.marker([coordinates[i][0], coordinates[i][1]]).addTo(t._component.map); 112 + var marker = L.marker([coordinates[coordinates_index][0], coordinates[coordinates_index][1]]).addTo(t._component.map);
  113 + coordinates_index++;
102 114
103 if(t.data.length > 2) 115 if(t.data.length > 2)
104 { 116 {