# HG changeset patch # User rougeronj # Date 1360856247 -3600 # Node ID 5bb3aec02883b8faf1d3a9ecdcf2109b0709113d # Parent 7ef5c69b73b363d3e4cba382fcd4d743136b462f# Parent 38afc7be4a886c9cdfe7a76abd5102488f25be8e Merge with 38afc7be4a886c9cdfe7a76abd5102488f25be8e (chunked_upload) diff -r 7ef5c69b73b3 -r 5bb3aec02883 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 Thu Feb 14 16:34:33 2013 +0100 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html Thu Feb 14 16:37:27 2013 +0100 @@ -10,12 +10,12 @@ {{ block.super }} - + + - {{ content_form.media.js }} {% endblock %} @@ -29,26 +29,50 @@ post_added_params = {"csrfmiddlewaretoken" : "{{csrf_token}}", "{{cookie_name}}" : "{{session_key}}"}; - onCreateContentReady("{% url ldt.ldt_utils.views.content.upload %}", - '{% absstatic "ldt" %}', - post_added_params, - '{% trans "Browse" %}', - '{% trans "File uploaded" %}', - '{% trans "Please wait, the upload is not finished yet" %}', - '{% trans "Cancel upload" %}', - "{% url ldt.ldt_utils.views.content.remove_temp_file %}", - "{% url ldt.ldt_utils.views.content.get_duration %}"); - + onCreateContentReady('{% absstatic "ldt" %}', post_added_params); }); // the function stopRKey prevents from the validation of the form if the user tape enter button while entering a field function stopRKey(evt) { var evt = (evt) ? evt : ((event) ? event : null); var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if ((evt.keyCode == 13) && (node.type=="text")) {return false;} - } + } document.onkeypress = stopRKey; + chunked_uploads_endpoints = { + upload_url: '{{WEB_URL}}{% url upload %}', + done_url: '{{WEB_URL}}{% url upload_done uuid='00000000-0000-0000-0000-000000000000' %}', + }; + + $(function() { + //gets video_url and returns it to the "scr" field + chunked_uploads_video_url = function(video_url) { + $('#id_content-media_input_type').val("create"); + $('#id_media-src').val(video_url); + $('#id_media-src').attr('readOnly', true); + $(".media_fields").hide(); + $("#media_field_create").show(); + $('#upload_url').append(video_url); + }; + + //callback of chunked upload start + chunked_uploads_start = function(){ + }; + + //callback of chunked upload stop + chunked_uploads_stop = function(){ + }; + + //callback of chunked upload error + chunked_uploads_error = function(){ + alert("The upload failed. Please reload the page, and try again."); + }; + + //callback of chunked upload complete + chunked_uploads_complete = function(){ + }; + }); {% endblock %} @@ -60,7 +84,7 @@ - + {% endblock %} @@ -114,15 +138,14 @@