mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
Update Resumable from github, fixes some problems with setting et2_file value to a list of files in firefox.
This commit is contained in:
parent
b9e6983643
commit
08c10a70aa
@ -258,8 +258,10 @@ var et2_file = et2_inputWidget.extend(
|
||||
* If you pass a FileList or list of files, it will trigger the async upload
|
||||
*
|
||||
* @param {FileList|File[]|false} value List of files to be uploaded, or false to reset.
|
||||
* @param {Event} event Most browsers require the user to initiate file transfers in some way.
|
||||
* Pass the event in, if you have it.
|
||||
*/
|
||||
set_value: function(value) {
|
||||
set_value: function(value, event) {
|
||||
if(!value || typeof value == "undefined")
|
||||
{
|
||||
value = {};
|
||||
@ -277,9 +279,18 @@ var et2_file = et2_inputWidget.extend(
|
||||
}
|
||||
|
||||
if(typeof value == 'object' && value.length && typeof value[0] == 'object' && value[0].name)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.input[0].files = value;
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
var self = this;
|
||||
var args = arguments;
|
||||
jQuery.each(value, function(i,file) {self.resumable.addFile(this,event);});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -349,6 +360,11 @@ var et2_file = et2_inputWidget.extend(
|
||||
},
|
||||
|
||||
_fileAdded: function(file,event) {
|
||||
// Manual additions have no event
|
||||
if(typeof event == 'undefined')
|
||||
{
|
||||
event = {};
|
||||
}
|
||||
// Trigger start of uploading, calls callback
|
||||
if(!this.resumable.isUploading())
|
||||
{
|
||||
|
@ -230,7 +230,7 @@
|
||||
window.setTimeout(function(){
|
||||
$.files.push(f);
|
||||
files.push(f);
|
||||
f.container = event.srcElement;
|
||||
f.container = (typeof event != 'undefined' ? event.srcElement : null);
|
||||
$.fire('fileAdded', f, event)
|
||||
},0);
|
||||
})()};
|
||||
@ -450,6 +450,7 @@
|
||||
params.push(['resumableIdentifier', encodeURIComponent($.fileObj.uniqueIdentifier)].join('='));
|
||||
params.push(['resumableFilename', encodeURIComponent($.fileObj.fileName)].join('='));
|
||||
params.push(['resumableRelativePath', encodeURIComponent($.fileObj.relativePath)].join('='));
|
||||
params.push(['resumableTotalChunks', encodeURIComponent($.fileObj.chunks.length)].join('='));
|
||||
// Append the relevant chunk and send it
|
||||
$.xhr.open('GET', $h.getTarget(params));
|
||||
$.xhr.timeout = $.getOpt('xhrTimeout');
|
||||
@ -578,7 +579,7 @@
|
||||
if($.pendingRetry) {
|
||||
// if pending retry then that's effectively the same as actively uploading,
|
||||
// there might just be a slight delay before the retry starts
|
||||
return('uploading')
|
||||
return('uploading');
|
||||
} else if(!$.xhr) {
|
||||
return('pending');
|
||||
} else if($.xhr.readyState<4) {
|
||||
@ -771,8 +772,8 @@
|
||||
});
|
||||
return(totalSize>0 ? totalDone/totalSize : 0);
|
||||
};
|
||||
$.addFile = function(file){
|
||||
appendFilesFromFileList([file]);
|
||||
$.addFile = function(file, event){
|
||||
appendFilesFromFileList([file], event);
|
||||
};
|
||||
$.removeFile = function(file){
|
||||
for(var i = $.files.length - 1; i >= 0; i--) {
|
||||
|
Loading…
Reference in New Issue
Block a user