Commit 382b55e7bb35e1a7ff94884558f38fbb5302d4d3
1 parent
576713c8
ortelio
Showing
4 changed files
with
591 additions
and
6 deletions
controllets/select-dataset-controllet/ortelio-controllet.html
0 → 100755
1 | +<link rel="import" href="../../bower_components/polymer/polymer.html"> | |
2 | + | |
3 | +<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html"> | |
4 | + | |
5 | +<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html"> | |
6 | +<!--<link rel="import" href="../../bower_components/app-layout/app-toolbar/app-toolbar.html">--> | |
7 | +<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html"> | |
8 | +<link rel="import" href="../../bower_components/paper-styles/color.html"> | |
9 | +<link rel="import" href="../../bower_components/paper-styles/typography.html"> | |
10 | +<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html"> | |
11 | +<link rel="import" href="../../bower_components/iron-icons/iron-icons.html"> | |
12 | +<link rel="import" href="../../bower_components/iron-image/iron-image.html"> | |
13 | +<link rel="import" href="../../bower_components/iron-list/iron-list.html"> | |
14 | + | |
15 | +<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html"> | |
16 | +<link rel="import" href="../../bower_components/paper-menu/paper-menu.html"> | |
17 | +<link rel="import" href="../../bower_components/paper-item/paper-item.html"> | |
18 | + | |
19 | +<link rel="import" href="../../bower_components/paper-input/paper-input.html"> | |
20 | + | |
21 | +<link rel="import" href="../../bower_components/paper-input/paper-textarea.html"> | |
22 | + | |
23 | +<link rel="import" href="../../bower_components/paper-material/paper-material.html" /> | |
24 | + | |
25 | +<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html"> | |
26 | +<link rel="import" href="../../bower_components/iron-icons/hardware-icons.html"> | |
27 | +<!--<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">--> | |
28 | + | |
29 | +<link rel="import" href="../../bower_components/paper-radio-button/paper-radio-button.html"> | |
30 | +<link rel="import" href="../../bower_components/paper-radio-group/paper-radio-group.html"> | |
31 | + | |
32 | +<link rel="import" href="../../bower_components/paper-checkbox/paper-checkbox.html"> | |
33 | + | |
34 | + | |
35 | +<dom-module id="ortelio-controllet"> | |
36 | + <template> | |
37 | + <style> | |
38 | + :host { | |
39 | + --paper-dropdown-menu-icon: { | |
40 | + color: #000000; | |
41 | + }; | |
42 | + --paper-dropdown-menu-ripple: { | |
43 | + color: #FFFFFF; | |
44 | + }; | |
45 | + /*--paper-tab-ink: {*/ | |
46 | + /*color: #FFFFFF;*/ | |
47 | + /*};*/ | |
48 | + } | |
49 | + | |
50 | + iron-list { | |
51 | + --iron-list-items-container: { | |
52 | + margin:16px 16px 8px 16px; | |
53 | + }; | |
54 | + } | |
55 | + | |
56 | + paper-textarea { | |
57 | + width: 100%; | |
58 | + --paper-input-container-focus-color: #2196F3; | |
59 | + } | |
60 | + | |
61 | + paper-input { | |
62 | + --paper-input-container-focus-color: #2196F3; | |
63 | + } | |
64 | + paper-dropdown-menu { | |
65 | + width: 100%; | |
66 | + --paper-input-container-focus-color: #2196F3; | |
67 | + } | |
68 | + | |
69 | + paper-item.iron-selected { | |
70 | + background-color: #2196F3; | |
71 | + color: #FFFFFF; | |
72 | + } | |
73 | + | |
74 | + paper-radio-button { | |
75 | + height: 24px; | |
76 | + --paper-radio-button-checked-color: #2196F3; | |
77 | + --paper-radio-button-checked-ink-color: #FFFFFF; | |
78 | + --paper-radio-button-unchecked-color: #000000; | |
79 | + --paper-radio-button-unchecked-ink-color: #FFFFFF; | |
80 | + --paper-radio-button-label-color: #000000; | |
81 | + } | |
82 | + | |
83 | + paper-icon-button{ | |
84 | + height: 48px; | |
85 | + width: 48px; | |
86 | + padding: 0px; | |
87 | + --paper-icon-button-ink-color: #FFFFFF; | |
88 | + } | |
89 | + | |
90 | + paper-icon-button:hover{ | |
91 | + color: #2196F3; | |
92 | + } | |
93 | + | |
94 | + paper-icon-button[disabled]{ | |
95 | + color: #B6B6B6; | |
96 | + } | |
97 | + | |
98 | + paper-icon-button.clear { | |
99 | + width: 24px; | |
100 | + height: 24px; | |
101 | + padding: 0px 4px; | |
102 | + color: #F44336; | |
103 | + --paper-icon-button-ink-color: #FFFFFF; | |
104 | + } | |
105 | + | |
106 | + paper-tabs { | |
107 | + font-weight: bold; | |
108 | + } | |
109 | + | |
110 | + paper-tab { | |
111 | + transition: all 1.0s; | |
112 | + } | |
113 | + | |
114 | + paper-tab.iron-selected { | |
115 | + background-color: #2196F3; | |
116 | + color: #FFFFFF; | |
117 | + } | |
118 | + | |
119 | + paper-tab:not(.iron-selected):hover { | |
120 | + color: #2196F3; | |
121 | + } | |
122 | + | |
123 | + .item { | |
124 | + /*@apply(--layout-horizontal);*/ | |
125 | + display: flex; | |
126 | + padding: 11px; | |
127 | + border: 1px solid #B6B6B6; | |
128 | + border-radius: 4px; | |
129 | + cursor: pointer; | |
130 | + margin-bottom: 8px; | |
131 | + background-color: #E0E0E0; | |
132 | + } | |
133 | + | |
134 | + .item.expanded { | |
135 | + /*border: 2px solid #2196F3;*/ | |
136 | + border-color: #2196F3; | |
137 | + } | |
138 | + | |
139 | + .pad { | |
140 | + @apply(--layout-flex); | |
141 | + /*@apply(--layout-vertical);*/ | |
142 | + } | |
143 | + | |
144 | + .primary { | |
145 | + font-weight: bold; | |
146 | + } | |
147 | + | |
148 | + .item.expanded .primary { | |
149 | + color: #2196F3; | |
150 | + } | |
151 | + | |
152 | + .longText { | |
153 | + display: none; | |
154 | + } | |
155 | + | |
156 | + .item.expanded .longText { | |
157 | + display: block; | |
158 | + } | |
159 | + | |
160 | + #ortelio_container * { | |
161 | + font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
162 | + font-size: 16px; | |
163 | + line-height: 24px; | |
164 | + } | |
165 | + | |
166 | + #ortelio_container { | |
167 | + height: 100%; | |
168 | + width: 100%; | |
169 | + margin-top: -48px;/*bad*/ | |
170 | + } | |
171 | + | |
172 | + #ortelio_container #list_info { | |
173 | + display: flex; | |
174 | + height: calc(100% - 48px); | |
175 | + width: calc(100% + 8px);/*bad*/ | |
176 | + } | |
177 | + | |
178 | + #ortelio_container #list_container { | |
179 | + position: relative; | |
180 | + height: 100%; | |
181 | + width: 50%; | |
182 | + border-left: 4px solid #B6B6B6; | |
183 | + } | |
184 | + | |
185 | + #ortelio_container #info_container { | |
186 | + position: relative; | |
187 | + height: 100%; | |
188 | + width: 50%; | |
189 | + border-right: 4px solid #B6B6B6; | |
190 | + } | |
191 | + | |
192 | + #ortelio_container #info { | |
193 | + position: relative; | |
194 | + height: calc(100% - 56px); | |
195 | + width: calc(100% - 56px); | |
196 | + padding: 11px; | |
197 | + border: 1px solid #B6B6B6; | |
198 | + border-radius: 4px; | |
199 | + background-color: #E0E0E0; | |
200 | + margin: 16px; | |
201 | + | |
202 | + /*cursor: url(http://www.i2clipart.com/cliparts/f/5/9/a/clipart-pointer-f59a.png), auto;*/ | |
203 | + } | |
204 | + | |
205 | + #ortelio_container #header { | |
206 | + width: 100%; | |
207 | + position: relative; | |
208 | + z-index: 1; | |
209 | + -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); | |
210 | + -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); | |
211 | + 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); | |
212 | + | |
213 | + background-color: #B6B6B6; | |
214 | + display: flex; | |
215 | + padding: 0px 4px; | |
216 | + } | |
217 | + | |
218 | + #header .header_block { | |
219 | + width: 20%; | |
220 | + height: 40px; | |
221 | + padding: 4px 16px 4px 16px; | |
222 | + } | |
223 | + | |
224 | + #header .header_block:nth-child(4) { | |
225 | + text-align: center; | |
226 | + } | |
227 | + | |
228 | + #ortelio_container #footer_list { | |
229 | + position: relative; | |
230 | + z-index: 1; | |
231 | + -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); | |
232 | + -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); | |
233 | + 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); | |
234 | + } | |
235 | + | |
236 | + #ortelio_container #footer_list{ | |
237 | + width: 100%; | |
238 | + background-color: #B6B6B6; | |
239 | + display: flex; | |
240 | + padding: 0px 4px; | |
241 | + } | |
242 | + | |
243 | + .footer_block { | |
244 | + width: calc((100% - 0px) / 3); | |
245 | + height: 24px; | |
246 | + padding: 12px 8px 12px 8px; | |
247 | + text-align: center; | |
248 | + } | |
249 | + | |
250 | + .footer_block:nth-child(2) { | |
251 | + height: 48px; | |
252 | + padding: 0px 8px; | |
253 | + } | |
254 | + | |
255 | + .footer_block:nth-child(3) { | |
256 | + height: 48px; | |
257 | + padding: 0px 8px; | |
258 | + } | |
259 | + </style> | |
260 | + | |
261 | + <iron-ajax id="filteredDatasets_request" handle-as="json" url="http://uc1.ortelio.co.uk/api/" on-response="_getFilteredDatasets"></iron-ajax> | |
262 | + | |
263 | + <div id="ortelio_container"> | |
264 | + <div id="header"> | |
265 | + <div class="header_block"> | |
266 | + </div> | |
267 | + <div class="header_block"> | |
268 | + </div> | |
269 | + <div class="header_block"> | |
270 | + </div> | |
271 | + <div class="header_block"> | |
272 | + </div> | |
273 | + <div class="header_block"> | |
274 | + <paper-input id="datasets_filter" value={{filter}} no-label-float label=""> | |
275 | + <iron-icon class="search" icon="search" prefix></iron-icon> | |
276 | + <paper-icon-button class="clear" suffix on-click="_clearInput" icon="clear" tabindex="0"></paper-icon-button> | |
277 | + </paper-input> | |
278 | + </div> | |
279 | + </div> | |
280 | + | |
281 | + <div id="list_info"> | |
282 | + <div id="list_container"> | |
283 | + <iron-list id="list" items="{{shownDatasets}}" selection-enabled> | |
284 | + <template> | |
285 | + <div> | |
286 | + <div class$="{{getClassForItem(selected)}}" on-tap="_selectDataUrl"> | |
287 | + <div class="pad"> | |
288 | + <div class="primary">{{item.package_name}}</div> | |
289 | + </div> | |
290 | + </div> | |
291 | + </div> | |
292 | + </template> | |
293 | + </iron-list> | |
294 | + </div> | |
295 | + <div id="info_container"> | |
296 | + <div id="info"> | |
297 | + </div> | |
298 | + </div> | |
299 | + </div> | |
300 | + | |
301 | + <div id="footer_list"> | |
302 | + <div class="footer_block"><span id="showing"></span> {{shownPrev}} <span id="to"></span> {{shownNext}} <span id="of"></span> {{length}} <span id="datasets"></span></div> | |
303 | + <div class="footer_block"> | |
304 | + <paper-icon-button id="slider_chevron_left" class="chevron-left" on-click="_onPrevClick" icon="chevron-left"></paper-icon-button> | |
305 | + <paper-icon-button id="slider_chevron_right" class="chevron-right" on-click="_onNextClick" icon="chevron-right"></paper-icon-button> | |
306 | + </div> | |
307 | + <div class="footer_block"> | |
308 | + <!--<paper-radio-group id="radio_sort" on-change="_changeSorting" selected="date">--> | |
309 | + <!--<paper-radio-button name="date">Date</paper-radio-button>--> | |
310 | + <!--<paper-radio-button name="relevance">Relevance</paper-radio-button>--> | |
311 | + <!--</paper-radio-group>--> | |
312 | + </div> | |
313 | + </div> | |
314 | + </div> | |
315 | + | |
316 | + </template> | |
317 | + | |
318 | + <script> | |
319 | + HTMLImports.whenReady(function() { | |
320 | + Polymer({ | |
321 | + is: 'ortelio-controllet', | |
322 | + properties: { | |
323 | +// datasets: { | |
324 | +// type: Object, | |
325 | +// value: undefined | |
326 | +// }, | |
327 | + filteredDatasets : { | |
328 | + type : Array, | |
329 | + value : undefined | |
330 | + }, | |
331 | + shownDatasets : { | |
332 | + type : Array, | |
333 | + value : undefined | |
334 | + }, | |
335 | + suggestedDatasets : { | |
336 | + type : Array, | |
337 | + value : undefined | |
338 | + }, | |
339 | + | |
340 | + providers : { | |
341 | + type : Array, | |
342 | + value : undefined | |
343 | + }, | |
344 | + dataUrl : { | |
345 | + type : String, | |
346 | + value : undefined, | |
347 | + observer : '_fireDataUrl' | |
348 | + }, | |
349 | + filter : { | |
350 | + type : String, | |
351 | + value : "", | |
352 | + observer : '_filter' | |
353 | + }, | |
354 | + sort : { | |
355 | + type : String, | |
356 | + value : "date", | |
357 | + }, | |
358 | + selected : { | |
359 | + type : Number, | |
360 | + value : 0 | |
361 | + }, | |
362 | + prev : {type : Number, value : undefined}, | |
363 | + next : {type : Number, value : undefined}, | |
364 | + shownPrev : {type : Number, value : undefined}, | |
365 | + shownNext : {type : Number, value : undefined}, | |
366 | + length : {type : Number, value : undefined}, | |
367 | + step : {type : Number, value : 20}, | |
368 | + }, | |
369 | + | |
370 | + ready : function() { | |
371 | + $(this.$.list_container).perfectScrollbar(); | |
372 | + $(this.$.info).perfectScrollbar(); | |
373 | + | |
374 | +// this.$.selected_url.invalid = true; | |
375 | + }, | |
376 | +// | |
377 | + attached: function() { | |
378 | + var that = this; | |
379 | + window.addEventListener("resize", function() { that._refreshList();});///?????????????? | |
380 | + | |
381 | +// this.providers = this.datasets["result"]["providers"]; | |
382 | +// this.datasets = this.datasets["result"]["datasets"]; | |
383 | +// this.datasets = [{"package_name":"openbilancio-provincia-di-prato","package_url":"http:\/\/ckan.routetopa.eu\/dataset\/openbilancio-provincia-di-prato","ckan_id":"0cb600fc-19ad-4aaf-9794-1e6ea851840a","portal":"http:\/\/ckan.routetopa.eu\/","resource_url":"http:\/\/ckan.routetopa.eu\/dataset\/58e0c611-8d26-4efe-ad77-af2c7a16234d\/resource\/0cb600fc-19ad-4aaf-9794-1e6ea851840a\/download\/CONSUNTIVOENTRATE2014.csv"},{"package_name":"albo-regionale-delle-concessioni-demaniali-marittime-per-finalita-turistico-ricreative","package_url":"http:\/\/dati.lazio.it\/catalog\/en\/dataset\/albo-regionale-delle-concessioni-demaniali-marittime-per-finalita-turistico-ricreative","ckan_id":"c8772359-fc32-4c8f-8e93-8e9bb3ccb17b","portal":"http:\/\/dati.lazio.it\/","resource_url":"http:\/\/dati.lazio.it\/catalog\/dataset\/c18aec8b-f33c-41dd-80f6-c1c9777ec842\/resource\/c8772359-fc32-4c8f-8e93-8e9bb3ccb17b\/download\/datianno2013.csv"},{"package_name":"artes-registro-regionale-delle-associazioni","package_url":"http:\/\/dati.lazio.it\/catalog\/en\/dataset\/artes-registro-regionale-delle-associazioni","ckan_id":"3dcbe73c-6724-458d-9976-9b420be95e74","portal":"http:\/\/dati.lazio.it\/","resource_url":"http:\/\/dati.lazio.it\/catalog\/dataset\/bdcbd139-c5d7-45f9-8d30-433e090bad02\/resource\/3dcbe73c-6724-458d-9976-9b420be95e74\/download\/associazioni.csv"},{"package_name":"bilanci-preventivi-della-regione-lazio","package_url":"http:\/\/dati.lazio.it\/catalog\/en\/dataset\/bilanci-preventivi-della-regione-lazio","ckan_id":"722b6cbd-28d3-4151-ac50-9c4261298168","portal":"http:\/\/dati.lazio.it\/","resource_url":"http:\/\/dati.lazio.it\/catalog\/dataset\/6febe802-8344-4734-b11b-ce4638234b45\/resource\/722b6cbd-28d3-4151-ac50-9c4261298168\/download\/preventivospese2013.csv"},{"package_name":"contributi-per-gli-spettacoli-dal-vivo","package_url":"http:\/\/dati.lazio.it\/catalog\/en\/dataset\/contributi-per-gli-spettacoli-dal-vivo","ckan_id":"e7c66956-5a08-4c2f-bee9-366e3035b0b7","portal":"http:\/\/dati.lazio.it\/","resource_url":"http:\/\/dati.lazio.it\/catalog\/dataset\/00bc8d2f-1513-4c45-89a1-75fc65d09c03\/resource\/e7c66956-5a08-4c2f-bee9-366e3035b0b7\/download\/contributi2010.csv"}] | |
384 | + | |
385 | + this._reset(); | |
386 | +// | |
387 | +// this.prev = 1; | |
388 | +// this.next = this.step; | |
389 | +// this.length = this.filteredDatasets.length; | |
390 | +// | |
391 | +// this.shownPrev = Math.min(this.prev, this.length); | |
392 | +// this.shownNext = Math.min(this.next, this.length); | |
393 | +// this.shownDatasets = this.filteredDatasets.slice(this.prev-1, this.next); | |
394 | +// | |
395 | +// this.$.list.scrollTarget = this.ownerDocument.documentElement; | |
396 | + | |
397 | + this._translate(); | |
398 | + }, | |
399 | + | |
400 | + _translate : function(){ | |
401 | + this.$.showing.innerHTML = ln["showing_" + ln["localization"]]; | |
402 | + this.$.to.innerHTML = ln["to_" + ln["localization"]]; | |
403 | + this.$.of.innerHTML = ln["of_" + ln["localization"]]; | |
404 | + this.$.datasets.innerHTML = ln["datasets_" + ln["localization"]]; | |
405 | + }, | |
406 | + | |
407 | + _refreshList : function() { | |
408 | + this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next); | |
409 | + }, | |
410 | + | |
411 | + _getFilteredDatasets : function(e) { | |
412 | +// console.log(e.detail.response); | |
413 | + | |
414 | + if(e.detail.response == null) | |
415 | + return; | |
416 | + | |
417 | + this.filteredDatasets = e.detail.response["results"]; | |
418 | + | |
419 | + this.prev = 1; | |
420 | + this.next = this.step; | |
421 | + this.length = this.filteredDatasets.length; | |
422 | + | |
423 | + this.shownPrev = Math.min(this.prev, this.length); | |
424 | + this.shownNext = Math.min(this.next, this.length); | |
425 | + this.shownDatasets = this.filteredDatasets.slice(this.prev-1, this.next); | |
426 | + | |
427 | + this.$.list.scrollTarget = this.ownerDocument.documentElement; | |
428 | + }, | |
429 | + | |
430 | + _reset : function() { | |
431 | + this.filteredDatasets = []; | |
432 | +// | |
433 | + this.prev = 1; | |
434 | + this.next = this.step; | |
435 | + this.length = this.filteredDatasets.length; | |
436 | + | |
437 | + this.shownPrev = Math.min(this.prev, this.length); | |
438 | + this.shownNext = Math.min(this.next, this.length); | |
439 | + this.shownDatasets = this.filteredDatasets.slice(this.prev-1, this.next); | |
440 | + | |
441 | + this.$.list.scrollTarget = this.ownerDocument.documentElement; | |
442 | + }, | |
443 | + | |
444 | + _filter : function() { | |
445 | + if(this.filter.length > 0) | |
446 | + this.debounce('filter', function () { | |
447 | + this.$.filteredDatasets_request.url = "http://uc1.ortelio.co.uk/api/" + this.filter + "/order:" + this.sort + "/limit:99999"; | |
448 | + this.$.filteredDatasets_request.generateRequest(); | |
449 | + }, 500); | |
450 | + else | |
451 | + this._reset(); | |
452 | + }, | |
453 | + | |
454 | + _clearInput : function() { | |
455 | + this.$.datasets_filter.value = ""; | |
456 | + this._filter(); | |
457 | + }, | |
458 | + | |
459 | + _changeSorting : function() { | |
460 | + this.async(function () { | |
461 | + this.sort = this.$.radio_sort.selectedItem.name; | |
462 | + this._filter(); | |
463 | + }, 0); | |
464 | + }, | |
465 | + | |
466 | + getClassForItem: function(selected) { | |
467 | + return selected ? 'item expanded' : 'item'; | |
468 | + }, | |
469 | + | |
470 | + _onPrevClick : function(){ | |
471 | + if(this.prev != 1) { | |
472 | + this.prev -= this.step; | |
473 | + this.next -= this.step; | |
474 | + | |
475 | + this.shownPrev = Math.min(this.prev, this.length); | |
476 | + this.shownNext = Math.min(this.next, this.length); | |
477 | + this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next); | |
478 | + } | |
479 | + $("#list_container").animate({ scrollTop: 0}, 0); | |
480 | + }, | |
481 | + | |
482 | + _onNextClick : function(){ | |
483 | + if(this.next < this.length) { | |
484 | + this.prev += this.step; | |
485 | + this.next += this.step; | |
486 | + | |
487 | + this.shownPrev = Math.min(this.prev, this.length); | |
488 | + this.shownNext = Math.min(this.next, this.length); | |
489 | + this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next); | |
490 | + } | |
491 | + $("#list_container").animate({ scrollTop: 0}, 0); | |
492 | + }, | |
493 | + | |
494 | + _selectDataUrl : function(){ | |
495 | + this.async(function () { | |
496 | + if(this.$.list.selectedItem) { | |
497 | + | |
498 | + var metas = this.$.list.selectedItem; | |
499 | + var html = "<span style=\"color: #2196F3; font-weight: bold;\">" + this.$.list.selectedItem.package_name + "</span><br><br>"; | |
500 | + for(var i in metas) | |
501 | + html += "<b>" + i + ":</b> " + metas[i] + "<br>"; | |
502 | + this.$.info.innerHTML = html; | |
503 | + | |
504 | + var url = this.$.list.selectedItem.resource_url; | |
505 | + | |
506 | + // Check if CKAN | |
507 | + var strDatasetPos = url.indexOf('/dataset/'); | |
508 | + var strResourcePos = (strDatasetPos >= 0) ? url.indexOf('/resource/') : -1; | |
509 | + if (strDatasetPos >= 0 && strResourcePos > strDatasetPos) { | |
510 | + var urlSegment1 = url.substring(0, strDatasetPos); | |
511 | + var urlResourceEnd = url.indexOf('/', strResourcePos + 10); | |
512 | + var resourceId = url.substring(strResourcePos + 10, urlResourceEnd); | |
513 | + url = urlSegment1 + "/api/action/datastore_search?resource_id=" + resourceId; | |
514 | + } | |
515 | + | |
516 | + // Check if OPENDATASOFT | |
517 | + var strExploreDatasetPos = url.indexOf('/explore/dataset/'); | |
518 | + if (strExploreDatasetPos >= 0) { | |
519 | + var urlSegment1 = url.substring(0, strExploreDatasetPos); | |
520 | + var datasetEnd = url.indexOf(strExploreDatasetPos + 17, '/'); | |
521 | + var datasetId = url.substring(strExploreDatasetPos + 17, datasetEnd >= 0 ? datasetEnd : url.length); | |
522 | + url = urlSegment1 + '/api/records/1.0/search?dataset=' + datasetId; | |
523 | + } | |
524 | + | |
525 | + url = this._addlimitUrl(url); | |
526 | + | |
527 | + this.fire("datasetexplorer-datalet_data-url", { url: url });//change event name | |
528 | + } | |
529 | + else { | |
530 | + this.fire("datasetexplorer-datalet_data-url", { url: "" }); | |
531 | + this.$.info.innerHTML = ""; | |
532 | + } | |
533 | + }, 0); | |
534 | + }, | |
535 | + | |
536 | + _addlimitUrl : function(url){ | |
537 | + //CKAN --> action no limit | |
538 | + if((url.indexOf("api/action") > -1) && !(url.indexOf("limit") > -1)) | |
539 | + { | |
540 | + url += "&limit=99999"; | |
541 | + } | |
542 | + //OpenDataSoft --> action no limit | |
543 | + if((url.indexOf("api/records") > -1) && !(url.indexOf("rows") > -1)){ | |
544 | + url += "&rows=10000"; | |
545 | + } | |
546 | + return url; | |
547 | + } | |
548 | + }); | |
549 | + }); | |
550 | + </script> | |
551 | +</dom-module> | |
0 | 552 | \ No newline at end of file | ... | ... |
controllets/select-dataset-controllet/select-dataset-controllet.html
... | ... | @@ -33,6 +33,7 @@ |
33 | 33 | |
34 | 34 | <link rel="import" href="../../bower_components/paper-checkbox/paper-checkbox.html"> |
35 | 35 | |
36 | +<link rel="import" href="ortelio-controllet.html"> | |
36 | 37 | <link rel="import" href="../../datalets/datasetexplorer-datalet/datasetexplorer-datalet.html"> |
37 | 38 | |
38 | 39 | <dom-module id="select-dataset-controllet"> |
... | ... | @@ -186,7 +187,7 @@ |
186 | 187 | position: relative; |
187 | 188 | height: 100%; |
188 | 189 | width: 50%; |
189 | - border-left: 4px solid #B6B6B6;; | |
190 | + border-left: 4px solid #B6B6B6; | |
190 | 191 | } |
191 | 192 | |
192 | 193 | #select_dataset_container #info_container { |
... | ... | @@ -194,8 +195,6 @@ |
194 | 195 | height: 100%; |
195 | 196 | width: 50%; |
196 | 197 | border-right: 4px solid #B6B6B6; |
197 | - | |
198 | - /*background-color: red;*/ | |
199 | 198 | } |
200 | 199 | |
201 | 200 | #select_dataset_container #info { |
... | ... | @@ -297,14 +296,22 @@ |
297 | 296 | /*font-weight: bold;*/ |
298 | 297 | /*line-height: 48px;*/ |
299 | 298 | /*}*/ |
299 | + | |
300 | + /*#ortelio {*/ | |
301 | + /*/!*height: calc(100% - 172px);*!/*/ | |
302 | + /*/!*width: calc(100% - 8px);*!/*/ | |
303 | + /*height: 100%;*/ | |
304 | + /*width: 100%;*/ | |
305 | + /*background-color: red;*/ | |
306 | + /*}*/ | |
300 | 307 | </style> |
301 | 308 | |
302 | 309 | <paper-material id="select_dataset_container" elevation="5"> |
303 | 310 | |
304 | 311 | <paper-tabs selected="{{selected}}" no-bar> |
305 | - <paper-tab noink on-tap="_refreshList"><span id="listView"></span></paper-tab> | |
306 | - <!--<paper-tab noink ><span id="listView"></span></paper-tab>--> | |
312 | + <paper-tab on-tap="_refreshList" noink><span id="listView"></span></paper-tab> | |
307 | 313 | <paper-tab on-tap="_noShadow" noink><span id="treeMapView"></span></paper-tab> |
314 | + <paper-tab on-tap="_hideSearch" noink><span id="extendedSearch"></span></paper-tab> | |
308 | 315 | </paper-tabs> |
309 | 316 | |
310 | 317 | <div id="header"> |
... | ... | @@ -388,6 +395,12 @@ |
388 | 395 | </div> |
389 | 396 | </neon-animatable> |
390 | 397 | |
398 | + <neon-animatable> | |
399 | + <!--<div id="ortelio">--> | |
400 | + <ortelio-controllet datasets={{datasets}}></ortelio-controllet> | |
401 | + <!--</div>--> | |
402 | + </neon-animatable> | |
403 | + | |
391 | 404 | </neon-animated-pages> |
392 | 405 | |
393 | 406 | <div id="url"> |
... | ... | @@ -496,6 +509,7 @@ |
496 | 509 | _translate : function(){ |
497 | 510 | this.$.listView.innerHTML = ln["listView_" + ln["localization"]]; |
498 | 511 | this.$.treeMapView.innerHTML = ln["treeMapView_" + ln["localization"]]; |
512 | + this.$.extendedSearch.innerHTML = ln["extendedSearch_" + ln["localization"]]; | |
499 | 513 | |
500 | 514 | this.$.ddl_provider.setAttribute("label", ln["provider_" + ln["localization"]]); |
501 | 515 | this.$.datasets_filter.setAttribute("label", ln["search_" + ln["localization"]]); |
... | ... | @@ -572,14 +586,28 @@ |
572 | 586 | |
573 | 587 | _refreshList : function() { |
574 | 588 | this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next); |
589 | + | |
590 | + this.$.header.style.display = "flex"; | |
591 | + this.$.header.style.visibility = "visible"; | |
592 | +// this.$.url.style.marginTop = "-4px"; | |
593 | + | |
575 | 594 | this.$.header.className = this.$.header.className.replace(" noshadow", ""); |
576 | 595 | }, |
577 | 596 | |
578 | 597 | _noShadow : function() { |
579 | - console.log(this.$.header); | |
598 | + this.$.header.style.display = "flex"; | |
599 | + this.$.header.style.visibility = "visible"; | |
600 | +// this.$.url.style.marginTop = "-4px"; | |
601 | + | |
580 | 602 | this.$.header.className += " noshadow"; |
581 | 603 | }, |
582 | 604 | |
605 | + _hideSearch : function() { | |
606 | +// this.$.header.style.display = "none"; | |
607 | + this.$.header.style.visibility = "hidden"; | |
608 | +// this.$.url.style.marginTop = "44px"; | |
609 | + }, | |
610 | + | |
583 | 611 | _clearInput : function() { |
584 | 612 | this.$.datasets_filter.value = ""; |
585 | 613 | }, | ... | ... |
controllets/select-visualization-controllet/select-visualization-controllet.html
... | ... | @@ -337,6 +337,8 @@ |
337 | 337 | this.params["aggregators"] = JSON.stringify(inputs.getAggregators()); |
338 | 338 | this.params["orders"] = JSON.stringify(inputs.getOrders()); |
339 | 339 | |
340 | + this.params["export_menu"] = "0"; | |
341 | + | |
340 | 342 | var params = this.$.options.getParams(); |
341 | 343 | for (var key in params) { this.params[key] = params[key]; } |
342 | 344 | ... | ... |
locales/controllet_ln.js
... | ... | @@ -15,6 +15,7 @@ ln["forward_en"] = "Forward"; |
15 | 15 | //SELECT DATASET |
16 | 16 | ln["listView_en"] = "LIST VIEW"; |
17 | 17 | ln["treeMapView_en"] = "TREE MAP VIEW"; |
18 | +ln["extendedSearch_en"] = "EXTENDED SEARCH"; | |
18 | 19 | ln["provider_en"] = "Provider"; |
19 | 20 | ln["showing_en"] = "Showing"; |
20 | 21 | ln["to_en"] = "to"; |
... | ... | @@ -128,6 +129,7 @@ ln["forward_it"] = "Avanti"; |
128 | 129 | //SELECT DATASET |
129 | 130 | ln["listView_it"] = "ELENCO"; |
130 | 131 | ln["treeMapView_it"] = "GRAFICO AD ALBERO"; |
132 | +ln["extendedSearch_it"] = "RICERCA ESTESA"; | |
131 | 133 | ln["provider_it"] = "Provider"; |
132 | 134 | ln["showing_it"] = "Visualizzati"; |
133 | 135 | ln["to_it"] = "a"; |
... | ... | @@ -241,6 +243,7 @@ ln["forward_fr"] = "AVANT"; |
241 | 243 | //SELECT DATASET |
242 | 244 | ln["listView_fr"] = "VUE EN LISTE"; |
243 | 245 | ln["treeMapView_fr"] = "VUE EN ARBORESCENCE"; |
246 | +ln["extendedSearch_fr"] = "EXTENDED SEARCH"; | |
244 | 247 | ln["provider_fr"] = "Provider"; |
245 | 248 | ln["showing_fr"] = "Showing"; |
246 | 249 | ln["to_fr"] = "to"; |
... | ... | @@ -354,6 +357,7 @@ ln["forward_nl"] = "VOOTUIT"; |
354 | 357 | //SELECT DATASET |
355 | 358 | ln["listView_nl"] = "LIJSTWEERGAVE"; |
356 | 359 | ln["treeMapView_nl"] = "BOOMSTRUCTUUR WEEERGAVE"; |
360 | +ln["extendedSearch_nl"] = "EXTENDED SEARCH"; | |
357 | 361 | ln["provider_nl"] = "Provider"; |
358 | 362 | ln["showing_nl"] = "Showing"; |
359 | 363 | ln["to_nl"] = "to"; | ... | ... |