diff --git a/upload/actions/file_uploader.php b/upload/actions/file_uploader.php index 67818cc6f..fac64d810 100644 --- a/upload/actions/file_uploader.php +++ b/upload/actions/file_uploader.php @@ -167,8 +167,8 @@ $vid = $Upload->submit_upload($vidDetails); if (!$vid) { - echo json_encode(['success' => 'no', 'file_name' => $filename_without_ext]); - exit(); + upload_error($eh->get_error()[0]['val']); + exit(0); } $Upload->add_conversion_queue($targetFileName); diff --git a/upload/changelog/550.json b/upload/changelog/550.json index cf872aa70..87207bb76 100644 --- a/upload/changelog/550.json +++ b/upload/changelog/550.json @@ -1,6 +1,6 @@ { "version":"5.5.0", - "revision":"327", + "revision":"328", "status":"dev", "detail":[ { @@ -259,6 +259,7 @@ ,"Fix disabled sections privacy" ,"Implement channels comments" ,"Fix sitemap & phpinfo privacy" + ,"Implement video & photo multi-upload #319 (Thanks @Kenmeiyoki !)" ] } ,{ diff --git a/upload/styles/cb_28/theme/js/pages/photo_upload/photo_upload.js b/upload/styles/cb_28/theme/js/pages/photo_upload/photo_upload.js index 2a50ca27d..b69a6069f 100644 --- a/upload/styles/cb_28/theme/js/pages/photo_upload/photo_upload.js +++ b/upload/styles/cb_28/theme/js/pages/photo_upload/photo_upload.js @@ -185,21 +185,20 @@ uploader.init(); uploader.bind('FilesAdded', function(up, uploadedFiles) { - for(var i = 0; i < uploadedFiles.length; i++){ + for(let i = 0; i < uploadedFiles.length; i++){ files.push(uploadedFiles[i]); + uploadedFiles[i].data = []; + uploadedFiles[i].data.photo_title = uploadedFiles[0].name; + uploadedFiles[i].data.photo_description = uploadedFiles[0].name; + uploadedFiles[i].data.photo_tags = ''; + uploadedFiles[i].data.collection_id = $('#collectionSelection').val(); + uploadedFiles[i].data.allow_comments = 'yes'; + uploadedFiles[i].data.allow_embedding = 'yes'; + uploadedFiles[i].data.allow_rating = 'yes'; + uploadedFiles[i].data.photoThumb = ''; + uploadedFiles[i].data.photo_id = 0; } - uploadedFiles[0].data = []; - uploadedFiles[0].data.photo_title = uploadedFiles[0].name; - uploadedFiles[0].data.photo_description = uploadedFiles[0].name; - uploadedFiles[0].data.photo_tags = ''; - uploadedFiles[0].data.collection_id = $('#collectionSelection').val(); - uploadedFiles[0].data.allow_comments = 'yes'; - uploadedFiles[0].data.allow_embedding = 'yes'; - uploadedFiles[0].data.allow_rating = 'yes'; - uploadedFiles[0].data.photoThumb = ''; - uploadedFiles[0].data.photo_id = 0; - reFreshTabs(up); // functions added diff --git a/upload/styles/cb_28/theme/js/pages/photo_upload/photo_upload.min.js b/upload/styles/cb_28/theme/js/pages/photo_upload/photo_upload.min.js index ddd4c7935..491cd6e82 100644 --- a/upload/styles/cb_28/theme/js/pages/photo_upload/photo_upload.min.js +++ b/upload/styles/cb_28/theme/js/pages/photo_upload/photo_upload.min.js @@ -1 +1 @@ -var window;window,$(document).ready(function(){$.get(theme+"/js/plupload/js/plupload.full.min.js",function(e){var a=[],t=new plupload.Uploader({browse_button:"selectFiles",runtimes:"html5,flash,silverlight,html4",url:uploadScriptPath,dragdrop:!0,drop_element:"dragDrop",max_file_size:max_upload_size+"Mb",filters:{mime_types:[{title:"Image files",extensions:photo_extensions},]}});t.init(),t.bind("FilesAdded",function(e,o){for(var l,n,s,i,d,r,c,p,h=0;h'+t+'
70% Complete50% completed
')}),$(".cancel_button").on("click",function(e){e.preventDefault();var a=$(this).attr("to_cancel"),l=0;$(this).attr("disabled",!0),$(this).text("Canceled"),$.each(o,function(e,n){n.id===a&&(t.removeFile(o[l]),$(this).unbind().remove(),$(".progress-bar_"+a).addClass("progress-bar-danger"),$(".realProgText_"+a).text("Canceled"),$("li#"+l).fadeOut("slow"),totalFiles-=1),l++})}),t.bind("UploadProgress",function(e,a){var t=a.id,o=a.percent;$(".progress-bar_"+t).css("width",o+"%"),$(".realProgText_"+t).text(o+"% Completed"),100==o&&($(".cancel_button[to_cancel='"+t+"']").fadeOut("slow"),$(".progress-bar_"+t).addClass("progress-bar-success"))}),setTimeout(function(){$(".upload-area").addClass("hidden"),$(".form_header").addClass("hidden"),$("#uploadDataContainer").removeClass("hidden"),$(".uploadingProgressContainer").removeClass("hidden"),$("#uploadedFilesInfo").text("Uploaded 0 of "+a.length),$(".allProgress").removeClass("hidden"),t.start()},1e3),$("#allUploadForms").css("display","block")}),t.bind("BeforeUpload",function(){$("#fileUploadProgress").removeClass("hidden"),$(".progress-container").removeClass("hidden")});var o=0;t.bind("UploadProgress",function(e,a){$("#progressNumber").text(a.percent+"%"),$("#videoNumber").text(a.name)}),t.bind("FileUploaded",function(e,t,l){$("#overallProgress").css("width",100/a.length*++o+"%"),$("#overallProgress").parents(".row").find("#uploadedFilesInfo").text("Uploaded "+o+" of "+a.length);var n,s=$.parseJSON(l.response);n=collection_id||$("#SelectionDIV select").val();var i=0,d=0;plupload.each(e.files,function(e){i++,e.id===t.id&&(d=i)}),$.ajax({url:"/actions/photo_uploader.php",type:"post",data:{insertPhoto:"yes",title:t.name,file_name:s.file_name,collection_id:n,ext:s.extension,photo_title:t.name,photo_description:t.name,photo_tags:""},dataType:"JSON",success:function(e){var a=document.createElement("input");a.name="photo_id",a.type="hidden",a.value=e.photoID,$("#tab"+d+" form").append(a),$("#tab"+d+" form").find(".edit-img-thumbnail > img").prop("src",e.photoPreview),$("#tab"+d+" .savePhotoDetails").removeAttr("disabled"),t.data.photoThumb=e.photoPreview,t.data.photo_id=e.photoID}})}),t.bind("UploadComplete",function(e,a){$("#fileUploadProgress").addClass("hidden"),$("#uploadMore").removeClass("hidden"),$(".uploadingProgressContainer").addClass("hidden"),t.refresh(),$("#uploadMessage").html("All Files are uploaded Successfully").attr("class","alert alert-success container"),setTimeout(function(){$("#uploadMessage").addClass("hidden")},5e3)}),t.bind("error",function(e,a){$("#uploadMessage").removeClass("hidden"),a&&$("#uploadMessage").html(a.message).attr("class","alert alert-danger container"),setTimeout(function(){$("#uploadMessage").addClass("hidden")},8e3)}),$("#addNewCollection").on({click:function(e){e.preventDefault();var a=$(this).parents("form").serialize();a+="&mode=add_collection";var t=$(this).parents("form").find("#collection_name").val();$.ajax({type:"post",url:"/ajax.php",data:a,success:function(e){if(null===(e=$.parseJSON(e)).err||void 0===e.err){var a=document.createElement("option");a.value=parseInt(e.id),a.innerHTML=t,a.selected=!0,$("select[name='collection_id']").get(0).appendChild(a),$("#collectionSelection").get(0).appendChild(a.cloneNode(!0)),$("#collectionSelection option").last().attr("selected","selected"),$("#uploadMessage").html(e.msg).attr("class","alert alert-success container").removeClass("hidden"),$("#CollectionDIV").toggle("fast"),$(".form_header").show(),$(".upload-area").show(),$("#collectionSelection").parent().show(),$("#SelectionDIV").find(".alert-danger").hide(),setTimeout(function(){$("#uploadMessage").addClass("hidden")},5e3)}else e.err,$("#uploadMessage").html(e.err).attr("class","alert alert-danger container").removeClass("hidden"),setTimeout(function(){$("#uploadMessage").addClass("hidden")},5e3)}})}}),$("#createNewCollection").on({click:function(e){e.preventDefault(),$("#CollectionDIV").toggle("fast").find("form")[0].reset(),$(".tagit li:not(.tagit-new)").remove(),$(".form_header").hide(),$(".upload-area").hide()}}),$("#cancelAddCollection").on({click:function(e){e.preventDefault(),$("#CollectionDIV").toggle("fast"),$(".form_header").show(),$(".upload-area").show()}}),$("#selectedFilesList a").on({click:function(e){e.preventDefault(),$(this).tab("show")}}),$("#SelectionDIV select").on({change:function(e){var a=$("#collectionId");if(a)$(a).val(this.value);else{var t=document.createElement("input");t.type="hidden",t.name="collection_id",t.value=this.value,$("#allUploadForms form").each(function(e,a){$(a).get(0).appendChild(t)})}}}),$("#uploadMorePhotos").on({click:function(e){e.preventDefault(),$(".upload-area").removeClass("hidden"),$(".form_header").removeClass("hidden"),$("#uploadDataContainer").addClass("hidden")}})}),init_tags("collection_tags",available_collection_tags)}); +window,$(document).ready(function(){$.get(theme+"/js/plupload/js/plupload.full.min.js",function(e){var u=[],m=new plupload.Uploader({browse_button:"selectFiles",runtimes:"html5,flash,silverlight,html4",url:uploadScriptPath,dragdrop:!0,drop_element:"dragDrop",max_file_size:max_upload_size+"Mb",filters:{mime_types:[{title:"Image files",extensions:photo_extensions}]}});m.init(),m.bind("FilesAdded",function(e,l){for(let e=0;e'+t+'
70% Complete50% completed
')}),$(".cancel_button").on("click",function(e){e.preventDefault();var t=$(this).attr("to_cancel"),o=0;$(this).attr("disabled",!0),$(this).text("Canceled"),$.each(l,function(e,a){a.id===t&&(m.removeFile(l[o]),$(this).unbind().remove(),$(".progress-bar_"+t).addClass("progress-bar-danger"),$(".realProgText_"+t).text("Canceled"),$("li#"+o).fadeOut("slow"),totalFiles-=1),o++})}),m.bind("UploadProgress",function(e,a){var t=a.id,a=a.percent;$(".progress-bar_"+t).css("width",a+"%"),$(".realProgText_"+t).text(a+"% Completed"),100==a&&($(".cancel_button[to_cancel='"+t+"']").fadeOut("slow"),$(".progress-bar_"+t).addClass("progress-bar-success"))}),setTimeout(function(){$(".upload-area").addClass("hidden"),$(".form_header").addClass("hidden"),$("#uploadDataContainer").removeClass("hidden"),$(".uploadingProgressContainer").removeClass("hidden"),$("#uploadedFilesInfo").text("Uploaded 0 of "+u.length),$(".allProgress").removeClass("hidden"),m.start()},1e3),$("#allUploadForms").css("display","block")}),m.bind("BeforeUpload",function(){$("#fileUploadProgress").removeClass("hidden"),$(".progress-container").removeClass("hidden")});var s=0;m.bind("UploadProgress",function(e,a){$("#progressNumber").text(a.percent+"%"),$("#videoNumber").text(a.name)}),m.bind("FileUploaded",function(e,t,a){$("#overallProgress").css("width",100/u.length*++s+"%"),$("#overallProgress").parents(".row").find("#uploadedFilesInfo").text("Uploaded "+s+" of "+u.length);var a=$.parseJSON(a.response),o=collection_id||$("#SelectionDIV select").val(),l=0,n=0;plupload.each(e.files,function(e){l++,e.id===t.id&&(n=l)}),$.ajax({url:"/actions/photo_uploader.php",type:"post",data:{insertPhoto:"yes",title:t.name,file_name:a.file_name,collection_id:o,ext:a.extension,photo_title:t.name,photo_description:t.name,photo_tags:""},dataType:"JSON",success:function(e){var a=document.createElement("input");a.name="photo_id",a.type="hidden",a.value=e.photoID,$("#tab"+n+" form").append(a),$("#tab"+n+" form").find(".edit-img-thumbnail > img").prop("src",e.photoPreview),$("#tab"+n+" .savePhotoDetails").removeAttr("disabled"),t.data.photoThumb=e.photoPreview,t.data.photo_id=e.photoID}})}),m.bind("UploadComplete",function(e,a){$("#fileUploadProgress").addClass("hidden"),$("#uploadMore").removeClass("hidden"),$(".uploadingProgressContainer").addClass("hidden"),m.refresh(),$("#uploadMessage").html("All Files are uploaded Successfully").attr("class","alert alert-success container"),setTimeout(function(){$("#uploadMessage").addClass("hidden")},5e3)}),m.bind("error",function(e,a){$("#uploadMessage").removeClass("hidden"),a&&$("#uploadMessage").html(a.message).attr("class","alert alert-danger container"),setTimeout(function(){$("#uploadMessage").addClass("hidden")},8e3)}),$("#addNewCollection").on({click:function(e){e.preventDefault();var e=$(this).parents("form").serialize(),t=(e+="&mode=add_collection",$(this).parents("form").find("#collection_name").val());$.ajax({type:"post",url:"/ajax.php",data:e,success:function(e){var a;null===(e=$.parseJSON(e)).err||void 0===e.err?((a=document.createElement("option")).value=parseInt(e.id),a.innerHTML=t,a.selected=!0,$("select[name='collection_id']").get(0).appendChild(a),$("#collectionSelection").get(0).appendChild(a.cloneNode(!0)),$("#collectionSelection option").last().attr("selected","selected"),$("#uploadMessage").html(e.msg).attr("class","alert alert-success container").removeClass("hidden"),$("#CollectionDIV").toggle("fast"),$(".form_header").show(),$(".upload-area").show(),$("#collectionSelection").parent().show(),$("#SelectionDIV").find(".alert-danger").hide()):(e.err,$("#uploadMessage").html(e.err).attr("class","alert alert-danger container").removeClass("hidden")),setTimeout(function(){$("#uploadMessage").addClass("hidden")},5e3)}})}}),$("#createNewCollection").on({click:function(e){e.preventDefault(),$("#CollectionDIV").toggle("fast").find("form")[0].reset(),$(".tagit li:not(.tagit-new)").remove(),$(".form_header").hide(),$(".upload-area").hide()}}),$("#cancelAddCollection").on({click:function(e){e.preventDefault(),$("#CollectionDIV").toggle("fast"),$(".form_header").show(),$(".upload-area").show()}}),$("#selectedFilesList a").on({click:function(e){e.preventDefault(),$(this).tab("show")}}),$("#SelectionDIV select").on({change:function(e){var t,a=$("#collectionId");a?$(a).val(this.value):((t=document.createElement("input")).type="hidden",t.name="collection_id",t.value=this.value,$("#allUploadForms form").each(function(e,a){$(a).get(0).appendChild(t)}))}}),$("#uploadMorePhotos").on({click:function(e){e.preventDefault(),$(".upload-area").removeClass("hidden"),$(".form_header").removeClass("hidden"),$("#uploadDataContainer").addClass("hidden")}})}),init_tags("collection_tags",available_collection_tags)}); \ No newline at end of file diff --git a/upload/styles/cb_28/theme/js/pages/upload/upload.js b/upload/styles/cb_28/theme/js/pages/upload/upload.js index 27004e883..6497aa656 100644 --- a/upload/styles/cb_28/theme/js/pages/upload/upload.js +++ b/upload/styles/cb_28/theme/js/pages/upload/upload.js @@ -28,20 +28,20 @@ $(document).ready(function(){ function reFreshTabs(up) { // creating the selected files list - var tabs = document.createElement('ul'); - tabs.id = 'selectedFilesList'; - tabs.className = 'nav nav-tabs'; + var ul = $('#selectedFilesList'); var li = false; - var index = 1; + var index = 0; var uploadForm = $('#updateVideoInfoForm.template').clone(); var oneUploadForm = false; var uploadForms = []; plupload.each(up.files, function(file) { - li = document.createElement('li'); - if(index === up.files.length){ - li.className = 'active'; + index++; + if($('#tab'+index).length === 0){ + li = document.createElement('li'); }else{ - li.className = ''; + ul.find('#'+index).removeClass('active'); + $('#tab'+index).removeClass('active'); + return; } var link = document.createElement('a'); link.href = '#tab'+index; @@ -59,11 +59,11 @@ $(document).ready(function(){ wrapperDiv.id = 'tab'+index; if(index === up.files.length){ + li.className = 'active'; wrapperDiv.className = 'tab-pane active uploadFormContainer'; } else { wrapperDiv.className = 'tab-pane uploadFormContainer'; } - $(oneUploadForm).find(".cancel_button").attr('to_cancel',index); $(oneUploadForm).find("input[name='title']").val(file.data.title); $(oneUploadForm).find("textarea[name='description']").val(file.data.description); @@ -101,7 +101,6 @@ $(document).ready(function(){ alert_shown = false; } }); - if(file.data.broadcast === 'unlisted'){ $(oneUploadForm).find('#video_password').attr('disabled',false); } else if(file.data.broadcast === 'private') { @@ -123,13 +122,12 @@ $(document).ready(function(){ wrapperDiv.appendChild(oneUploadForm); uploadForms.push(wrapperDiv); - li.id = index++; + li.id = index; li.appendChild(link); - tabs.appendChild(li); + ul.append(li); }); - $('#files').html('').append(tabs); - $('#allUploadForms').html('').append(uploadForms); + $('#allUploadForms').append(uploadForms); $("#allUploadForms input, " + "#allUploadForms textarea, " + @@ -164,30 +162,30 @@ $(document).ready(function(){ }); uploader.bind('FilesAdded', function(up, uploadedFiles) { + let i; $("#uploadMore").addClass("hidden"); - - const filename = uploadedFiles[0].name; - let filename_without_extension = filename.substring(0, filename.lastIndexOf('.')); - if( filename_without_extension.length > max_video_title ){ - filename_without_extension = filename_without_extension.substring(0, max_video_title); + for(i = 0; i < uploadedFiles.length; i++) { + const filename = uploadedFiles[i].name; + let filename_without_extension = filename.substring(0, filename.lastIndexOf('.')); + if( filename_without_extension.length > max_video_title ){ + filename_without_extension = filename_without_extension.substring(0, max_video_title); + } + uploadedFiles[i].data = []; + uploadedFiles[i].data.title = filename_without_extension; + uploadedFiles[i].data.description = filename_without_extension; + uploadedFiles[i].data.tags = ''; + uploadedFiles[i].data.country = default_country_iso2; + uploadedFiles[i].data.location = ''; + uploadedFiles[i].data.datecreated = date_format_time; + uploadedFiles[i].data.broadcast = ''; + uploadedFiles[i].data.video_password = ''; + uploadedFiles[i].data.video_users = ''; + uploadedFiles[i].data.allow_comments = 'yes'; + uploadedFiles[i].data.comment_voting = 'yes'; + uploadedFiles[i].data.allow_rating = 'yes'; + uploadedFiles[i].data.allow_embedding = 'yes'; + uploadedFiles[i].data['category[]'] = [get_default_cid]; } - - uploadedFiles[0].data = []; - uploadedFiles[0].data.title = filename_without_extension; - uploadedFiles[0].data.description = filename_without_extension; - uploadedFiles[0].data.tags = ''; - uploadedFiles[0].data.country = default_country_iso2; - uploadedFiles[0].data.location = ''; - uploadedFiles[0].data.datecreated = date_format_time; - uploadedFiles[0].data.broadcast = ''; - uploadedFiles[0].data.video_password = ''; - uploadedFiles[0].data.video_users = ''; - uploadedFiles[0].data.allow_comments = 'yes'; - uploadedFiles[0].data.comment_voting = 'yes'; - uploadedFiles[0].data.allow_rating = 'yes'; - uploadedFiles[0].data.allow_embedding = 'yes'; - uploadedFiles[0].data['category[]'] = [get_default_cid]; - reFreshTabs(up); //function for real progress bar @@ -204,7 +202,7 @@ $(document).ready(function(){ //end function var index = 1; - for (var i = 0; i < up.files.length; i++ ){ + for (i = 0; i < up.files.length; i++ ){ if( up.files[i].file_name !== undefined ){ var hiddenField_fileName = document.createElement('input'); hiddenField_fileName.name = 'file_name'; @@ -212,7 +210,6 @@ $(document).ready(function(){ hiddenField_fileName.value = up.files[i].file_name; $('#tab'+index+' form').append(hiddenField_fileName); } - if( up.files[i].show_duration === true ){ $('#tab'+index+' #duration').removeClass('hidden').removeAttr('disabled'); } @@ -283,32 +280,44 @@ $(document).ready(function(){ */ var filesUploaded = 0; + var errors = []; uploader.bind('FileUploaded', function(up, fileDetails, response) { - $('#overallProgress').css('width', ((100/up.files.length)*(++filesUploaded))+"%"); - $('#overallProgress').parents('.row').find('#uploadedFilesInfo').text('Inserted ' + (filesUploaded) + ' of ' + up.files.length); var serverResponse = $.parseJSON(response.response); - + var id_error = ''; + if (serverResponse.error) { + errors.push(serverResponse.error); + $('.progress-bar_'+fileDetails.id).addClass('progress-bar-danger'); + id_error = fileDetails.id; + }else { + filesUploaded++; + } + $('#overallProgress').css('width', ((100/up.files.length)*(filesUploaded))+"%"); + $('#overallProgress').parents('.row').find('#uploadedFilesInfo').text('Inserted ' + (filesUploaded) + ' of ' + up.files.length); var index = 1; plupload.each(up.files,function(file) { if( file.id === fileDetails.id ){ - file.file_name = serverResponse.file_name; - - var hiddenField_fileName = document.createElement('input'); - hiddenField_fileName.name = 'file_name'; - hiddenField_fileName.type = 'hidden'; - hiddenField_fileName.value = serverResponse.file_name; - $('#tab'+index+' form').append(hiddenField_fileName); - - if(serverResponse.extension === 'mp4' && stay_mp4 === 'yes' ){ - file.show_duration = true; - $('#tab'+index+' #duration').removeClass('hidden').removeAttr('disabled'); + if (id_error === file.id) { + $('#tab'+index+' form').find(':input').attr('disabled','disabled'); } else { - file.show_duration = false; - } + file.file_name = serverResponse.file_name; + + var hiddenField_fileName = document.createElement('input'); + hiddenField_fileName.name = 'file_name'; + hiddenField_fileName.type = 'hidden'; + hiddenField_fileName.value = serverResponse.file_name; + $('#tab'+index+' form').append(hiddenField_fileName); + + if(serverResponse.extension === 'mp4' && stay_mp4 === 'yes' ){ + file.show_duration = true; + $('#tab'+index+' #duration').removeClass('hidden').removeAttr('disabled'); + } else { + file.show_duration = false; + } - $('#tab'+index+' .saveVideoDetails').removeAttr('disabled'); + $('#tab'+index+' .saveVideoDetails').removeAttr('disabled'); + } } index++ }); @@ -366,20 +375,29 @@ $(document).ready(function(){ // remove cancel button $(".cancel_button[to_cancel='" + pluploadFileId + "']").fadeOut('slow'); // turn progress bar into green to show success - $('.progress-bar_'+pluploadFileId).addClass('progress-bar-success'); + if (!$('.progress-bar_'+pluploadFileId).hasClass('progress-bar-danger')) { + $('.progress-bar_'+pluploadFileId).addClass('progress-bar-success'); + } } }); uploader.bind('UploadComplete', function(plupload, files){ $("#fileUploadProgress").addClass('hidden'); - $("#uploadMore").removeClass('hidden'); $(".uploadingProgressContainer").hide(); uploader.refresh(); - $("#uploadMessage").html('File uploaded successfully').attr('class', 'alert alert-success container'); - setTimeout(function(){ - $("#uploadMessage").addClass('hidden'); - }, 5000); + if (errors.length > 0 ) { + $("#uploadMessage").html(''); + errors.forEach(function (error) { + $("#uploadMessage").append(error).attr('class', 'alert alert-danger container'); + }); + errors = []; + } else { + $("#uploadMessage").html('File uploaded successfully').attr('class', 'alert alert-success container'); + setTimeout(function(){ + $("#uploadMessage").addClass('hidden'); + }, 5000); + } }); uploader.bind('error', function(up, err) { diff --git a/upload/styles/cb_28/theme/js/pages/upload/upload.min.js b/upload/styles/cb_28/theme/js/pages/upload/upload.min.js index c9ddc2572..9637fab03 100644 --- a/upload/styles/cb_28/theme/js/pages/upload/upload.min.js +++ b/upload/styles/cb_28/theme/js/pages/upload/upload.min.js @@ -1 +1 @@ -var grabbed_json="nothing";$(document).ready(function(){var d="/actions/file_uploader.php";""!==uploadScriptPath&&(d=uploadScriptPath);var a=(a=back_extensions).substring(0,a.length-1);$.get(theme+"/js/plupload/js/plupload.full.min.js",function(e){var l=new plupload.Uploader({browse_button:"selectFiles",dragdrop:!0,drop_element:"dragDrop",runtimes:"html5,flash,silverlight,html4",url:d,file_data_name:"Filedata",filters:{mime_types:[{title:"Video files",extensions:a}],max_file_size:max_upload_size+"Mb"}});function o(i){var d=document.createElement("ul"),l=(d.id="selectedFilesList",!(d.className="nav nav-tabs")),o=1,r=$("#updateVideoInfoForm.template").clone(),c=!1,p=[];plupload.each(i.files,function(e){l=document.createElement("li"),o===i.files.length?l.className="active":l.className="";var a=document.createElement("a"),t=(a.href="#tab"+o,a.setAttribute("data-toggle","tab"),i.files.length<8?a.innerHTML="("+o+") "+e.name.substring(0,10):a.innerHTML="("+o+") ",(c=$(r).clone().get(0)).className="updateVideoInfoForm",c.id="",document.createElement("div")),n=(t.id="tab"+o,o===i.files.length?t.className="tab-pane active uploadFormContainer":t.className="tab-pane uploadFormContainer",$(c).find(".cancel_button").attr("to_cancel",o),$(c).find("input[name='title']").val(e.data.title),$(c).find("textarea[name='description']").val(e.data.description),$(c).find("input[name='tags']").val(e.data.tags).attr("id","tags"+o),$(c).find("input[name='location']").val(e.data.location),$(c).find("input[name='datecreated']").val(e.data.datecreated),$(c).find("input[name='video_password']").val(e.data.video_password),$(c).find("select[name='country']").val(e.data.country),$(c).find("textarea[name='video_users']").val(e.data.video_users),$(c).find("input[name='broadcast'][value='"+e.data.broadcast+"']").prop("checked",!0),$(c).find("input[name='allow_comments'][value='"+e.data.allow_comments+"']").prop("checked",!0),$(c).find("input[name='comment_voting'][value='"+e.data.comment_voting+"']").prop("checked",!0),$(c).find("input[name='allow_rating'][value='"+e.data.allow_rating+"']").prop("checked",!0),$(c).find("input[name='allow_embedding'][value='"+e.data.allow_embedding+"']").prop("checked",!0),document.createElement("ul")),s=(n.id="list_tags_"+o,$(n).insertAfter($(c).find("input[name='tags']")),!1);$(c).find("#list_tags_"+o).tagit({singleField:!0,readOnly:!1,singleFieldNode:$(c).find("#tags"+o),animate:!0,caseSensitive:!1,availableTags:available_tags,beforeTagAdded:function(e,a){if(a.tagLabel.length<=2)return s||(s=!0,alert(tag_too_short)),!1;s=!1}}),"unlisted"===e.data.broadcast?$(c).find("#video_password").attr("disabled",!1):"private"===e.data.broadcast&&$(c).find("#video_users").attr("disabled",!1),$.each(e.data["category[]"],function(e,a){$(c).find("input[name='category[]'][value='"+a+"']").prop("checked",!0)}),!0===e.show_duration&&$(c).find("#duration").removeClass("hidden").removeAttr("disabled"),100===e.percent&&$(c).find(".saveVideoDetails").removeAttr("disabled"),t.appendChild(c),p.push(t),l.id=o++,l.appendChild(a),d.appendChild(l)}),$("#files").html("").append(d),$("#allUploadForms").html("").append(p),$("#allUploadForms input, #allUploadForms textarea, #allUploadForms select ").change(function(){var a,t=$(this).closest("form").find("input[name='file_name']").val(),n=$(this).attr("name");"checkbox"!==$(this).attr("type")?a=$(this).val():(a=[],$.each($(this).closest("form").find("input[name='"+n+"']:checked"),function(){a.push($(this).val())})),plupload.each(i.files,function(e){e.file_name===t&&(e.data[n]=a)})})}l.init(),l.bind("FilesRemoved",function(e){o(e)}),l.bind("FilesAdded",function(e,s){$("#uploadMore").addClass("hidden");var a=s[0].name;let t=a.substring(0,a.lastIndexOf("."));t.length>max_video_title&&(t=t.substring(0,max_video_title)),s[0].data=[],s[0].data.title=t,s[0].data.description=t,s[0].data.tags="",s[0].data.country=default_country_iso2,s[0].data.location="",s[0].data.datecreated=date_format_time,s[0].data.broadcast="",s[0].data.video_password="",s[0].data.video_users="",s[0].data.allow_comments="yes",s[0].data.comment_voting="yes",s[0].data.allow_rating="yes",s[0].data.allow_embedding="yes",s[0].data["category[]"]=[get_default_cid],o(e),$.each(s,function(e,a){var t=a.name,a=a.id;$(".realProgressBars").append('
'+t+'
70% Complete50% completed
')});for(var n,i=1,d=0;dmax_video_title&&(e=e.substring(0,max_video_title)),s[a].data=[],s[a].data.title=e,s[a].data.description=e,s[a].data.tags="",s[a].data.country=default_country_iso2,s[a].data.location="",s[a].data.datecreated=date_format_time,s[a].data.broadcast="",s[a].data.video_password="",s[a].data.video_users="",s[a].data.allow_comments="yes",s[a].data.comment_voting="yes",s[a].data.allow_rating="yes",s[a].data.allow_embedding="yes",s[a].data["category[]"]=[get_default_cid]}o(e),$.each(s,function(e,a){var t=a.name,a=a.id;$(".realProgressBars").append('
'+t+'
70% Complete50% completed
')});var n,d=1;for(a=0;a