[Pkg-javascript-commits] [plupload.js] 01/02: Imported Upstream version 2.1.8~dfsg1
Alexandre Viau
aviau at moszumanska.debian.org
Tue Jan 5 02:23:59 UTC 2016
This is an automated email from the git hooks/post-receive script.
aviau pushed a commit to branch master
in repository plupload.js.
commit 0fc3954d3e45b8dc4cce9dacce6c74d56d504178
Author: aviau <alexandre at alexandreviau.net>
Date: Mon Jan 4 21:18:46 2016 -0500
Imported Upstream version 2.1.8~dfsg1
---
examples/custom.html | 85 +
examples/dump.php | 27 +
examples/events.html | 217 ++
examples/jquery/all_runtimes.html | 139 ++
examples/jquery/jquery_ui_widget.html | 113 +
examples/jquery/queue_widget.html | 66 +
examples/jquery/s3.php | 125 ++
examples/upload.php | 125 ++
.../css/jquery.plupload.queue.css | 185 ++
js/jquery.plupload.queue/img/backgrounds.gif | Bin 0 -> 2977 bytes
js/jquery.plupload.queue/img/buttons-disabled.png | Bin 0 -> 1292 bytes
js/jquery.plupload.queue/img/buttons.png | Bin 0 -> 1439 bytes
js/jquery.plupload.queue/img/delete.gif | Bin 0 -> 180 bytes
js/jquery.plupload.queue/img/done.gif | Bin 0 -> 1024 bytes
js/jquery.plupload.queue/img/error.gif | Bin 0 -> 994 bytes
js/jquery.plupload.queue/img/throbber.gif | Bin 0 -> 1922 bytes
js/jquery.plupload.queue/img/transp50.png | Bin 0 -> 399 bytes
js/jquery.plupload.queue/jquery.plupload.queue.js | 428 ++++
js/jquery.ui.plupload/css/jquery.ui.plupload.css | 375 ++++
js/jquery.ui.plupload/img/loading.gif | Bin 0 -> 4023 bytes
js/jquery.ui.plupload/img/plupload.png | Bin 0 -> 6597 bytes
js/jquery.ui.plupload/jquery.ui.plupload.js | 1343 +++++++++++
js/plupload.dev.js | 2347 ++++++++++++++++++++
license.txt | 339 +++
readme.md | 147 ++
25 files changed, 6061 insertions(+)
diff --git a/examples/custom.html b/examples/custom.html
new file mode 100644
index 0000000..3850ade
--- /dev/null
+++ b/examples/custom.html
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
+
+<title>Plupload - Custom example</title>
+
+<!-- production -->
+<script type="text/javascript" src="../js/plupload.full.min.js"></script>
+
+
+<!-- debug
+<script type="text/javascript" src="../js/moxie.js"></script>
+<script type="text/javascript" src="../js/plupload.dev.js"></script>
+-->
+
+</head>
+<body style="font: 13px Verdana; background: #eee; color: #333">
+
+<h1>Custom example</h1>
+
+<p>Shows you how to use the core plupload API.</p>
+
+<div id="filelist">Your browser doesn't have Flash, Silverlight or HTML5 support.</div>
+<br />
+
+<div id="container">
+ <a id="pickfiles" href="javascript:;">[Select files]</a>
+ <a id="uploadfiles" href="javascript:;">[Upload files]</a>
+</div>
+
+<br />
+<pre id="console"></pre>
+
+
+<script type="text/javascript">
+// Custom example logic
+
+var uploader = new plupload.Uploader({
+ runtimes : 'html5,flash,silverlight,html4',
+ browse_button : 'pickfiles', // you can pass an id...
+ container: document.getElementById('container'), // ... or DOM Element itself
+ url : 'upload.php',
+ flash_swf_url : '../js/Moxie.swf',
+ silverlight_xap_url : '../js/Moxie.xap',
+
+ filters : {
+ max_file_size : '10mb',
+ mime_types: [
+ {title : "Image files", extensions : "jpg,gif,png"},
+ {title : "Zip files", extensions : "zip"}
+ ]
+ },
+
+ init: {
+ PostInit: function() {
+ document.getElementById('filelist').innerHTML = '';
+
+ document.getElementById('uploadfiles').onclick = function() {
+ uploader.start();
+ return false;
+ };
+ },
+
+ FilesAdded: function(up, files) {
+ plupload.each(files, function(file) {
+ document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
+ });
+ },
+
+ UploadProgress: function(up, file) {
+ document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
+ },
+
+ Error: function(up, err) {
+ document.getElementById('console').appendChild(document.createTextNode("\nError #" + err.code + ": " + err.message));
+ }
+ }
+});
+
+uploader.init();
+
+</script>
+</body>
+</html>
diff --git a/examples/dump.php b/examples/dump.php
new file mode 100644
index 0000000..3ce4471
--- /dev/null
+++ b/examples/dump.php
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
+<title>Plupload - Form dump</title>
+</head>
+<body style="font: 13px Verdana; background: #eee; color: #333">
+
+<h1>Post dump</h1>
+
+<p>Shows the form items posted.</p>
+
+<table>
+ <tr>
+ <th>Name</th>
+ <th>Value</th>
+ </tr>
+ <?php $count = 0; foreach ($_POST as $name => $value) { ?>
+ <tr class="<?php echo $count % 2 == 0 ? 'alt' : ''; ?>">
+ <td><?php echo htmlentities(stripslashes($name)) ?></td>
+ <td><?php echo nl2br(htmlentities(stripslashes($value))) ?></td>
+ </tr>
+ <?php } ?>
+</table>
+
+</body>
+</html>
diff --git a/examples/events.html b/examples/events.html
new file mode 100644
index 0000000..dd05e75
--- /dev/null
+++ b/examples/events.html
@@ -0,0 +1,217 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
+
+<title>Plupload - Events example</title>
+
+<!-- production -->
+<script type="text/javascript" src="../js/plupload.full.min.js"></script>
+
+
+<!-- debug
+<script type="text/javascript" src="../js/moxie.js"></script>
+<script type="text/javascript" src="../js/plupload.dev.js"></script>
+-->
+
+</head>
+<body style="font: 13px Verdana; background: #eee; color: #333">
+
+<h1>Events example</h1>
+
+<div id="container">
+ <a id="pickfiles" href="javascript:;">[Select files]</a>
+ <a id="uploadfiles" href="javascript:;">[Upload files]</a>
+</div>
+
+<br />
+<pre id="console"></pre>
+
+<script type="text/javascript">
+ var uploader = new plupload.Uploader({
+ // General settings
+ runtimes : 'silverlight,html4',
+ browse_button : 'pickfiles', // you can pass in id...
+ url : 'upload.php',
+ chunk_size : '1mb',
+ unique_names : true,
+
+ // Resize images on client-side if we can
+ resize : { width : 320, height : 240, quality : 90 },
+
+ filters : {
+ max_file_size : '10mb',
+
+ // Specify what files to browse for
+ mime_types: [
+ {title : "Image files", extensions : "jpg,gif,png"},
+ {title : "Zip files", extensions : "zip"}
+ ]
+ },
+
+ flash_swf_url : '../js/Moxie.swf',
+ silverlight_xap_url : '../js/Moxie.xap',
+
+ // PreInit events, bound before the internal events
+ preinit : {
+ Init: function(up, info) {
+ log('[Init]', 'Info:', info, 'Features:', up.features);
+ },
+
+ UploadFile: function(up, file) {
+ log('[UploadFile]', file);
+
+ // You can override settings before the file is uploaded
+ // up.setOption('url', 'upload.php?id=' + file.id);
+ // up.setOption('multipart_params', {param1 : 'value1', param2 : 'value2'});
+ }
+ },
+
+ // Post init events, bound after the internal events
+ init : {
+ PostInit: function() {
+ // Called after initialization is finished and internal event handlers bound
+ log('[PostInit]');
+
+ document.getElementById('uploadfiles').onclick = function() {
+ uploader.start();
+ return false;
+ };
+ },
+
+ Browse: function(up) {
+ // Called when file picker is clicked
+ log('[Browse]');
+ },
+
+ Refresh: function(up) {
+ // Called when the position or dimensions of the picker change
+ log('[Refresh]');
+ },
+
+ StateChanged: function(up) {
+ // Called when the state of the queue is changed
+ log('[StateChanged]', up.state == plupload.STARTED ? "STARTED" : "STOPPED");
+ },
+
+ QueueChanged: function(up) {
+ // Called when queue is changed by adding or removing files
+ log('[QueueChanged]');
+ },
+
+ OptionChanged: function(up, name, value, oldValue) {
+ // Called when one of the configuration options is changed
+ log('[OptionChanged]', 'Option Name: ', name, 'Value: ', value, 'Old Value: ', oldValue);
+ },
+
+ BeforeUpload: function(up, file) {
+ // Called right before the upload for a given file starts, can be used to cancel it if required
+ log('[BeforeUpload]', 'File: ', file);
+ },
+
+ UploadProgress: function(up, file) {
+ // Called while file is being uploaded
+ log('[UploadProgress]', 'File:', file, "Total:", up.total);
+ },
+
+ FileFiltered: function(up, file) {
+ // Called when file successfully files all the filters
+ log('[FileFiltered]', 'File:', file);
+ },
+
+ FilesAdded: function(up, files) {
+ // Called when files are added to queue
+ log('[FilesAdded]');
+
+ plupload.each(files, function(file) {
+ log(' File:', file);
+ });
+ },
+
+ FilesRemoved: function(up, files) {
+ // Called when files are removed from queue
+ log('[FilesRemoved]');
+
+ plupload.each(files, function(file) {
+ log(' File:', file);
+ });
+ },
+
+ FileUploaded: function(up, file, info) {
+ // Called when file has finished uploading
+ log('[FileUploaded] File:', file, "Info:", info);
+ },
+
+ ChunkUploaded: function(up, file, info) {
+ // Called when file chunk has finished uploading
+ log('[ChunkUploaded] File:', file, "Info:", info);
+ },
+
+ UploadComplete: function(up, files) {
+ // Called when all files are either uploaded or failed
+ log('[UploadComplete]');
+ },
+
+ Destroy: function(up) {
+ // Called when uploader is destroyed
+ log('[Destroy] ');
+ },
+
+ Error: function(up, args) {
+ // Called when error occurs
+ log('[Error] ', args);
+ }
+ }
+ });
+
+
+ function log() {
+ var str = "";
+
+ plupload.each(arguments, function(arg) {
+ var row = "";
+
+ if (typeof(arg) != "string") {
+ plupload.each(arg, function(value, key) {
+ // Convert items in File objects to human readable form
+ if (arg instanceof plupload.File) {
+ // Convert status to human readable
+ switch (value) {
+ case plupload.QUEUED:
+ value = 'QUEUED';
+ break;
+
+ case plupload.UPLOADING:
+ value = 'UPLOADING';
+ break;
+
+ case plupload.FAILED:
+ value = 'FAILED';
+ break;
+
+ case plupload.DONE:
+ value = 'DONE';
+ break;
+ }
+ }
+
+ if (typeof(value) != "function") {
+ row += (row ? ', ' : '') + key + '=' + value;
+ }
+ });
+
+ str += row + " ";
+ } else {
+ str += arg + " ";
+ }
+ });
+
+ var log = document.getElementById('console');
+ log.innerHTML += str + "\n";
+ }
+
+ uploader.init();
+
+</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/examples/jquery/all_runtimes.html b/examples/jquery/all_runtimes.html
new file mode 100644
index 0000000..ea44a9b
--- /dev/null
+++ b/examples/jquery/all_runtimes.html
@@ -0,0 +1,139 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
+
+<title>Plupload - Queue widget example</title>
+
+<link rel="stylesheet" href="../../js/jquery.plupload.queue/css/jquery.plupload.queue.css" type="text/css" media="screen" />
+
+<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
+
+<!-- production -->
+<script type="text/javascript" src="../../js/plupload.full.min.js"></script>
+<script type="text/javascript" src="../../js/jquery.plupload.queue/jquery.plupload.queue.js"></script>
+
+<!-- debug
+<script type="text/javascript" src="../../js/moxie.js"></script>
+<script type="text/javascript" src="../../js/plupload.dev.js"></script>
+<script type="text/javascript" src="../../js/jquery.plupload.queue/jquery.plupload.queue.js"></script>
+-->
+
+</head>
+<body style="font: 13px Verdana; background: #eee; color: #333">
+
+<form method="post" action="dump.php">
+ <h1>Queue widget example</h1>
+
+ <p>Shows the jQuery Plupload Queue widget and under different runtimes.</p>
+
+ <div style="float: left; margin-right: 20px">
+ <h3>Flash runtime</h3>
+ <div id="flash_uploader" style="width: 500px; height: 330px;">Your browser doesn't have Flash installed.</div>
+
+ <h3>Silverlight runtime</h3>
+ <div id="silverlight_uploader" style="width: 500px; height: 330px;">Your browser doesn't have Silverlight installed.</div>
+ </div>
+
+ <div style="float: left; margin-right: 20px">
+ <h3>HTML 4 runtime</h3>
+ <div id="html4_uploader" style="width: 500px; height: 330px;">Your browser doesn't have HTML 4 support.</div>
+
+ <h3>HTML 5 runtime</h3>
+ <div id="html5_uploader" style="width: 500px; height: 330px;">Your browser doesn't support native upload.</div>
+ </div>
+
+ <br style="clear: both" />
+
+ <input type="submit" value="Send" />
+</form>
+
+<script type="text/javascript">
+$(function() {
+ // Setup flash version
+ $("#flash_uploader").pluploadQueue({
+ // General settings
+ runtimes : 'flash',
+ url : '../upload.php',
+ chunk_size : '1mb',
+ unique_names : true,
+
+ filters : {
+ max_file_size : '10mb',
+ mime_types: [
+ {title : "Image files", extensions : "jpg,gif,png"},
+ {title : "Zip files", extensions : "zip"}
+ ]
+ },
+
+ // Resize images on clientside if we can
+ resize : {width : 320, height : 240, quality : 90},
+
+ // Flash settings
+ flash_swf_url : '../../js/Moxie.swf'
+ });
+
+
+ // Setup silverlight version
+ $("#silverlight_uploader").pluploadQueue({
+ // General settings
+ runtimes : 'silverlight',
+ url : '../upload.php',
+ chunk_size : '1mb',
+ unique_names : true,
+
+ filters : {
+ max_file_size : '10mb',
+ mime_types: [
+ {title : "Image files", extensions : "jpg,gif,png"},
+ {title : "Zip files", extensions : "zip"}
+ ]
+ },
+
+ // Resize images on clientside if we can
+ resize : {width : 320, height : 240, quality : 90},
+
+ // Silverlight settings
+ silverlight_xap_url : '../../js/Moxie.xap'
+ });
+
+ // Setup html5 version
+ $("#html5_uploader").pluploadQueue({
+ // General settings
+ runtimes : 'html5',
+ url : '../upload.php',
+ chunk_size : '1mb',
+ unique_names : true,
+
+ filters : {
+ max_file_size : '10mb',
+ mime_types: [
+ {title : "Image files", extensions : "jpg,gif,png"},
+ {title : "Zip files", extensions : "zip"}
+ ]
+ },
+
+ // Resize images on clientside if we can
+ resize : {width : 320, height : 240, quality : 90}
+ });
+
+
+ // Setup html4 version
+ $("#html4_uploader").pluploadQueue({
+ // General settings
+ runtimes : 'html4',
+ url : '../upload.php',
+ unique_names : true,
+
+ filters : {
+ mime_types: [
+ {title : "Image files", extensions : "jpg,gif,png"},
+ {title : "Zip files", extensions : "zip"}
+ ]
+ }
+ });
+});
+</script>
+
+</body>
+</html>
diff --git a/examples/jquery/jquery_ui_widget.html b/examples/jquery/jquery_ui_widget.html
new file mode 100644
index 0000000..1beb6c1
--- /dev/null
+++ b/examples/jquery/jquery_ui_widget.html
@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
+
+<title>Plupload - jQuery UI Widget</title>
+
+<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" />
+<link rel="stylesheet" href="../../js/jquery.ui.plupload/css/jquery.ui.plupload.css" type="text/css" />
+
+<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
+<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
+
+<!-- production -->
+<script type="text/javascript" src="../../js/plupload.full.min.js"></script>
+<script type="text/javascript" src="../../js/jquery.ui.plupload/jquery.ui.plupload.js"></script>
+
+<!-- debug
+<script type="text/javascript" src="../../js/moxie.js"></script>
+<script type="text/javascript" src="../../js/plupload.dev.js"></script>
+<script type="text/javascript" src="../../js/jquery.ui.plupload/jquery.ui.plupload.js"></script>
+-->
+
+</head>
+<body style="font: 13px Verdana; background: #eee; color: #333">
+
+<h1>jQuery UI Widget</h1>
+
+<p>You can see this example with different themes on the <a href="http://plupload.com/example_jquery_ui.php">www.plupload.com</a> website.</p>
+
+<form id="form" method="post" action="../dump.php">
+ <div id="uploader">
+ <p>Your browser doesn't have Flash, Silverlight or HTML5 support.</p>
+ </div>
+ <br />
+ <input type="submit" value="Submit" />
+</form>
+
+<script type="text/javascript">
+// Initialize the widget when the DOM is ready
+$(function() {
+ $("#uploader").plupload({
+ // General settings
+ runtimes : 'html5,flash,silverlight,html4',
+ url : '../upload.php',
+
+ // User can upload no more then 20 files in one go (sets multiple_queues to false)
+ max_file_count: 20,
+
+ chunk_size: '1mb',
+
+ // Resize images on clientside if we can
+ resize : {
+ width : 200,
+ height : 200,
+ quality : 90,
+ crop: true // crop to exact dimensions
+ },
+
+ filters : {
+ // Maximum file size
+ max_file_size : '1000mb',
+ // Specify what files to browse for
+ mime_types: [
+ {title : "Image files", extensions : "jpg,gif,png"},
+ {title : "Zip files", extensions : "zip"}
+ ]
+ },
+
+ // Rename files by clicking on their titles
+ rename: true,
+
+ // Sort files
+ sortable: true,
+
+ // Enable ability to drag'n'drop files onto the widget (currently only HTML5 supports that)
+ dragdrop: true,
+
+ // Views to activate
+ views: {
+ list: true,
+ thumbs: true, // Show thumbs
+ active: 'thumbs'
+ },
+
+ // Flash settings
+ flash_swf_url : '../../js/Moxie.swf',
+
+ // Silverlight settings
+ silverlight_xap_url : '../../js/Moxie.xap'
+ });
+
+
+ // Handle the case when form was submitted before uploading has finished
+ $('#form').submit(function(e) {
+ // Files in queue upload them first
+ if ($('#uploader').plupload('getFiles').length > 0) {
+
+ // When all files are uploaded submit form
+ $('#uploader').on('complete', function() {
+ $('#form')[0].submit();
+ });
+
+ $('#uploader').plupload('start');
+ } else {
+ alert("You must have at least one file in the queue.");
+ }
+ return false; // Keep the form from submitting
+ });
+});
+</script>
+</body>
+</html>
diff --git a/examples/jquery/queue_widget.html b/examples/jquery/queue_widget.html
new file mode 100644
index 0000000..4855287
--- /dev/null
+++ b/examples/jquery/queue_widget.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
+
+<title>Plupload - Queue widget example</title>
+
+<link rel="stylesheet" href="../../js/jquery.plupload.queue/css/jquery.plupload.queue.css" type="text/css" media="screen" />
+
+<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
+
+<!-- production -->
+<script type="text/javascript" src="../../js/plupload.full.min.js"></script>
+<script type="text/javascript" src="../../js/jquery.plupload.queue/jquery.plupload.queue.js"></script>
+
+<!-- debug
+<script type="text/javascript" src="../../js/moxie.js"></script>
+<script type="text/javascript" src="../../js/plupload.dev.js"></script>
+<script type="text/javascript" src="../../js/jquery.plupload.queue/jquery.plupload.queue.js"></script>
+-->
+
+
+</head>
+<body style="font: 13px Verdana; background: #eee; color: #333">
+
+<form method="post" action="dump.php">
+ <div id="uploader">
+ <p>Your browser doesn't have Flash, Silverlight or HTML5 support.</p>
+ </div>
+ <input type="submit" value="Send" />
+</form>
+
+<script type="text/javascript">
+$(function() {
+
+ // Setup html5 version
+ $("#uploader").pluploadQueue({
+ // General settings
+ runtimes : 'html5,flash,silverlight,html4',
+ url : '../upload.php',
+ chunk_size: '1mb',
+ rename : true,
+ dragdrop: true,
+
+ filters : {
+ // Maximum file size
+ max_file_size : '10mb',
+ // Specify what files to browse for
+ mime_types: [
+ {title : "Image files", extensions : "jpg,gif,png"},
+ {title : "Zip files", extensions : "zip"}
+ ]
+ },
+
+ // Resize images on clientside if we can
+ resize : {width : 320, height : 240, quality : 90},
+
+ flash_swf_url : '../../js/Moxie.swf',
+ silverlight_xap_url : '../../js/Moxie.xap'
+ });
+
+});
+</script>
+
+</body>
+</html>
diff --git a/examples/jquery/s3.php b/examples/jquery/s3.php
new file mode 100644
index 0000000..a46f1db
--- /dev/null
+++ b/examples/jquery/s3.php
@@ -0,0 +1,125 @@
+<?php
+/*
+In order to upload files to S3 using Flash runtime, one should start by placing crossdomain.xml into the bucket.
+crossdomain.xml can be as simple as this:
+
+<?xml version="1.0"?>
+<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
+<cross-domain-policy>
+<allow-access-from domain="*" secure="false" />
+</cross-domain-policy>
+
+In our tests SilverLight didn't require anything special and worked with this configuration just fine. It may fail back
+to the same crossdomain.xml as last resort.
+
+!!!Important!!! Plupload UI Widget here, is used only for demo purposes and is not required for uploading to S3.
+*/
+
+// important variables that will be used throughout this example
+$bucket = 'BUCKET';
+
+// these can be found on your Account page, under Security Credentials > Access Keys
+$accessKeyId = 'ACCESS_KEY_ID';
+$secret = 'SECRET_ACCESS_KEY';
+
+// prepare policy
+$policy = base64_encode(json_encode(array(
+ // ISO 8601 - date('c'); generates uncompatible date, so better do it manually
+ 'expiration' => date('Y-m-d\TH:i:s.000\Z', strtotime('+1 day')),
+ 'conditions' => array(
+ array('bucket' => $bucket),
+ array('acl' => 'public-read'),
+ array('starts-with', '$key', ''),
+ // for demo purposes we are accepting only images
+ array('starts-with', '$Content-Type', 'image/'),
+ // Plupload internally adds name field, so we need to mention it here
+ array('starts-with', '$name', ''),
+ // One more field to take into account: Filename - gets silently sent by FileReference.upload() in Flash
+ // http://docs.amazonwebservices.com/AmazonS3/latest/dev/HTTPPOSTFlash.html
+ array('starts-with', '$Filename', ''),
+ )
+)));
+
+// sign policy
+$signature = base64_encode(hash_hmac('sha1', $policy, $secret, true));
+
+?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
+
+<title>Plupload to Amazon S3 Example</title>
+
+<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" />
+<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
+<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
+
+<!-- Load plupload and all it's runtimes and finally the UI widget -->
+<link rel="stylesheet" href="../../js/jquery.ui.plupload/css/jquery.ui.plupload.css" type="text/css" />
+
+
+<!-- production -->
+<script type="text/javascript" src="../../js/plupload.full.min.js"></script>
+<script type="text/javascript" src="../../js/jquery.ui.plupload/jquery.ui.plupload.js"></script>
+
+<!-- debug
+<script type="text/javascript" src="../../js/moxie.js"></script>
+<script type="text/javascript" src="../../js/plupload.dev.js"></script>
+<script type="text/javascript" src="../../js/jquery.ui.plupload/jquery.ui.plupload.js"></script>
+-->
+
+</head>
+<body style="font: 13px Verdana; background: #eee; color: #333">
+
+<h1>Plupload to Amazon S3 Example</h1>
+
+<div id="uploader">
+ <p>Your browser doesn't have Flash, Silverlight or HTML5 support.</p>
+</div>
+
+<script type="text/javascript">
+// Convert divs to queue widgets when the DOM is ready
+$(function() {
+ $("#uploader").plupload({
+ runtimes : 'html5,flash,silverlight',
+ url : 'http://<?php echo $bucket; ?>.s3.amazonaws.com/',
+
+ multipart: true,
+ multipart_params: {
+ 'key': '${filename}', // use filename as a key
+ 'Filename': '${filename}', // adding this to keep consistency across the runtimes
+ 'acl': 'public-read',
+ 'Content-Type': 'image/jpeg',
+ 'AWSAccessKeyId' : '<?php echo $accessKeyId; ?>',
+ 'policy': '<?php echo $policy; ?>',
+ 'signature': '<?php echo $signature; ?>'
+ },
+
+ // !!!Important!!!
+ // this is not recommended with S3, since it will force Flash runtime into the mode, with no progress indication
+ //resize : {width : 800, height : 600, quality : 60}, // Resize images on clientside, if possible
+
+ // optional, but better be specified directly
+ file_data_name: 'file',
+
+ filters : {
+ // Maximum file size
+ max_file_size : '10mb',
+ // Specify what files to browse for
+ mime_types: [
+ {title : "Image files", extensions : "jpg,jpeg"}
+ ]
+ },
+
+ // Flash settings
+ flash_swf_url : '../../js/Moxie.swf',
+
+ // Silverlight settings
+ silverlight_xap_url : '../../js/Moxie.xap'
+ });
+});
+</script>
+
+</body>
+</html>
diff --git a/examples/upload.php b/examples/upload.php
new file mode 100644
index 0000000..0b7276c
--- /dev/null
+++ b/examples/upload.php
@@ -0,0 +1,125 @@
+<?php
+/**
+ * upload.php
+ *
+ * Copyright 2013, Moxiecode Systems AB
+ * Released under GPL License.
+ *
+ * License: http://www.plupload.com/license
+ * Contributing: http://www.plupload.com/contributing
+ */
+
+#!! IMPORTANT:
+#!! this file is just an example, it doesn't incorporate any security checks and
+#!! is not recommended to be used in production environment as it is. Be sure to
+#!! revise it and customize to your needs.
+
+
+// Make sure file is not cached (as it happens for example on iOS devices)
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+header("Cache-Control: no-store, no-cache, must-revalidate");
+header("Cache-Control: post-check=0, pre-check=0", false);
+header("Pragma: no-cache");
+
+/*
+// Support CORS
+header("Access-Control-Allow-Origin: *");
+// other CORS headers if any...
+if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
+ exit; // finish preflight CORS requests here
+}
+*/
+
+// 5 minutes execution time
+ at set_time_limit(5 * 60);
+
+// Uncomment this one to fake upload time
+// usleep(5000);
+
+// Settings
+$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
+//$targetDir = 'uploads';
+$cleanupTargetDir = true; // Remove old files
+$maxFileAge = 5 * 3600; // Temp file age in seconds
+
+
+// Create target dir
+if (!file_exists($targetDir)) {
+ @mkdir($targetDir);
+}
+
+// Get a file name
+if (isset($_REQUEST["name"])) {
+ $fileName = $_REQUEST["name"];
+} elseif (!empty($_FILES)) {
+ $fileName = $_FILES["file"]["name"];
+} else {
+ $fileName = uniqid("file_");
+}
+
+$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
+
+// Chunking might be enabled
+$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
+$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
+
+
+// Remove old temp files
+if ($cleanupTargetDir) {
+ if (!is_dir($targetDir) || !$dir = opendir($targetDir)) {
+ die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
+ }
+
+ while (($file = readdir($dir)) !== false) {
+ $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
+
+ // If temp file is current file proceed to the next
+ if ($tmpfilePath == "{$filePath}.part") {
+ continue;
+ }
+
+ // Remove temp file if it is older than the max age and is not the current file
+ if (preg_match('/\.part$/', $file) && (filemtime($tmpfilePath) < time() - $maxFileAge)) {
+ @unlink($tmpfilePath);
+ }
+ }
+ closedir($dir);
+}
+
+
+// Open temp file
+if (!$out = @fopen("{$filePath}.part", $chunks ? "ab" : "wb")) {
+ die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
+}
+
+if (!empty($_FILES)) {
+ if ($_FILES["file"]["error"] || !is_uploaded_file($_FILES["file"]["tmp_name"])) {
+ die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
+ }
+
+ // Read binary input stream and append it to temp file
+ if (!$in = @fopen($_FILES["file"]["tmp_name"], "rb")) {
+ die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
+ }
+} else {
+ if (!$in = @fopen("php://input", "rb")) {
+ die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
+ }
+}
+
+while ($buff = fread($in, 4096)) {
+ fwrite($out, $buff);
+}
+
+ at fclose($out);
+ at fclose($in);
+
+// Check if file has been uploaded
+if (!$chunks || $chunk == $chunks - 1) {
+ // Strip the temp .part suffix off
+ rename("{$filePath}.part", $filePath);
+}
+
+// Return Success JSON-RPC response
+die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
diff --git a/js/jquery.plupload.queue/css/jquery.plupload.queue.css b/js/jquery.plupload.queue/css/jquery.plupload.queue.css
new file mode 100644
index 0000000..6bfe0e5
--- /dev/null
+++ b/js/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/js/jquery.plupload.queue/img/backgrounds.gif b/js/jquery.plupload.queue/img/backgrounds.gif
new file mode 100644
index 0000000..39e33eb
Binary files /dev/null and b/js/jquery.plupload.queue/img/backgrounds.gif differ
diff --git a/js/jquery.plupload.queue/img/buttons-disabled.png b/js/jquery.plupload.queue/img/buttons-disabled.png
new file mode 100644
index 0000000..afa11af
Binary files /dev/null and b/js/jquery.plupload.queue/img/buttons-disabled.png differ
diff --git a/js/jquery.plupload.queue/img/buttons.png b/js/jquery.plupload.queue/img/buttons.png
new file mode 100644
index 0000000..153e738
Binary files /dev/null and b/js/jquery.plupload.queue/img/buttons.png differ
diff --git a/js/jquery.plupload.queue/img/delete.gif b/js/jquery.plupload.queue/img/delete.gif
new file mode 100644
index 0000000..78ca8b3
Binary files /dev/null and b/js/jquery.plupload.queue/img/delete.gif differ
diff --git a/js/jquery.plupload.queue/img/done.gif b/js/jquery.plupload.queue/img/done.gif
new file mode 100644
index 0000000..29f3ed7
Binary files /dev/null and b/js/jquery.plupload.queue/img/done.gif differ
diff --git a/js/jquery.plupload.queue/img/error.gif b/js/jquery.plupload.queue/img/error.gif
new file mode 100644
index 0000000..4682b63
Binary files /dev/null and b/js/jquery.plupload.queue/img/error.gif differ
diff --git a/js/jquery.plupload.queue/img/throbber.gif b/js/jquery.plupload.queue/img/throbber.gif
new file mode 100644
index 0000000..4ae8b16
Binary files /dev/null and b/js/jquery.plupload.queue/img/throbber.gif differ
diff --git a/js/jquery.plupload.queue/img/transp50.png b/js/jquery.plupload.queue/img/transp50.png
new file mode 100644
index 0000000..eb0efe1
Binary files /dev/null and b/js/jquery.plupload.queue/img/transp50.png differ
diff --git a/js/jquery.plupload.queue/jquery.plupload.queue.js b/js/jquery.plupload.queue/jquery.plupload.queue.js
new file mode 100644
index 0000000..6894ecd
--- /dev/null
+++ b/js/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.
+
+ at 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>
+
+ at 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
+ });
+
+ at class pluploadQueue
+ at constructor
+ at 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"> </div>' +
+ '<div class="plupload_file_status"><span>' + _('Status') + '</span></div>' +
+ '<div class="plupload_file_size">' + _('Size') + '</div>' +
+ '<div class="plupload_clearer"> </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"> </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"> </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/js/jquery.ui.plupload/css/jquery.ui.plupload.css b/js/jquery.ui.plupload/css/jquery.ui.plupload.css
new file mode 100644
index 0000000..e46a3f1
--- /dev/null
+++ b/js/jquery.ui.plupload/css/jquery.ui.plupload.css
@@ -0,0 +1,375 @@
+/*
+ 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_thumb_loading {
+ background: #eee url(../img/loading.gif) center no-repeat;
+}
+
+.plupload_thumb_loading .plupload_file_dummy,
+.plupload_thumb_embedded .plupload_file_dummy {
+ display: none;
+}
+
+.plupload_file_name {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ 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: 6px;
+ 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/js/jquery.ui.plupload/img/loading.gif b/js/jquery.ui.plupload/img/loading.gif
new file mode 100644
index 0000000..f0109d1
Binary files /dev/null and b/js/jquery.ui.plupload/img/loading.gif differ
diff --git a/js/jquery.ui.plupload/img/plupload.png b/js/jquery.ui.plupload/img/plupload.png
new file mode 100644
index 0000000..8ae0f90
Binary files /dev/null and b/js/jquery.ui.plupload/img/plupload.png differ
diff --git a/js/jquery.ui.plupload/jquery.ui.plupload.js b/js/jquery.ui.plupload/jquery.ui.plupload.js
new file mode 100644
index 0000000..20a24d9
--- /dev/null
+++ b/js/jquery.ui.plupload/jquery.ui.plupload.js
@@ -0,0 +1,1343 @@
+/**
+ * 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.
+
+ at 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>
+
+ at 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.");
+
+ at example
+ // Subscribing to the events...
+ // ... on initialization:
+ $('#uploader').plupload({
+ ...
+ viewchanged: function(event, args) {
+ // stuff ...
+ }
+ });
+ // ... or after initialization
+ $('#uploader').on("viewchanged", function(event, args) {
+ // stuff ...
+ });
+
+ at class UI.Plupload
+ at constructor
+ at 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.
+
+ at event ready
+ at param {plupload.Uploader} uploader Uploader instance sending the event.
+*/
+
+/**
+Dispatched when file dialog is closed.
+
+ at event selected
+ at param {plupload.Uploader} uploader Uploader instance sending the event.
+ at param {Array} files Array of selected files represented by plupload.File objects
+*/
+
+/**
+Dispatched when file dialog is closed.
+
+ at event removed
+ at param {plupload.Uploader} uploader Uploader instance sending the event.
+ at param {Array} files Array of removed files represented by plupload.File objects
+*/
+
+/**
+Dispatched when upload is started.
+
+ at event started
+ at param {plupload.Uploader} uploader Uploader instance sending the event.
+*/
+
+/**
+Dispatched when upload is stopped.
+
+ at event stopped
+ at param {plupload.Uploader} uploader Uploader instance sending the event.
+*/
+
+/**
+Dispatched during the upload process.
+
+ at event progress
+ at param {plupload.Uploader} uploader Uploader instance sending the event.
+ at 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.
+
+ at event uploaded
+ at param {plupload.Uploader} uploader Uploader instance sending the event.
+ at 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.
+
+ at event complete
+ at param {plupload.Uploader} uploader Uploader instance sending the event.
+ at 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.
+
+ at event viewchanged
+ at param {plupload.Uploader} uploader Uploader instance sending the event.
+ at param {String} type Current view type.
+*/
+
+/**
+Dispatched when error of some kind is detected.
+
+ at event error
+ at param {plupload.Uploader} uploader Uploader instance sending the event.
+ at param {String} error Error message.
+ at 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"> </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"> </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> ' +
+ '<a class="plupload_button plupload_start">' + _("Start Upload") + '</a> ' +
+ '<a class="plupload_button plupload_stop plupload_hidden">'+_("Stop Upload") + '</a> ' +
+ '</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"> </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));
+
+ // retrieve full normalized set of options
+ this.options = uploader.getOption();
+
+ 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', function() {
+ self._handleState();
+ });
+
+ uploader.bind('StateChanged', function(up) {
+ self._handleState();
+ if (plupload.STARTED === up.state) {
+ self._trigger('started', null, { up: this.uploader });
+ } else if (plupload.STOPPED === up.state) {
+ self._trigger('stopped', null, { up: this.uploader });
+ }
+ });
+
+ uploader.bind('UploadFile', function(up, file) {
+ self._handleFileStatus(file);
+ });
+
+ uploader.bind('FileUploaded', function(up, file, result) {
+ self._handleFileStatus(file);
+ self._trigger('uploaded', null, { up: up, file: file, result: result } );
+ });
+
+ uploader.bind('UploadProgress', function(up, file) {
+ self._handleFileStatus(file);
+ self._updateTotalProgress();
+ self._trigger('progress', null, { up: up, file: file } );
+ });
+
+ uploader.bind('UploadComplete', function(up, files) {
+ self._addFormFields();
+ self._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.setOption(key, value);
+ },
+
+
+ /**
+ Start upload. Triggers `start` event.
+
+ @method start
+ */
+ start: function() {
+ this.uploader.start();
+ },
+
+
+ /**
+ Stop upload. Triggers `stop` event.
+
+ @method stop
+ */
+ stop: function() {
+ this.uploader.stop();
+ },
+
+
+ /**
+ 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 its 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 its 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 .plupload_file_thumb', self.filelist)
+ .slice(startIdx, startIdx + num)
+ .filter('.plupload_thumb_toload')
+ .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);
+ this.embed(thumb[0], {
+ width: self.options.thumb_width,
+ height: self.options.thumb_height,
+ crop: true,
+ preserveHeaders: false,
+ swf_url: o.resolveUrl(self.options.flash_swf_url),
+ xap_url: o.resolveUrl(self.options.silverlight_xap_url)
+ });
+ };
+
+ img.bind("embedded error", function(e) {
+ $('#' + file.id, self.filelist)
+ .find('.plupload_file_thumb')
+ .removeClass('plupload_thumb_loading')
+ .addClass('plupload_thumb_' + e.type)
+ ;
+ this.destroy();
+ setTimeout(cb, 1); // detach, otherwise ui might hang (in SilverLight for example)
+ });
+
+ $('#' + file.id, self.filelist)
+ .find('.plupload_file_thumb')
+ .removeClass('plupload_thumb_toload')
+ .addClass('plupload_thumb_loading')
+ ;
+ 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()).closest('.plupload_file').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_delete" id="{id}" style="width:{thumb_width}px;">' +
+ '<div class="plupload_file_thumb plupload_thumb_toload" 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/js/plupload.dev.js b/js/plupload.dev.js
new file mode 100644
index 0000000..606cf7f
--- /dev/null
+++ b/js/plupload.dev.js
@@ -0,0 +1,2347 @@
+/**
+ * Plupload - multi-runtime File Uploader
+ * v2.1.8
+ *
+ * Copyright 2013, Moxiecode Systems AB
+ * Released under GPL License.
+ *
+ * License: http://www.plupload.com/license
+ * Contributing: http://www.plupload.com/contributing
+ *
+ * Date: 2015-07-21
+ */
+/**
+ * Plupload.js
+ *
+ * Copyright 2013, Moxiecode Systems AB
+ * Released under GPL License.
+ *
+ * License: http://www.plupload.com/license
+ * Contributing: http://www.plupload.com/contributing
+ */
+
+/*global mOxie:true */
+
+;(function(window, o, undef) {
+
+var delay = window.setTimeout
+, fileFilters = {}
+;
+
+// convert plupload features to caps acceptable by mOxie
+function normalizeCaps(settings) {
+ var features = settings.required_features, caps = {};
+
+ function resolve(feature, value, strict) {
+ // Feature notation is deprecated, use caps (this thing here is required for backward compatibility)
+ var map = {
+ chunks: 'slice_blob',
+ jpgresize: 'send_binary_string',
+ pngresize: 'send_binary_string',
+ progress: 'report_upload_progress',
+ multi_selection: 'select_multiple',
+ dragdrop: 'drag_and_drop',
+ drop_element: 'drag_and_drop',
+ headers: 'send_custom_headers',
+ urlstream_upload: 'send_binary_string',
+ canSendBinary: 'send_binary',
+ triggerDialog: 'summon_file_dialog'
+ };
+
+ if (map[feature]) {
+ caps[map[feature]] = value;
+ } else if (!strict) {
+ caps[feature] = value;
+ }
+ }
+
+ if (typeof(features) === 'string') {
+ plupload.each(features.split(/\s*,\s*/), function(feature) {
+ resolve(feature, true);
+ });
+ } else if (typeof(features) === 'object') {
+ plupload.each(features, function(value, feature) {
+ resolve(feature, value);
+ });
+ } else if (features === true) {
+ // check settings for required features
+ if (settings.chunk_size > 0) {
+ caps.slice_blob = true;
+ }
+
+ if (settings.resize.enabled || !settings.multipart) {
+ caps.send_binary_string = true;
+ }
+
+ plupload.each(settings, function(value, feature) {
+ resolve(feature, !!value, true); // strict check
+ });
+ }
+
+ return caps;
+}
+
+/**
+ * @module plupload
+ * @static
+ */
+var plupload = {
+ /**
+ * Plupload version will be replaced on build.
+ *
+ * @property VERSION
+ * @for Plupload
+ * @static
+ * @final
+ */
+ VERSION : '2.1.8',
+
+ /**
+ * The state of the queue before it has started and after it has finished
+ *
+ * @property STOPPED
+ * @static
+ * @final
+ */
+ STOPPED : 1,
+
+ /**
+ * Upload process is running
+ *
+ * @property STARTED
+ * @static
+ * @final
+ */
+ STARTED : 2,
+
+ /**
+ * File is queued for upload
+ *
+ * @property QUEUED
+ * @static
+ * @final
+ */
+ QUEUED : 1,
+
+ /**
+ * File is being uploaded
+ *
+ * @property UPLOADING
+ * @static
+ * @final
+ */
+ UPLOADING : 2,
+
+ /**
+ * File has failed to be uploaded
+ *
+ * @property FAILED
+ * @static
+ * @final
+ */
+ FAILED : 4,
+
+ /**
+ * File has been uploaded successfully
+ *
+ * @property DONE
+ * @static
+ * @final
+ */
+ DONE : 5,
+
+ // Error constants used by the Error event
+
+ /**
+ * Generic error for example if an exception is thrown inside Silverlight.
+ *
+ * @property GENERIC_ERROR
+ * @static
+ * @final
+ */
+ GENERIC_ERROR : -100,
+
+ /**
+ * HTTP transport error. For example if the server produces a HTTP status other than 200.
+ *
+ * @property HTTP_ERROR
+ * @static
+ * @final
+ */
+ HTTP_ERROR : -200,
+
+ /**
+ * Generic I/O error. For example if it wasn't possible to open the file stream on local machine.
+ *
+ * @property IO_ERROR
+ * @static
+ * @final
+ */
+ IO_ERROR : -300,
+
+ /**
+ * @property SECURITY_ERROR
+ * @static
+ * @final
+ */
+ SECURITY_ERROR : -400,
+
+ /**
+ * Initialization error. Will be triggered if no runtime was initialized.
+ *
+ * @property INIT_ERROR
+ * @static
+ * @final
+ */
+ INIT_ERROR : -500,
+
+ /**
+ * File size error. If the user selects a file that is too large it will be blocked and an error of this type will be triggered.
+ *
+ * @property FILE_SIZE_ERROR
+ * @static
+ * @final
+ */
+ FILE_SIZE_ERROR : -600,
+
+ /**
+ * File extension error. If the user selects a file that isn't valid according to the filters setting.
+ *
+ * @property FILE_EXTENSION_ERROR
+ * @static
+ * @final
+ */
+ FILE_EXTENSION_ERROR : -601,
+
+ /**
+ * Duplicate file error. If prevent_duplicates is set to true and user selects the same file again.
+ *
+ * @property FILE_DUPLICATE_ERROR
+ * @static
+ * @final
+ */
+ FILE_DUPLICATE_ERROR : -602,
+
+ /**
+ * Runtime will try to detect if image is proper one. Otherwise will throw this error.
+ *
+ * @property IMAGE_FORMAT_ERROR
+ * @static
+ * @final
+ */
+ IMAGE_FORMAT_ERROR : -700,
+
+ /**
+ * While working on files runtime may run out of memory and will throw this error.
+ *
+ * @since 2.1.2
+ * @property MEMORY_ERROR
+ * @static
+ * @final
+ */
+ MEMORY_ERROR : -701,
+
+ /**
+ * Each runtime has an upper limit on a dimension of the image it can handle. If bigger, will throw this error.
+ *
+ * @property IMAGE_DIMENSIONS_ERROR
+ * @static
+ * @final
+ */
+ IMAGE_DIMENSIONS_ERROR : -702,
+
+ /**
+ * Mime type lookup table.
+ *
+ * @property mimeTypes
+ * @type Object
+ * @final
+ */
+ mimeTypes : o.mimes,
+
+ /**
+ * In some cases sniffing is the only way around :(
+ */
+ ua: o.ua,
+
+ /**
+ * Gets the true type of the built-in object (better version of typeof).
+ * @credits Angus Croll (http://javascriptweblog.wordpress.com/)
+ *
+ * @method typeOf
+ * @static
+ * @param {Object} o Object to check.
+ * @return {String} Object [[Class]]
+ */
+ typeOf: o.typeOf,
+
+ /**
+ * Extends the specified object with another object.
+ *
+ * @method extend
+ * @static
+ * @param {Object} target Object to extend.
+ * @param {Object..} obj Multiple objects to extend with.
+ * @return {Object} Same as target, the extended object.
+ */
+ extend : o.extend,
+
+ /**
+ * Generates an unique ID. This is 99.99% unique since it takes the current time and 5 random numbers.
+ * The only way a user would be able to get the same ID is if the two persons at the same exact millisecond manages
+ * to get 5 the same random numbers between 0-65535 it also uses a counter so each call will be guaranteed to be page unique.
+ * It's more probable for the earth to be hit with an asteriod. You can also if you want to be 100% sure set the plupload.guidPrefix property
+ * to an user unique key.
+ *
+ * @method guid
+ * @static
+ * @return {String} Virtually unique id.
+ */
+ guid : o.guid,
+
+ /**
+ * Get array of DOM Elements by their ids.
+ *
+ * @method get
+ * @for Utils
+ * @param {String} id Identifier of the DOM Element
+ * @return {Array}
+ */
+ get : function get(ids) {
+ var els = [], el;
+
+ if (o.typeOf(ids) !== 'array') {
+ ids = [ids];
+ }
+
+ var i = ids.length;
+ while (i--) {
+ el = o.get(ids[i]);
+ if (el) {
+ els.push(el);
+ }
+ }
+
+ return els.length ? els : null;
+ },
+
+ /**
+ * Executes the callback function for each item in array/object. If you return false in the
+ * callback it will break the loop.
+ *
+ * @method each
+ * @static
+ * @param {Object} obj Object to iterate.
+ * @param {function} callback Callback function to execute for each item.
+ */
+ each : o.each,
+
+ /**
+ * Returns the absolute x, y position of an Element. The position will be returned in a object with x, y fields.
+ *
+ * @method getPos
+ * @static
+ * @param {Element} node HTML element or element id to get x, y position from.
+ * @param {Element} root Optional root element to stop calculations at.
+ * @return {object} Absolute position of the specified element object with x, y fields.
+ */
+ getPos : o.getPos,
+
+ /**
+ * Returns the size of the specified node in pixels.
+ *
+ * @method getSize
+ * @static
+ * @param {Node} node Node to get the size of.
+ * @return {Object} Object with a w and h property.
+ */
+ getSize : o.getSize,
+
+ /**
+ * Encodes the specified string.
+ *
+ * @method xmlEncode
+ * @static
+ * @param {String} s String to encode.
+ * @return {String} Encoded string.
+ */
+ xmlEncode : function(str) {
+ var xmlEncodeChars = {'<' : 'lt', '>' : 'gt', '&' : 'amp', '"' : 'quot', '\'' : '#39'}, xmlEncodeRegExp = /[<>&\"\']/g;
+
+ return str ? ('' + str).replace(xmlEncodeRegExp, function(chr) {
+ return xmlEncodeChars[chr] ? '&' + xmlEncodeChars[chr] + ';' : chr;
+ }) : str;
+ },
+
+ /**
+ * Forces anything into an array.
+ *
+ * @method toArray
+ * @static
+ * @param {Object} obj Object with length field.
+ * @return {Array} Array object containing all items.
+ */
+ toArray : o.toArray,
+
+ /**
+ * Find an element in array and return its index if present, otherwise return -1.
+ *
+ * @method inArray
+ * @static
+ * @param {mixed} needle Element to find
+ * @param {Array} array
+ * @return {Int} Index of the element, or -1 if not found
+ */
+ inArray : o.inArray,
+
+ /**
+ * Extends the language pack object with new items.
+ *
+ * @method addI18n
+ * @static
+ * @param {Object} pack Language pack items to add.
+ * @return {Object} Extended language pack object.
+ */
+ addI18n : o.addI18n,
+
+ /**
+ * Translates the specified string by checking for the english string in the language pack lookup.
+ *
+ * @method translate
+ * @static
+ * @param {String} str String to look for.
+ * @return {String} Translated string or the input string if it wasn't found.
+ */
+ translate : o.translate,
+
+ /**
+ * Checks if object is empty.
+ *
+ * @method isEmptyObj
+ * @static
+ * @param {Object} obj Object to check.
+ * @return {Boolean}
+ */
+ isEmptyObj : o.isEmptyObj,
+
+ /**
+ * Checks if specified DOM element has specified class.
+ *
+ * @method hasClass
+ * @static
+ * @param {Object} obj DOM element like object to add handler to.
+ * @param {String} name Class name
+ */
+ hasClass : o.hasClass,
+
+ /**
+ * Adds specified className to specified DOM element.
+ *
+ * @method addClass
+ * @static
+ * @param {Object} obj DOM element like object to add handler to.
+ * @param {String} name Class name
+ */
+ addClass : o.addClass,
+
+ /**
+ * Removes specified className from specified DOM element.
+ *
+ * @method removeClass
+ * @static
+ * @param {Object} obj DOM element like object to add handler to.
+ * @param {String} name Class name
+ */
+ removeClass : o.removeClass,
+
+ /**
+ * Returns a given computed style of a DOM element.
+ *
+ * @method getStyle
+ * @static
+ * @param {Object} obj DOM element like object.
+ * @param {String} name Style you want to get from the DOM element
+ */
+ getStyle : o.getStyle,
+
+ /**
+ * Adds an event handler to the specified object and store reference to the handler
+ * in objects internal Plupload registry (@see removeEvent).
+ *
+ * @method addEvent
+ * @static
+ * @param {Object} obj DOM element like object to add handler to.
+ * @param {String} name Name to add event listener to.
+ * @param {Function} callback Function to call when event occurs.
+ * @param {String} (optional) key that might be used to add specifity to the event record.
+ */
+ addEvent : o.addEvent,
+
+ /**
+ * Remove event handler from the specified object. If third argument (callback)
+ * is not specified remove all events with the specified name.
+ *
+ * @method removeEvent
+ * @static
+ * @param {Object} obj DOM element to remove event listener(s) from.
+ * @param {String} name Name of event listener to remove.
+ * @param {Function|String} (optional) might be a callback or unique key to match.
+ */
+ removeEvent: o.removeEvent,
+
+ /**
+ * Remove all kind of events from the specified object
+ *
+ * @method removeAllEvents
+ * @static
+ * @param {Object} obj DOM element to remove event listeners from.
+ * @param {String} (optional) unique key to match, when removing events.
+ */
+ removeAllEvents: o.removeAllEvents,
+
+ /**
+ * Cleans the specified name from national characters (diacritics). The result will be a name with only a-z, 0-9 and _.
+ *
+ * @method cleanName
+ * @static
+ * @param {String} s String to clean up.
+ * @return {String} Cleaned string.
+ */
+ cleanName : function(name) {
+ var i, lookup;
+
+ // Replace diacritics
+ lookup = [
+ /[\300-\306]/g, 'A', /[\340-\346]/g, 'a',
+ /\307/g, 'C', /\347/g, 'c',
+ /[\310-\313]/g, 'E', /[\350-\353]/g, 'e',
+ /[\314-\317]/g, 'I', /[\354-\357]/g, 'i',
+ /\321/g, 'N', /\361/g, 'n',
+ /[\322-\330]/g, 'O', /[\362-\370]/g, 'o',
+ /[\331-\334]/g, 'U', /[\371-\374]/g, 'u'
+ ];
+
+ for (i = 0; i < lookup.length; i += 2) {
+ name = name.replace(lookup[i], lookup[i + 1]);
+ }
+
+ // Replace whitespace
+ name = name.replace(/\s+/g, '_');
+
+ // Remove anything else
+ name = name.replace(/[^a-z0-9_\-\.]+/gi, '');
+
+ return name;
+ },
+
+ /**
+ * Builds a full url out of a base URL and an object with items to append as query string items.
+ *
+ * @method buildUrl
+ * @static
+ * @param {String} url Base URL to append query string items to.
+ * @param {Object} items Name/value object to serialize as a querystring.
+ * @return {String} String with url + serialized query string items.
+ */
+ buildUrl : function(url, items) {
+ var query = '';
+
+ plupload.each(items, function(value, name) {
+ query += (query ? '&' : '') + encodeURIComponent(name) + '=' + encodeURIComponent(value);
+ });
+
+ if (query) {
+ url += (url.indexOf('?') > 0 ? '&' : '?') + query;
+ }
+
+ return url;
+ },
+
+ /**
+ * Formats the specified number as a size string for example 1024 becomes 1 KB.
+ *
+ * @method formatSize
+ * @static
+ * @param {Number} size Size to format as string.
+ * @return {String} Formatted size string.
+ */
+ formatSize : function(size) {
+
+ if (size === undef || /\D/.test(size)) {
+ return plupload.translate('N/A');
+ }
+
+ function round(num, precision) {
+ return Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision);
+ }
+
+ var boundary = Math.pow(1024, 4);
+
+ // TB
+ if (size > boundary) {
+ return round(size / boundary, 1) + " " + plupload.translate('tb');
+ }
+
+ // GB
+ if (size > (boundary/=1024)) {
+ return round(size / boundary, 1) + " " + plupload.translate('gb');
+ }
+
+ // MB
+ if (size > (boundary/=1024)) {
+ return round(size / boundary, 1) + " " + plupload.translate('mb');
+ }
+
+ // KB
+ if (size > 1024) {
+ return Math.round(size / 1024) + " " + plupload.translate('kb');
+ }
+
+ return size + " " + plupload.translate('b');
+ },
+
+
+ /**
+ * Parses the specified size string into a byte value. For example 10kb becomes 10240.
+ *
+ * @method parseSize
+ * @static
+ * @param {String|Number} size String to parse or number to just pass through.
+ * @return {Number} Size in bytes.
+ */
+ parseSize : o.parseSizeStr,
+
+
+ /**
+ * A way to predict what runtime will be choosen in the current environment with the
+ * specified settings.
+ *
+ * @method predictRuntime
+ * @static
+ * @param {Object|String} config Plupload settings to check
+ * @param {String} [runtimes] Comma-separated list of runtimes to check against
+ * @return {String} Type of compatible runtime
+ */
+ predictRuntime : function(config, runtimes) {
+ var up, runtime;
+
+ up = new plupload.Uploader(config);
+ runtime = o.Runtime.thatCan(up.getOption().required_features, runtimes || config.runtimes);
+ up.destroy();
+ return runtime;
+ },
+
+ /**
+ * Registers a filter that will be executed for each file added to the queue.
+ * If callback returns false, file will not be added.
+ *
+ * Callback receives two arguments: a value for the filter as it was specified in settings.filters
+ * and a file to be filtered. Callback is executed in the context of uploader instance.
+ *
+ * @method addFileFilter
+ * @static
+ * @param {String} name Name of the filter by which it can be referenced in settings.filters
+ * @param {String} cb Callback - the actual routine that every added file must pass
+ */
+ addFileFilter: function(name, cb) {
+ fileFilters[name] = cb;
+ }
+};
+
+
+plupload.addFileFilter('mime_types', function(filters, file, cb) {
+ if (filters.length && !filters.regexp.test(file.name)) {
+ this.trigger('Error', {
+ code : plupload.FILE_EXTENSION_ERROR,
+ message : plupload.translate('File extension error.'),
+ file : file
+ });
+ cb(false);
+ } else {
+ cb(true);
+ }
+});
+
+
+plupload.addFileFilter('max_file_size', function(maxSize, file, cb) {
+ var undef;
+
+ maxSize = plupload.parseSize(maxSize);
+
+ // Invalid file size
+ if (file.size !== undef && maxSize && file.size > maxSize) {
+ this.trigger('Error', {
+ code : plupload.FILE_SIZE_ERROR,
+ message : plupload.translate('File size error.'),
+ file : file
+ });
+ cb(false);
+ } else {
+ cb(true);
+ }
+});
+
+
+plupload.addFileFilter('prevent_duplicates', function(value, file, cb) {
+ if (value) {
+ var ii = this.files.length;
+ while (ii--) {
+ // Compare by name and size (size might be 0 or undefined, but still equivalent for both)
+ if (file.name === this.files[ii].name && file.size === this.files[ii].size) {
+ this.trigger('Error', {
+ code : plupload.FILE_DUPLICATE_ERROR,
+ message : plupload.translate('Duplicate file error.'),
+ file : file
+ });
+ cb(false);
+ return;
+ }
+ }
+ }
+ cb(true);
+});
+
+
+/**
+ at class Uploader
+ at constructor
+
+ at param {Object} settings For detailed information about each option check documentation.
+ @param {String|DOMElement} settings.browse_button id of the DOM element or DOM element itself to use as file dialog trigger.
+ @param {String} settings.url URL of the server-side upload handler.
+ @param {Number|String} [settings.chunk_size=0] Chunk size in bytes to slice the file into. Shorcuts with b, kb, mb, gb, tb suffixes also supported. `e.g. 204800 or "204800b" or "200kb"`. By default - disabled.
+ @param {Boolean} [settings.send_chunk_number=true] Whether to send chunks and chunk numbers, or total and offset bytes.
+ @param {String|DOMElement} [settings.container] id of the DOM element or DOM element itself that will be used to wrap uploader structures. Defaults to immediate parent of the `browse_button` element.
+ @param {String|DOMElement} [settings.drop_element] id of the DOM element or DOM element itself to use as a drop zone for Drag-n-Drop.
+ @param {String} [settings.file_data_name="file"] Name for the file field in Multipart formated message.
+ @param {Object} [settings.filters={}] Set of file type filters.
+ @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 {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} [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 {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.send_file_name=true] Whether to send file name as additional argument - 'name' (required for chunked uploads and some other cases where file name cannot be sent via normal ways).
+*/
+plupload.Uploader = function(options) {
+ /**
+ Fires when the current RunTime has been initialized.
+
+ @event Init
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ */
+
+ /**
+ Fires after the init event incase you need to perform actions there.
+
+ @event PostInit
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ */
+
+ /**
+ Fires when the option is changed in via uploader.setOption().
+
+ @event OptionChanged
+ @since 2.1
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ @param {String} name Name of the option that was changed
+ @param {Mixed} value New value for the specified option
+ @param {Mixed} oldValue Previous value of the option
+ */
+
+ /**
+ Fires when the silverlight/flash or other shim needs to move.
+
+ @event Refresh
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ */
+
+ /**
+ Fires when the overall state is being changed for the upload queue.
+
+ @event StateChanged
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ */
+
+ /**
+ Fires when browse_button is clicked and browse dialog shows.
+
+ @event Browse
+ @since 2.1.2
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ */
+
+ /**
+ Fires for every filtered file before it is added to the queue.
+
+ @event FileFiltered
+ @since 2.1
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ @param {plupload.File} file Another file that has to be added to the queue.
+ */
+
+ /**
+ Fires when the file queue is changed. In other words when files are added/removed to the files array of the uploader instance.
+
+ @event QueueChanged
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ */
+
+ /**
+ Fires after files were filtered and added to the queue.
+
+ @event FilesAdded
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ @param {Array} files Array of file objects that were added to queue by the user.
+ */
+
+ /**
+ Fires when file is removed from the queue.
+
+ @event FilesRemoved
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ @param {Array} files Array of files that got removed.
+ */
+
+ /**
+ Fires just before a file is uploaded. Can be used to cancel the upload for the specified file
+ by returning false from the handler.
+
+ @event BeforeUpload
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ @param {plupload.File} file File to be uploaded.
+ */
+
+ /**
+ Fires when a file is to be uploaded by the runtime.
+
+ @event UploadFile
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ @param {plupload.File} file File to be uploaded.
+ */
+
+ /**
+ Fires while a file is being uploaded. Use this event to update the current file upload progress.
+
+ @event UploadProgress
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ @param {plupload.File} file File that is currently being uploaded.
+ */
+
+ /**
+ Fires when file chunk is uploaded.
+
+ @event ChunkUploaded
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ @param {plupload.File} file File that the chunk was uploaded for.
+ @param {Object} result Object with response properties.
+ @param {Number} result.offset The amount of bytes the server has received so far, including this chunk.
+ @param {Number} result.total The size of the file.
+ @param {String} result.response The response body sent by the server.
+ @param {Number} result.status The HTTP status code sent by the server.
+ @param {String} result.responseHeaders All the response headers as a single string.
+ */
+
+ /**
+ Fires when a file is successfully uploaded.
+
+ @event FileUploaded
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ @param {plupload.File} file File that was uploaded.
+ @param {Object} result Object with response properties.
+ @param {String} result.response The response body sent by the server.
+ @param {Number} result.status The HTTP status code sent by the server.
+ @param {String} result.responseHeaders All the response headers as a single string.
+ */
+
+ /**
+ Fires when all files in a queue are uploaded.
+
+ @event UploadComplete
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ @param {Array} files Array of file objects that was added to queue/selected by the user.
+ */
+
+ /**
+ Fires when a error occurs.
+
+ @event Error
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ @param {Object} error Contains code, message and sometimes file and other details.
+ @param {Number} error.code The plupload error code.
+ @param {String} error.message Description of the error (uses i18n).
+ */
+
+ /**
+ Fires when destroy method is called.
+
+ @event Destroy
+ @param {plupload.Uploader} uploader Uploader instance sending the event.
+ */
+ var uid = plupload.guid()
+ , settings
+ , files = []
+ , preferred_caps = {}
+ , fileInputs = []
+ , fileDrops = []
+ , startTime
+ , total
+ , disabled = false
+ , xhr
+ ;
+
+
+ // Private methods
+ function uploadNext() {
+ var file, count = 0, i;
+
+ if (this.state == plupload.STARTED) {
+ // Find first QUEUED file
+ for (i = 0; i < files.length; i++) {
+ if (!file && files[i].status == plupload.QUEUED) {
+ file = files[i];
+ if (this.trigger("BeforeUpload", file)) {
+ file.status = plupload.UPLOADING;
+ this.trigger("UploadFile", file);
+ }
+ } else {
+ count++;
+ }
+ }
+
+ // All files are DONE or FAILED
+ if (count == files.length) {
+ if (this.state !== plupload.STOPPED) {
+ this.state = plupload.STOPPED;
+ this.trigger("StateChanged");
+ }
+ this.trigger("UploadComplete", files);
+ }
+ }
+ }
+
+
+ function calcFile(file) {
+ file.percent = file.size > 0 ? Math.ceil(file.loaded / file.size * 100) : 100;
+ calc();
+ }
+
+
+ function calc() {
+ var i, file;
+
+ // Reset stats
+ total.reset();
+
+ // Check status, size, loaded etc on all files
+ for (i = 0; i < files.length; i++) {
+ file = files[i];
+
+ if (file.size !== undef) {
+ // We calculate totals based on original file size
+ total.size += file.origSize;
+
+ // Since we cannot predict file size after resize, we do opposite and
+ // interpolate loaded amount to match magnitude of total
+ total.loaded += file.loaded * file.origSize / file.size;
+ } else {
+ total.size = undef;
+ }
+
+ if (file.status == plupload.DONE) {
+ total.uploaded++;
+ } else if (file.status == plupload.FAILED) {
+ total.failed++;
+ } else {
+ total.queued++;
+ }
+ }
+
+ // If we couldn't calculate a total file size then use the number of files to calc percent
+ if (total.size === undef) {
+ total.percent = files.length > 0 ? Math.ceil(total.uploaded / files.length * 100) : 0;
+ } else {
+ total.bytesPerSec = Math.ceil(total.loaded / ((+new Date() - startTime || 1) / 1000.0));
+ total.percent = total.size > 0 ? Math.ceil(total.loaded / total.size * 100) : 0;
+ }
+ }
+
+
+ function getRUID() {
+ var ctrl = fileInputs[0] || fileDrops[0];
+ if (ctrl) {
+ return ctrl.getRuntime().uid;
+ }
+ return false;
+ }
+
+
+ function runtimeCan(file, cap) {
+ if (file.ruid) {
+ var info = o.Runtime.getInfo(file.ruid);
+ if (info) {
+ return info.can(cap);
+ }
+ }
+ return false;
+ }
+
+
+ function bindEventListeners() {
+ this.bind('FilesAdded FilesRemoved', function(up) {
+ up.trigger('QueueChanged');
+ up.refresh();
+ });
+
+ this.bind('CancelUpload', onCancelUpload);
+
+ this.bind('BeforeUpload', onBeforeUpload);
+
+ this.bind('UploadFile', onUploadFile);
+
+ this.bind('UploadProgress', onUploadProgress);
+
+ this.bind('StateChanged', onStateChanged);
+
+ this.bind('QueueChanged', calc);
+
+ this.bind('Error', onError);
+
+ this.bind('FileUploaded', onFileUploaded);
+
+ this.bind('Destroy', onDestroy);
+ }
+
+
+ function initControls(settings, cb) {
+ var self = this, inited = 0, queue = [];
+
+ // common settings
+ var options = {
+ runtime_order: settings.runtimes,
+ required_caps: settings.required_features,
+ preferred_caps: preferred_caps,
+ swf_url: settings.flash_swf_url,
+ xap_url: settings.silverlight_xap_url
+ };
+
+ // add runtime specific options if any
+ plupload.each(settings.runtimes.split(/\s*,\s*/), function(runtime) {
+ if (settings[runtime]) {
+ options[runtime] = settings[runtime];
+ }
+ });
+
+ // initialize file pickers - there can be many
+ if (settings.browse_button) {
+ plupload.each(settings.browse_button, function(el) {
+ queue.push(function(cb) {
+ var fileInput = new o.FileInput(plupload.extend({}, options, {
+ accept: settings.filters.mime_types,
+ name: settings.file_data_name,
+ multiple: settings.multi_selection,
+ container: settings.container,
+ browse_button: el
+ }));
+
+ fileInput.onready = function() {
+ var info = o.Runtime.getInfo(this.ruid);
+
+ // for backward compatibility
+ o.extend(self.features, {
+ chunks: info.can('slice_blob'),
+ multipart: info.can('send_multipart'),
+ multi_selection: info.can('select_multiple')
+ });
+
+ inited++;
+ fileInputs.push(this);
+ cb();
+ };
+
+ fileInput.onchange = function() {
+ self.addFile(this.files);
+ };
+
+ fileInput.bind('mouseenter mouseleave mousedown mouseup', function(e) {
+ if (!disabled) {
+ if (settings.browse_button_hover) {
+ if ('mouseenter' === e.type) {
+ o.addClass(el, settings.browse_button_hover);
+ } else if ('mouseleave' === e.type) {
+ o.removeClass(el, settings.browse_button_hover);
+ }
+ }
+
+ if (settings.browse_button_active) {
+ if ('mousedown' === e.type) {
+ o.addClass(el, settings.browse_button_active);
+ } else if ('mouseup' === e.type) {
+ o.removeClass(el, settings.browse_button_active);
+ }
+ }
+ }
+ });
+
+ fileInput.bind('mousedown', function() {
+ self.trigger('Browse');
+ });
+
+ fileInput.bind('error runtimeerror', function() {
+ fileInput = null;
+ cb();
+ });
+
+ fileInput.init();
+ });
+ });
+ }
+
+ // initialize drop zones
+ if (settings.drop_element) {
+ plupload.each(settings.drop_element, function(el) {
+ queue.push(function(cb) {
+ var fileDrop = new o.FileDrop(plupload.extend({}, options, {
+ drop_zone: el
+ }));
+
+ fileDrop.onready = function() {
+ var info = o.Runtime.getInfo(this.ruid);
+
+ self.features.dragdrop = info.can('drag_and_drop'); // for backward compatibility
+
+ inited++;
+ fileDrops.push(this);
+ cb();
+ };
+
+ fileDrop.ondrop = function() {
+ self.addFile(this.files);
+ };
+
+ fileDrop.bind('error runtimeerror', function() {
+ fileDrop = null;
+ cb();
+ });
+
+ fileDrop.init();
+ });
+ });
+ }
+
+
+ o.inSeries(queue, function() {
+ if (typeof(cb) === 'function') {
+ cb(inited);
+ }
+ });
+ }
+
+
+ function resizeImage(blob, params, cb) {
+ var img = new o.Image();
+
+ try {
+ img.onload = function() {
+ // no manipulation required if...
+ if (params.width > this.width &&
+ params.height > this.height &&
+ params.quality === undef &&
+ params.preserve_headers &&
+ !params.crop
+ ) {
+ this.destroy();
+ return cb(blob);
+ }
+ // otherwise downsize
+ img.downsize(params.width, params.height, params.crop, params.preserve_headers);
+ };
+
+ img.onresize = function() {
+ cb(this.getAsBlob(blob.type, params.quality));
+ this.destroy();
+ };
+
+ img.onerror = function() {
+ cb(blob);
+ };
+
+ img.load(blob);
+ } catch(ex) {
+ cb(blob);
+ }
+ }
+
+
+ function setOption(option, value, init) {
+ var self = this, reinitRequired = false;
+
+ function _setOption(option, value, init) {
+ var oldValue = settings[option];
+
+ switch (option) {
+ case 'max_file_size':
+ if (option === 'max_file_size') {
+ settings.max_file_size = settings.filters.max_file_size = value;
+ }
+ break;
+
+ case 'chunk_size':
+ if (value = plupload.parseSize(value)) {
+ settings[option] = value;
+ settings.send_file_name = true;
+ }
+ break;
+
+ case 'multipart':
+ settings[option] = value;
+ if (!value) {
+ settings.send_file_name = true;
+ }
+ break;
+
+ case 'unique_names':
+ settings[option] = value;
+ if (value) {
+ settings.send_file_name = true;
+ }
+ break;
+
+ case 'filters':
+ // for sake of backward compatibility
+ if (plupload.typeOf(value) === 'array') {
+ value = {
+ mime_types: value
+ };
+ }
+
+ if (init) {
+ plupload.extend(settings.filters, value);
+ } else {
+ settings.filters = value;
+ }
+
+ // if file format filters are being updated, regenerate the matching expressions
+ if (value.mime_types) {
+ settings.filters.mime_types.regexp = (function(filters) {
+ var extensionsRegExp = [];
+
+ plupload.each(filters, function(filter) {
+ plupload.each(filter.extensions.split(/,/), function(ext) {
+ if (/^\s*\*\s*$/.test(ext)) {
+ extensionsRegExp.push('\\.*');
+ } else {
+ extensionsRegExp.push('\\.' + ext.replace(new RegExp('[' + ('/^$.*+?|()[]{}\\'.replace(/./g, '\\$&')) + ']', 'g'), '\\$&'));
+ }
+ });
+ });
+
+ return new RegExp('(' + extensionsRegExp.join('|') + ')$', 'i');
+ }(settings.filters.mime_types));
+ }
+ break;
+
+ case 'resize':
+ if (init) {
+ plupload.extend(settings.resize, value, {
+ enabled: true
+ });
+ } else {
+ settings.resize = value;
+ }
+ break;
+
+ case 'prevent_duplicates':
+ settings.prevent_duplicates = settings.filters.prevent_duplicates = !!value;
+ break;
+
+ case 'browse_button':
+ case 'drop_element':
+ value = plupload.get(value);
+
+ case 'container':
+ case 'runtimes':
+ case 'multi_selection':
+ case 'flash_swf_url':
+ case 'silverlight_xap_url':
+ settings[option] = value;
+ if (!init) {
+ reinitRequired = true;
+ }
+ break;
+
+ default:
+ settings[option] = value;
+ }
+
+ if (!init) {
+ self.trigger('OptionChanged', option, value, oldValue);
+ }
+ }
+
+ if (typeof(option) === 'object') {
+ plupload.each(option, function(value, option) {
+ _setOption(option, value, init);
+ });
+ } else {
+ _setOption(option, value, init);
+ }
+
+ if (init) {
+ // Normalize the list of required capabilities
+ settings.required_features = normalizeCaps(plupload.extend({}, settings));
+
+ // Come up with the list of capabilities that can affect default mode in a multi-mode runtimes
+ preferred_caps = normalizeCaps(plupload.extend({}, settings, {
+ required_features: true
+ }));
+ } else if (reinitRequired) {
+ self.trigger('Destroy');
+
+ initControls.call(self, settings, function(inited) {
+ if (inited) {
+ self.runtime = o.Runtime.getInfo(getRUID()).type;
+ self.trigger('Init', { runtime: self.runtime });
+ self.trigger('PostInit');
+ } else {
+ self.trigger('Error', {
+ code : plupload.INIT_ERROR,
+ message : plupload.translate('Init error.')
+ });
+ }
+ });
+ }
+ }
+
+
+ // Internal event handlers
+ function onBeforeUpload(up, file) {
+ // Generate unique target filenames
+ if (up.settings.unique_names) {
+ var matches = file.name.match(/\.([^.]+)$/), ext = "part";
+ if (matches) {
+ ext = matches[1];
+ }
+ file.target_name = file.id + '.' + ext;
+ }
+ }
+
+
+ function onUploadFile(up, file) {
+ var url = up.settings.url
+ , chunkSize = up.settings.chunk_size
+ , retries = up.settings.max_retries
+ , features = up.features
+ , offset = 0
+ , blob
+ ;
+
+ // make sure we start at a predictable offset
+ if (file.loaded) {
+ offset = file.loaded = chunkSize ? chunkSize * Math.floor(file.loaded / chunkSize) : 0;
+ }
+
+ function handleError() {
+ if (retries-- > 0) {
+ delay(uploadNextChunk, 1000);
+ } else {
+ file.loaded = offset; // reset all progress
+
+ up.trigger('Error', {
+ code : plupload.HTTP_ERROR,
+ message : plupload.translate('HTTP Error.'),
+ file : file,
+ response : xhr.responseText,
+ status : xhr.status,
+ responseHeaders: xhr.getAllResponseHeaders()
+ });
+ }
+ }
+
+ function uploadNextChunk() {
+ var chunkBlob, formData, args = {}, curChunkSize;
+
+ // make sure that file wasn't cancelled and upload is not stopped in general
+ if (file.status !== plupload.UPLOADING || up.state === plupload.STOPPED) {
+ return;
+ }
+
+ // send additional 'name' parameter only if required
+ if (up.settings.send_file_name) {
+ args.name = file.target_name || file.name;
+ }
+
+ if (chunkSize && features.chunks && blob.size > chunkSize) { // blob will be of type string if it was loaded in memory
+ curChunkSize = Math.min(chunkSize, blob.size - offset);
+ chunkBlob = blob.slice(offset, offset + curChunkSize);
+ } else {
+ curChunkSize = blob.size;
+ chunkBlob = blob;
+ }
+
+ // If chunking is enabled add corresponding args, no matter if file is bigger than chunk or smaller
+ if (chunkSize && features.chunks) {
+ // Setup query string arguments
+ if (up.settings.send_chunk_number) {
+ args.chunk = Math.ceil(offset / chunkSize);
+ args.chunks = Math.ceil(blob.size / chunkSize);
+ } else { // keep support for experimental chunk format, just in case
+ args.offset = offset;
+ args.total = blob.size;
+ }
+ }
+
+ xhr = new o.XMLHttpRequest();
+
+ // Do we have upload progress support
+ if (xhr.upload) {
+ xhr.upload.onprogress = function(e) {
+ file.loaded = Math.min(file.size, offset + e.loaded);
+ up.trigger('UploadProgress', file);
+ };
+ }
+
+ xhr.onload = function() {
+ // check if upload made itself through
+ if (xhr.status >= 400) {
+ handleError();
+ return;
+ }
+
+ retries = up.settings.max_retries; // reset the counter
+
+ // Handle chunk response
+ if (curChunkSize < blob.size) {
+ chunkBlob.destroy();
+
+ offset += curChunkSize;
+ file.loaded = Math.min(offset, blob.size);
+
+ up.trigger('ChunkUploaded', file, {
+ offset : file.loaded,
+ total : blob.size,
+ response : xhr.responseText,
+ status : xhr.status,
+ responseHeaders: xhr.getAllResponseHeaders()
+ });
+
+ // stock Android browser doesn't fire upload progress events, but in chunking mode we can fake them
+ if (o.Env.browser === 'Android Browser') {
+ // doesn't harm in general, but is not required anywhere else
+ up.trigger('UploadProgress', file);
+ }
+ } else {
+ file.loaded = file.size;
+ }
+
+ chunkBlob = formData = null; // Free memory
+
+ // Check if file is uploaded
+ if (!offset || offset >= blob.size) {
+ // If file was modified, destory the copy
+ if (file.size != file.origSize) {
+ blob.destroy();
+ blob = null;
+ }
+
+ up.trigger('UploadProgress', file);
+
+ file.status = plupload.DONE;
+
+ up.trigger('FileUploaded', file, {
+ response : xhr.responseText,
+ status : xhr.status,
+ responseHeaders: xhr.getAllResponseHeaders()
+ });
+ } else {
+ // Still chunks left
+ delay(uploadNextChunk, 1); // run detached, otherwise event handlers interfere
+ }
+ };
+
+ xhr.onerror = function() {
+ handleError();
+ };
+
+ xhr.onloadend = function() {
+ this.destroy();
+ xhr = null;
+ };
+
+ // Build multipart request
+ if (up.settings.multipart && features.multipart) {
+ xhr.open("post", url, true);
+
+ // Set custom headers
+ plupload.each(up.settings.headers, function(value, name) {
+ xhr.setRequestHeader(name, value);
+ });
+
+ formData = new o.FormData();
+
+ // Add multipart params
+ plupload.each(plupload.extend(args, up.settings.multipart_params), function(value, name) {
+ formData.append(name, value);
+ });
+
+ // Add file and send it
+ formData.append(up.settings.file_data_name, chunkBlob);
+ xhr.send(formData, {
+ runtime_order: up.settings.runtimes,
+ required_caps: up.settings.required_features,
+ preferred_caps: preferred_caps,
+ swf_url: up.settings.flash_swf_url,
+ xap_url: up.settings.silverlight_xap_url
+ });
+ } else {
+ // if no multipart, send as binary stream
+ url = plupload.buildUrl(up.settings.url, plupload.extend(args, up.settings.multipart_params));
+
+ xhr.open("post", url, true);
+
+ xhr.setRequestHeader('Content-Type', 'application/octet-stream'); // Binary stream header
+
+ // Set custom headers
+ plupload.each(up.settings.headers, function(value, name) {
+ xhr.setRequestHeader(name, value);
+ });
+
+ xhr.send(chunkBlob, {
+ runtime_order: up.settings.runtimes,
+ required_caps: up.settings.required_features,
+ preferred_caps: preferred_caps,
+ swf_url: up.settings.flash_swf_url,
+ xap_url: up.settings.silverlight_xap_url
+ });
+ }
+ }
+
+ blob = file.getSource();
+
+ // Start uploading chunks
+ if (up.settings.resize.enabled && runtimeCan(blob, 'send_binary_string') && !!~o.inArray(blob.type, ['image/jpeg', 'image/png'])) {
+ // Resize if required
+ resizeImage.call(this, blob, up.settings.resize, function(resizedBlob) {
+ blob = resizedBlob;
+ file.size = resizedBlob.size;
+ uploadNextChunk();
+ });
+ } else {
+ uploadNextChunk();
+ }
+ }
+
+
+ function onUploadProgress(up, file) {
+ calcFile(file);
+ }
+
+
+ function onStateChanged(up) {
+ if (up.state == plupload.STARTED) {
+ // Get start time to calculate bps
+ startTime = (+new Date());
+ } else if (up.state == plupload.STOPPED) {
+ // Reset currently uploading files
+ for (var i = up.files.length - 1; i >= 0; i--) {
+ if (up.files[i].status == plupload.UPLOADING) {
+ up.files[i].status = plupload.QUEUED;
+ calc();
+ }
+ }
+ }
+ }
+
+
+ function onCancelUpload() {
+ if (xhr) {
+ xhr.abort();
+ }
+ }
+
+
+ function onFileUploaded(up) {
+ calc();
+
+ // Upload next file but detach it from the error event
+ // since other custom listeners might want to stop the queue
+ delay(function() {
+ uploadNext.call(up);
+ }, 1);
+ }
+
+
+ function onError(up, err) {
+ if (err.code === plupload.INIT_ERROR) {
+ up.destroy();
+ }
+ // Set failed status if an error occured on a file
+ else if (err.code === plupload.HTTP_ERROR) {
+ err.file.status = plupload.FAILED;
+ calcFile(err.file);
+
+ // Upload next file but detach it from the error event
+ // since other custom listeners might want to stop the queue
+ if (up.state == plupload.STARTED) { // upload in progress
+ up.trigger('CancelUpload');
+ delay(function() {
+ uploadNext.call(up);
+ }, 1);
+ }
+ }
+ }
+
+
+ function onDestroy(up) {
+ up.stop();
+
+ // Purge the queue
+ plupload.each(files, function(file) {
+ file.destroy();
+ });
+ files = [];
+
+ if (fileInputs.length) {
+ plupload.each(fileInputs, function(fileInput) {
+ fileInput.destroy();
+ });
+ fileInputs = [];
+ }
+
+ if (fileDrops.length) {
+ plupload.each(fileDrops, function(fileDrop) {
+ fileDrop.destroy();
+ });
+ fileDrops = [];
+ }
+
+ preferred_caps = {};
+ disabled = false;
+ startTime = xhr = null;
+ total.reset();
+ }
+
+
+ // Default settings
+ settings = {
+ runtimes: o.Runtime.order,
+ max_retries: 0,
+ chunk_size: 0,
+ multipart: true,
+ multi_selection: true,
+ file_data_name: 'file',
+ flash_swf_url: 'js/Moxie.swf',
+ silverlight_xap_url: 'js/Moxie.xap',
+ filters: {
+ mime_types: [],
+ prevent_duplicates: false,
+ max_file_size: 0
+ },
+ resize: {
+ enabled: false,
+ preserve_headers: true,
+ crop: false
+ },
+ send_file_name: true,
+ send_chunk_number: true
+ };
+
+
+ setOption.call(this, options, null, true);
+
+ // Inital total state
+ total = new plupload.QueueProgress();
+
+ // Add public methods
+ plupload.extend(this, {
+
+ /**
+ * Unique id for the Uploader instance.
+ *
+ * @property id
+ * @type String
+ */
+ id : uid,
+ uid : uid, // mOxie uses this to differentiate between event targets
+
+ /**
+ * Current state of the total uploading progress. This one can either be plupload.STARTED or plupload.STOPPED.
+ * These states are controlled by the stop/start methods. The default value is STOPPED.
+ *
+ * @property state
+ * @type Number
+ */
+ state : plupload.STOPPED,
+
+ /**
+ * Map of features that are available for the uploader runtime. Features will be filled
+ * before the init event is called, these features can then be used to alter the UI for the end user.
+ * Some of the current features that might be in this map is: dragdrop, chunks, jpgresize, pngresize.
+ *
+ * @property features
+ * @type Object
+ */
+ features : {},
+
+ /**
+ * Current runtime name.
+ *
+ * @property runtime
+ * @type String
+ */
+ runtime : null,
+
+ /**
+ * Current upload queue, an array of File instances.
+ *
+ * @property files
+ * @type Array
+ * @see plupload.File
+ */
+ files : files,
+
+ /**
+ * Object with name/value settings.
+ *
+ * @property settings
+ * @type Object
+ */
+ settings : settings,
+
+ /**
+ * Total progess information. How many files has been uploaded, total percent etc.
+ *
+ * @property total
+ * @type plupload.QueueProgress
+ */
+ total : total,
+
+
+ /**
+ * Initializes the Uploader instance and adds internal event listeners.
+ *
+ * @method init
+ */
+ init : function() {
+ var self = this;
+
+ if (typeof(settings.preinit) == "function") {
+ settings.preinit(self);
+ } else {
+ plupload.each(settings.preinit, function(func, name) {
+ self.bind(name, func);
+ });
+ }
+
+ bindEventListeners.call(this);
+
+ // Check for required options
+ if (!settings.browse_button || !settings.url) {
+ this.trigger('Error', {
+ code : plupload.INIT_ERROR,
+ message : plupload.translate('Init error.')
+ });
+ return;
+ }
+
+ initControls.call(this, settings, function(inited) {
+ if (typeof(settings.init) == "function") {
+ settings.init(self);
+ } else {
+ plupload.each(settings.init, function(func, name) {
+ self.bind(name, func);
+ });
+ }
+
+ if (inited) {
+ self.runtime = o.Runtime.getInfo(getRUID()).type;
+ self.trigger('Init', { runtime: self.runtime });
+ self.trigger('PostInit');
+ } else {
+ self.trigger('Error', {
+ code : plupload.INIT_ERROR,
+ message : plupload.translate('Init error.')
+ });
+ }
+ });
+ },
+
+ /**
+ * Set the value for the specified option(s).
+ *
+ * @method setOption
+ * @since 2.1
+ * @param {String|Object} option Name of the option to change or the set of key/value pairs
+ * @param {Mixed} [value] Value for the option (is ignored, if first argument is object)
+ */
+ setOption: function(option, value) {
+ setOption.call(this, option, value, !this.runtime); // until runtime not set we do not need to reinitialize
+ },
+
+ /**
+ * Get the value for the specified option or the whole configuration, if not specified.
+ *
+ * @method getOption
+ * @since 2.1
+ * @param {String} [option] Name of the option to get
+ * @return {Mixed} Value for the option or the whole set
+ */
+ getOption: function(option) {
+ if (!option) {
+ return settings;
+ }
+ return settings[option];
+ },
+
+ /**
+ * Refreshes the upload instance by dispatching out a refresh event to all runtimes.
+ * This would for example reposition flash/silverlight shims on the page.
+ *
+ * @method refresh
+ */
+ refresh : function() {
+ if (fileInputs.length) {
+ plupload.each(fileInputs, function(fileInput) {
+ fileInput.trigger('Refresh');
+ });
+ }
+ this.trigger('Refresh');
+ },
+
+ /**
+ * Starts uploading the queued files.
+ *
+ * @method start
+ */
+ start : function() {
+ if (this.state != plupload.STARTED) {
+ this.state = plupload.STARTED;
+ this.trigger('StateChanged');
+
+ uploadNext.call(this);
+ }
+ },
+
+ /**
+ * Stops the upload of the queued files.
+ *
+ * @method stop
+ */
+ stop : function() {
+ if (this.state != plupload.STOPPED) {
+ this.state = plupload.STOPPED;
+ this.trigger('StateChanged');
+ this.trigger('CancelUpload');
+ }
+ },
+
+
+ /**
+ * Disables/enables browse button on request.
+ *
+ * @method disableBrowse
+ * @param {Boolean} disable Whether to disable or enable (default: true)
+ */
+ disableBrowse : function() {
+ disabled = arguments[0] !== undef ? arguments[0] : true;
+
+ if (fileInputs.length) {
+ plupload.each(fileInputs, function(fileInput) {
+ fileInput.disable(disabled);
+ });
+ }
+
+ this.trigger('DisableBrowse', disabled);
+ },
+
+ /**
+ * Returns the specified file object by id.
+ *
+ * @method getFile
+ * @param {String} id File id to look for.
+ * @return {plupload.File} File object or undefined if it wasn't found;
+ */
+ getFile : function(id) {
+ var i;
+ for (i = files.length - 1; i >= 0; i--) {
+ if (files[i].id === id) {
+ return files[i];
+ }
+ }
+ },
+
+ /**
+ * Adds file to the queue programmatically. Can be native file, instance of Plupload.File,
+ * instance of mOxie.File, input[type="file"] element, or array of these. Fires FilesAdded,
+ * if any files were added to the queue. Otherwise nothing happens.
+ *
+ * @method addFile
+ * @since 2.0
+ * @param {plupload.File|mOxie.File|File|Node|Array} file File or files to add to the queue.
+ * @param {String} [fileName] If specified, will be used as a name for the file
+ */
+ addFile : function(file, fileName) {
+ var self = this
+ , queue = []
+ , filesAdded = []
+ , ruid
+ ;
+
+ function filterFile(file, cb) {
+ var queue = [];
+ o.each(self.settings.filters, function(rule, name) {
+ if (fileFilters[name]) {
+ queue.push(function(cb) {
+ fileFilters[name].call(self, rule, file, function(res) {
+ cb(!res);
+ });
+ });
+ }
+ });
+ o.inSeries(queue, cb);
+ }
+
+ /**
+ * @method resolveFile
+ * @private
+ * @param {o.File|o.Blob|plupload.File|File|Blob|input[type="file"]} file
+ */
+ function resolveFile(file) {
+ var type = o.typeOf(file);
+
+ // o.File
+ if (file instanceof o.File) {
+ if (!file.ruid && !file.isDetached()) {
+ if (!ruid) { // weird case
+ return false;
+ }
+ file.ruid = ruid;
+ file.connectRuntime(ruid);
+ }
+ resolveFile(new plupload.File(file));
+ }
+ // o.Blob
+ else if (file instanceof o.Blob) {
+ resolveFile(file.getSource());
+ file.destroy();
+ }
+ // plupload.File - final step for other branches
+ else if (file instanceof plupload.File) {
+ if (fileName) {
+ file.name = fileName;
+ }
+
+ queue.push(function(cb) {
+ // run through the internal and user-defined filters, if any
+ filterFile(file, function(err) {
+ if (!err) {
+ // make files available for the filters by updating the main queue directly
+ files.push(file);
+ // collect the files that will be passed to FilesAdded event
+ filesAdded.push(file);
+
+ self.trigger("FileFiltered", file);
+ }
+ delay(cb, 1); // do not build up recursions or eventually we might hit the limits
+ });
+ });
+ }
+ // native File or blob
+ else if (o.inArray(type, ['file', 'blob']) !== -1) {
+ resolveFile(new o.File(null, file));
+ }
+ // input[type="file"]
+ else if (type === 'node' && o.typeOf(file.files) === 'filelist') {
+ // if we are dealing with input[type="file"]
+ o.each(file.files, resolveFile);
+ }
+ // mixed array of any supported types (see above)
+ else if (type === 'array') {
+ fileName = null; // should never happen, but unset anyway to avoid funny situations
+ o.each(file, resolveFile);
+ }
+ }
+
+ ruid = getRUID();
+
+ resolveFile(file);
+
+ if (queue.length) {
+ o.inSeries(queue, function() {
+ // if any files left after filtration, trigger FilesAdded
+ if (filesAdded.length) {
+ self.trigger("FilesAdded", filesAdded);
+ }
+ });
+ }
+ },
+
+ /**
+ * Removes a specific file.
+ *
+ * @method removeFile
+ * @param {plupload.File|String} file File to remove from queue.
+ */
+ removeFile : function(file) {
+ var id = typeof(file) === 'string' ? file : file.id;
+
+ for (var i = files.length - 1; i >= 0; i--) {
+ if (files[i].id === id) {
+ return this.splice(i, 1)[0];
+ }
+ }
+ },
+
+ /**
+ * Removes part of the queue and returns the files removed. This will also trigger the FilesRemoved and QueueChanged events.
+ *
+ * @method splice
+ * @param {Number} start (Optional) Start index to remove from.
+ * @param {Number} length (Optional) Lengh of items to remove.
+ * @return {Array} Array of files that was removed.
+ */
+ splice : function(start, length) {
+ // Splice and trigger events
+ var removed = files.splice(start === undef ? 0 : start, length === undef ? files.length : length);
+
+ // if upload is in progress we need to stop it and restart after files are removed
+ var restartRequired = false;
+ if (this.state == plupload.STARTED) { // upload in progress
+ plupload.each(removed, function(file) {
+ if (file.status === plupload.UPLOADING) {
+ restartRequired = true; // do not restart, unless file that is being removed is uploading
+ return false;
+ }
+ });
+
+ if (restartRequired) {
+ this.stop();
+ }
+ }
+
+ this.trigger("FilesRemoved", removed);
+
+ // Dispose any resources allocated by those files
+ plupload.each(removed, function(file) {
+ file.destroy();
+ });
+
+ if (restartRequired) {
+ this.start();
+ }
+
+ return removed;
+ },
+
+ /**
+ Dispatches the specified event name and its arguments to all listeners.
+
+ @method trigger
+ @param {String} name Event name to fire.
+ @param {Object..} Multiple arguments to pass along to the listener functions.
+ */
+
+ // override the parent method to match Plupload-like event logic
+ dispatchEvent: function(type) {
+ var list, args, result;
+
+ type = type.toLowerCase();
+
+ list = this.hasEventListener(type);
+
+ if (list) {
+ // sort event list by prority
+ list.sort(function(a, b) { return b.priority - a.priority; });
+
+ // first argument should be current plupload.Uploader instance
+ args = [].slice.call(arguments);
+ args.shift();
+ args.unshift(this);
+
+ for (var i = 0; i < list.length; i++) {
+ // Fire event, break chain if false is returned
+ if (list[i].fn.apply(list[i].scope, args) === false) {
+ return false;
+ }
+ }
+ }
+ return true;
+ },
+
+ /**
+ Check whether uploader has any listeners to the specified event.
+
+ @method hasEventListener
+ @param {String} name Event name to check for.
+ */
+
+
+ /**
+ Adds an event listener by name.
+
+ @method bind
+ @param {String} name Event name to listen for.
+ @param {function} fn Function to call ones the event gets fired.
+ @param {Object} [scope] Optional scope to execute the specified function in.
+ @param {Number} [priority=0] Priority of the event handler - handlers with higher priorities will be called first
+ */
+ bind: function(name, fn, scope, priority) {
+ // adapt moxie EventTarget style to Plupload-like
+ plupload.Uploader.prototype.bind.call(this, name, fn, priority, scope);
+ },
+
+ /**
+ Removes the specified event listener.
+
+ @method unbind
+ @param {String} name Name of event to remove.
+ @param {function} fn Function to remove from listener.
+ */
+
+ /**
+ Removes all event listeners.
+
+ @method unbindAll
+ */
+
+
+ /**
+ * Destroys Plupload instance and cleans after itself.
+ *
+ * @method destroy
+ */
+ destroy : function() {
+ this.trigger('Destroy');
+ settings = total = null; // purge these exclusively
+ this.unbindAll();
+ }
+ });
+};
+
+plupload.Uploader.prototype = o.EventTarget.instance;
+
+/**
+ * Constructs a new file instance.
+ *
+ * @class File
+ * @constructor
+ *
+ * @param {Object} file Object containing file properties
+ * @param {String} file.name Name of the file.
+ * @param {Number} file.size File size.
+ */
+plupload.File = (function() {
+ var filepool = {};
+
+ function PluploadFile(file) {
+
+ plupload.extend(this, {
+
+ /**
+ * File id this is a globally unique id for the specific file.
+ *
+ * @property id
+ * @type String
+ */
+ id: plupload.guid(),
+
+ /**
+ * File name for example "myfile.gif".
+ *
+ * @property name
+ * @type String
+ */
+ name: file.name || file.fileName,
+
+ /**
+ * File type, `e.g image/jpeg`
+ *
+ * @property type
+ * @type String
+ */
+ type: file.type || '',
+
+ /**
+ * File size in bytes (may change after client-side manupilation).
+ *
+ * @property size
+ * @type Number
+ */
+ size: file.size || file.fileSize,
+
+ /**
+ * Original file size in bytes.
+ *
+ * @property origSize
+ * @type Number
+ */
+ origSize: file.size || file.fileSize,
+
+ /**
+ * Number of bytes uploaded of the files total size.
+ *
+ * @property loaded
+ * @type Number
+ */
+ loaded: 0,
+
+ /**
+ * Number of percentage uploaded of the file.
+ *
+ * @property percent
+ * @type Number
+ */
+ percent: 0,
+
+ /**
+ * Status constant matching the plupload states QUEUED, UPLOADING, FAILED, DONE.
+ *
+ * @property status
+ * @type Number
+ * @see plupload
+ */
+ status: plupload.QUEUED,
+
+ /**
+ * Date of last modification.
+ *
+ * @property lastModifiedDate
+ * @type {String}
+ */
+ lastModifiedDate: file.lastModifiedDate || (new Date()).toLocaleString(), // Thu Aug 23 2012 19:40:00 GMT+0400 (GET)
+
+ /**
+ * Returns native window.File object, when it's available.
+ *
+ * @method getNative
+ * @return {window.File} or null, if plupload.File is of different origin
+ */
+ getNative: function() {
+ var file = this.getSource().getSource();
+ return o.inArray(o.typeOf(file), ['blob', 'file']) !== -1 ? file : null;
+ },
+
+ /**
+ * Returns mOxie.File - unified wrapper object that can be used across runtimes.
+ *
+ * @method getSource
+ * @return {mOxie.File} or null
+ */
+ getSource: function() {
+ if (!filepool[this.id]) {
+ return null;
+ }
+ return filepool[this.id];
+ },
+
+ /**
+ * Destroys plupload.File object.
+ *
+ * @method destroy
+ */
+ destroy: function() {
+ var src = this.getSource();
+ if (src) {
+ src.destroy();
+ delete filepool[this.id];
+ }
+ }
+ });
+
+ filepool[this.id] = file;
+ }
+
+ return PluploadFile;
+}());
+
+
+/**
+ * Constructs a queue progress.
+ *
+ * @class QueueProgress
+ * @constructor
+ */
+ plupload.QueueProgress = function() {
+ var self = this; // Setup alias for self to reduce code size when it's compressed
+
+ /**
+ * Total queue file size.
+ *
+ * @property size
+ * @type Number
+ */
+ self.size = 0;
+
+ /**
+ * Total bytes uploaded.
+ *
+ * @property loaded
+ * @type Number
+ */
+ self.loaded = 0;
+
+ /**
+ * Number of files uploaded.
+ *
+ * @property uploaded
+ * @type Number
+ */
+ self.uploaded = 0;
+
+ /**
+ * Number of files failed to upload.
+ *
+ * @property failed
+ * @type Number
+ */
+ self.failed = 0;
+
+ /**
+ * Number of files yet to be uploaded.
+ *
+ * @property queued
+ * @type Number
+ */
+ self.queued = 0;
+
+ /**
+ * Total percent of the uploaded bytes.
+ *
+ * @property percent
+ * @type Number
+ */
+ self.percent = 0;
+
+ /**
+ * Bytes uploaded per second.
+ *
+ * @property bytesPerSec
+ * @type Number
+ */
+ self.bytesPerSec = 0;
+
+ /**
+ * Resets the progress to its initial values.
+ *
+ * @method reset
+ */
+ self.reset = function() {
+ self.size = self.loaded = self.uploaded = self.failed = self.queued = self.percent = self.bytesPerSec = 0;
+ };
+};
+
+window.plupload = plupload;
+
+}(window, mOxie));
diff --git a/license.txt b/license.txt
new file mode 100644
index 0000000..d511905
--- /dev/null
+++ b/license.txt
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..8fa2238
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,147 @@
+# Plupload
+
+Plupload is a cross-browser multi-runtime file uploading API. Basically, a set of tools that will help you to
+build a reliable and visually appealing file uploader in minutes.
+
+Historically, Plupload comes from a dark and hostile age of no HTML5, hence all the alternative fallbacks,
+like Flash, Silverlight and Java (still in development). It is meant to provide an API, that
+will work anywhere and in any case, in one way or another. While having very solid fallbacks, Plupload
+is built with the future of HTML5 in mind.
+
+### Table of Contents
+* [Backstory](https://github.com/moxiecode/plupload/blob/master/readme.md#backstory)
+* [Structure](https://github.com/moxiecode/plupload/blob/master/readme.md#structure)
+ * [File API and XHR L2 pollyfills](https://github.com/moxiecode/moxie/blob/master/README.md)
+ * [Plupload API](https://github.com/moxiecode/plupload/wiki/API)
+ * [UI Widget](https://github.com/moxiecode/plupload/wiki/UI.Plupload)
+ * [Queue Widget](https://github.com/moxiecode/plupload/wiki/pluploadQueue)
+* [Demos](https://github.com/jayarjo/plupload-demos/blob/master/README.md)
+* [Building Instructions](https://github.com/moxiecode/plupload/blob/master/readme.md#build)
+* [Getting Started](https://github.com/moxiecode/plupload/wiki/Getting-Started)
+ * [Options](https://github.com/moxiecode/plupload/wiki/Options)
+ * [Events](https://github.com/moxiecode/plupload/wiki/Uploader#wiki-events)
+ * [Methods](https://github.com/moxiecode/plupload/wiki/Uploader#wiki-methods)
+ * [Plupload in Your Language](https://github.com/moxiecode/plupload/wiki/Plupload-in-Your-Language)
+ * [File Filters](https://github.com/moxiecode/plupload/wiki/File-Filters)
+ * [Image Resizing on Client-Side](https://github.com/moxiecode/plupload/wiki/Image-Resizing-on-Client-Side)
+ * [Chunking](https://github.com/moxiecode/plupload/wiki/Chunking)
+ * [Upload to Amazon S3](https://github.com/moxiecode/plupload/wiki/Upload-to-Amazon-S3)
+* [FAQ](https://github.com/moxiecode/plupload/wiki/Frequently-Asked-Questions)
+* [Support](https://github.com/moxiecode/plupload/blob/master/readme.md##support)
+ * [Create a Fiddle](https://github.com/moxiecode/plupload/wiki/Create-a-Fiddle)
+* [Contributing](https://github.com/moxiecode/plupload/blob/master/readme.md#contribute)
+* [License](https://github.com/moxiecode/plupload/blob/master/readme.md#license)
+* [Contact Us](http://www.moxiecode.com/contact.php)
+
+<a name="backstory" />
+### Backstory
+
+Plupload started in a time when uploading a file in a responsive and customizable manner was a real pain.
+Internally, browsers only had the `input[type="file"]` element. It was ugly and clunky at the same time.
+One couldn't even change it's visuals, without hiding it and coding another one on top of it from scratch.
+And then there was no progress indication for the upload process... Sounds pretty crazy today.
+
+It was very logical for developers to look for alternatives and writing their own implementations, using
+Flash and Java, in order to somehow extend limited browser capabilities. And so did we, in our search for
+a reliable and flexible file uploader for
+our [TinyMCE](http://www.tinymce.com/index.php)'s
+[MCImageManager](http://www.tinymce.com/enterprise/mcimagemanager.php).
+
+Quickly enough though, Plupload grew big. It easily split into a standalone project.
+With major *version 2.0* it underwent another huge reconstruction, basically
+[from the ground up](http://blog.moxiecode.com/2012/11/28/first-public-beta-plupload-2/),
+as all the low-level runtime logic has been extracted into separate [File API](http://www.w3.org/TR/FileAPI/)
+and [XHR L2](http://www.w3.org/TR/XMLHttpRequest/) pollyfills (currently known under combined name of [mOxie](https://github.com/moxiecode/moxie)),
+giving Plupload a chance to evolve further.
+
+<a name="structure" />
+### Structure
+
+Currently, Plupload may be considered as consisting of three parts: low-level pollyfills,
+Plupload API and Widgets (UI and Queue). Initially, Widgets were meant only to serve as examples
+of the API, but quickly formed into fully-functional API implementations that now come bundled with
+the Plupload API. This has been a source for multiple misconceptions about the API as Widgets were
+easily mistaken for the Plupload itself. They are only implementations, such as any of you can
+build by yourself out of the API.
+
+* [Low-level pollyfills (mOxie)](https://github.com/moxiecode/moxie) - have their own [code base](https://github.com/moxiecode/moxie) and [documentation](https://github.com/moxiecode/moxie/wiki) on GitHub.
+* [Plupload API](https://github.com/moxiecode/plupload/wiki/API)
+* [UI Widget](https://github.com/moxiecode/plupload/wiki/UI.Plupload)
+* [Queue Widget](https://github.com/moxiecode/plupload/wiki/pluploadQueue)
+
+<a name="build" />
+### Building instructions
+
+Plupload depends on File API and XHR2 L2 pollyfills that currently have their
+[own repository](https://github.com/moxiecode/moxie) on GitHub. However, in most cases you shouldn't
+care as we bundle the latest build of mOxie, including full and minified JavaScript source and
+pre-compiled `SWF` and `XAP` components, with [every release](https://github.com/moxiecode/plupload/releases). You can find everything you may need under `js/` folder.
+
+There are cases where you might need a custom build, for example free of unnecessary runtimes, half the
+original size, etc. The difficult part of this task comes from mOxie and its set of additional runtimes
+that require special tools on your workstation in order to compile.
+Consider [build instructions for mOxie](https://github.com/moxiecode/moxie#build-instructions) -
+everything applies to Plupload as well.
+
+First of all, if you want to build custom Plupload packages you will require [Node.js](http://nodejs.org/),
+as this is our build environment of choice. Node.js binaries (as well as Source)
+[are available](http://nodejs.org/download/) for all major operating systems.
+
+Plupload includes _mOxie_ as a submodule, it also depends on some other repositories for building up it's dev
+environment - to avoid necessity of downloading them one by one, we recommended you to simply clone Plupload
+with [git](http://git-scm.com/) recursively (you will require git installed on your system for this operation
+to succeed):
+
+```
+git clone --recursive https://github.com/moxiecode/plupload.git
+```
+
+And finalize the preparation stage with: `npm install` - this will install all additional modules, including those
+required by dev and test environments. In case you would rather keep it minimal, add a `--production` flag.
+
+*Note:* Currently, for an unknown reason, locally installed Node.js modules on Windows, may not be automatically
+added to the system PATH. So, if `jake` commands below are not recognized you will need to add them manually:
+
+```
+set PATH=%PATH%;%CD%\node_modules\.bin\
+```
+
+<a name="support" />
+### Support
+
+We are actively standing behind the Plupload and now that we are done with major rewrites and refactoring,
+the only real goal that we have ahead is making it as reliable and bulletproof as possible. We are open to
+all the suggestions and feature requests. We ask you to file bug reports if you encounter any. We may not
+react to them instantly, but we constantly bear them in my mind as we extend the code base.
+
+In addition to dedicated support for those who dare to buy our OEM licenses, we got
+[discussion boards](http://www.plupload.com/punbb/index.php), which is like an enormous FAQ,
+covering every possible application case. Of course, you are welcome to file a bug report or feature request,
+here on [GitHub](https://github.com/moxiecode/plupload/issues).
+
+Sometimes it is easier to notice the problem when bug report is accompained by the actual code. Consider providing
+[a Plupload fiddle](https://github.com/moxiecode/plupload/wiki/Create-a-Fiddle) for the troublesome code.
+
+<a name="contribute" />
+### Contributing
+
+We are open to suggestions and code revisions, however there are some rules and limitations that you might
+want to consider first.
+
+* Code that you contribute will automatically be licensed under the LGPL, but will not be limited to LGPL.
+* Although all contributors will get the credit for their work, copyright notices will be changed to [Moxiecode Systems AB](http://www.moxiecode.com/).
+* Third party code will be reviewed, tested and possibly modified before being released.
+
+These basic rules help us earn a living and ensure that code remains Open Source and compatible with LGPL license. All contributions will be added to the changelog and appear in every release and on the site.
+
+An easy place to start is to [translate Plupload to your language](https://github.com/moxiecode/plupload/wiki/Plupload-in-Your-Language#contribute).
+
+You can read more about how to contribute at: [http://www.plupload.com/contributing](http://www.plupload.com/contributing)
+
+<a name="license" />
+### License
+
+Copyright 2013, [Moxiecode Systems AB](http://www.moxiecode.com/)
+Released under [GPLv2 License](https://github.com/moxiecode/plupload/blob/master/license.txt).
+
+We also provide [commercial license](http://www.plupload.com/commercial.php).
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/plupload.js.git
More information about the Pkg-javascript-commits
mailing list