Commit a55fd02c4057b018f64cc595bf12d1b8330d7adf
1 parent
2d6ef548
plugin update
Showing
1 changed file
with
37 additions
and
1 deletions
datalets/base-datalet/base-datalet.html
... | ... | @@ -367,7 +367,43 @@ Example : |
367 | 367 | |
368 | 368 | var post = 'svg_data=' + window.encodeURIComponent(svg) + '&datalet=' + parent.is + '&dataset=' + this.$.base_datalet_link.getAttribute("href"); |
369 | 369 | xhr.responseType = 'blob'; |
370 | - xhr.send(post); | |
370 | + | |
371 | + //OpenDataSoft check | |
372 | + if(this.dataUrl.indexOf("/records/") > -1 ) | |
373 | + { | |
374 | + var urlSource = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2]; | |
375 | + | |
376 | + var i; | |
377 | + if(this.dataUrl.indexOf("&") > -1) | |
378 | + i = this.dataUrl.indexOf("&"); | |
379 | + else | |
380 | + i = this.dataUrl.length; | |
381 | + | |
382 | + $.ajax({ | |
383 | + url: urlSource + "/api/dataset/1.0/" + this.dataUrl.substring(this.dataUrl.indexOf("=")+1, i), | |
384 | + dataType: "json", | |
385 | + success: function(e){ | |
386 | + post += '&name=' + e.metas.title + '&description=' + e.metas.description + '&created=' + e.metas.data_processed + '&lastModified=' + e.metas.modified; | |
387 | + xhr.send(post); | |
388 | + } | |
389 | + }); | |
390 | + } | |
391 | + else if(this.dataUrl.indexOf("datastore_search?resource_id") > -1 ) | |
392 | + { | |
393 | + $.ajax({ | |
394 | + url: this.dataUrl.replace("datastore_search?resource_id", "resource_show?id"), | |
395 | + dataType: "json", | |
396 | + success: function(e){ | |
397 | + post += '&name=' + e.result.name + '&description=' + e.result.description + '&created=' + e.result.created + '&format=' + e.result.format + '&lastModified=' + e.result.last_modified; | |
398 | + xhr.send(post); | |
399 | + } | |
400 | + }); | |
401 | + } | |
402 | + else | |
403 | + { | |
404 | + xhr.send(post); | |
405 | + } | |
406 | + | |
371 | 407 | }, |
372 | 408 | |
373 | 409 | importToMySpace: function() { | ... | ... |