diff options
-rw-r--r-- | www/js/importer.js | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/www/js/importer.js b/www/js/importer.js index 6dfba76..2a96ff7 100644 --- a/www/js/importer.js +++ b/www/js/importer.js @@ -373,7 +373,21 @@ Rdxport.Upload.prototype.onmessage = function(event) { this.importFileUploadError(data.RESPONSE_CODE, data.ERROR_STRING); break; case Rdxport.Importer.TYPE_ACK: - //console.log(data); + console.log(data); + if (this.file && !this.sendingFile) { + this.sendingFile = true; + + // todo: post request goes here. + /*var command = { + LOGIN_NAME: this.username, + SESSION_ID: data.ID, + FILENAME: 'filename!', + data: self.file, + mimeTypes:"multipart/form-data" + }; + return $.post('https://import.helsinki.at/upload', command);*/ + } + this.group.fetchCarts(); this.groupView.uploadProgress(this); break; @@ -404,32 +418,6 @@ Rdxport.Upload.prototype.onmessage = function(event) { } break; } - - if (this.file && !this.sendingFile) { - this.sendingFile = true; - - var chunkSize = 60 * 1024; - var start = 0; - var end = chunkSize; - var self = this; - this.uploadInterval = setInterval(function() { - for(var i = 0; i < 16; i++) { - if (self.webSocket.bufferedAmount > 16 * chunkSize) { - return true; - } - var blob = self.file.slice(start, end, {type: "application/octet-stream"}); - self.webSocket.send(blob); - - if (self.file.size === end) { - clearInterval(self.uploadInterval); - return true; - } - start += chunkSize; - end += chunkSize; - end = end > self.file.size ? self.file.size : end; - } - }, 50); - } }; Rdxport.Upload.prototype.import = function() { @@ -463,7 +451,7 @@ Rdxport.Upload.prototype.import = function() { AUTOTRIM_LEVEL: self.group.trimlevel, USE_METADATA: self.useMetadata, REFERENCE_ID: reference - }; + }; if (self.group instanceof Rdxport.Show) { sendOptions.SHOW_ID = self.group.id; } |