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

plupload upgraded to v2.3.6

This commit is contained in:
Cameron
2018-11-23 13:24:14 -08:00
parent 0adf60f9e7
commit 96647b445e
19 changed files with 3241 additions and 2576 deletions

View File

@@ -12,7 +12,7 @@
* jquery.ui.widget.js
* jquery.ui.button.js
* jquery.ui.progressbar.js
*
*
* Optionally:
* jquery.ui.sortable.js
*/
@@ -22,11 +22,11 @@
/**
jQuery UI based implementation of the Plupload API - multi-runtime file uploading API.
To use the widget you must include _jQuery_ and _jQuery UI_ bundle (including `ui.core`, `ui.widget`, `ui.button`,
To use the widget you must include _jQuery_ and _jQuery UI_ bundle (including `ui.core`, `ui.widget`, `ui.button`,
`ui.progressbar` and `ui.sortable`).
In general the widget is designed the way that you do not usually need to do anything to it after you instantiate it.
But! You still can intervenue, to some extent, in case you need to. Although, due to the fact that widget is based on
In general the widget is designed the way that you do not usually need to do anything to it after you instantiate it.
But! You still can intervenue, to some extent, in case you need to. Although, due to the fact that widget is based on
_jQuery UI_ widget factory, there are some specifics. See examples below for more details.
@example
@@ -58,7 +58,7 @@ _jQuery UI_ widget factory, there are some specifics. See examples below for mor
@example
// Subscribing to the events...
// ... on initialization:
$('#uploader').plupload({
$('#uploader').plupload({
...
viewchanged: function(event, args) {
// stuff ...
@@ -102,10 +102,10 @@ _jQuery UI_ widget factory, there are some specifics. See examples below for mor
@param {Boolean} [settings.dragdrop=true] Enable ability to add file to the queue by drag'n'dropping them from the desktop.
@param {Boolean} [settings.rename=false] Enable ability to rename files in the queue.
@param {Boolean} [settings.sortable=false] Enable ability to sort files in the queue, changing their uploading priority.
@param {Object} [settings.buttons] Control the visibility of functional buttons.
@param {Object} [settings.buttons] Control the visibility of functional buttons.
@param {Boolean} [settings.buttons.browse=true] Display browse button.
@param {Boolean} [settings.buttons.start=true] Display start button.
@param {Boolean} [settings.buttons.stop=true] Display stop button.
@param {Boolean} [settings.buttons.stop=true] Display stop button.
@param {Object} [settings.views] Control various views of the file queue.
@param {Boolean} [settings.views.list=true] Enable list view.
@param {Boolean} [settings.views.thumbs=false] Enable thumbs view.
@@ -198,13 +198,13 @@ Dispatched when error of some kind is detected.
@param {Enum} status Status constant matching the plupload states QUEUED, UPLOADING, FAILED, DONE.
*/
var uploaders = {};
var uploaders = {};
function _(str) {
return plupload.translate(str) || str;
}
function renderUI(obj) {
function renderUI(obj) {
obj.id = obj.attr('id');
obj.html(
@@ -236,7 +236,7 @@ function renderUI(obj) {
'<ul class="plupload_filelist_content"> </ul>' +
'<div class="plupload_clearer">&nbsp;</div>' +
'</div>' +
'<table class="plupload_filelist plupload_filelist_footer ui-widget-header">' +
'<tr>' +
'<td class="plupload_cell plupload_file_name">' +
@@ -272,22 +272,22 @@ function renderUI(obj) {
$.widget("ui.plupload", {
widgetEventPrefix: '',
contents_bak: '',
options: {
browse_button_hover: 'ui-state-hover',
browse_button_active: 'ui-state-active',
filters: {},
// widget specific
buttons: {
browse: true,
start: true,
stop: true
stop: true
},
views: {
list: true,
thumbs: false,
@@ -299,14 +299,14 @@ $.widget("ui.plupload", {
thumb_height: 60,
multiple_queues: true, // re-use widget by default
dragdrop : true,
dragdrop : true,
autostart: false,
sortable: false,
rename: false
},
FILE_COUNT_ERROR: -9001,
_create: function() {
var id = this.element.attr('id');
if (!id) {
@@ -314,30 +314,30 @@ $.widget("ui.plupload", {
this.element.attr('id', id);
}
this.id = id;
// backup the elements initial state
this.contents_bak = this.element.html();
renderUI(this.element);
// container, just in case
this.container = $('.plupload_container', this.element).attr('id', id + '_container');
this.container = $('.plupload_container', this.element).attr('id', id + '_container');
this.content = $('.plupload_content', this.element);
if ($.fn.resizable) {
this.container.resizable({
this.container.resizable({
handles: 's',
minHeight: 300
});
}
// list of files, may become sortable
this.filelist = $('.plupload_filelist_content', this.container)
.attr({
id: id + '_filelist',
unselectable: 'on'
});
// buttons
this.browse_button = $('.plupload_add', this.container).attr('id', id + '_browse');
@@ -345,22 +345,22 @@ $.widget("ui.plupload", {
this.stop_button = $('.plupload_stop', this.container).attr('id', id + '_stop');
this.thumbs_switcher = $('#' + id + '_view_thumbs');
this.list_switcher = $('#' + id + '_view_list');
if ($.ui.button) {
this.browse_button.button({
icons: { primary: 'ui-icon-circle-plus' },
disabled: true
});
this.start_button.button({
icons: { primary: 'ui-icon-circle-arrow-e' },
disabled: true
});
this.stop_button.button({
icons: { primary: 'ui-icon-circle-close' }
});
this.list_switcher.button({
text: false,
icons: { secondary: "ui-icon-grip-dotted-horizontal" }
@@ -371,21 +371,21 @@ $.widget("ui.plupload", {
icons: { secondary: "ui-icon-image" }
});
}
// progressbar
this.progressbar = $('.plupload_progress_container', this.container);
this.progressbar = $('.plupload_progress_container', this.container);
if ($.ui.progressbar) {
this.progressbar.progressbar();
}
// counter
this.counter = $('.plupload_count', this.element)
.attr({
id: id + '_count',
name: id + '_count'
});
// initialize uploader instance
this._initUploader();
},
@@ -394,7 +394,7 @@ $.widget("ui.plupload", {
var self = this
, id = this.id
, uploader
, options = {
, options = {
container: id + '_buttons',
browse_button: id + '_browse'
}
@@ -408,9 +408,13 @@ $.widget("ui.plupload", {
}
this.filelist.on('click', function(e) {
if ($(e.target).hasClass('plupload_action_icon')) {
self.removeFile($(e.target).closest('.plupload_file').attr('id'));
e.preventDefault();
var me = $(e.target), fileContainer;
if (me.hasClass('plupload_action_icon')) {
fileContainer = me.closest('.plupload_file');
if (fileContainer.hasClass('plupload_delete')) {
self.removeFile(fileContainer.attr('id'));
e.preventDefault();
}
}
});
@@ -434,7 +438,7 @@ $.widget("ui.plupload", {
if (maxCount <= this.files.length - (this.total.uploaded + this.total.failed)) {
self.browse_button.button('disable');
this.disableBrowse();
this.trigger('Error', {
code : self.FILE_COUNT_ERROR,
message : _("File count error."),
@@ -447,41 +451,41 @@ $.widget("ui.plupload", {
});
uploader.bind('Error', function(up, err) {
uploader.bind('Error', function(up, err) {
var message, details = "";
message = '<strong>' + err.message + '</strong>';
switch (err.code) {
case plupload.FILE_EXTENSION_ERROR:
details = o.sprintf(_("File: %s"), err.file.name);
details = plupload.sprintf(_("File: %s"), err.file.name);
break;
case plupload.FILE_SIZE_ERROR:
details = o.sprintf(_("File: %s, size: %d, max file size: %d"), err.file.name, plupload.formatSize(err.file.size), plupload.formatSize(plupload.parseSize(up.getOption('filters').max_file_size)));
details = plupload.sprintf(_("File: %s, size: %d, max file size: %d"), err.file.name, plupload.formatSize(err.file.size), plupload.formatSize(plupload.parseSize(up.getOption('filters').max_file_size)));
break;
case plupload.FILE_DUPLICATE_ERROR:
details = o.sprintf(_("%s already present in the queue."), err.file.name);
details = plupload.sprintf(_("%s already present in the queue."), err.file.name);
break;
case self.FILE_COUNT_ERROR:
details = o.sprintf(_("Upload element accepts only %d file(s) at a time. Extra files were stripped."), up.getOption('filters').max_file_count || 0);
details = plupload.sprintf(_("Upload element accepts only %d file(s) at a time. Extra files were stripped."), up.getOption('filters').max_file_count || 0);
break;
case plupload.IMAGE_FORMAT_ERROR :
details = _("Image format either wrong or not supported.");
break;
break;
case plupload.IMAGE_MEMORY_ERROR :
details = _("Runtime ran out of available memory.");
break;
/* // This needs a review
case plupload.IMAGE_DIMENSIONS_ERROR :
details = o.sprintf(_('Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.'), up.runtime, up.features.maxWidth, up.features.maxHeight);
details = plupload.sprintf(_('Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.'), up.runtime, up.features.maxWidth, up.features.maxHeight);
break; */
case plupload.HTTP_ERROR:
details = _("Upload URL might be wrong or doesn't exist.");
break;
@@ -501,8 +505,8 @@ $.widget("ui.plupload", {
}
});
uploader.bind('PostInit', function(up) {
uploader.bind('PostInit', function(up) {
// all buttons are optional, so they can be disabled and hidden
if (!self.options.buttons.browse) {
self.browse_button.button('disable').hide();
@@ -510,17 +514,17 @@ $.widget("ui.plupload", {
} else {
self.browse_button.button('enable');
}
if (!self.options.buttons.start) {
self.start_button.button('disable').hide();
}
}
if (!self.options.buttons.stop) {
self.stop_button.button('disable').hide();
}
if (!self.options.unique_names && self.options.rename) {
self._enableRenaming();
self._enableRenaming();
}
if (self.options.dragdrop && up.features.dragdrop) {
@@ -528,7 +532,7 @@ $.widget("ui.plupload", {
}
self._enableViewSwitcher();
self.start_button.click(function(e) {
if (!$(this).button('option', 'disabled')) {
self.start();
@@ -543,24 +547,24 @@ $.widget("ui.plupload", {
self._trigger('ready', null, { up: up });
});
// uploader internal events must run first
// uploader internal events must run first
uploader.init();
uploader.bind('FileFiltered', function(up, file) {
self._addFiles(file);
});
uploader.bind('FilesAdded', function(up, files) {
self._trigger('selected', null, { up: up, files: files } );
// re-enable sortable
if (self.options.sortable && $.ui.sortable) {
self._enableSortingList();
self._enableSortingList();
}
self._trigger('updatelist', null, { filelist: self.filelist });
if (self.options.autostart) {
// set a little delay to make sure that QueueChanged triggered by the core has time to complete
setTimeout(function() {
@@ -568,11 +572,11 @@ $.widget("ui.plupload", {
}, 10);
}
});
uploader.bind('FilesRemoved', function(up, files) {
// destroy sortable if enabled
if ($.ui.sortable && self.options.sortable) {
$('tbody', self.filelist).sortable('destroy');
$('tbody', self.filelist).sortable('destroy');
}
$.each(files, function(i, file) {
@@ -580,18 +584,18 @@ $.widget("ui.plupload", {
$(this).remove();
});
});
if (up.files.length) {
// re-initialize sortable
if (self.options.sortable && $.ui.sortable) {
self._enableSortingList();
self._enableSortingList();
}
}
self._trigger('updatelist', null, { filelist: self.filelist });
self._trigger('removed', null, { up: up, files: files } );
});
uploader.bind('QueueChanged', function() {
self._handleState();
});
@@ -604,35 +608,35 @@ $.widget("ui.plupload", {
self._trigger('stopped', null, { up: this.uploader });
}
});
uploader.bind('UploadFile', function(up, file) {
self._handleFileStatus(file);
});
uploader.bind('FileUploaded', function(up, file, result) {
self._handleFileStatus(file);
self._trigger('uploaded', null, { up: up, file: file, result: result } );
});
uploader.bind('UploadProgress', function(up, file) {
self._handleFileStatus(file);
self._updateTotalProgress();
self._trigger('progress', null, { up: up, file: file } );
});
uploader.bind('UploadComplete', function(up, files) {
self._addFormFields();
self._addFormFields();
self._trigger('complete', null, { up: up, files: files } );
});
},
_setOption: function(key, value) {
var self = this;
if (key == 'buttons' && typeof(value) == 'object') {
if (key == 'buttons' && typeof(value) == 'object') {
value = $.extend(self.options.buttons, value);
if (!value.browse) {
self.browse_button.button('disable').hide();
self.uploader.disableBrowse(true);
@@ -640,24 +644,24 @@ $.widget("ui.plupload", {
self.browse_button.button('enable').show();
self.uploader.disableBrowse(false);
}
if (!value.start) {
self.start_button.button('disable').hide();
} else {
self.start_button.button('enable').show();
}
if (!value.stop) {
self.stop_button.button('disable').hide();
} else {
self.start_button.button('enable').show();
self.start_button.button('enable').show();
}
}
self.uploader.setOption(key, value);
self.uploader.setOption(key, value);
},
/**
Start upload. Triggers `start` event.
@@ -667,7 +671,7 @@ $.widget("ui.plupload", {
this.uploader.start();
},
/**
Stop upload. Triggers `stop` event.
@@ -699,7 +703,7 @@ $.widget("ui.plupload", {
this.uploader.disableBrowse(true);
},
/**
Retrieve file by its unique id.
@@ -709,18 +713,18 @@ $.widget("ui.plupload", {
*/
getFile: function(id) {
var file;
if (typeof id === 'number') {
file = this.uploader.files[id];
file = this.uploader.files[id];
} else {
file = this.uploader.getFile(id);
file = this.uploader.getFile(id);
}
return file;
},
/**
Return array of files currently in the queue.
@method getFiles
@return {Array} Array of files in the queue represented by plupload.File objects
*/
@@ -728,7 +732,7 @@ $.widget("ui.plupload", {
return this.uploader.files;
},
/**
Remove the file from the queue.
@@ -742,7 +746,7 @@ $.widget("ui.plupload", {
this.uploader.removeFile(file);
},
/**
Clear the file queue.
@@ -786,12 +790,12 @@ $.widget("ui.plupload", {
*/
notify: function(type, message) {
var popup = $(
'<div class="plupload_message">' +
'<div class="plupload_message">' +
'<span class="plupload_message_close ui-icon ui-icon-circle-close" title="'+_('Close')+'"></span>' +
'<p><span class="ui-icon"></span>' + message + '</p>' +
'</div>'
);
popup
.addClass('ui-state-' + (type === 'error' ? 'error' : 'highlight'))
.find('p .ui-icon')
@@ -799,42 +803,42 @@ $.widget("ui.plupload", {
.end()
.find('.plupload_message_close')
.click(function() {
popup.remove();
popup.remove();
})
.end();
$('.plupload_header', this.container).append(popup);
},
/**
Destroy the widget, the uploader, free associated resources and bring back original html.
@method destroy
*/
destroy: function() {
destroy: function() {
// destroy uploader instance
this.uploader.destroy();
// unbind all button events
$('.plupload_button', this.element).unbind();
// destroy buttons
if ($.ui.button) {
$('.plupload_add, .plupload_start, .plupload_stop', this.container)
.button('destroy');
}
// destroy progressbar
if ($.ui.progressbar) {
this.progressbar.progressbar('destroy');
this.progressbar.progressbar('destroy');
}
// destroy sortable behavior
if ($.ui.sortable && this.options.sortable) {
$('tbody', this.filelist).sortable('destroy');
}
// restore the elements initial state
this.element
.empty()
@@ -843,15 +847,15 @@ $.widget("ui.plupload", {
$.Widget.prototype.destroy.apply(this);
},
_handleState: function() {
var up = this.uploader
, filesPending = up.files.length - (up.total.uploaded + up.total.failed)
, maxCount = up.getOption('filters').max_file_count || 0
;
if (plupload.STARTED === up.state) {
if (plupload.STARTED === up.state) {
$([])
.add(this.stop_button)
.add('.plupload_started')
@@ -863,10 +867,10 @@ $.widget("ui.plupload", {
this.browse_button.button('disable');
up.disableBrowse();
}
$('.plupload_upload_status', this.element).html(o.sprintf(_('Uploaded %d/%d files'), up.total.uploaded, up.files.length));
$('.plupload_upload_status', this.element).html(plupload.sprintf(_('Uploaded %d/%d files'), up.total.uploaded, up.files.length));
$('.plupload_header_content', this.element).addClass('plupload_header_content_bw');
}
}
else if (plupload.STOPPED === up.state) {
$([])
.add(this.stop_button)
@@ -878,10 +882,10 @@ $.widget("ui.plupload", {
} else {
this.start_button.button('disable');
}
if (this.options.multiple_queues) {
$('.plupload_header_content', this.element).removeClass('plupload_header_content_bw');
}
}
// if max_file_count defined, only that many files can be queued at once
if (this.options.multiple_queues && maxCount && maxCount > filesPending) {
@@ -895,27 +899,30 @@ $.widget("ui.plupload", {
if (up.total.queued === 0) {
$('.ui-button-text', this.browse_button).html(_('Add Files'));
} else {
$('.ui-button-text', this.browse_button).html(o.sprintf(_('%d files queued'), up.total.queued));
$('.ui-button-text', this.browse_button).html(plupload.sprintf(_('%d files queued'), up.total.queued));
}
// have a helper class on a container expressing whether it has files queued or not
this.container.toggleClass('plupload_files_queued', up.files.length);
up.refresh();
},
_handleFileStatus: function(file) {
var $file = $('#' + file.id), actionClass, iconClass;
// since this method might be called asynchronously, file row might not yet be rendered
if (!$file.length) {
return;
return;
}
switch (file.status) {
case plupload.DONE:
case plupload.DONE:
actionClass = 'plupload_done';
iconClass = 'plupload_action_icon ui-icon ui-icon-circle-check';
break;
case plupload.FAILED:
actionClass = 'ui-state-error plupload_failed';
iconClass = 'plupload_action_icon ui-icon ui-icon-alert';
@@ -929,17 +936,17 @@ $.widget("ui.plupload", {
case plupload.UPLOADING:
actionClass = 'ui-state-highlight plupload_uploading';
iconClass = 'plupload_action_icon ui-icon ui-icon-circle-arrow-w';
// scroll uploading file into the view if its bottom boundary is out of it
var scroller = $('.plupload_scroll', this.container)
, scrollTop = scroller.scrollTop()
, scrollerHeight = scroller.height()
, rowOffset = $file.position().top + $file.height()
;
if (scrollerHeight < rowOffset) {
scroller.scrollTop(scrollTop + rowOffset - scrollerHeight);
}
}
// Set file specific progress
$file
@@ -950,7 +957,7 @@ $.widget("ui.plupload", {
.css('width', file.percent + '%')
.end()
.find('.plupload_file_size')
.html(plupload.formatSize(file.size));
.html(plupload.formatSize(file.size));
break;
}
actionClass += ' ui-state-default plupload_file';
@@ -960,16 +967,16 @@ $.widget("ui.plupload", {
.find('.plupload_action_icon')
.attr('class', iconClass);
},
_updateTotalProgress: function() {
var up = this.uploader;
// Scroll to end of file list
this.filelist[0].scrollTop = this.filelist[0].scrollHeight;
this.progressbar.progressbar('value', up.total.percent);
this.element
.find('.plupload_total_status')
.html(up.total.percent + '%')
@@ -978,7 +985,7 @@ $.widget("ui.plupload", {
.html(plupload.formatSize(up.total.size))
.end()
.find('.plupload_upload_status')
.html(o.sprintf(_('Uploaded %d/%d files'), up.total.uploaded, up.files.length));
.html(plupload.sprintf(_('Uploaded %d/%d files'), up.total.uploaded, up.files.length));
},
@@ -998,7 +1005,7 @@ $.widget("ui.plupload", {
function onLast(el, eventName, cb) {
var timer;
el.on(eventName, function() {
clearTimeout(timer);
timer = setTimeout(function() {
@@ -1032,7 +1039,7 @@ $.widget("ui.plupload", {
.filter('.plupload_thumb_toload')
.get();
}
function init() {
function mpl() { // measure, pick, load
@@ -1058,17 +1065,19 @@ $.widget("ui.plupload", {
function preloadThumb(file, cb) {
var img = new o.Image();
var img = new o.image.Image();
var resolveUrl = o.core.utils.Url.resolveUrl;
img.onload = function() {
var thumb = $('#' + file.id + ' .plupload_file_thumb', self.filelist);
this.embed(thumb[0], {
width: self.options.thumb_width,
height: self.options.thumb_height,
this.embed(thumb[0], {
width: self.options.thumb_width,
height: self.options.thumb_height,
crop: true,
fit: true,
preserveHeaders: false,
swf_url: o.resolveUrl(self.options.flash_swf_url),
xap_url: o.resolveUrl(self.options.silverlight_xap_url)
swf_url: resolveUrl(self.options.flash_swf_url),
xap_url: resolveUrl(self.options.silverlight_xap_url)
});
};
@@ -1094,7 +1103,7 @@ $.widget("ui.plupload", {
function lazyLoad() {
if (self.view_mode !== 'thumbs' || loading) {
return;
}
}
pickThumbsToLoad();
if (!thumbs.length) {
@@ -1125,12 +1134,12 @@ $.widget("ui.plupload", {
'<div class="plupload_file_dummy ui-widget-content" style="line-height: {thumb_height}px;"><span class="ui-state-disabled">{ext} </span></div>' +
'</div>' +
'<div class="plupload_file_status">' +
'<div class="plupload_file_progress ui-widget-header" style="width: 0%"> </div>' +
'<div class="plupload_file_progress ui-widget-header" style="width: 0%"> </div>' +
'<span class="plupload_file_percent">{percent} </span>' +
'</div>' +
'<div class="plupload_file_name" title="{name}">' +
'<span class="plupload_file_name_wrapper">{name} </span>' +
'</div>' +
'</div>' +
'<div class="plupload_file_action">' +
'<div class="plupload_action_icon ui-icon ui-icon-circle-minus"> </div>' +
'</div>' +
@@ -1143,14 +1152,14 @@ $.widget("ui.plupload", {
}
$.each(files, function(i, file) {
var ext = o.Mime.getFileExtension(file.name) || 'none';
var ext = o.core.utils.Mime.getFileExtension(file.name) || 'none';
html += file_html.replace(/\{(\w+)\}/g, function($0, $1) {
switch ($1) {
case 'thumb_width':
case 'thumb_height':
return self.options[$1];
case 'size':
return plupload.formatSize(file.size);
@@ -1189,20 +1198,20 @@ $.widget("ui.plupload", {
this.counter.val(this.uploader.files.length);
},
_viewChanged: function(view) {
// update or write a new cookie
if (this.options.views.remember && $.cookie) {
$.cookie('plupload_ui_view', view, { expires: 7, path: '/' });
}
}
// ugly fix for IE6 - make content area stretchable
if (o.Env.browser === 'IE' && o.Env.version < 7) {
if (plupload.ua.browser === 'IE' && plupload.ua.version < 7) {
this.content.attr('style', 'height:expression(document.getElementById("' + this.id + '_container' + '").clientHeight - ' + (view === 'list' ? 132 : 102) + ')');
}
this.container.removeClass('plupload_view_list plupload_view_thumbs').addClass('plupload_view_' + view);
this.container.removeClass('plupload_view_list plupload_view_thumbs').addClass('plupload_view_' + view);
this.view_mode = view;
this._trigger('viewchanged', null, { view: view });
},
@@ -1264,20 +1273,26 @@ $.widget("ui.plupload", {
this._displayThumbs();
}
},
_enableRenaming: function() {
var self = this;
this.filelist.dblclick(function(e) {
var nameSpan = $(e.target), nameInput, file, parts, name, ext = "";
var nameInput, fileContainer, file, parts, name, ext = "";
var nameSpan = $(e.target);
if (!nameSpan.hasClass('plupload_file_name_wrapper')) {
return;
}
fileContainer = nameSpan.closest('.plupload_file');
if (!fileContainer.hasClass('plupload_delete')) {
return;
}
// Get file name and split out name and extension
file = self.uploader.getFile(nameSpan.closest('.plupload_file')[0].id);
file = self.uploader.getFile(fileContainer[0].id);
name = file.name;
parts = /^(.+)(\.[^.]+)$/.exec(name);
if (parts) {
@@ -1305,39 +1320,39 @@ $.widget("ui.plupload", {
})[0].focus();
});
},
_enableSortingList: function() {
var self = this;
if ($('.plupload_file', this.filelist).length < 2) {
return;
return;
}
// destroy sortable if enabled
$('tbody', this.filelist).sortable('destroy');
// enable
$('tbody', this.filelist).sortable('destroy');
// enable
this.filelist.sortable({
items: '.plupload_delete',
cancel: 'object, .plupload_clearer',
stop: function() {
var files = [];
$.each($(this).sortable('toArray'), function(i, id) {
files[files.length] = self.uploader.getFile(id);
});
});
files.unshift(files.length);
files.unshift(0);
// re-populate files array
Array.prototype.splice.apply(self.uploader.files, files);
// re-populate files array
Array.prototype.splice.apply(self.uploader.files, files);
}
});
});
}
});
} (window, document, plupload, mOxie, jQuery));
} (window, document, plupload, moxie, jQuery));