Blame view

controllets/providers-utility-controllet/providers-utility-controllet.html 1.52 KB
89558a41   Renato De Donato   datatype, provide...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  <link rel="import" href="../../bower_components/polymer/polymer.html" />
  
  <script src="ckan.js"></script>
  <script src="openDataSoft.js"></script>
  <script src="generic.js"></script>
  
  <script>
      var providerFactory = {
          getProvider: function(dataUrl) {
              if (dataUrl.indexOf("datastore_search?resource_id") > -1)
                  return new ckan_Provider();
              else if (dataUrl.indexOf("search?dataset") > -1)
                  return new openDataSoft_Provider();
              else
ce415fab   Renato De Donato   new-bug
15
                  return new generic_Provider();
89558a41   Renato De Donato   datatype, provide...
16
17
18
          }
      };
  
0f4f5f1b   Renato De Donato   new datalets mult...
19
20
      //utility non legato al provider, aggiungere copy e creare un altro js!!!
  
89558a41   Renato De Donato   datatype, provide...
21
22
23
24
25
26
      //jsdatachecker
      utility_getFields = function(types) {
          return Object.keys(types).map(function(key) { return key; });
      };
  
      utility_getSelectedFields = function(fields, indices) {
4f438cd9   Renato De Donato   datalets-modifier
27
          var selectedFileds = [];
89558a41   Renato De Donato   datatype, provide...
28
29
30
31
32
          for (var i = 0; i < indices.length; i++)
              selectedFileds.push(fields[indices[i]]);
          return selectedFileds;
      };
  
4f438cd9   Renato De Donato   datalets-modifier
33
      utility_getSelectedIndices = function(fields, selectedFileds) {
4f438cd9   Renato De Donato   datalets-modifier
34
          var selectedIndices = [];
2f01c2f6   Renato De Donato   preselect bug
35
36
37
          for (var i = 0; i < selectedFileds.length; i++)
              if($.inArray(selectedFileds[i], fields) > -1)
                  selectedIndices.push(fields.indexOf(selectedFileds[i]));
4f438cd9   Renato De Donato   datalets-modifier
38
39
40
          return selectedIndices;
      };
  
0f4f5f1b   Renato De Donato   new datalets mult...
41
  
89558a41   Renato De Donato   datatype, provide...
42
43
44
45
46
47
48
49
50
51
52
53
54
  </script>
  
  <dom-module id="providers-utility-controllet">
  
      <template></template>
  
      <script>
          Polymer({
              is : 'providers-utility-controllet',
          });
      </script>
  
  </dom-module>