From df45c13f622d01241ac96b2f16cb964ba688d72c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 28 Nov 2017 14:30:46 -0800 Subject: first integration attempt with /cloud and blueimp uploader --- view/js/mod_cloud.js | 27 +++++++++++++++++++++++++++ view/tpl/cloud.tpl | 5 +++++ 2 files changed, 32 insertions(+) (limited to 'view') diff --git a/view/js/mod_cloud.js b/view/js/mod_cloud.js index 8af90863e..32aae2029 100644 --- a/view/js/mod_cloud.js +++ b/view/js/mod_cloud.js @@ -17,6 +17,33 @@ function UploadInit() { var filedrag = $("#cloud-drag-area"); var submit = $("#upload-submit"); + + $('#invisible-cloud-file-upload').fileupload({ + url: 'file_upload', + dataType: 'json', + // dropZone: $('#profile-jot-text'), + maxChunkSize: 4 * 1024 * 1024, + add: function(e,data) { + $('#profile-rotator').show(); + data.submit(); + }, + done: function(e,data) { + addeditortext(data.result.message); + $('#jot-media').val($('#jot-media').val() + data.result.message); + }, + stop: function(e,data) { + preview_post(); + $('#profile-rotator').hide(); + }, + }); + + $('#files-upload').click(function(event) { event.preventDefault(); $('#invisible-cloud-file-upload').trigger('click'); return false;}); + + + + + + // is XHR2 available? var xhr = new XMLHttpRequest(); if (xhr.upload) { diff --git a/view/tpl/cloud.tpl b/view/tpl/cloud.tpl index d1567af9f..ccd59d81a 100644 --- a/view/tpl/cloud.tpl +++ b/view/tpl/cloud.tpl @@ -1,3 +1,8 @@ + + + + +
{{include file="cloud_header.tpl"}} {{include file="cloud_directory.tpl"}} -- cgit v1.2.3 From 76703dee8481075a44b254a548bb29b49530d0ad Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 28 Nov 2017 17:37:18 -0800 Subject: more chunk work --- view/js/mod_cloud.js | 44 ++++++++++++++++++++++------------------- view/tpl/cloud_actionspanel.tpl | 2 +- 2 files changed, 25 insertions(+), 21 deletions(-) (limited to 'view') diff --git a/view/js/mod_cloud.js b/view/js/mod_cloud.js index 32aae2029..25f40e5a5 100644 --- a/view/js/mod_cloud.js +++ b/view/js/mod_cloud.js @@ -18,26 +18,28 @@ function UploadInit() { var submit = $("#upload-submit"); - $('#invisible-cloud-file-upload').fileupload({ + $('#files-upload').fileupload({ url: 'file_upload', dataType: 'json', - // dropZone: $('#profile-jot-text'), - maxChunkSize: 4 * 1024 * 1024, + dropZone: filedrag, + maxChunkSize: 100000, // 4 * 1024 * 1024, + add: function(e,data) { $('#profile-rotator').show(); data.submit(); }, - done: function(e,data) { - addeditortext(data.result.message); - $('#jot-media').val($('#jot-media').val() + data.result.message); - }, - stop: function(e,data) { - preview_post(); - $('#profile-rotator').hide(); - }, + +// done: function(e,data) { +// addeditortext(data.result.message); +// $('#jot-media').val($('#jot-media').val() + data.result.message); +// }, +// stop: function(e,data) { +// preview_post(); +// $('#profile-rotator').hide(); +// }, }); - $('#files-upload').click(function(event) { event.preventDefault(); $('#invisible-cloud-file-upload').trigger('click'); return false;}); +// $('#files-upload').click(function(event) { event.preventDefault(); $('#invisible-cloud-file-upload').trigger('click'); return false;}); @@ -185,6 +187,8 @@ function getIconFromType(type) { // upload files function UploadFile(file, idx) { + return; + window.filesToUpload = window.filesToUpload + 1; var xhr = new XMLHttpRequest(); @@ -229,15 +233,15 @@ function UploadFile(file, idx) { }); // POST to the entire cloud path - xhr.open('post', 'file_upload', true); +// xhr.open('post', 'file_upload', true); - var formfields = $("#ajax-upload-files").serializeArray(); +// var formfields = $("#ajax-upload-files").serializeArray(); - var data = new FormData(); - $.each(formfields, function(i, field) { - data.append(field.name, field.value); - }); - data.append('userfile', file); +// var data = new FormData(); +// $.each(formfields, function(i, field) { +// data.append(field.name, field.value); +// }); +// data.append('userfile', file); - xhr.send(data); +// xhr.send(data); } diff --git a/view/tpl/cloud_actionspanel.tpl b/view/tpl/cloud_actionspanel.tpl index fc3e7f82f..489632a4a 100644 --- a/view/tpl/cloud_actionspanel.tpl +++ b/view/tpl/cloud_actionspanel.tpl @@ -25,7 +25,7 @@ - + {{include file="field_checkbox.tpl" field=$notify}}
-- cgit v1.2.3 From e1a209a3da3913666c00398d3f9e249856a72e69 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 28 Nov 2017 18:01:04 -0800 Subject: more chunk work --- view/js/mod_cloud.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'view') diff --git a/view/js/mod_cloud.js b/view/js/mod_cloud.js index 25f40e5a5..1a473ac75 100644 --- a/view/js/mod_cloud.js +++ b/view/js/mod_cloud.js @@ -25,8 +25,7 @@ function UploadInit() { maxChunkSize: 100000, // 4 * 1024 * 1024, add: function(e,data) { - $('#profile-rotator').show(); - data.submit(); +// data.submit(); }, // done: function(e,data) { @@ -47,24 +46,24 @@ function UploadInit() { // is XHR2 available? - var xhr = new XMLHttpRequest(); - if (xhr.upload) { +// var xhr = new XMLHttpRequest(); +// if (xhr.upload) { // file select - fileselect.attr("multiple", 'multiple'); - fileselect.on("change", UploadFileSelectHandler); +// fileselect.attr("multiple", 'multiple'); +// fileselect.on("change", UploadFileSelectHandler); // file submit - submit.on("click", fileselect, UploadFileSelectHandler); +// submit.on("click", fileselect, UploadFileSelectHandler); // file drop - filedrag.on("dragover", DragDropUploadFileHover); - filedrag.on("dragleave", DragDropUploadFileHover); - filedrag.on("drop", DragDropUploadFileSelectHandler); - } +// filedrag.on("dragover", DragDropUploadFileHover); +// filedrag.on("dragleave", DragDropUploadFileHover); +// filedrag.on("drop", DragDropUploadFileSelectHandler); +// } - window.filesToUpload = 0; - window.fileUploadsCompleted = 0; +// window.filesToUpload = 0; +// window.fileUploadsCompleted = 0; } // file drag hover -- cgit v1.2.3 From e47c08ed72acd82ef455588f5dec3269a8030037 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 28 Nov 2017 20:40:01 -0800 Subject: more chunk --- view/js/mod_cloud.js | 8 ++++++-- view/tpl/cloud.tpl | 1 - view/tpl/cloud_actionspanel.tpl | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'view') diff --git a/view/js/mod_cloud.js b/view/js/mod_cloud.js index 1a473ac75..3a82c701f 100644 --- a/view/js/mod_cloud.js +++ b/view/js/mod_cloud.js @@ -24,9 +24,13 @@ function UploadInit() { dropZone: filedrag, maxChunkSize: 100000, // 4 * 1024 * 1024, - add: function(e,data) { +// add: function(e,data) { // data.submit(); - }, +// }, + +// submit: function(e,data) { +// data.submit(); +// }, // done: function(e,data) { // addeditortext(data.result.message); diff --git a/view/tpl/cloud.tpl b/view/tpl/cloud.tpl index ccd59d81a..e7237c7e6 100644 --- a/view/tpl/cloud.tpl +++ b/view/tpl/cloud.tpl @@ -1,7 +1,6 @@ -
{{include file="cloud_header.tpl"}} diff --git a/view/tpl/cloud_actionspanel.tpl b/view/tpl/cloud_actionspanel.tpl index 489632a4a..71ba2f687 100644 --- a/view/tpl/cloud_actionspanel.tpl +++ b/view/tpl/cloud_actionspanel.tpl @@ -25,7 +25,7 @@ - + {{include file="field_checkbox.tpl" field=$notify}}
-- cgit v1.2.3 From d59c1bb6bf36419344dc355113e56c2254cbcbfa Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 29 Nov 2017 18:34:16 -0800 Subject: more chunk stuff --- view/js/mod_cloud.js | 6 +++--- view/tpl/cloud_actionspanel.tpl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'view') diff --git a/view/js/mod_cloud.js b/view/js/mod_cloud.js index 3a82c701f..e9e8e9241 100644 --- a/view/js/mod_cloud.js +++ b/view/js/mod_cloud.js @@ -28,9 +28,9 @@ function UploadInit() { // data.submit(); // }, -// submit: function(e,data) { -// data.submit(); -// }, + submit: function(e,data) { + e.preventDefault(); + }, // done: function(e,data) { // addeditortext(data.result.message); diff --git a/view/tpl/cloud_actionspanel.tpl b/view/tpl/cloud_actionspanel.tpl index 71ba2f687..2eed5b18b 100644 --- a/view/tpl/cloud_actionspanel.tpl +++ b/view/tpl/cloud_actionspanel.tpl @@ -25,7 +25,7 @@ - + {{include file="field_checkbox.tpl" field=$notify}}
-- cgit v1.2.3 From cce2b08e6bcb16b1c9fde13b2597ce66fc0c45d6 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 30 Nov 2017 15:28:53 -0800 Subject: progress on chunked uploads in /cloud --- view/js/mod_cloud.js | 18 +++++++++--------- view/tpl/cloud_actionspanel.tpl | 7 ++++--- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'view') diff --git a/view/js/mod_cloud.js b/view/js/mod_cloud.js index e9e8e9241..2215a9df9 100644 --- a/view/js/mod_cloud.js +++ b/view/js/mod_cloud.js @@ -18,20 +18,21 @@ function UploadInit() { var submit = $("#upload-submit"); - $('#files-upload').fileupload({ + $('#invisible-cloud-file-upload').fileupload({ url: 'file_upload', dataType: 'json', dropZone: filedrag, + formData: $('#ajax-upload-files').serializeArray(), maxChunkSize: 100000, // 4 * 1024 * 1024, -// add: function(e,data) { -// data.submit(); -// }, - - submit: function(e,data) { - e.preventDefault(); + add: function(e,data) { + data.submit(); }, +// submit: function(e,data) { +// e.preventDefault(); +// }, + // done: function(e,data) { // addeditortext(data.result.message); // $('#jot-media').val($('#jot-media').val() + data.result.message); @@ -42,7 +43,7 @@ function UploadInit() { // }, }); -// $('#files-upload').click(function(event) { event.preventDefault(); $('#invisible-cloud-file-upload').trigger('click'); return false;}); + $('#upload-submit').click(function(event) { event.preventDefault(); $('#invisible-cloud-file-upload').trigger('click'); return false;}); @@ -190,7 +191,6 @@ function getIconFromType(type) { // upload files function UploadFile(file, idx) { - return; window.filesToUpload = window.filesToUpload + 1; diff --git a/view/tpl/cloud_actionspanel.tpl b/view/tpl/cloud_actionspanel.tpl index 2eed5b18b..8d39a8383 100644 --- a/view/tpl/cloud_actionspanel.tpl +++ b/view/tpl/cloud_actionspanel.tpl @@ -1,3 +1,4 @@ +
@@ -24,8 +25,8 @@ - - + {{include file="field_checkbox.tpl" field=$notify}}
@@ -34,7 +35,7 @@ {{/if}} - +
-- cgit v1.2.3 From cc0d53e6959f333d26003af64439b2fd8a8d665c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 30 Nov 2017 16:24:18 -0800 Subject: made it to prepareHtml --- view/js/mod_cloud.js | 8 +++++--- view/tpl/cloud_directory.tpl | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'view') diff --git a/view/js/mod_cloud.js b/view/js/mod_cloud.js index 2215a9df9..0756c34e3 100644 --- a/view/js/mod_cloud.js +++ b/view/js/mod_cloud.js @@ -16,7 +16,7 @@ function UploadInit() { var fileselect = $("#files-upload"); var filedrag = $("#cloud-drag-area"); var submit = $("#upload-submit"); - + var count = 1; $('#invisible-cloud-file-upload').fileupload({ url: 'file_upload', @@ -26,6 +26,7 @@ function UploadInit() { maxChunkSize: 100000, // 4 * 1024 * 1024, add: function(e,data) { + $(data.files).each( function() { this.count = ++ count; prepareHtml(this) }); data.submit(); }, @@ -117,8 +118,9 @@ function UploadFileSelectHandler(e) { } } -function prepareHtml(f, i) { - var num = i - 1; +function prepareHtml(f) { + var num = f.count - 1; + var i = f.count; $('#cloud-index #new-upload-progress-bar-' + num.toString()).after( '' + '' + diff --git a/view/tpl/cloud_directory.tpl b/view/tpl/cloud_directory.tpl index 88b6bf563..7017df344 100644 --- a/view/tpl/cloud_directory.tpl +++ b/view/tpl/cloud_directory.tpl @@ -52,7 +52,7 @@ {{/if}} - {{* this is needed to append the upload files in the right order *}} + {{* this is needed to append the upload files in the right order *}} {{foreach $entries as $item}} -- cgit v1.2.3 From 0e8e0b48b3fd6f4d6d0dd60039743371930af08d Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 30 Nov 2017 19:05:24 -0800 Subject: more or less working chunked uploads on /cloud now. --- view/js/mod_cloud.js | 50 ++++++++++++++++------------------------- view/tpl/cloud_actionspanel.tpl | 2 +- 2 files changed, 20 insertions(+), 32 deletions(-) (limited to 'view') diff --git a/view/js/mod_cloud.js b/view/js/mod_cloud.js index 0756c34e3..9f2a007f3 100644 --- a/view/js/mod_cloud.js +++ b/view/js/mod_cloud.js @@ -18,58 +18,46 @@ function UploadInit() { var submit = $("#upload-submit"); var count = 1; + $('#invisible-cloud-file-upload').fileupload({ url: 'file_upload', dataType: 'json', dropZone: filedrag, formData: $('#ajax-upload-files').serializeArray(), - maxChunkSize: 100000, // 4 * 1024 * 1024, + maxChunkSize: 4 * 1024 * 1024, add: function(e,data) { - $(data.files).each( function() { this.count = ++ count; prepareHtml(this) }); + $(data.files).each( function() { this.count = ++ count; prepareHtml(this); }); + data.submit(); }, -// submit: function(e,data) { -// e.preventDefault(); -// }, - -// done: function(e,data) { -// addeditortext(data.result.message); -// $('#jot-media').val($('#jot-media').val() + data.result.message); -// }, -// stop: function(e,data) { -// preview_post(); -// $('#profile-rotator').hide(); -// }, - }); - $('#upload-submit').click(function(event) { event.preventDefault(); $('#invisible-cloud-file-upload').trigger('click'); return false;}); + progress: function(e,data) { + + // there will only be one file, the one we are looking for + $(data.files).each( function() { + var idx = this.count; + // Dynamically update the percentage complete displayed in the file upload list + $('#upload-progress-' + idx).html(Math.round(data.loaded / data.total * 100) + '%'); + $('#upload-progress-bar-' + idx).css('background-size', Math.round(data.loaded / data.total * 100) + '%'); + }); + }, - // is XHR2 available? -// var xhr = new XMLHttpRequest(); -// if (xhr.upload) { - // file select -// fileselect.attr("multiple", 'multiple'); -// fileselect.on("change", UploadFileSelectHandler); + stop: function(e,data) { + window.location.href = window.location.href; + } - // file submit -// submit.on("click", fileselect, UploadFileSelectHandler); + }); - // file drop -// filedrag.on("dragover", DragDropUploadFileHover); -// filedrag.on("dragleave", DragDropUploadFileHover); -// filedrag.on("drop", DragDropUploadFileSelectHandler); -// } + $('#upload-submit').click(function(event) { event.preventDefault(); $('#invisible-cloud-file-upload').trigger('click'); return false;}); -// window.filesToUpload = 0; -// window.fileUploadsCompleted = 0; } // file drag hover diff --git a/view/tpl/cloud_actionspanel.tpl b/view/tpl/cloud_actionspanel.tpl index 8d39a8383..6b876d2ac 100644 --- a/view/tpl/cloud_actionspanel.tpl +++ b/view/tpl/cloud_actionspanel.tpl @@ -21,7 +21,7 @@
{{if $quota.limit || $quota.used}}{{/if}} -
+ -- cgit v1.2.3