aboutsummaryrefslogtreecommitdiffstats
path: root/themes/default/js/plugins/plupload/jquery.plupload.queue
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2014-05-27 14:11:23 +0000
committerplegall <plg@piwigo.org>2014-05-27 14:11:23 +0000
commit70bcfb5b861894ecfc5df386921586e3b2ff2555 (patch)
tree32097608fa5b827138ab3069b469c59b1d1f6bcb /themes/default/js/plugins/plupload/jquery.plupload.queue
parent39fc0a9f9a5248783eebea7bd05d45d5318a3409 (diff)
feature 2616: HTML5 upload (with plupload 2.1.2). First basic implementation. Needs customization.
Chunked upload + Drag & drop (no more Flash) use a new specific API method pwg.images.upload git-svn-id: http://piwigo.org/svn/trunk@28545 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'themes/default/js/plugins/plupload/jquery.plupload.queue')
-rw-r--r--themes/default/js/plugins/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css185
-rw-r--r--themes/default/js/plugins/plupload/jquery.plupload.queue/img/backgrounds.gifbin0 -> 2977 bytes
-rw-r--r--themes/default/js/plugins/plupload/jquery.plupload.queue/img/buttons-disabled.pngbin0 -> 1292 bytes
-rw-r--r--themes/default/js/plugins/plupload/jquery.plupload.queue/img/buttons.pngbin0 -> 1439 bytes
-rw-r--r--themes/default/js/plugins/plupload/jquery.plupload.queue/img/delete.gifbin0 -> 180 bytes
-rw-r--r--themes/default/js/plugins/plupload/jquery.plupload.queue/img/done.gifbin0 -> 1024 bytes
-rw-r--r--themes/default/js/plugins/plupload/jquery.plupload.queue/img/error.gifbin0 -> 994 bytes
-rw-r--r--themes/default/js/plugins/plupload/jquery.plupload.queue/img/throbber.gifbin0 -> 1922 bytes
-rw-r--r--themes/default/js/plugins/plupload/jquery.plupload.queue/img/transp50.pngbin0 -> 399 bytes
-rw-r--r--themes/default/js/plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.js428
-rw-r--r--themes/default/js/plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js1
11 files changed, 614 insertions, 0 deletions
diff --git a/themes/default/js/plugins/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css b/themes/default/js/plugins/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css
new file mode 100644
index 000000000..6bfe0e5e3
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css
@@ -0,0 +1,185 @@
+/*
+ Plupload
+------------------------------------------------------------------- */
+
+.plupload_wrapper * {
+ box-sizing: content-box;
+}
+
+.plupload_button {
+ display: -moz-inline-box; /* FF < 3*/
+ display: inline-block;
+ font: normal 12px sans-serif;
+ text-decoration: none;
+ color: #42454a;
+ border: 1px solid #bababa;
+ padding: 2px 8px 3px 20px;
+ margin-right: 4px;
+ background: #f3f3f3 url('../img/buttons.png') no-repeat 0 center;
+ outline: 0;
+
+ /* Optional rounded corners for browsers that support it */
+ -moz-border-radius: 3px;
+ -khtml-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.plupload_button:hover {
+ color: #000;
+ text-decoration: none;
+}
+
+.plupload_disabled, a.plupload_disabled:hover {
+ color: #737373;
+ border-color: #c5c5c5;
+ background: #ededed url('../img/buttons-disabled.png') no-repeat 0 center;
+ cursor: default;
+}
+
+.plupload_add {
+ background-position: -181px center;
+}
+
+.plupload_wrapper {
+ font: normal 11px Verdana,sans-serif;
+ width: 100%;
+}
+
+.plupload_container {
+ padding: 8px;
+ background: url('../img/transp50.png');
+ /*-moz-border-radius: 5px;*/
+}
+
+.plupload_container input {
+ border: 1px solid #DDD;
+ font: normal 11px Verdana,sans-serif;
+ width: 98%;
+}
+
+.plupload_header {background: #2A2C2E url('../img/backgrounds.gif') repeat-x;}
+.plupload_header_content {
+ background: url('../img/backgrounds.gif') no-repeat 0 -317px;
+ min-height: 56px;
+ padding-left: 60px;
+ color: #FFF;
+}
+.plupload_header_title {
+ font: normal 18px sans-serif;
+ padding: 6px 0 3px;
+}
+.plupload_header_text {
+ font: normal 12px sans-serif;
+}
+
+.plupload_filelist {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.plupload_scroll .plupload_filelist {
+ height: 185px;
+ background: #F5F5F5;
+ overflow-y: scroll;
+}
+
+.plupload_filelist li {
+ padding: 10px 8px;
+ background: #F5F5F5 url('../img/backgrounds.gif') repeat-x 0 -156px;
+ border-bottom: 1px solid #DDD;
+}
+
+.plupload_filelist_header, .plupload_filelist_footer {
+ background: #DFDFDF;
+ padding: 8px 8px;
+ color: #42454A;
+}
+.plupload_filelist_header {
+ border-top: 1px solid #EEE;
+ border-bottom: 1px solid #CDCDCD;
+}
+
+.plupload_filelist_footer {border-top: 1px solid #FFF; height: 22px; line-height: 20px; vertical-align: middle;}
+.plupload_file_name {float: left; overflow: hidden}
+.plupload_file_status {color: #777;}
+.plupload_file_status span {color: #42454A;}
+.plupload_file_size, .plupload_file_status, .plupload_progress {
+ float: right;
+ width: 80px;
+}
+.plupload_file_size, .plupload_file_status, .plupload_file_action {text-align: right;}
+
+.plupload_filelist .plupload_file_name {
+ width: 205px;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+
+.plupload_file_action {
+ float: right;
+ width: 16px;
+ height: 16px;
+ margin-left: 15px;
+}
+
+.plupload_file_action * {
+ display: none;
+ width: 16px;
+ height: 16px;
+}
+
+li.plupload_uploading {background: #ECF3DC url('../img/backgrounds.gif') repeat-x 0 -238px;}
+li.plupload_done {color:#AAA}
+
+li.plupload_delete a {
+ background: url('../img/delete.gif');
+}
+
+li.plupload_failed a {
+ background: url('../img/error.gif');
+ cursor: default;
+}
+
+li.plupload_done a {
+ background: url('../img/done.gif');
+ cursor: default;
+}
+
+.plupload_progress, .plupload_upload_status {
+ display: none;
+}
+
+.plupload_progress_container {
+ margin-top: 3px;
+ border: 1px solid #CCC;
+ background: #FFF;
+ padding: 1px;
+}
+.plupload_progress_bar {
+ width: 0px;
+ height: 7px;
+ background: #CDEB8B;
+}
+
+.plupload_scroll .plupload_filelist_header .plupload_file_action, .plupload_scroll .plupload_filelist_footer .plupload_file_action {
+ margin-right: 17px;
+}
+
+/* Floats */
+
+.plupload_clear,.plupload_clearer {clear: both;}
+.plupload_clearer, .plupload_progress_bar {
+ display: block;
+ font-size: 0;
+ line-height: 0;
+}
+
+li.plupload_droptext {
+ background: transparent;
+ text-align: center;
+ vertical-align: middle;
+ border: 0;
+ line-height: 165px;
+}
diff --git a/themes/default/js/plugins/plupload/jquery.plupload.queue/img/backgrounds.gif b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/backgrounds.gif
new file mode 100644
index 000000000..39e33ebc0
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/backgrounds.gif
Binary files differ
diff --git a/themes/default/js/plugins/plupload/jquery.plupload.queue/img/buttons-disabled.png b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/buttons-disabled.png
new file mode 100644
index 000000000..afa11af9b
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/buttons-disabled.png
Binary files differ
diff --git a/themes/default/js/plugins/plupload/jquery.plupload.queue/img/buttons.png b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/buttons.png
new file mode 100644
index 000000000..153e73885
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/buttons.png
Binary files differ
diff --git a/themes/default/js/plugins/plupload/jquery.plupload.queue/img/delete.gif b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/delete.gif
new file mode 100644
index 000000000..78ca8b3b4
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/delete.gif
Binary files differ
diff --git a/themes/default/js/plugins/plupload/jquery.plupload.queue/img/done.gif b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/done.gif
new file mode 100644
index 000000000..29f3ed7c9
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/done.gif
Binary files differ
diff --git a/themes/default/js/plugins/plupload/jquery.plupload.queue/img/error.gif b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/error.gif
new file mode 100644
index 000000000..4682b6300
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/error.gif
Binary files differ
diff --git a/themes/default/js/plugins/plupload/jquery.plupload.queue/img/throbber.gif b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/throbber.gif
new file mode 100644
index 000000000..4ae8b16a5
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/throbber.gif
Binary files differ
diff --git a/themes/default/js/plugins/plupload/jquery.plupload.queue/img/transp50.png b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/transp50.png
new file mode 100644
index 000000000..eb0efe104
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.plupload.queue/img/transp50.png
Binary files differ
diff --git a/themes/default/js/plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.js b/themes/default/js/plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.js
new file mode 100644
index 000000000..6894ecde9
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.js
@@ -0,0 +1,428 @@
+/**
+ * jquery.plupload.queue.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under GPL License.
+ *
+ * License: http://www.plupload.com/license
+ * Contributing: http://www.plupload.com/contributing
+ */
+
+/* global jQuery:true, alert:true */
+
+/**
+jQuery based implementation of the Plupload API - multi-runtime file uploading API.
+
+To use the widget you must include _jQuery_. It is not meant to be extended in any way and is provided to be
+used as it is.
+
+@example
+ <!-- Instantiating: -->
+ <div id="uploader">
+ <p>Your browser doesn't have Flash, Silverlight or HTML5 support.</p>
+ </div>
+
+ <script>
+ $('#uploader').pluploadQueue({
+ url : '../upload.php',
+ filters : [
+ {title : "Image files", extensions : "jpg,gif,png"}
+ ],
+ rename: true,
+ flash_swf_url : '../../js/Moxie.swf',
+ silverlight_xap_url : '../../js/Moxie.xap',
+ });
+ </script>
+
+@example
+ // Retrieving a reference to plupload.Uploader object
+ var uploader = $('#uploader').pluploadQueue();
+
+ uploader.bind('FilesAdded', function() {
+
+ // Autostart
+ setTimeout(uploader.start, 1); // "detach" from the main thread
+ });
+
+@class pluploadQueue
+@constructor
+@param {Object} settings For detailed information about each option check documentation.
+ @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 {String} [settings.file_data_name="file"] Name for the file field in Multipart formated message.
+ @param {Array} [settings.filters=[]] Set of file type filters, each one defined by hash of title and extensions. `e.g. {title : "Image files", extensions : "jpg,jpeg,gif,png"}`. Dispatches `plupload.FILE_EXTENSION_ERROR`
+ @param {String} [settings.flash_swf_url] URL of the Flash swf.
+ @param {Object} [settings.headers] Custom headers to send with the upload. Hash of name/value pairs.
+ @param {Number|String} [settings.max_file_size] Maximum file size that the user can pick, in bytes. Optionally supports b, kb, mb, gb, tb suffixes. `e.g. "10mb" or "1gb"`. By default - not set. Dispatches `plupload.FILE_SIZE_ERROR`.
+ @param {Number} [settings.max_retries=0] How many times to retry the chunk or file, before triggering Error event.
+ @param {Boolean} [settings.multipart=true] Whether to send file and additional parameters as Multipart formated message.
+ @param {Object} [settings.multipart_params] Hash of key/value pairs to send with every file upload.
+ @param {Boolean} [settings.multi_selection=true] Enable ability to select multiple files at once in file dialog.
+ @param {Boolean} [settings.prevent_duplicates=false] Do not let duplicates into the queue. Dispatches `plupload.FILE_DUPLICATE_ERROR`.
+ @param {String|Object} [settings.required_features] Either comma-separated list or hash of required features that chosen runtime should absolutely possess.
+ @param {Object} [settings.resize] Enable resizng of images on client-side. Applies to `image/jpeg` and `image/png` only. `e.g. {width : 200, height : 200, quality : 90, crop: true}`
+ @param {Number} [settings.resize.width] If image is bigger, it will be resized.
+ @param {Number} [settings.resize.height] If image is bigger, it will be resized.
+ @param {Number} [settings.resize.quality=90] Compression quality for jpegs (1-100).
+ @param {Boolean} [settings.resize.crop=false] Whether to crop images to exact dimensions. By default they will be resized proportionally.
+ @param {String} [settings.runtimes="html5,flash,silverlight,html4"] Comma separated list of runtimes, that Plupload will try in turn, moving to the next if previous fails.
+ @param {String} [settings.silverlight_xap_url] URL of the Silverlight xap.
+ @param {Boolean} [settings.unique_names=false] If true will generate unique filenames for uploaded files.
+
+ @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.multiple_queues=true] Re-activate the widget after each upload procedure.
+*/
+;(function($, o) {
+ var uploaders = {};
+
+ function _(str) {
+ return plupload.translate(str) || str;
+ }
+
+ function renderUI(id, target) {
+ // Remove all existing non plupload items
+ target.contents().each(function(i, node) {
+ node = $(node);
+
+ if (!node.is('.plupload')) {
+ node.remove();
+ }
+ });
+
+ target.prepend(
+ '<div class="plupload_wrapper plupload_scroll">' +
+ '<div id="' + id + '_container" class="plupload_container">' +
+ '<div class="plupload">' +
+ '<div class="plupload_header">' +
+ '<div class="plupload_header_content">' +
+ '<div class="plupload_header_title">' + _('Select files') + '</div>' +
+ '<div class="plupload_header_text">' + _('Add files to the upload queue and click the start button.') + '</div>' +
+ '</div>' +
+ '</div>' +
+
+ '<div class="plupload_content">' +
+ '<div class="plupload_filelist_header">' +
+ '<div class="plupload_file_name">' + _('Filename') + '</div>' +
+ '<div class="plupload_file_action">&nbsp;</div>' +
+ '<div class="plupload_file_status"><span>' + _('Status') + '</span></div>' +
+ '<div class="plupload_file_size">' + _('Size') + '</div>' +
+ '<div class="plupload_clearer">&nbsp;</div>' +
+ '</div>' +
+
+ '<ul id="' + id + '_filelist" class="plupload_filelist"></ul>' +
+
+ '<div class="plupload_filelist_footer">' +
+ '<div class="plupload_file_name">' +
+ '<div class="plupload_buttons">' +
+ '<a href="#" class="plupload_button plupload_add" id="' + id + '_browse">' + _('Add Files') + '</a>' +
+ '<a href="#" class="plupload_button plupload_start">' + _('Start Upload') + '</a>' +
+ '</div>' +
+ '<span class="plupload_upload_status"></span>' +
+ '</div>' +
+ '<div class="plupload_file_action"></div>' +
+ '<div class="plupload_file_status"><span class="plupload_total_status">0%</span></div>' +
+ '<div class="plupload_file_size"><span class="plupload_total_file_size">0 b</span></div>' +
+ '<div class="plupload_progress">' +
+ '<div class="plupload_progress_container">' +
+ '<div class="plupload_progress_bar"></div>' +
+ '</div>' +
+ '</div>' +
+ '<div class="plupload_clearer">&nbsp;</div>' +
+ '</div>' +
+ '</div>' +
+ '</div>' +
+ '</div>' +
+ '<input type="hidden" id="' + id + '_count" name="' + id + '_count" value="0" />' +
+ '</div>'
+ );
+ }
+
+ $.fn.pluploadQueue = function(settings) {
+ if (settings) {
+ this.each(function() {
+ var uploader, target, id, contents_bak;
+
+ target = $(this);
+ id = target.attr('id');
+
+ if (!id) {
+ id = plupload.guid();
+ target.attr('id', id);
+ }
+
+ contents_bak = target.html();
+ renderUI(id, target);
+
+ settings = $.extend({
+ dragdrop : true,
+ browse_button : id + '_browse',
+ container : id
+ }, settings);
+
+ // Enable drag/drop (see PostInit handler as well)
+ if (settings.dragdrop) {
+ settings.drop_element = id + '_filelist';
+ }
+
+ uploader = new plupload.Uploader(settings);
+
+ uploaders[id] = uploader;
+
+ function handleStatus(file) {
+ var actionClass;
+
+ if (file.status == plupload.DONE) {
+ actionClass = 'plupload_done';
+ }
+
+ if (file.status == plupload.FAILED) {
+ actionClass = 'plupload_failed';
+ }
+
+ if (file.status == plupload.QUEUED) {
+ actionClass = 'plupload_delete';
+ }
+
+ if (file.status == plupload.UPLOADING) {
+ actionClass = 'plupload_uploading';
+ }
+
+ var icon = $('#' + file.id).attr('class', actionClass).find('a').css('display', 'block');
+ if (file.hint) {
+ icon.attr('title', file.hint);
+ }
+ }
+
+ function updateTotalProgress() {
+ $('span.plupload_total_status', target).html(uploader.total.percent + '%');
+ $('div.plupload_progress_bar', target).css('width', uploader.total.percent + '%');
+ $('span.plupload_upload_status', target).html(
+ o.sprintf(_('Uploaded %d/%d files'), uploader.total.uploaded, uploader.files.length)
+ );
+ }
+
+ function updateList() {
+ var fileList = $('ul.plupload_filelist', target).html(''), inputCount = 0, inputHTML;
+
+ $.each(uploader.files, function(i, file) {
+ inputHTML = '';
+
+ if (file.status == plupload.DONE) {
+ if (file.target_name) {
+ inputHTML += '<input type="hidden" name="' + id + '_' + inputCount + '_tmpname" value="' + plupload.xmlEncode(file.target_name) + '" />';
+ }
+
+ inputHTML += '<input type="hidden" name="' + id + '_' + inputCount + '_name" value="' + plupload.xmlEncode(file.name) + '" />';
+ inputHTML += '<input type="hidden" name="' + id + '_' + inputCount + '_status" value="' + (file.status == plupload.DONE ? 'done' : 'failed') + '" />';
+
+ inputCount++;
+
+ $('#' + id + '_count').val(inputCount);
+ }
+
+ fileList.append(
+ '<li id="' + file.id + '">' +
+ '<div class="plupload_file_name"><span>' + file.name + '</span></div>' +
+ '<div class="plupload_file_action"><a href="#"></a></div>' +
+ '<div class="plupload_file_status">' + file.percent + '%</div>' +
+ '<div class="plupload_file_size">' + plupload.formatSize(file.size) + '</div>' +
+ '<div class="plupload_clearer">&nbsp;</div>' +
+ inputHTML +
+ '</li>'
+ );
+
+ handleStatus(file);
+
+ $('#' + file.id + '.plupload_delete a').click(function(e) {
+ $('#' + file.id).remove();
+ uploader.removeFile(file);
+
+ e.preventDefault();
+ });
+ });
+
+ $('span.plupload_total_file_size', target).html(plupload.formatSize(uploader.total.size));
+
+ if (uploader.total.queued === 0) {
+ $('span.plupload_add_text', target).html(_('Add Files'));
+ } else {
+ $('span.plupload_add_text', target).html(o.sprintf(_('%d files queued'), uploader.total.queued));
+ }
+
+ $('a.plupload_start', target).toggleClass('plupload_disabled', uploader.files.length == (uploader.total.uploaded + uploader.total.failed));
+
+ // Scroll to end of file list
+ fileList[0].scrollTop = fileList[0].scrollHeight;
+
+ updateTotalProgress();
+
+ // Re-add drag message if there is no files
+ if (!uploader.files.length && uploader.features.dragdrop && uploader.settings.dragdrop) {
+ $('#' + id + '_filelist').append('<li class="plupload_droptext">' + _("Drag files here.") + '</li>');
+ }
+ }
+
+ function destroy() {
+ delete uploaders[id];
+ uploader.destroy();
+ target.html(contents_bak);
+ uploader = target = contents_bak = null;
+ }
+
+ uploader.bind("UploadFile", function(up, file) {
+ $('#' + file.id).addClass('plupload_current_file');
+ });
+
+ uploader.bind('Init', function(up, res) {
+ // Enable rename support
+ if (!settings.unique_names && settings.rename) {
+ target.on('click', '#' + id + '_filelist div.plupload_file_name span', function(e) {
+ var targetSpan = $(e.target), file, parts, name, ext = "";
+
+ // Get file name and split out name and extension
+ file = up.getFile(targetSpan.parents('li')[0].id);
+ name = file.name;
+ parts = /^(.+)(\.[^.]+)$/.exec(name);
+ if (parts) {
+ name = parts[1];
+ ext = parts[2];
+ }
+
+ // Display input element
+ targetSpan.hide().after('<input type="text" />');
+ targetSpan.next().val(name).focus().blur(function() {
+ targetSpan.show().next().remove();
+ }).keydown(function(e) {
+ var targetInput = $(this);
+
+ if (e.keyCode == 13) {
+ e.preventDefault();
+
+ // Rename file and glue extension back on
+ file.name = targetInput.val() + ext;
+ targetSpan.html(file.name);
+ targetInput.blur();
+ }
+ });
+ });
+ }
+
+ $('#' + id + '_container').attr('title', 'Using runtime: ' + res.runtime);
+
+ $('a.plupload_start', target).click(function(e) {
+ if (!$(this).hasClass('plupload_disabled')) {
+ uploader.start();
+ }
+
+ e.preventDefault();
+ });
+
+ $('a.plupload_stop', target).click(function(e) {
+ e.preventDefault();
+ uploader.stop();
+ });
+
+ $('a.plupload_start', target).addClass('plupload_disabled');
+ });
+
+ uploader.bind("Error", function(up, err) {
+ var file = err.file, message;
+
+ if (file) {
+ message = err.message;
+
+ if (err.details) {
+ message += " (" + err.details + ")";
+ }
+
+ if (err.code == plupload.FILE_SIZE_ERROR) {
+ alert(_("Error: File too large:") + " " + file.name);
+ }
+
+ if (err.code == plupload.FILE_EXTENSION_ERROR) {
+ alert(_("Error: Invalid file extension:") + " " + file.name);
+ }
+
+ file.hint = message;
+ $('#' + file.id).attr('class', 'plupload_failed').find('a').css('display', 'block').attr('title', message);
+ }
+
+ if (err.code === plupload.INIT_ERROR) {
+ setTimeout(function() {
+ destroy();
+ }, 1);
+ }
+ });
+
+ uploader.bind("PostInit", function(up) {
+ // features are populated only after input components are fully instantiated
+ if (up.settings.dragdrop && up.features.dragdrop) {
+ $('#' + id + '_filelist').append('<li class="plupload_droptext">' + _("Drag files here.") + '</li>');
+ }
+ });
+
+ uploader.init();
+
+ uploader.bind('StateChanged', function() {
+ if (uploader.state === plupload.STARTED) {
+ $('li.plupload_delete a,div.plupload_buttons', target).hide();
+ uploader.disableBrowse(true);
+
+ $('span.plupload_upload_status,div.plupload_progress,a.plupload_stop', target).css('display', 'block');
+ $('span.plupload_upload_status', target).html('Uploaded ' + uploader.total.uploaded + '/' + uploader.files.length + ' files');
+
+ if (settings.multiple_queues) {
+ $('span.plupload_total_status,span.plupload_total_file_size', target).show();
+ }
+ } else {
+ updateList();
+ $('a.plupload_stop,div.plupload_progress', target).hide();
+ $('a.plupload_delete', target).css('display', 'block');
+
+ if (settings.multiple_queues && uploader.total.uploaded + uploader.total.failed == uploader.files.length) {
+ $(".plupload_buttons,.plupload_upload_status", target).css("display", "inline");
+ uploader.disableBrowse(false);
+
+ $(".plupload_start", target).addClass("plupload_disabled");
+ $('span.plupload_total_status,span.plupload_total_file_size', target).hide();
+ }
+ }
+ });
+
+ uploader.bind('FilesAdded', updateList);
+
+ uploader.bind('FilesRemoved', function() {
+ // since the whole file list is redrawn for every change in the queue
+ // we need to scroll back to the file removal point to avoid annoying
+ // scrolling to the bottom bug (see #926)
+ var scrollTop = $('#' + id + '_filelist').scrollTop();
+ updateList();
+ $('#' + id + '_filelist').scrollTop(scrollTop);
+ });
+
+ uploader.bind('FileUploaded', function(up, file) {
+ handleStatus(file);
+ });
+
+ uploader.bind("UploadProgress", function(up, file) {
+ // Set file specific progress
+ $('#' + file.id + ' div.plupload_file_status', target).html(file.percent + '%');
+
+ handleStatus(file);
+ updateTotalProgress();
+ });
+
+ // Call setup function
+ if (settings.setup) {
+ settings.setup(uploader);
+ }
+ });
+
+ return this;
+ } else {
+ // Get uploader instance for specified element
+ return uploaders[$(this[0]).attr('id')];
+ }
+ };
+})(jQuery, mOxie);
diff --git a/themes/default/js/plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js b/themes/default/js/plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js
new file mode 100644
index 000000000..d7f7b9636
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js
@@ -0,0 +1 @@
+;(function(e,t){function r(e){return plupload.translate(e)||e}function i(t,n){n.contents().each(function(t,n){n=e(n),n.is(".plupload")||n.remove()}),n.prepend('<div class="plupload_wrapper plupload_scroll"><div id="'+t+'_container" class="plupload_container">'+'<div class="plupload">'+'<div class="plupload_header">'+'<div class="plupload_header_content">'+'<div class="plupload_header_title">'+r("Select files")+"</div>"+'<div class="plupload_header_text">'+r("Add files to the upload queue and click the start button.")+"</div>"+"</div>"+"</div>"+'<div class="plupload_content">'+'<div class="plupload_filelist_header">'+'<div class="plupload_file_name">'+r("Filename")+"</div>"+'<div class="plupload_file_action">&nbsp;</div>'+'<div class="plupload_file_status"><span>'+r("Status")+"</span></div>"+'<div class="plupload_file_size">'+r("Size")+"</div>"+'<div class="plupload_clearer">&nbsp;</div>'+"</div>"+'<ul id="'+t+'_filelist" class="plupload_filelist"></ul>'+'<div class="plupload_filelist_footer">'+'<div class="plupload_file_name">'+'<div class="plupload_buttons">'+'<a href="#" class="plupload_button plupload_add" id="'+t+'_browse">'+r("Add Files")+"</a>"+'<a href="#" class="plupload_button plupload_start">'+r("Start Upload")+"</a>"+"</div>"+'<span class="plupload_upload_status"></span>'+"</div>"+'<div class="plupload_file_action"></div>'+'<div class="plupload_file_status"><span class="plupload_total_status">0%</span></div>'+'<div class="plupload_file_size"><span class="plupload_total_file_size">0 b</span></div>'+'<div class="plupload_progress">'+'<div class="plupload_progress_container">'+'<div class="plupload_progress_bar"></div>'+"</div>"+"</div>"+'<div class="plupload_clearer">&nbsp;</div>'+"</div>"+"</div>"+"</div>"+"</div>"+'<input type="hidden" id="'+t+'_count" name="'+t+'_count" value="0" />'+"</div>")}var n={};e.fn.pluploadQueue=function(s){return s?(this.each(function(){function c(t){var n;t.status==plupload.DONE&&(n="plupload_done"),t.status==plupload.FAILED&&(n="plupload_failed"),t.status==plupload.QUEUED&&(n="plupload_delete"),t.status==plupload.UPLOADING&&(n="plupload_uploading");var r=e("#"+t.id).attr("class",n).find("a").css("display","block");t.hint&&r.attr("title",t.hint)}function h(){e("span.plupload_total_status",a).html(u.total.percent+"%"),e("div.plupload_progress_bar",a).css("width",u.total.percent+"%"),e("span.plupload_upload_status",a).html(t.sprintf(r("Uploaded %d/%d files"),u.total.uploaded,u.files.length))}function p(){var n=e("ul.plupload_filelist",a).html(""),i=0,s;e.each(u.files,function(t,r){s="",r.status==plupload.DONE&&(r.target_name&&(s+='<input type="hidden" name="'+f+"_"+i+'_tmpname" value="'+plupload.xmlEncode(r.target_name)+'" />'),s+='<input type="hidden" name="'+f+"_"+i+'_name" value="'+plupload.xmlEncode(r.name)+'" />',s+='<input type="hidden" name="'+f+"_"+i+'_status" value="'+(r.status==plupload.DONE?"done":"failed")+'" />',i++,e("#"+f+"_count").val(i)),n.append('<li id="'+r.id+'">'+'<div class="plupload_file_name"><span>'+r.name+"</span></div>"+'<div class="plupload_file_action"><a href="#"></a></div>'+'<div class="plupload_file_status">'+r.percent+"%</div>"+'<div class="plupload_file_size">'+plupload.formatSize(r.size)+"</div>"+'<div class="plupload_clearer">&nbsp;</div>'+s+"</li>"),c(r),e("#"+r.id+".plupload_delete a").click(function(t){e("#"+r.id).remove(),u.removeFile(r),t.preventDefault()})}),e("span.plupload_total_file_size",a).html(plupload.formatSize(u.total.size)),u.total.queued===0?e("span.plupload_add_text",a).html(r("Add Files")):e("span.plupload_add_text",a).html(t.sprintf(r("%d files queued"),u.total.queued)),e("a.plupload_start",a).toggleClass("plupload_disabled",u.files.length==u.total.uploaded+u.total.failed),n[0].scrollTop=n[0].scrollHeight,h(),!u.files.length&&u.features.dragdrop&&u.settings.dragdrop&&e("#"+f+"_filelist").append('<li class="plupload_droptext">'+r("Drag files here.")+"</li>")}function d(){delete n[f],u.destroy(),a.html(l),u=a=l=null}var u,a,f,l;a=e(this),f=a.attr("id"),f||(f=plupload.guid(),a.attr("id",f)),l=a.html(),i(f,a),s=e.extend({dragdrop:!0,browse_button:f+"_browse",container:f},s),s.dragdrop&&(s.drop_element=f+"_filelist"),u=new plupload.Uploader(s),n[f]=u,u.bind("UploadFile",function(t,n){e("#"+n.id).addClass("plupload_current_file")}),u.bind("Init",function(t,n){!s.unique_names&&s.rename&&a.on("click","#"+f+"_filelist div.plupload_file_name span",function(n){var r=e(n.target),i,s,o,u="";i=t.getFile(r.parents("li")[0].id),o=i.name,s=/^(.+)(\.[^.]+)$/.exec(o),s&&(o=s[1],u=s[2]),r.hide().after('<input type="text" />'),r.next().val(o).focus().blur(function(){r.show().next().remove()}).keydown(function(t){var n=e(this);t.keyCode==13&&(t.preventDefault(),i.name=n.val()+u,r.html(i.name),n.blur())})}),e("#"+f+"_container").attr("title","Using runtime: "+n.runtime),e("a.plupload_start",a).click(function(t){e(this).hasClass("plupload_disabled")||u.start(),t.preventDefault()}),e("a.plupload_stop",a).click(function(e){e.preventDefault(),u.stop()}),e("a.plupload_start",a).addClass("plupload_disabled")}),u.bind("Error",function(t,n){var i=n.file,s;i&&(s=n.message,n.details&&(s+=" ("+n.details+")"),n.code==plupload.FILE_SIZE_ERROR&&alert(r("Error: File too large:")+" "+i.name),n.code==plupload.FILE_EXTENSION_ERROR&&alert(r("Error: Invalid file extension:")+" "+i.name),i.hint=s,e("#"+i.id).attr("class","plupload_failed").find("a").css("display","block").attr("title",s)),n.code===plupload.INIT_ERROR&&setTimeout(function(){d()},1)}),u.bind("PostInit",function(t){t.settings.dragdrop&&t.features.dragdrop&&e("#"+f+"_filelist").append('<li class="plupload_droptext">'+r("Drag files here.")+"</li>")}),u.init(),u.bind("StateChanged",function(){u.state===plupload.STARTED?(e("li.plupload_delete a,div.plupload_buttons",a).hide(),u.disableBrowse(!0),e("span.plupload_upload_status,div.plupload_progress,a.plupload_stop",a).css("display","block"),e("span.plupload_upload_status",a).html("Uploaded "+u.total.uploaded+"/"+u.files.length+" files"),s.multiple_queues&&e("span.plupload_total_status,span.plupload_total_file_size",a).show()):(p(),e("a.plupload_stop,div.plupload_progress",a).hide(),e("a.plupload_delete",a).css("display","block"),s.multiple_queues&&u.total.uploaded+u.total.failed==u.files.length&&(e(".plupload_buttons,.plupload_upload_status",a).css("display","inline"),u.disableBrowse(!1),e(".plupload_start",a).addClass("plupload_disabled"),e("span.plupload_total_status,span.plupload_total_file_size",a).hide()))}),u.bind("FilesAdded",p),u.bind("FilesRemoved",function(){var t=e("#"+f+"_filelist").scrollTop();p(),e("#"+f+"_filelist").scrollTop(t)}),u.bind("FileUploaded",function(e,t){c(t)}),u.bind("UploadProgress",function(t,n){e("#"+n.id+" div.plupload_file_status",a).html(n.percent+"%"),c(n),h()}),s.setup&&s.setup(u)}),this):n[e(this[0]).attr("id")]}})(jQuery,mOxie); \ No newline at end of file