diff --git a/datalets/base-datalet/base-datalet.html b/datalets/base-datalet/base-datalet.html index 8ad5e56..9099eb8 100755 --- a/datalets/base-datalet/base-datalet.html +++ b/datalets/base-datalet/base-datalet.html @@ -165,9 +165,9 @@ Example :
-
Export to HTML
-
Export to PNG
-
Export to RTF
+
Export to HTML
+
Export to PNG
+
Export to RTF
Import in My Space
@@ -337,6 +337,39 @@ Example : xhr.send(post); }, + exportRTF: function () { + var parent = this.parentElement; + while(!parent.hasAttribute("data-url")) + parent = parent.parentElement; + + + var svg = $(parent.is + " .highcharts-container"); + 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 = "datalet.rtf"; + document.body.appendChild(a); + a.click(); + //window.URL.revokeObjectURL(downloadUrl); + } + }; + + //xhr.open('POST', 'http://172.16.15.77/DEEalerProvider/DEEP/export/export-datalet-as-rtf', true); + xhr.open('POST', 'http://stage.routetopa.eu/deep/DEEP/export/export-datalet-as-rtf', true); + xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + + var post = 'svg_data=' + window.encodeURIComponent(svg) + '&datalet=' + parent.is + '&dataset=' + this.$.base_datalet_link.getAttribute("href"); + xhr.responseType = 'blob'; + xhr.send(post); + }, + importToMySpace: function() { var parent = this.parentElement; var html = '';