1
0
mirror of https://github.com/e107inc/e107.git synced 2025-10-10 12:34:49 +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; background-color: #eee;
} }
.plupload_file_loading .plupload_file_thumb { .plupload_thumb_loading {
background: #eee url(../img/loading.gif) center no-repeat; 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 { .plupload_file_name {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@@ -344,7 +349,7 @@
font-weight: bold; font-weight: bold;
} }
plupload_message i { .plupload_message i {
font-style: italic; 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 * Plupload - multi-runtime File Uploader
* v2.1.2 * v2.1.9
* *
* Copyright 2013, Moxiecode Systems AB * Copyright 2013, Moxiecode Systems AB
* Released under GPL License. * Released under GPL License.
@@ -8,7 +8,7 @@
* License: http://www.plupload.com/license * License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing * Contributing: http://www.plupload.com/contributing
* *
* Date: 2014-05-14 * Date: 2016-05-15
*/ */
/** /**
* Plupload.js * Plupload.js
@@ -94,10 +94,10 @@ var plupload = {
* @static * @static
* @final * @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 * @property STOPPED
* @static * @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. * 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. * 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. * to an user unique key.
* *
* @method guid * @method guid
@@ -303,20 +303,19 @@ var plupload = {
* Get array of DOM Elements by their ids. * Get array of DOM Elements by their ids.
* *
* @method get * @method get
* @for Utils
* @param {String} id Identifier of the DOM Element * @param {String} id Identifier of the DOM Element
* @return {Array} * @return {Array}
*/ */
get : function get(ids) { getAll : function get(ids) {
var els = [], el; var els = [], el;
if (o.typeOf(ids) !== 'array') { if (plupload.typeOf(ids) !== 'array') {
ids = [ids]; ids = [ids];
} }
var i = ids.length; var i = ids.length;
while (i--) { while (i--) {
el = o.get(ids[i]); el = plupload.get(ids[i]);
if (el) { if (el) {
els.push(el); els.push(el);
} }
@@ -325,6 +324,15 @@ var plupload = {
return els.length ? els : null; 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 * Executes the callback function for each item in array/object. If you return false in the
* callback it will break the loop. * callback it will break the loop.
@@ -384,7 +392,7 @@ var plupload = {
toArray : o.toArray, 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 * @method inArray
* @static * @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 {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 {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 {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|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 {String} [settings.file_data_name="file"] Name for the file field in Multipart formated message.
@param {Object} [settings.filters={}] Set of file type filters. @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) { plupload.Uploader = function(options) {
/** /**
* Fires when the current RunTime has been initialized. Fires when the current RunTime has been initialized.
*
* @event Init @event Init
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
*/ */
/** /**
* Fires after the init event incase you need to perform actions there. Fires after the init event incase you need to perform actions there.
*
* @event PostInit @event PostInit
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
*/ */
/** /**
* Fires when the option is changed in via uploader.setOption(). Fires when the option is changed in via uploader.setOption().
*
* @event OptionChanged @event OptionChanged
* @since 2.1 @since 2.1
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {String} name Name of the option that was changed @param {String} name Name of the option that was changed
* @param {Mixed} value New value for the specified option @param {Mixed} value New value for the specified option
* @param {Mixed} oldValue Previous value of the option @param {Mixed} oldValue Previous value of the option
*/ */
/** /**
* Fires when the silverlight/flash or other shim needs to move. Fires when the silverlight/flash or other shim needs to move.
*
* @event Refresh @event Refresh
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
*/ */
/** /**
* Fires when the overall state is being changed for the upload queue. Fires when the overall state is being changed for the upload queue.
*
* @event StateChanged @event StateChanged
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
*/ */
/** /**
* Fires when browse_button is clicked and browse dialog shows. Fires when browse_button is clicked and browse dialog shows.
*
* @event Browse @event Browse
* @since 2.1.2 @since 2.1.2
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
*/ */
/** /**
* Fires for every filtered file before it is added to the queue. Fires for every filtered file before it is added to the queue.
*
* @event FileFiltered @event FileFiltered
* @since 2.1 @since 2.1
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {plupload.File} file Another file that has to be added to the queue. @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. 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 @event QueueChanged
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
*/ */
/** /**
* Fires after files were filtered and added to the queue. Fires after files were filtered and added to the queue.
*
* @event FilesAdded @event FilesAdded
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {Array} files Array of file objects that were added to queue by the user. @param {Array} files Array of file objects that were added to queue by the user.
*/ */
/** /**
* Fires when file is removed from the queue. Fires when file is removed from the queue.
*
* @event FilesRemoved @event FilesRemoved
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {Array} files Array of files that got removed. @param {Array} files Array of files that got removed.
*/ */
/** /**
* Fires when just before a file is uploaded. This event enables you to override settings Fires just before a file is uploaded. Can be used to cancel the upload for the specified file
* on the uploader instance before the file is uploaded. by returning false from the handler.
*
* @event BeforeUpload @event BeforeUpload
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {plupload.File} file File to be uploaded. @param {plupload.File} file File to be uploaded.
*/ */
/** /**
* Fires when a file is to be uploaded by the runtime. Fires when a file is to be uploaded by the runtime.
*
* @event UploadFile @event UploadFile
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {plupload.File} file File to be uploaded. @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. Fires while a file is being uploaded. Use this event to update the current file upload progress.
*
* @event UploadProgress @event UploadProgress
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {plupload.File} file File that is currently being uploaded. @param {plupload.File} file File that is currently being uploaded.
*/ */
/** /**
* Fires when file chunk is uploaded. Fires when file chunk is uploaded.
*
* @event ChunkUploaded @event ChunkUploaded
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {plupload.File} file File that the chunk was uploaded for. @param {plupload.File} file File that the chunk was uploaded for.
* @param {Object} response Object with response properties. @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. Fires when a file is successfully uploaded.
*
* @event FileUploaded @event FileUploaded
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {plupload.File} file File that was uploaded. @param {plupload.File} file File that was uploaded.
* @param {Object} response Object with response properties. @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. Fires when all files in a queue are uploaded.
*
* @event UploadComplete @event UploadComplete
* @param {plupload.Uploader} uploader Uploader instance sending the event. @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. @param {Array} files Array of file objects that was added to queue/selected by the user.
*/ */
/** /**
* Fires when a error occurs. Fires when a error occurs.
*
* @event Error @event Error
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
* @param {Object} error Contains code, message and sometimes file and other details. @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. Fires when destroy method is called.
*
* @event Destroy @event Destroy
* @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.Uploader} uploader Uploader instance sending the event.
*/ */
var uid = plupload.guid() var uid = plupload.guid()
, settings , settings
@@ -1110,7 +1128,12 @@ plupload.Uploader = function(options) {
fileDrop.onready = function() { fileDrop.onready = function() {
var info = o.Runtime.getInfo(this.ruid); 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++; inited++;
fileDrops.push(this); fileDrops.push(this);
@@ -1257,11 +1280,15 @@ plupload.Uploader = function(options) {
settings.prevent_duplicates = settings.filters.prevent_duplicates = !!value; settings.prevent_duplicates = settings.filters.prevent_duplicates = !!value;
break; break;
// options that require reinitialisation
case 'container':
case 'browse_button': case 'browse_button':
case 'drop_element': case 'drop_element':
value = plupload.get(value); value = 'container' === option
? plupload.get(value)
case 'container': : plupload.getAll(value)
;
case 'runtimes': case 'runtimes':
case 'multi_selection': case 'multi_selection':
case 'flash_swf_url': case 'flash_swf_url':
@@ -1578,7 +1605,7 @@ plupload.Uploader = function(options) {
up.destroy(); up.destroy();
} }
// Set failed status if an error occured on a file // 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; err.file.status = plupload.FAILED;
calcFile(err.file); calcFile(err.file);
@@ -1725,32 +1752,49 @@ plupload.Uploader = function(options) {
* @method init * @method init
*/ */
init : function() { init : function() {
var self = this; var self = this, opt, preinitOpt, err;
if (typeof(settings.preinit) == "function") { preinitOpt = self.getOption('preinit');
settings.preinit(self); if (typeof(preinitOpt) == "function") {
preinitOpt(self);
} else { } else {
plupload.each(settings.preinit, function(func, name) { plupload.each(preinitOpt, function(func, name) {
self.bind(name, func); self.bind(name, func);
}); });
} }
bindEventListeners.call(this); bindEventListeners.call(self);
// Check for required options // Check for required options
if (!settings.browse_button || !settings.url) { plupload.each(['container', 'browse_button', 'drop_element'], function(el) {
this.trigger('Error', { if (self.getOption(el) === null) {
code : plupload.INIT_ERROR, err = {
message : plupload.translate('Init error.') code : plupload.INIT_ERROR,
}); message : plupload.translate("'%' specified, but cannot be found.")
return; }
return false;
}
});
if (err) {
return self.trigger('Error', err);
} }
initControls.call(this, settings, function(inited) {
if (typeof(settings.init) == "function") { if (!settings.browse_button && !settings.drop_element) {
settings.init(self); 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 { } else {
plupload.each(settings.init, function(func, name) { plupload.each(initOpt, function(func, name) {
self.bind(name, func); self.bind(name, func);
}); });
} }
@@ -2036,53 +2080,75 @@ plupload.Uploader = function(options) {
}, },
/** /**
* Dispatches the specified event name and it's arguments to all listeners. 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.
*/
/** @method trigger
* Check whether uploader has any listeners to the specified event. @param {String} name Event name to fire.
* @param {Object..} Multiple arguments to pass along to the listener functions.
* @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();
list = this.hasEventListener(type);
/** if (list) {
* Adds an event listener by name. // sort event list by priority
* list.sort(function(a, b) { return b.priority - a.priority; });
* @method bind
* @param {String} name Event name to listen for. // first argument should be current plupload.Uploader instance
* @param {function} func Function to call ones the event gets fired. args = [].slice.call(arguments);
* @param {Object} scope Optional scope to execute the specified function in. args.shift();
*/ args.unshift(this);
bind : function(name, func, scope) {
var self = this; for (var i = 0; i < list.length; i++) {
// adapt moxie EventTarget style to Plupload-like // Fire event, break chain if false is returned
plupload.Uploader.prototype.bind.call(this, name, function() { if (list[i].fn.apply(list[i].scope, args) === false) {
var args = [].slice.call(arguments); return false;
args.splice(0, 1, self); // replace event object with uploader instance }
return func.apply(this, args); }
}, 0, scope); }
return true;
}, },
/** /**
* Removes the specified event listener. Check whether uploader has any listeners to the specified event.
*
* @method unbind @method hasEventListener
* @param {String} name Name of event to remove. @param {String} name Event name to check for.
* @param {function} func Function to remove from listener. */
*/
/** /**
* Removes all event listeners. Adds an event listener by name.
*
* @method unbindAll @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
*/
/** /**
@@ -2301,7 +2367,7 @@ plupload.File = (function() {
self.bytesPerSec = 0; self.bytesPerSec = 0;
/** /**
* Resets the progress to it's initial values. * Resets the progress to its initial values.
* *
* @method reset * @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