aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-07-29 11:30:33 +0200
committerMario Vavti <mario@mariovavti.com>2016-07-29 11:30:33 +0200
commit5e5ec5a66a64d43ef5ea14c03b32055863f11bf1 (patch)
tree5612d94e67052d5634988490fd311a8e9bc2ef06
parent3a320462faedca9ec29a452e82d874fce0138136 (diff)
downloadvolse-hubzilla-5e5ec5a66a64d43ef5ea14c03b32055863f11bf1.tar.gz
volse-hubzilla-5e5ec5a66a64d43ef5ea14c03b32055863f11bf1.tar.bz2
volse-hubzilla-5e5ec5a66a64d43ef5ea14c03b32055863f11bf1.zip
catch all input fields (in preparation for acl in this place) and display the files to upload in the right order
-rw-r--r--view/js/mod_cloud.js11
-rw-r--r--view/tpl/cloud_directory.tpl2
2 files changed, 9 insertions, 4 deletions
diff --git a/view/js/mod_cloud.js b/view/js/mod_cloud.js
index 0c3bfe120..e56ec2a81 100644
--- a/view/js/mod_cloud.js
+++ b/view/js/mod_cloud.js
@@ -74,8 +74,6 @@ function UploadFileSelectHandler(e) {
var files = e.target.files;
}
-
-
// process all File objects
for (var i = 0, f; f = files[i]; i++) {
if(e.target.id === 'files-upload')
@@ -87,7 +85,8 @@ function UploadFileSelectHandler(e) {
}
function prepareHtml(f, i) {
- $("#cloud-index tr:nth-child(2)").after(
+ var num = i - 1;
+ $('#cloud-index #new-upload-progress-bar-' + num.toString()).after(
'<tr id="new-upload-' + i + '" class="new-upload">' +
'<td><i class="fa ' + getIconFromType(f.type) + '" title="' + f.type + '"></i></td>' +
'<td>' + f.name + '</td>' +
@@ -205,8 +204,12 @@ function UploadFile(file, idx) {
// POST to the entire cloud path
xhr.open('post', window.location.pathname, true);
+ var formfields = $("#ajax-upload-files").serializeArray();
+
var data = new FormData();
- data.append('sabreAction', 'put');
+ $.each(formfields, function(i, field) {
+ data.append(field.name, field.value);
+ });
data.append('file', file);
xhr.send(data);
diff --git a/view/tpl/cloud_directory.tpl b/view/tpl/cloud_directory.tpl
index 06176fdb8..5a84028c1 100644
--- a/view/tpl/cloud_directory.tpl
+++ b/view/tpl/cloud_directory.tpl
@@ -18,6 +18,7 @@
<td class="hidden-xs"></td>
</tr>
{{/if}}
+ <tr id="new-upload-progress-bar--1"></tr> {{* this is needed to append the upload files in the right order *}}
{{foreach $entries as $item}}
<tr id="cloud-index-{{$item.attachId}}">
<td><i class="fa {{$item.iconFromType}}" title="{{$item.type}}"></i></td>
@@ -38,6 +39,7 @@
<tr id="cloud-tools-{{$item.attachId}}">
<td id="perms-panel-{{$item.attachId}}" colspan="9"></td>
</tr>
+
{{/foreach}}
</table>
</div>