# HG changeset patch # User rougeronj # Date 1354549584 -3600 # Node ID 6742a569c7b5c19e4b323959428cb2f40cc185af # Parent 09d5115b977fc7d16002dd576b1b9da73a6547b8 first version of chunked_upload diff -r 09d5115b977f -r 6742a569c7b5 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 30 17:22:18 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html Mon Dec 03 16:46:24 2012 +0100 @@ -8,12 +8,15 @@ {{ block.super }} - + - + + + + {{ content_form.media.js }} {% endblock %} @@ -59,6 +62,7 @@ + {% endblock %} @@ -108,14 +112,18 @@
{{ content_form.media_input_type.errors }}{{ content_form.media_input_type.label_tag }}{{content_form.media_input_type}}
+
- {{ media_form.media_file.errors }} - {% comment %}{{ media_form.media_file.label_tag }}{{media_form.media_file}}{% endcomment %} -
- -
-
+ +
+ + + +
+ +
+
{{ media_form.external_src_url.errors }}{{ media_form.external_src_url.label_tag }}{{ media_form.external_src_url }}
{{ media_form.src.errors }}{{ media_form.src.label_tag }}{{ media_form.src }}
@@ -132,7 +140,6 @@ {% endif %} {% include "ldt/ldt_utils/partial/picture.html"%} {% include "ldt/ldt_utils/partial/permissions.html" %} -
@@ -149,4 +156,5 @@
+ {% endblock %} diff -r 09d5115b977f -r 6742a569c7b5 src/ldt/ldt/ldt_utils/urls.py --- a/src/ldt/ldt/ldt_utils/urls.py Fri Nov 30 17:22:18 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/urls.py Mon Dec 03 16:46:24 2012 +0100 @@ -75,4 +75,5 @@ url(r'^space/removetempfile/$', 'views.content.remove_temp_file'), url(r'^space/getduration/$', 'views.content.get_duration'), + url(r'^upload/$', 'views.test_upload.upload'), ) diff -r 09d5115b977f -r 6742a569c7b5 src/ldt/ldt/static/ldt/css/ldtform.css --- a/src/ldt/ldt/static/ldt/css/ldtform.css Fri Nov 30 17:22:18 2012 +0100 +++ b/src/ldt/ldt/static/ldt/css/ldtform.css Mon Dec 03 16:46:24 2012 +0100 @@ -147,7 +147,7 @@ } #media_fields_div { - width : 338px; + width : 300px; height : 50px; margin-top: 10px 0px; padding-left: 10px; diff -r 09d5115b977f -r 6742a569c7b5 src/ldt/ldt/static/ldt/js/projectscontents.js --- a/src/ldt/ldt/static/ldt/js/projectscontents.js Fri Nov 30 17:22:18 2012 +0100 +++ b/src/ldt/ldt/static/ldt/js/projectscontents.js Mon Dec 03 16:46:24 2012 +0100 @@ -460,81 +460,6 @@ $("#upload_progress_bar").css({ width:"90%", height:"10" }); $('#media_fields_div').height(80); - - // We init the swfupload object - swfupload = new SWFUpload({ - debug: false, - - upload_url: url_upload, - flash_url: media_prefix+"swf/swfupload.swf", - - post_params: post_added_params, - - button_placeholder_id: "upload_btn", - button_width: "60", - button_height: "16", - button_cursor: SWFUpload.CURSOR.HAND, - button_text : '' + btn_label + '', - button_text_style : ".btnText { font-size: 12; font-family: Arial; }", - - file_types : "*.flv;*.f4v;*.mp4;*.mov;*.mp3", - file_types_description : "Media Files (flv, f4v, mov H264, mp4, mp3)", - file_upload_limit : "1", - file_queue_limit : "1", - - upload_error_handler : uploadError, - upload_start_handler : function(file) { - try { - if($('#upload_progress_info').children().size()>0){ - $('#progress_info').remove(); - } - $('#upload_progress_info').append('

' + cancel_label + '.

'); - } - catch (ex) { - //this.debug(ex); - } - }, - upload_progress_handler : uploadProgress, - upload_success_handler : function() { - try { - if($('#upload_progress_info').children().size()>0){ - $('#progress_info').remove(); - } - $('#upload_progress_info').append('

' + 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,9 +469,6 @@ //this.debug(ex); } } -function startLocalUpload(){ - swfupload.startUpload(); -} function uploadProgress(file, bytesLoaded, bytesTotal) { try { var percent = Math.ceil((bytesLoaded / bytesTotal) * 100); @@ -562,44 +484,6 @@ $('#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){ @@ -704,3 +588,4 @@ $(checkbox_names).trigger("change"); }); } +