aboutsummaryrefslogtreecommitdiffstats
path: root/themes/default/js/plugins/plupload/jquery.ui.plupload
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/js/plugins/plupload/jquery.ui.plupload')
-rw-r--r--themes/default/js/plugins/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css371
-rw-r--r--themes/default/js/plugins/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css.orig370
-rw-r--r--themes/default/js/plugins/plupload/jquery.ui.plupload/img/loading.gifbin0 -> 4023 bytes
-rw-r--r--themes/default/js/plugins/plupload/jquery.ui.plupload/img/plupload.pngbin0 -> 6597 bytes
-rw-r--r--themes/default/js/plugins/plupload/jquery.ui.plupload/jquery.ui.plupload.js1323
-rw-r--r--themes/default/js/plugins/plupload/jquery.ui.plupload/jquery.ui.plupload.min.js1
6 files changed, 2065 insertions, 0 deletions
diff --git a/themes/default/js/plugins/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css b/themes/default/js/plugins/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css
new file mode 100644
index 000000000..c230b83eb
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css
@@ -0,0 +1,371 @@
+/*
+ Plupload
+------------------------------------------------------------------- */
+
+.plupload_wrapper * {
+ box-sizing: content-box;
+}
+
+.plupload_button {
+ cursor: pointer;
+ outline: none;
+}
+
+.plupload_wrapper {
+ font: normal 11px Verdana,sans-serif;
+ width: 100%;
+ min-width: 520px;
+ line-height: 12px;
+}
+
+.plupload_container {
+ _height: 300px;
+ min-height: 300px;
+ position: relative;
+}
+
+.plupload_filelist_footer {border-width: 1px 0 0 0}
+.plupload_file {border-width: 0 0 1px 0}
+.plupload_container .plupload_header {border-width: 0 0 1px 0; position: relative;}
+
+.plupload_delete .ui-icon,
+.plupload_done .ui-icon,
+.plupload_failed .ui-icon {
+ cursor:pointer;
+}
+
+.plupload_header_content {
+ height: 56px;
+ padding: 0 160px 0 60px;
+ position: relative;
+}
+
+.plupload_logo {
+ display:none;
+ width: 40px;
+ height: 40px;
+ background: url('../img/plupload.png') no-repeat 0 0;
+ position: absolute;
+ top: 8px;
+ left: 8px;
+}
+
+.plupload_header_content_bw .plupload_logo {
+ background-position: -40px 0;
+}
+
+.plupload_header_title {
+ font: normal 18px sans-serif;
+ line-height: 19px;
+ padding: 6px 0 3px;
+}
+
+.plupload_header_text {
+ font: normal 12px sans-serif;
+}
+
+.plupload_view_switch {
+ position: absolute;
+ right: 16px;
+ bottom: 8px;
+ margin: 0;
+ display: none;
+}
+
+.plupload_view_switch .ui-button {
+ margin-right: -0.31em;
+}
+
+.plupload_content {
+ position: absolute;
+ top: 86px;
+ bottom: 44px;
+ left: 0;
+ right: 0;
+ overflow-y: auto;
+ width: 100%;
+}
+
+.plupload_filelist {
+ border-collapse: collapse;
+ border-left: none;
+ border-right: none;
+ margin: 0;
+ padding: 0;
+ width: 100%;
+ -moz-user-select: none;
+ -webkit-user-select: none;
+ user-select: none;
+}
+
+.plupload_filelist_content {
+ padding: 0;
+ margin: 0;
+}
+
+.plupload_cell {padding: 8px 6px;}
+
+.plupload_file {
+ list-style: none;
+ display: block;
+ position: relative;
+ overflow: hidden;
+ line-height: 12px;
+}
+
+.plupload_file_thumb {
+ position: relative;
+ background-image: none;
+ background-color: #eee;
+}
+
+.plupload_file_loading .plupload_file_thumb {
+ background: #eee url(../img/loading.gif) center no-repeat;
+}
+
+.plupload_file_name {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.plupload_filelist_header {
+ border-top: none;
+}
+
+.plupload_filelist_footer {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+}
+
+.plupload_buttons {
+ position: relative;
+}
+
+/* list view */
+.plupload_view_list .plupload_file {
+ border-left: none;
+ border-right: none;
+ border-top: none;
+ height: 29px;
+ width: 100% !important;
+ /* fix IE6 vertical white-space bug */
+ _float: left;
+ _clear: left;
+}
+
+.plupload_view_list div.plupload_file_size,
+.plupload_view_list div.plupload_file_status,
+.plupload_view_list div.plupload_file_action {
+ padding: 8px 6px;
+ position: absolute;
+ top: 0;
+ right: 0;
+}
+
+.plupload_view_list div.plupload_file_name {
+ margin-right: 156px;
+ padding: 8px 6px;
+ _width: 75%;
+}
+
+.plupload_view_list div.plupload_file_size {
+ right: 28px;
+}
+
+.plupload_view_list div.plupload_file_status {
+ right: 82px;
+}
+
+.plupload_view_list .plupload_file_rename {
+ margin-left: -2px;
+}
+
+.plupload_view_list .plupload_file_size,
+.plupload_view_list .plupload_file_status,
+.plupload_filelist_footer .plupload_file_size,
+.plupload_filelist_footer .plupload_file_status {
+ text-align: right;
+ width: 52px;
+}
+
+.plupload_view_list .plupload_file_thumb {
+ position: absolute;
+ top: -999px;
+}
+
+.plupload_view_list .plupload_file_progress {
+ display: none;
+}
+
+
+/* thumbs view */
+.plupload_view_thumbs .plupload_content {
+ top: 57px;
+}
+
+.plupload_view_thumbs .plupload_filelist_header {
+ display: none;
+}
+
+.plupload_view_thumbs .plupload_file {
+ padding: 16px;
+ margin: 10px;
+ border: 1px solid #fff;
+ float: left;
+}
+
+.plupload_view_thumbs .plupload_file_thumb,
+.plupload_view_thumbs .plupload_file_dummy {
+ text-align: center;
+ overflow: hidden;
+}
+
+.plupload_view_thumbs .plupload_file_dummy {
+ font-size: 21px;
+ font-weight: bold;
+ text-transform: lowercase;
+ overflow: hidden;
+ border: none;
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+
+.plupload_view_thumbs div.plupload_file_action {
+ position: absolute;
+ top: 0;
+ right: 0;
+}
+
+.plupload_view_thumbs div.plupload_file_name {
+ padding: 0;
+ font-weight: bold;
+}
+
+.plupload_view_thumbs .plupload_file_rename {
+ padding: 1px 0;
+ width: 100% !important;
+}
+
+.plupload_view_thumbs div.plupload_file_size {
+ font-size: 0.8em;
+ font-weight: normal;
+}
+
+.plupload_view_thumbs div.plupload_file_status {
+ position: relative;
+ height: 3px;
+ overflow: hidden;
+ text-indent: -999px;
+ margin-bottom: 3px;
+}
+
+.plupload_view_thumbs div.plupload_file_progress {
+ border: none;
+ height: 100%;
+}
+
+.plupload .ui-sortable-helper,
+.plupload .ui-sortable .plupload_file {
+ cursor:move;
+}
+
+.plupload_file_action {width: 16px;}
+.plupload_file_name {
+ overflow: hidden;
+ padding-left: 10px;
+}
+
+.plupload_file_rename {
+ border: none;
+ font: normal 11px Verdana, sans-serif;
+ padding: 1px 2px;
+ line-height: 11px;
+ height: 11px;
+}
+
+.plupload_progress {width: 60px;}
+.plupload_progress_container {padding: 1px;}
+
+
+/* Floats */
+
+.plupload_right {float: right;}
+.plupload_left {float: left;}
+.plupload_clear,.plupload_clearer {clear: both;}
+.plupload_clearer, .plupload_progress_bar {
+ display: block;
+ font-size: 0;
+ line-height: 0;
+}
+.plupload_clearer {height: 0;}
+
+/* Misc */
+.plupload_hidden {display: none !important;}
+
+.plupload_droptext {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: transparent;
+ text-align: center;
+ vertical-align: middle;
+ border: 0;
+ line-height: 160px;
+ display: none;
+}
+
+.plupload_dropbox .plupload_droptext {
+ display: block;
+}
+
+.plupload_buttons, .plupload_upload_status {float: left}
+
+.plupload_message {
+ position: absolute;
+ top: -1px;
+ left: -1px;
+ height: 100%;
+ width: 100%;
+}
+
+.plupload_message p {
+ padding:0.7em;
+ margin:0;
+}
+
+.plupload_message strong {
+ font-weight: bold;
+}
+
+plupload_message i {
+ font-style: italic;
+}
+
+.plupload_message p span.ui-icon {
+ float: left;
+ margin-right: 0.3em;
+}
+
+.plupload_header_content .ui-state-error,
+.plupload_header_content .ui-state-highlight {
+ border:none;
+}
+
+.plupload_message_close {
+ position:absolute;
+ top:5px;
+ right:5px;
+ cursor:pointer;
+}
+
+.plupload .ui-sortable-placeholder {
+ height:35px;
+}
diff --git a/themes/default/js/plugins/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css.orig b/themes/default/js/plugins/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css.orig
new file mode 100644
index 000000000..87d54814d
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css.orig
@@ -0,0 +1,370 @@
+/*
+ Plupload
+------------------------------------------------------------------- */
+
+.plupload_wrapper * {
+ box-sizing: content-box;
+}
+
+.plupload_button {
+ cursor: pointer;
+ outline: none;
+}
+
+.plupload_wrapper {
+ font: normal 11px Verdana,sans-serif;
+ width: 100%;
+ min-width: 520px;
+ line-height: 12px;
+}
+
+.plupload_container {
+ _height: 300px;
+ min-height: 300px;
+ position: relative;
+}
+
+.plupload_filelist_footer {border-width: 1px 0 0 0}
+.plupload_file {border-width: 0 0 1px 0}
+.plupload_container .plupload_header {border-width: 0 0 1px 0; position: relative;}
+
+.plupload_delete .ui-icon,
+.plupload_done .ui-icon,
+.plupload_failed .ui-icon {
+ cursor:pointer;
+}
+
+.plupload_header_content {
+ height: 56px;
+ padding: 0 160px 0 60px;
+ position: relative;
+}
+
+.plupload_logo {
+ width: 40px;
+ height: 40px;
+ background: url('../img/plupload.png') no-repeat 0 0;
+ position: absolute;
+ top: 8px;
+ left: 8px;
+}
+
+.plupload_header_content_bw .plupload_logo {
+ background-position: -40px 0;
+}
+
+.plupload_header_title {
+ font: normal 18px sans-serif;
+ line-height: 19px;
+ padding: 6px 0 3px;
+}
+
+.plupload_header_text {
+ font: normal 12px sans-serif;
+}
+
+.plupload_view_switch {
+ position: absolute;
+ right: 16px;
+ bottom: 8px;
+ margin: 0;
+ display: none;
+}
+
+.plupload_view_switch .ui-button {
+ margin-right: -0.31em;
+}
+
+.plupload_content {
+ position: absolute;
+ top: 86px;
+ bottom: 44px;
+ left: 0;
+ right: 0;
+ overflow-y: auto;
+ width: 100%;
+}
+
+.plupload_filelist {
+ border-collapse: collapse;
+ border-left: none;
+ border-right: none;
+ margin: 0;
+ padding: 0;
+ width: 100%;
+ -moz-user-select: none;
+ -webkit-user-select: none;
+ user-select: none;
+}
+
+.plupload_filelist_content {
+ padding: 0;
+ margin: 0;
+}
+
+.plupload_cell {padding: 8px 6px;}
+
+.plupload_file {
+ list-style: none;
+ display: block;
+ position: relative;
+ overflow: hidden;
+ line-height: 12px;
+}
+
+.plupload_file_thumb {
+ position: relative;
+ background-image: none;
+ background-color: #eee;
+}
+
+.plupload_file_loading .plupload_file_thumb {
+ background: #eee url(../img/loading.gif) center no-repeat;
+}
+
+.plupload_file_name {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.plupload_filelist_header {
+ border-top: none;
+}
+
+.plupload_filelist_footer {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+}
+
+.plupload_buttons {
+ position: relative;
+}
+
+/* list view */
+.plupload_view_list .plupload_file {
+ border-left: none;
+ border-right: none;
+ border-top: none;
+ height: 29px;
+ width: 100% !important;
+ /* fix IE6 vertical white-space bug */
+ _float: left;
+ _clear: left;
+}
+
+.plupload_view_list div.plupload_file_size,
+.plupload_view_list div.plupload_file_status,
+.plupload_view_list div.plupload_file_action {
+ padding: 8px 6px;
+ position: absolute;
+ top: 0;
+ right: 0;
+}
+
+.plupload_view_list div.plupload_file_name {
+ margin-right: 156px;
+ padding: 8px 6px;
+ _width: 75%;
+}
+
+.plupload_view_list div.plupload_file_size {
+ right: 28px;
+}
+
+.plupload_view_list div.plupload_file_status {
+ right: 82px;
+}
+
+.plupload_view_list .plupload_file_rename {
+ margin-left: -2px;
+}
+
+.plupload_view_list .plupload_file_size,
+.plupload_view_list .plupload_file_status,
+.plupload_filelist_footer .plupload_file_size,
+.plupload_filelist_footer .plupload_file_status {
+ text-align: right;
+ width: 52px;
+}
+
+.plupload_view_list .plupload_file_thumb {
+ position: absolute;
+ top: -999px;
+}
+
+.plupload_view_list .plupload_file_progress {
+ display: none;
+}
+
+
+/* thumbs view */
+.plupload_view_thumbs .plupload_content {
+ top: 57px;
+}
+
+.plupload_view_thumbs .plupload_filelist_header {
+ display: none;
+}
+
+.plupload_view_thumbs .plupload_file {
+ padding: 16px;
+ margin: 10px;
+ border: 1px solid #fff;
+ float: left;
+}
+
+.plupload_view_thumbs .plupload_file_thumb,
+.plupload_view_thumbs .plupload_file_dummy {
+ text-align: center;
+ overflow: hidden;
+}
+
+.plupload_view_thumbs .plupload_file_dummy {
+ font-size: 21px;
+ font-weight: bold;
+ text-transform: lowercase;
+ overflow: hidden;
+ border: none;
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+
+.plupload_view_thumbs div.plupload_file_action {
+ position: absolute;
+ top: 0;
+ right: 0;
+}
+
+.plupload_view_thumbs div.plupload_file_name {
+ padding: 0;
+ font-weight: bold;
+}
+
+.plupload_view_thumbs .plupload_file_rename {
+ padding: 1px 0;
+ width: 100% !important;
+}
+
+.plupload_view_thumbs div.plupload_file_size {
+ font-size: 0.8em;
+ font-weight: normal;
+}
+
+.plupload_view_thumbs div.plupload_file_status {
+ position: relative;
+ height: 3px;
+ overflow: hidden;
+ text-indent: -999px;
+ margin-bottom: 3px;
+}
+
+.plupload_view_thumbs div.plupload_file_progress {
+ border: none;
+ height: 100%;
+}
+
+.plupload .ui-sortable-helper,
+.plupload .ui-sortable .plupload_file {
+ cursor:move;
+}
+
+.plupload_file_action {width: 16px;}
+.plupload_file_name {
+ overflow: hidden;
+ padding-left: 10px;
+}
+
+.plupload_file_rename {
+ border: none;
+ font: normal 11px Verdana, sans-serif;
+ padding: 1px 2px;
+ line-height: 11px;
+ height: 11px;
+}
+
+.plupload_progress {width: 60px;}
+.plupload_progress_container {padding: 1px;}
+
+
+/* Floats */
+
+.plupload_right {float: right;}
+.plupload_left {float: left;}
+.plupload_clear,.plupload_clearer {clear: both;}
+.plupload_clearer, .plupload_progress_bar {
+ display: block;
+ font-size: 0;
+ line-height: 0;
+}
+.plupload_clearer {height: 0;}
+
+/* Misc */
+.plupload_hidden {display: none !important;}
+
+.plupload_droptext {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: transparent;
+ text-align: center;
+ vertical-align: middle;
+ border: 0;
+ line-height: 160px;
+ display: none;
+}
+
+.plupload_dropbox .plupload_droptext {
+ display: block;
+}
+
+.plupload_buttons, .plupload_upload_status {float: left}
+
+.plupload_message {
+ position: absolute;
+ top: -1px;
+ left: -1px;
+ height: 100%;
+ width: 100%;
+}
+
+.plupload_message p {
+ padding:0.7em;
+ margin:0;
+}
+
+.plupload_message strong {
+ font-weight: bold;
+}
+
+plupload_message i {
+ font-style: italic;
+}
+
+.plupload_message p span.ui-icon {
+ float: left;
+ margin-right: 0.3em;
+}
+
+.plupload_header_content .ui-state-error,
+.plupload_header_content .ui-state-highlight {
+ border:none;
+}
+
+.plupload_message_close {
+ position:absolute;
+ top:5px;
+ right:5px;
+ cursor:pointer;
+}
+
+.plupload .ui-sortable-placeholder {
+ height:35px;
+}
diff --git a/themes/default/js/plugins/plupload/jquery.ui.plupload/img/loading.gif b/themes/default/js/plugins/plupload/jquery.ui.plupload/img/loading.gif
new file mode 100644
index 000000000..f0109d170
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.ui.plupload/img/loading.gif
Binary files differ
diff --git a/themes/default/js/plugins/plupload/jquery.ui.plupload/img/plupload.png b/themes/default/js/plugins/plupload/jquery.ui.plupload/img/plupload.png
new file mode 100644
index 000000000..8ae0f90b5
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.ui.plupload/img/plupload.png
Binary files differ
diff --git a/themes/default/js/plugins/plupload/jquery.ui.plupload/jquery.ui.plupload.js b/themes/default/js/plugins/plupload/jquery.ui.plupload/jquery.ui.plupload.js
new file mode 100644
index 000000000..af9193761
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.ui.plupload/jquery.ui.plupload.js
@@ -0,0 +1,1323 @@
+/**
+ * jquery.ui.plupload.js
+ *
+ * Copyright 2013, Moxiecode Systems AB
+ * Released under GPL License.
+ *
+ * License: http://www.plupload.com/license
+ * Contributing: http://www.plupload.com/contributing
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.button.js
+ * jquery.ui.progressbar.js
+ *
+ * Optionally:
+ * jquery.ui.sortable.js
+ */
+
+ /* global jQuery:true */
+
+/**
+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`,
+`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
+_jQuery UI_ widget factory, there are some specifics. See examples below for more details.
+
+@example
+ <!-- Instantiating: -->
+ <div id="uploader">
+ <p>Your browser doesn't have Flash, Silverlight or HTML5 support.</p>
+ </div>
+
+ <script>
+ $('#uploader').plupload({
+ url : '../upload.php',
+ filters : [
+ {title : "Image files", extensions : "jpg,gif,png"}
+ ],
+ rename: true,
+ sortable: true,
+ flash_swf_url : '../../js/Moxie.swf',
+ silverlight_xap_url : '../../js/Moxie.xap',
+ });
+ </script>
+
+@example
+ // Invoking methods:
+ $('#uploader').plupload(options);
+
+ // Display welcome message in the notification area
+ $('#uploader').plupload('notify', 'info', "This might be obvious, but you need to click 'Add Files' to add some files.");
+
+@example
+ // Subscribing to the events...
+ // ... on initialization:
+ $('#uploader').plupload({
+ ...
+ viewchanged: function(event, args) {
+ // stuff ...
+ }
+ });
+ // ... or after initialization
+ $('#uploader').on("viewchanged", function(event, args) {
+ // stuff ...
+ });
+
+@class UI.Plupload
+@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 {Object} [settings.filters={}] Set of file type filters.
+ @param {Array} [settings.filters.mime_types=[]] List of file types to accept, each one defined by title and list of extensions. `e.g. {title : "Image files", extensions : "jpg,jpeg,gif,png"}`. Dispatches `plupload.FILE_EXTENSION_ERROR`
+ @param {String|Number} [settings.filters.max_file_size=0] 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 {Boolean} [settings.filters.prevent_duplicates=false] Do not let duplicates into the queue. Dispatches `plupload.FILE_DUPLICATE_ERROR`.
+ @param {Number} [settings.filters.max_file_count=0] Limit the number of files that can reside in the queue at the same time (default is 0 - no limit).
+ @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.autostart=false] Whether to auto start uploading right after file selection.
+ @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 {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 {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.
+ @param {String} [settings.views.default='list'] Default view.
+ @param {Boolean} [settings.views.remember=true] Whether to remember the current view (requires jQuery Cookie plugin).
+ @param {Boolean} [settings.multiple_queues=true] Re-activate the widget after each upload procedure.
+*/
+;(function(window, document, plupload, o, $) {
+
+/**
+Dispatched when the widget is initialized and ready.
+
+@event ready
+@param {plupload.Uploader} uploader Uploader instance sending the event.
+*/
+
+/**
+Dispatched when file dialog is closed.
+
+@event selected
+@param {plupload.Uploader} uploader Uploader instance sending the event.
+@param {Array} files Array of selected files represented by plupload.File objects
+*/
+
+/**
+Dispatched when file dialog is closed.
+
+@event removed
+@param {plupload.Uploader} uploader Uploader instance sending the event.
+@param {Array} files Array of removed files represented by plupload.File objects
+*/
+
+/**
+Dispatched when upload is started.
+
+@event start
+@param {plupload.Uploader} uploader Uploader instance sending the event.
+*/
+
+/**
+Dispatched when upload is stopped.
+
+@event stop
+@param {plupload.Uploader} uploader Uploader instance sending the event.
+*/
+
+/**
+Dispatched during the upload process.
+
+@event progress
+@param {plupload.Uploader} uploader Uploader instance sending the event.
+@param {plupload.File} file File that is being uploaded (includes loaded and percent properties among others).
+ @param {Number} size Total file size in bytes.
+ @param {Number} loaded Number of bytes uploaded of the files total size.
+ @param {Number} percent Number of percentage uploaded of the file.
+*/
+
+/**
+Dispatched when file is uploaded.
+
+@event uploaded
+@param {plupload.Uploader} uploader Uploader instance sending the event.
+@param {plupload.File} file File that was uploaded.
+ @param {Enum} status Status constant matching the plupload states QUEUED, UPLOADING, FAILED, DONE.
+*/
+
+/**
+Dispatched when upload of the whole queue is complete.
+
+@event complete
+@param {plupload.Uploader} uploader Uploader instance sending the event.
+@param {Array} files Array of uploaded files represented by plupload.File objects
+*/
+
+/**
+Dispatched when the view is changed, e.g. from `list` to `thumbs` or vice versa.
+
+@event viewchanged
+@param {plupload.Uploader} uploader Uploader instance sending the event.
+@param {String} type Current view type.
+*/
+
+/**
+Dispatched when error of some kind is detected.
+
+@event error
+@param {plupload.Uploader} uploader Uploader instance sending the event.
+@param {String} error Error message.
+@param {plupload.File} file File that was uploaded.
+ @param {Enum} status Status constant matching the plupload states QUEUED, UPLOADING, FAILED, DONE.
+*/
+
+var uploaders = {};
+
+function _(str) {
+ return plupload.translate(str) || str;
+}
+
+function renderUI(obj) {
+ obj.id = obj.attr('id');
+
+ obj.html(
+ '<div class="plupload_wrapper">' +
+ '<div class="ui-widget-content plupload_container">' +
+ '<div class="ui-state-default ui-widget-header plupload_header">' +
+ '<div class="plupload_header_content">' +
+ '<div class="plupload_logo"> </div>' +
+ '<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 class="plupload_view_switch">' +
+ '<input type="radio" id="'+obj.id+'_view_list" name="view_mode_'+obj.id+'" checked="checked" /><label class="plupload_button" for="'+obj.id+'_view_list" data-view="list">' + _('List') + '</label>' +
+ '<input type="radio" id="'+obj.id+'_view_thumbs" name="view_mode_'+obj.id+'" /><label class="plupload_button" for="'+obj.id+'_view_thumbs" data-view="thumbs">' + _('Thumbnails') + '</label>' +
+ '</div>' +
+ '</div>' +
+ '</div>' +
+
+ '<table class="plupload_filelist plupload_filelist_header ui-widget-header">' +
+ '<tr>' +
+ '<td class="plupload_cell plupload_file_name">' + _('Filename') + '</td>' +
+ '<td class="plupload_cell plupload_file_status">' + _('Status') + '</td>' +
+ '<td class="plupload_cell plupload_file_size">' + _('Size') + '</td>' +
+ '<td class="plupload_cell plupload_file_action">&nbsp;</td>' +
+ '</tr>' +
+ '</table>' +
+
+ '<div class="plupload_content">' +
+ '<div class="plupload_droptext">' + _("Drag files here.") + '</div>' +
+ '<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">' +
+ '<div class="plupload_buttons"><!-- Visible -->' +
+ '<a class="plupload_button plupload_add">' + _("Add Files") + '</a>&nbsp;' +
+ '<a class="plupload_button plupload_start">' + _("Start Upload") + '</a>&nbsp;' +
+ '<a class="plupload_button plupload_stop plupload_hidden">'+_("Stop Upload") + '</a>&nbsp;' +
+ '</div>' +
+
+ '<div class="plupload_started plupload_hidden"><!-- Hidden -->' +
+ '<div class="plupload_progress plupload_right">' +
+ '<div class="plupload_progress_container"></div>' +
+ '</div>' +
+
+ '<div class="plupload_cell plupload_upload_status"></div>' +
+
+ '<div class="plupload_clearer">&nbsp;</div>' +
+ '</div>' +
+ '</td>' +
+ '<td class="plupload_file_status"><span class="plupload_total_status">0%</span></td>' +
+ '<td class="plupload_file_size"><span class="plupload_total_file_size">0 kb</span></td>' +
+ '<td class="plupload_file_action"></td>' +
+ '</tr>' +
+ '</table>' +
+
+ '</div>' +
+ '<input class="plupload_count" value="0" type="hidden">' +
+ '</div>'
+ );
+}
+
+
+$.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
+ },
+
+ views: {
+ list: true,
+ thumbs: false,
+ active: 'list',
+ remember: true // requires: https://github.com/carhartl/jquery-cookie, otherwise disabled even if set to true
+ },
+
+ thumb_width: 100,
+ thumb_height: 60,
+
+ multiple_queues: true, // re-use widget by default
+ dragdrop : true,
+ autostart: false,
+ sortable: false,
+ rename: false
+ },
+
+ FILE_COUNT_ERROR: -9001,
+
+ _create: function() {
+ var id = this.element.attr('id');
+ if (!id) {
+ id = plupload.guid();
+ 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.content = $('.plupload_content', this.element);
+
+ if ($.fn.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');
+ this.start_button = $('.plupload_start', this.container).attr('id', id + '_start');
+ 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" }
+ });
+
+ this.thumbs_switcher.button({
+ text: false,
+ icons: { secondary: "ui-icon-image" }
+ });
+ }
+
+ // progressbar
+ 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();
+ },
+
+ _initUploader: function() {
+ var self = this
+ , id = this.id
+ , uploader
+ , options = {
+ container: id + '_buttons',
+ browse_button: id + '_browse'
+ }
+ ;
+
+ $('.plupload_buttons', this.element).attr('id', id + '_buttons');
+
+ if (self.options.dragdrop) {
+ this.filelist.parent().attr('id', this.id + '_dropbox');
+ options.drop_element = this.id + '_dropbox';
+ }
+
+ this.filelist.on('click', function(e) {
+ if ($(e.target).hasClass('plupload_action_icon')) {
+ self.removeFile($(e.target).closest('.plupload_file').attr('id'));
+ e.preventDefault();
+ }
+ });
+
+ uploader = this.uploader = uploaders[id] = new plupload.Uploader($.extend(this.options, options));
+
+ if (self.options.views.thumbs) {
+ uploader.settings.required_features.display_media = true;
+ }
+
+ // for backward compatibility
+ if (self.options.max_file_count) {
+ plupload.extend(uploader.getOption('filters'), {
+ max_file_count: self.options.max_file_count
+ });
+ }
+
+ plupload.addFileFilter('max_file_count', function(maxCount, file, cb) {
+ 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."),
+ file : file
+ });
+ cb(false);
+ } else {
+ cb(true);
+ }
+ });
+
+
+ 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);
+ 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)));
+ break;
+
+ case plupload.FILE_DUPLICATE_ERROR:
+ details = o.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);
+ break;
+
+ case plupload.IMAGE_FORMAT_ERROR :
+ details = _("Image format either wrong or not supported.");
+ 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);
+ break; */
+
+ case plupload.HTTP_ERROR:
+ details = _("Upload URL might be wrong or doesn't exist.");
+ break;
+ }
+
+ message += " <br /><i>" + details + "</i>";
+
+ self._trigger('error', null, { up: up, error: err } );
+
+ // do not show UI if no runtime can be initialized
+ if (err.code === plupload.INIT_ERROR) {
+ setTimeout(function() {
+ self.destroy();
+ }, 1);
+ } else {
+ self.notify('error', message);
+ }
+ });
+
+
+ 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();
+ up.disableBrowse(true);
+ } 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();
+ }
+
+ if (self.options.dragdrop && up.features.dragdrop) {
+ self.filelist.parent().addClass('plupload_dropbox');
+ }
+
+ self._enableViewSwitcher();
+
+ self.start_button.click(function(e) {
+ if (!$(this).button('option', 'disabled')) {
+ self.start();
+ }
+ e.preventDefault();
+ });
+
+ self.stop_button.click(function(e) {
+ self.stop();
+ e.preventDefault();
+ });
+
+ self._trigger('ready', null, { up: up });
+ });
+
+ // 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._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() {
+ self.start();
+ }, 10);
+ }
+ });
+
+ uploader.bind('FilesRemoved', function(up, files) {
+ // destroy sortable if enabled
+ if ($.ui.sortable && self.options.sortable) {
+ $('tbody', self.filelist).sortable('destroy');
+ }
+
+ $.each(files, function(i, file) {
+ $('#' + file.id).toggle("highlight", function() {
+ $(this).remove();
+ });
+ });
+
+ if (up.files.length) {
+ // re-initialize sortable
+ if (self.options.sortable && $.ui.sortable) {
+ self._enableSortingList();
+ }
+ }
+
+ self._trigger('updatelist', null, { filelist: self.filelist });
+ self._trigger('removed', null, { up: up, files: files } );
+ });
+
+ uploader.bind('QueueChanged StateChanged', function() {
+ self._handleState();
+ });
+
+ uploader.bind('UploadFile', function(up, file) {
+ self._handleFileStatus(file);
+ });
+
+ uploader.bind('FileUploaded', function(up, file) {
+ self._handleFileStatus(file);
+ self._trigger('uploaded', null, { up: up, file: file } );
+ });
+
+ 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._trigger('complete', null, { up: up, files: files } );
+ });
+ },
+
+
+ _setOption: function(key, value) {
+ var self = this;
+
+ 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);
+ } else {
+ 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.uploader.settings[key] = value;
+ },
+
+
+ /**
+ Start upload. Triggers `start` event.
+
+ @method start
+ */
+ start: function() {
+ this.uploader.start();
+ this._trigger('start', null, { up: this.uploader });
+ },
+
+
+ /**
+ Stop upload. Triggers `stop` event.
+
+ @method stop
+ */
+ stop: function() {
+ this.uploader.stop();
+ this._trigger('stop', null, { up: this.uploader });
+ },
+
+
+ /**
+ Enable browse button.
+
+ @method enable
+ */
+ enable: function() {
+ this.browse_button.button('enable');
+ this.uploader.disableBrowse(false);
+ },
+
+
+ /**
+ Disable browse button.
+
+ @method disable
+ */
+ disable: function() {
+ this.browse_button.button('disable');
+ this.uploader.disableBrowse(true);
+ },
+
+
+ /**
+ Retrieve file by it's unique id.
+
+ @method getFile
+ @param {String} id Unique id of the file
+ @return {plupload.File}
+ */
+ getFile: function(id) {
+ var file;
+
+ if (typeof id === 'number') {
+ file = this.uploader.files[id];
+ } else {
+ 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
+ */
+ getFiles: function() {
+ return this.uploader.files;
+ },
+
+
+ /**
+ Remove the file from the queue.
+
+ @method removeFile
+ @param {plupload.File|String} file File to remove, might be specified directly or by it's unique id
+ */
+ removeFile: function(file) {
+ if (plupload.typeOf(file) === 'string') {
+ file = this.getFile(file);
+ }
+ this.uploader.removeFile(file);
+ },
+
+
+ /**
+ Clear the file queue.
+
+ @method clearQueue
+ */
+ clearQueue: function() {
+ this.uploader.splice();
+ },
+
+
+ /**
+ Retrieve internal plupload.Uploader object (usually not required).
+
+ @method getUploader
+ @return {plupload.Uploader}
+ */
+ getUploader: function() {
+ return this.uploader;
+ },
+
+
+ /**
+ Trigger refresh procedure, specifically browse_button re-measure and re-position operations.
+ Might get handy, when UI Widget is placed within the popup, that is constantly hidden and shown
+ again - without calling this method after each show operation, dialog trigger might get displaced
+ and disfunctional.
+
+ @method refresh
+ */
+ refresh: function() {
+ this.uploader.refresh();
+ },
+
+
+ /**
+ Display a message in notification area.
+
+ @method notify
+ @param {Enum} type Type of the message, either `error` or `info`
+ @param {String} message The text message to display.
+ */
+ notify: function(type, message) {
+ var popup = $(
+ '<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')
+ .addClass('ui-icon-' + (type === 'error' ? 'alert' : 'info'))
+ .end()
+ .find('.plupload_message_close')
+ .click(function() {
+ 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 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');
+ }
+
+ // destroy sortable behavior
+ if ($.ui.sortable && this.options.sortable) {
+ $('tbody', this.filelist).sortable('destroy');
+ }
+
+ // restore the elements initial state
+ this.element
+ .empty()
+ .html(this.contents_bak);
+ this.contents_bak = '';
+
+ $.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) {
+ $([])
+ .add(this.stop_button)
+ .add('.plupload_started')
+ .removeClass('plupload_hidden');
+
+ this.start_button.button('disable');
+
+ if (!this.options.multiple_queues) {
+ 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_header_content', this.element).addClass('plupload_header_content_bw');
+ }
+ else if (plupload.STOPPED === up.state) {
+ $([])
+ .add(this.stop_button)
+ .add('.plupload_started')
+ .addClass('plupload_hidden');
+
+ if (filesPending) {
+ this.start_button.button('enable');
+ } 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) {
+ this.browse_button.button('enable');
+ up.disableBrowse(false);
+ }
+
+ this._updateTotalProgress();
+ }
+
+ 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));
+ }
+
+ 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;
+ }
+
+ switch (file.status) {
+ 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';
+ break;
+
+ case plupload.QUEUED:
+ actionClass = 'plupload_delete';
+ iconClass = 'plupload_action_icon ui-icon ui-icon-circle-minus';
+ break;
+
+ 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
+ .find('.plupload_file_percent')
+ .html(file.percent + '%')
+ .end()
+ .find('.plupload_file_progress')
+ .css('width', file.percent + '%')
+ .end()
+ .find('.plupload_file_size')
+ .html(plupload.formatSize(file.size));
+ break;
+ }
+ actionClass += ' ui-state-default plupload_file';
+
+ $file
+ .attr('class', actionClass)
+ .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 + '%')
+ .end()
+ .find('.plupload_total_file_size')
+ .html(plupload.formatSize(up.total.size))
+ .end()
+ .find('.plupload_upload_status')
+ .html(o.sprintf(_('Uploaded %d/%d files'), up.total.uploaded, up.files.length));
+ },
+
+
+ _displayThumbs: function() {
+ var self = this
+ , tw, th // thumb width/height
+ , cols
+ , num = 0 // number of simultaneously visible thumbs
+ , thumbs = [] // array of thumbs to preload at any given moment
+ , loading = false
+ ;
+
+ if (!this.options.views.thumbs) {
+ return;
+ }
+
+
+ function onLast(el, eventName, cb) {
+ var timer;
+
+ el.on(eventName, function() {
+ clearTimeout(timer);
+ timer = setTimeout(function() {
+ clearTimeout(timer);
+ cb();
+ }, 300);
+ });
+ }
+
+
+ // calculate number of simultaneously visible thumbs
+ function measure() {
+ if (!tw || !th) {
+ var wrapper = $('.plupload_file:eq(0)', self.filelist);
+ tw = wrapper.outerWidth(true);
+ th = wrapper.outerHeight(true);
+ }
+
+ var aw = self.content.width(), ah = self.content.height();
+ cols = Math.floor(aw / tw);
+ num = cols * (Math.ceil(ah / th) + 1);
+ }
+
+
+ function pickThumbsToLoad() {
+ // calculate index of virst visible thumb
+ var startIdx = Math.floor(self.content.scrollTop() / th) * cols;
+ // get potentially visible thumbs that are not yet visible
+ thumbs = $('.plupload_file', self.filelist)
+ .slice(startIdx, startIdx + num)
+ .filter('.plupload_file_loading')
+ .get();
+ }
+
+
+ function init() {
+ function mpl() { // measure, pick, load
+ if (self.view_mode !== 'thumbs') {
+ return;
+ }
+ measure();
+ pickThumbsToLoad();
+ lazyLoad();
+ }
+
+ if ($.fn.resizable) {
+ onLast(self.container, 'resize', mpl);
+ }
+
+ onLast(self.window, 'resize', mpl);
+ onLast(self.content, 'scroll', mpl);
+
+ self.element.on('viewchanged selected', mpl);
+
+ mpl();
+ }
+
+
+ function preloadThumb(file, cb) {
+ var img = new o.Image();
+
+ img.onload = function() {
+ var thumb = $('#' + file.id + ' .plupload_file_thumb', self.filelist).html('');
+ this.embed(thumb[0], {
+ width:  self.options.thumb_width,
+ height: self.options.thumb_height,
+ crop: true,
+ swf_url: o.resolveUrl(self.options.flash_swf_url),
+ xap_url: o.resolveUrl(self.options.silverlight_xap_url)
+ });
+ };
+
+ img.bind("embedded error", function() {
+ $('#' + file.id, self.filelist).removeClass('plupload_file_loading');
+ this.destroy();
+ setTimeout(cb, 1); // detach, otherwise ui might hang (in SilverLight for example)
+ });
+
+ img.load(file.getSource());
+ }
+
+
+ function lazyLoad() {
+ if (self.view_mode !== 'thumbs' || loading) {
+ return;
+ }
+
+ pickThumbsToLoad();
+ if (!thumbs.length) {
+ return;
+ }
+
+ loading = true;
+
+ preloadThumb(self.getFile($(thumbs.shift()).attr('id')), function() {
+ loading = false;
+ lazyLoad();
+ });
+ }
+
+ // this has to run only once to measure structures and bind listeners
+ this.element.on('selected', function onselected() {
+ self.element.off('selected', onselected);
+ init();
+ });
+ },
+
+
+ _addFiles: function(files) {
+ var self = this, file_html, html = '';
+
+ file_html = '<li class="plupload_file ui-state-default plupload_file_loading plupload_delete" id="%id%" style="width:%thumb_width%px;">' +
+ '<div class="plupload_file_thumb" style="width:%thumb_width%px;height:%thumb_height%px;">' +
+ '<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>' +
+ '<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 class="plupload_file_action">' +
+ '<div class="plupload_action_icon ui-icon ui-icon-circle-minus"> </div>' +
+ '</div>' +
+ '<div class="plupload_file_size">%size% </div>' +
+ '<div class="plupload_file_fields"> </div>' +
+ '</li>';
+
+ if (plupload.typeOf(files) !== 'array') {
+ files = [files];
+ }
+
+ $.each(files, function(i, file) {
+ var ext = o.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);
+
+ case 'ext':
+ return ext;
+
+ default:
+ return file[$1] || '';
+ }
+ });
+ });
+
+ self.filelist.append(html);
+ },
+
+
+ _addFormFields: function() {
+ var self = this;
+
+ // re-add from fresh
+ $('.plupload_file_fields', this.filelist).html('');
+
+ plupload.each(this.uploader.files, function(file, count) {
+ var fields = ''
+ , id = self.id + '_' + count
+ ;
+
+ if (file.target_name) {
+ fields += '<input type="hidden" name="' + id + '_tmpname" value="'+plupload.xmlEncode(file.target_name)+'" />';
+ }
+ fields += '<input type="hidden" name="' + id + '_name" value="'+plupload.xmlEncode(file.name)+'" />';
+ fields += '<input type="hidden" name="' + id + '_status" value="' + (file.status === plupload.DONE ? 'done' : 'failed') + '" />';
+
+ $('#' + file.id).find('.plupload_file_fields').html(fields);
+ });
+
+ 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) {
+ 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.view_mode = view;
+ this._trigger('viewchanged', null, { view: view });
+ },
+
+
+ _enableViewSwitcher: function() {
+ var self = this
+ , view
+ , switcher = $('.plupload_view_switch', this.container)
+ , buttons
+ , button
+ ;
+
+ plupload.each(['list', 'thumbs'], function(view) {
+ if (!self.options.views[view]) {
+ switcher.find('[for="' + self.id + '_view_' + view + '"], #'+ self.id +'_view_' + view).remove();
+ }
+ });
+
+ // check if any visible left
+ buttons = switcher.find('.plupload_button');
+
+ if (buttons.length === 1) {
+ switcher.hide();
+ view = buttons.eq(0).data('view');
+ this._viewChanged(view);
+ } else if ($.ui.button && buttons.length > 1) {
+ if (this.options.views.remember && $.cookie) {
+ view = $.cookie('plupload_ui_view');
+ }
+
+ // if wierd case, bail out to default
+ if (!~plupload.inArray(view, ['list', 'thumbs'])) {
+ view = this.options.views.active;
+ }
+
+ switcher
+ .show()
+ .buttonset()
+ .find('.ui-button')
+ .click(function(e) {
+ view = $(this).data('view');
+ self._viewChanged(view);
+ e.preventDefault(); // avoid auto scrolling to widget in IE and FF (see #850)
+ });
+
+ // if view not active - happens when switcher wasn't clicked manually
+ button = switcher.find('[for="' + self.id + '_view_'+view+'"]');
+ if (button.length) {
+ button.trigger('click');
+ }
+ } else {
+ switcher.show();
+ this._viewChanged(this.options.views.active);
+ }
+
+ // initialize thumb viewer if requested
+ if (this.options.views.thumbs) {
+ this._displayThumbs();
+ }
+ },
+
+
+ _enableRenaming: function() {
+ var self = this;
+
+ this.filelist.dblclick(function(e) {
+ var nameSpan = $(e.target), nameInput, file, parts, name, ext = "";
+
+ if (!nameSpan.hasClass('plupload_file_name_wrapper')) {
+ return;
+ }
+
+ // Get file name and split out name and extension
+ file = self.uploader.getFile(nameSpan.closest('.plupload_file')[0].id);
+ name = file.name;
+ parts = /^(.+)(\.[^.]+)$/.exec(name);
+ if (parts) {
+ name = parts[1];
+ ext = parts[2];
+ }
+
+ // Display input element
+ nameInput = $('<input class="plupload_file_rename" type="text" />').width(nameSpan.width()).insertAfter(nameSpan.hide());
+ nameInput.val(name).blur(function() {
+ nameSpan.show().parent().scrollLeft(0).end().next().remove();
+ }).keydown(function(e) {
+ var nameInput = $(this);
+
+ if ($.inArray(e.keyCode, [13, 27]) !== -1) {
+ e.preventDefault();
+
+ // Rename file and glue extension back on
+ if (e.keyCode === 13) {
+ file.name = nameInput.val() + ext;
+ nameSpan.html(file.name);
+ }
+ nameInput.blur();
+ }
+ })[0].focus();
+ });
+ },
+
+
+ _enableSortingList: function() {
+ var self = this;
+
+ if ($('.plupload_file', this.filelist).length < 2) {
+ return;
+ }
+
+ // destroy sortable if enabled
+ $('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);
+ }
+ });
+ }
+});
+
+} (window, document, plupload, mOxie, jQuery));
diff --git a/themes/default/js/plugins/plupload/jquery.ui.plupload/jquery.ui.plupload.min.js b/themes/default/js/plugins/plupload/jquery.ui.plupload/jquery.ui.plupload.min.js
new file mode 100644
index 000000000..c276ad3fc
--- /dev/null
+++ b/themes/default/js/plugins/plupload/jquery.ui.plupload/jquery.ui.plupload.min.js
@@ -0,0 +1 @@
+;(function(e,t,n,r,i){function o(e){return n.translate(e)||e}function u(e){e.id=e.attr("id"),e.html('<div class="plupload_wrapper"><div class="ui-widget-content plupload_container"><div class="ui-state-default ui-widget-header plupload_header"><div class="plupload_header_content"><div class="plupload_logo"> </div><div class="plupload_header_title">'+o("Select files")+"</div>"+'<div class="plupload_header_text">'+o("Add files to the upload queue and click the start button.")+"</div>"+'<div class="plupload_view_switch">'+'<input type="radio" id="'+e.id+'_view_list" name="view_mode_'+e.id+'" checked="checked" /><label class="plupload_button" for="'+e.id+'_view_list" data-view="list">'+o("List")+"</label>"+'<input type="radio" id="'+e.id+'_view_thumbs" name="view_mode_'+e.id+'" /><label class="plupload_button" for="'+e.id+'_view_thumbs" data-view="thumbs">'+o("Thumbnails")+"</label>"+"</div>"+"</div>"+"</div>"+'<table class="plupload_filelist plupload_filelist_header ui-widget-header">'+"<tr>"+'<td class="plupload_cell plupload_file_name">'+o("Filename")+"</td>"+'<td class="plupload_cell plupload_file_status">'+o("Status")+"</td>"+'<td class="plupload_cell plupload_file_size">'+o("Size")+"</td>"+'<td class="plupload_cell plupload_file_action">&nbsp;</td>'+"</tr>"+"</table>"+'<div class="plupload_content">'+'<div class="plupload_droptext">'+o("Drag files here.")+"</div>"+'<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">'+'<div class="plupload_buttons"><!-- Visible -->'+'<a class="plupload_button plupload_add">'+o("Add Files")+"</a>&nbsp;"+'<a class="plupload_button plupload_start">'+o("Start Upload")+"</a>&nbsp;"+'<a class="plupload_button plupload_stop plupload_hidden">'+o("Stop Upload")+"</a>&nbsp;"+"</div>"+'<div class="plupload_started plupload_hidden"><!-- Hidden -->'+'<div class="plupload_progress plupload_right">'+'<div class="plupload_progress_container"></div>'+"</div>"+'<div class="plupload_cell plupload_upload_status"></div>'+'<div class="plupload_clearer">&nbsp;</div>'+"</div>"+"</td>"+'<td class="plupload_file_status"><span class="plupload_total_status">0%</span></td>'+'<td class="plupload_file_size"><span class="plupload_total_file_size">0 kb</span></td>'+'<td class="plupload_file_action"></td>'+"</tr>"+"</table>"+"</div>"+'<input class="plupload_count" value="0" type="hidden">'+"</div>")}var s={};i.widget("ui.plupload",{widgetEventPrefix:"",contents_bak:"",options:{browse_button_hover:"ui-state-hover",browse_button_active:"ui-state-active",filters:{},buttons:{browse:!0,start:!0,stop:!0},views:{list:!0,thumbs:!1,active:"list",remember:!0},thumb_width:100,thumb_height:60,multiple_queues:!0,dragdrop:!0,autostart:!1,sortable:!1,rename:!1},FILE_COUNT_ERROR:-9001,_create:function(){var e=this.element.attr("id");e||(e=n.guid(),this.element.attr("id",e)),this.id=e,this.contents_bak=this.element.html(),u(this.element),this.container=i(".plupload_container",this.element).attr("id",e+"_container"),this.content=i(".plupload_content",this.element),i.fn.resizable&&this.container.resizable({handles:"s",minHeight:300}),this.filelist=i(".plupload_filelist_content",this.container).attr({id:e+"_filelist",unselectable:"on"}),this.browse_button=i(".plupload_add",this.container).attr("id",e+"_browse"),this.start_button=i(".plupload_start",this.container).attr("id",e+"_start"),this.stop_button=i(".plupload_stop",this.container).attr("id",e+"_stop"),this.thumbs_switcher=i("#"+e+"_view_thumbs"),this.list_switcher=i("#"+e+"_view_list"),i.ui.button&&(this.browse_button.button({icons:{primary:"ui-icon-circle-plus"},disabled:!0}),this.start_button.button({icons:{primary:"ui-icon-circle-arrow-e"},disabled:!0}),this.stop_button.button({icons:{primary:"ui-icon-circle-close"}}),this.list_switcher.button({text:!1,icons:{secondary:"ui-icon-grip-dotted-horizontal"}}),this.thumbs_switcher.button({text:!1,icons:{secondary:"ui-icon-image"}})),this.progressbar=i(".plupload_progress_container",this.container),i.ui.progressbar&&this.progressbar.progressbar(),this.counter=i(".plupload_count",this.element).attr({id:e+"_count",name:e+"_count"}),this._initUploader()},_initUploader:function(){var e=this,t=this.id,u,a={container:t+"_buttons",browse_button:t+"_browse"};i(".plupload_buttons",this.element).attr("id",t+"_buttons"),e.options.dragdrop&&(this.filelist.parent().attr("id",this.id+"_dropbox"),a.drop_element=this.id+"_dropbox"),this.filelist.on("click",function(t){i(t.target).hasClass("plupload_action_icon")&&(e.removeFile(i(t.target).closest(".plupload_file").attr("id")),t.preventDefault())}),u=this.uploader=s[t]=new n.Uploader(i.extend(this.options,a)),e.options.views.thumbs&&(u.settings.required_features.display_media=!0),e.options.max_file_count&&n.extend(u.getOption("filters"),{max_file_count:e.options.max_file_count}),n.addFileFilter("max_file_count",function(t,n,r){t<=this.files.length-(this.total.uploaded+this.total.failed)?(e.browse_button.button("disable"),this.disableBrowse(),this.trigger("Error",{code:e.FILE_COUNT_ERROR,message:o("File count error."),file:n}),r(!1)):r(!0)}),u.bind("Error",function(t,i){var s,u="";s="<strong>"+i.message+"</strong>";switch(i.code){case n.FILE_EXTENSION_ERROR:u=r.sprintf(o("File: %s"),i.file.name);break;case n.FILE_SIZE_ERROR:u=r.sprintf(o("File: %s, size: %d, max file size: %d"),i.file.name,n.formatSize(i.file.size),n.formatSize(n.parseSize(t.getOption("filters").max_file_size)));break;case n.FILE_DUPLICATE_ERROR:u=r.sprintf(o("%s already present in the queue."),i.file.name);break;case e.FILE_COUNT_ERROR:u=r.sprintf(o("Upload element accepts only %d file(s) at a time. Extra files were stripped."),t.getOption("filters").max_file_count||0);break;case n.IMAGE_FORMAT_ERROR:u=o("Image format either wrong or not supported.");break;case n.IMAGE_MEMORY_ERROR:u=o("Runtime ran out of available memory.");break;case n.HTTP_ERROR:u=o("Upload URL might be wrong or doesn't exist.")}s+=" <br /><i>"+u+"</i>",e._trigger("error",null,{up:t,error:i}),i.code===n.INIT_ERROR?setTimeout(function(){e.destroy()},1):e.notify("error",s)}),u.bind("PostInit",function(t){e.options.buttons.browse?e.browse_button.button("enable"):(e.browse_button.button("disable").hide(),t.disableBrowse(!0)),e.options.buttons.start||e.start_button.button("disable").hide(),e.options.buttons.stop||e.stop_button.button("disable").hide(),!e.options.unique_names&&e.options.rename&&e._enableRenaming(),e.options.dragdrop&&t.features.dragdrop&&e.filelist.parent().addClass("plupload_dropbox"),e._enableViewSwitcher(),e.start_button.click(function(t){i(this).button("option","disabled")||e.start(),t.preventDefault()}),e.stop_button.click(function(t){e.stop(),t.preventDefault()}),e._trigger("ready",null,{up:t})}),u.init(),u.bind("FileFiltered",function(t,n){e._addFiles(n)}),u.bind("FilesAdded",function(t,n){e._trigger("selected",null,{up:t,files:n}),e.options.sortable&&i.ui.sortable&&e._enableSortingList(),e._trigger("updatelist",null,{filelist:e.filelist}),e.options.autostart&&setTimeout(function(){e.start()},10)}),u.bind("FilesRemoved",function(t,n){i.ui.sortable&&e.options.sortable&&i("tbody",e.filelist).sortable("destroy"),i.each(n,function(e,t){i("#"+t.id).toggle("highlight",function(){i(this).remove()})}),t.files.length&&e.options.sortable&&i.ui.sortable&&e._enableSortingList(),e._trigger("updatelist",null,{filelist:e.filelist}),e._trigger("removed",null,{up:t,files:n})}),u.bind("QueueChanged StateChanged",function(){e._handleState()}),u.bind("UploadFile",function(t,n){e._handleFileStatus(n)}),u.bind("FileUploaded",function(t,n){e._handleFileStatus(n),e._trigger("uploaded",null,{up:t,file:n})}),u.bind("UploadProgress",function(t,n){e._handleFileStatus(n),e._updateTotalProgress(),e._trigger("progress",null,{up:t,file:n})}),u.bind("UploadComplete",function(t,n){e._addFormFields(),e._trigger("complete",null,{up:t,files:n})})},_setOption:function(e,t){var n=this;e=="buttons"&&typeof t=="object"&&(t=i.extend(n.options.buttons,t),t.browse?(n.browse_button.button("enable").show(),n.uploader.disableBrowse(!1)):(n.browse_button.button("disable").hide(),n.uploader.disableBrowse(!0)),t.start?n.start_button.button("enable").show():n.start_button.button("disable").hide(),t.stop?n.start_button.button("enable").show():n.stop_button.button("disable").hide()),n.uploader.settings[e]=t},start:function(){this.uploader.start(),this._trigger("start",null,{up:this.uploader})},stop:function(){this.uploader.stop(),this._trigger("stop",null,{up:this.uploader})},enable:function(){this.browse_button.button("enable"),this.uploader.disableBrowse(!1)},disable:function(){this.browse_button.button("disable"),this.uploader.disableBrowse(!0)},getFile:function(e){var t;return typeof e=="number"?t=this.uploader.files[e]:t=this.uploader.getFile(e),t},getFiles:function(){return this.uploader.files},removeFile:function(e){n.typeOf(e)==="string"&&(e=this.getFile(e)),this.uploader.removeFile(e)},clearQueue:function(){this.uploader.splice()},getUploader:function(){return this.uploader},refresh:function(){this.uploader.refresh()},notify:function(e,t){var n=i('<div class="plupload_message"><span class="plupload_message_close ui-icon ui-icon-circle-close" title="'+o("Close")+'"></span>'+'<p><span class="ui-icon"></span>'+t+"</p>"+"</div>");n.addClass("ui-state-"+(e==="error"?"error":"highlight")).find("p .ui-icon").addClass("ui-icon-"+(e==="error"?"alert":"info")).end().find(".plupload_message_close").click(function(){n.remove()}).end(),i(".plupload_header",this.container).append(n)},destroy:function(){this.uploader.destroy(),i(".plupload_button",this.element).unbind(),i.ui.button&&i(".plupload_add, .plupload_start, .plupload_stop",this.container).button("destroy"),i.ui.progressbar&&this.progressbar.progressbar("destroy"),i.ui.sortable&&this.options.sortable&&i("tbody",this.filelist).sortable("destroy"),this.element.empty().html(this.contents_bak),this.contents_bak="",i.Widget.prototype.destroy.apply(this)},_handleState:function(){var e=this.uploader,t=e.files.length-(e.total.uploaded+e.total.failed),s=e.getOption("filters").max_file_count||0;n.STARTED===e.state?(i([]).add(this.stop_button).add(".plupload_started").removeClass("plupload_hidden"),this.start_button.button("disable"),this.options.multiple_queues||(this.browse_button.button("disable"),e.disableBrowse()),i(".plupload_upload_status",this.element).html(r.sprintf(o("Uploaded %d/%d files"),e.total.uploaded,e.files.length)),i(".plupload_header_content",this.element).addClass("plupload_header_content_bw")):n.STOPPED===e.state&&(i([]).add(this.stop_button).add(".plupload_started").addClass("plupload_hidden"),t?this.start_button.button("enable"):this.start_button.button("disable"),this.options.multiple_queues&&i(".plupload_header_content",this.element).removeClass("plupload_header_content_bw"),this.options.multiple_queues&&s&&s>t&&(this.browse_button.button("enable"),e.disableBrowse(!1)),this._updateTotalProgress()),e.total.queued===0?i(".ui-button-text",this.browse_button).html(o("Add Files")):i(".ui-button-text",this.browse_button).html(r.sprintf(o("%d files queued"),e.total.queued)),e.refresh()},_handleFileStatus:function(e){var t=i("#"+e.id),r,s;if(!t.length)return;switch(e.status){case n.DONE:r="plupload_done",s="plupload_action_icon ui-icon ui-icon-circle-check";break;case n.FAILED:r="ui-state-error plupload_failed",s="plupload_action_icon ui-icon ui-icon-alert";break;case n.QUEUED:r="plupload_delete",s="plupload_action_icon ui-icon ui-icon-circle-minus";break;case n.UPLOADING:r="ui-state-highlight plupload_uploading",s="plupload_action_icon ui-icon ui-icon-circle-arrow-w";var o=i(".plupload_scroll",this.container),u=o.scrollTop(),a=o.height(),f=t.position().top+t.height();a<f&&o.scrollTop(u+f-a),t.find(".plupload_file_percent").html(e.percent+"%").end().find(".plupload_file_progress").css("width",e.percent+"%").end().find(".plupload_file_size").html(n.formatSize(e.size))}r+=" ui-state-default plupload_file",t.attr("class",r).find(".plupload_action_icon").attr("class",s)},_updateTotalProgress:function(){var e=this.uploader;this.filelist[0].scrollTop=this.filelist[0].scrollHeight,this.progressbar.progressbar("value",e.total.percent),this.element.find(".plupload_total_status").html(e.total.percent+"%").end().find(".plupload_total_file_size").html(n.formatSize(e.total.size)).end().find(".plupload_upload_status").html(r.sprintf(o("Uploaded %d/%d files"),e.total.uploaded,e.files.length))},_displayThumbs:function(){function f(e,t,n){var r;e.on(t,function(){clearTimeout(r),r=setTimeout(function(){clearTimeout(r),n()},300)})}function l(){if(!t||!n){var r=i(".plupload_file:eq(0)",e.filelist);t=r.outerWidth(!0),n=r.outerHeight(!0)}var u=e.content.width(),a=e.content.height();s=Math.floor(u/t),o=s*(Math.ceil(a/n)+1)}function c(){var t=Math.floor(e.content.scrollTop()/n)*s;u=i(".plupload_file",e.filelist).slice(t,t+o).filter(".plupload_file_loading").get()}function h(){function t(){if(e.view_mode!=="thumbs")return;l(),c(),d()}i.fn.resizable&&f(e.container,"resize",t),f(e.window,"resize",t),f(e.content,"scroll",t),e.element.on("viewchanged selected",t),t()}function p(t,n){var s=new r.Image;s.onload=function(){var n=i("#"+t.id+" .plupload_file_thumb",e.filelist).html("");this.embed(n[0],{width:e.options.thumb_width,height:e.options.thumb_height,crop:!0,swf_url:r.resolveUrl(e.options.flash_swf_url),xap_url:r.resolveUrl(e.options.silverlight_xap_url)})},s.bind("embedded error",function(){i("#"+t.id,e.filelist).removeClass("plupload_file_loading"),this.destroy(),setTimeout(n,1)}),s.load(t.getSource())}function d(){if(e.view_mode!=="thumbs"||a)return;c();if(!u.length)return;a=!0,p(e.getFile(i(u.shift()).attr("id")),function(){a=!1,d()})}var e=this,t,n,s,o=0,u=[],a=!1;if(!this.options.views.thumbs)return;this.element.on("selected",function v(){e.element.off("selected",v),h()})},_addFiles:function(e){var t=this,s,o="";s='<li class="plupload_file ui-state-default plupload_file_loading plupload_delete" id="%id%" style="width:%thumb_width%px;"><div class="plupload_file_thumb" style="width:%thumb_width%px;height:%thumb_height%px;"><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><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 class="plupload_file_action"><div class="plupload_action_icon ui-icon ui-icon-circle-minus"> </div></div><div class="plupload_file_size">%size% </div><div class="plupload_file_fields"> </div></li>',n.typeOf(e)!=="array"&&(e=[e]),i.each(e,function(e,i){var u=r.Mime.getFileExtension(i.name)||"none";o+=s.replace(/%(\w+)%/g,function(e,r){switch(r){case"thumb_width":case"thumb_height":return t.options[r];case"size":return n.formatSize(i.size);case"ext":return u;default:return i[r]||""}})}),t.filelist.append(o)},_addFormFields:function(){var e=this;i(".plupload_file_fields",this.filelist).html(""),n.each(this.uploader.files,function(t,r){var s="",o=e.id+"_"+r;t.target_name&&(s+='<input type="hidden" name="'+o+'_tmpname" value="'+n.xmlEncode(t.target_name)+'" />'),s+='<input type="hidden" name="'+o+'_name" value="'+n.xmlEncode(t.name)+'" />',s+='<input type="hidden" name="'+o+'_status" value="'+(t.status===n.DONE?"done":"failed")+'" />',i("#"+t.id).find(".plupload_file_fields").html(s)}),this.counter.val(this.uploader.files.length)},_viewChanged:function(e){this.options.views.remember&&i.cookie&&i.cookie("plupload_ui_view",e,{expires:7,path:"/"}),r.Env.browser==="IE"&&r.Env.version<7&&this.content.attr("style",'height:expression(document.getElementById("'+this.id+"_container"+'").clientHeight - '+(e==="list"?132:102)+")"),this.container.removeClass("plupload_view_list plupload_view_thumbs").addClass("plupload_view_"+e),this.view_mode=e,this._trigger("viewchanged",null,{view:e})},_enableViewSwitcher:function(){var e=this,t,r=i(".plupload_view_switch",this.container),s,o;n.each(["list","thumbs"],function(t){e.options.views[t]||r.find('[for="'+e.id+"_view_"+t+'"], #'+e.id+"_view_"+t).remove()}),s=r.find(".plupload_button"),s.length===1?(r.hide(),t=s.eq(0).data("view"),this._viewChanged(t)):i.ui.button&&s.length>1?(this.options.views.remember&&i.cookie&&(t=i.cookie("plupload_ui_view")),~n.inArray(t,["list","thumbs"])||(t=this.options.views.active),r.show().buttonset().find(".ui-button").click(function(n){t=i(this).data("view"),e._viewChanged(t),n.preventDefault()}),o=r.find('[for="'+e.id+"_view_"+t+'"]'),o.length&&o.trigger("click")):(r.show(),this._viewChanged(this.options.views.active)),this.options.views.thumbs&&this._displayThumbs()},_enableRenaming:function(){var e=this;this.filelist.dblclick(function(t){var n=i(t.target),r,s,o,u,a="";if(!n.hasClass("plupload_file_name_wrapper"))return;s=e.uploader.getFile(n.closest(".plupload_file")[0].id),u=s.name,o=/^(.+)(\.[^.]+)$/.exec(u),o&&(u=o[1],a=o[2]),r=i('<input class="plupload_file_rename" type="text" />').width(n.width()).insertAfter(n.hide()),r.val(u).blur(function(){n.show().parent().scrollLeft(0).end().next().remove()}).keydown(function(e){var t=i(this);i.inArray(e.keyCode,[13,27])!==-1&&(e.preventDefault(),e.keyCode===13&&(s.name=t.val()+a,n.html(s.name)),t.blur())})[0].focus()})},_enableSortingList:function(){var e=this;if(i(".plupload_file",this.filelist).length<2)return;i("tbody",this.filelist).sortable("destroy"),this.filelist.sortable({items:".plupload_delete",cancel:"object, .plupload_clearer",stop:function(){var t=[];i.each(i(this).sortable("toArray"),function(n,r){t[t.length]=e.uploader.getFile(r)}),t.unshift(t.length),t.unshift(0),Array.prototype.splice.apply(e.uploader.files,t)}})}})})(window,document,plupload,mOxie,jQuery); \ No newline at end of file