summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2014-02-27 12:12:26 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2014-02-27 12:12:26 (GMT)
commitd931bebecdc5473223317a863bd23cf0fab2bd77 (patch)
tree72a87a04dc842fb1026dce9433da66e4becca522
parent1589c2c09283cb7721cc6e426113b07b1d163343 (diff)
downloadcom_zimbra_emaildownloader-d931bebecdc5473223317a863bd23cf0fab2bd77.zip
com_zimbra_emaildownloader-d931bebecdc5473223317a863bd23cf0fab2bd77.tar.gz
com_zimbra_emaildownloader-d931bebecdc5473223317a863bd23cf0fab2bd77.tar.bz2
change extension to upload message via xmlhttprequest
-rw-r--r--emaildownloader.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/emaildownloader.js b/emaildownloader.js
index 634b1f0..9a4841f 100644
--- a/emaildownloader.js
+++ b/emaildownloader.js
@@ -89,6 +89,30 @@ function(droppedItem) {
url[i++] = "&filename=ZimbraItems";
var getUrl = url.join("");
+
+ var oReq = new XMLHttpRequest();
+ oReq.open("GET", getUrl, true);
+ oReq.responseType = "blob";
+
+ oReq.onload = function(oEvent) {
+ var blob = oReq.response;
+ /* needs Access-Control-Allow-Origin: * header on the server */
+ var postUrl = 'http://test.ged.pfwb.be/@@importZimbra';
+
+ var sendReq = new XMLHttpRequest();
+ sendReq.open("PUT", postUrl, true);
+ sendReq.onload = function (oEvent) {
+ // Uploaded.
+ alert('done');
+ };
+
+ sendReq.send(blob);
+ };
+
+ oReq.send();
+
+
+
window.open(getUrl, "_blank");
};
@@ -96,4 +120,4 @@ EmailDownloaderZimlet.prototype._getMsgIdsFromConv =
function(convSrcObj) {
convSrcObj.load();
return convSrcObj.msgIds;
-}; \ No newline at end of file
+};