# HG changeset patch # User rougeronj # Date 1354273187 -3600 # Node ID 9f7680957db8f7501d7d48a304545c0920b45349 # Parent ede3d5bcbd8bdd447a56ab596294c4267ac48f10 start integration of chunk upload diff -r ede3d5bcbd8b -r 9f7680957db8 src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html Fri Nov 16 17:35:46 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html Fri Nov 30 11:59:47 2012 +0100 @@ -14,6 +14,11 @@ + + + + + {{ content_form.media.js }} {% endblock %} @@ -59,6 +64,7 @@ + {% endblock %} @@ -108,14 +114,17 @@
' + success_label + '.
'); - $("#upload_progress_bar > div").css({ 'background': '#90ffa8' }); - window.upload_from_local_done = true; - // Now that the file is uploaded, we submit the form if asked - if(window.submit_asked==true){ - $('#my_form').submit(); - } - else{ - // We ask the uploaded media's duration - if(window.ask_duration_url){ - $.ajax({ - type: "GET", - url: window.ask_duration_url, - data: "filename="+ $('#id_media-local_file_name').val(), - cache: false, - success: function(data, status, request){ - if(data && data!=""){ - $('#id_content-duration').val(data); - } - } - }); - } - } - } - catch (ex) { - //this.debug(ex); - } - }, - file_queued_handler : displayUploadPath, - file_dialog_complete_handler: function() { - window.submit_asked = false; - this.startUpload(); - } - //upload_complete_handler: function() { this.startUpload(); }, - }); } function displayUploadPath(file) { try { @@ -544,62 +469,6 @@ //this.debug(ex); } } -function startLocalUpload(){ - swfupload.startUpload(); -} -function uploadProgress(file, bytesLoaded, bytesTotal) { - try { - var percent = Math.ceil((bytesLoaded / bytesTotal) * 100); - $("#upload_progress_bar").progressbar({ value: percent }); - } - catch (ex) { - //this.debug(ex); - } -} -function cancelSwfUpload(){ - swfupload.cancelUpload(); - if($('#media_field_upload').has($('#cancelupload')).length==0){ - $('#cancelupload').remove(); - } -} -function uploadError(file, errorCode, message) { - try { - if($('#upload_progress_info').children().size()>0){ - $('#progress_info').remove(); - } - switch (errorCode) { - case SWFUpload.UPLOAD_ERROR.HTTP_ERROR: - $('#upload_progress_info').append('' + "Error Code: HTTP Error, File name: " + file.name + ", Message: " + message + '
'); - break; - case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED: - $('#upload_progress_info').append('' + "Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message + '
'); - break; - case SWFUpload.UPLOAD_ERROR.IO_ERROR: - $('#upload_progress_info').append('' + "Error Code: IO Error, File name: " + file.name + ", Message: " + message + '
'); - break; - case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR: - $('#upload_progress_info').append('' + "Error Code: Security Error, File name: " + file.name + ", Message: " + message + '
'); - break; - case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED: - $('#upload_progress_info').append('' + "Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message + '
'); - break; - case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED: - $('#upload_progress_info').append('' + "Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message + '
'); - break; - case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED: - $('#upload_progress_info').append('' + "Error Code: FILE_CANCELLED" + '
'); - break; - case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED: - $('#upload_progress_info').append('' + "STOPPED" + '
'); - break; - default: - $('#upload_progress_info').append('' + "unhandled error: File name: " + file.name + ", File size: " + file.size + ", Message: " + message + '
'); - break; - } - } catch (ex) { - //this.debug(ex); - } -} // Test the value of the URL from the form to load a picture in case it is a youtube video function testUrlValue(e){