From 2d84b2269e85e1ab101a0640a288d67b8215b348 Mon Sep 17 00:00:00 2001 From: Sanj Date: Thu, 11 Oct 2012 04:39:27 +0530 Subject: [PATCH] oops --- itf/static/js/upload/edgeUpload.js | 163 ----------------------------- 1 file changed, 163 deletions(-) delete mode 100644 itf/static/js/upload/edgeUpload.js diff --git a/itf/static/js/upload/edgeUpload.js b/itf/static/js/upload/edgeUpload.js deleted file mode 100644 index f082c17..0000000 --- a/itf/static/js/upload/edgeUpload.js +++ /dev/null @@ -1,163 +0,0 @@ -// vi:si:et:sw=2:sts=2:ts=2 - - - - -function doProgress(progress) { - var status = progress.status; - var progress = progress.progress; - //do something with status and progress, i.e. set progressbar width: - $('#progress').css('width', parseInt(progress*100, 10) +'%'); - $('#progressstatus').html(parseInt(progress*100, 10) + '% - ' + status); -} - - - - - -var UploadQueue = function() { - var that = this; - this.allFiles = []; - this.isUploading = false; - this.$list = $('#filesList'); - this.$progress = $('#progressbar'); - this.len = function() { - return this.allFiles.length; - }; - this.getLi = function(no) { - return this.$list.children('li').eq(no); - } - this.init(); -} - -UploadQueue.prototype.init = function() { -// $('#progressbar').show(); - $('#progressbar').width(200).height(20); -// $('#progressbar').css('background-color', '#80ADB0'); - $('#progressbar').html('
uploading
'); -} - -/* param f = file */ -UploadQueue.prototype.getData = function(f) { - return { - 'firefogg': 1, - 'name': f.name, - 'category': $('#files_category').val() - }; -}; - - -UploadQueue.prototype.uploadNext = function() { - -}; - - -UploadQueue.prototype.addFile = function(f) { - for (var i=0; i').data("file", f).text(f.name).appendTo(that.$list); -}; - -UploadQueue.prototype.markDone = function(no, data) { - $('.uploading').removeClass("uploading"); - var $li = this.getLi(no); - $li.addClass("uploaded"); - fileUploadedCallback($li, data); - if (this.len() > (no + 1)) { - this.upload(no + 1); - } else { - this.isUploading = false; - $('#progressbar').hide(); - } -}; - -UploadQueue.prototype.upload = function(no) { - var that = this; - var fil = this.allFiles[no]; -// console.log("uploading", fil); - var data = this.getData(fil); - var $li = this.getLi(no); - this.isUploading = true; - $('#progressbar').show(); - $li.addClass("uploading"); - var ogg = ChunkUploader({ - 'file': fil, - 'url': add_url, - 'data': data, - 'callback': function(response) { - var data = JSON.parse(response.responseText); - //console.log("data", data); - if (data.resultUrl) { - that.markDone(no, response); - } else { - $('#progressbar').html(response.status); - } - }, - 'progress': doProgress - }); - /* - ogg = FirefoggUploader(fil, add_url, data, function(ogg) { - if (ogg.resultUrl) { - that.markDone(no, ogg); - } else { - $('#progressbar').html(ogg.status); - } - }, doProgress); - */ -}; - -function fileUploadedCallback(jq, data) { -// alert("hi"); -// console.log(data); - - var d = JSON.parse(data.responseText); -// console.log("dd", d) - var fileId = d.fileId; - jq.data("fileId", fileId); - if (d.hasOwnProperty("errors")) { - var $error = $('
').addClass("fileError").text(data.errors[0]).appendTo(jq); - } else { - var $formContainer = $('
').addClass("fileForm"); -// var $title = $('
').addClass("formHelp").text("Add Description").appendTo($formContainer); -// console.log(data); - var $titleInput = $('').attr("type", "text").addClass("fileTitle").val(d.title); -// console.log($titleInput); - $titleInput.appendTo($formContainer); - var $descInput = $('