Commit afa01def authored by Henning Leutz's avatar Henning Leutz 🥋

fix: upload finish status is now set correctly

parent 1cce363c
......@@ -104,6 +104,7 @@ define('controls/upload/File', [
this.$result = null;
this.$error = false;
this.$errors = 0;
this.$uploaded = false;
this.$ContextMenu = null;
this.$slice_method = 'slice';
......@@ -409,6 +410,7 @@ define('controls/upload/File', [
}
if (this.$error === false) {
this.$uploaded = true;
this.fireEvent('complete', [this, this.$result]);
}
......@@ -498,7 +500,7 @@ define('controls/upload/File', [
* @return {Boolean}
*/
isFinished: function () {
return this.$range_end === this.$file_size;
return this.$uploaded;
},
/**
......@@ -566,10 +568,10 @@ define('controls/upload/File', [
response.text().then(function (text) {
this.$parseResult(text);
}.bind(this));
this.refresh();
this.upload();
this.refresh();
this.upload();
}.bind(this));
}.bind(this)).catch(function (err) {
console.error('Information about the upload error: ', err);
......
......@@ -25,13 +25,14 @@ define('controls/upload/Form', [
'qui/controls/Control',
'qui/controls/utils/Progressbar',
'qui/controls/buttons/Button',
'qui/controls/loader/Loader',
'utils/Media',
'classes/request/Upload',
'Locale',
'css!controls/upload/Form.css'
], function (QUI, QUIControl, QUIProgressbar, QUIButton, MediaUtils, Upload, Locale) {
], function (QUI, QUIControl, QUIProgressbar, QUIButton, QUILoader, MediaUtils, Upload, Locale) {
"use strict";
var lg = 'quiqqer/quiqqer';
......@@ -256,6 +257,8 @@ define('controls/upload/Form', [
}
});
this.$Loader = new QUILoader().inject(this.$Elm);
this.$Buttons = this.$Elm.getElement('.controls-upload-buttons');
this.$BgText = this.$Elm.getElement('.controls-upload-bg-text');
this.$Info = this.$Elm.getElement('.controls-upload-info');
......@@ -913,6 +916,7 @@ define('controls/upload/Form', [
return;
}
this.$Loader.show();
this.fireEvent('submit', [this.getFiles(), this]);
// send to upload manager
......@@ -992,6 +996,7 @@ define('controls/upload/Form', [
}
}
this.$Loader.hide();
this.fireEvent('finished', [this]);
this.$finished = true;
}.bind(this));
......
......@@ -36,7 +36,7 @@ define('controls/upload/Manager', [
return new Class({
Extends: QUIPanel,
Type: 'controls/upload/Manager',
Type : 'controls/upload/Manager',
Binds: [
'$onCreate',
......@@ -47,19 +47,19 @@ define('controls/upload/Manager', [
],
options: {
icon: 'fa fa-upload',
icon : 'fa fa-upload',
pauseAllowed: true,
contextMenu: true
contextMenu : true
},
initialize: function (options) {
this.parent(options);
this.$files = [];
this.$files = [];
this.$container = null;
this.$uploads = {};
this.$uploads = {};
this.$maxPercent = 0;
this.$maxPercent = 0;
this.$uploadPerCents = {};
this.$Container = null;
......@@ -79,8 +79,8 @@ define('controls/upload/Manager', [
}).inject(this.getContent());
this.addButton({
icon: 'fa fa-trash',
title: Locale.get(lg, 'upload.manager.clear'),
icon : 'fa fa-trash',
title : Locale.get(lg, 'upload.manager.clear'),
styles: {
'float': 'right'
},
......@@ -219,10 +219,10 @@ define('controls/upload/Manager', [
// ask for extraction
new QUIAlert({
title: Locale.get(lg, 'upload.manager.message.archivfile.title'),
content: Locale.get(lg, 'upload.manager.message.archivfile.text') + '<br />' + list,
title : Locale.get(lg, 'upload.manager.message.archivfile.title'),
content : Locale.get(lg, 'upload.manager.message.archivfile.text') + '<br />' + list,
closeButtonText: Locale.get(lg, 'upload.manager.message.archivfile.btn.start'),
events: {
events : {
onClose: function (Win) {
var i, len;
......@@ -311,7 +311,7 @@ define('controls/upload/Manager', [
};
for (i = 0, len = files.length; i < len; i++) {
file_params = Object.clone(params);
file_params = Object.clone(params);
file_params.extract = false;
if (extract && extract[files[i].name]) {
......@@ -325,18 +325,18 @@ define('controls/upload/Manager', [
}
var QUIFile = new UploadFile(files[i], {
phpfunc: rf,
params: file_params,
events: events,
phpfunc : rf,
params : file_params,
events : events,
pauseAllowed: this.getAttribute('pauseAllowed'),
contextMenu: this.getAttribute('contextMenu')
contextMenu : this.getAttribute('contextMenu')
});
QUIFile.addEvents({
onComplete: onComplete,
onRefresh: onRefresh,
onError: onError,
onCancel: onCancel
onRefresh : onRefresh,
onError : onError,
onCancel : onCancel
});
if (file_params.phponstart) {
......@@ -359,13 +359,13 @@ define('controls/upload/Manager', [
Node.setStyles({
background: '#fff',
border: '1px solid #f1f1f1',
bottom: 10,
boxShadow: '0 0 10px rgba(0, 0, 0, 0.3)',
position: 'absolute',
right: 10,
width: 300,
zIndex: 1000
border : '1px solid #f1f1f1',
bottom : 10,
boxShadow : '0 0 10px rgba(0, 0, 0, 0.3)',
position : 'absolute',
right : 10,
width : 300,
zIndex : 1000
});
Node.inject(document.body);
......@@ -444,10 +444,10 @@ define('controls/upload/Manager', [
QUIFile = new UploadFile(params.file, {
phpfunc: params.phpfunc,
params: params,
events: {
params : params,
events : {
onComplete: func_oncomplete,
onCancel: func_oncancel
onCancel : func_oncancel
}
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment