catch all input fields (in preparation for acl in this place) and display the files to upload in the right order

This commit is contained in:
Mario Vavti 2016-07-29 11:30:33 +02:00
parent 3a320462fa
commit 5e5ec5a66a
2 changed files with 9 additions and 4 deletions

View File

@ -74,8 +74,6 @@ function UploadFileSelectHandler(e) {
var files = e.target.files; var files = e.target.files;
} }
// process all File objects // process all File objects
for (var i = 0, f; f = files[i]; i++) { for (var i = 0, f; f = files[i]; i++) {
if(e.target.id === 'files-upload') if(e.target.id === 'files-upload')
@ -87,7 +85,8 @@ function UploadFileSelectHandler(e) {
} }
function prepareHtml(f, i) { 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">' + '<tr id="new-upload-' + i + '" class="new-upload">' +
'<td><i class="fa ' + getIconFromType(f.type) + '" title="' + f.type + '"></i></td>' + '<td><i class="fa ' + getIconFromType(f.type) + '" title="' + f.type + '"></i></td>' +
'<td>' + f.name + '</td>' + '<td>' + f.name + '</td>' +
@ -205,8 +204,12 @@ function UploadFile(file, idx) {
// POST to the entire cloud path // POST to the entire cloud path
xhr.open('post', window.location.pathname, true); xhr.open('post', window.location.pathname, true);
var formfields = $("#ajax-upload-files").serializeArray();
var data = new FormData(); var data = new FormData();
data.append('sabreAction', 'put'); $.each(formfields, function(i, field) {
data.append(field.name, field.value);
});
data.append('file', file); data.append('file', file);
xhr.send(data); xhr.send(data);

View File

@ -18,6 +18,7 @@
<td class="hidden-xs"></td> <td class="hidden-xs"></td>
</tr> </tr>
{{/if}} {{/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}} {{foreach $entries as $item}}
<tr id="cloud-index-{{$item.attachId}}"> <tr id="cloud-index-{{$item.attachId}}">
<td><i class="fa {{$item.iconFromType}}" title="{{$item.type}}"></i></td> <td><i class="fa {{$item.iconFromType}}" title="{{$item.type}}"></i></td>
@ -38,6 +39,7 @@
<tr id="cloud-tools-{{$item.attachId}}"> <tr id="cloud-tools-{{$item.attachId}}">
<td id="perms-panel-{{$item.attachId}}" colspan="9"></td> <td id="perms-panel-{{$item.attachId}}" colspan="9"></td>
</tr> </tr>
{{/foreach}} {{/foreach}}
</table> </table>
</div> </div>