73bcce88
luigser
COMPONENTS
|
1
|
<!--
|
5e6ba8af
isisadmin
datalet doc update
|
2
3
4
|
@license
The MIT License (MIT)
|
94601c1f
Renato De Donato
trevieww multitable
|
5
|
Copyright (c) 2015 Dipartimento di Informatica - Universit� di Salerno - Italy
|
5e6ba8af
isisadmin
datalet doc update
|
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
|
a1f0799c
isisadmin
datalet global re...
|
24
25
|
-->
|
ae17a8dc
Luigi Serra
Controllet and da...
|
26
|
<!--
|
950d181d
Luigi Serra
license updates
|
27
28
|
* Developed by :
* ROUTE-TO-PA Project - grant No 645860. - www.routetopa.eu
|
ae17a8dc
Luigi Serra
Controllet and da...
|
29
30
31
|
*
-->
|
a1f0799c
isisadmin
datalet global re...
|
32
33
|
<link rel="import" href="../../bower_components/polymer/polymer.html">
|
25201c03
Renato De Donato
spinner, geojsonPure
|
34
35
36
|
<link rel="import" href="../../bower_components/paper-spinner/paper-spinner.html">
<link rel="import" href="../../bower_components/paper-spinner/paper-spinner-lite.html">
|
a1f0799c
isisadmin
datalet global re...
|
37
|
<!--
|
5e6ba8af
isisadmin
datalet doc update
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
The `base-datalet` is the base component that includes datalet footer (with information about dataset domain and ROUTE-TO-PA project).
Base datalet includes polymer.html and the BaseDataletBehaviors javascript file that define the datalet workcycle and the datalet base properties : dataUrl, fields and data.
Every datalet must include this one in its `<template>` section.
Example :
<dom-module id="every-datalet">
<template>
...
<base-datalet data-url="{{dataUrl}}" fields="{{fields}}"></base-datalet>
...
</template>
</dom-module>
@element base-datalet
@status v0.1
@homepage
@group datalets
|
73bcce88
luigser
COMPONENTS
|
56
|
-->
|
73bcce88
luigser
COMPONENTS
|
57
58
59
|
<dom-module id="base-datalet">
<template>
|
25201c03
Renato De Donato
spinner, geojsonPure
|
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
<style is="custom-style">
paper-spinner {
height: 64px;
width: 64px;
--paper-spinner-stroke-width: 8px;
--paper-spinner-layer-1-color: #2196F3;
--paper-spinner-layer-2-color: #F44336;;
--paper-spinner-layer-3-color: #FFEB3B;;
--paper-spinner-layer-4-color: #4CAF50;;
}
|
0f6424fe
root
update new data-s...
|
74
75
76
77
78
79
80
81
|
a {
color: #00BCD4;
text-decoration: none;
}
a:hover {
color: #2db395;
text-decoration: underline;
}
|
94601c1f
Renato De Donato
trevieww multitable
|
82
|
#base_datalet_container {
|
7487ff51
Renato De Donato
css export menu
|
83
|
position: relative;
|
94601c1f
Renato De Donato
trevieww multitable
|
84
|
font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
59100bec
Renato De Donato
localization + ba...
|
85
|
padding-top: 2px;
|
59100bec
Renato De Donato
localization + ba...
|
86
|
border-top: 2px solid #B6B6B6;
|
c94733d2
Renato De Donato
paper-card modify
|
87
|
margin-top: 8px;
|
94601c1f
Renato De Donato
trevieww multitable
|
88
89
|
}
#base_datalet_rtp {
|
94601c1f
Renato De Donato
trevieww multitable
|
90
|
display: flex;
|
59100bec
Renato De Donato
localization + ba...
|
91
|
padding-top: 4px;
|
94601c1f
Renato De Donato
trevieww multitable
|
92
|
}
|
0f6424fe
root
update new data-s...
|
93
|
#rtp {
|
94601c1f
Renato De Donato
trevieww multitable
|
94
95
|
padding-top: 8px;
padding-right: 8px;
|
c94733d2
Renato De Donato
paper-card modify
|
96
|
font-size: 12px;
|
73bcce88
luigser
COMPONENTS
|
97
|
}
|
0f6424fe
root
update new data-s...
|
98
|
#rtpalogo {
|
0b7cbd33
Renato De Donato
title-desciption
|
99
|
height: 32px;
|
94601c1f
Renato De Donato
trevieww multitable
|
100
|
width: 32px;
|
73bcce88
luigser
COMPONENTS
|
101
|
}
|
25201c03
Renato De Donato
spinner, geojsonPure
|
102
|
#base_datalet_spinner {
|
73cc8795
pina
dataset page and ...
|
103
|
width: 100%;
|
25201c03
Renato De Donato
spinner, geojsonPure
|
104
|
padding: 168px calc(50% - 32px);
|
59100bec
Renato De Donato
localization + ba...
|
105
|
}
|
0b7cbd33
Renato De Donato
title-desciption
|
106
|
|
59100bec
Renato De Donato
localization + ba...
|
107
108
109
|
#base_datalet_source_link{
padding-top: 12px;
}
|
0b7cbd33
Renato De Donato
title-desciption
|
110
111
112
113
114
115
|
#span_title{
font-size: small;
}
#span_description{
|
28265108
Renato De Donato
new link-text con...
|
116
|
font-style: italic;
|
0b7cbd33
Renato De Donato
title-desciption
|
117
118
|
color: #727272;
}
|
25201c03
Renato De Donato
spinner, geojsonPure
|
119
120
|
/*EXPORT*/
|
498cdf34
Andrea Petta
leafletjs
|
121
122
|
.export
{
|
498cdf34
Andrea Petta
leafletjs
|
123
|
position: absolute;
|
7487ff51
Renato De Donato
css export menu
|
124
125
126
127
128
129
130
131
|
right: 0px;
top: 0px;
--paper-icon-button-ink-color: #2196F3;
padding: 4px;
}
.export:hover {
color: #2196F3;
|
498cdf34
Andrea Petta
leafletjs
|
132
133
134
135
136
|
}
.highcharts-contextmenu
{
position: absolute;
|
7487ff51
Renato De Donato
css export menu
|
137
138
139
140
|
top: 4px;
right: 40px;
font-size: small;
font-size: small;
|
498cdf34
Andrea Petta
leafletjs
|
141
|
border: solid 1px #000000;
|
7487ff51
Renato De Donato
css export menu
|
142
143
|
display: none;
|
498cdf34
Andrea Petta
leafletjs
|
144
145
|
}
|
498cdf34
Andrea Petta
leafletjs
|
146
147
148
|
.highcharts-contextmenu-container div
{
cursor: pointer;
|
7487ff51
Renato De Donato
css export menu
|
149
|
padding: 0px 4px;
|
498cdf34
Andrea Petta
leafletjs
|
150
|
font-size: 11px;
|
7487ff51
Renato De Donato
css export menu
|
151
|
line-height: 15px;
|
498cdf34
Andrea Petta
leafletjs
|
152
153
154
155
|
}
.highcharts-contextmenu-container div:hover
{
|
7487ff51
Renato De Donato
css export menu
|
156
|
background: #00BCD4;
|
498cdf34
Andrea Petta
leafletjs
|
157
|
}
|
25201c03
Renato De Donato
spinner, geojsonPure
|
158
159
|
/*EXPORT*/
|
73bcce88
luigser
COMPONENTS
|
160
161
|
</style>
|
25201c03
Renato De Donato
spinner, geojsonPure
|
162
163
|
<div id="base_datalet_spinner">
<paper-spinner id="datalet_spinner" active></paper-spinner>
|
73cc8795
pina
dataset page and ...
|
164
|
</div>
|
0f6424fe
root
update new data-s...
|
165
|
|
94601c1f
Renato De Donato
trevieww multitable
|
166
|
<div id="base_datalet_container">
|
0f6424fe
root
update new data-s...
|
167
|
|
59100bec
Renato De Donato
localization + ba...
|
168
|
<div id="base_datalet_title_description">
|
0b7cbd33
Renato De Donato
title-desciption
|
169
|
<span id="span_title"><b>{{title}}</b> <span id="span_description">{{description}}</span></span>
|
59100bec
Renato De Donato
localization + ba...
|
170
171
172
|
</div>
<div id="base_datalet_source_link">
|
d8e59cbf
Andrea Petta
plugin update
|
173
|
<b>Source:</b> <a id="base_datalet_source" target="_blank"></a> <a id="base_datalet_link" target="_blank">(dataset)</a>
|
59100bec
Renato De Donato
localization + ba...
|
174
|
</div>
|
0f6424fe
root
update new data-s...
|
175
|
|
94601c1f
Renato De Donato
trevieww multitable
|
176
|
<div id="base_datalet_rtp">
|
73cc8795
pina
dataset page and ...
|
177
|
<div id="rtp">Powered by ROUTE-TO-PA</div>
|
9579b866
Renato De Donato
firefox bug fix
|
178
|
<div><a href="http://www.routetopa.eu/" target="_blank"><img id="rtpalogo" src="static/images/rtpalogo.png" ></a></div>
|
94601c1f
Renato De Donato
trevieww multitable
|
179
|
</div>
|
b4accc86
Renato De Donato
datalet improved
|
180
|
|
498cdf34
Andrea Petta
leafletjs
|
181
|
<div id="export">
|
7487ff51
Renato De Donato
css export menu
|
182
183
|
<!--<div class="export" on-click="showHideExportMenu"></div>-->
<paper-icon-button class="export" on-click="showHideExportMenu" icon="more-horiz"></paper-icon-button>
|
498cdf34
Andrea Petta
leafletjs
|
184
185
|
<div class="highcharts-contextmenu" id="highcharts-contextmenu">
<div class="highcharts-contextmenu-container">
|
fb1e71b5
Andrea Petta
plugin update
|
186
187
188
|
<div id="export_html" on-click="exportToHTML">Export to HTML</div>
<div id="export_png" on-click="exportToIMG">Export to PNG</div>
<div id="export_rtf" on-click="exportRTF">Export to RTF</div>
|
498cdf34
Andrea Petta
leafletjs
|
189
190
191
192
193
|
<div id="export_my_space" on-click="importToMySpace">Import in My Space</div>
</div>
</div>
</div>
|
94601c1f
Renato De Donato
trevieww multitable
|
194
195
|
</div>
|
73bcce88
luigser
COMPONENTS
|
196
197
|
</template>
|
4e7eacf4
Luigi Serra
Controllets and d...
|
198
199
|
<script src="static/js/BaseDataletBehavior.js"></script>
<script src="static/js/WorkcycleBehavior.js"></script>
|
73bcce88
luigser
COMPONENTS
|
200
201
202
203
|
<script>
BaseDatalet = Polymer({
is: 'base-datalet',
|
3c812cc9
Renato De Donato
title-desciption ...
|
204
|
|
5e6ba8af
isisadmin
datalet doc update
|
205
|
/**
|
21107197
Andrea Petta
test
|
206
|
*
|
7be24196
Renato De Donato
test2
|
207
|
* It is called after the element's template has been stamped and all elements inside the element's local
|
5e6ba8af
isisadmin
datalet doc update
|
208
209
210
|
* DOM have been configured (with values bound from parents, deserialized attributes, or else default values)
* and had their ready method called.
*
|
73cc8795
pina
dataset page and ...
|
211
212
213
214
|
* Extract
* 1) the dataset domain
* 2) the page of a datalet
* from the entire URL and set the text content of the datalet footer.
|
5e6ba8af
isisadmin
datalet doc update
|
215
|
* @method ready
|
5e6ba8af
isisadmin
datalet doc update
|
216
|
*/
|
73bcce88
luigser
COMPONENTS
|
217
|
ready: function(){
|
498cdf34
Andrea Petta
leafletjs
|
218
219
220
|
this.setExportMenu();
|
59100bec
Renato De Donato
localization + ba...
|
221
|
if(this.dataUrl != undefined) {
|
0f6424fe
root
update new data-s...
|
222
|
|
59100bec
Renato De Donato
localization + ba...
|
223
224
225
|
var urlSource = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2];
this.$.base_datalet_source.innerHTML = urlSource;
this.$.base_datalet_source.setAttribute("href", urlSource);
|
73cc8795
pina
dataset page and ...
|
226
|
|
73cc8795
pina
dataset page and ...
|
227
|
|
59100bec
Renato De Donato
localization + ba...
|
228
229
230
|
//OpenDataSoft check
if(this.dataUrl.indexOf("/records/") > -1 )
{
|
8c25f3d6
Renato De Donato
issy
|
231
232
233
234
235
236
237
|
var i;
if(this.dataUrl.indexOf("&") > -1)
i = this.dataUrl.indexOf("&");
else
i = this.dataUrl.length;
this.$.base_datalet_link.setAttribute("href", urlSource + "/explore/dataset/" + this.dataUrl.substring(this.dataUrl.indexOf("=")+1, i));
|
59100bec
Renato De Donato
localization + ba...
|
238
|
}
|
2b65b828
isisadmin
base datalet fix
|
239
240
|
// CKAN
else if(this.dataUrl.indexOf("datastore_search?resource_id") > -1 )
|
59100bec
Renato De Donato
localization + ba...
|
241
|
{
|
2b65b828
isisadmin
base datalet fix
|
242
243
244
245
246
247
248
249
|
var comp = this;
$.ajax({
url: this.dataUrl.replace("datastore_search?resource_id", "resource_show?id"),
dataType: "json",
success: function(e){
comp.$.base_datalet_link.setAttribute("href", urlSource + "/dataset/" + e.result.package_id + "/resource/" + e.result.id);
}
});
|
59100bec
Renato De Donato
localization + ba...
|
250
|
}
|
dc922151
Andrea Petta
plugin update
|
251
252
253
254
|
else
{
this.$.base_datalet_link.style.display = 'none';
}
|
6cf27113
pina
add link dataset ...
|
255
|
}
|
b4190b56
Renato De Donato
myspace update
|
256
257
258
|
else {
this.hideFooter();
|
256ece27
Renato De Donato
new controllet
|
259
|
// this.$.base_datalet_spin.remove();
|
b4190b56
Renato De Donato
myspace update
|
260
|
}
|
035bbee3
Luigi Serra
Datalets and cont...
|
261
|
},
|
17da8e08
Renato De Donato
hidden preview da...
|
262
|
|
035bbee3
Luigi Serra
Datalets and cont...
|
263
264
265
|
/**
* Set the domain url to show in the footer
*/
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
266
267
268
|
// setDomain: function(url){
// this.$.domain.textContent = url;
// },
|
17da8e08
Renato De Donato
hidden preview da...
|
269
|
|
71ed2ed2
Renato De Donato
redraw
|
270
|
removeLoader: function() {
|
25201c03
Renato De Donato
spinner, geojsonPure
|
271
272
|
this.$.base_datalet_spinner.style.display = "none";
this.$.datalet_spinner.active = false;
|
71ed2ed2
Renato De Donato
redraw
|
273
274
|
},
|
17da8e08
Renato De Donato
hidden preview da...
|
275
276
|
hideFooter: function() {
this.$.base_datalet_container.innerHTML = "";
|
c94733d2
Renato De Donato
paper-card modify
|
277
|
this.$.base_datalet_container.style.margin = 0;
|
17da8e08
Renato De Donato
hidden preview da...
|
278
|
this.$.base_datalet_container.style.border = 0;
|
34789a0e
Renato De Donato
jsdatachecker ln,...
|
279
|
this.removeLoader();
|
498cdf34
Andrea Petta
leafletjs
|
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
},
setExportMenu: function()
{
// xxxx BITMASK. FROM RIGHT : HTML, PNG, RTF, MY SPACE (eg. 1111 show all, 0000 hide all)
var bitmask = this.export_menu;
var menu = ["export_html", "export_png", "export_rtf", "export_my_space"];
if(bitmask == 15) return;
if(bitmask == 0)
{
this.$.export.style.display = "none";
return;
}
//var max_i = Math.floor(Math.log2(this.export_menu))+1;
for(var i=0; i<menu.length; i++)
{
if(bitmask % 2 == 0)
this.$[menu[i]].style.display = "none";
bitmask = Math.floor(bitmask/2);
}
},
showHideExportMenu: function()
{
if(this.$["highcharts-contextmenu"].style.display == "block")
this.$["highcharts-contextmenu"].style.display = "none";
else
this.$["highcharts-contextmenu"].style.display = "block";
},
exportToHTML: function () {
var parent = this.parentElement;
var html = '';
while(!parent.hasAttribute("data-url"))
parent = parent.parentElement;
html += '<'+parent.is;
for(var i=0; i<parent.attributes.length; i++)
html += ' '+parent.attributes[i].name+'=\''+parent.attributes[i].value+'\'';
html += '></'+parent.is+'>';
var dataletImport = '\<script type="text/javascript" src="https://cdn.jsdelivr.net/webcomponentsjs/0.7.16/webcomponents-lite.min.js"\>\<\/script\>\n' +
'\<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"\>\<\/script\>\n' +
'<!-- REMOVE THE PREVIOUS SCRIPT TAGS IF YOUR PAGE ALREADY USES JQUERY AND POLYFILL LIBRARIES -->\n';
|
9a8ed768
Renato De Donato
last push?
|
329
|
var dataletLink = '<link rel="import" href="http://deep.routetopa.eu/deep_1_7/COMPONENTS/datalets/'+parent.is+'/'+parent.is+'.html" /> \n';
|
498cdf34
Andrea Petta
leafletjs
|
330
331
332
333
|
window.prompt("Copy to clipboard: Ctrl+C, Enter", dataletImport+dataletLink+html);
},
|
498cdf34
Andrea Petta
leafletjs
|
334
335
336
337
338
339
|
exportToIMG: function () {
var parent = this.parentElement;
while(!parent.hasAttribute("data-url"))
parent = parent.parentElement;
|
f81cb81f
Andrea Petta
plugin update
|
340
|
var svg = $(parent).find(".highcharts-container");
|
498cdf34
Andrea Petta
leafletjs
|
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
|
svg = $(svg[0]).html();
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if (this.readyState == 4 && this.status == 200){
var blob = new Blob([this.response], {type:'octet/stream'});
var downloadUrl = window.URL.createObjectURL(blob);
var a = document.createElement("a");
a.href = downloadUrl;
a.download = "image.png";
document.body.appendChild(a);
a.click();
//window.URL.revokeObjectURL(downloadUrl);
}
};
|
dc2827bb
Andrea Petta
leafletjs
|
358
|
//xhr.open('POST', 'http://172.16.15.77/DEEalerProvider/DEEP/export/export-datalet-as-img', true);
|
f34f2cd6
Andrea Petta
plugin update
|
359
|
//xhr.open('POST', 'http://stage.routetopa.eu/deep/DEEP/export/export-datalet-as-img', true);
|
a0bae62a
Andrea Petta
plugin update
|
360
|
xhr.open('POST', 'http://deep.routetopa.eu/deep_1_6/DEEP/export/export-datalet-as-img', true);
|
498cdf34
Andrea Petta
leafletjs
|
361
362
363
364
365
366
367
|
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
var post = 'svg_data=' + window.encodeURIComponent(svg);
xhr.responseType = 'blob';
xhr.send(post);
},
|
fb1e71b5
Andrea Petta
plugin update
|
368
|
exportRTF: function () {
|
30a8fe36
Andrea Petta
plugin update
|
369
370
|
var t = this;
|
fb1e71b5
Andrea Petta
plugin update
|
371
372
373
374
|
var parent = this.parentElement;
while(!parent.hasAttribute("data-url"))
parent = parent.parentElement;
|
30a8fe36
Andrea Petta
plugin update
|
375
376
377
|
var post_id = parent.parentElement.id.match(/\d+/); post_id = post_id ? post_id[0] : "";
var datalet_id = $(parent).parents().eq(3).attr("datalet-id") ? $(parent).parents().eq(3).attr("datalet-id") : "";
var isPublicRoom = (typeof SPODPUBLICROOM != 'undefined') ? true : false;
|
fb1e71b5
Andrea Petta
plugin update
|
378
|
|
f81cb81f
Andrea Petta
plugin update
|
379
|
var svg = $(parent).find(".highcharts-container");
|
fb1e71b5
Andrea Petta
plugin update
|
380
381
382
383
|
svg = $(svg[0]).html();
var xhr = new XMLHttpRequest();
|
30a8fe36
Andrea Petta
plugin update
|
384
385
386
387
388
|
$.ajax({
url: ODE.get_datalet_info,
data: {"post_id" : post_id, "datalet_id" : datalet_id, "is_public_room" : isPublicRoom},
dataType: "json",
success: function(e){
|
a0bae62a
Andrea Petta
plugin update
|
389
|
//xhr.open('POST', 'http://172.16.15.77/DEEalerProvider/DEEP/export/export-datalet-as-rtf', true);
|
30a8fe36
Andrea Petta
plugin update
|
390
|
//xhr.open('POST', 'http://stage.routetopa.eu/deep/DEEP/export/export-datalet-as-rtf', true);
|
a0bae62a
Andrea Petta
plugin update
|
391
|
xhr.open('POST', 'http://deep.routetopa.eu/deep_1_6/DEEP/export/export-datalet-as-rtf', true);
|
30a8fe36
Andrea Petta
plugin update
|
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
|
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
var post = 'svg_data=' + window.encodeURIComponent(svg) + '&datalet=' + parent.is + '&dataset=' + t.$.base_datalet_link.getAttribute("href");
post += '&user=' + e.user + '×tamp=' + e.timestamp + '&comment=' + (e.comment ? e.comment : "");
xhr.responseType = 'blob';
//OpenDataSoft check
if(t.dataUrl.indexOf("/records/") > -1)
{
var urlSource = t.dataUrl.split("/")[0] + "//" + t.dataUrl.split("/")[2];
var i;
if(t.dataUrl.indexOf("&") > -1)
i = t.dataUrl.indexOf("&");
else
i = t.dataUrl.length;
$.ajax({
url: urlSource + "/api/dataset/1.0/" + t.dataUrl.substring(t.dataUrl.indexOf("=")+1, i),
dataType: "json",
success: function(e){
post += '&name=' + e.metas.title + '&description=' + e.metas.description + '&created=' + e.metas.data_processed + '&lastModified=' + e.metas.modified;
xhr.send(post);
}
});
}
else if(t.dataUrl.indexOf("datastore_search?resource_id") > -1 )
{
$.ajax({
url: t.dataUrl.replace("datastore_search?resource_id", "resource_show?id"),
dataType: "json",
success: function(e){
post += '&name=' + e.result.name + '&description=' + e.result.description + '&created=' + e.result.created + '&format=' + e.result.format + '&lastModified=' + e.result.last_modified;
xhr.send(post);
}
});
}
else
{
xhr.send(post);
}
}
});
|
fb1e71b5
Andrea Petta
plugin update
|
438
439
440
441
442
443
444
445
446
447
448
449
|
xhr.onreadystatechange = function(){
if (this.readyState == 4 && this.status == 200){
var blob = new Blob([this.response], {type:'octet/stream'});
var downloadUrl = window.URL.createObjectURL(blob);
var a = document.createElement("a");
a.href = downloadUrl;
a.download = "datalet.rtf";
document.body.appendChild(a);
a.click();
//window.URL.revokeObjectURL(downloadUrl);
}
};
|
fb1e71b5
Andrea Petta
plugin update
|
450
451
|
},
|
498cdf34
Andrea Petta
leafletjs
|
452
453
454
455
456
457
458
459
460
461
462
463
464
465
|
importToMySpace: function() {
var parent = this.parentElement;
var html = '';
while(!parent.hasAttribute("data-url"))
parent = parent.parentElement;
var params = {};
var fields;
var component = parent.is;
for(var i=0; i<parent.attributes.length; i++)
params[parent.attributes[i].name] = parent.attributes[i].value;
delete params["fields"];
|
ba359dd6
Andrea Petta
plugin update
|
466
467
|
delete params["data"];
|
498cdf34
Andrea Petta
leafletjs
|
468
469
470
471
472
473
474
475
476
477
478
|
fields = parent.attributes["fields"].value.replace(/\[|\]/g, "");
params = JSON.stringify(params);
$.ajax({
type: 'post',
url: ODE.ajax_private_room_datalet,
data: {"component":component, "fields":fields, "params":params, "data":""},
dataType: 'JSON',
success: function(data){
if(data.status == "ok")
{
|
f7f73c85
Andrea Petta
plugin update
|
479
|
alert("Datalet added to Myspace");
|
498cdf34
Andrea Petta
leafletjs
|
480
481
482
483
484
485
486
487
488
489
490
|
}
else
{
alert("Error");
}
},
error: function( XMLHttpRequest, textStatus, errorThrown ){
OW.error(textStatus);
},
complete: function(){}
});
|
17da8e08
Renato De Donato
hidden preview da...
|
491
|
}
|
498cdf34
Andrea Petta
leafletjs
|
492
|
|
2b65b828
isisadmin
base datalet fix
|
493
|
});
|
73bcce88
luigser
COMPONENTS
|
494
495
|
</script>
</dom-module>
|