1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 05:37:32 +02:00

Issue #1886 - plupload updated to v2.1.9

This commit is contained in:
Cameron
2016-09-28 10:44:28 -07:00
parent bb357b2035
commit 14c7f5971e
12 changed files with 4221 additions and 1903 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,2 @@
// English (en)
plupload.addI18n({"Stop Upload":"Stop Upload","Upload URL might be wrong or doesn't exist.":"Upload URL might be wrong or doesn't exist.","tb":"tb","Size":"Size","Close":"Close","You must specify either browse_button or drop_element.":"You must specify either browse_button or drop_element.","Init error.":"Init error.","Add files to the upload queue and click the start button.":"Add files to the upload queue and click the start button.","List":"List","Filename":"Filename","%s specified, but cannot be found.":"%s specified, but cannot be found.","Image format either wrong or not supported.":"Image format either wrong or not supported.","Status":"Status","HTTP Error.":"HTTP Error.","Start Upload":"Start Upload","Error: File too large:":"Error: File too large:","kb":"kb","Duplicate file error.":"Duplicate file error.","File size error.":"File size error.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Error: Invalid file extension:","Select files":"Select files","%s already present in the queue.":"%s already present in the queue.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.","File: %s":"File: %s","b":"b","Uploaded %d/%d files":"Uploaded %d/%d files","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Upload element accepts only %d file(s) at a time. Extra files were stripped.","%d files queued":"%d files queued","File: %s, size: %d, max file size: %d":"File: %s, size: %d, max file size: %d","Thumbnails":"Thumbnails","Drag files here.":"Drag files here.","Runtime ran out of available memory.":"Runtime ran out of available memory.","File count error.":"File count error.","File extension error.":"File extension error.","mb":"mb","Add Files":"Add Files"});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -118,10 +118,15 @@
background-color: #eee;
}
.plupload_file_loading .plupload_file_thumb {
.plupload_thumb_loading {
background: #eee url(../img/loading.gif) center no-repeat;
}
.plupload_thumb_loading .plupload_file_dummy,
.plupload_thumb_embedded .plupload_file_dummy {
display: none;
}
.plupload_file_name {
overflow: hidden;
text-overflow: ellipsis;
@@ -344,7 +349,7 @@
font-weight: bold;
}
plupload_message i {
.plupload_message i {
font-style: italic;
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
/**
* Plupload - multi-runtime File Uploader
* v2.1.2
* v2.1.9
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
@@ -8,7 +8,7 @@
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*
* Date: 2014-05-14
* Date: 2016-05-15
*/
/**
* Plupload.js
@@ -94,10 +94,10 @@ var plupload = {
* @static
* @final
*/
VERSION : '2.1.2',
VERSION : '2.1.9',
/**
* Inital state of the queue and also the state ones it's finished all it's uploads.
* The state of the queue before it has started and after it has finished
*
* @property STOPPED
* @static
@@ -288,9 +288,9 @@ var plupload = {
/**
* Generates an unique ID. This is 99.99% unique since it takes the current time and 5 random numbers.
* The only way a user would be able to get the same ID is if the two persons at the same exact milisecond manages
* The only way a user would be able to get the same ID is if the two persons at the same exact millisecond manages
* to get 5 the same random numbers between 0-65535 it also uses a counter so each call will be guaranteed to be page unique.
* It's more probable for the earth to be hit with an ansteriod. You can also if you want to be 100% sure set the plupload.guidPrefix property
* It's more probable for the earth to be hit with an asteriod. You can also if you want to be 100% sure set the plupload.guidPrefix property
* to an user unique key.
*
* @method guid
@@ -303,20 +303,19 @@ var plupload = {
* Get array of DOM Elements by their ids.
*
* @method get
* @for Utils
* @param {String} id Identifier of the DOM Element
* @return {Array}
*/
get : function get(ids) {
getAll : function get(ids) {
var els = [], el;
if (o.typeOf(ids) !== 'array') {
if (plupload.typeOf(ids) !== 'array') {
ids = [ids];
}
var i = ids.length;
while (i--) {
el = o.get(ids[i]);
el = plupload.get(ids[i]);
if (el) {
els.push(el);
}
@@ -325,6 +324,15 @@ var plupload = {
return els.length ? els : null;
},
/**
Get DOM element by id
@method get
@param {String} id Identifier of the DOM Element
@return {Node}
*/
get: o.get,
/**
* Executes the callback function for each item in array/object. If you return false in the
* callback it will break the loop.
@@ -384,7 +392,7 @@ var plupload = {
toArray : o.toArray,
/**
* Find an element in array and return it's index if present, otherwise return -1.
* Find an element in array and return its index if present, otherwise return -1.
*
* @method inArray
* @static
@@ -711,7 +719,7 @@ plupload.addFileFilter('prevent_duplicates', function(value, file, cb) {
@param {String} settings.url URL of the server-side upload handler.
@param {Number|String} [settings.chunk_size=0] Chunk size in bytes to slice the file into. Shorcuts with b, kb, mb, gb, tb suffixes also supported. `e.g. 204800 or "204800b" or "200kb"`. By default - disabled.
@param {Boolean} [settings.send_chunk_number=true] Whether to send chunks and chunk numbers, or total and offset bytes.
@param {String} [settings.container] id of the DOM element to use as a container for uploader structures. Defaults to document.body.
@param {String|DOMElement} [settings.container] id of the DOM element or DOM element itself that will be used to wrap uploader structures. Defaults to immediate parent of the `browse_button` element.
@param {String|DOMElement} [settings.drop_element] id of the DOM element or DOM element itself to use as a drop zone for Drag-n-Drop.
@param {String} [settings.file_data_name="file"] Name for the file field in Multipart formated message.
@param {Object} [settings.filters={}] Set of file type filters.
@@ -737,148 +745,158 @@ plupload.addFileFilter('prevent_duplicates', function(value, file, cb) {
*/
plupload.Uploader = function(options) {
/**
* Fires when the current RunTime has been initialized.
*
* @event Init
* @param {plupload.Uploader} uploader Uploader instance sending the event.
Fires when the current RunTime has been initialized.
@event Init
@param {plupload.Uploader} uploader Uploader instance sending the event.
*/
/**
* Fires after the init event incase you need to perform actions there.
*
* @event PostInit
* @param {plupload.Uploader} uploader Uploader instance sending the event.
Fires after the init event incase you need to perform actions there.
@event PostInit
@param {plupload.Uploader} uploader Uploader instance sending the event.
*/
/**
* Fires when the option is changed in via uploader.setOption().
*
* @event OptionChanged
* @since 2.1
* @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {String} name Name of the option that was changed
* @param {Mixed} value New value for the specified option
* @param {Mixed} oldValue Previous value of the option
Fires when the option is changed in via uploader.setOption().
@event OptionChanged
@since 2.1
@param {plupload.Uploader} uploader Uploader instance sending the event.
@param {String} name Name of the option that was changed
@param {Mixed} value New value for the specified option
@param {Mixed} oldValue Previous value of the option
*/
/**
* Fires when the silverlight/flash or other shim needs to move.
*
* @event Refresh
* @param {plupload.Uploader} uploader Uploader instance sending the event.
Fires when the silverlight/flash or other shim needs to move.
@event Refresh
@param {plupload.Uploader} uploader Uploader instance sending the event.
*/
/**
* Fires when the overall state is being changed for the upload queue.
*
* @event StateChanged
* @param {plupload.Uploader} uploader Uploader instance sending the event.
Fires when the overall state is being changed for the upload queue.
@event StateChanged
@param {plupload.Uploader} uploader Uploader instance sending the event.
*/
/**
* Fires when browse_button is clicked and browse dialog shows.
*
* @event Browse
* @since 2.1.2
* @param {plupload.Uploader} uploader Uploader instance sending the event.
Fires when browse_button is clicked and browse dialog shows.
@event Browse
@since 2.1.2
@param {plupload.Uploader} uploader Uploader instance sending the event.
*/
/**
* Fires for every filtered file before it is added to the queue.
*
* @event FileFiltered
* @since 2.1
* @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {plupload.File} file Another file that has to be added to the queue.
Fires for every filtered file before it is added to the queue.
@event FileFiltered
@since 2.1
@param {plupload.Uploader} uploader Uploader instance sending the event.
@param {plupload.File} file Another file that has to be added to the queue.
*/
/**
* Fires when the file queue is changed. In other words when files are added/removed to the files array of the uploader instance.
*
* @event QueueChanged
* @param {plupload.Uploader} uploader Uploader instance sending the event.
Fires when the file queue is changed. In other words when files are added/removed to the files array of the uploader instance.
@event QueueChanged
@param {plupload.Uploader} uploader Uploader instance sending the event.
*/
/**
* Fires after files were filtered and added to the queue.
*
* @event FilesAdded
* @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {Array} files Array of file objects that were added to queue by the user.
Fires after files were filtered and added to the queue.
@event FilesAdded
@param {plupload.Uploader} uploader Uploader instance sending the event.
@param {Array} files Array of file objects that were added to queue by the user.
*/
/**
* Fires when file is removed from the queue.
*
* @event FilesRemoved
* @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {Array} files Array of files that got removed.
Fires when file is removed from the queue.
@event FilesRemoved
@param {plupload.Uploader} uploader Uploader instance sending the event.
@param {Array} files Array of files that got removed.
*/
/**
* Fires when just before a file is uploaded. This event enables you to override settings
* on the uploader instance before the file is uploaded.
*
* @event BeforeUpload
* @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {plupload.File} file File to be uploaded.
Fires just before a file is uploaded. Can be used to cancel the upload for the specified file
by returning false from the handler.
@event BeforeUpload
@param {plupload.Uploader} uploader Uploader instance sending the event.
@param {plupload.File} file File to be uploaded.
*/
/**
* Fires when a file is to be uploaded by the runtime.
*
* @event UploadFile
* @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {plupload.File} file File to be uploaded.
Fires when a file is to be uploaded by the runtime.
@event UploadFile
@param {plupload.Uploader} uploader Uploader instance sending the event.
@param {plupload.File} file File to be uploaded.
*/
/**
* Fires while a file is being uploaded. Use this event to update the current file upload progress.
*
* @event UploadProgress
* @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {plupload.File} file File that is currently being uploaded.
Fires while a file is being uploaded. Use this event to update the current file upload progress.
@event UploadProgress
@param {plupload.Uploader} uploader Uploader instance sending the event.
@param {plupload.File} file File that is currently being uploaded.
*/
/**
* Fires when file chunk is uploaded.
*
* @event ChunkUploaded
* @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {plupload.File} file File that the chunk was uploaded for.
* @param {Object} response Object with response properties.
Fires when file chunk is uploaded.
@event ChunkUploaded
@param {plupload.Uploader} uploader Uploader instance sending the event.
@param {plupload.File} file File that the chunk was uploaded for.
@param {Object} result Object with response properties.
@param {Number} result.offset The amount of bytes the server has received so far, including this chunk.
@param {Number} result.total The size of the file.
@param {String} result.response The response body sent by the server.
@param {Number} result.status The HTTP status code sent by the server.
@param {String} result.responseHeaders All the response headers as a single string.
*/
/**
* Fires when a file is successfully uploaded.
*
* @event FileUploaded
* @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {plupload.File} file File that was uploaded.
* @param {Object} response Object with response properties.
Fires when a file is successfully uploaded.
@event FileUploaded
@param {plupload.Uploader} uploader Uploader instance sending the event.
@param {plupload.File} file File that was uploaded.
@param {Object} result Object with response properties.
@param {String} result.response The response body sent by the server.
@param {Number} result.status The HTTP status code sent by the server.
@param {String} result.responseHeaders All the response headers as a single string.
*/
/**
* Fires when all files in a queue are uploaded.
*
* @event UploadComplete
* @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {Array} files Array of file objects that was added to queue/selected by the user.
Fires when all files in a queue are uploaded.
@event UploadComplete
@param {plupload.Uploader} uploader Uploader instance sending the event.
@param {Array} files Array of file objects that was added to queue/selected by the user.
*/
/**
* Fires when a error occurs.
*
* @event Error
* @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {Object} error Contains code, message and sometimes file and other details.
Fires when a error occurs.
@event Error
@param {plupload.Uploader} uploader Uploader instance sending the event.
@param {Object} error Contains code, message and sometimes file and other details.
@param {Number} error.code The plupload error code.
@param {String} error.message Description of the error (uses i18n).
*/
/**
* Fires when destroy method is called.
*
* @event Destroy
* @param {plupload.Uploader} uploader Uploader instance sending the event.
Fires when destroy method is called.
@event Destroy
@param {plupload.Uploader} uploader Uploader instance sending the event.
*/
var uid = plupload.guid()
, settings
@@ -1110,7 +1128,12 @@ plupload.Uploader = function(options) {
fileDrop.onready = function() {
var info = o.Runtime.getInfo(this.ruid);
self.features.dragdrop = info.can('drag_and_drop'); // for backward compatibility
// for backward compatibility
o.extend(self.features, {
chunks: info.can('slice_blob'),
multipart: info.can('send_multipart'),
dragdrop: info.can('drag_and_drop')
});
inited++;
fileDrops.push(this);
@@ -1257,11 +1280,15 @@ plupload.Uploader = function(options) {
settings.prevent_duplicates = settings.filters.prevent_duplicates = !!value;
break;
// options that require reinitialisation
case 'container':
case 'browse_button':
case 'drop_element':
value = plupload.get(value);
value = 'container' === option
? plupload.get(value)
: plupload.getAll(value)
;
case 'container':
case 'runtimes':
case 'multi_selection':
case 'flash_swf_url':
@@ -1578,7 +1605,7 @@ plupload.Uploader = function(options) {
up.destroy();
}
// Set failed status if an error occured on a file
else if (err.file) {
else if (err.code === plupload.HTTP_ERROR) {
err.file.status = plupload.FAILED;
calcFile(err.file);
@@ -1725,32 +1752,49 @@ plupload.Uploader = function(options) {
* @method init
*/
init : function() {
var self = this;
var self = this, opt, preinitOpt, err;
if (typeof(settings.preinit) == "function") {
settings.preinit(self);
preinitOpt = self.getOption('preinit');
if (typeof(preinitOpt) == "function") {
preinitOpt(self);
} else {
plupload.each(settings.preinit, function(func, name) {
plupload.each(preinitOpt, function(func, name) {
self.bind(name, func);
});
}
bindEventListeners.call(this);
bindEventListeners.call(self);
// Check for required options
if (!settings.browse_button || !settings.url) {
this.trigger('Error', {
plupload.each(['container', 'browse_button', 'drop_element'], function(el) {
if (self.getOption(el) === null) {
err = {
code : plupload.INIT_ERROR,
message : plupload.translate('Init error.')
message : plupload.translate("'%' specified, but cannot be found.")
}
return false;
}
});
return;
if (err) {
return self.trigger('Error', err);
}
initControls.call(this, settings, function(inited) {
if (typeof(settings.init) == "function") {
settings.init(self);
if (!settings.browse_button && !settings.drop_element) {
return self.trigger('Error', {
code : plupload.INIT_ERROR,
message : plupload.translate("You must specify either 'browse_button' or 'drop_element'.")
});
}
initControls.call(self, settings, function(inited) {
var initOpt = self.getOption('init');
if (typeof(initOpt) == "function") {
initOpt(self);
} else {
plupload.each(settings.init, function(func, name) {
plupload.each(initOpt, function(func, name) {
self.bind(name, func);
});
}
@@ -2036,52 +2080,74 @@ plupload.Uploader = function(options) {
},
/**
* Dispatches the specified event name and it's arguments to all listeners.
*
*
* @method trigger
* @param {String} name Event name to fire.
* @param {Object..} Multiple arguments to pass along to the listener functions.
Dispatches the specified event name and its arguments to all listeners.
@method trigger
@param {String} name Event name to fire.
@param {Object..} Multiple arguments to pass along to the listener functions.
*/
/**
* Check whether uploader has any listeners to the specified event.
*
* @method hasEventListener
* @param {String} name Event name to check for.
*/
// override the parent method to match Plupload-like event logic
dispatchEvent: function(type) {
var list, args, result;
type = type.toLowerCase();
/**
* Adds an event listener by name.
*
* @method bind
* @param {String} name Event name to listen for.
* @param {function} func Function to call ones the event gets fired.
* @param {Object} scope Optional scope to execute the specified function in.
*/
bind : function(name, func, scope) {
var self = this;
// adapt moxie EventTarget style to Plupload-like
plupload.Uploader.prototype.bind.call(this, name, function() {
var args = [].slice.call(arguments);
args.splice(0, 1, self); // replace event object with uploader instance
return func.apply(this, args);
}, 0, scope);
list = this.hasEventListener(type);
if (list) {
// sort event list by priority
list.sort(function(a, b) { return b.priority - a.priority; });
// first argument should be current plupload.Uploader instance
args = [].slice.call(arguments);
args.shift();
args.unshift(this);
for (var i = 0; i < list.length; i++) {
// Fire event, break chain if false is returned
if (list[i].fn.apply(list[i].scope, args) === false) {
return false;
}
}
}
return true;
},
/**
* Removes the specified event listener.
*
* @method unbind
* @param {String} name Name of event to remove.
* @param {function} func Function to remove from listener.
Check whether uploader has any listeners to the specified event.
@method hasEventListener
@param {String} name Event name to check for.
*/
/**
Adds an event listener by name.
@method bind
@param {String} name Event name to listen for.
@param {function} fn Function to call ones the event gets fired.
@param {Object} [scope] Optional scope to execute the specified function in.
@param {Number} [priority=0] Priority of the event handler - handlers with higher priorities will be called first
*/
bind: function(name, fn, scope, priority) {
// adapt moxie EventTarget style to Plupload-like
plupload.Uploader.prototype.bind.call(this, name, fn, priority, scope);
},
/**
Removes the specified event listener.
@method unbind
@param {String} name Name of event to remove.
@param {function} fn Function to remove from listener.
*/
/**
* Removes all event listeners.
*
* @method unbindAll
Removes all event listeners.
@method unbindAll
*/
@@ -2301,7 +2367,7 @@ plupload.File = (function() {
self.bytesPerSec = 0;
/**
* Resets the progress to it's initial values.
* Resets the progress to its initial values.
*
* @method reset
*/

File diff suppressed because one or more lines are too long

13
e107_web/js/plupload/plupload.min.js vendored Normal file

File diff suppressed because one or more lines are too long