Commit 37bd0ebd877ebcdecc6ff3874fb6d2a5dabd6e19

Authored by Andrea Petta
2 parents b0b8a913 34789a0e

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

Showing 31 changed files with 2057 additions and 2565 deletions
alasql-utility/alasql-utility.js
... ... @@ -125,7 +125,8 @@ function _addParenthesis (fields) {
125 125 }
126 126  
127 127 function _normalizeField (field) {
128   - return "[" + field + "]";
  128 + return "`" + field + "`";
  129 + //return "[" + field + "]";
129 130 }
130 131  
131 132 function alasql_transformData (data, fields, round) {
... ...
bower_components/jsdatachecker/.bower.json
1 1 {
2   - "name": "JSDataChecker",
3   - "version": "0.0.9",
4   - "homepage": "https://github.com/donpir/JSDataChecker",
  2 + "name": "jsdatachecker",
  3 + "version": "0.1.2",
  4 + "homepage": "https://github.com/donpir/jsdatachecker",
5 5 "authors": [
6 6 "'Donato Pirozzi <'donatopirozzi@gmail.com'>"
7 7 ],
... ... @@ -19,17 +19,17 @@
19 19 "polymer": "Polymer/polymer#1.2.0",
20 20 "qunit": "~1.22.0",
21 21 "csvjson": "0.1.1",
22   - "polywc": "https://github.com/donpir/polywc.git#master"
  22 + "polywc-data-table": "https://github.com/donpir/polywc-data-table.git#master"
23 23 },
24 24 "private": false,
25   - "_release": "0.0.9",
  25 + "_release": "0.1.2",
26 26 "_resolution": {
27 27 "type": "version",
28   - "tag": "v0.0.9",
29   - "commit": "277c51efeee4daa0bd11051de022975ba86f47fa"
  28 + "tag": "v0.1.2",
  29 + "commit": "1cd37fc00315232a97de7978e5423784899eca29"
30 30 },
31 31 "_source": "https://github.com/donpir/JSDataChecker.git",
32   - "_target": "~0.0.9",
  32 + "_target": "~0.1.2",
33 33 "_originalSource": "jsdatachecker",
34 34 "_direct": true
35 35 }
36 36 \ No newline at end of file
... ...
bower_components/jsdatachecker/README.md
... ... @@ -3,6 +3,18 @@ JavaScript Library to read dataset content (e.g., Open Data), infer data types,
3 3  
4 4 In details, it analysis the json (specified paths) to infer the data type. In addition, when request (via code) the library converts the json data based on the inferred type.
5 5  
  6 +Recognised basic types:
  7 + - Text;
  8 + - Number;
  9 + - Date;
  10 + - Object;
  11 + - Null.
  12 +
  13 +Recognised types:
  14 + - Geographic coordinates;
  15 + - JSON;
  16 + - GEOJSON.
  17 +
6 18 ## Documentation
7 19  
8 20 See wiki pages [here](https://github.com/donpir/JSDataChecker/wiki).
... ...
bower_components/jsdatachecker/bower.json
1 1 {
2   - "name": "JSDataChecker",
3   - "version": "v0.0.9",
4   - "homepage": "https://github.com/donpir/JSDataChecker",
  2 + "name": "jsdatachecker",
  3 + "version": "v0.1.2",
  4 + "homepage": "https://github.com/donpir/jsdatachecker",
5 5 "authors": [
6 6 "'Donato Pirozzi <'donatopirozzi@gmail.com'>"
7 7 ],
... ... @@ -19,7 +19,7 @@
19 19 "polymer": "Polymer/polymer#1.2.0",
20 20 "qunit": "~1.22.0",
21 21 "csvjson": "0.1.1",
22   - "polywc": "https://github.com/donpir/polywc.git#master"
  22 + "polywc-data-table": "https://github.com/donpir/polywc-data-table.git#master"
23 23 },
24 24 "private": false
25 25 }
... ...
bower_components/jsdatachecker/build.cmd
1 1 del jsdatachecker.min.js
2   -uglifyjs src\ArrayUtils.js src\DataTypeConverter.js src\DataTypesUtils.js src\DataTypeHierarchy.js --compress -o jsdatachecker.min.js
3 2 \ No newline at end of file
  3 +uglifyjs src\ArrayUtils.js src\DataTypeConverter.js src\DataTypesUtils.js src\DataTypeHierarchy.js src\langs.js --compress -o jsdatachecker.min.js
4 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(){}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={GEOCOORDINATE:{value:1e3,name:"GEOCOORDINATE"},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;var max=ArrayUtils.FindMinMax(field._inferredSubTypes,function(curval,lastval){return curval>lastval});if(field.subtype=null,null!=max&&null!=max.first){field.subtype=max.first.key,field.subtypeConfidence=field._inferredSubTypes[field.subtype]/field.numOfItems;var fieldName=field.name.toLowerCase(),isLatType=field.subtype===DataTypeConverter.SUBTYPES.LATITUDE.name,fieldNameContainsLat=fieldName.indexOf("lat")>=0,fieldNameContainsLon=fieldName.indexOf("ng")>=0;1==isLatType&&0==fieldNameContainsLat&&1==fieldNameContainsLon&&(field.subtype=DataTypeConverter.SUBTYPES.LONGITUDE.name)}})},_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},_processInferSubType=function(value){if(null===value||"undefined"==typeof value)return null;var isnumber=DataTypesUtils.FilterFloat(value);return isNaN(isnumber)!==!0?isnumber>=-90&&90>=isnumber&&DataTypesUtils.DecimalPlaces(isnumber)>=5?DataTypeConverter.SUBTYPES.GEOCOORDINATE:isnumber>=-180&&180>=isnumber&&DataTypesUtils.DecimalPlaces(isnumber)>=5?DataTypeConverter.SUBTYPES.GEOCOORDINATE:null:null},_filterBasedOnThreshold=function(metadata,threshold){return ArrayUtils.IteratorOverKeys(metadata.types,function(fieldType,key){if(!(fieldType.typeConfidence>=threshold)){var arrHierarchyTypes=DataTypeHierarchy.HIERARCHY[fieldType.type],lastFieldType={lastType:arrHierarchyTypes[0],lastTypeCounter:fieldType._inferredTypes[arrHierarchyTypes[0]],typeConfidence:0};lastFieldType.typeConfidence=lastFieldType.lastTypeCounter/fieldType.numOfItems;for(var curType,i=1;i<arrHierarchyTypes.length,curType=arrHierarchyTypes[i];i++){var numItemsOfCurType=fieldType._inferredTypes.hasOwnProperty(curType)?fieldType._inferredTypes[curType]:0;if(lastFieldType.lastType=curType,lastFieldType.lastTypeCounter+=numItemsOfCurType,lastFieldType.typeConfidence=lastFieldType.lastTypeCounter/fieldType.numOfItems,lastFieldType.typeConfidence>=threshold){fieldType.type=lastFieldType.lastType,fieldType.typeConfidence=lastFieldType.typeConfidence;break}}}}),metadata},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,options){"undefined"!=typeof options&&null!=options||(options={thresholdConfidence:1});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 curKey=sProcessedKeys+(0==sProcessedKeys.length?"":",")+key,fieldType=ArrayUtils.TestAndInitializeKey(fieldsType,curKey,{name:curKey,_inferredTypes:[],_inferredSubTypes:[],_inferredValues:[],numOfItems:0});fieldType.numOfItems++;var inferredType=_processInferType(item);ArrayUtils.TestAndIncrement(fieldType._inferredTypes,inferredType.name),inferredType===DataTypeConverter.TYPES.TEXT&&ArrayUtils.TestAndIncrement(fieldType._inferredValues,item);var inferredSubType=_processInferSubType(item);null!=inferredSubType&&"undefined"!=typeof inferredSubType&&ArrayUtils.TestAndIncrement(fieldType._inferredSubTypes,inferredSubType.name)}),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="";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});var metadata={dataset:json,fieldKeys:fieldKeys,types:fieldsType,qualityIndex:quality,warningsTextual:warningsTextual};return _filterBasedOnThreshold(metadata,options.thresholdConfidence),metadata},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.GEOCOORDINATE.name]=[DataTypeConverter.SUBTYPES.GEOCOORDINATE.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};
2 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={EMPTY:{value:0,name:"NULL"},TEXT:{value:1,name:"TEXT"},NUMBER:{value:2,name:"NUMBER"},OBJECT:{value:3,name:"OBJECT"},DATETIME:{value:4,name:"DATETIME"}},DataTypeConverter.SUBTYPES={GEOCOORDINATE:{value:1e3,name:"GEOCOORDINATE"},GEOJSON:{value:1001,name:"GEOJSON"},BOOL:{value:1002,name:"BOOL"},CONST:{value:1003,name:"CONST"},CATEGORY:{value:1004,name:"CATEGORY"},PERCENTAGE:{value:1100,name:"PERCENTAGE"},LATITUDE:{value:1101,name:"LATITUDE"},LONGITUDE:{value:1102,name:"LONGITUDE"}},DataTypeConverter.LANGS={EN:{value:1e3,name:"EN"},IT:{value:1001,name:"IT"},FR:{value:1100,name:"FR"},NL:{value:1101,name:"NL"}},DataTypeConverter.GEOJSONTYPES=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","GeometryCollection","Feature","FeatureCollection"],DataTypeConverter.prototype=function(){var _analyseDataTypes=function(fields){ArrayUtils.IteratorOverKeys(fields,function(field){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;var max=ArrayUtils.FindMinMax(field._inferredSubTypes,function(curval,lastval){return curval>lastval});if(field.subtype=null,null!=max&&null!=max.first){field.subtype=max.first.key,field.subtypeConfidence=field._inferredSubTypes[field.subtype]/field.numOfItems;var fieldName=field.name.toLowerCase(),isLatType=field.subtype===DataTypeConverter.SUBTYPES.LATITUDE.name,fieldNameContainsLat=fieldName.indexOf("lat")>=0,fieldNameContainsLon=fieldName.indexOf("ng")>=0;1==isLatType&&0==fieldNameContainsLat&&1==fieldNameContainsLon&&(field.subtype=DataTypeConverter.SUBTYPES.LONGITUDE.name)}})},_processInferType=function(value){if(null===value||"undefined"==typeof value)return DataTypeConverter.TYPES.EMPTY;if("object"==typeof value)return DataTypeConverter.TYPES.OBJECT;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},_processInferSubType=function(value){if(null===value||"undefined"==typeof value)return null;if(Array.isArray(value)&&2==value.length&&NaN!=DataTypesUtils.FilterFloat(value[0])&&NaN!=DataTypesUtils.FilterFloat(value[1])&&DataTypesUtils.DecimalPlaces(value[0])>4&&DataTypesUtils.DecimalPlaces(value[1])>4)return DataTypeConverter.SUBTYPES.GEOCOORDINATE;if("string"==typeof value){var split=value.split(",");if(DataTypesUtils.IsLatLng(split[0])&&DataTypesUtils.IsLatLng(split[1]))return DataTypeConverter.SUBTYPES.GEOCOORDINATE}var isnumber=DataTypesUtils.FilterFloat(value);if(isNaN(isnumber)!==!0)return isnumber>=-90&&90>=isnumber&&DataTypesUtils.DecimalPlaces(isnumber)>=5?DataTypeConverter.SUBTYPES.GEOCOORDINATE:isnumber>=-180&&180>=isnumber&&DataTypesUtils.DecimalPlaces(isnumber)>=5?DataTypeConverter.SUBTYPES.GEOCOORDINATE:null;if("object"==typeof value&&value.hasOwnProperty("type")){var geotype=value.type,isincluded=DataTypeConverter.GEOJSONTYPES.includes(geotype);if(isincluded)return DataTypeConverter.SUBTYPES.GEOJSON}return null},_filterBasedOnThreshold=function(metadata,threshold){return ArrayUtils.IteratorOverKeys(metadata.types,function(fieldType,key){if(!(fieldType.typeConfidence>=threshold)){var arrHierarchyTypes=DataTypeHierarchy.HIERARCHY[fieldType.type];if(null==arrHierarchyTypes)return metadata;var lastFieldType={lastType:arrHierarchyTypes[0],lastTypeCounter:fieldType._inferredTypes[arrHierarchyTypes[0]],typeConfidence:0};lastFieldType.typeConfidence=lastFieldType.lastTypeCounter/fieldType.numOfItems;for(var curType,i=1;i<arrHierarchyTypes.length,curType=arrHierarchyTypes[i];i++){var numItemsOfCurType=fieldType._inferredTypes.hasOwnProperty(curType)?fieldType._inferredTypes[curType]:0;if(lastFieldType.lastType=curType,lastFieldType.lastTypeCounter+=numItemsOfCurType,lastFieldType.typeConfidence=lastFieldType.lastTypeCounter/fieldType.numOfItems,lastFieldType.typeConfidence>=threshold){fieldType.type=lastFieldType.lastType,fieldType.typeConfidence=lastFieldType.typeConfidence;break}}}}),metadata},_capitalizeFirstLetter=function(string){return string.charAt(0).toUpperCase()+string.slice(1)},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,options){"undefined"!=typeof options&&null!=options||(options={}),0==options.hasOwnProperty("thresholdConfidence")&&(options.thresholdConfidence=1),0==options.hasOwnProperty("language")?options.language=DataTypeConverter.LANGS.EN.name:options.language=options.language.toUpperCase();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 curKey=sProcessedKeys+(0==sProcessedKeys.length?"":",")+key,fieldType=ArrayUtils.TestAndInitializeKey(fieldsType,curKey,{name:curKey,_inferredTypes:[],_inferredSubTypes:[],_inferredValues:[],numOfItems:0});fieldType.numOfItems++;var inferredType=_processInferType(item);ArrayUtils.TestAndIncrement(fieldType._inferredTypes,inferredType.name),inferredType===DataTypeConverter.TYPES.TEXT&&ArrayUtils.TestAndIncrement(fieldType._inferredValues,item);var inferredSubType=_processInferSubType(item);null!=inferredSubType&&"undefined"!=typeof inferredSubType&&ArrayUtils.TestAndIncrement(fieldType._inferredSubTypes,inferredSubType.name)}),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="";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){var _descr1=_capitalizeFirstLetter(JDC_LNG.key_declaretype[options.language])+".",_descr2=_capitalizeFirstLetter(JDC_LNG.key_notoftype_singular[options.language])+".";incorrect>1&&(_descr2=_capitalizeFirstLetter(JDC_LNG.key_notoftype_plural[options.language])+".");var descr=_descr1+" "+_descr2;descr=descr.replace(/%COL_NAME/g,fieldType.name),descr=descr.replace(/%COL_TYPE/g,fieldType.type),descr=descr.replace(/%COL_ERRORS/g,incorrect),description+=descr}}var descr="";1==fieldType.totalNullValues?descr=_capitalizeFirstLetter(JDC_LNG.key_emptyvalue_singolar[options.language])+".":fieldType.totalNullValues>1&&(descr=_capitalizeFirstLetter(JDC_LNG.key_emptyvalue_plural[options.language])+"."),descr=descr.replace(/%COL_NAME/g,fieldType.name),descr=descr.replace(/%COL_TYPE/g,fieldType.type),descr=descr.replace(/%COL_NULLVALUES/g,fieldType.totalNullValues),fieldType.errorsDescription=description,warningsTextual+=description});var metadata={dataset:json,fieldKeys:fieldKeys,types:fieldsType,qualityIndex:quality,warningsTextual:warningsTextual};return _filterBasedOnThreshold(metadata,options.thresholdConfidence),metadata},inferDataTypeOfValue:function(value){return _processInferType(value)},inferDataSubTypeOfValue:function(value){return _processInferSubType(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},DataTypesUtils.IsLatLng=function(num){return NaN==DataTypesUtils.FilterFloat(num)?!1:DataTypesUtils.DecimalPlaces(num)>4},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.GEOCOORDINATE.name]=[DataTypeConverter.SUBTYPES.GEOCOORDINATE.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};var JDC_LNG={key_declaretype:{EN:"the column <%COL_NAME> is of type <%COL_TYPE>",IT:"la colonna <%COL_NAME> รจ di tipo <%COL_TYPE>",FR:"le colum <%COL_NAME> est de type <%COL_TYPE>",NL:"de kolom <%COL_NAME> is van het type <%COL_TYPE>"},key_notoftype_singular:{EN:"a value is not <%COL_TYPE>",IT:"un valore non รจ un <%COL_TYPE>",FR:"une valeur est pas <%COL_TYPE> se trouvant",NL:"een waarde is niet <%COL_TYPE>"},key_notoftype_plural:{EN:"%COL_ERRORS values are not <%COL_TYPE>",IT:"%COL_ERRORS valori non sono di tipo <%COL_TYPE>",FR:"les valeurs %COL_ERRORS sont du type <%COL_TYPE>",NL:"%COL_ERRORS waarden niet <%COL_TYPE>"},key_emptyvalue_singolar:{EN:"the column <%COL_NAME> has an empty value",IT:"la colonna <%COL_NAME> ha un valore vuoto",FR:"la colonne <%COL_NAME> a une valeur vide",NL:"de kolom <%COL_NAME> heeft een lege waarde"},key_emptyvalue_plural:{EN:"the column <%COL_NAME> has <%COL_NULLVALUES> empty values",IT:"la colonna <%COL_NAME> ha <%COL_NULLVALUES> valori vuoti",FR:"la colonne <%COL_NAME> a <%COL_NULLVALUES> valeurs vide",NL:"de kolom <%COL_NAME> heeft <%COL_NULLVALUES> lege waarde"},key_type:{EN:"type",IT:"tipo",FR:"type",NL:"type"},key_subtype:{EN:"subtype",IT:"sottotipo",FR:"sous-type",NL:"subtype"},key_typetext:{EN:"text",IT:"testo",FR:"texte",NL:"tekst"},key_typenumber:{EN:"number",IT:"numero",FR:"nombre",NL:"aantal"},key_typeobject:{EN:"object",IT:"oggetto",FR:"objet",NL:"voorwerp"},key_typedatetime:{EN:"date or time",IT:"data o orario",FR:"date ou l'heure",NL:"datum of tijd"},key_typeempty:{EN:"empty",IT:"vuoto",FR:"vide",NL:"leeg"},key_typelatitude:{EN:"latitude",IT:"latitudine",FR:"latitude",NL:"breedtegraad"},key_typelongitude:{EN:"longitude",IT:"longitudine",FR:"longitude",NL:"lengtegraad"}};
3 3 \ No newline at end of file
... ...
bower_components/jsdatachecker/src/DataTypeConverter.js
... ... @@ -25,29 +25,40 @@ function DataTypeConverter() {
25 25 };//EndConstructor.
26 26  
27 27 DataTypeConverter.TYPES = {
28   - TEXT : { value: 0, name: "TEXT" },
29   - CODE : { value: 1, name: "CODE"},
  28 + EMPTY : { value: 0, name: "NULL"},
30 29  
  30 + TEXT : { value: 1, name: "TEXT" },
31 31 NUMBER : { value: 2, name: "NUMBER" },
32 32 OBJECT : { value: 3, name: "OBJECT" },
  33 + DATETIME : { value: 4, name: "DATETIME" }
  34 +};
33 35  
  36 +DataTypeConverter.SUBTYPES = {
  37 + GEOCOORDINATE : { value: 1000, name: "GEOCOORDINATE" },
  38 + GEOJSON : { value: 1001, name: "GEOJSON" },
  39 + BOOL : { value: 1002, name: "BOOL"},
  40 + CONST : { value: 1003, name: "CONST" },
  41 + CATEGORY : { value: 1004, name: "CATEGORY" },
34 42  
35   - BOOL : { value: 5, name: "BOOL"},
36   - CONST : { value: 6, name: "CONST" },
37   - CATEGORY : { value: 7, name: "CATEGORY" },
38   -
39   - DATETIME : { value: 8, name: "DATETIME" },
  43 + PERCENTAGE : { value: 1100, name: "PERCENTAGE" },
  44 + LATITUDE : { value: 1101, name: "LATITUDE" },
  45 + LONGITUDE : { value: 1102, name: "LONGITUDE" }
40 46  
41   - EMPTY : { value: 101, name: "NULL" }
  47 + /*CODE : { value: 2000, name: "CODE"},*/
42 48 };
43 49  
44   -DataTypeConverter.SUBTYPES = {
45   - GEOCOORDINATE : { value: 1000, name: "GEOCOORDINATE" },
46   - PERCENTAGE : { value: 1000, name: "PERCENTAGE" },
47   - LATITUDE : { value: 1001, name: "LATITUDE" },
48   - LONGITUDE : { value: 1002, name: "LONGITUDE" }
  50 +DataTypeConverter.LANGS = {
  51 + EN : { value: 1000, name: "EN" },
  52 + IT : { value: 1001, name: "IT" },
  53 + FR : { value: 1100, name: "FR" },
  54 + NL : { value: 1101, name: "NL" }
49 55 };
50 56  
  57 +
  58 +DataTypeConverter.GEOJSONTYPES = [ "Point", "MultiPoint", "LineString",
  59 + "MultiLineString", "Polygon", "MultiPolygon", "GeometryCollection", "Feature",
  60 + "FeatureCollection" ];
  61 +
51 62 DataTypeConverter.prototype = (function () {
52 63  
53 64 /***
... ... @@ -111,6 +122,10 @@ DataTypeConverter.prototype = (function () {
111 122  
112 123 var _analyseDataTypes = function(fields) {
113 124 ArrayUtils.IteratorOverKeys(fields, function(field) {
  125 +
  126 +
  127 + /*
  128 + //TODO: removed CODE, I don't know whether it must be inserted
114 129 if (field._inferredTypes[DataTypeConverter.TYPES.CODE.name]) {
115 130 var confidence = field._inferredTypes[DataTypeConverter.TYPES.CODE.name] / field.numOfItems;
116 131 var _numericalInferredType = field._inferredTypes[DataTypeConverter.TYPES.NUMBER.name];
... ... @@ -119,7 +134,7 @@ DataTypeConverter.prototype = (function () {
119 134 field.type = DataTypeConverter.TYPES.CODE.name;
120 135 field.typeConfidence = confidence;
121 136 return;
122   - }
  137 + }*/
123 138  
124 139 //Infers the field TYPE.
125 140 var max = ArrayUtils.FindMinMax(field._inferredTypes, function (curval, lastval) {
... ... @@ -189,11 +204,6 @@ DataTypeConverter.prototype = (function () {
189 204 if (typeof value === 'object')
190 205 return DataTypeConverter.TYPES.OBJECT;
191 206  
192   - //If the value starts with a zero and contains all numbers, it is
193   - //inferred as textual content.
194   - if (/^0[0-9]+$/.test(value))
195   - return DataTypeConverter.TYPES.CODE;
196   -
197 207 //Try to parse the float.
198 208 var isnumber = DataTypesUtils.FilterFloat(value);
199 209 if (isNaN(isnumber) !== true) {//It is a number.
... ... @@ -222,6 +232,21 @@ DataTypeConverter.prototype = (function () {
222 232 var _processInferSubType = function (value) {
223 233 if (value === null || typeof value === 'undefined') return null;
224 234  
  235 + //GEOCOORDINATE
  236 + if (Array.isArray(value) && value.length == 2) {//It recognises the LAT LNG as array of two values.
  237 + //Checks if the two array's values are numbers.
  238 + if ( DataTypesUtils.FilterFloat(value[0]) != NaN && DataTypesUtils.FilterFloat(value[1]) != NaN )
  239 + if (DataTypesUtils.DecimalPlaces(value[0]) > 4 && DataTypesUtils.DecimalPlaces(value[1]) > 4 )
  240 + return DataTypeConverter.SUBTYPES.GEOCOORDINATE;
  241 + }//EndIf.
  242 +
  243 + if (typeof value === 'string') {
  244 + var split = value.split(",");
  245 + //if (split.length == 2)
  246 + if (DataTypesUtils.IsLatLng(split[0]) && DataTypesUtils.IsLatLng(split[1]))
  247 + return DataTypeConverter.SUBTYPES.GEOCOORDINATE;
  248 + }
  249 +
225 250 //Try to parse the float.
226 251 var isnumber = DataTypesUtils.FilterFloat(value);
227 252 if (isNaN(isnumber) !== true) {//It is a number.
... ... @@ -240,6 +265,19 @@ DataTypeConverter.prototype = (function () {
240 265 return null;
241 266 }
242 267  
  268 + //Try to parse GEOJSON.
  269 + if (typeof value === 'object' && value.hasOwnProperty('type')) {
  270 + //Check the type variable.
  271 + var geotype = value.type;
  272 + var isincluded = DataTypeConverter.GEOJSONTYPES.includes(geotype);
  273 + if (isincluded) return DataTypeConverter.SUBTYPES.GEOJSON;
  274 + }
  275 +
  276 + //If the value starts with a zero and contains all numbers, it is
  277 + //inferred as textual content.
  278 + /*if (/^0[0-9]+$/.test(value))
  279 + return DataTypeConverter.TYPES.CODE;*/
  280 +
243 281 return null;
244 282 };//EndFunction.
245 283  
... ... @@ -248,6 +286,9 @@ DataTypeConverter.prototype = (function () {
248 286 if (fieldType.typeConfidence >= threshold) return;
249 287  
250 288 var arrHierarchyTypes = DataTypeHierarchy.HIERARCHY[fieldType.type];
  289 + if (arrHierarchyTypes == null)
  290 + return metadata;
  291 +
251 292 var lastFieldType = { lastType: arrHierarchyTypes[0],
252 293 lastTypeCounter: fieldType._inferredTypes[arrHierarchyTypes[0]],
253 294 typeConfidence: 0 };
... ... @@ -270,6 +311,15 @@ DataTypeConverter.prototype = (function () {
270 311 return metadata;
271 312 };//EndFunction.
272 313  
  314 + var _capitalizeFirstLetter = function(string) {
  315 + return string.charAt(0).toUpperCase() + string.slice(1);
  316 + };//EndFunction.
  317 +
  318 + var _replaceAll = function(search, replacement) {
  319 + var target = this;
  320 + return target.split(search).join(replacement);
  321 + };
  322 +
273 323 var jsonTraverse = function(json, fieldKeys, callback) {
274 324 var stack = [];
275 325 var numOfRows = 0;
... ... @@ -396,8 +446,17 @@ DataTypeConverter.prototype = (function () {
396 446 * @param options Infer Data Type options, in particular the threshold value for the confidence.
397 447 */
398 448 inferJsonDataType: function (json, fieldKeys, options) {
399   - if (typeof options === 'undefined' || options == null)
400   - options = { thresholdConfidence: 1 };
  449 +
  450 + //Default options initialisation.
  451 + if (typeof options === 'undefined' || options == null) options = { };
  452 +
  453 + if (options.hasOwnProperty("thresholdConfidence") == false)
  454 + options.thresholdConfidence = 1;
  455 +
  456 + if (options.hasOwnProperty("language") == false)
  457 + options.language = DataTypeConverter.LANGS.EN.name;
  458 + else
  459 + options.language = options.language.toUpperCase();
401 460  
402 461 var stack = [];
403 462 var fieldsType = {};
... ... @@ -508,19 +567,43 @@ DataTypeConverter.prototype = (function () {
508 567  
509 568 var incorrect = fieldType.numOfItems - fieldType.totalNullValues - fieldType._inferredTypes[fieldType.type];
510 569 if (incorrect > 0) {
511   - description += "The column <" + fieldType.name + "> has the type <" + fieldType.type + ">";
  570 + var _descr1 = _capitalizeFirstLetter(JDC_LNG['key_declaretype'][options.language]) + ".";
  571 + var _descr2 = _capitalizeFirstLetter(JDC_LNG['key_notoftype_singular'][options.language]) + ".";
  572 + if (incorrect > 1)
  573 + _descr2 = _capitalizeFirstLetter(JDC_LNG['key_notoftype_plural'][options.language]) + ".";
  574 +
  575 + var descr = _descr1 + " " + _descr2;
  576 + descr = descr.replace(/%COL_NAME/g, fieldType.name);
  577 + descr = descr.replace(/%COL_TYPE/g, fieldType.type);
  578 + descr = descr.replace(/%COL_ERRORS/g, incorrect);
  579 +
  580 + description += descr;
  581 +
  582 + /*description += "The column <" + fieldType.name + "> has the type <" + fieldType.type + ">";
512 583 var verb = (incorrect == 1) ? " value is" : " values are";
513   - description += ", but " + incorrect + verb + " not a " + fieldType.type;
  584 + description += ", but " + incorrect + verb + " not a " + fieldType.type;*/
514 585 }
515 586 }
516 587  
517   - if (fieldType.totalNullValues > 0) {
  588 + var descr = "";
  589 + if (fieldType.totalNullValues == 1)
  590 + descr = _capitalizeFirstLetter(JDC_LNG['key_emptyvalue_singolar'][options.language]) + ".";
  591 + else if (fieldType.totalNullValues > 1 )
  592 + descr = _capitalizeFirstLetter(JDC_LNG['key_emptyvalue_plural'][options.language]) + ".";
  593 +
  594 + descr = descr.replace(/%COL_NAME/g, fieldType.name);
  595 + descr = descr.replace(/%COL_TYPE/g, fieldType.type);
  596 + descr = descr.replace(/%COL_NULLVALUES/g, fieldType.totalNullValues);
  597 +
  598 + /*if (fieldType.totalNullValues > 0) {
  599 + var descr = _capitalizeFirstLetter(JDC_LNG['key_declaretype'][options.language]) + ".";
  600 +
518 601 description += "The column <" + fieldType.name + "> has " + fieldType.totalNullValues + " EMPTY value";
519 602 if (fieldType.totalNullValues > 1) description += "s";
520 603 }
521 604  
522 605 if (description.length > 0)
523   - description += ".";
  606 + description += ".";*/
524 607  
525 608 fieldType.errorsDescription = description;
526 609 warningsTextual += description;
... ... @@ -547,6 +630,15 @@ DataTypeConverter.prototype = (function () {
547 630 */
548 631 inferDataTypeOfValue: function (value) {
549 632 return _processInferType(value);
  633 + },//EndFunction.
  634 +
  635 + /**
  636 + * Given in input a value, the function infers the data type.
  637 + * @param value
  638 + * @returns {*}
  639 + */
  640 + inferDataSubTypeOfValue: function (value) {
  641 + return _processInferSubType(value);
550 642 }//EndFunction.
551 643  
552 644 };
... ...
bower_components/jsdatachecker/src/DataTypesUtils.js
... ... @@ -122,4 +122,10 @@ DataTypesUtils.DecimalPlaces = function (num) {
122 122 (match[1] ? match[1].length : 0)
123 123 // Adjust for scientific notation.
124 124 - (match[2] ? +match[2] : 0));
  125 +}//EndFunction.
  126 +
  127 +DataTypesUtils.IsLatLng = function (num) {
  128 + if (DataTypesUtils.FilterFloat(num) == NaN) return false;
  129 + if (DataTypesUtils.DecimalPlaces(num) > 4) return true;
  130 + return false;
125 131 }//EndFunction.
126 132 \ No newline at end of file
... ...
bower_components/jsdatachecker/src/ODPlatforms/CKAN.js
... ... @@ -39,6 +39,7 @@ CKANApi.prototype = (function() {
39 39 errorCallback("Check DataStoreAPI.");
40 40 };
41 41 xhttp.open("GET", theUrl, true);//true for asynchronous.
  42 + //xhttp.setRequestHeader('Content-yype')
42 43 xhttp.send(null);
43 44 };//EndFunction.
44 45  
... ...
bower_components/jsdatachecker/src/ODPlatforms/ODStatistics.js
... ... @@ -53,18 +53,44 @@ ODStatistics.prototype = (function() {
53 53  
54 54 stats.numOfDatasets = datasets.length;
55 55 stats.formats = [];
  56 + stats.formatsAggregated = [];
56 57  
57 58 for (var i=0; i<datasets.length; i++) {
58 59 var dataset = datasets[i];
59 60  
60 61 //Statistics on the datasets' formats.
61 62 ArrayUtils.TestAndIncrement(stats.formats, dataset.format);
  63 +
  64 + var dsformat = dataset.format.toLowerCase();
  65 +
  66 + //Aggregated formats.
  67 + if (dsformat.includes("csv"))
  68 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "csv");
  69 + else if (dsformat.includes("pdf"))
  70 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "pdf");
  71 + else if (dsformat.includes("html"))
  72 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "html");
  73 + else if (dsformat.includes("json"))
  74 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "json");
  75 + else if (dsformat.includes("xml"))
  76 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "xml");
  77 + else if (dsformat.includes("shp"))
  78 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "shp");
  79 + else if (dsformat.includes("geojson"))
  80 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "geojson");
  81 + else if (dsformat.includes("kml"))
  82 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "kml");
  83 + else if (dsformat.includes("txt"))
  84 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "txt");
  85 + else if (dsformat.includes("xls") || dsformat.includes("xlsx") || dsformat.includes("ods"))
  86 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "xls/ods");
  87 + else
  88 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "other");
62 89 }//EndForI.
63 90  
64 91 //Calculates the formats percentages.
65 92 var tmpArrFormats = stats.formats;
66 93 stats.formats = [];
67   -
68 94 ArrayUtils.IteratorOverKeys(tmpArrFormats, function(item, property) {
69 95 var recordFormat = {};
70 96 recordFormat.name = property;
... ... @@ -74,6 +100,18 @@ ODStatistics.prototype = (function() {
74 100 stats.formats.push(recordFormat);
75 101 });
76 102  
  103 + //Calculates the formats percentage for the aggregated formats.
  104 + var tmpArrFormatsAggregated = stats.formatsAggregated;
  105 + stats.formatsAggregated = [];
  106 + ArrayUtils.IteratorOverKeys(tmpArrFormatsAggregated, function(item, property) {
  107 + var recordFormat = {};
  108 + recordFormat.name = property;
  109 + recordFormat.occurrance = item;
  110 + recordFormat.occurrancePercentage = (item / datasets.length) * 100;
  111 + recordFormat.occurrancePercentage = Math.round(recordFormat.occurrancePercentage * 100) / 100;
  112 + stats.formatsAggregated.push(recordFormat);
  113 + });
  114 +
77 115 return stats;
78 116 };//EndFunction.
79 117  
... ...
bower_components/jsdatachecker/src/langs.js 0 โ†’ 100644
  1 +
  2 +
  3 +
  4 +var JDC_LNG = {
  5 +
  6 + "key_declaretype": {
  7 + "EN": "the column <%COL_NAME> is of type <%COL_TYPE>",
  8 + "IT": "la colonna <%COL_NAME> รจ di tipo <%COL_TYPE>",
  9 + "FR": "le colum <%COL_NAME> est de type <%COL_TYPE>",
  10 + "NL": "de kolom <%COL_NAME> is van het type <%COL_TYPE>"
  11 + },
  12 +
  13 + "key_notoftype_singular": {
  14 + "EN": "a value is not <%COL_TYPE>",
  15 + "IT": "un valore non รจ un <%COL_TYPE>",
  16 + "FR": "une valeur est pas <%COL_TYPE> se trouvant",
  17 + "NL": "een waarde is niet <%COL_TYPE>"
  18 + },
  19 +
  20 + "key_notoftype_plural": {
  21 + "EN": "%COL_ERRORS values are not <%COL_TYPE>",
  22 + "IT": "%COL_ERRORS valori non sono di tipo <%COL_TYPE>",
  23 + "FR": "les valeurs %COL_ERRORS sont du type <%COL_TYPE>",
  24 + "NL": "%COL_ERRORS waarden niet <%COL_TYPE>"
  25 + },
  26 +
  27 + "key_emptyvalue_singolar": {
  28 + "EN": "the column <%COL_NAME> has an empty value",
  29 + "IT": "la colonna <%COL_NAME> ha un valore vuoto",
  30 + "FR": "la colonne <%COL_NAME> a une valeur vide",
  31 + "NL": "de kolom <%COL_NAME> heeft een lege waarde"
  32 + },
  33 +
  34 + "key_emptyvalue_plural": {
  35 + "EN": "the column <%COL_NAME> has <%COL_NULLVALUES> empty values",
  36 + "IT": "la colonna <%COL_NAME> ha <%COL_NULLVALUES> valori vuoti",
  37 + "FR": "la colonne <%COL_NAME> a <%COL_NULLVALUES> valeurs vide",
  38 + "NL": "de kolom <%COL_NAME> heeft <%COL_NULLVALUES> lege waarde"
  39 + },
  40 +
  41 + "key_type": {
  42 + "EN": "type",
  43 + "IT": "tipo",
  44 + "FR": "type",
  45 + "NL": "type"
  46 + },
  47 +
  48 + "key_subtype": {
  49 + "EN": "subtype",
  50 + "IT": "sottotipo",
  51 + "FR": "sous-type",
  52 + "NL": "subtype"
  53 + },
  54 +
  55 + "key_typetext": {
  56 + "EN": "text",
  57 + "IT": "testo",
  58 + "FR": "texte",
  59 + "NL": "tekst"
  60 + },
  61 +
  62 + "key_typenumber": {
  63 + "EN": "number",
  64 + "IT": "numero",
  65 + "FR": "nombre",
  66 + "NL": "aantal"
  67 + },
  68 +
  69 + "key_typeobject": {
  70 + "EN": "object",
  71 + "IT": "oggetto",
  72 + "FR": "objet",
  73 + "NL": "voorwerp"
  74 + },
  75 +
  76 + "key_typedatetime": {
  77 + "EN": "date or time",
  78 + "IT": "data o orario",
  79 + "FR": "date ou l'heure",
  80 + "NL": "datum of tijd"
  81 + },
  82 +
  83 + "key_typeempty": {
  84 + "EN": "empty",
  85 + "IT": "vuoto",
  86 + "FR": "vide",
  87 + "NL": "leeg"
  88 + },
  89 +
  90 + "key_typelatitude": {
  91 + "EN": "latitude",
  92 + "IT": "latitudine",
  93 + "FR": "latitude",
  94 + "NL": "breedtegraad"
  95 + },
  96 +
  97 + "key_typelongitude": {
  98 + "EN": "longitude",
  99 + "IT": "longitudine",
  100 + "FR": "longitude",
  101 + "NL": "lengtegraad"
  102 + }
  103 +
  104 +};
0 105 \ No newline at end of file
... ...
controllets/data-sevc-controllet/data-sevc-controllet.html
... ... @@ -47,7 +47,7 @@
47 47  
48 48 listeners : {
49 49 'page-slider-controllet_selected' : '_updateSlider',
50   - 'dataset-selection-controllet_data-url' : '_allowSecondStep',
  50 + 'select-dataset-controllet_data-url' : '_allowSecondStep',
51 51 'select-fields-controllet_selected-fields' : '_allowThirdStep',
52 52 'filters-controllet_filters': '_allowThirdStep',
53 53 'aggregators-controllet_aggregators': '_allowThirdStep',
... ... @@ -117,7 +117,7 @@
117 117  
118 118 _allowSecondStep : function(e){
119 119 this.$.slider.chevronRight(false);
120   -//
  120 +
121 121 var f = Object.create(providerFactory);
122 122 var provider = f.getProvider(e.detail.url);
123 123 var dataUrl = provider.addLimit(e.detail.url);
... ... @@ -135,6 +135,8 @@
135 135 }
136 136 else
137 137 this.$.select_dataset.$.selected_url.invalid = true;
  138 +
  139 + this.$.select_dataset.showDatasetInfo();
138 140 },
139 141  
140 142 _allowThirdStep : function(){
... ...
controllets/data-sevc-controllet/demo/index.html
... ... @@ -18,8 +18,10 @@
18 18 <data-sevc-controllet deep-url="http://172.16.15.38/DEEalerProvider/DEEP/"
19 19 datalets-list-url="http://172.16.15.38/DEEalerProvider/DEEP/datalets-list"
20 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\":\"\"}"}]}}'
  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='{"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 23 <!--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\":\"\"}"}]}}'-->
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\"}"}]'-->
  24 +
23 25 </data-sevc-controllet>
24 26  
25 27 <!--<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/"-->
... ...
controllets/data-table-controllet/data-table-controllet.html
... ... @@ -40,15 +40,20 @@
40 40 }
41 41  
42 42 paper-icon-button.order {
43   - height: 24px;
44   - width: 24px;
  43 + height: 40px;
  44 + width: 40px;
  45 + padding: 4px;
  46 +
45 47 cursor: pointer;
46 48 }
47 49  
48 50 paper-icon-button.warning {
49   - height: 24px;
50   - width: 24px;
  51 + height: 40px;
  52 + width: 40px;
  53 + padding: 4px;
51 54 color: #FFEB3B;
  55 + --paper-icon-button-ink-color: #FFEB3B;
  56 +
52 57 cursor: help;
53 58 }
54 59  
... ... @@ -77,18 +82,22 @@
77 82  
78 83 #data_table_container #header {
79 84 background: #B6B6B6;
80   - height: 24px;
81   - padding: 12px;
  85 + height: 40px;
  86 + padding: 4px;
82 87 text-align: center;
83 88 font-weight: 700;
84 89 cursor: help;
85 90 }
86 91  
  92 + #data_table_container #header * {
  93 + line-height: 40px !important;
  94 + }
  95 +
87 96 #data_table_container table {
88 97 height: calc(100% - 96px);
89 98 width: 100%;
90 99  
91   - border-spacing: 0px;
  100 + border-spacing: 0;
92 101 }
93 102  
94 103 #data_table_container tbody {
... ... @@ -103,22 +112,35 @@
103 112  
104 113 #data_table_container th,
105 114 #data_table_container td{
106   - height: 24px;
107   - padding: 12px;
  115 + height: 32px;
  116 + /*padding: 12px;*/
108 117 text-align: center;
109   - max-width: 256px;
110   - min-width: 156px;
  118 + /*max-width: 256px;*/
  119 + /*min-width: 156px;*/
111 120 overflow: hidden;
112 121 white-space: nowrap;
113 122 text-overflow: ellipsis;
114 123 width: 1%;
115 124 }
116 125  
  126 + #data_table_container td {
  127 + font-size: 14px;
  128 + padding: 4px 12px;
  129 + max-width: calc(360px - 24px);
  130 + }
  131 +
117 132 #data_table_container th {
118 133 background: #2196F3;
119 134 color: #FFFFFF;
120 135 font-weight: 700;
121 136 cursor: help;
  137 + border-right: 2px solid #FFFFFF;
  138 + height: 40px;
  139 + padding: 4px 12px;
  140 + }
  141 +
  142 + #data_table_container tr :nth-last-child(2) {
  143 + border-right: 0;
122 144 }
123 145  
124 146 #data_table_container th,
... ... @@ -128,17 +150,13 @@
128 150  
129 151 #data_table_container th .th_label {
130 152 display: inline-block;
131   - max-width: calc(100% - 48px - 8px);
  153 + /*max-width: calc(100% - 48px - 8px);*/
132 154 vertical-align: middle;
133 155 overflow: hidden;
134 156 white-space: nowrap;
135 157 text-overflow: ellipsis;
136 158 line-height: 24px;/**/
137   - }
138   -
139   - #data_table_container td {
140   - font-size: 14px;
141   - padding: 4px;
  159 + max-width: calc(360px - 114px);
142 160 }
143 161  
144 162 #data_table_container #footer {
... ... @@ -202,10 +220,10 @@
202 220 <paper-material id="data_table_container" elevation="5">
203 221  
204 222 <div id="header">
205   - <span id="selected_data"></span>
206 223 <template is="dom-if" if={{hasWarnings}}>
207 224 <paper-icon-button class="warning" icon="warning"></paper-icon-button>
208 225 </template>
  226 + <span id="selected_data"></span>
209 227 </div>
210 228  
211 229 <paper-tooltip id="tooltip_wornings" for="header" offset="56">
... ... @@ -223,10 +241,11 @@
223 241 <tr>
224 242 <template is="dom-repeat" items="{{fields}}">
225 243 <th id="id_{{index}}">
226   - <div class="th_label">{{item.name}}</div>
  244 +
227 245 <template is="dom-if" if={{item.errorsDescription.length}}>
228 246 <paper-icon-button class="warning" icon="warning"></paper-icon-button>
229 247 </template>
  248 + <div class="th_label">{{item.name}}</div>
230 249 <paper-icon-button id="{{index}}" class="order" on-click="_order" icon="unfold-more"></paper-icon-button>
231 250 </th>
232 251 </template>
... ... @@ -340,7 +359,7 @@
340 359  
341 360 setData : function(data) {
342 361 var converter = new DataTypeConverter();
343   - var result = converter.inferJsonDataType(data, ["*"]);
  362 + var result = converter.inferJsonDataType(data, ["*"], { language: ln["localization"] } );
344 363 result = converter.cast(result);
345 364 this.fields = ArrayUtils.toFieldsArray(result.types);
346 365 this.data = result.dataset;
... ...
controllets/dataset-table-controllet/dataset-table-controllet.html
... ... @@ -434,7 +434,10 @@
434 434  
435 435 //2nd loop will extract each column and convert it in string comma-seprated
436 436 for (var index in arrData[i]) {
437   - row += arrData[i][index] + ',';
  437 + if(typeof arrData[i][index] == 'string')
  438 + row += '"' + arrData[i][index].replace('"', '""') + '",';
  439 + else
  440 + row += arrData[i][index] + ',';
438 441 }
439 442  
440 443 row.slice(0, row.length - 1);
... ...
controllets/datasets-list-controllet/datasets-list-controllet.html 0 โ†’ 100644
  1 +<link rel="import" href="../../bower_components/polymer/polymer.html">
  2 +
  3 +<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
  4 +<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
  5 +<link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
  6 +<link rel="import" href="../../bower_components/paper-item/paper-item.html">
  7 +<link rel="import" href="../../bower_components/paper-spinner/paper-spinner.html">
  8 +
  9 +<dom-module id="datasets-list-controllet">
  10 + <template>
  11 + <style>
  12 +
  13 + #datasets_list_container {
  14 + height: 100%;
  15 + width: 100%;
  16 + }
  17 +
  18 + #datasets_list_container * {
  19 + font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  20 + font-size: 16px;
  21 + line-height: 24px;
  22 + }
  23 +
  24 + #datasets_list_container #list_info {
  25 + display: flex;
  26 + height: calc(100% - 48px);
  27 + width: 100%;
  28 +
  29 + background: #E0E0E0;
  30 + }
  31 +
  32 + #datasets_list_container #menu {
  33 + background: #E0E0E0;
  34 + }
  35 +
  36 + #datasets_list_container #list_container {
  37 + position: relative;
  38 + height: calc(100% - 28px);
  39 + width: calc(50% - 24px);
  40 + margin-top: 12px;
  41 + padding: 0 12px;
  42 + overflow: hidden;
  43 + background: #E0E0E0;
  44 + }
  45 +
  46 + #datasets_list_container #info_container {
  47 + position: relative;
  48 + height: calc(100% - 32px);
  49 + width: calc(50% - 32px);
  50 + padding: 16px;
  51 + background: #E0E0E0;
  52 + }
  53 +
  54 + #datasets_list_container #info {
  55 + position: relative;
  56 + height: calc(100% - 2px);
  57 + width: calc(100% - 2px);
  58 + border: 1px solid #B6B6B6;
  59 + border-radius: 2px;
  60 + background: #FFFFFF;
  61 + }
  62 +
  63 + #datasets_list_container #footer {
  64 + width: 100%;
  65 + height: 48px;
  66 + background: #B6B6B6;
  67 + display: flex;
  68 + flex-direction: row;
  69 + }
  70 +
  71 + #datasets_list_container .footer_block {
  72 + height: 24px;
  73 + padding: 12px 8px;
  74 + text-align: right;
  75 + }
  76 +
  77 + #datasets_list_container .footer_block:nth-child(1) {
  78 + width: 30%;
  79 + overflow: hidden;
  80 + white-space: nowrap;
  81 + text-overflow: ellipsis;
  82 + }
  83 +
  84 + #datasets_list_container .footer_block:nth-child(2) {
  85 + width: 40%;
  86 + height: 48px;
  87 + padding: 0 8px;
  88 + text-align: center;
  89 + }
  90 +
  91 + #datasets_list_container .footer_block:nth-child(3) {
  92 + width: 30%;
  93 + height: 40px;
  94 + padding: 4px 8px;
  95 + text-align: left;
  96 + }
  97 +
  98 + #datasets_list_container #info_header {
  99 + height: 24px;
  100 + padding: 12px;
  101 + text-align: center;
  102 + font-weight: 700;
  103 + color: #FFFFFF;
  104 + background: #2196F3;
  105 +
  106 + overflow: hidden;
  107 + white-space: nowrap;
  108 + text-overflow: ellipsis;
  109 +
  110 + border-bottom: 1px solid #B6B6B6;
  111 + }
  112 +
  113 + #datasets_list_container #info_body {
  114 + padding: 12px;
  115 + }
  116 +
  117 + #datasets_list_container br {
  118 + display: block;
  119 + margin-top: 8px;
  120 + content: " ";
  121 + }
  122 +
  123 + paper-input {
  124 + max-width: 288px;
  125 + --paper-input-container-focus-color: #2196F3;
  126 + }
  127 +
  128 + paper-menu {
  129 + padding: 0;
  130 + }
  131 +
  132 + paper-item {
  133 + cursor: pointer;
  134 + color: #000000;
  135 + margin: 4px;
  136 + padding: 0 12px;
  137 + border-radius: 2px;
  138 + border: 1px solid #B6B6B6;
  139 +
  140 + background: #FFFFFF;
  141 + }
  142 +
  143 + paper-item span {
  144 + width: 100%;
  145 + overflow: hidden;
  146 + white-space: nowrap;
  147 + text-overflow: ellipsis;
  148 + }
  149 +
  150 + paper-item.iron-selected {
  151 + background: #2196F3 !important;;
  152 + color: #FFFFFF;
  153 + /*font-weight: 700;*/
  154 + }
  155 +
  156 + paper-item:focus:before {
  157 + opacity: 0 !important;
  158 + background: white;
  159 + }
  160 +
  161 + paper-item:focus:after {
  162 + opacity: 0 !important;
  163 + background: white;
  164 + }
  165 +
  166 + paper-item:hover:not(.iron-selected) {
  167 + background: #BBDEFB !important;
  168 + }
  169 +
  170 + paper-icon-button{
  171 + height: 48px;
  172 + width: 48px;
  173 + padding: 0;
  174 + --paper-icon-button-ink-color: #FFFFFF;
  175 + }
  176 +
  177 + paper-icon-button:hover{
  178 + color: #2196F3;
  179 + }
  180 +
  181 + paper-icon-button.clear {
  182 + width: 24px;
  183 + height: 24px;
  184 + padding: 0 4px;
  185 + color: #F44336;
  186 + --paper-icon-button-ink-color: #FFFFFF;
  187 + }
  188 +
  189 + #datasets_list_container #spinner_container {
  190 + height: calc(100% - 49px);
  191 + width: 100%;
  192 + text-align: center;
  193 + display: none;
  194 + }
  195 +
  196 + paper-spinner {
  197 + top: calc(50% - 32px);
  198 + height: 64px;
  199 + width: 64px;
  200 +
  201 + --paper-spinner-stroke-width: 8px;
  202 +
  203 + --paper-spinner-layer-1-color: #2196F3;
  204 + --paper-spinner-layer-2-color: #F44336;;
  205 + --paper-spinner-layer-3-color: #FFEB3B;;
  206 + --paper-spinner-layer-4-color: #4CAF50;;
  207 + }
  208 +
  209 + </style>
  210 +
  211 + <div id="datasets_list_container">
  212 + <div id="list_info">
  213 + <div id="list_container">
  214 + <div id="menu_container">
  215 + <paper-menu id="menu">
  216 + <template is="dom-repeat" items="{{shownDatasets}}">
  217 + <paper-item id={{index}} title="{{item.resource_name}}" on-click="_selectDataset" style$="background: {{_getColorForItem(item)}};"><span>{{_getVersionedResourceName(item)}}</span></paper-item>
  218 + </template>
  219 + </paper-menu>
  220 + </div>
  221 + </div>
  222 + <div id="info_container">
  223 + <div id="info">
  224 + <div id="info_header"><span id="datasets_info"></span></div>
  225 + <div id="info_body"></div>
  226 + <div id="spinner_container">
  227 + <paper-spinner id="spinner"></paper-spinner>
  228 + </div>
  229 + </div>
  230 + </div>
  231 + </div>
  232 +
  233 + <div id="footer">
  234 + <div class="footer_block">
  235 + <span id="showing"></span> {{shownPrev}} <span id="to"></span> {{shownNext}} <span id="of"></span> {{length}} <span id="rows"></span>
  236 + </div>
  237 + <div class="footer_block">
  238 + <paper-icon-button id="slider_chevron_left" class="chevron-left" on-click="_onPrevClick" icon="chevron-left"></paper-icon-button>
  239 + <paper-icon-button id="slider_chevron_right" class="chevron-right" on-click="_onNextClick" icon="chevron-right"></paper-icon-button>
  240 + </div>
  241 + <div class="footer_block">
  242 + <paper-input id="filter" value={{filter}} no-label-float>
  243 + <iron-icon class="search" icon="search" prefix></iron-icon>
  244 + <paper-icon-button class="clear" suffix on-click="_clearInput" icon="clear"></paper-icon-button>
  245 + </paper-input>
  246 + </div>
  247 + </div>
  248 + </div>
  249 +
  250 + </template>
  251 +
  252 + <script>
  253 + HTMLImports.whenReady(function() {
  254 + Polymer({
  255 + is: 'datasets-list-controllet',
  256 +
  257 + properties: {
  258 +
  259 + datasets: {
  260 + type: Object,
  261 + value: undefined
  262 + },
  263 +
  264 + providers: {
  265 + type: Object,
  266 + value: undefined
  267 + },
  268 +
  269 + filter : {
  270 + type : String,
  271 + value : "",
  272 + observer : '_filter'
  273 + }
  274 +
  275 + },
  276 +
  277 +// _loadTreeMap : function(){
  278 +// this.async(function () {
  279 +// var h = $("#list_info").height();
  280 +// var w = $("#list_info").width();
  281 +//
  282 +// var data = JSON.stringify({result : {providers: this.providers, datasets: this.datasets}}).replace(/'/g, "");
  283 +//
  284 +// this.$.list_info.innerHTML = "<datasetexplorer-datalet data='"+data+"' width=\""+w+"\" height=\""+h+"\" fields='[\"provider_name\",\"organization_name\",\"package_name\",\"resource_name\",\"url\",\"w\",\"metas\"]'></datasetexplorer-datalet>";
  285 +// }, 100);
  286 +// },
  287 +//
  288 +// setProviders : function(providers) {
  289 +// this.providers = this._copy(providers);
  290 +// },
  291 +
  292 + ready : function() {
  293 + $(this.$.list_container).perfectScrollbar();
  294 + $(this.$.info).perfectScrollbar();
  295 +
  296 + this.step = 20;
  297 + this.version = true;
  298 + this.selectedItemId = -1;
  299 + },
  300 +
  301 + attached: function() {
  302 + this._translate();
  303 + },
  304 +
  305 + setDatasets : function(datasets) {
  306 + this.datasets = this._copy(datasets);
  307 +
  308 + this.prev = 1;
  309 + this.next = this.step;
  310 + this.length = this.datasets.length;
  311 +
  312 + this.shownPrev = Math.min(this.prev, this.length);
  313 + this.shownNext = Math.min(this.next, this.length);
  314 + this.shownDatasets = this.datasets.slice(this.prev-1, this.next);
  315 +
  316 + this._filter();
  317 + },
  318 +
  319 + showDatasetInfo : function() {
  320 + this.$.spinner_container.style.display = "none";
  321 + this.$.info_body.style.display = "block";
  322 + this.$.spinner.active = false;
  323 + },
  324 +
  325 + showVersion : function(flag) {
  326 + this.version = flag;
  327 + },
  328 +
  329 + _loadDatasetInfo : function() {
  330 + $(this.$.info).animate({ scrollTop: 0}, 0);
  331 + this.$.info_body.style.display = "none";
  332 + this.$.spinner_container.style.display = "block";
  333 + this.$.spinner.active = true;
  334 + },
  335 +
  336 + _onPrevClick : function(){
  337 + if(this.prev != 1) {
  338 + this.prev -= this.step;
  339 + this.next -= this.step;
  340 +
  341 + this.shownPrev = Math.min(this.prev, this.length);
  342 + this.shownNext = Math.min(this.next, this.length);
  343 + this.shownDatasets = this.datasets.slice(this.prev - 1, this.next);
  344 + }
  345 + $(this.$.list_container).animate({ scrollTop: 0}, 0);
  346 + this.$.menu.selected = -1;
  347 + },
  348 +
  349 + _onNextClick : function(){
  350 + if(this.next < this.length) {
  351 + this.prev += this.step;
  352 + this.next += this.step;
  353 +
  354 + this.shownPrev = Math.min(this.prev, this.length);
  355 + this.shownNext = Math.min(this.next, this.length);
  356 + this.shownDatasets = this.datasets.slice(this.prev - 1, this.next);
  357 + }
  358 + $(this.$.list_container).animate({ scrollTop: 0}, 0);
  359 + this.$.menu.selected = -1;
  360 + },
  361 +
  362 + _filter : function() {
  363 + this.debounce('_filter', function () {
  364 + if(this.datasets && this.datasets.length) {
  365 + var filter = this.filter.toLowerCase();
  366 +
  367 + if(filter == "")
  368 + this.shownDatasets = this.datasets;
  369 + else
  370 + this.shownDatasets = this.datasets.filter(function (el) {
  371 + return (el.resource_name.toLowerCase().indexOf(filter) > -1);
  372 + });
  373 +
  374 + this.prev = 1;
  375 + this.next = this.step;
  376 + this.length = this.shownDatasets.length;
  377 +
  378 + this.shownPrev = Math.min(this.prev, this.length);
  379 + this.shownNext = Math.min(this.next, this.length);
  380 + this.shownDatasets = this.shownDatasets.slice(this.prev - 1, this.next);
  381 +
  382 + $(this.$.list_container).animate({ scrollTop: 0}, 0);
  383 + this.$.menu.selected = -1;
  384 + }
  385 + }, 0);
  386 + },
  387 +
  388 + _clearInput : function() {
  389 + this.$.filter.value = "";
  390 + },
  391 +
  392 + _translate : function(){
  393 + this.$.datasets_info.innerHTML = ln["datasetsInfo_" + ln["localization"]];
  394 +
  395 + this.$.showing.innerHTML = ln["showing_" + ln["localization"]];
  396 + this.$.to.innerHTML = ln["to_" + ln["localization"]];
  397 + this.$.of.innerHTML = ln["of_" + ln["localization"]];
  398 +
  399 + this.$.filter.setAttribute("label", ln["search_" + ln["localization"]]);
  400 + },
  401 +
  402 + _selectDataset : function(){
  403 + var id = this.$.menu.selectedItem.id;
  404 + if(id == this.selectedItemId)
  405 + return;
  406 +
  407 + this.selectedItemId = id;
  408 +
  409 + this._loadDatasetInfo();
  410 +
  411 + var dataset = this.shownDatasets[id];
  412 +
  413 + var html = '';
  414 +
  415 + var users = dataset.users;
  416 + var metas = JSON.parse(dataset.metas);
  417 +
  418 + if(users) {
  419 + html += '<b>users:</b><div class="user_icons" style="display: flex; flex-direction: row;">';
  420 + for(var j in users) {
  421 + html += '<a href="' + users[j].href + '">';
  422 + html += '<div class="user_icon" style="background-image: url(' + users[j].src + '); background-size: 40px 40px; height:40px; width:40px; border-radius: 50%; cursor: pointer; margin-right: 12px;" title="' + users[j].user + '"></div>';
  423 + html += '</a>';
  424 +
  425 + }
  426 + html += '</div>';
  427 + html += '<b> version:</b> ' + dataset.version + '<br>';
  428 + }
  429 +
  430 + for(var i in metas)
  431 + html += '<b>' + i + ':</b> ' + metas[i] + '<br>';
  432 +
  433 +// this.$.info_header.innerHTML = this._getVersionedResourceName(dataset);
  434 + this.$.info_header.innerHTML = dataset.resource_name;
  435 + this.$.info_body.innerHTML = html;
  436 +
  437 + this.fire("datasets-list-controllet_dataset", { dataset: dataset });
  438 + },
  439 +
  440 + _getVersionedResourceName : function(dataset){
  441 + if(this.version && dataset.version)
  442 +// return dataset.resource_name + ' [' + ln["Version_" + ln["localization"]] + ' ' + dataset.version + ']';
  443 + return dataset.resource_name + ' [VER ' + dataset.version + ']';
  444 + return dataset.resource_name;
  445 + },
  446 +
  447 + _getColorForItem : function(item) {
  448 + if(!item.provider_name)
  449 + return "#FFEB3B";
  450 + },
  451 +
  452 + _copy : function(o) {
  453 + var out, v, key;
  454 + out = Array.isArray(o) ? new Array(o.length) : {};
  455 + for (key in o) {
  456 + v = o[key];
  457 + out[key] = (typeof v === "object") ? this._copy(v) : v;
  458 + }
  459 + return out;
  460 + }
  461 +
  462 + });
  463 + });
  464 + </script>
  465 +</dom-module>
0 466 \ No newline at end of file
... ...
controllets/datasets-list-controllet/demo/index.html 0 โ†’ 100644
  1 +<html>
  2 +
  3 +<head>
  4 + <script src="../../shared_js/jquery-1.11.2.min.js"></script>
  5 +
  6 + <script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
  7 +
  8 + <script src="../../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>
  9 + <link rel="stylesheet" href="../../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">
  10 +
  11 + <script src="../../../locales/controllet_ln.js"></script>
  12 + <script>
  13 + ln["localization"] = "en";
  14 + </script>
  15 +
  16 + <link rel="import" href="../datasets-list-controllet.html" />
  17 +</head>
  18 +
  19 +<body>
  20 +
  21 +<style>
  22 +
  23 + .container {
  24 + width: 1200px;
  25 + height: 600px;
  26 + position: relative;
  27 + top: 96px;
  28 + left: calc((100% - 1200px) / 2);
  29 + }
  30 +
  31 +</style>
  32 +
  33 +<div class="container">
  34 + <datasets-list-controllet 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\":\"\"}"}]}}'></datasets-list-controllet>
  35 +
  36 + <!--<select-dataset-controllet id="ds" datasets="we"></select-dataset-controllet>-->
  37 +
  38 + <!--<select-dataset-controllet id="ds" 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\":\"\"}"}]}}'-->
  39 + <!--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\"}"}]'-->
  40 + <!--<select-dataset-controllet id="ds" 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\":\"\"}"}]}}'></select-dataset-controllet>-->
  41 +</div>
  42 +
  43 +<script>
  44 + var description = "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa "+
  45 + " aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa "+
  46 + " aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa "+
  47 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  48 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  49 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  50 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  51 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  52 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  53 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  54 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  55 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  56 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  57 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  58 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  59 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  60 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa";
  61 +
  62 + var dataset1 = {description: description, name: "Data", url: "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=c3b52992-ba61-4a73-a637-0f2e1ca26aab"};
  63 + var dataset2 = {description: "", name: "Klassen", url: "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=dfd27de5-0790-466c-af59-6a82509e7fbb"};
  64 + var dataset3 = {description: "descrizione bellissima purissima levissima sbiricuda antani", name: "Derelict Sites", url: "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=fcbee83e-3d3d-4303-a568-24dd33d02adc"};
  65 + var datasets = [dataset1, dataset2, dataset3];
  66 + var datasets = [dataset1, dataset2, dataset3, dataset1, dataset2, dataset3, dataset1, dataset2, dataset3, dataset1, dataset2, dataset3, dataset1, dataset2, dataset3];
  67 +
  68 + // var ds = document.getElementById('ds');
  69 + // ds.setAttribute("items", JSON.stringify(datasets));
  70 + // ds.setAttribute("items", a);
  71 +
  72 +</script>
  73 +
  74 +</body>
  75 +
  76 +</html>
... ...
controllets/select-dataset-controllet/select-dataset-controllet.html
1 1 <link rel="import" href="../../bower_components/polymer/polymer.html">
2 2  
  3 +<link rel="import" href="../../bower_components/paper-material/paper-material.html" />
3 4 <link rel="import" href="../../bower_components/paper-tabs/paper-tabs.html">
4 5 <link rel="import" href="../../bower_components/paper-tabs/paper-tab.html">
5   -
6   -<link rel="import" href="../../bower_components/neon-animation/neon-animation.html">
7   -<link rel="import" href="../../bower_components/neon-animation/neon-animatable.html">
8   -<link rel="import" href="../../bower_components/neon-animation/neon-animations.html">
9   -
10   -<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">
11   -<!--<link rel="import" href="../../bower_components/app-layout/app-toolbar/app-toolbar.html">-->
12   -<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
13   -<link rel="import" href="../../bower_components/paper-styles/color.html">
14   -<link rel="import" href="../../bower_components/paper-styles/typography.html">
15   -<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
16   -<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
17   -<link rel="import" href="../../bower_components/iron-image/iron-image.html">
18   -<link rel="import" href="../../bower_components/iron-list/iron-list.html">
19   -
20 6 <link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
21 7 <link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
22 8 <link rel="import" href="../../bower_components/paper-item/paper-item.html">
  9 +<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
  10 +<link rel="import" href="../../bower_components/paper-tooltip/paper-tooltip.html">
23 11  
24   -<link rel="import" href="../../bower_components/paper-input/paper-input.html">
25   -
26   -<link rel="import" href="../../bower_components/paper-input/paper-textarea.html">
27   -
28   -<link rel="import" href="../../bower_components/paper-material/paper-material.html" />
29   -
30   -<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
31   -<link rel="import" href="../../bower_components/iron-icons/hardware-icons.html">
32   -<!--<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">-->
33   -
34   -<link rel="import" href="../../bower_components/paper-checkbox/paper-checkbox.html">
35   -
36   -<link rel="import" href="../providers-utility-controllet/providers-utility-controllet.html">
37   -<link rel="import" href="ortelio-controllet.html">
38   -<link rel="import" href="../../datalets/datasetexplorer-datalet/datasetexplorer-datalet.html">
  12 +<link rel="import" href="../datasets-list-controllet/datasets-list-controllet.html">
39 13  
40 14 <dom-module id="select-dataset-controllet">
41 15 <template>
42 16 <style>
43   - :host {
44   - --paper-dropdown-menu-icon: {
45   - color: #000000;
46   - };
47   - --paper-dropdown-menu-ripple: {
48   - color: #FFFFFF;
49   - };
50   - /*--paper-tab-ink: {*/
51   - /*color: #FFFFFF;*/
52   - /*};*/
53   - }
54   -
55   - iron-list {
56   - --iron-list-items-container: {
57   - margin:16px 16px 8px 16px;
58   - };
59   - }
60 17  
61   - paper-textarea {
62   - width: 100%;
63   - --paper-input-container-focus-color: #2196F3;
64   - }
65   -
66   - paper-input {
67   - --paper-input-container-focus-color: #2196F3;
68   - }
69   - paper-dropdown-menu {
70   - width: 100%;
71   - --paper-input-container-focus-color: #2196F3;
  18 + #select_dataset_container {
  19 + margin-top: 8px;
72 20 }
73 21  
74   - paper-item.iron-selected {
75   - background-color: #2196F3;
76   - color: #FFFFFF;
  22 + #select_dataset_container * {
  23 + font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  24 + font-size: 16px;
  25 + line-height: 24px;
77 26 }
78 27  
79   - paper-checkbox {
80   - height: 24px;
81   - /*margin-top: 8px*/
82   - --paper-checkbox-checked-color: #2196F3;
83   - --paper-checkbox-checked-ink-color: #FFFFFF;
84   - --paper-checkbox-unchecked-color: #000000;
85   - --paper-checkbox-unchecked-ink-color: #FFFFFF;
86   - --paper-checkbox-label-color: #000000;
87   - }
  28 + #select_dataset_container #options {
  29 + display: flex;
  30 + flex-direction: row;
88 31  
89   - paper-icon-button{
90 32 height: 48px;
91   - width: 48px;
92   - padding: 0px;
93   - --paper-icon-button-ink-color: #FFFFFF;
94   - }
95   -
96   - paper-icon-button:hover{
97   - color: #2196F3;
98   - }
99   -
100   - paper-icon-button[disabled]{
101   - color: #B6B6B6;
102   - }
  33 + padding: 0;
  34 + font-weight: 700;
  35 + background: #B6B6B6;
103 36  
104   - paper-icon-button.clear {
105   - width: 24px;
106   - height: 24px;
107   - padding: 0px 4px;
108   - color: #F44336;
109   - --paper-icon-button-ink-color: #FFFFFF;
110   - }
  37 + margin-top: 2px;
111 38  
112   - paper-tabs {
113   - font-weight: bold;
  39 + overflow: hidden;
114 40 }
115 41  
116   - paper-tab {
117   - transition: all 1.0s;
118   - }
119   -
120   - paper-tab.iron-selected {
121   - background-color: #2196F3;
122   - color: #FFFFFF;
123   - }
124   -
125   - paper-tab:not(.iron-selected):hover {
126   - color: #2196F3;
  42 + #select_dataset_container #options_header {
  43 + width: calc(100% - 96px);
  44 + text-align: center;
  45 + padding: 12px 0 12px 48px;
127 46 }
128 47  
129   - .item {
130   - /*@apply(--layout-horizontal);*/
131   - display: flex;
132   - padding: 11px;
133   - border: 1px solid #B6B6B6;
134   - border-radius: 4px;
135   - cursor: pointer;
136   - margin-bottom: 8px;
137   - background-color: #E0E0E0;
138   - }
  48 + #select_dataset_container .header_block {
  49 + width: calc((100% - 48px) / 2);
  50 + max-width: 400px;
  51 + margin-left: 12px;
139 52  
140   - .item.expanded {
141   - /*border: 2px solid #2196F3;*/
142   - border-color: #2196F3;
143   - }
  53 + line-height: 40px;
144 54  
145   - .pad {
146   - @apply(--layout-flex);
147   - /*@apply(--layout-vertical);*/
  55 + display: none;
148 56 }
149 57  
150   - .primary {
151   - font-weight: bold;
152   - }
  58 + #select_dataset_container #url {
  59 + padding: 0 12px 12px 12px;
  60 + height: 60px;
153 61  
154   - .item.expanded .primary {
155   - color: #2196F3;
  62 + border: 2px solid #B6B6B6;
  63 + border-top: 0;
156 64 }
157 65  
158   - .longText {
159   - display: none;
  66 + #select_dataset_container #datasets_list_container {
  67 + height: calc(100% - 96px - 2px - 74px);
  68 + width: 100%;
160 69 }
161 70  
162   - .item.expanded .longText {
163   - display: block;
  71 + paper-tabs {
  72 + background: #B6B6B6;
164 73 }
165 74  
166   - #select_dataset_container {
167   - margin-top: 8px;
  75 + paper-tab {
  76 + font-weight: 700;
  77 + border-right: 2px solid #FFFFFF;
168 78 }
169 79  
170   - #select_dataset_container * {
171   - font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
172   - font-size: 16px;
173   - line-height: 24px;
  80 + paper-tab:nth-child(2) {
  81 + border-right: 0;
174 82 }
175 83  
176   - #select_dataset_container #neon_container {
177   - height: calc(100% - 172px);
178   - width: calc(100% - 8px);
  84 + paper-tab.iron-selected {
  85 + color: #FFFFFF;
  86 + background: #2196F3;;
179 87 }
180 88  
181   - #select_dataset_container #list_info {
182   - display: flex;
183   - height: calc(100% - 48px);
184   - width: calc(100% + 8px);/*bad*/
  89 + paper-tab:not(.iron-selected):hover {
  90 + color: #2196F3;
185 91 }
186 92  
187   - #select_dataset_container #list_container {
188   - position: relative;
189   - height: 100%;
190   - width: 50%;
191   - border-left: 4px solid #B6B6B6;
  93 + paper-input {
  94 + --paper-input-container-focus-color: #2196F3;
192 95 }
193 96  
194   - #select_dataset_container #info_container {
195   - position: relative;
196   - height: 100%;
197   - width: 50%;
198   - border-right: 4px solid #B6B6B6;
  97 + paper-icon-button {
  98 + height: 48px;
  99 + width: 48px;
  100 + padding: 8px;
199 101 }
200 102  
201   - #select_dataset_container #info {
202   - position: relative;
203   - height: calc(100% - 56px);
204   - width: calc(100% - 56px);
205   - padding: 11px;
206   - border: 1px solid #B6B6B6;
207   - border-radius: 4px;
208   - background-color: #E0E0E0;
209   - margin: 16px;
210   - }
  103 + paper-icon-button[icon="settings"] {
  104 + cursor: pointer;
  105 + color: #00BCD4;
  106 + --paper-icon-button-ink-color: #00BCD4;
211 107  
212   - #select_dataset_container #treemap_container {
213   - /*height: calc(100% - 244px);*/
214   - /*width: calc(100% - 8px);*/
215   - height: calc(100% - 48px);
216   - width: 100%;
217   - border: 4px solid #B6B6B6;
218   - border-top: 0px;
219   - border-bottom: 0px;
220   - position: relative;
  108 + background: #E0E0E0;
  109 + float: right;
  110 + position: absolute;
  111 + right: 0;
221 112 }
222 113  
223   - #select_dataset_container #header {
224   - position: relative;
225   - z-index: 1;
226   - -webkit-box-shadow: 0 30px 24px -12px rgba(0, 0, 0, 0.14), 0 20px 30px -9px rgba(0, 0, 0, 0.12), 0 20px 10px -19px rgba(0, 0, 0, 0.4);
227   - -moz-box-shadow: 0 30px 24px -12px rgba(0, 0, 0, 0.14), 0 20px 30px -9px rgba(0, 0, 0, 0.12), 0 20px 10px -19px rgba(0, 0, 0, 0.4);
228   - box-shadow: 0 30px 24px -12px rgba(0, 0, 0, 0.14), 0 20px 30px -9px rgba(0, 0, 0, 0.12), 0 20px 10px -19px rgba(0, 0, 0, 0.4);
229   -
230   - background-color: #B6B6B6;
231   - display: flex;
232   - padding: 0px 4px;
  114 + paper-icon-button[icon="info-outline"] {
  115 + cursor: help;
233 116 }
234 117  
235   - #select_dataset_container #footer_list {
236   - position: relative;
237   - z-index: 1;
238   - -webkit-box-shadow: 0 -30px 24px -12px rgba(0, 0, 0, 0.14), 0 -20px 30px -9px rgba(0, 0, 0, 0.12), 0 -20px 10px -19px rgba(0, 0, 0, 0.4);
239   - -moz-box-shadow: 0 -30px 24px -12px rgba(0, 0, 0, 0.14), 0 -20px 30px -9px rgba(0, 0, 0, 0.12), 0 -20px 10px -19px rgba(0, 0, 0, 0.4);
240   - box-shadow: 0 -30px 24px -12px rgba(0, 0, 0, 0.14), 0 -20px 30px -9px rgba(0, 0, 0, 0.12), 0 -20px 10px -19px rgba(0, 0, 0, 0.4);
  118 + :host {
  119 + --paper-dropdown-menu-icon: {
  120 + color: #000000;
  121 + };
  122 + --paper-dropdown-menu-ripple: {
  123 + color: #FFFFFF;
  124 + };
241 125 }
242 126  
243   - .noshadow {
244   - -webkit-box-shadow: none !important;
245   - -moz-box-shadow: none !important;
246   - box-shadow: none !important;
  127 + paper-dropdown-menu {
  128 + width: 200px;
  129 + --paper-input-container-focus-color: #2196F3;
247 130 }
248 131  
249   - #select_dataset_container #footer_list,
250   - #select_dataset_container #footer_treemap {
251   - width: 100%;
252   - background-color: #B6B6B6;
253   - display: flex;
254   - padding: 0px 4px;
  132 + paper-item {
  133 + min-width: 128px;
  134 + white-space: nowrap;
255 135 }
256 136  
257   - #select_dataset_container #url {
258   - height: 76px;/*100*/
259   - border: 4px solid #B6B6B6;
260   - border-top: 0px;
261   - padding: 0px 16px;
262   - margin-top: -4px;
  137 + paper-item.iron-selected {
  138 + background-color: #2196F3;
  139 + color: #FFFFFF;
263 140 }
264 141  
265   - #header .header_block {
266   - width: 20%;
267   - height: 40px;
268   - padding: 4px 16px 4px 16px;
  142 + paper-tooltip {
  143 + min-width: 400px;
  144 + --paper-tooltip-background: black;
269 145 }
270 146  
271   - /*.header_block:nth-child(2), .header_block:nth-child(3), .header_block:nth-child(3), .header_block:nth-child(4){*/
272   - /*visibility: hidden;*/
273   - /*}*/
274   -
275   - #header .header_block:nth-child(4) {
276   - text-align: center;
  147 + #select_dataset_container br {
  148 + display: block;
  149 + margin-top: 8px;
  150 + content: " ";
277 151 }
278 152  
279   - .footer_block {
280   - width: calc((100% - 0px) / 3);
281   - height: 24px;
282   - padding: 12px 8px 12px 8px;
283   - text-align: center;
  153 + #select_dataset_container p {
  154 + margin: 0;
  155 + padding: 0;
284 156 }
285 157  
286   - .footer_block:nth-child(2) {
287   - height: 48px;
288   - padding: 0px 8px;
  158 + #select_dataset_container p .option {
  159 + color: #2196F3;;
  160 + font-weight: 700;
289 161 }
290 162  
291   - #suggested_div {
292   - visibility: hidden;
  163 + #select_dataset_container p .description {
293 164 }
294 165  
295   - /*.info_resource_name {*/
296   - /*color: #2196F3;*/
297   - /*font-weight: bold;*/
298   - /*line-height: 48px;*/
299   - /*}*/
300   -
301   - /*#ortelio {*/
302   - /*/!*height: calc(100% - 172px);*!/*/
303   - /*/!*width: calc(100% - 8px);*!/*/
304   - /*height: 100%;*/
305   - /*width: 100%;*/
306   - /*background-color: red;*/
307   - /*}*/
308 166 </style>
309 167  
310 168 <paper-material id="select_dataset_container" elevation="5">
311   -
312   - <paper-tabs selected="{{selected}}" no-bar>
313   - <paper-tab on-tap="_refreshList" noink><span id="listView"></span></paper-tab>
314   - <paper-tab on-tap="_noShadow" noink><span id="treeMapView"></span></paper-tab>
315   - <paper-tab on-tap="_hideSearch" noink><span id="extendedSearch"></span></paper-tab>
  169 + <paper-tabs selected={{tabIndex}} no-bar>
  170 + <paper-tab noink on-tap="_setProvidersDatasets"><span id="providers_datasets"></span></paper-tab>
  171 + <paper-tab noink on-tap="_setLocalDatasets"><span id="spod_users_datasets"></span></paper-tab>
316 172 </paper-tabs>
317 173  
318   - <div id="header">
319   - <div class="header_block">
  174 + <div id="options">
  175 +
  176 + <div id="options_header"></div>
  177 +
  178 + <div id="provider_option" class="header_block">
  179 + {{_getLocalization('provider')}}:&nbsp;
320 180 <paper-dropdown-menu id="ddl_provider" label="" no-label-float>
321   - <paper-menu class="dropdown-content" selected="0">
322   - <paper-item id="0" on-tap="_filter"></paper-item>
323   - <template is="dom-repeat" items={{_toArray(providers)}} as="provider">
324   - <!--<paper-item id={{provider.value.id}} style$="background: {{_getProviderColor(provider.value.id)}};">{{provider.value.title}}</paper-item>-->
325   - <paper-item id={{provider.value.id}} on-tap="_filter">{{provider.value.title}}</paper-item>
  181 + <paper-menu id="menu_provider" class="dropdown-content">
  182 + <paper-item id="0" on-tap="_setProvidersDatasets"><span id="all"></span></paper-item>
  183 + <template is="dom-repeat" items={{_toArray(providers)}}>
  184 + <paper-item id={{item.value.id}} on-tap="_setProvidersDatasets">{{item.value.title}}</paper-item>
326 185 </template>
327 186 </paper-menu>
328 187 </paper-dropdown-menu>
  188 + <paper-icon-button id="info_provider" icon="info-outline" noink></paper-icon-button>
  189 + <paper-tooltip id="tooltip_provider" for="info_provider" offset="8">
  190 + <p>
  191 + <span class="option">{{_getLocalization('all')}}</span><br>
  192 + <span class="description">{{_getLocalization('allDescription')}}</span><br>
  193 + <span class="option">{{_getLocalization('providerName')}}</span><br>
  194 + <span class="description">{{_getLocalization('providerNameDescription')}}</span><br>
  195 + </p>
  196 + </paper-tooltip>
329 197 </div>
330   - <div class="header_block">
331   - </div>
332   - <div class="header_block">
333   - </div>
334   - <div class="header_block">
  198 +
  199 + <!--<div id="view_option" class="header_block">-->
  200 + <!--{{_getLocalization('view')}}:&nbsp;-->
  201 + <!--<paper-dropdown-menu id="ddl_view" label="" no-label-float>-->
  202 + <!--<paper-menu id="menu_view" class="dropdown-content">-->
  203 + <!--<paper-item id="0" on-tap=""><span id="list"></span></paper-item>-->
  204 + <!--<paper-item id="1" on-tap="" disabled><span id="tree"></span></paper-item>-->
  205 + <!--</paper-menu>-->
  206 + <!--</paper-dropdown-menu>-->
  207 + <!--<paper-icon-button id="info_view" icon="info-outline" noink></paper-icon-button>-->
  208 + <!--<paper-tooltip id="tooltip_view" for="info_view" offset="8">-->
  209 + <!--<p>-->
  210 + <!--<span class="option">{{_getLocalization('list')}}</span><br>-->
  211 + <!--<span class="description">{{_getLocalization('listDescription')}}</span><br>-->
  212 + <!--<span class="option">{{_getLocalization('tree')}}</span><br>-->
  213 + <!--<span class="description">{{_getLocalization('treeDescription')}}</span><br>-->
  214 + <!--</p>-->
  215 + <!--</paper-tooltip>-->
  216 + <!--</div>-->
  217 +
  218 + <div id="search_option" class="header_block">
  219 + {{_getLocalization('search')}}:&nbsp;
  220 + <paper-dropdown-menu id="ddl_search" label="" no-label-float>
  221 + <paper-menu id="menu_search" class="dropdown-content">
  222 + <paper-item><span id="standard"></span></paper-item>
  223 + <paper-item disabled><span id="extended"></span></paper-item>
  224 + </paper-menu>
  225 + </paper-dropdown-menu>
  226 + <paper-icon-button id="info_search" icon="info-outline" noink></paper-icon-button>
  227 + <paper-tooltip id="tooltip_search" for="info_search" offset="8">
  228 + <p>
  229 + <span class="option">{{_getLocalization('standard')}}</span><br>
  230 + <span class="description">{{_getLocalization('standardDescription')}}</span><br>
  231 + <span class="option">{{_getLocalization('extended')}}</span><br>
  232 + <span class="description">{{_getLocalization('extendedDescription')}}</span><br>
  233 + </p>
  234 + </paper-tooltip>
335 235 </div>
336   - <div class="header_block">
337   - <paper-input id="datasets_filter" value={{filter}} no-label-float label="">
338   - <iron-icon class="search" icon="search" prefix></iron-icon>
339   - <paper-icon-button class="clear" suffix on-click="_clearInput" icon="clear" tabindex="0"></paper-icon-button>
340   - </paper-input>
  236 +
  237 + <div id="version_option" class="header_block">
  238 + {{_getLocalization('version')}}:&nbsp;
  239 + <paper-dropdown-menu id="ddl_version" label="" no-label-float>
  240 + <paper-menu id="menu_version" class="dropdown-content">
  241 + <paper-item id="0" on-tap="_showLast"><span id="show_last"></span></paper-item>
  242 + <paper-item id="1" on-tap="_showAll"><span id="show_all"></span></paper-item>
  243 + </paper-menu>
  244 + </paper-dropdown-menu>
  245 + <paper-icon-button id="tooltip_version" icon="info-outline" noink></paper-icon-button>
  246 + <paper-tooltip id="tooltip_version" for="tooltip_version" offset="8">
  247 + <p>
  248 + <span class="option">{{_getLocalization('showLast')}}</span><br>
  249 + <span class="description">{{_getLocalization('showLastDescription')}}</span><br>
  250 + <span class="option">{{_getLocalization('showAll')}}</span><br>
  251 + <span class="description">{{_getLocalization('showAllDescription')}}</span><br>
  252 + </p>
  253 + </paper-tooltip>
341 254 </div>
  255 +
  256 + <paper-icon-button icon="settings" on-click="_optionsMenu"></paper-icon-button>
  257 +
342 258 </div>
343 259  
344   - <neon-animated-pages id="neon_container" selected="{{selected}}" entry-animation="fade-in-animation" exit-animation="fade-out-animation">
345   -
346   - <neon-animatable>
347   - <div id="list_info">
348   - <div id="list_container">
349   - <iron-list id="list" items="{{shownDatasets}}" selection-enabled>
350   - <template>
351   - <div>
352   - <div class$="{{getClassForItem(selected)}}" on-tap="_selectDataUrl" style$="background: {{_getColorForItem(item)}};">
353   - <span style="display:none;">{{item.url}}</span>
354   - <div class="pad">
355   - <div class="primary">{{item.resource_name}}</div>
356   - <!--<div class="longText">-->
357   - <!--<template is="dom-repeat" items="{{_stringToArray(item.metas)}}" as="mata">-->
358   - <!--<b>{{mata.name}}:</b>-->
359   - <!--<span inner-h-t-m-l="{{mata.value}}"></span> <br>-->
360   - <!--</template>-->
361   - <!--</div>-->
362   - </div>
363   - <iron-icon icon$="{{_getIconForItem(item)}}" style$="color: {{_getColorForIcon(item)}};"></iron-icon>
364   - </div>
365   - </div>
366   - </template>
367   - </iron-list>
368   - </div>
369   - <div id="info_container">
370   - <div id="info">
371   - </div>
372   - </div>
373   - </div>
374   -
375   - <div id="footer_list">
376   - <div class="footer_block"><span id="showing"></span> {{shownPrev}} <span id="to"></span> {{shownNext}} <span id="of"></span> {{length}} <span id="datasets"></span></div>
377   - <div class="footer_block">
378   - <paper-icon-button id="slider_chevron_left" class="chevron-left" on-click="_onPrevClick" icon="chevron-left"></paper-icon-button>
379   - <paper-icon-button id="slider_chevron_right" class="chevron-right" on-click="_onNextClick" icon="chevron-right"></paper-icon-button>
380   - </div>
381   - <div id="suggested_div" class="footer_block">
382   - <!--<template is="dom-if" if={{suggestedDatasets}}>-->
383   - <paper-checkbox checked on-change="showSuggested"><span id="suggested_datasets"></span></paper-checkbox>
384   - <!--</template>-->
385   - </div>
386   - </div>
387   - </neon-animatable>
388   -
389   - <neon-animatable>
390   - <div id="treemap_container"></div>
391   -
392   - <div id="footer_treemap">
393   - <div class="footer_block"><span id="showing2"></span> {{tLength}} <span id="datasets2"></span></div>
394   - <div class="footer_block"></div>
395   - <div class="footer_block"></div>
396   - </div>
397   - </neon-animatable>
398   -
399   - <neon-animatable>
400   - <!--<div id="ortelio">-->
401   - <ortelio-controllet datasets={{datasets}}></ortelio-controllet>
402   - <!--</div>-->
403   - </neon-animatable>
404   -
405   - </neon-animated-pages>
406   -
407   - <div id="url">
408   - <paper-textarea id="selected_url" label="" value={{dataUrl}} error-message={{errorMessage}}></paper-textarea>
  260 + <div id="datasets_list_container">
  261 + <datasets-list-controllet id="datasets_list"></datasets-list-controllet>
409 262 </div>
410 263  
  264 + <div id="url"><paper-input id="selected_url" label="" value={{dataUrl}} error-message={{errorMessage}}></paper-input></div>
411 265 </paper-material>
412 266  
413 267 </template>
... ... @@ -416,211 +270,130 @@
416 270 HTMLImports.whenReady(function() {
417 271 Polymer({
418 272 is: 'select-dataset-controllet',
  273 +
419 274 properties: {
  275 +
  276 + tabIndex: {
  277 + type: Number,
  278 + value: 0
  279 + },
  280 +
420 281 datasets: {
421 282 type: Object,
422 283 value: undefined
423 284 },
424   - filteredDatasets : {
425   - type : Array,
426   - value : undefined
427   - },
428   - shownDatasets : {
429   - type : Array,
430   - value : undefined
431   - },
  285 +
432 286 suggestedDatasets : {
433 287 type : Array,
434 288 value : undefined
435 289 },
436 290  
437   - providers : {
438   - type : Array,
439   - value : undefined
440   - },
441 291 dataUrl : {
442 292 type : String,
443 293 value : undefined,
444 294 observer : '_fireDataUrl'
445   - },
446   - filter : {
447   - type : String,
448   - value : "",
449   - observer : '_filter'
450   - },
451   - selected : {
452   - type : Number,
453   - value : 0
454   - },
455   - prev : {type : Number, value : undefined},
456   - next : {type : Number, value : undefined},
457   - shownPrev : {type : Number, value : undefined},
458   - shownNext : {type : Number, value : undefined},
459   - length : {type : Number, value : undefined},
460   - tLength : {type : Number, computed : 'treemapLength(length)'},
461   - step : {type : Number, value : 20},
462   - colors : {
463   - type : Array,
464   - value : ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]
465 295 }
  296 +
466 297 },
467 298  
468 299 listeners: {
469   - 'datasetexplorer-datalet_data-url': '_selectDataUrl_treeMap'
  300 + 'datasets-list-controllet_dataset' : '_selectDataUrl'
470 301 },
471 302  
472 303 ready : function() {
  304 + this._translate();
  305 +
473 306 $(this.$.list_container).perfectScrollbar();
474 307 $(this.$.info).perfectScrollbar();
475 308  
476   -// this.$.selected_url.invalid = true;
  309 + this.options = false;
477 310 },
478 311  
479   - attached: function() {
  312 + attached : function() {
  313 + this._translate();
  314 +
480 315 this._resize();
481 316 var that = this;
482   - window.addEventListener("resize", function() { that._resize(); that._loadTreeMap();});
  317 + window.addEventListener("resize", function() { that._resize() });
483 318  
484   -// this.providers = that.datasets["result"]["providers"];
485   -// this.datasets = that.datasets["result"]["datasets"];
  319 + this.providers = this.datasets["result"]["providers"];
  320 + this.providersDatasets = this.datasets["result"]["datasets"];
  321 +
  322 + if(this.suggestedDatasets)
  323 + this.providersDatasets = this.suggestedDatasets.concat(this.providersDatasets);
486 324  
487 325 $.ajax({
488 326 url: "/cocreation/ajax/get-all-dataset",
489 327 dataType: "json",
490   - success: function(spodDatasets){
491   -
492   - that.providers = $.extend(that.datasets["result"]["providers"], {99: {api_url: "/cocreation/ajax/get-all-dataset", id: "99", image_hash: "SPOD", title: "SPOD"}});
493   - that.datasets = $.merge(spodDatasets, that.datasets["result"]["datasets"]);
494   -
495   - if(that.suggestedDatasets) {
496   - that.tempDatasets = that.datasets;
497   - that.datasets = that.suggestedDatasets.concat(that.datasets);
498   - that.$.suggested_div.style.visibility = "visible";
499   - }
500   -
501   - that.filteredDatasets = that.datasets;
502   -
503   - that.prev = 1;
504   - that.next = that.step;
505   - that.length = that.filteredDatasets.length;
506   -
507   - that.shownPrev = Math.min(that.prev, that.length);
508   - that.shownNext = Math.min(that.next, that.length);
509   - that.shownDatasets = that.filteredDatasets.slice(that.prev-1, that.next);
510   -
511   - that.$.list.scrollTarget = that.ownerDocument.documentElement;
512   -
513   - that._translate();
514   -
515   - that._loadTreeMap();
  328 + success: function(localDatasets){
  329 + that.localDatasets = localDatasets;
  330 + that.lastLocalDatasets = [];
  331 + var resource_name = "";
  332 + for(var i in localDatasets)
  333 + if(localDatasets[i].resource_name != resource_name) {
  334 + that.lastLocalDatasets.push(localDatasets[i]);
  335 + resource_name = localDatasets[i].resource_name;
  336 + }
  337 + },
  338 + error: function(){
  339 + that.localDatasets = [];
  340 + that.lastLocalDatasets = [];
516 341 }
517 342 });
518   - },
519 343  
520   - _translate : function(){
521   - this.$.listView.innerHTML = ln["listView_" + ln["localization"]];
522   - this.$.treeMapView.innerHTML = ln["treeMapView_" + ln["localization"]];
523   - this.$.extendedSearch.innerHTML = ln["extendedSearch_" + ln["localization"]];
524   -
525   - this.$.ddl_provider.setAttribute("label", ln["provider_" + ln["localization"]]);
526   - this.$.datasets_filter.setAttribute("label", ln["search_" + ln["localization"]]);
527   -
528   - this.$.suggested_datasets.innerHTML = ln["suggestedDatasets_" + ln["localization"]];
  344 + this._setProvidersDatasets();
  345 + },
529 346  
530   - this.$.showing.innerHTML = ln["showing_" + ln["localization"]];
531   - this.$.showing2.innerHTML = ln["showing_" + ln["localization"]];
532   - this.$.to.innerHTML = ln["to_" + ln["localization"]];
533   - this.$.of.innerHTML = ln["of_" + ln["localization"]];
534   - this.$.datasets.innerHTML = ln["datasets_" + ln["localization"]];
535   - this.$.datasets2.innerHTML = ln["datasets_" + ln["localization"]];
  347 + showDatasetInfo : function() {
  348 + this.$.datasets_list.showDatasetInfo();
  349 + },
536 350  
  351 + _translate : function(){
537 352 this.$.selected_url.setAttribute("label", ln["selectedUrl_" + ln["localization"]]);
538 353 this.errorMessage = ln["wrongUrl_" + ln["localization"]];
539   - },
540 354  
541   - showSuggested : function(e) {
542   - if(e.target.checked)
543   - this.datasets = this.suggestedDatasets.concat(this.tempDatasets);
544   - else
545   - this.datasets = this.tempDatasets;
546   - this._filter();
  355 + this.$.providers_datasets.innerHTML = ln["providersDatasets_" + ln["localization"]];
  356 + this.$.spod_users_datasets.innerHTML = ln["spodUsersDatasets_" + ln["localization"]];
  357 + this.$.options_header.innerHTML = ln["datasets_" + ln["localization"]];
  358 +
  359 + this.$.all.innerHTML = ln["all_" + ln["localization"]];
  360 +// this.$.list.innerHTML = ln["list_" + ln["localization"]];
  361 +// this.$.tree.innerHTML = ln["tree_" + ln["localization"]];
  362 + this.$.standard.innerHTML = ln["standard_" + ln["localization"]];
  363 + this.$.extended.innerHTML = ln["extended_" + ln["localization"]];
  364 + this.$.show_last.innerHTML = ln["showLast_" + ln["localization"]];
  365 + this.$.show_all.innerHTML = ln["showAll_" + ln["localization"]];
  366 +
  367 + this.$.menu_provider.select(0);
  368 +// this.$.menu_view.select(0);
  369 + this.$.menu_search.select(0);
  370 + this.$.menu_version.select(0);
547 371 },
548 372  
549   - _loadTreeMap : function(){
550   - var h = $("#neon_container").height() - 48;
551   - var w = $("#neon_container").width();
552   -
553   - var data = JSON.stringify({result : {providers: this.providers, datasets: this.filteredDatasets}}).replace(/'/g, "");
554   -
555   - if(this.filteredDatasets.length > 0)
556   - this.$.treemap_container.innerHTML = "<datasetexplorer-datalet data='"+data+"' width=\""+w+"\" height=\""+h+"\" fields='[\"provider_name\",\"organization_name\",\"package_name\",\"resource_name\",\"url\",\"w\",\"metas\"]'></datasetexplorer-datalet>";
  373 + _setLocalDatasets : function() {
  374 + if(this.$.ddl_version.selectedItem.id == 0)
  375 + this._showLast();
557 376 else
558   - this.$.treemap_container.innerHTML = "";
  377 + this._showAll();
  378 + this._showOptions()
559 379 },
560 380  
561   - _filter : function() {
562   - if(this.filteredDatasets) {
563   - this.async(function () {
564   - var ddl_provider = $(this.$.ddl_provider).find("paper-menu")[0].selectedItem;
565   - var name = ddl_provider.innerHTML.trim();
566   - var id = this._getIdByProviderName(name);
567   - this.prev = 1;
568   - this.next = this.step;
569   - if (id) {
570   - //filtered by provider name
571   - this.filteredDatasets = this.datasets.filter(function (el) {
572   - return el.provider_name == "p:" + id;
573   - });
574   - }
575   - else {
576   - this.filteredDatasets = this.datasets;
577   - }
578   -
579   - //filtered by filter
580   - var filter = this.filter;
581   - this.filteredDatasets = this.filteredDatasets.filter(function (el) {
582   - return el.resource_name.toLowerCase().indexOf(filter.toLowerCase()) > -1;
  381 + _setProvidersDatasets : function() {
  382 + this.async(function () {
  383 + var ddl_provider = $(this.$.ddl_provider).find("paper-menu")[0].selectedItem;
  384 + var name = ddl_provider.innerHTML.trim();
  385 + var id = this._getIdByProviderName(name);
  386 + if (id) {
  387 + var providerDatasets = this.providersDatasets.filter(function (el) {
  388 + return el.provider_name == "p:" + id;
583 389 });
  390 + this.$.datasets_list.setDatasets(providerDatasets);
  391 + }
  392 + else
  393 + this.$.datasets_list.setDatasets(this.providersDatasets);
584 394  
585   - this.length = this.filteredDatasets.length;
586   -
587   - this.shownPrev = Math.min(this.prev, this.length);
588   - this.shownNext = Math.min(this.next, this.length);
589   - this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next);
590   -
591   - $("#list_container").animate({scrollTop: 0}, 0);
592   -
593   - this._loadTreeMap();
594   - }, 0);
595   - }
596   - },
597   -
598   - _refreshList : function() {
599   - this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next);
600   -
601   - this.$.header.style.display = "flex";
602   - this.$.header.style.visibility = "visible";
603   -// this.$.url.style.marginTop = "-4px";
604   -
605   - this.$.header.className = this.$.header.className.replace(" noshadow", "");
606   - },
607   -
608   - _noShadow : function() {
609   - this.$.header.style.display = "flex";
610   - this.$.header.style.visibility = "visible";
611   -// this.$.url.style.marginTop = "-4px";
612   -
613   - this.$.header.className += " noshadow";
614   - },
615   -
616   - _hideSearch : function() {
617   -// this.$.header.style.display = "none";
618   - this.$.header.style.visibility = "hidden";
619   -// this.$.url.style.marginTop = "44px";
620   - },
621   -
622   - _clearInput : function() {
623   - this.$.datasets_filter.value = "";
  395 + this._showOptions()
  396 + }, 0);
624 397 },
625 398  
626 399 _getIdByProviderName : function(name) {
... ... @@ -630,104 +403,49 @@
630 403 }
631 404 },
632 405  
633   -// iconForItem: function(item) {
634   -// return item ? (item.integer < 50 ? 'star-border' : 'info-outline') : '';
635   -// },
636   -
637   - treemapLength : function(length) {
638   - var ddl_provider = $(this.$.ddl_provider).find("paper-menu")[0].selectedItem;
639   - var name = ddl_provider.innerHTML.trim();
640   - var id = this._getIdByProviderName(name);
641   -
642   - if(this.suggestedDatasets && !id)
643   - return Math.max(length - this.suggestedDatasets.length, 0);
644   - return length;
645   - },
646   -
647   - _getColorForIcon : function(item) {
648   - var ddl_provider = $(this.$.ddl_provider).find("paper-menu")[0].selectedItem;
649   - var name = ddl_provider.innerHTML.trim();
650   - var id = this._getIdByProviderName(name);
651   - if (id) {
652   - return this.colors[0];
653   - }
654   - if(!item.provider_name) {
655   - return "#00BCD4";
656   - }
657   - var id = item.provider_name.substring(2, item.provider_name.length);
658   - var i = this.getProviderById(id) % this.colors.length;
659   - return this.colors[i];
660   - },
661   -
662   - _getColorForItem : function(item) {
663   -// var ddl_provider = $(this.$.ddl_provider).find("paper-menu")[0].selectedItem;
664   -// var name = ddl_provider.innerHTML.trim();
665   -// var id = this._getIdByProviderName(name);
666   -// if (id) {
667   -// return this.colors[0];
668   -// }
669   - if(!item.provider_name) {
670   - return "#FFEB3B";
671   - }
672   -// var id = item.provider_name.substring(2, item.provider_name.length);
673   -// var i = this.getProviderById(id) % this.colors.length;
674   -// return this.colors[i];
675   - },
676   -
677   - _getIconForItem : function(item) {
678   - return item.provider_name ? 'bookmark' : 'star';
679   - },
680   -
681   -// _getProviderColor: function(id) {
682   -// var i = this.getProviderById(id) % this.colors.length;
683   -// return this.colors[i];
684   -// },
685   -
686   - getClassForItem: function(selected) {
687   - return selected ? 'item expanded' : 'item';
  406 + _optionsMenu : function() {
  407 + this.options = !this.options;
  408 + this._showOptions();
688 409 },
689 410  
690   - getProviderById: function(providerId) {
691   - var i = 0;
692   - for(var id in this.providers){
693   - if(this.providers[id].id == providerId)
694   - return i;
695   - i++;
696   - }
  411 + _showOptions : function() {
  412 + this.async(function () {
  413 + if(!this.options) {
  414 + this.$.options_header.style.display = "block";
  415 + this.$.provider_option.style.display = "none";
  416 +// this.$.view_option.style.display = "none";
  417 + this.$.search_option.style.display = "none";
  418 + this.$.version_option.style.display = "none";
  419 + }
  420 + else if(this.tabIndex == 0) {
  421 + this.$.options_header.style.display = "none";
  422 + this.$.provider_option.style.display = "block";
  423 +// this.$.view_option.style.display = "block";
  424 + this.$.search_option.style.display = "block";
  425 + this.$.version_option.style.display = "none";
  426 + }
  427 + else if(this.tabIndex == 1) {
  428 + this.$.options_header.style.display = "none";
  429 + this.$.provider_option.style.display = "none";
  430 +// this.$.view_option.style.display = "none";
  431 + this.$.search_option.style.display = "none";
  432 + this.$.version_option.style.display = "block";
  433 + }
  434 + }, 0);
697 435 },
698 436  
699   - _onPrevClick : function(){
700   - if(this.prev != 1) {
701   - this.prev -= this.step;
702   - this.next -= this.step;
703   -
704   - this.shownPrev = Math.min(this.prev, this.length);
705   - this.shownNext = Math.min(this.next, this.length);
706   - this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next);
707   - }
708   - $("#list_container").animate({ scrollTop: 0}, 0);
  437 + _showAll : function() {
  438 + this.$.datasets_list.showVersion(true);
  439 + this.$.datasets_list.setDatasets(this.localDatasets);
709 440 },
710 441  
711   - _onNextClick : function(){
712   - if(this.next < this.length) {
713   - this.prev += this.step;
714   - this.next += this.step;
715   -
716   - this.shownPrev = Math.min(this.prev, this.length);
717   - this.shownNext = Math.min(this.next, this.length);
718   - this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next);
719   - }
720   - $("#list_container").animate({ scrollTop: 0}, 0);
  442 + _showLast : function() {
  443 + this.$.datasets_list.showVersion(false);
  444 + this.$.datasets_list.setDatasets(this.lastLocalDatasets);
721 445 },
722 446  
723   - _stringToArray: function(obj) {
724   - obj = JSON.parse(obj);
725   - return Object.keys(obj).map(function(key) {
726   - return {
727   - name: key,
728   - value: obj[key]
729   - };
730   - });
  447 + _getLocalization : function(text){
  448 + return ln[text + "_" + ln["localization"]];
731 449 },
732 450  
733 451 _toArray: function(obj) {
... ... @@ -739,74 +457,16 @@
739 457 });
740 458 },
741 459  
742   - _selectDataUrl : function(){
  460 + _selectDataUrl : function(e){
743 461 this.async(function () {
744   - if(this.$.list.selectedItem) {
745   -
746   - var metas = JSON.parse(this.$.list.selectedItem.metas);
747   - var html = "<span style=\"color: #2196F3; font-weight: bold;\">" + this.$.list.selectedItem.resource_name + "</span><br><br>";
748   - /*font-weight: bold;*/
749   - /*line-height: 48px;*/
750   - for(var i in metas)
751   - html += "<b>" + i + ":</b> " + metas[i] + "<br>";
752   - this.$.info.innerHTML = html;
753   -
754   - this.dataUrl = this.$.list.selectedItem.url;
755   -// var url = this.$.list.selectedItem.url;
756   -
757   -// url = utility_getResourceUrl(url);
758   -
759   -// // Check if CKAN
760   -// var strDatasetPos = url.indexOf('/dataset/');
761   -// var strResourcePos = (strDatasetPos >= 0) ? url.indexOf('/resource/') : -1;
762   -// if (strDatasetPos >= 0 && strResourcePos > strDatasetPos) {
763   -// var urlSegment1 = url.substring(0, strDatasetPos);
764   -// var urlResourceEnd = url.indexOf('/', strResourcePos + 10);
765   -// var resourceId = url.substring(strResourcePos + 10, urlResourceEnd);
766   -// url = urlSegment1 + "/api/action/datastore_search?resource_id=" + resourceId;
767   -// }
768   -//
769   -// // Check if OPENDATASOFT
770   -// var strExploreDatasetPos = url.indexOf('/explore/dataset/');
771   -// if (strExploreDatasetPos >= 0) {
772   -// var urlSegment1 = url.substring(0, strExploreDatasetPos);
773   -// var datasetEnd = url.indexOf(strExploreDatasetPos + 17, '/');
774   -// var datasetId = url.substring(strExploreDatasetPos + 17, datasetEnd >= 0 ? datasetEnd : url.length);
775   -// url = urlSegment1 + '/api/records/1.0/search?dataset=' + datasetId;
776   -// }
777   -
778   -// this.dataUrl = this._addlimitUrl(url);
779   -// this.dataUrl = url;
780   - }
781   - else {
782   - this.dataUrl = "";
783   - this.$.info.innerHTML = "";
784   - }
  462 + this.dataUrl = e.detail.dataset.url;
785 463 }, 0);
786 464 },
787 465  
788   - _selectDataUrl_treeMap : function(e) {
789   -// this.dataUrl = this._addlimitUrl(e.detail.url);
790   - this.dataUrl = e.detail.url;
791   - },
792   -
793 466 _fireDataUrl : function(){
794   - this.fire('dataset-selection-controllet_data-url', {url: this.dataUrl});
  467 + this.fire('select-dataset-controllet_data-url', {url: this.dataUrl});
795 468 },
796 469  
797   -// _addlimitUrl : function(url){
798   -// //CKAN --> action no limit
799   -// if((url.indexOf("api/action") > -1) && !(url.indexOf("limit") > -1))
800   -// {
801   -// url += "&limit=99999";
802   -// }
803   -// //OpenDataSoft --> action no limit
804   -// if((url.indexOf("api/records") > -1) && !(url.indexOf("rows") > -1)){
805   -// url += "&rows=10000";
806   -// }
807   -// return url;
808   -// },
809   -
810 470 _resize : function(){
811 471 var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16;
812 472 h = h - 64 - 8; //height with page scroller
... ...
controllets/select-dataset-controllet/select-dataset-controllet_old.html 0 โ†’ 100755
  1 +<link rel="import" href="../../bower_components/polymer/polymer.html">
  2 +
  3 +<link rel="import" href="../../bower_components/paper-tabs/paper-tabs.html">
  4 +<link rel="import" href="../../bower_components/paper-tabs/paper-tab.html">
  5 +
  6 +<link rel="import" href="../../bower_components/neon-animation/neon-animation.html">
  7 +<link rel="import" href="../../bower_components/neon-animation/neon-animatable.html">
  8 +<link rel="import" href="../../bower_components/neon-animation/neon-animations.html">
  9 +
  10 +<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">
  11 +<!--<link rel="import" href="../../bower_components/app-layout/app-toolbar/app-toolbar.html">-->
  12 +<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
  13 +<link rel="import" href="../../bower_components/paper-styles/color.html">
  14 +<link rel="import" href="../../bower_components/paper-styles/typography.html">
  15 +<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
  16 +<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
  17 +<link rel="import" href="../../bower_components/iron-image/iron-image.html">
  18 +<link rel="import" href="../../bower_components/iron-list/iron-list.html">
  19 +
  20 +<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
  21 +<link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
  22 +<link rel="import" href="../../bower_components/paper-item/paper-item.html">
  23 +
  24 +<link rel="import" href="../../bower_components/paper-input/paper-input.html">
  25 +
  26 +<link rel="import" href="../../bower_components/paper-input/paper-textarea.html">
  27 +
  28 +<link rel="import" href="../../bower_components/paper-material/paper-material.html" />
  29 +
  30 +<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
  31 +<link rel="import" href="../../bower_components/iron-icons/hardware-icons.html">
  32 +<!--<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">-->
  33 +
  34 +<link rel="import" href="../../bower_components/paper-checkbox/paper-checkbox.html">
  35 +
  36 +<link rel="import" href="../providers-utility-controllet/providers-utility-controllet.html">
  37 +<link rel="import" href="ortelio-controllet.html">
  38 +<link rel="import" href="../../datalets/datasetexplorer-datalet/datasetexplorer-datalet.html">
  39 +
  40 +<dom-module id="select-dataset-controllet">
  41 + <template>
  42 + <style>
  43 + :host {
  44 + --paper-dropdown-menu-icon: {
  45 + color: #000000;
  46 + };
  47 + --paper-dropdown-menu-ripple: {
  48 + color: #FFFFFF;
  49 + };
  50 + /*--paper-tab-ink: {*/
  51 + /*color: #FFFFFF;*/
  52 + /*};*/
  53 + }
  54 +
  55 + iron-list {
  56 + --iron-list-items-container: {
  57 + margin:16px 16px 8px 16px;
  58 + };
  59 + }
  60 +
  61 + paper-textarea {
  62 + width: 100%;
  63 + --paper-input-container-focus-color: #2196F3;
  64 + }
  65 +
  66 + paper-input {
  67 + --paper-input-container-focus-color: #2196F3;
  68 + }
  69 + paper-dropdown-menu {
  70 + width: 100%;
  71 + --paper-input-container-focus-color: #2196F3;
  72 + }
  73 +
  74 + paper-item.iron-selected {
  75 + background-color: #2196F3;
  76 + color: #FFFFFF;
  77 + }
  78 +
  79 + paper-checkbox {
  80 + height: 24px;
  81 + /*margin-top: 8px*/
  82 + --paper-checkbox-checked-color: #2196F3;
  83 + --paper-checkbox-checked-ink-color: #FFFFFF;
  84 + --paper-checkbox-unchecked-color: #000000;
  85 + --paper-checkbox-unchecked-ink-color: #FFFFFF;
  86 + --paper-checkbox-label-color: #000000;
  87 + }
  88 +
  89 + paper-icon-button{
  90 + height: 48px;
  91 + width: 48px;
  92 + padding: 0px;
  93 + --paper-icon-button-ink-color: #FFFFFF;
  94 + }
  95 +
  96 + paper-icon-button:hover{
  97 + color: #2196F3;
  98 + }
  99 +
  100 + paper-icon-button[disabled]{
  101 + color: #B6B6B6;
  102 + }
  103 +
  104 + paper-icon-button.clear {
  105 + width: 24px;
  106 + height: 24px;
  107 + padding: 0px 4px;
  108 + color: #F44336;
  109 + --paper-icon-button-ink-color: #FFFFFF;
  110 + }
  111 +
  112 + paper-tabs {
  113 + font-weight: bold;
  114 + }
  115 +
  116 + paper-tab {
  117 + transition: all 1.0s;
  118 + }
  119 +
  120 + paper-tab.iron-selected {
  121 + background-color: #2196F3;
  122 + color: #FFFFFF;
  123 + }
  124 +
  125 + paper-tab:not(.iron-selected):hover {
  126 + color: #2196F3;
  127 + }
  128 +
  129 + .item {
  130 + /*@apply(--layout-horizontal);*/
  131 + display: flex;
  132 + padding: 11px;
  133 + border: 1px solid #B6B6B6;
  134 + border-radius: 4px;
  135 + cursor: pointer;
  136 + margin-bottom: 8px;
  137 + background-color: #E0E0E0;
  138 + }
  139 +
  140 + .item.expanded {
  141 + /*border: 2px solid #2196F3;*/
  142 + border-color: #2196F3;
  143 + }
  144 +
  145 + .pad {
  146 + @apply(--layout-flex);
  147 + /*@apply(--layout-vertical);*/
  148 + }
  149 +
  150 + .primary {
  151 + font-weight: bold;
  152 + }
  153 +
  154 + .item.expanded .primary {
  155 + color: #2196F3;
  156 + }
  157 +
  158 + .longText {
  159 + display: none;
  160 + }
  161 +
  162 + .item.expanded .longText {
  163 + display: block;
  164 + }
  165 +
  166 + #select_dataset_container {
  167 + margin-top: 8px;
  168 + }
  169 +
  170 + #select_dataset_container * {
  171 + font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  172 + font-size: 16px;
  173 + line-height: 24px;
  174 + }
  175 +
  176 + #select_dataset_container #neon_container {
  177 + height: calc(100% - 172px);
  178 + width: calc(100% - 8px);
  179 + }
  180 +
  181 + #select_dataset_container #list_info {
  182 + display: flex;
  183 + height: calc(100% - 48px);
  184 + width: calc(100% + 8px);/*bad*/
  185 + }
  186 +
  187 + #select_dataset_container #list_container {
  188 + position: relative;
  189 + height: 100%;
  190 + width: 50%;
  191 + border-left: 4px solid #B6B6B6;
  192 + }
  193 +
  194 + #select_dataset_container #info_container {
  195 + position: relative;
  196 + height: 100%;
  197 + width: 50%;
  198 + border-right: 4px solid #B6B6B6;
  199 + }
  200 +
  201 + #select_dataset_container #info {
  202 + position: relative;
  203 + height: calc(100% - 56px);
  204 + width: calc(100% - 56px);
  205 + padding: 11px;
  206 + border: 1px solid #B6B6B6;
  207 + border-radius: 4px;
  208 + background-color: #E0E0E0;
  209 + margin: 16px;
  210 + }
  211 +
  212 + #select_dataset_container #treemap_container {
  213 + /*height: calc(100% - 244px);*/
  214 + /*width: calc(100% - 8px);*/
  215 + height: calc(100% - 48px);
  216 + width: 100%;
  217 + border: 4px solid #B6B6B6;
  218 + border-top: 0px;
  219 + border-bottom: 0px;
  220 + position: relative;
  221 + }
  222 +
  223 + #select_dataset_container #header {
  224 + position: relative;
  225 + z-index: 1;
  226 + -webkit-box-shadow: 0 30px 24px -12px rgba(0, 0, 0, 0.14), 0 20px 30px -9px rgba(0, 0, 0, 0.12), 0 20px 10px -19px rgba(0, 0, 0, 0.4);
  227 + -moz-box-shadow: 0 30px 24px -12px rgba(0, 0, 0, 0.14), 0 20px 30px -9px rgba(0, 0, 0, 0.12), 0 20px 10px -19px rgba(0, 0, 0, 0.4);
  228 + box-shadow: 0 30px 24px -12px rgba(0, 0, 0, 0.14), 0 20px 30px -9px rgba(0, 0, 0, 0.12), 0 20px 10px -19px rgba(0, 0, 0, 0.4);
  229 +
  230 + background-color: #B6B6B6;
  231 + display: flex;
  232 + padding: 0px 4px;
  233 + }
  234 +
  235 + #select_dataset_container #footer_list {
  236 + position: relative;
  237 + z-index: 1;
  238 + -webkit-box-shadow: 0 -30px 24px -12px rgba(0, 0, 0, 0.14), 0 -20px 30px -9px rgba(0, 0, 0, 0.12), 0 -20px 10px -19px rgba(0, 0, 0, 0.4);
  239 + -moz-box-shadow: 0 -30px 24px -12px rgba(0, 0, 0, 0.14), 0 -20px 30px -9px rgba(0, 0, 0, 0.12), 0 -20px 10px -19px rgba(0, 0, 0, 0.4);
  240 + box-shadow: 0 -30px 24px -12px rgba(0, 0, 0, 0.14), 0 -20px 30px -9px rgba(0, 0, 0, 0.12), 0 -20px 10px -19px rgba(0, 0, 0, 0.4);
  241 + }
  242 +
  243 + .noshadow {
  244 + -webkit-box-shadow: none !important;
  245 + -moz-box-shadow: none !important;
  246 + box-shadow: none !important;
  247 + }
  248 +
  249 + #select_dataset_container #footer_list,
  250 + #select_dataset_container #footer_treemap {
  251 + width: 100%;
  252 + background-color: #B6B6B6;
  253 + display: flex;
  254 + padding: 0px 4px;
  255 + }
  256 +
  257 + #select_dataset_container #url {
  258 + height: 76px;/*100*/
  259 + border: 4px solid #B6B6B6;
  260 + border-top: 0px;
  261 + padding: 0px 16px;
  262 + margin-top: -4px;
  263 + }
  264 +
  265 + #header .header_block {
  266 + width: 20%;
  267 + height: 40px;
  268 + padding: 4px 16px 4px 16px;
  269 + }
  270 +
  271 + /*.header_block:nth-child(2), .header_block:nth-child(3), .header_block:nth-child(3), .header_block:nth-child(4){*/
  272 + /*visibility: hidden;*/
  273 + /*}*/
  274 +
  275 + #header .header_block:nth-child(4) {
  276 + text-align: center;
  277 + }
  278 +
  279 + .footer_block {
  280 + width: calc((100% - 0px) / 3);
  281 + height: 24px;
  282 + padding: 12px 8px 12px 8px;
  283 + text-align: center;
  284 + }
  285 +
  286 + .footer_block:nth-child(2) {
  287 + height: 48px;
  288 + padding: 0px 8px;
  289 + }
  290 +
  291 + #suggested_div {
  292 + visibility: hidden;
  293 + }
  294 +
  295 + /*.info_resource_name {*/
  296 + /*color: #2196F3;*/
  297 + /*font-weight: bold;*/
  298 + /*line-height: 48px;*/
  299 + /*}*/
  300 +
  301 + /*#ortelio {*/
  302 + /*/!*height: calc(100% - 172px);*!/*/
  303 + /*/!*width: calc(100% - 8px);*!/*/
  304 + /*height: 100%;*/
  305 + /*width: 100%;*/
  306 + /*background-color: red;*/
  307 + /*}*/
  308 + </style>
  309 +
  310 + <paper-material id="select_dataset_container" elevation="5">
  311 +
  312 + <paper-tabs selected="{{selected}}" no-bar>
  313 + <paper-tab on-tap="_refreshList" noink><span id="listView"></span></paper-tab>
  314 + <paper-tab on-tap="_noShadow" noink><span id="treeMapView"></span></paper-tab>
  315 + <paper-tab on-tap="_hideSearch" noink><span id="extendedSearch"></span></paper-tab>
  316 + </paper-tabs>
  317 +
  318 + <div id="header">
  319 + <div class="header_block">
  320 + <paper-dropdown-menu id="ddl_provider" label="" no-label-float>
  321 + <paper-menu class="dropdown-content" selected="0">
  322 + <paper-item id="0" on-tap="_filter"></paper-item>
  323 + <template is="dom-repeat" items={{_toArray(providers)}} as="provider">
  324 + <!--<paper-item id={{provider.value.id}} style$="background: {{_getProviderColor(provider.value.id)}};">{{provider.value.title}}</paper-item>-->
  325 + <paper-item id={{provider.value.id}} on-tap="_filter">{{provider.value.title}}</paper-item>
  326 + </template>
  327 + </paper-menu>
  328 + </paper-dropdown-menu>
  329 + </div>
  330 + <div class="header_block">
  331 + </div>
  332 + <div class="header_block">
  333 + </div>
  334 + <div class="header_block">
  335 + </div>
  336 + <div class="header_block">
  337 + <paper-input id="datasets_filter" value={{filter}} no-label-float label="">
  338 + <iron-icon class="search" icon="search" prefix></iron-icon>
  339 + <paper-icon-button class="clear" suffix on-click="_clearInput" icon="clear" tabindex="0"></paper-icon-button>
  340 + </paper-input>
  341 + </div>
  342 + </div>
  343 +
  344 + <neon-animated-pages id="neon_container" selected="{{selected}}" entry-animation="fade-in-animation" exit-animation="fade-out-animation">
  345 +
  346 + <neon-animatable>
  347 + <div id="list_info">
  348 + <div id="list_container">
  349 + <iron-list id="list" items="{{shownDatasets}}" selection-enabled>
  350 + <template>
  351 + <div>
  352 + <div class$="{{getClassForItem(selected)}}" on-tap="_selectDataUrl" style$="background: {{_getColorForItem(item)}};">
  353 + <span style="display:none;">{{item.url}}</span>
  354 + <div class="pad">
  355 + <div class="primary">{{item.resource_name}}</div>
  356 + <!--<div class="longText">-->
  357 + <!--<template is="dom-repeat" items="{{_stringToArray(item.metas)}}" as="mata">-->
  358 + <!--<b>{{mata.name}}:</b>-->
  359 + <!--<span inner-h-t-m-l="{{mata.value}}"></span> <br>-->
  360 + <!--</template>-->
  361 + <!--</div>-->
  362 + </div>
  363 + <iron-icon icon$="{{_getIconForItem(item)}}" style$="color: {{_getColorForIcon(item)}};"></iron-icon>
  364 + </div>
  365 + </div>
  366 + </template>
  367 + </iron-list>
  368 + </div>
  369 + <div id="info_container">
  370 + <div id="info">
  371 + </div>
  372 + </div>
  373 + </div>
  374 +
  375 + <div id="footer_list">
  376 + <div class="footer_block"><span id="showing"></span> {{shownPrev}} <span id="to"></span> {{shownNext}} <span id="of"></span> {{length}} <span id="datasets"></span></div>
  377 + <div class="footer_block">
  378 + <paper-icon-button id="slider_chevron_left" class="chevron-left" on-click="_onPrevClick" icon="chevron-left"></paper-icon-button>
  379 + <paper-icon-button id="slider_chevron_right" class="chevron-right" on-click="_onNextClick" icon="chevron-right"></paper-icon-button>
  380 + </div>
  381 + <div id="suggested_div" class="footer_block">
  382 + <!--<template is="dom-if" if={{suggestedDatasets}}>-->
  383 + <paper-checkbox checked on-change="showSuggested"><span id="suggested_datasets"></span></paper-checkbox>
  384 + <!--</template>-->
  385 + </div>
  386 + </div>
  387 + </neon-animatable>
  388 +
  389 + <neon-animatable>
  390 + <div id="treemap_container"></div>
  391 +
  392 + <div id="footer_treemap">
  393 + <div class="footer_block"><span id="showing2"></span> {{tLength}} <span id="datasets2"></span></div>
  394 + <div class="footer_block"></div>
  395 + <div class="footer_block"></div>
  396 + </div>
  397 + </neon-animatable>
  398 +
  399 + <neon-animatable>
  400 + <!--<div id="ortelio">-->
  401 + <ortelio-controllet datasets={{datasets}}></ortelio-controllet>
  402 + <!--</div>-->
  403 + </neon-animatable>
  404 +
  405 + </neon-animated-pages>
  406 +
  407 + <div id="url">
  408 + <paper-textarea id="selected_url" label="" value={{dataUrl}} error-message={{errorMessage}}></paper-textarea>
  409 + </div>
  410 +
  411 + </paper-material>
  412 +
  413 + </template>
  414 +
  415 + <script>
  416 + HTMLImports.whenReady(function() {
  417 + Polymer({
  418 + is: 'select-dataset-controllet',
  419 + properties: {
  420 + datasets: {
  421 + type: Object,
  422 + value: undefined
  423 + },
  424 + filteredDatasets : {
  425 + type : Array,
  426 + value : undefined
  427 + },
  428 + shownDatasets : {
  429 + type : Array,
  430 + value : undefined
  431 + },
  432 + suggestedDatasets : {
  433 + type : Array,
  434 + value : undefined
  435 + },
  436 +
  437 + providers : {
  438 + type : Array,
  439 + value : undefined
  440 + },
  441 + dataUrl : {
  442 + type : String,
  443 + value : undefined,
  444 + observer : '_fireDataUrl'
  445 + },
  446 + filter : {
  447 + type : String,
  448 + value : "",
  449 + observer : '_filter'
  450 + },
  451 + selected : {
  452 + type : Number,
  453 + value : 0
  454 + },
  455 + prev : {type : Number, value : undefined},
  456 + next : {type : Number, value : undefined},
  457 + shownPrev : {type : Number, value : undefined},
  458 + shownNext : {type : Number, value : undefined},
  459 + length : {type : Number, value : undefined},
  460 + tLength : {type : Number, computed : 'treemapLength(length)'},
  461 + step : {type : Number, value : 20},
  462 + colors : {
  463 + type : Array,
  464 + value : ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]
  465 + }
  466 + },
  467 +
  468 + listeners: {
  469 + 'datasetexplorer-datalet_data-url': '_selectDataUrl_treeMap'
  470 + },
  471 +
  472 + ready : function() {
  473 + $(this.$.list_container).perfectScrollbar();
  474 + $(this.$.info).perfectScrollbar();
  475 +
  476 +// this.$.selected_url.invalid = true;
  477 + },
  478 +
  479 + attached: function() {
  480 + this._resize();
  481 + var that = this;
  482 + window.addEventListener("resize", function() { that._resize(); that._loadTreeMap();});
  483 +
  484 +// this.providers = that.datasets["result"]["providers"];
  485 +// this.datasets = that.datasets["result"]["datasets"];
  486 +
  487 + $.ajax({
  488 + url: "/cocreation/ajax/get-all-dataset",
  489 + dataType: "json",
  490 + success: function(spodDatasets){
  491 +
  492 + that.providers = $.extend(that.datasets["result"]["providers"], {99: {api_url: "/cocreation/ajax/get-all-dataset", id: "99", image_hash: "SPOD", title: "SPOD"}});
  493 + that.datasets = $.merge(spodDatasets, that.datasets["result"]["datasets"]);
  494 +
  495 + if(that.suggestedDatasets) {
  496 + that.tempDatasets = that.datasets;
  497 + that.datasets = that.suggestedDatasets.concat(that.datasets);
  498 + that.$.suggested_div.style.visibility = "visible";
  499 + }
  500 +
  501 + that.filteredDatasets = that.datasets;
  502 +
  503 + that.prev = 1;
  504 + that.next = that.step;
  505 + that.length = that.filteredDatasets.length;
  506 +
  507 + that.shownPrev = Math.min(that.prev, that.length);
  508 + that.shownNext = Math.min(that.next, that.length);
  509 + that.shownDatasets = that.filteredDatasets.slice(that.prev-1, that.next);
  510 +
  511 + that.$.list.scrollTarget = that.ownerDocument.documentElement;
  512 +
  513 + that._translate();
  514 +
  515 + that._loadTreeMap();
  516 + }
  517 + });
  518 + },
  519 +
  520 + _translate : function(){
  521 + this.$.listView.innerHTML = ln["listView_" + ln["localization"]];
  522 + this.$.treeMapView.innerHTML = ln["treeMapView_" + ln["localization"]];
  523 + this.$.extendedSearch.innerHTML = ln["extendedSearch_" + ln["localization"]];
  524 +
  525 + this.$.ddl_provider.setAttribute("label", ln["provider_" + ln["localization"]]);
  526 + this.$.datasets_filter.setAttribute("label", ln["search_" + ln["localization"]]);
  527 +
  528 + this.$.suggested_datasets.innerHTML = ln["suggestedDatasets_" + ln["localization"]];
  529 +
  530 + this.$.showing.innerHTML = ln["showing_" + ln["localization"]];
  531 + this.$.showing2.innerHTML = ln["showing_" + ln["localization"]];
  532 + this.$.to.innerHTML = ln["to_" + ln["localization"]];
  533 + this.$.of.innerHTML = ln["of_" + ln["localization"]];
  534 + this.$.datasets.innerHTML = ln["datasets_" + ln["localization"]];
  535 + this.$.datasets2.innerHTML = ln["datasets_" + ln["localization"]];
  536 +
  537 + this.$.selected_url.setAttribute("label", ln["selectedUrl_" + ln["localization"]]);
  538 + this.errorMessage = ln["wrongUrl_" + ln["localization"]];
  539 + },
  540 +
  541 + showSuggested : function(e) {
  542 + if(e.target.checked)
  543 + this.datasets = this.suggestedDatasets.concat(this.tempDatasets);
  544 + else
  545 + this.datasets = this.tempDatasets;
  546 + this._filter();
  547 + },
  548 +
  549 + _loadTreeMap : function(){
  550 + var h = $("#neon_container").height() - 48;
  551 + var w = $("#neon_container").width();
  552 +
  553 + var data = JSON.stringify({result : {providers: this.providers, datasets: this.filteredDatasets}}).replace(/'/g, "");
  554 +
  555 + if(this.filteredDatasets.length > 0)
  556 + this.$.treemap_container.innerHTML = "<datasetexplorer-datalet data='"+data+"' width=\""+w+"\" height=\""+h+"\" fields='[\"provider_name\",\"organization_name\",\"package_name\",\"resource_name\",\"url\",\"w\",\"metas\"]'></datasetexplorer-datalet>";
  557 + else
  558 + this.$.treemap_container.innerHTML = "";
  559 + },
  560 +
  561 + _filter : function() {
  562 + if(this.filteredDatasets) {
  563 + this.async(function () {
  564 + var ddl_provider = $(this.$.ddl_provider).find("paper-menu")[0].selectedItem;
  565 + var name = ddl_provider.innerHTML.trim();
  566 + var id = this._getIdByProviderName(name);
  567 + this.prev = 1;
  568 + this.next = this.step;
  569 + if (id) {
  570 + //filtered by provider name
  571 + this.filteredDatasets = this.datasets.filter(function (el) {
  572 + return el.provider_name == "p:" + id;
  573 + });
  574 + }
  575 + else {
  576 + this.filteredDatasets = this.datasets;
  577 + }
  578 +
  579 + //filtered by filter
  580 + var filter = this.filter;
  581 + this.filteredDatasets = this.filteredDatasets.filter(function (el) {
  582 + return el.resource_name.toLowerCase().indexOf(filter.toLowerCase()) > -1;
  583 + });
  584 +
  585 + this.length = this.filteredDatasets.length;
  586 +
  587 + this.shownPrev = Math.min(this.prev, this.length);
  588 + this.shownNext = Math.min(this.next, this.length);
  589 + this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next);
  590 +
  591 + $("#list_container").animate({scrollTop: 0}, 0);
  592 +
  593 + this._loadTreeMap();
  594 + }, 0);
  595 + }
  596 + },
  597 +
  598 + _refreshList : function() {
  599 + this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next);
  600 +
  601 + this.$.header.style.display = "flex";
  602 + this.$.header.style.visibility = "visible";
  603 +// this.$.url.style.marginTop = "-4px";
  604 +
  605 + this.$.header.className = this.$.header.className.replace(" noshadow", "");
  606 + },
  607 +
  608 + _noShadow : function() {
  609 + this.$.header.style.display = "flex";
  610 + this.$.header.style.visibility = "visible";
  611 +// this.$.url.style.marginTop = "-4px";
  612 +
  613 + this.$.header.className += " noshadow";
  614 + },
  615 +
  616 + _hideSearch : function() {
  617 +// this.$.header.style.display = "none";
  618 + this.$.header.style.visibility = "hidden";
  619 +// this.$.url.style.marginTop = "44px";
  620 + },
  621 +
  622 + _clearInput : function() {
  623 + this.$.datasets_filter.value = "";
  624 + },
  625 +
  626 + _getIdByProviderName : function(name) {
  627 + for(var id in this.providers) {
  628 + if (this.providers[id].title == name)
  629 + return this.providers[id].id;
  630 + }
  631 + },
  632 +
  633 +// iconForItem: function(item) {
  634 +// return item ? (item.integer < 50 ? 'star-border' : 'info-outline') : '';
  635 +// },
  636 +
  637 + treemapLength : function(length) {
  638 + var ddl_provider = $(this.$.ddl_provider).find("paper-menu")[0].selectedItem;
  639 + var name = ddl_provider.innerHTML.trim();
  640 + var id = this._getIdByProviderName(name);
  641 +
  642 + if(this.suggestedDatasets && !id)
  643 + return Math.max(length - this.suggestedDatasets.length, 0);
  644 + return length;
  645 + },
  646 +
  647 + _getColorForIcon : function(item) {
  648 + var ddl_provider = $(this.$.ddl_provider).find("paper-menu")[0].selectedItem;
  649 + var name = ddl_provider.innerHTML.trim();
  650 + var id = this._getIdByProviderName(name);
  651 + if (id) {
  652 + return this.colors[0];
  653 + }
  654 + if(!item.provider_name) {
  655 + return "#00BCD4";
  656 + }
  657 + var id = item.provider_name.substring(2, item.provider_name.length);
  658 + var i = this.getProviderById(id) % this.colors.length;
  659 + return this.colors[i];
  660 + },
  661 +
  662 + _getColorForItem : function(item) {
  663 +// var ddl_provider = $(this.$.ddl_provider).find("paper-menu")[0].selectedItem;
  664 +// var name = ddl_provider.innerHTML.trim();
  665 +// var id = this._getIdByProviderName(name);
  666 +// if (id) {
  667 +// return this.colors[0];
  668 +// }
  669 + if(!item.provider_name) {
  670 + return "#FFEB3B";
  671 + }
  672 +// var id = item.provider_name.substring(2, item.provider_name.length);
  673 +// var i = this.getProviderById(id) % this.colors.length;
  674 +// return this.colors[i];
  675 + },
  676 +
  677 + _getIconForItem : function(item) {
  678 + return item.provider_name ? 'bookmark' : 'star';
  679 + },
  680 +
  681 +// _getProviderColor: function(id) {
  682 +// var i = this.getProviderById(id) % this.colors.length;
  683 +// return this.colors[i];
  684 +// },
  685 +
  686 + getClassForItem: function(selected) {
  687 + return selected ? 'item expanded' : 'item';
  688 + },
  689 +
  690 + getProviderById: function(providerId) {
  691 + var i = 0;
  692 + for(var id in this.providers){
  693 + if(this.providers[id].id == providerId)
  694 + return i;
  695 + i++;
  696 + }
  697 + },
  698 +
  699 + _onPrevClick : function(){
  700 + if(this.prev != 1) {
  701 + this.prev -= this.step;
  702 + this.next -= this.step;
  703 +
  704 + this.shownPrev = Math.min(this.prev, this.length);
  705 + this.shownNext = Math.min(this.next, this.length);
  706 + this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next);
  707 + }
  708 + $("#list_container").animate({ scrollTop: 0}, 0);
  709 + },
  710 +
  711 + _onNextClick : function(){
  712 + if(this.next < this.length) {
  713 + this.prev += this.step;
  714 + this.next += this.step;
  715 +
  716 + this.shownPrev = Math.min(this.prev, this.length);
  717 + this.shownNext = Math.min(this.next, this.length);
  718 + this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next);
  719 + }
  720 + $("#list_container").animate({ scrollTop: 0}, 0);
  721 + },
  722 +
  723 + _stringToArray: function(obj) {
  724 + obj = JSON.parse(obj);
  725 + return Object.keys(obj).map(function(key) {
  726 + return {
  727 + name: key,
  728 + value: obj[key]
  729 + };
  730 + });
  731 + },
  732 +
  733 + _toArray: function(obj) {
  734 + return Object.keys(obj).map(function(key) {
  735 + return {
  736 + name: key,
  737 + value: obj[key]
  738 + };
  739 + });
  740 + },
  741 +
  742 + _selectDataUrl : function(){
  743 + this.async(function () {
  744 + if(this.$.list.selectedItem) {
  745 +
  746 + var metas = JSON.parse(this.$.list.selectedItem.metas);
  747 + var html = "<span style=\"color: #2196F3; font-weight: bold;\">" + this.$.list.selectedItem.resource_name + "</span><br><br>";
  748 + /*font-weight: bold;*/
  749 + /*line-height: 48px;*/
  750 + for(var i in metas)
  751 + html += "<b>" + i + ":</b> " + metas[i] + "<br>";
  752 + this.$.info.innerHTML = html;
  753 +
  754 + this.dataUrl = this.$.list.selectedItem.url;
  755 +// var url = this.$.list.selectedItem.url;
  756 +
  757 +// url = utility_getResourceUrl(url);
  758 +
  759 +// // Check if CKAN
  760 +// var strDatasetPos = url.indexOf('/dataset/');
  761 +// var strResourcePos = (strDatasetPos >= 0) ? url.indexOf('/resource/') : -1;
  762 +// if (strDatasetPos >= 0 && strResourcePos > strDatasetPos) {
  763 +// var urlSegment1 = url.substring(0, strDatasetPos);
  764 +// var urlResourceEnd = url.indexOf('/', strResourcePos + 10);
  765 +// var resourceId = url.substring(strResourcePos + 10, urlResourceEnd);
  766 +// url = urlSegment1 + "/api/action/datastore_search?resource_id=" + resourceId;
  767 +// }
  768 +//
  769 +// // Check if OPENDATASOFT
  770 +// var strExploreDatasetPos = url.indexOf('/explore/dataset/');
  771 +// if (strExploreDatasetPos >= 0) {
  772 +// var urlSegment1 = url.substring(0, strExploreDatasetPos);
  773 +// var datasetEnd = url.indexOf(strExploreDatasetPos + 17, '/');
  774 +// var datasetId = url.substring(strExploreDatasetPos + 17, datasetEnd >= 0 ? datasetEnd : url.length);
  775 +// url = urlSegment1 + '/api/records/1.0/search?dataset=' + datasetId;
  776 +// }
  777 +
  778 +// this.dataUrl = this._addlimitUrl(url);
  779 +// this.dataUrl = url;
  780 + }
  781 + else {
  782 + this.dataUrl = "";
  783 + this.$.info.innerHTML = "";
  784 + }
  785 + }, 0);
  786 + },
  787 +
  788 + _selectDataUrl_treeMap : function(e) {
  789 +// this.dataUrl = this._addlimitUrl(e.detail.url);
  790 + this.dataUrl = e.detail.url;
  791 + },
  792 +
  793 + _fireDataUrl : function(){
  794 + this.fire('dataset-selection-controllet_data-url', {url: this.dataUrl});
  795 + },
  796 +
  797 +// _addlimitUrl : function(url){
  798 +// //CKAN --> action no limit
  799 +// if((url.indexOf("api/action") > -1) && !(url.indexOf("limit") > -1))
  800 +// {
  801 +// url += "&limit=99999";
  802 +// }
  803 +// //OpenDataSoft --> action no limit
  804 +// if((url.indexOf("api/records") > -1) && !(url.indexOf("rows") > -1)){
  805 +// url += "&rows=10000";
  806 +// }
  807 +// return url;
  808 +// },
  809 +
  810 + _resize : function(){
  811 + var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16;
  812 + h = h - 64 - 8; //height with page scroller
  813 + $("#select_dataset_container").height(h);
  814 + }
  815 + });
  816 + });
  817 + </script>
  818 +</dom-module>
0 819 \ No newline at end of file
... ...
controllets/select-fields-controllet/select-fields-controllet.html
... ... @@ -45,8 +45,14 @@
45 45 paper-item {
46 46 cursor: pointer;
47 47 color: #000000;
  48 + background: #FFFFFF;
48 49 margin: 4px;
49   - padding: 0px 12px;
  50 + padding: 0 12px;
  51 + /*background: rgba(0, 0, 0, 0.12);*/
  52 + border-radius: 2px;
  53 + border: 1px solid #B6B6B6;
  54 +
  55 + /*background: #E0E0E0;*/
50 56 }
51 57  
52 58 paper-item span {
... ... @@ -72,7 +78,11 @@
72 78 }
73 79  
74 80 paper-item:hover:not(.iron-selected) {
75   - background-color: rgba(0, 0, 0, 0.12);
  81 + background-color: #BBDEFB;
  82 + }
  83 +
  84 + #menu, #menu_container {
  85 + background-color: #E0E0E0;
76 86 }
77 87  
78 88 </style>
... ...
controllets/select-marker-map-controllet/select-marker-map-controllet.html
... ... @@ -147,6 +147,7 @@
147 147 type: Object,
148 148 value: new ol.layer.Tile({
149 149 title: 'Global Imagery',
  150 + visible: false,
150 151 source: new ol.source.BingMaps({
151 152 key : "AiAjdlCagGtE5269Z4YP3e3VtMkzzAKvowq5cQadahNZjVxttUxdDS40u91Uv8qP",
152 153 imagerySet: 'AerialWithLabels'
... ...
controllets/select-visualization-controllet/select-datalet-inputs.html deleted
1   -<link rel="import" href="../../bower_components/polymer/polymer.html" />
2   -
3   -<link rel="import" href="../../bower_components/paper-material/paper-material.html" />
4   -
5   -<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
6   -<link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
7   -<link rel="import" href="../../bower_components/paper-item/paper-item.html">
8   -
9   -<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
10   -<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
11   -<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
12   -
13   -<dom-module id="select-datalet-inputs">
14   -
15   - <template>
16   -
17   - <style is="custom-style">
18   - :host {
19   - --paper-dropdown-menu-icon: {
20   - color: #2196F3;
21   - };
22   - }
23   -
24   - #inputs_container {
25   - font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
26   - font-size: 16px;
27   -
28   - height: 100%;
29   - width: 258px;
30   - }
31   -
32   - .inputs{
33   - position: relative;
34   - }
35   -
36   - .input_header {
37   - height: 32px;
38   - padding-top: 16px;
39   - text-align: center;
40   - font-weight: 700;
41   - background-color: #B6B6B6;
42   - }
43   -
44   - #expert_container {
45   - display: none;
46   - }
47   -
48   - #expert_header {
49   - height: 32px;
50   - padding-top: 16px;
51   - margin-top: 8px;
52   - text-align: center;
53   - font-weight: 700;
54   - color: #00BCD4;
55   - cursor: pointer;
56   -
57   - display: none;
58   - }
59   -
60   - .info_button {
61   - position: absolute;
62   - top: 18px;
63   - right: 0px;
64   - }
65   -
66   - paper-dropdown-menu {
67   - height: 48px;
68   - width: 210px;;
69   - padding-left: 8px;
70   - padding-bottom: 8px;
71   - --paper-input-container-focus-color: #2196F3;
72   - }
73   -
74   - paper-item.iron-selected {
75   - background-color: #2196F3;
76   - color: #FFFFFF;
77   - }
78   -
79   - paper-icon-button {
80   - color: #2196F3;
81   - --paper-icon-button-ink-color: #2196F3;
82   - margin: 0px;
83   - }
84   - </style>
85   -
86   - <paper-material id="inputs_container" elevation="5">
87   -
88   - <div class="input_header"><span id="inputs"></span></div>
89   -
90   - <template is="dom-repeat" items="{{inputs}}" index-as="ddl_index">
91   - <div class="inputs">
92   - <paper-dropdown-menu id={{ddl_index}} label={{_getLabelName(item.name)}}>
93   - <paper-menu class="dropdown-content">
94   - <template is="dom-repeat" items={{fields}}>
95   - <paper-item id={{index}} on-tap="_addInput">{{_fieldName(item)}}</paper-item>
96   - </template>
97   - </paper-menu>
98   - </paper-dropdown-menu>
99   - <div class="info_button">
100   - <paper-icon-button id="{{ddl_index}}" on-click="_setOrders" icon="unfold-more" title=""></paper-icon-button>
101   - </div>
102   - </div>
103   - </template>
104   -
105   - <div id="expert_header" on-click="_showExpertMode"><span id="groupBy"></span></div>
106   -
107   - <div id="expert_container">
108   -
109   - <div class="inputs">
110   - <paper-dropdown-menu id="group_by" disabled>
111   - <paper-menu class="dropdown-content">
112   - <template is="dom-repeat" items={{groupableFields}}>
113   - <paper-item id={{index}} on-tap="_setAggregatorsFields">{{_fieldName(item)}}</paper-item>
114   - </template>
115   - </paper-menu>
116   - </paper-dropdown-menu>
117   - </div>
118   -
119   - <template is="dom-repeat" items="{{aggregateFields}}" as="field">
120   - <div class="inputs">
121   - <paper-dropdown-menu id="calculate_{{index}}" label="{{_calculateLabel()}}">
122   - <paper-menu class="dropdown-content">
123   - <template is="dom-repeat" items="{{functions}}">
124   - <paper-item id={{index}} on-tap="_setAggregators">{{_operationName(index)}} : {{_fieldName(field)}}</paper-item>
125   - </template>
126   - </paper-menu>
127   - </paper-dropdown-menu>
128   - </div>
129   - </template>
130   -
131   - </div>
132   -
133   - </paper-material>
134   -
135   -
136   - </template>
137   -
138   - <script>
139   -
140   - Polymer({
141   -
142   - is : 'select-datalet-inputs',
143   -
144   - properties : {
145   -
146   - //INPUT
147   - fields : {type : Array, value : []},
148   -
149   - //OUTPUT
150   - selectedFields : {type : Array, value : []},
151   - aggregators : {type : Array, value : []},
152   - orders : {type : Array, value : []},
153   -
154   - expert : {
155   - type : Boolean,
156   - value : false
157   - },
158   -
159   - functions : {
160   - type : Array,
161   - value : ["COUNT", "SUM", "MIN", "MAX", "AVG", "FIRST", "LAST"]
162   - },
163   -
164   - inputs : {
165   - type : Array,
166   - value : []
167   - },
168   -
169   - groupableFields : {
170   - type : Array,
171   - value : []
172   - },
173   -
174   - aggregateFields : {
175   - type : Array,
176   - value : []
177   - }
178   -
179   - },
180   -
181   - ready : function() {
182   - $(this.$.inputs_container).perfectScrollbar();
183   - },
184   -
185   - attached : function() {
186   - this._translate();
187   - },
188   -
189   - _preselectInputs : function(fields, aggregators, orders) {
190   - aggregators = JSON.parse(aggregators);
191   - orders = JSON.parse(orders);
192   -
193   - this.selectedFields = this._copy(fields);
194   -
195   - var ddls = this.$.inputs_container.querySelectorAll("paper-dropdown-menu");
196   -
197   - for (var i = 0; i < fields.length; i++)
198   - $(ddls[i]).find("paper-menu")[0].select(i+1);
199   -
200   - if(orders.length > 0) {
201   - this.orders = this._copy(orders);//wrong
202   - }
203   -
204   - if(aggregators.length > 0) {
205   -
206   - this.$.group_by.removeAttribute("disabled");
207   - this._showExpertMode();
208   -
209   - var groupableFields = [];
210   - for (var i = 0; i < this.selectedFields.length; i++) {
211   - if(this.selectedFields[i])
212   - groupableFields.push(this.selectedFields[i]);
213   - }
214   - this.groupableFields = this._copy(groupableFields);
215   - this.aggregateFields = [];
216   -
217   - var index = this.groupableFields.indexOf(aggregators[0].field);
218   -
219   - this.async(function () {
220   - var menu = $(this.$.group_by).find("paper-menu")[0];
221   - menu.select(index);
222   - }, 0);
223   -
224   - var aggregateFields = [];
225   - for (var i = 0; i < this.groupableFields.length; i++) {
226   - if (i != index && this.groupableFields[i])
227   - aggregateFields.push(this.groupableFields[i]);
228   - }
229   - this.aggregateFields = this._copy(aggregateFields);
230   -
231   - this.async(function() {
232   - var ddls = document.getElementsByTagName("paper-dropdown-menu");
233   - var j = 1;
234   - for (var i = 0; i < ddls.length; i++){
235   - var id = ddls[i].id;
236   - if(id.indexOf("calculate") > -1) {
237   - var ii = this.functions.indexOf(aggregators[j].operation);
238   - j++;
239   - $(ddls[i]).find("paper-menu")[0].select(-1);
240   - $(ddls[i]).find("paper-menu")[0].select(ii);
241   - }
242   - }
243   -
244   -// this._setAggregators();
245   - this.aggregators = this._copy(aggregators);
246   -
247   - this.fireReady();
248   - }, 0);
249   - }
250   - else
251   - this.fireReady();
252   - },
253   -
254   - getSelectedFields : function () {
255   - return this.selectedFields.filter(function(field){ return field != "" });
256   - },
257   -
258   - getAggregators : function () {
259   - return this.aggregators;
260   - },
261   -
262   - getOrders : function () {
263   - return this.orders;
264   - },
265   -
266   - setFields : function(fields) {
267   - var temp = this._copy(fields);
268   - temp.unshift("");
269   -
270   - if (JSON.stringify(this.fields) != JSON.stringify(temp)) {
271   - this.fields = this._copy(temp);
272   - this.$.expert_header.style.display = "block";
273   - this._reset();
274   - }
275   - },
276   -
277   - setInputs : function(inputs) {
278   - var temp = this._copy(inputs);
279   - if (inputs.constructor != Array && inputs.name == "GEOJSON") {
280   - temp = [];
281   - temp.push(inputs);
282   - }
283   - else if (inputs.constructor != Array) {//table --> 1 input
284   - var name = inputs.name;
285   - var description = inputs.description;
286   - var selection = inputs.selection;
287   - temp = [];
288   - for (var i = 1; i < this.fields.length; i++)
289   - temp.push({name: name + " " + i, description: description, selection: selection});
290   - }
291   - else if (inputs.length > 2 && inputs[2].selection == "*") {//map --> multiple baloon content
292   - name = inputs[2].name;
293   - description = inputs[2].description;
294   - selection = inputs[2].selection;
295   - temp = [inputs[0], inputs[1]];
296   - temp.push({name: name + " 1", description: description, selection: selection});
297   - for (var i = 4; i < this.fields.length; i++)
298   - temp.push({name: name + " " +(i-2), description: description, selection: selection});
299   - }
300   -// else if (inputs.length > 4 && inputs[4].selection == "+") {//bubble --> multiple bubble content
301   -// name = inputs[4].name;
302   -// description = inputs[4].description;
303   -// selection = inputs[4].selection;
304   -// temp = [inputs[0], inputs[1], inputs[2], inputs[3]];
305   -// temp.push({name: name + " 1", description: description, selection: selection});
306   -// for (var i = 6; i < this.fields.length; i++)
307   -// temp.push({name: name + " " + (i-4), description: description, selection: selection});
308   -// }
309   -
310   - else if (inputs.length == 2 && inputs[1].selection == "*") {//
311   - name = inputs[1].name;
312   - description = inputs[1].description;
313   - selection = inputs[1].selection;
314   - temp = [inputs[0]];
315   - temp.push({name: name + " 1", description: description, selection: selection});
316   - for (var i = 3; i < this.fields.length; i++)
317   - temp.push({name: name + " " +(i-1), description: description, selection: selection});
318   - }
319   -
320   - else if (inputs.length == 3 && inputs[1].selection == "*") {//
321   - name = inputs[1].name;
322   - description = inputs[1].description;
323   - selection = inputs[1].selection;
324   - temp = [inputs[0]];
325   - temp.push({name: name + " 1", description: description, selection: selection});
326   - for (var i = 3; i < this.fields.length; i++)
327   - temp.push({name: name + " " +(i-1), description: description, selection: selection});
328   -
329   - temp.push(inputs[2]);
330   - }
331   -
332   - this.inputs = this._copy(temp);
333   -
334   - this.selectedFields = new Array(temp.length);
335   -
336   - this.selectedFields2 = new Array(temp.length);
337   - },
338   -
339   - fireReady : function() {
340   - if(this._isReady())
341   - this.fire('select_visualization_inputs_ready', {isReady: true});
342   - else
343   - this.fire('select_visualization_inputs_ready', {isReady: false});
344   - },
345   -
346   - _isReady : function() {
347   - var fire = true;
348   - for (var i = 0; i < this.selectedFields.length; i++) {
349   - if (!this.selectedFields[i] && this.inputs[i].selection != "+" && this.inputs[i].selection != "*" && this.inputs[i].selection != "?")
350   - return false;
351   - if(this.inputs[i].selection == "+")
352   - fire = false;
353   - }
354   -
355   - if(!fire) {
356   - for (var i = 0; i < this.selectedFields.length; i++) {
357   - if (this.selectedFields[i] && this.inputs[i].selection == "+") {
358   - fire = true;
359   - break;
360   - }
361   - }
362   - }
363   -
364   - return fire;
365   - },
366   -
367   - _reset : function() {
368   - //this.fields = []; --> setFields
369   - //this.inputs = []; --> setInputs
370   - this.selectedFields = [];
371   - this.aggregators = [];
372   - //this.orders = []; --> _resetOrders
373   - this._resetOrders();
374   - this.expert = true;
375   - this._showExpertMode();//expert --> false
376   - this.groupableFields = [];
377   - this.aggregateFields = [];
378   -
379   - this.async(function () {
380   - //reset ddl
381   - var ddls = this.$.inputs_container.getElementsByTagName("paper-dropdown-menu");
382   - for (var i = 0; i < ddls.length; i++)
383   - $(ddls[i]).find("paper-menu")[0].select(-1);
384   - this.$.group_by.setAttribute("disabled", "");
385   - //reset orders
386   - this._resetOrders();
387   - }, 1);
388   - },
389   -
390   - _translate : function(){
391   - this.$.inputs.innerHTML = ln["inputs_" + ln["localization"]];
392   - this.$.groupBy.innerHTML = ln["expertGroupBy_" + ln["localization"]];
393   -
394   - this.$.group_by.setAttribute("label", ln["groupBy_" + ln["localization"]]);
395   - },
396   -
397   - _showExpertMode : function() {
398   - if(!this.expert) {
399   - this.$.expert_header.style.color = "#000000";
400   - this.$.expert_header.style.background = "#B6B6B6";
401   - this.$.expert_container.style.display = "block";
402   - }
403   - else {
404   - this.$.expert_header.style.color = "#00BCD4";
405   - this.$.expert_header.style.background = "#FFFFFF";
406   - this.$.expert_container.style.display = "none";
407   - }
408   -
409   - this.expert = !this.expert;
410   - },
411   -
412   - getFields : function () {
413   - return this.selectedFields2;
414   - },
415   -
416   - _addInput : function(e){
417   - var selectedFields = this._copy(this.selectedFields);
418   -
419   - var ddl_index = $(e.target).parents("paper-dropdown-menu")[0].id;
420   -
421   - var index = e.target.id;
422   - selectedFields[ddl_index] = this.fields[index];
423   -
424   - this.selectedFields = this._copy(selectedFields);
425   -
426   -// console.log(this.inputs[ddl_index].name);
427   - this.selectedFields2[ddl_index] = {field: this.fields[index], input: this.inputs[ddl_index].name};
428   -
429   - if(!this._isReady()) {
430   - this.$.group_by.setAttribute("disabled", "");
431   -
432   - this.groupableFields = [];
433   - this.aggregateFields = [];
434   - }
435   - else {
436   - this.$.group_by.removeAttribute("disabled");
437   -
438   - var groupableFields = [];
439   - for (var i = 0; i < this.selectedFields.length; i++) {
440   - if(this.selectedFields[i])
441   - groupableFields.push(this.selectedFields[i]);
442   - }
443   - this.groupableFields = this._copy(groupableFields);
444   - this.aggregateFields = [];
445   -
446   - this.async(function () {
447   - var menu = $(this.$.group_by).find("paper-menu")[0];
448   - menu.select(-1);
449   - }, 0);
450   - }
451   - this._setAggregators();
452   - },
453   -
454   - _setAggregatorsFields : function(e){
455   - var index = e.target.id;
456   - var aggregateFields = [];
457   - for (var i = 0; i < this.groupableFields.length; i++) {
458   - if (i != index && this.groupableFields[i])
459   - aggregateFields.push(this.groupableFields[i]);
460   - }
461   - this.aggregateFields = this._copy(aggregateFields);
462   -
463   - this.async(function() {
464   - var ddls = document.getElementsByTagName("paper-dropdown-menu");
465   - for (var i = 0; i < ddls.length; i++){
466   - var id = ddls[i].id;
467   - if(id.indexOf("calculate") > -1) {
468   - $(ddls[i]).find("paper-menu")[0].select(-1);
469   - $(ddls[i]).find("paper-menu")[0].select(0);
470   - }
471   - }
472   -
473   - this._setAggregators();
474   - }, 0);
475   - },
476   -
477   - _setAggregators : function(){
478   - this.async(function() {
479   - this.aggregators = [];
480   -
481   - this._resetOrders();
482   -
483   - var gb_menu = $(this.$.group_by).find("paper-menu")[0];
484   - var groupByField = this.groupableFields[gb_menu.selected];
485   - if(groupByField) {
486   - this.aggregators.push({"field": groupByField, "operation": "GROUP BY"});
487   - for (var i = 0; i < this.aggregateFields.length; i++){
488   - var c_menu = $("#calculate_"+i).find("paper-menu")[0];
489   - var operationIndex = c_menu.selectedItem.id;
490   - this.aggregators.push({"field": this.aggregateFields[i], "operation": this.functions[operationIndex]})
491   - }
492   - }
493   -
494   - this.fireReady();
495   - }, 1);
496   - },
497   -
498   - _setOrders : function(e){
499   - var t = e.target;
500   - if(t.tagName.indexOf("IRON-ICON") > -1)
501   - t = $(e.target).parents("paper-icon-button")[0];
502   -
503   - var icon = t.getAttribute("icon");
504   - var id = t.getAttribute("id");
505   - var field = this.selectedFields[id];
506   -
507   - if(icon.indexOf("unfold-more") > -1){
508   - t.setAttribute("icon", "expand-less");
509   - t.setAttribute("title", ln["sortAscending_" + ln["localization"]]);
510   - var orders = this.orders.filter(function (el) { return el.field !== field; });
511   - orders.unshift({"field": field, "operation": "ASC"});
512   - this.orders = this._copy(orders);
513   - }
514   - else if(icon.indexOf("expand-less") > -1){
515   - t.setAttribute("icon", "expand-more");
516   - t.setAttribute("title", ln["sortDescending_" + ln["localization"]]);
517   - var orders = this.orders.filter(function (el) { return el.field !== field; });
518   - orders.unshift({"field": field, "operation": "DESC"});
519   - this.orders = this._copy(orders);
520   - }
521   - else if(icon.indexOf("expand-more") > -1){
522   - t.setAttribute("icon", "unfold-more");
523   - t.setAttribute("title", ln["unsort_" + ln["localization"]]);
524   - var orders = this.orders.filter(function (el) { return el.field !== field; });
525   - this.orders = this._copy(orders);
526   - }
527   -
528   - this.fireReady();
529   - },
530   -
531   - _resetOrders : function(){
532   - var icons = this.$.inputs_container.querySelectorAll("paper-icon-button");
533   - for (var i = 0; i < icons.length; i++){
534   - icons[i].setAttribute("icon", "unfold-more");
535   - icons[i].setAttribute("title", ln["unsort_" + ln["localization"]]);
536   - }
537   - this.orders = [];
538   - },
539   -
540   - _fieldName : function(field) {
541   - return field.substring(field.lastIndexOf(",")+1, field.length);
542   - },
543   -
544   - _getLabelName: function(key) {
545   - if(key.indexOf("Column") > -1) {
546   - return ln["Column" + "_" +ln["localization"]] + key.slice(-2);
547   - }
548   - if(key.indexOf("Level") > -1) {
549   - return ln["Level" + "_" +ln["localization"]] + key.slice(-2);
550   - }
551   - if(key.indexOf("BalloonContent") > -1) {
552   - return ln["BalloonContent" + "_" +ln["localization"]] + key.slice(-2);
553   - }
554   -// if(key.indexOf("BubbleContent") > -1) {
555   -// return ln["BubbleContent" + "_" +ln["localization"]] + key.slice(-2);
556   -// }
557   - if(key.indexOf("NumericYAxis") > -1) {
558   - return ln["NumericYAxis" + "_" +ln["localization"]] + key.slice(-2);
559   - }
560   -
561   - return ln[key + "_" +ln["localization"]];
562   - },
563   -
564   - _operationName: function(index) {
565   - var key = this.functions[index];
566   - return ln[key + "_" +ln["localization"]];
567   - },
568   -
569   - _calculateLabel: function() {
570   - return ln["calculate" + "_" +ln["localization"]];
571   - },
572   -
573   - _copy : function(o) {
574   - var out, v, key;
575   - out = Array.isArray(o) ? new Array(o.length) : {};
576   - for (key in o) {
577   - v = o[key];
578   - out[key] = (typeof v === "object") ? this._copy(v) : v;
579   - }
580   - return out;
581   - }
582   -
583   - });
584   -
585   - </script>
586   -
587   -</dom-module>
588 0 \ No newline at end of file
controllets/select-visualization-controllet/select-datalet-inputs_series.html deleted
1   -<link rel="import" href="../../bower_components/polymer/polymer.html" />
2   -
3   -<link rel="import" href="../../bower_components/paper-material/paper-material.html" />
4   -
5   -<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
6   -<link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
7   -<link rel="import" href="../../bower_components/paper-item/paper-item.html">
8   -
9   -<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
10   -<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
11   -<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
12   -
13   -<dom-module id="select-datalet-inputs_series">
14   -
15   - <template>
16   -
17   - <style is="custom-style">
18   - :host {
19   - --paper-dropdown-menu-icon: {
20   - color: #2196F3;
21   - };
22   - }
23   -
24   - #inputs_series_container {
25   - font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
26   - font-size: 16px;
27   -
28   - height: 100%;
29   - width: 258px;
30   - }
31   -
32   - .inputs{
33   - position: relative;
34   - }
35   -
36   - .input_header {
37   - height: 32px;
38   - padding-top: 16px;
39   - text-align: center;
40   - font-weight: 700;
41   - background-color: #B6B6B6;
42   - }
43   -
44   - #expert_container {
45   - display: none;
46   - }
47   -
48   - #expert_header {
49   - height: 32px;
50   - padding-top: 16px;
51   - margin-top: 8px;
52   - text-align: center;
53   - font-weight: 700;
54   - color: #00BCD4;
55   - cursor: pointer;
56   - }
57   -
58   - .info_button {
59   - position: absolute;
60   - top: 18px;
61   - right: 0px;
62   - }
63   -
64   - paper-dropdown-menu {
65   - height: 48px;
66   - width: 210px;;
67   - padding-left: 8px;
68   - padding-bottom: 8px;
69   - --paper-input-container-focus-color: #2196F3;
70   - }
71   -
72   - paper-item.iron-selected {
73   - background-color: #2196F3;
74   - color: #FFFFFF;
75   - }
76   -
77   - paper-icon-button {
78   - color: #2196F3;
79   - --paper-icon-button-ink-color: #2196F3;
80   - margin: 0px;
81   - }
82   - </style>
83   -
84   - <paper-material id="inputs_series_container" elevation="5">
85   -
86   - <div class="input_header"><span id="inputs"></span></div>
87   -
88   - <template is="dom-repeat" items="{{inputs}}" index-as="ddl_index">
89   - <div class="inputs">
90   - <paper-dropdown-menu id={{ddl_index}} label={{_getLabelName(item.name)}}>
91   - <paper-menu class="dropdown-content">
92   - <template is="dom-repeat" items={{fields}}>
93   - <paper-item id={{index}} on-tap="_addInput">{{_fieldName(item)}}</paper-item>
94   - </template>
95   - </paper-menu>
96   - </paper-dropdown-menu>
97   - <div class="info_button">
98   - <paper-icon-button id="{{ddl_index}}" on-click="_setOrders" icon="unfold-more" title=""></paper-icon-button>
99   - </div>
100   - </div>
101   - </template>
102   -
103   - <div id="expert_header" on-click="_showExpertMode"><span id="groupBy"></span></div>
104   -
105   - <div id="expert_container">
106   -
107   - <div class="inputs">
108   - <paper-dropdown-menu id="group_by" disabled>
109   - <paper-menu class="dropdown-content">
110   - <template is="dom-repeat" items={{groupableFields}}>
111   - <paper-item id={{index}} on-tap="_setAggregatorsFields">{{_fieldName(item)}}</paper-item>
112   - </template>
113   - </paper-menu>
114   - </paper-dropdown-menu>
115   - <div class="info_button">
116   - <paper-icon-button id="gb" on-click="_setOrders" icon="unfold-more" title="" disabled></paper-icon-button>
117   - </div>
118   - </div>
119   -
120   - <template is="dom-repeat" items="{{aggregateFields}}" as="field">
121   - <div class="inputs">
122   - <paper-dropdown-menu id="calculate_{{index}}" label="{{_calculateLabel()}}" disabled>
123   - <paper-menu class="dropdown-content">
124   - <template is="dom-repeat" items="{{functions}}">
125   - <paper-item id={{index}} on-tap="_setAggregators">{{_operationName(index)}} : {{_fieldName(field)}}</paper-item>
126   - </template>
127   - </paper-menu>
128   - </paper-dropdown-menu>
129   - </div>
130   - </template>
131   -
132   - </div>
133   -
134   - </paper-material>
135   -
136   -
137   - </template>
138   -
139   - <script>
140   -
141   - Polymer({
142   -
143   - is : 'select-datalet-inputs_series',
144   -
145   - properties : {
146   -
147   - //INPUT
148   - fields : {type : Array, value : []},
149   -
150   - //OUTPUT
151   - selectedFields : {type : Array, value : ["", ""]},
152   - aggregators : {type : Array, value : []},
153   - orders : {type : Array, value : []},
154   -
155   - expert : {
156   - type : Boolean,
157   - value : false
158   - },
159   -
160   - functions : {
161   - type : Array,
162   - value : ["COUNT", "SUM", "MIN", "MAX", "AVG", "FIRST", "LAST"]
163   - },
164   -
165   - inputs : {
166   - type : Array,
167   - value : []
168   - },
169   -
170   - groupableFields : {
171   - type : Array,
172   - value : []
173   - },
174   -
175   - aggregateFields : {
176   - type : Array,
177   - value : [""]
178   - }
179   -
180   - },
181   -
182   - ready : function() {
183   - $(this.$.inputs_series_container).perfectScrollbar();
184   - },
185   -
186   - attached : function() {
187   - this._translate();
188   - },
189   -
190   - _preselectInputs : function(fields, aggregators, orders) {
191   - aggregators = JSON.parse(aggregators);
192   - orders = JSON.parse(orders);
193   -
194   - //fields = [f1 gb(opt) f2] --> si puรฒ cambiare in f1 f2 gb ???
195   -
196   - this.selectedFields = this._copy(fields);
197   -
198   - var ddls = this.$.inputs_series_container.querySelectorAll("paper-dropdown-menu");
199   -
200   - $(ddls[0]).find("paper-menu")[0].select(1);
201   - $(ddls[1]).find("paper-menu")[0].select(2);
202   -
203   - if(orders.length > 0) {
204   - this.orders = this._copy(orders);//wrong
205   - }
206   -
207   - if(aggregators.length > 0) {
208   - if(fields.length == 2) {
209   - this.selectedFields = [fields[0], fields[1]];
210   -
211   - this.$.group_by.removeAttribute("disabled");
212   - $("#calculate_0")[0].removeAttribute("disabled");
213   - $("#gb")[0].removeAttribute("disabled");
214   - this._showExpertMode();
215   -
216   - var groupableFields = [];
217   - for (var i = 0; i < this.fields.length; i++) {
218   - if(this.fields[i] != this.selectedFields[1])
219   - groupableFields.push(this.fields[i]);
220   - }
221   - this.groupableFields = this._copy(groupableFields);
222   - this.aggregateFields = [this.selectedFields[1]];
223   -
224   - $(ddls[0]).find("paper-menu")[0].select(1);
225   - $(ddls[1]).find("paper-menu")[0].select(2);
226   -
227   - this.async(function () {
228   - var i = this.functions.indexOf(aggregators[1].operation);
229   -
230   - $(this.$.group_by).find("paper-menu")[0].select(1);
231   - $("#calculate_0").find("paper-menu")[0].select(i);
232   -
233   -// this._setAggregators();//if dont --> $("#gb")[0].removeAttribute("disabled");
234   - this.aggregators = this._copy(aggregators);
235   -
236   - this.fireReady();
237   - }, 0);
238   - }
239   - else/*if(fields.length == 3)*/ {
240   - this.selectedFields = [fields[0], fields[2]];
241   -
242   - this.$.group_by.removeAttribute("disabled");
243   - $("#calculate_0")[0].removeAttribute("disabled");
244   - $("#gb")[0].removeAttribute("disabled");
245   - this._showExpertMode();
246   -
247   - var groupableFields = [];
248   - for (var i = 0; i < this.fields.length; i++) {
249   - if(this.fields[i] != this.selectedFields[1])
250   - groupableFields.push(this.fields[i]);
251   - }
252   - this.groupableFields = this._copy(groupableFields);
253   - this.aggregateFields = [this.selectedFields[1]];
254   -
255   - $(ddls[0]).find("paper-menu")[0].select(1);
256   - $(ddls[1]).find("paper-menu")[0].select(3);
257   -
258   - this.async(function () {
259   - var i = this.functions.indexOf(aggregators[2].operation);
260   -
261   - $(this.$.group_by).find("paper-menu")[0].select(2);
262   - $("#calculate_0").find("paper-menu")[0].select(i);
263   -
264   -// this._setAggregators();//if dont --> $("#gb")[0].removeAttribute("disabled");
265   - this.aggregators = this._copy(aggregators);
266   -
267   - this.fireReady();
268   - }, 0);
269   - }
270   - }
271   - else
272   - this.fireReady();
273   - },
274   -
275   - getSelectedFields : function () {
276   - var gb_menu = $(this.$.group_by).find("paper-menu")[0];
277   - var c_menu = $("#calculate_0").find("paper-menu")[0];
278   -
279   - if(gb_menu.selectedItem && c_menu.selectedItem && gb_menu.selectedItem.id != 0) {
280   - var groupByField = this.groupableFields[gb_menu.selected];
281   - if (groupByField != this.selectedFields[0])
282   - return [this.selectedFields[0], groupByField, this.selectedFields[1]];
283   - }
284   - return this.selectedFields;
285   - },
286   -
287   - getAggregators : function () {
288   - return this.aggregators;
289   - },
290   -
291   - getOrders : function () {
292   - return this.orders;
293   - },
294   -
295   - setFields : function(fields) {
296   - var temp = this._copy(fields);
297   - temp.unshift("");
298   -
299   - if (JSON.stringify(this.fields) != JSON.stringify(temp)) {
300   - this.fields = this._copy(temp);
301   - this._reset();
302   - }
303   - },
304   -
305   - getFields : function () {
306   - return null;
307   - },
308   -
309   - setInputs : function(inputs) {
310   - this.inputs = this._copy(inputs);
311   - },
312   -
313   - fireReady : function() {
314   - if(this.selectedFields[0] != "" && this.selectedFields[1] != "")
315   - this.fire('select_visualization_inputs_ready', {isReady: true});
316   - else
317   - this.fire('select_visualization_inputs_ready', {isReady: false});
318   - },
319   -
320   - _reset : function() {
321   - //this.fields = []; --> setFields
322   - //this.inputs = []; --> setInputs
323   - this.selectedFields = ["", ""];
324   - this.aggregators = [];
325   - //this.orders = []; --> _resetOrders
326   - this.expert = true;
327   - this._showExpertMode();//expert --> false
328   - this.groupableFields = [];
329   - this.aggregateFields = [""];
330   -
331   - this.async(function () {
332   - //reset ddl
333   - var ddls = this.$.inputs_series_container.getElementsByTagName("paper-dropdown-menu");
334   - for (var i = 0; i < ddls.length; i++)
335   - $(ddls[i]).find("paper-menu")[0].select(-1);
336   - this.$.group_by.setAttribute("disabled", "");
337   - $("#calculate_0")[0].setAttribute("disabled", "");
338   - //reset orders
339   - this._resetOrders();
340   - }, 1);
341   - },
342   -
343   - _translate : function(){
344   - this.$.inputs.innerHTML = ln["inputs_" + ln["localization"]];
345   - this.$.groupBy.innerHTML = ln["expertGroupBy_" + ln["localization"]];
346   -
347   - this.$.group_by.setAttribute("label", ln["groupBy_" + ln["localization"]]);
348   - },
349   -
350   - _showExpertMode : function() {
351   - if(!this.expert) {
352   - this.$.expert_header.style.color = "#000000";
353   - this.$.expert_header.style.background = "#B6B6B6";
354   - this.$.expert_container.style.display = "block";
355   - }
356   - else {
357   - this.$.expert_header.style.color = "#00BCD4";
358   - this.$.expert_header.style.background = "#FFFFFF";
359   - this.$.expert_container.style.display = "none";
360   - }
361   -
362   - this.expert = !this.expert;
363   - },
364   -
365   - _addInput : function(e){
366   - var selectedFields = this._copy(this.selectedFields);
367   -
368   - var ddl_index = $(e.target).parents("paper-dropdown-menu")[0].id;
369   - var index = e.target.id;
370   - selectedFields[ddl_index] = this.fields[index];
371   -
372   - this.selectedFields = this._copy(selectedFields);
373   -
374   - if(this.selectedFields[0] == "" || this.selectedFields[1] == "") {
375   - this.$.group_by.setAttribute("disabled", "");
376   - $("#calculate_0")[0].setAttribute("disabled", "");
377   -
378   - this.groupableFields = [];
379   - this.aggregateFields = [""];
380   - var menu = $("#calculate_0").find("paper-menu")[0];
381   - menu.select(-1);
382   - }
383   - else {
384   - this.$.group_by.removeAttribute("disabled");
385   - $("#calculate_0")[0].removeAttribute("disabled");
386   -
387   - var groupableFields = [];
388   - for (var i = 0; i < this.fields.length; i++) {
389   - if(this.fields[i] != this.selectedFields[1])
390   - groupableFields.push(this.fields[i]);
391   - }
392   - this.groupableFields = this._copy(groupableFields);
393   - this.aggregateFields = [this.selectedFields[1]];
394   -
395   - this.async(function () {
396   - var menu = $(this.$.group_by).find("paper-menu")[0];
397   - menu.select(-1);
398   - var menu = $("#calculate_0").find("paper-menu")[0];
399   - //var selected = menu.selected;
400   - menu.select(-1);
401   - //menu.select(selected);
402   - }, 0);
403   - }
404   - this._setAggregators();
405   - },
406   -
407   - _setAggregatorsFields : function(){
408   - this.async(function() {
409   - var c_menu = $("#calculate_0").find("paper-menu")[0];
410   - var selected = c_menu.selected > 0 ? c_menu.selected : 0;
411   - c_menu.select(-1);
412   - c_menu.select(selected);
413   -
414   - this._setAggregators();
415   - }, 0);
416   - },
417   -
418   - _setAggregators : function(){
419   - this.async(function() {
420   - this.aggregators = [];
421   -
422   - this._resetOrders();
423   -
424   - $("#gb")[0].setAttribute("disabled", "");
425   -
426   - var gb_menu = $(this.$.group_by).find("paper-menu")[0];
427   - var c_menu = $("#calculate_0").find("paper-menu")[0];
428   -
429   - if(gb_menu.selectedItem && c_menu.selectedItem && gb_menu.selectedItem.id != 0) {
430   - var groupByField = this.groupableFields[gb_menu.selected];
431   - var operationIndex = c_menu.selectedItem.id;
432   -
433   - if (groupByField == this.selectedFields[0]){// X Axis field
434   - this.aggregators.push({"field": groupByField, "operation": "GROUP BY"});
435   - }
436   - else{
437   - $("#gb")[0].removeAttribute("disabled");
438   - this.aggregators.push({"field": this.selectedFields[0], "operation": "GROUP BY"});
439   - this.aggregators.push({"field": groupByField, "operation": "GROUP BY"});
440   - }
441   -
442   - this.aggregators.push({"field": this.selectedFields[1], "operation": this.functions[operationIndex]});
443   - }
444   -
445   - this.fireReady();
446   - }, 0);
447   - },
448   -
449   - _setOrders : function(e){
450   - var t = e.target;
451   - if(t.tagName.indexOf("IRON-ICON") > -1)
452   - t = $(e.target).parents("paper-icon-button")[0];
453   -
454   - var icon = t.getAttribute("icon");
455   - var id = t.getAttribute("id");
456   - var field;
457   -
458   - if(id == "gb"){
459   - var gb_menu = $(this.$.group_by).find("paper-menu")[0];
460   - field = this.groupableFields[gb_menu.selected];
461   - }
462   - else {
463   - field = this.selectedFields[id];
464   - }
465   -
466   - if(icon.indexOf("unfold-more") > -1){
467   - t.setAttribute("icon", "expand-less");
468   - t.setAttribute("title", ln["sortAscending_" + ln["localization"]]);
469   - var orders = this.orders.filter(function (el) { return el.field !== field; });
470   - orders.unshift({"field": field, "operation": "ASC"});
471   - this.orders = this._copy(orders);
472   - }
473   - else if(icon.indexOf("expand-less") > -1){
474   - t.setAttribute("icon", "expand-more");
475   - t.setAttribute("title", ln["sortDescending_" + ln["localization"]]);
476   - var orders = this.orders.filter(function (el) { return el.field !== field; });
477   - orders.unshift({"field": field, "operation": "DESC"});
478   - this.orders = this._copy(orders);
479   - }
480   - else if(icon.indexOf("expand-more") > -1){
481   - t.setAttribute("icon", "unfold-more");
482   - t.setAttribute("title", ln["unsort_" + ln["localization"]]);
483   - var orders = this.orders.filter(function (el) { return el.field !== field; });
484   - this.orders = this._copy(orders);
485   - }
486   -
487   - this.fireReady();
488   - },
489   -
490   - _resetOrders : function(){
491   - var icons = this.$.inputs_series_container.querySelectorAll("paper-icon-button");
492   - for (var i = 0; i < icons.length; i++){
493   - icons[i].setAttribute("icon", "unfold-more");
494   - icons[i].setAttribute("title", ln["unsort_" + ln["localization"]]);
495   - }
496   - this.orders = [];
497   - },
498   -
499   - _fieldName : function(field) {
500   - return field.substring(field.lastIndexOf(",")+1, field.length);
501   - },
502   -
503   - _getLabelName: function(key) {
504   - return ln[key + "_" +ln["localization"]];
505   - },
506   -
507   - _operationName: function(index) {
508   - var key = this.functions[index];
509   - return ln[key + "_" +ln["localization"]];
510   - },
511   -
512   - _calculateLabel: function() {
513   - return ln["calculate" + "_" +ln["localization"]];
514   - },
515   -
516   - _copy : function(o) {
517   - var out, v, key;
518   - out = Array.isArray(o) ? new Array(o.length) : {};
519   - for (key in o) {
520   - v = o[key];
521   - out[key] = (typeof v === "object") ? this._copy(v) : v;
522   - }
523   - return out;
524   - }
525   -
526   - });
527   -
528   - </script>
529   -
530   -</dom-module>
531 0 \ No newline at end of file
controllets/select-visualization-controllet/select-datalet-options.html deleted
1   -<link rel="import" href="../../bower_components/polymer/polymer.html" />
2   -
3   -<link rel="import" href="../../bower_components/paper-material/paper-material.html" />
4   -
5   -<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
6   -<link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
7   -<link rel="import" href="../../bower_components/paper-item/paper-item.html">
8   -
9   -<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
10   -<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
11   -<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
12   -
13   -<link rel="import" href="../../bower_components/paper-input/paper-textarea.html">
14   -<link rel="import" href="../../bower_components/paper-input/paper-input.html">
15   -
16   -<link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">
17   -
18   -<dom-module id="select-datalet-options">
19   -
20   - <template>
21   -
22   - <style is="custom-style">
23   - :host {
24   - --paper-dropdown-menu-icon: {
25   - color: #2196F3;
26   - };
27   - }
28   -
29   - #select_datalet_options_container {
30   - font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
31   - font-size: 16px;
32   -
33   - /*height: 100vh;*/
34   - height: 100%;
35   - width: 258px;
36   - }
37   -
38   - .inputs{
39   - position: relative;
40   - }
41   -
42   - .input_header {
43   - height: 32px;
44   - padding-top: 16px;
45   - text-align: center;
46   - font-weight: 700;
47   - background-color: #B6B6B6;
48   - }
49   -
50   - .info_button {
51   - position: absolute;
52   - top: 18px;
53   - right: 0px;
54   - }
55   -
56   - #dialog_info_input {
57   - display: flex;
58   - flex-direction: column;
59   - color: #000000;
60   - border: 2px solid #2196F3;
61   - background-color: #E0E0E0;
62   - min-width: 244px;
63   - padding: 8px;
64   - }
65   -
66   - #dialog_name{
67   - font-size: 24px;
68   - line-height: 24px;
69   - font-weight: 700;
70   - padding: 0px;
71   - margin: 0px;
72   - }
73   -
74   - #dialog_description{
75   -
76   - font-size: 16px;
77   - line-height: 16px;
78   - font-weight: normal;
79   - padding: 0px;
80   - margin: 8px 0px 0px 0px;
81   - }
82   -
83   - paper-dropdown-menu {
84   - height: 48px;
85   - width: 210px;;
86   - padding-left: 8px;
87   - padding-bottom: 8px;
88   - --paper-input-container-focus-color: #2196F3;
89   - }
90   -
91   - paper-item.iron-selected {
92   - background-color: #2196F3;
93   - color: #FFFFFF;
94   - }
95   -
96   - paper-icon-button {
97   - color: #2196F3;
98   - --paper-icon-button-ink-color: #2196F3;
99   - margin: 0px;
100   - }
101   -
102   - paper-input {
103   - display: inline-block;
104   - height: 48px;
105   - /*padding: 0px 8px;*/
106   - width: 210px;
107   - padding-left: 8px;
108   - padding-bottom: 8px;
109   - --paper-input-container-focus-color: #2196F3;
110   - }
111   -
112   - paper-input.base_input {
113   - width: 242px;
114   - }
115   -
116   - paper-textarea {
117   - width: 242px;
118   - padding-left: 8px;
119   - padding-bottom: 4px;
120   - --paper-input-container-focus-color: #2196F3;
121   - }
122   - </style>
123   -
124   - <paper-material id="select_datalet_options_container" elevation="5">
125   -
126   - <div class="input_header"><span id="baseInfo"></span></div>
127   -
128   - <div class="inputs">
129   - <paper-input id="base_title" maxlength="32" class="base_input" on-change="_updateParams" value=""></paper-input>
130   - </div>
131   -
132   - <div class="inputs">
133   - <paper-textarea id="base_description" maxlength="100" class="base_input" on-change="_updateParams" value=""></paper-textarea>
134   - </div>
135   -
136   - <div class="input_header"><span id="layouts"></span></div>
137   -
138   - <template is="dom-repeat" items={{options}} index-as="index">
139   - <div class="inputs">
140   - <template is="dom-if" if="{{_checkType(item.type, 'TEXT')}}">
141   - <paper-input label={{_getLabelName(item.name)}} on-change="_updateParams"></paper-input>
142   - </template>
143   -
144   - <template is="dom-if" if="{{_checkType(item.type, 'LIST')}}">
145   - <paper-dropdown-menu label={{_getLabelName(item.name)}}>
146   - <paper-menu class="dropdown-content" selected = 0>
147   - <!--<paper-item on-tap="_updateParams"></paper-item>-->
148   - <template is="dom-repeat" items={{item.list.item}}>
149   - <paper-item id={{index}} on-tap="_updateParams">{{item}}</paper-item>
150   - </template>
151   - </paper-menu>
152   - </paper-dropdown-menu>
153   - </template>
154   -
155   - <div class="info_button">
156   - <paper-icon-button id={{item.name}} on-click="_showInfo" icon="info-outline" title="{{_getLabelName(item.name)}} info"></paper-icon-button>
157   - </div>
158   - </div>
159   - </template>
160   -
161   - </paper-material>
162   -
163   - <paper-dialog id="dialog_info_input">
164   - <span id="dialog_name"></span>
165   - <span id="dialog_description"></span>
166   - </paper-dialog>
167   -
168   - </template>
169   -
170   - <script>
171   -
172   - Polymer({
173   -
174   - is : 'select-datalet-options',
175   -
176   - properties : {
177   -
178   - options : {
179   - type : Array,
180   - value : []
181   - },
182   -
183   - params : {
184   - type : Object,
185   - value : {}
186   - }
187   -
188   - },
189   -
190   - ready : function() {
191   - $(this.$.select_datalet_options_container).perfectScrollbar();
192   - },
193   -
194   - attached : function() {
195   - this._translate();
196   - },
197   -
198   - _preselectOptions : function(params) {
199   - var textarea = this.$.select_datalet_options_container.querySelectorAll("paper-textarea");
200   - textarea[0].value = params["description"];
201   -
202   - var inputs = this.$.select_datalet_options_container.querySelectorAll("paper-input");
203   - inputs[0].value = params["title"];
204   -
205   - for (var i = 1; i < inputs.length; i++)
206   - if(params[this.options[i - 1].name])
207   - inputs[i].value = params[this.options[i - 1].name];
208   -
209   - this._updateParams();
210   -
211   -// var menus = this.$.select_datalet_options_container.querySelectorAll("paper-menu");
212   -// var ddls = this.$.select_datalet_options_container.querySelectorAll("paper-dropdown-menu");
213   -// for (var i = 0; i < ddls.length; i++) {
214   -// var menu = $(ddls[i]).find("paper-menu")[0];
215   -// if(params[ddls[i].label])
216   -// menu.select(1);//select item con nome params[ddls[i].label]
217   -// }
218   - },
219   -
220   - setOptions : function(options) {
221   - this.options = [];
222   - this.params = [];
223   - this.async(function() {
224   - this.options = options;
225   - }, 0);
226   -
227   -// this.params["title"] = "";
228   -// this.params["description"] = "";
229   - },
230   -
231   - checkOptions : function(options) {
232   - if(options.length != this.options.length)
233   - this.setOptions(options);
234   - },
235   -
236   - getParams : function() {
237   - return this.params;
238   - },
239   -
240   - _reset : function() {
241   - this.options = [];
242   - this.params = [];
243   - },
244   -
245   - _updateParams : function() {
246   - this.async(function() {
247   - var textarea = this.$.select_datalet_options_container.querySelectorAll("paper-textarea");
248   - this.params["description"] = textarea[0].value;
249   -
250   - var inputs = this.$.select_datalet_options_container.querySelectorAll("paper-input");
251   - this.params["title"] = inputs[0].value;
252   -
253   - for (var i = 1; i < inputs.length; i++)
254   - this.params[this.options[i-1].name] = inputs[i].value;
255   -
256   - this.fire('select_visualization_options_changed');
257   - }, 0);
258   - },
259   -
260   - _translate : function(){
261   - this.$.baseInfo.innerHTML = ln["baseInfo_" + ln["localization"]];
262   - this.$.layouts.innerHTML = ln["layouts_" + ln["localization"]];
263   -
264   - this.$.base_title.label = ln["title_" + ln["localization"]];
265   - this.$.base_description.label = ln["description_" + ln["localization"]];
266   - },
267   -
268   - _checkType: function(type, check){
269   - return (type == check);
270   - },
271   -
272   - _getLabelName: function(key) {
273   - return ln[key + "_" +ln["localization"]];
274   - },
275   -
276   - _showInfo : function(e){
277   - var t = e.target;
278   - if(t.tagName.indexOf("IRON-ICON") != -1)
279   - t = $(e.target).parents("paper-icon-button")[0];
280   -
281   - var name = t.getAttribute("id");
282   -
283   - this.$.dialog_name.innerHTML = ln[name + "_" + ln["localization"]];
284   - this.$.dialog_description.innerHTML = ln[name + "_description_" + ln["localization"]];
285   - this.$.dialog_info_input.open();
286   -
287   - var pos = t.getBoundingClientRect();
288   - $("#dialog_info_input").css("top", pos.top - 4);
289   - $("#dialog_info_input").css("left", pos.left - 4);
290   - },
291   -
292   - });
293   -
294   - </script>
295   -
296   -</dom-module>
297 0 \ No newline at end of file
controllets/select-visualization-controllet/select-visualization-controllet_old.html deleted
1   -<link rel="import" href="../../bower_components/polymer/polymer.html" />
2   -
3   -<link rel="import" href="../../bower_components/paper-material/paper-material.html" />
4   -
5   -<link rel="import" href="../../bower_components/paper-button/paper-button.html">
6   -
7   -<link rel="import" href="../items-vslider-controllet/items-vslider-controllet.html" />
8   -<link rel="import" href="select-datalet-inputs_series.html" />
9   -<link rel="import" href="select-datalet-inputs.html" />
10   -<link rel="import" href="select-datalet-options.html" />
11   -
12   -<script src="../../../DEEPCLIENT/js/deepClient.js"></script>
13   -
14   -<dom-module id="select-visualization-controllet">
15   -
16   - <template>
17   -
18   - <style is="custom-style">
19   - #select_visualization_container {
20   - display: flex;
21   - font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
22   - font-size: 16px;
23   - margin-top: 8px;
24   - }
25   -
26   - #items_vslider_controllet {
27   - position: relative;
28   - min-width: 172px;
29   - }
30   -
31   - #datalet_selection_inputs {
32   - position: relative;
33   - margin-left: 32px;
34   - min-width: 258px;
35   - }
36   -
37   - #datalet_selection_options {
38   - position: relative;
39   - margin-left: 32px;
40   - min-width: 258px;
41   - }
42   -
43   - #datalet_preview_container {
44   - position: relative;
45   - width: 100%;
46   - margin-left: 32px;
47   - }
48   -
49   - #datalet_selection_datalet {
50   - position: relative;
51   - height: 100vh;
52   - width: 100%;
53   - }
54   -
55   - #datalet_selection_datalet_placeholder {
56   - padding: 16px;
57   - }
58   -
59   - .input_header {
60   - height: 32px;
61   - padding-top: 16px;
62   - text-align: center;
63   - font-weight: 700;
64   - background-color: #B6B6B6;
65   - }
66   -
67   - paper-button {
68   - position: absolute;
69   - bottom: 16px;
70   - right: 11px;
71   -
72   - height: 48px;
73   - width: 172px;
74   - background-color: #00BCD4;
75   - color: white;
76   - font-weight: 700;
77   - padding: 16px;
78   - }
79   -
80   - paper-button:hover {
81   - background-color: #00AABF;
82   -
83   - box-shadow: 0px 8px 12px #888;
84   - -webkit-box-shadow: 0px 8px 12px #888;
85   - -moz-box-shadow: 0px 8px 12px #888;
86   - }
87   -
88   - paper-button[disabled] {
89   - background-color: #B6B6B6;
90   - }
91   - </style>
92   -
93   - <iron-ajax id="selectedDatalet_request" on-response="_handleSelectedDatalet"></iron-ajax>
94   -
95   - <div id="select_visualization_container">
96   -
97   - <div id="items_vslider_controllet">
98   - <items-vslider-controllet id="vslider" datalets-list-url={{dataletsListUrl}} preselected-datalet={{preselectedDatalet}}></items-vslider-controllet>
99   - </div>
100   -
101   - <div id="datalet_selection_inputs">
102   - <template is="dom-if" if="{{_checkType(type, 'multiseries')}}">
103   - <select-datalet-inputs_series id="inputs_series"></select-datalet-inputs_series>
104   - </template>
105   - <template is="dom-if" if="{{_checkType(type, 'default')}}">
106   - <select-datalet-inputs id="inputs"></select-datalet-inputs>
107   - </template>
108   - <template is="dom-if" if="{{_checkType(type, '')}}">
109   - <select-datalet-inputs></select-datalet-inputs>
110   - </template>
111   - </div>
112   -
113   - <div id="datalet_selection_options">
114   - <select-datalet-options id="options"></select-datalet-options>
115   - </div>
116   -
117   - <div id="datalet_preview_container">
118   -
119   - <paper-material id="datalet_selection_datalet" elevation="5">
120   - <div class="input_header"><span id="dataletPreview"></span></div>
121   - <div id="datalet_selection_datalet_placeholder"></div>
122   - </paper-material>
123   -
124   - <paper-button id="add_button" disabled raised on-click="_addDatalet"></paper-button>
125   -
126   - </div>
127   -
128   - </div>
129   -
130   - </template>
131   -
132   - <script>
133   -
134   - Polymer({
135   -
136   - is : 'select-visualization-controllet',
137   -
138   - properties : {
139   -
140   - deepUrl : {
141   - type : String,
142   - value : undefined
143   - },
144   -
145   - dataletsListUrl : {
146   - type : String,
147   - value : undefined
148   - },
149   -
150   - selectedDatalet : {
151   - type : String,
152   - value : undefined
153   - },
154   -
155   - preselectedDatalet : {
156   - type : String,
157   - value : undefined
158   - },
159   -
160   - type : {
161   - type : String,
162   - value : ""
163   - },
164   -
165   - filters : {
166   - type : Array,
167   - value : []
168   - },
169   -
170   - fields : {
171   - type : Array,
172   - value : []
173   - },
174   -
175   - selectedFields : {
176   - type : Array,
177   - value : []
178   - },
179   -
180   - dataletPreset : {
181   - type : Object,
182   - value : []
183   - },
184   -
185   - dataUrl : {
186   - type : String,
187   - value : undefined
188   - },
189   -
190   - params:{
191   - type: Object,
192   - value: undefined
193   - },
194   -
195   - data : {
196   - type : Object,
197   - value : undefined
198   - },
199   -
200   - },
201   -
202   - listeners: {
203   -// 'select-fields-controllet_selected-fields': '_updateFields',
204   -// 'filters-controllet_filters': '_updateFilters',
205   - 'items-vslider-controllet_selected-datalet': '_selectDatalet',
206   - 'select_visualization_inputs_ready': '_loadDatalet',
207   - 'select_visualization_options_changed': '_tryLoadDatalet'
208   - },
209   -
210   - ready : function() {
211   - this._resize();
212   -
213   - $(this.$.datalet_selection_datalet).perfectScrollbar();
214   -
215   -// this.params = {'data-url' : this.dataUrl};//not here
216   - },
217   -
218   - attached : function() {
219   - this._resize();
220   - var that = this;
221   - window.addEventListener("resize", function() { that._resize(); });
222   -
223   - this._translate();
224   - },
225   -
226   - setFilters : function(filters) {
227   - this.filters = this._copy(filters);
228   - },
229   -
230   - setFields : function(fields) {
231   -// if (this.fields.length > 0 && JSON.stringify(this.fields) != JSON.stringify(fields))
232   -// this.init();
233   -
234   - this.fields = this._copy(fields);
235   -
236   - var inputs = this._getInputs();
237   - if (inputs)
238   - inputs.setFields(this.fields);
239   - },
240   -
241   - setData : function(data) {
242   - this.data = this._copy(data);
243   - },
244   -
245   - init : function() {
246   - this.$.vslider._reset();
247   - },
248   -
249   - show : function() {//show --> preselect
250   -// if(this.preselectedDatalet)
251   - if(this.dataletPreset)
252   - this._preselectDatalet();
253   -
254   -// if (this.$.datalet_selection_datalet_placeholder.innerHTML == "") {
255   -// var inputs = this._getInputs();
256   -// inputs.fireReady();
257   -// }
258   - },
259   -
260   - _translate : function(){
261   - if(this.preselectedDatalet)
262   - this.$.add_button.innerHTML = ln["modifyDatalet_" + ln["localization"]];
263   - else
264   - this.$.add_button.innerHTML = ln["addDatalet_" + ln["localization"]];
265   -
266   - this.$.dataletPreview.innerHTML = ln["dataletPreview_" + ln["localization"]];
267   - },
268   -
269   - _selectDatalet : function(e){
270   -
271   - this.$.add_button.setAttribute("disabled", "true");
272   -
273   - this.selectedDatalet = e.detail.datalet;
274   -
275   - this.$.datalet_selection_datalet_placeholder.innerHTML = "";
276   -
277   - if(!this.selectedDatalet){
278   - this.type = "";
279   - this.$.options.setOptions([]);
280   - }
281   - else{
282   - this.$.selectedDatalet_request.url = this.deepUrl + e.detail.datalet + "-datalet";
283   - this.$.selectedDatalet_request.generateRequest();
284   - }
285   - },
286   -
287   - _handleSelectedDatalet : function(e){
288   -
289   - if(this.type != e.detail.response.type) {
290   -
291   - this.type = e.detail.response.type;
292   -
293   - this.async(function () {
294   - var inputs = this._getInputs();
295   - inputs.setFields(this.fields);
296   - inputs.setInputs(e.detail.response.idm.inputs.input);// Cannot read property '0' of undefined
297   - }, 0);
298   -
299   - this.$.options.setOptions(e.detail.response.idm.inputs.layouts.input);
300   - }
301   - else {
302   - this.$.options.checkOptions(e.detail.response.idm.inputs.layouts.input);
303   - }
304   -
305   - this.async(function () {
306   - var inputs = this._getInputs();
307   - inputs.fireReady();
308   - }, 0);
309   -
310   -// this.async(function () {
311   -// if(this.preselectedDatalet)
312   -// this._preselectDatalet();
313   -// }, 1);
314   - },
315   -
316   - _preselectDatalet : function() {
317   - this.$.vslider._preselectDatalet();
318   -
319   - this.async(function () {
320   - this.$.options._preselectOptions(this.dataletPreset);
321   - }, 100);
322   -
323   - this.async(function () {
324   - var inputs = this._getInputs();
325   - inputs._preselectInputs(this.fields, this.dataletPreset["aggregators"], this.dataletPreset["orders"]);
326   - this.dataletPreset = undefined;
327   - }, 200);
328   - },
329   -
330   - _tryLoadDatalet : function(){
331   - var inputs = this._getInputs();
332   - inputs.fireReady();
333   - },
334   -
335   - _loadDatalet : function(e){
336   - if(!e.detail.isReady) {
337   - this.$.datalet_selection_datalet_placeholder.innerHTML = "";
338   - return;
339   - }
340   -
341   - var inputs = this._getInputs();
342   -
343   - this.selectedFields = inputs.getSelectedFields();
344   -
345   -// console.log(inputs.getFields());
346   -
347   - this.params = {'data-url' : this.dataUrl};//??????????????????
348   -// this.params = {};
349   -
350   - this.params["selectedfields"] = JSON.stringify(inputs.getFields());
351   -
352   - this.params["filters"] = JSON.stringify(this.filters);
353   - this.params["aggregators"] = JSON.stringify(inputs.getAggregators());
354   - this.params["orders"] = JSON.stringify(inputs.getOrders());
355   -
356   - this.params["export_menu"] = "0";
357   -
358   - var params = this.$.options.getParams();
359   - for (var key in params) { this.params[key] = params[key]; }
360   -
361   - //use cache
362   - var data = alasql_QUERY(this.data, this.selectedFields, null, inputs.getAggregators(), inputs.getOrders());
363   -
364   - var converter = new DataTypeConverter();
365   - var result = converter.inferJsonDataType(data, ["*"]);
366   - result = converter.cast(result);
367   - data = result.dataset;
368   -
369   - data = alasql_transformData(data, this.selectedFields, true);
370   -
371   - this.params["data"] = JSON.stringify(data).replace(/'/g, "&#39;");
372   - //
373   -
374   - var dataletParams ={
375   - component: this.selectedDatalet+"-datalet",
376   - fields: this.selectedFields,
377   - params: this.params,
378   - placeHolder: this.$.datalet_selection_datalet_placeholder,
379   - };
380   -
381   - ComponentService.deep_url = this.deepUrl;
382   - ComponentService.getComponent(dataletParams);
383   -
384   - this.$.add_button.removeAttribute("disabled");
385   - },
386   -
387   - _addDatalet : function(){
388   - delete this.params["export_menu"];
389   - delete this.params["data"];
390   -
391   - var data = {
392   - dataUrl: this.dataUrl,
393   - datalet: this.selectedDatalet+"-datalet",
394   - fields: this.selectedFields,
395   - params: this.params,
396   - staticData: JSON.stringify(this.$.datalet_selection_datalet_placeholder.children[1].behavior.data)
397   - }
398   -
399   - this.fire('data-sevc-controllet.dataletCreated', {data : data});
400   - },
401   -
402   - _checkType: function(type, check){
403   - if (type == "multiseries" || type == "")
404   - return (type == check);
405   - else if(check == "default")
406   - return true;
407   - return false;
408   - },
409   -
410   - _getInputs : function(){
411   - if(this.type == "multiseries")
412   - return this.$$("#inputs_series")
413   - return this.$$("#inputs");
414   - },
415   -
416   - _copy : function(o) {
417   - var out, v, key;
418   - out = Array.isArray(o) ? new Array(o.length) : {};
419   - for (key in o) {
420   - v = o[key];
421   - out[key] = (typeof v === "object") ? this._copy(v) : v;
422   - }
423   - return out;
424   - },
425   -
426   - _resize : function(){
427   - var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16;
428   - h = h - 64 - 8; //height with page scroller
429   -
430   - $("#items_vslider_controllet").height(h);//vslider controllet
431   - $("#datalet_selection_inputs").height(h);
432   - $("#datalet_selection_options").height(h);
433   -
434   - $("#datalet_selection_datalet").height(h);
435   - }
436   -
437   - });
438   -
439   - </script>
440   -
441   -</dom-module>
442 0 \ No newline at end of file
datalets/base-datalet/base-datalet.html
... ... @@ -272,6 +272,7 @@ Example :
272 272 this.$.base_datalet_container.innerHTML = "";
273 273 this.$.base_datalet_container.style.margin = 0;
274 274 this.$.base_datalet_container.style.border = 0;
  275 + this.removeLoader();
275 276 },
276 277  
277 278 setExportMenu: function()
... ...
datalets/datasetexplorer-datalet/datasetexplorer-datalet.html
... ... @@ -67,7 +67,8 @@ Example:
67 67 width: 100%;
68 68 height: 70%;
69 69 /*min-height: 500px;*/
70   - background: #ffffff;
  70 + /*background: #ffffff;*/
  71 + background: transparent;
71 72 position: relative;
72 73 }
73 74  
... ... @@ -115,6 +116,10 @@ Example:
115 116 fill: #bbb;
116 117 }
117 118  
  119 + :host ::content iframe.iframe {
  120 + border: 0 !important;
  121 + }
  122 +
118 123 /*:host ::content .children svg.foreignObject {*/
119 124 /*font: 9px sans-serif;*/
120 125 /*text-overflow: ellipsis;*/
... ... @@ -206,7 +211,7 @@ Example:
206 211 var xyz = function(url) {
207 212 me.selectResource(url);
208 213 }
209   - this.map.name = this._component.name;
  214 + this.map.name = datasetexplorer_ln["path_" + datasetexplorer_ln["ln"]];
210 215 build2(this.map, this.meta, this._component.$.treemap_placeholder, xyz, this._component.width, this._component.height);
211 216 },
212 217  
... ...
datalets/datasetexplorer-datalet/js/buildtreemap2.js
... ... @@ -249,7 +249,7 @@ function build2(root, meta, place_holder, select_listener, width, height) {
249 249 .attr("width", root.dx)
250 250 .attr("height", root.dy - root.y)
251 251 .append("xhtml:body")
252   - .html('<iframe src="'+pageurl+'" width="'+root.dx+'" height="'+root.dy+'"></iframe>');
  252 + .html('<iframe class="iframe" src="'+pageurl+'" width="'+root.dx+'" height="'+root.dy+'"></iframe>');
253 253 }
254 254  
255 255 return g;
... ...
datalets/highcharts-datalet/static/themes/themes.js
... ... @@ -14,7 +14,7 @@ Highcharts.themeSpod = {
14 14  
15 15 // Load the fonts
16 16 Highcharts.createElement('link', {
17   - href: '//fonts.googleapis.com/css?family=Unica+One',
  17 + //href: '//fonts.googleapis.com/css?family=Unica+One',
18 18 rel: 'stylesheet',
19 19 type: 'text/css'
20 20 }, null, document.getElementsByTagName('head')[0]);
... ... @@ -225,7 +225,7 @@ Highcharts.themeDarkUnika = {
225 225  
226 226 // Load the fonts
227 227 Highcharts.createElement('link', {
228   - href: '//fonts.googleapis.com/css?family=Signika:400,700',
  228 + //href: '//fonts.googleapis.com/css?family=Signika:400,700',
229 229 rel: 'stylesheet',
230 230 type: 'text/css'
231 231 }, null, document.getElementsByTagName('head')[0]);
... ... @@ -326,7 +326,7 @@ Highcharts.themeSandSignika = {
326 326  
327 327 // Load the fonts
328 328 Highcharts.createElement('link', {
329   - href: '//fonts.googleapis.com/css?family=Dosis:400,600',
  329 + //href: '//fonts.googleapis.com/css?family=Dosis:400,600',
330 330 rel: 'stylesheet',
331 331 type: 'text/css'
332 332 }, null, document.getElementsByTagName('head')[0]);
... ...
locales/controllet_ln.js
... ... @@ -17,17 +17,43 @@ ln[&quot;forward_en&quot;] = &quot;FORWARD&quot;;
17 17  
18 18 //SELECT DATASET
19 19  
20   -ln["listView_en"] = "LIST VIEW";
21   -ln["treeMapView_en"] = "TREE MAP VIEW";
22   -ln["extendedSearch_en"] = "EXTENDED SEARCH";
  20 +ln["selectedUrl_en"] = "Selected url";
  21 +ln["wrongUrl_en"] = "Invalid url or data provider not supported yet.";
  22 +
  23 +ln["providersDatasets_en"] = "PROVIDERS DATASETS";
  24 +ln["spodUsersDatasets_en"] = "SPOD USERS DATASETS";
  25 +ln["datasets_en"] = "DATASETS";
  26 +
23 27 ln["provider_en"] = "Provider";
  28 +ln["all_en"] = "All";
  29 +ln["allDescription_en"] = "Shows the datasets of all associated providers.";
  30 +ln["providerName_en"] = "Provider";
  31 +ln["providerNameDescription_en"] = "Shows only the datasets of the selected provider.";
  32 +
  33 +//ln["view_en"] = "View";
  34 +//ln["list_en"] = "List";
  35 +//ln["listDescription_en"] = "Shows the datasets with a classic list.";
  36 +//ln["tree_en"] = "Tree";
  37 +//ln["treeDescription_en"] = "Shows the datasets with a tree map.";
  38 +
  39 +ln["search_en"] = "Search";
  40 +ln["standard_en"] = "Standard";
  41 +ln["standardDescription_en"] = "The search function works only on datasets names.";
  42 +ln["extended_en"] = "Extended [NOT AVAILABLE]";
  43 +ln["extendedDescription_en"] = "The search function works the entire contents of the datasets.";
  44 +
  45 +ln["version_en"] = "Version";
  46 +ln["showLast_en"] = "Show last";
  47 +ln["showLastDescription_en"] = "Shows only the latest version of the datasets.";
  48 +ln["showAll_en"] = "Show all";
  49 +ln["showAllDescription_en"] = "Shows all versions of the datasets.";
  50 +
  51 +//select-dataset-controllet
  52 +ln["datasetsInfo_en"] = "DATASET INFO";
24 53 ln["showing_en"] = "Showing";
25 54 ln["to_en"] = "to";
26 55 ln["of_en"] = "of";
27   -ln["datasets_en"] = "datasets";
28   -ln["suggestedDatasets_en"] = "Suggested datasets";
29   -ln["selectedUrl_en"] = "Selected url";
30   -ln["wrongUrl_en"] = "Invalid url or data provider not supported yet.";
  56 +ln["search_en"] = "Search";
31 57  
32 58 //SELECT DATA
33 59  
... ...
locales/datasetexplorer_ln.js
... ... @@ -2,12 +2,16 @@ datasetexplorer_ln = [];
2 2  
3 3 /*EN*/
4 4 datasetexplorer_ln["ode+back_en"] = "<< Click to navigate back to the top level.";
  5 +datasetexplorer_ln["path_en"] = "Path: ";
5 6  
6 7 /*IT*/
7 8 datasetexplorer_ln["ode+back_it"] = "<< Clicca qui per tornare al livello precedente.";
  9 +datasetexplorer_ln["path_it"] = "Path: ";
8 10  
9 11 /*FR*/
10 12 datasetexplorer_ln["ode+back_fr"] = "<< Click to navigate back to the top level.";
  13 +datasetexplorer_ln["path_fr"] = "Path: ";
11 14  
12 15 /*NL*/
13 16 datasetexplorer_ln["ode+back_nl"] = "<< Click to navigate back to the top level.";
  17 +datasetexplorer_ln["path_nl"] = "Path: ";
... ...