diff --git a/public/javascripts/plupload/changelog.txt b/public/javascripts/plupload/changelog.txt new file mode 100644 index 0000000..1b7953b --- /dev/null +++ b/public/javascripts/plupload/changelog.txt @@ -0,0 +1,128 @@ +Version 1.4.2 (2011-02-20) + Added Brazilian Portuguese, German, Russian and Spanish translations. + Added support for file_data_name option to SilverLight runtime. + Added support for better quality image resizing to Flash runtime. + Added support for properly handling images with dimensions up to 8191x8191 pixels to Flash runtime. + Added 'updatelist' event to UI Widget, which will be triggered every time file list will get redrawn. + Added support for dynamically changing options to UI Widget. + Fixed HTML4 runtime bug, when UploadFile handler was attached twice. + Fixed HTML5 to use FileReader.readAsBinaryString() instead of File.getAsBinary() on newer WebKit browsers (like Chrome 9). + Fixed Flash runtime from sending duplicate Filename param, when using FileReference.upload(). + Updated S3 example to illustrate support for a proper progress indication. +Version 1.4.1 (2011-02-01) + Added an example on how to use Plupload with Amazon S3 written in PHP but can easily be ported to other languages. + Fixed bug where hidden input elements wasn't created when the multiple_queues option wasn't used. + Fixed bug where FF4 would produce an exception about missing BlobBuilder. +Version 1.4.0 (2011-01-26) + Added removeEvent and removeAllEvents methods and modified addEvent accordingly, in order to support dynamic unload. + Added unbindAll method. + Added UploadComplete event, which fires when internal iterator reaches the end of the queue. + Added public destroy method to plupload object, new event - Destroy, and corresponding handlers to all runtimes. + Added Czech, Italian, French, Dutch translations. + Added support for translatable error messages. + Added two new options: browse_button_hover and browse_button_active, in order to support browse_button interactivity. + Added support for 'multi_selection: false' to Silverlight runtime. + Added support for video/mp4, video/x-m4v and audio/mp4 MIME Types. + Added artificial sendAsBinary method to XMLHttpRequest.prototype for browsers that have support for BlobBuilder and typed arrays. + Added version tracking variable into plupload object and version comment to the header of every file. + Fixed measurements of browse_button element in order to size and position input[type=file] element to fit it fully. + Fixed Flash runtime behavior for multiple_select=false and other simpleUpload usage cases: basically new FileReference has to be created for every select dialog. + Fixed browser sniffer to match only Safari, for fakeSafariDragDrop (seems like Safari on Mac doesn't require it either). + Fixed so that ExternalInterface escapes strings properly, before passing them to JS. + Fixed eventual reinitialization of flash/silverlight runtimes, especially for cases when object wrapper needed to be programmatically hidden and then shown again. + Fixed so that Plupload will now ignore files with duplicate names when adding to the queue, in one set. Mainly introduced to work around Safari on Windows bug (https://bugs.webkit.org/show_bug.cgi?id=37957). + Fixed bug, when final UploadProgress was firing after FileUploaded for Flash simpleUpload. + Fixed bug where upload would fail if an error was produced inside the FilesAdded event. + Fixed bug in Flash runtime when it used a wrong size when resizing, but not chunking. + Fixed bug in Silverlight runtime that would keep sending 0 byte packages when a picture was chunked before resized. + Disabled blur filter (is going to be replaced with some bilinear resampling in next release). + Completely revised UI Widget, to be more jQuery UI oriented. Optionally depends on UI Button, UI Sortable, UI ProgressBar. +Version 1.3.0 (2010-11-24) + Added new jQuery UI widget that supports jQuery UI themes. + Added new multiple_queues option that enables you to upload multiple times in the queue widgets. + Added support for crossdomain loading of the XAP and SWF files and crossdomain upload. + Added new multiple_queues option that enables you to upload multiple times in the queue widgets. + Added support for crossdomain loading of the XAP and SWF files and crossdomain upload. + Added preinit/init options to to ease up the binding of custom events to queueWidget and the Uploader class. + Added drag/drop support for Safari until they fix the broken drag/drop support on Windows. + Added events example file that show how to bind all events and display event specific data. + Added support for retaining Exif data on images when they where resized using the HTML5 runtime. + Fixed logic issue with the upload.php example file. Chunking wasn't working correctly. + Fixed issue with HTML4 not handling the form encoding correctly on older IE versions. Patch contributed by jinxdone. + Fixed so the HTML4 runtime only submits the defined multipart_params arguments. + Fixes issue where it wasn't possible to dynamically override url or mutlipart_params for the HTML4 runtime. + Fixed so all runtimes pass the name, chunk and chunks parameters as multipart parameters instead of querystring parameters. + Fixed so files are read using the newer FileReader class if it's available if not it tries the older getAsXXX on Gecko. + Fixed bug where IE 9 beta 1 wouldn't render Silverlight properly. + Fixed bug where Flash would do extra empty requests if images below a specific size would be uploaded. + Fixed bug where Google Gears would resize and re-encode images even if the it wasn't changed in scale. + Fixed bug where the HTML5 runtime wouldn't free memory after each request on Gecko. +Version 1.2.4 (2010-09-08) + Added new BeforeUpload event to make it easier to override settings before a file is uploaded. + Added new automatic usage of FileReference in Flash if it's possible. Contributed by Marcel Jackwerth. + Added new chunking support for Chrome 5 and Firefox 3.6 using the HTML 5 runtime. + Added new multipart upload support for WebKit using the HTML 5 runtime and the FormData object. + Added new image scaling method for the Flash runtime contributed by rcoopman. + Added new alert error message if the user selected invalid files. + Added new automatic unique name generation to the example.php script. Contributed by Brandon Kelly. + Changed so the default upload method is multipart and the default chunk size is 0. + Fixed progress issue with the HTML5 runtime running on Gecko. + Fixed so longer extensions can be used such as .tar.gz. + Fixed so the file extension is retained when using the unique_names option. +Version 1.2.3 (2010-05-27) + Added new drag/drop support for HTML5 running on Chrome beta. + Added new multipart state for the features object. It's now possible to detect multipart support. + Added new getFeatures function to all runtime. Basic concept by Javier Martinez Fernandez. + Fixed bug where runtimes where initialized even if they didn't match the required_features setting. +Version 1.2.2.1 (2010-05-04) + Added new headers option, enables you to set custom headers for the upload requests. + Fixed bug where the file extension checking was case sensitive. +Version 1.2.2 (2010-04-26) + Added new file_data_name option that enables you to set the multipart file data param. Patch contributed by Alex Ganov. + Added new FILE_SIZE_ERROR type that will be triggered if the user selected a file that is to large or zero bytes. + Added new FILE_EXTENSION_ERROR type that will be triggered if you add a file with an invalid file extension. + Added new required_features setting, enables you to specify a list of required features that the runtime must have. + Fixed so the plupload.buildUrl function uses the UTF compatible encodeURIComponent method instead of escape. + Fixed so that all file types can be selected if you don't specify a filter setting. + Fixed so more valid HTTP status codes are accepted as valid responses. + Fixed so all runtimes fills the features object with available features. + Fixed some issues with the HTML4 runtime if there wasn't any existing forms on the page. + Fixed some conflict issues with HTML4 runtime and forms with the input names of action or target. + Fixed bug where some Gecko versions would produce exceptions when checking the HTTP status of a XHR. +Version 1.2.1 (2010-03-22) + Fixed bug with incorrect aspect ratio in Flash image scaling. + Fixed bug where chunked uploads could get scrambled in the Flash runtime. Patch contributed by Grady Werner. + Fixed bug where a beta version of Chrome wouldn't handle drag/drop correctly because of missing drag effect. + Fixed so the HTML 4 runtime displays N/A for file sizes and the progress is based on uploaded files instead of bytes. + Fixed so chunking can be disabled properly in Flash but that will affect the progress bar. + Fixed so queue widget displays the drag/drop message if file queue is emptied. + Fixed small files are uploaded as one single chunk and not forced into 4 chunks in the Flash runtime. +Version 1.2 (2010-03-09) + Added new rename file support for jQuery queue widget, click on a file name to rename it if it's enabled. + Added official ChunkUploaded event, it similar to FileUploaded but executed for each chunk. + Added bytes per second support to total queue progress. + Added better error handling to core API using the new Error event. + Added better error handling to jQuery queue widget. + Fixed so chunking uploads is dispatch from JS not from inside Flash/Silverlight. +Version 1.1.1 (2010-02-25) + Added new setup setting to queue widget. Makes it easier to bind custom events to uploader instance. + Fixed so it's possible to disable chunking compleatly. It's now disabled by default. + Fixed bug where multipart mode was enabled all the time in the Flash runtime. + Fixed bug where chunked uploading in Silverlight would fail. + Fixed bug where the delete button was visible while uploading. + Fixed bug where unique_names setting wasn't working when the core API was used. + Fixed bug where the queue widget wouldn't display the currently uploaded file if the unique_names was enabled. +Version 1.1 (2010-02-24) + Added new multipart and multipart_params support. + Added new container option, enables you to specify where flash/silverlight objects would be added. + Added chunking support to BrowserPlus runtime, contributed by Steve Spencer. + Added FileUploaded event that fires when a file is uploaded. + Added more easily understandable buttons to queue widget. + Added html4 runtime, contributed by Ryan Demmer. + Fixed issues with i18n support and added a Swedish and Danish language pack. + Fixed bug where the Flash runtime could do empty requests if the image was scaled down. + Fixed bug where uploading small images in Silverlight would produce an exception. + Fixed so the runtime list can include whitespace or missing runtimes. Patch contributed by Øyvind Sean Kinsey. + Fixed so to large files are ignored and never dispatched to the FilesAdded event. +Version 1.0 (2010-02-03) + First official release of Plupload. diff --git a/public/javascripts/plupload/examples/css/jquery.ui.plupload.css b/public/javascripts/plupload/examples/css/jquery.ui.plupload.css new file mode 100644 index 0000000..b5475c7 --- /dev/null +++ b/public/javascripts/plupload/examples/css/jquery.ui.plupload.css @@ -0,0 +1,139 @@ +/* + Plupload +------------------------------------------------------------------- */ + +.plupload_button {cursor: pointer;} + +.plupload_wrapper { + font: normal 11px Verdana,sans-serif; + width: 100%; +} + +.plupload .plupload_container input {width: 98%;} +.plupload .plupload_filelist_footer {border-width: 1px 0 0 0} +.plupload .plupload_filelist_header {border-width: 0 0 1px 0} +div.plupload .plupload_file {border-width: 0 0 1px 0} +div.plupload div.plupload_header {border-width: 0 0 1px 0; position: relative;} + +.plupload_file .ui-icon { + cursor:pointer; +} + +.plupload_header_content { + background-image: url('../img/plupload.png'); + background-repeat: no-repeat; + background-position: 8px center; + min-height: 56px; + padding-left: 60px; + position:relative; +} +.plupload_header_content_bw {background-image: url('../img/plupload-bw.png');} +.plupload_header_title { + font: normal 18px sans-serif; + padding: 6px 0 3px; +} +.plupload_header_text {font: normal 12px sans-serif;} + +.plupload_filelist, +.plupload_filelist_content { + border-collapse: collapse; + margin: 0; + padding: 0; + width: 100%; +} + +.plupload_cell {padding: 8px 6px;} + +.plupload_file { + border-left: none; + border-right: none; +} + +.plupload_scroll { + max-height: 180px; + min-height: 168px; + _height: 168px; + overflow-y: auto; +} + +.plupload_file_size, .plupload_file_status {text-align: right;} +.plupload_file_size, .plupload_file_status {width: 52px;} +.plupload_file_action {width: 16px;} +.plupload_file_name { + overflow: hidden; + padding-left: 10px; +} + +.plupload_file_rename { + width:95%; +} + +.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;} +.plupload_droptext { + background: transparent; + text-align: center; + vertical-align: middle; + border: 0; + line-height: 165px; +} + +.plupload_buttons, .plupload_upload_status {float: left} + +.plupload_message { + position: absolute; + top: 0px; + left: 0px; + 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/public/javascripts/plupload/examples/css/plupload.queue.css b/public/javascripts/plupload/examples/css/plupload.queue.css new file mode 100644 index 0000000..8581fdd --- /dev/null +++ b/public/javascripts/plupload/examples/css/plupload.queue.css @@ -0,0 +1,177 @@ +/* + Plupload +------------------------------------------------------------------- */ + +.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} + +.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/public/javascripts/plupload/examples/custom.html b/public/javascripts/plupload/examples/custom.html new file mode 100644 index 0000000..42a02fa --- /dev/null +++ b/public/javascripts/plupload/examples/custom.html @@ -0,0 +1,91 @@ + + + + + +Plupload - Queue widget example + + + + + + + + + + + + + + + + + + +
+

Custom example

+ +

Shows you how to use the core plupload API.

+ +
+
No runtime found.
+
+ [Select files] + [Upload files] +
+ + +
+ + + \ No newline at end of file diff --git a/public/javascripts/plupload/examples/dump.php b/public/javascripts/plupload/examples/dump.php new file mode 100644 index 0000000..056f6a0 --- /dev/null +++ b/public/javascripts/plupload/examples/dump.php @@ -0,0 +1,31 @@ + + + + + +Plupload - Form dump + + + + +

Post dump

+ +

Shows the form items posted.

+ + + + + + + $value) { ?> + + + + + +
NameValue
+ + + diff --git a/public/javascripts/plupload/examples/events.html b/public/javascripts/plupload/examples/events.html new file mode 100644 index 0000000..48e553f --- /dev/null +++ b/public/javascripts/plupload/examples/events.html @@ -0,0 +1,187 @@ + + + + + +Plupload - Events example + + + + + + + + + + + +
+

Events example

+ +

Shows how to bind and use all available events.

+ +

Log messages

+ + +

Queue widget

+
You browser doesn't support upload.
+ Clear queue +
+ + + \ No newline at end of file diff --git a/public/javascripts/plupload/examples/img/backgrounds.gif b/public/javascripts/plupload/examples/img/backgrounds.gif new file mode 100644 index 0000000..39e33eb Binary files /dev/null and b/public/javascripts/plupload/examples/img/backgrounds.gif differ diff --git a/public/javascripts/plupload/examples/img/buttons-disabled.png b/public/javascripts/plupload/examples/img/buttons-disabled.png new file mode 100644 index 0000000..afa11af Binary files /dev/null and b/public/javascripts/plupload/examples/img/buttons-disabled.png differ diff --git a/public/javascripts/plupload/examples/img/buttons.png b/public/javascripts/plupload/examples/img/buttons.png new file mode 100644 index 0000000..153e738 Binary files /dev/null and b/public/javascripts/plupload/examples/img/buttons.png differ diff --git a/public/javascripts/plupload/examples/img/delete.gif b/public/javascripts/plupload/examples/img/delete.gif new file mode 100644 index 0000000..78ca8b3 Binary files /dev/null and b/public/javascripts/plupload/examples/img/delete.gif differ diff --git a/public/javascripts/plupload/examples/img/done.gif b/public/javascripts/plupload/examples/img/done.gif new file mode 100644 index 0000000..29f3ed7 Binary files /dev/null and b/public/javascripts/plupload/examples/img/done.gif differ diff --git a/public/javascripts/plupload/examples/img/error.gif b/public/javascripts/plupload/examples/img/error.gif new file mode 100644 index 0000000..4682b63 Binary files /dev/null and b/public/javascripts/plupload/examples/img/error.gif differ diff --git a/public/javascripts/plupload/examples/img/plupload-bw.png b/public/javascripts/plupload/examples/img/plupload-bw.png new file mode 100644 index 0000000..bb4147e Binary files /dev/null and b/public/javascripts/plupload/examples/img/plupload-bw.png differ diff --git a/public/javascripts/plupload/examples/img/plupload.png b/public/javascripts/plupload/examples/img/plupload.png new file mode 100644 index 0000000..74fa3ad Binary files /dev/null and b/public/javascripts/plupload/examples/img/plupload.png differ diff --git a/public/javascripts/plupload/examples/img/throbber.gif b/public/javascripts/plupload/examples/img/throbber.gif new file mode 100644 index 0000000..4ae8b16 Binary files /dev/null and b/public/javascripts/plupload/examples/img/throbber.gif differ diff --git a/public/javascripts/plupload/examples/img/transp50.png b/public/javascripts/plupload/examples/img/transp50.png new file mode 100644 index 0000000..eb0efe1 Binary files /dev/null and b/public/javascripts/plupload/examples/img/transp50.png differ diff --git a/public/javascripts/plupload/examples/jquery_ui_widget.html b/public/javascripts/plupload/examples/jquery_ui_widget.html new file mode 100644 index 0000000..5332d94 --- /dev/null +++ b/public/javascripts/plupload/examples/jquery_ui_widget.html @@ -0,0 +1,94 @@ + + + + +Plupload - Queue widget example + + + + + + + + + + + + + + + + + + + +

jQuery UI Widget

+ +

You can see this example with different themes on the www.plupload.com website.

+ +
+
+

You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.

+
+
+ + + \ No newline at end of file diff --git a/public/javascripts/plupload/examples/queue_widget.html b/public/javascripts/plupload/examples/queue_widget.html new file mode 100644 index 0000000..f3a8daa --- /dev/null +++ b/public/javascripts/plupload/examples/queue_widget.html @@ -0,0 +1,163 @@ + + + + + +Plupload - Queue widget example + + + + + + + + + + + + +
+

Queue widget example

+ +

Shows the jQuery Plupload Queue widget and under different runtimes.

+ +
+

Flash runtime

+
You browser doesn't have Flash installed.
+ +

Gears runtime

+
You browser doesn't have Gears installed.
+
+ +
+

Silverlight runtime

+
You browser doesn't have Silverlight installed.
+ +

HTML 5 runtime

+
You browser doesn't support native upload. Try Firefox 3 or Safari 4.
+
+ +
+

BrowserPlus runtime

+
You browser doesn't have BrowserPlus installed.
+ +

HTML 4 runtime

+
You browser doesn't have HTML 4 support.
+
+ +
+ + +
+ + + \ No newline at end of file diff --git a/public/javascripts/plupload/examples/queue_widget_dev.html b/public/javascripts/plupload/examples/queue_widget_dev.html new file mode 100644 index 0000000..224b39c --- /dev/null +++ b/public/javascripts/plupload/examples/queue_widget_dev.html @@ -0,0 +1,194 @@ + + + + + +Plupload - Queue widget example + + + + + + + + + + + + + + + + + + + + +
+

Queue widget example

+ +

Shows the jQuery Plupload Queue widget and under different runtimes.

+ +
+

Flash runtime

+
You browser doesn't have Flash installed.
+ +

Gears runtime

+
You browser doesn't have Gears installed.
+
+ +
+

Silverlight runtime

+
You browser doesn't have Silverlight installed.
+ +

HTML 5 runtime

+
You browser doesn't support native upload. Try Firefox 3 or Safari 4.
+
+ +
+

BrowserPlus runtime

+
You browser doesn't have BrowserPlus installed.
+ +

HTML4 runtime

+
You browser doesn't have a HTML 4 browser.
+ +
+

Custom example

+
+ + +
+
+ +
+ + +
+ + + \ No newline at end of file diff --git a/public/javascripts/plupload/examples/s3.php b/public/javascripts/plupload/examples/s3.php new file mode 100644 index 0000000..14f0597 --- /dev/null +++ b/public/javascripts/plupload/examples/s3.php @@ -0,0 +1,143 @@ + + + + + + +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'; + + +// hash_hmac — Generate a keyed hash value using the HMAC method +// (PHP 5 >= 5.1.2, PECL hash >= 1.1) +if (!function_exists('hash_hmac')) : +// based on: http://www.php.net/manual/en/function.sha1.php#39492 +function hash_hmac($algo, $data, $key, $raw_output = false) +{ + $blocksize = 64; + if (strlen($key) > $blocksize) + $key = pack('H*', $algo($key)); + + $key = str_pad($key, $blocksize, chr(0x00)); + $ipad = str_repeat(chr(0x36), $blocksize); + $opad = str_repeat(chr(0x5c), $blocksize); + $hmac = pack('H*', $algo(($key^$opad) . pack('H*', $algo(($key^$ipad) . $data)))); + + return $raw_output ? $hmac : bin2hex($hmac); +} +endif; + +// 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/'), + // "Some versions of the Adobe Flash Player do not properly handle HTTP responses that have an empty body. + // To configure POST to return a response that does not have an empty body, set success_action_status to 201. + // When set, Amazon S3 returns an XML document with a 201 status code." + // http://docs.amazonwebservices.com/AmazonS3/latest/dev/HTTPPOSTFlash.html + array('success_action_status' => '201'), + // 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)); + +?> + + + + +Plupload to Amazon S3 Example + + + + + + + + + + + + + + + +

Plupload to Amazon S3 Example

+ +
+

You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.

+
+ + + + + \ No newline at end of file diff --git a/public/javascripts/plupload/examples/upload.php b/public/javascripts/plupload/examples/upload.php new file mode 100644 index 0000000..f9f13aa --- /dev/null +++ b/public/javascripts/plupload/examples/upload.php @@ -0,0 +1,118 @@ + \ No newline at end of file diff --git a/public/javascripts/plupload/js/gears_init.js b/public/javascripts/plupload/js/gears_init.js new file mode 100644 index 0000000..5f44f09 --- /dev/null +++ b/public/javascripts/plupload/js/gears_init.js @@ -0,0 +1,86 @@ +// Copyright 2007, Google Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// 3. Neither the name of Google Inc. nor the names of its contributors may be +// used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Sets up google.gears.*, which is *the only* supported way to access Gears. +// +// Circumvent this file at your own risk! +// +// In the future, Gears may automatically define google.gears.* without this +// file. Gears may use these objects to transparently fix bugs and compatibility +// issues. Applications that use the code below will continue to work seamlessly +// when that happens. + +(function() { + // We are already defined. Hooray! + if (window.google && google.gears) { + return; + } + + var factory = null; + + // Firefox + if (typeof GearsFactory != 'undefined') { + factory = new GearsFactory(); + } else { + // IE + try { + factory = new ActiveXObject('Gears.Factory'); + // privateSetGlobalObject is only required and supported on WinCE. + if (factory.getBuildInfo().indexOf('ie_mobile') != -1) { + factory.privateSetGlobalObject(this); + } + } catch (e) { + // Safari + if ((typeof navigator.mimeTypes != 'undefined') + && navigator.mimeTypes["application/x-googlegears"]) { + factory = document.createElement("object"); + factory.style.display = "none"; + factory.width = 0; + factory.height = 0; + factory.type = "application/x-googlegears"; + document.documentElement.appendChild(factory); + } + } + } + + // *Do not* define any objects if Gears is not installed. This mimics the + // behavior of Gears defining the objects in the future. + if (!factory) { + return; + } + + // Now set up the objects, being careful not to overwrite anything. + // + // Note: In Internet Explorer for Windows Mobile, you can't add properties to + // the window object. However, global objects are automatically added as + // properties of the window object in all browsers. + if (!window.google) { + google = {}; + } + + if (!google.gears) { + google.gears = {factory: factory}; + } +})(); diff --git a/public/javascripts/plupload/js/jquery.plupload.queue.min.js b/public/javascripts/plupload/js/jquery.plupload.queue.min.js new file mode 100644 index 0000000..e4379fb --- /dev/null +++ b/public/javascripts/plupload/js/jquery.plupload.queue.min.js @@ -0,0 +1 @@ +(function(c){var d={};function a(e){return plupload.translate(e)||e}function b(f,e){e.contents().each(function(g,h){h=c(h);if(!h.is(".plupload")){h.remove()}});e.prepend('
'+a("Select files")+'
'+a("Add files to the upload queue and click the start button.")+'
'+a("Filename")+'
 
'+a("Status")+'
'+a("Size")+'
 
    ')}c.fn.pluploadQueue=function(e){if(e){this.each(function(){var j,i,k;i=c(this);k=i.attr("id");if(!k){k=plupload.guid();i.attr("id",k)}j=new plupload.Uploader(c.extend({dragdrop:true,container:k},e));d[k]=j;function h(l){var n;if(l.status==plupload.DONE){n="plupload_done"}if(l.status==plupload.FAILED){n="plupload_failed"}if(l.status==plupload.QUEUED){n="plupload_delete"}if(l.status==plupload.UPLOADING){n="plupload_uploading"}var m=c("#"+l.id).attr("class",n).find("a").css("display","block");if(l.hint){m.attr("title",l.hint)}}function f(){c("span.plupload_total_status",i).html(j.total.percent+"%");c("div.plupload_progress_bar",i).css("width",j.total.percent+"%");c("span.plupload_upload_status",i).text(a("Uploaded %d/%d files").replace(/%d\/%d/,j.total.uploaded+"/"+j.files.length))}function g(){var m=c("ul.plupload_filelist",i).html(""),n=0,l;c.each(j.files,function(p,o){l="";if(o.status==plupload.DONE){if(o.target_name){l+=''}l+='';l+='';n++;c("#"+k+"_count").val(n)}m.append('
  • '+o.name+'
    '+o.percent+'%
    '+plupload.formatSize(o.size)+'
     
    '+l+"
  • ");h(o);c("#"+o.id+".plupload_delete a").click(function(q){c("#"+o.id).remove();j.removeFile(o);q.preventDefault()})});c("span.plupload_total_file_size",i).html(plupload.formatSize(j.total.size));if(j.total.queued===0){c("span.plupload_add_text",i).text(a("Add files."))}else{c("span.plupload_add_text",i).text(j.total.queued+" files queued.")}c("a.plupload_start",i).toggleClass("plupload_disabled",j.files.length==(j.total.uploaded+j.total.failed));m[0].scrollTop=m[0].scrollHeight;f();if(!j.files.length&&j.features.dragdrop&&j.settings.dragdrop){c("#"+k+"_filelist").append('
  • '+a("Drag files here.")+"
  • ")}}j.bind("UploadFile",function(l,m){c("#"+m.id).addClass("plupload_current_file")});j.bind("Init",function(l,m){b(k,i);if(!e.unique_names&&e.rename){c("#"+k+"_filelist div.plupload_file_name span",i).live("click",function(s){var q=c(s.target),o,r,n,p="";o=l.getFile(q.parents("li")[0].id);n=o.name;r=/^(.+)(\.[^.]+)$/.exec(n);if(r){n=r[1];p=r[2]}q.hide().after('');q.next().val(n).focus().blur(function(){q.show().next().remove()}).keydown(function(u){var t=c(this);if(u.keyCode==13){u.preventDefault();o.name=t.val()+p;q.text(o.name);t.blur()}})})}c("a.plupload_add",i).attr("id",k+"_browse");l.settings.browse_button=k+"_browse";if(l.features.dragdrop&&l.settings.dragdrop){l.settings.drop_element=k+"_filelist";c("#"+k+"_filelist").append('
  • '+a("Drag files here.")+"
  • ")}c("#"+k+"_container").attr("title","Using runtime: "+m.runtime);c("a.plupload_start",i).click(function(n){if(!c(this).hasClass("plupload_disabled")){j.start()}n.preventDefault()});c("a.plupload_stop",i).click(function(n){n.preventDefault();j.stop()});c("a.plupload_start",i).addClass("plupload_disabled")});j.init();j.bind("Error",function(l,o){var m=o.file,n;if(m){n=o.message;if(o.details){n+=" ("+o.details+")"}if(o.code==plupload.FILE_SIZE_ERROR){alert(a("Error: File to large: ")+m.name)}if(o.code==plupload.FILE_EXTENSION_ERROR){alert(a("Error: Invalid file extension: ")+m.name)}m.hint=n;c("#"+m.id).attr("class","plupload_failed").find("a").css("display","block").attr("title",n)}});j.bind("StateChanged",function(){if(j.state===plupload.STARTED){c("li.plupload_delete a,div.plupload_buttons",i).hide();c("span.plupload_upload_status,div.plupload_progress,a.plupload_stop",i).css("display","block");c("span.plupload_upload_status",i).text("Uploaded "+j.total.uploaded+"/"+j.files.length+" files");if(e.multiple_queues){c("span.plupload_total_status,span.plupload_total_file_size",i).show()}}else{g();c("a.plupload_stop,div.plupload_progress",i).hide();c("a.plupload_delete",i).css("display","block")}});j.bind("QueueChanged",g);j.bind("FileUploaded",function(l,m){h(m)});j.bind("UploadProgress",function(l,m){c("#"+m.id+" div.plupload_file_status",i).html(m.percent+"%");h(m);f();if(e.multiple_queues&&j.total.uploaded+j.total.failed==j.files.length){c(".plupload_buttons,.plupload_upload_status",i).css("display","inline");c(".plupload_start",i).addClass("plupload_disabled");c("span.plupload_total_status,span.plupload_total_file_size",i).hide()}});if(e.setup){e.setup(j)}});return this}else{return d[c(this[0]).attr("id")]}}})(jQuery); \ No newline at end of file diff --git a/public/javascripts/plupload/js/jquery.ui.plupload.min.js b/public/javascripts/plupload/js/jquery.ui.plupload.min.js new file mode 100644 index 0000000..b7a368b --- /dev/null +++ b/public/javascripts/plupload/js/jquery.ui.plupload.min.js @@ -0,0 +1 @@ +(function(f,a,c,g,e){var h={};function b(i){return c.translate(i)||i}function d(i){i.html('
    '+b("Select files")+'
    '+b("Add files to the upload queue and click the start button.")+'
    '+b("Filename")+''+b("Status")+''+b("Size")+' 
    ')}g.widget("ui.plupload",{contents_bak:"",runtime:null,options:{browse_button_hover:"ui-state-hover",browse_button_active:"ui-state-active",dragdrop:true,multiple_queues:true,buttons:{browse:true,start:true,stop:true},autostart:false,sortable:false,rename:false,max_file_count:0},FILE_COUNT_ERROR:-9001,_create:function(){var i=this,k,j;k=this.element.attr("id");if(!k){k=c.guid();this.element.attr("id",k)}this.id=k;this.contents_bak=this.element.html();d(this.element);this.container=g(".plupload_container",this.element).attr("id",k+"_container");this.filelist=g(".plupload_filelist_content",this.container).attr("id",k+"_filelist");this.browse_button=g(".plupload_add",this.container).attr("id",k+"_browse");this.start_button=g(".plupload_start",this.container).attr("id",k+"_start");this.stop_button=g(".plupload_stop",this.container).attr("id",k+"_stop");if(g.ui.button){this.browse_button.button({icons:{primary:"ui-icon-circle-plus"}});this.start_button.button({icons:{primary:"ui-icon-circle-arrow-e"},disabled:true});this.stop_button.button({icons:{primary:"ui-icon-circle-close"}})}if(!this.options.buttons.browse){this.browse_button.button("disable").hide();g("#"+k+i.runtime+"_container").hide()}if(!this.options.buttons.start){this.start_button.button("disable").hide()}if(!this.options.buttons.stop){this.stop_button.button("disable").hide()}this.progressbar=g(".plupload_progress_container",this.container);if(g.ui.progressbar){this.progressbar.progressbar()}this.counter=g(".plupload_count",this.element).attr({id:k+"_count",name:k+"_count"});j=this.uploader=h[k]=new c.Uploader(g.extend({container:k,browse_button:k+"_browse"},this.options));j.bind("Init",function(l,m){if(!i.options.unique_names&&i.options.rename){i._enableRenaming()}if(j.features.dragdrop&&i.options.dragdrop){i._enableDragAndDrop()}i.container.attr("title",b("Using runtime: ")+(i.runtime=m.runtime));i.start_button.click(function(n){if(!g(this).button("option","disabled")){i.start()}n.preventDefault()});i.stop_button.click(function(n){j.stop();n.preventDefault()})});if(i.options.max_file_count){j.bind("FilesAdded",function(l,n){var m=n.length,o=[];if(m>i.options.max_file_count){o=n.splice(i.options.max_file_count);l.trigger("Error",{code:i.FILE_COUNT_ERROR,message:b("File count error."),file:o})}})}j.init();j.bind("FilesAdded",function(l,m){i._trigger("selected",null,{up:l,files:m});if(i.options.autostart){i.start()}});j.bind("FilesRemoved",function(l,m){i._trigger("removed",null,{up:l,files:m})});j.bind("QueueChanged",function(){i._updateFileList()});j.bind("StateChanged",function(){i._handleState()});j.bind("UploadFile",function(l,m){i._handleFileStatus(m)});j.bind("FileUploaded",function(l,m){i._handleFileStatus(m);i._trigger("uploaded",null,{up:l,file:m})});j.bind("UploadProgress",function(l,m){g("#"+m.id+" .plupload_file_status",i.element).html(m.percent+"%");i._handleFileStatus(m);i._updateTotalProgress();i._trigger("progress",null,{up:l,file:m})});j.bind("UploadComplete",function(l,m){i._trigger("complete",null,{up:l,files:m})});j.bind("Error",function(l,p){var n=p.file,o,m;if(n){o=""+p.message+"";m=p.details;if(m){o+="
    "+p.details+""}else{switch(p.code){case c.FILE_EXTENSION_ERROR:m=b("File: %s").replace("%s",n.name);break;case c.FILE_SIZE_ERROR:m=b("File: %f, size: %s, max file size: %m").replace(/%([fsm])/g,function(r,q){switch(q){case"f":return n.name;case"s":return n.size;case"m":return c.parseSize(i.options.max_file_size)}});break;case i.FILE_COUNT_ERROR:m=b("Upload element accepts only %d file(s) at a time. Extra files were stripped.").replace("%d",i.options.max_file_count);break;case c.IMAGE_FORMAT_ERROR:m=c.translate("Image format either wrong or not supported.");break;case c.IMAGE_MEMORY_ERROR:m=c.translate("Runtime ran out of available memory.");break;case c.IMAGE_DIMENSIONS_ERROR:m=c.translate("Resoultion out of boundaries! %s runtime supports images only up to %wx%hpx.").replace(/%([swh])/g,function(r,q){switch(q){case"s":return l.runtime;case"w":return l.features.maxWidth;case"h":return l.features.maxHeight}});break;case c.HTTP_ERROR:m=b("Upload URL might be wrong or doesn't exist");break}o+="
    "+m+""}i._notify("error",o)}})},_setOption:function(i,j){if(i=="buttons"&&typeof(j)=="object"){j=g.extend(this.options.buttons,j);if(!j.browse){this.browse_button.button("disable").hide();g("#"+this.id+self.runtime+"_container").hide()}else{this.browse_button.button("enable").show();g("#"+this.id+self.runtime+"_container").show()}if(!j.start){this.start_button.button("disable").hide()}else{this.start_button.button("enable").show()}if(!j.stop){this.stop_button.button("disable").hide()}else{this.start_button.button("enable").show()}}this.uploader.settings[i]=j},start:function(){this.uploader.start();this._trigger("start",null)},stop:function(){this.uploader.stop();this._trigger("stop",null)},getFile:function(j){var i;if(typeof j==="number"){i=this.uploader.files[j]}else{i=this.uploader.getFile(j)}return i},removeFile:function(j){var i=this.getFile(j);if(i){this.uploader.removeFile(i)}},clearQueue:function(){this.uploader.splice()},getUploader:function(){return this.uploader},refresh:function(){this.uploader.refresh()},_handleState:function(){var i=this,j=this.uploader;if(j.state===c.STARTED){g(i.start_button).button("disable");g([]).add(i.stop_button).add(".plupload_started").removeClass("plupload_hidden");g(".plupload_upload_status",i.element).text(b("Uploaded %d/%d files").replace("%d/%d",j.total.uploaded+"/"+j.files.length));g(".plupload_header_content",i.element).addClass("plupload_header_content_bw")}else{g([]).add(i.stop_button).add(".plupload_started").addClass("plupload_hidden");if(i.options.multiple_queues){g(i.start_button).button("enable");g(".plupload_header_content",i.element).removeClass("plupload_header_content_bw")}i._updateFileList()}},_handleFileStatus:function(l){var n,j;switch(l.status){case c.DONE:n="plupload_done";j="ui-icon ui-icon-circle-check";break;case c.FAILED:n="ui-state-error plupload_failed";j="ui-icon ui-icon-alert";break;case c.QUEUED:n="plupload_delete";j="ui-icon ui-icon-circle-minus";break;case c.UPLOADING:n="ui-state-highlight plupload_uploading";j="ui-icon ui-icon-circle-arrow-w";var i=g(".plupload_scroll",this.container),m=i.scrollTop(),o=i.height(),k=g("#"+l.id).position().top+g("#"+l.id).height();if(o'}i+='';i+='';k++;j.counter.val(k)}l.append(''+p.name+''+p.percent+'%'+c.formatSize(p.size)+'
    '+i+"");j._handleFileStatus(p);g("#"+p.id+".plupload_delete .ui-icon, #"+p.id+".plupload_done .ui-icon").click(function(r){g("#"+p.id).remove();n.removeFile(p);r.preventDefault()});j._trigger("updatelist",null,l)});g(".plupload_total_file_size",j.element).html(c.formatSize(n.total.size));if(n.total.queued===0){g(".ui-button-text",j.browse_button).text(b("Add Files"))}else{g(".ui-button-text",j.browse_button).text(b("%d files queued").replace("%d",n.total.queued))}if(n.files.length===(n.total.uploaded+n.total.failed)){j.start_button.button("disable")}else{j.start_button.button("enable")}l[0].scrollTop=l[0].scrollHeight;j._updateTotalProgress();if(!n.files.length&&n.features.dragdrop&&n.settings.dragdrop){g("#"+o+"_filelist").append(''+b("Drag files here.")+"")}else{if(j.options.sortable&&g.ui.sortable){j._enableSortingList()}}},_enableRenaming:function(){var i=this;g(".plupload_file_name span",this.filelist).live("click",function(o){var m=g(o.target),k,n,j,l="";k=i.uploader.getFile(m.parents("tr")[0].id);j=k.name;n=/^(.+)(\.[^.]+)$/.exec(j);if(n){j=n[1];l=n[2]}m.hide().after('');m.next().val(j).focus().blur(function(){m.show().next().remove()}).keydown(function(q){var p=g(this);if(g.inArray(q.keyCode,[13,27])!==-1){q.preventDefault();if(q.keyCode===13){k.name=p.val()+l;m.text(k.name)}p.blur()}})})},_enableDragAndDrop:function(){this.filelist.append(''+b("Drag files here.")+"");this.filelist.parent().attr("id",this.id+"_dropbox");this.uploader.settings.drop_element=this.options.drop_element=this.id+"_dropbox"},_enableSortingList:function(){var j,i=this;if(g("tbody tr",this.filelist).length<2){return}g("tbody",this.filelist).sortable({containment:"parent",items:".plupload_delete",helper:function(l,k){return k.clone(true).find("td:not(.plupload_file_name)").remove().end().css("width","100%")},start:function(l,k){j=g("tr",this).index(k.item)},stop:function(q,p){var l,o,k,n=[],m=g("tr",this).index(p.item);for(l=0,o=i.uploader.files.length;l

    '+k+"

    ");i.addClass("ui-state-"+(j==="error"?"error":"highlight")).find("p .ui-icon").addClass("ui-icon-"+(j==="error"?"alert":"info")).end().find(".plupload_message_close").click(function(){i.remove()}).end().appendTo(".plupload_header_content",this.container)},destroy:function(){g(".plupload_button",this.element).unbind();if(g.ui.button){g(".plupload_add, .plupload_start, .plupload_stop",this.container).button("destroy")}if(g.ui.progressbar){this.progressbar.progressbar("destroy")}if(g.ui.sortable&&this.options.sortable){g("tbody",this.filelist).sortable("destroy")}this.uploader.destroy();this.element.empty().html(this.contents_bak);this.contents_bak="";g.Widget.prototype.destroy.apply(this)}})}(window,document,plupload,jQuery)); \ No newline at end of file diff --git a/public/javascripts/plupload/js/plupload.browserplus.min.js b/public/javascripts/plupload/js/plupload.browserplus.min.js new file mode 100644 index 0000000..a5b20b3 --- /dev/null +++ b/public/javascripts/plupload/js/plupload.browserplus.min.js @@ -0,0 +1 @@ +(function(a){a.runtimes.BrowserPlus=a.addRuntime("browserplus",{getFeatures:function(){return{dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true}},init:function(g,i){var e=window.BrowserPlus,h={},d=g.settings,c=d.resize;function f(n){var m,l,j=[],k,o;for(l=0;l0){q(++s,u)}else{j.status=a.DONE;m.trigger("FileUploaded",j,{response:w.value.body,status:v});if(v>=400){m.trigger("Error",{code:a.HTTP_ERROR,message:a.translate("HTTP Error."),file:j,status:v})}}}else{m.trigger("Error",{code:a.GENERIC_ERROR,message:a.translate("Generic Error."),file:j,details:w.error})}})}function p(s){j.size=s.size;if(k){e.FileAccess.chunk({file:s,chunkSize:k},function(v){if(v.success){var w=v.value,t=w.length;n=Array(t);for(var u=0;u';function m(){return b.getElementById(j.id+"_flash")}function l(){if(p++>5000){o({success:false});return}if(!g[j.id]){setTimeout(l,1)}}l();n=i=null;j.bind("Flash:Init",function(){var s={},r,q=j.settings.resize||{};m().setFileFilters(j.settings.filters,j.settings.multi_selection);if(g[j.id]){return}g[j.id]=true;j.bind("UploadFile",function(t,u){var v=t.settings;m().uploadFile(s[u.id],v.url,{name:u.target_name||u.name,mime:d.mimeTypes[u.name.replace(/^.+\.([^.]+)/,"$1")]||"application/octet-stream",chunk_size:v.chunk_size,width:q.width,height:q.height,quality:q.quality||90,multipart:v.multipart,multipart_params:v.multipart_params||{},file_data_name:v.file_data_name,format:/\.(jpg|jpeg)$/i.test(u.name)?"jpg":"png",headers:v.headers,urlstream_upload:v.urlstream_upload})});j.bind("Flash:UploadProcess",function(u,t){var v=u.getFile(s[t.id]);if(v.status!=d.FAILED){v.loaded=t.loaded;v.size=t.size;u.trigger("UploadProgress",v)}});j.bind("Flash:UploadChunkComplete",function(t,v){var w,u=t.getFile(s[v.id]);w={chunk:v.chunk,chunks:v.chunks,response:v.text};t.trigger("ChunkUploaded",u,w);if(u.status!=d.FAILED){m().uploadNextChunk()}if(v.chunk==v.chunks-1){u.status=d.DONE;t.trigger("FileUploaded",u,{response:v.text})}});j.bind("Flash:SelectFiles",function(t,w){var v,u,x=[],y;for(u=0;u":"gt","&":"amp",'"':"quot","'":"#39"},l=/[<>&\"\']/g,b,c=window.setTimeout,d={},e;function h(){this.returnValue=false}function j(){this.cancelBubble=true}(function(n){var o=n.split(/,/),p,r,q;for(p=0;p0){g.each(o,function(r,q){n[q]=r})}});return n},cleanName:function(n){var o,p;p=[/[\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(o=0;o0?"&":"?")+p}return o},each:function(q,r){var p,o,n;if(q){p=q.length;if(p===b){for(o in q){if(q.hasOwnProperty(o)){if(r(q[o],o)===false){return}}}}else{for(n=0;n1073741824){return Math.round(n/1073741824,1)+" GB"}if(n>1048576){return Math.round(n/1048576,1)+" MB"}if(n>1024){return Math.round(n/1024,1)+" KB"}return n+" b"},getPos:function(o,s){var t=0,r=0,v,u=document,p,q;o=o;s=s||u.body;function n(B){var z,A,w=0,C=0;if(B){A=B.getBoundingClientRect();z=u.compatMode==="CSS1Compat"?u.documentElement:u.body;w=A.left+z.scrollLeft;C=A.top+z.scrollTop}return{x:w,y:C}}if(o&&o.getBoundingClientRect&&(navigator.userAgent.indexOf("MSIE")>0&&u.documentMode!==8)){p=n(o);q=n(s);return{x:p.x-q.x,y:p.y-q.y}}v=o;while(v&&v!=s&&v.nodeType){t+=v.offsetLeft||0;r+=v.offsetTop||0;v=v.offsetParent}v=o.parentNode;while(v&&v!=s&&v.nodeType){t-=v.scrollLeft||0;r-=v.scrollTop||0;v=v.parentNode}return{x:t,y:r}},getSize:function(n){return{w:n.offsetWidth||n.clientWidth,h:n.offsetHeight||n.clientHeight}},parseSize:function(n){var o;if(typeof(n)=="string"){n=/^([0-9]+)([mgk]+)$/.exec(n.toLowerCase().replace(/[^0-9mkg]/g,""));o=n[2];n=+n[1];if(o=="g"){n*=1073741824}if(o=="m"){n*=1048576}if(o=="k"){n*=1024}}return n},xmlEncode:function(n){return n?(""+n).replace(l,function(o){return a[o]?"&"+a[o]+";":o}):n},toArray:function(p){var o,n=[];for(o=0;o=0;p--){if(r[p].key===q||r[p].orig===u){if(t.detachEvent){t.detachEvent("on"+o,r[p].func)}else{if(t.removeEventListener){t.removeEventListener(o,r[p].func,false)}}r[p].orig=null;r[p].func=null;r.splice(p,1);if(u!==b){break}}}if(!r.length){delete d[t[e]][o]}if(n(d[t[e]])){delete d[t[e]];try{delete t[e]}catch(s){t[e]=b}}},removeAllEvents:function(o){var n=arguments[1];if(o[e]===b||!o[e]){return}g.each(d[o[e]],function(q,p){g.removeEvent(o,p,n)})}};g.Uploader=function(q){var o={},t,s=[],p;t=new g.QueueProgress();q=g.extend({chunk_size:0,multipart:true,multi_selection:true,file_data_name:"file",filters:[]},q);function r(){var v,w=0,u;if(this.state==g.STARTED){for(u=0;u0?Math.ceil(t.uploaded/s.length*100):0}else{t.bytesPerSec=Math.ceil(t.loaded/((+new Date()-p||1)/1000));t.percent=t.size>0?Math.ceil(t.loaded/t.size*100):0}}g.extend(this,{state:g.STOPPED,runtime:"",features:{},files:s,settings:q,total:t,id:g.guid(),init:function(){var z=this,A,w,v,y=0,x;if(typeof(q.preinit)=="function"){q.preinit(z)}else{g.each(q.preinit,function(C,B){z.bind(B,C)})}q.page_url=q.page_url||document.location.pathname.replace(/\/[^\/]+$/g,"/");if(!/^(\w+:\/\/|\/)/.test(q.url)){q.url=q.page_url+q.url}q.chunk_size=g.parseSize(q.chunk_size);q.max_file_size=g.parseSize(q.max_file_size);z.bind("FilesAdded",function(B,E){var D,C,G=0,H,F=q.filters;if(F&&F.length){H=[];g.each(F,function(I){g.each(I.extensions.split(/,/),function(J){H.push("\\."+J.replace(new RegExp("["+("/^$.*+?|()[]{}\\".replace(/./g,"\\$&"))+"]","g"),"\\$&"))})});H=new RegExp(H.join("|")+"$","i")}for(D=0;Dq.max_file_size){B.trigger("Error",{code:g.FILE_SIZE_ERROR,message:g.translate("File size error."),file:C});continue}s.push(C);G++}if(G){c(function(){z.trigger("QueueChanged");z.refresh()},1)}else{return false}});if(q.unique_names){z.bind("UploadFile",function(B,C){var E=C.name.match(/\.([^.]+)$/),D="tmp";if(E){D=E[1]}C.target_name=C.id+"."+D})}z.bind("UploadProgress",function(B,C){C.percent=C.size>0?Math.ceil(C.loaded/C.size*100):100;n()});z.bind("StateChanged",function(B){if(B.state==g.STARTED){p=(+new Date())}});z.bind("QueueChanged",n);z.bind("Error",function(B,C){if(C.file){C.file.status=g.FAILED;n();if(B.state==g.STARTED){c(function(){r.call(z)},1)}}});z.bind("FileUploaded",function(B,C){C.status=g.DONE;C.loaded=C.size;B.trigger("UploadProgress",C);c(function(){r.call(z)},1)});if(q.runtimes){w=[];x=q.runtimes.split(/\s?,\s?/);for(A=0;A=0;u--){if(s[u].id===v){return s[u]}}},removeFile:function(v){var u;for(u=s.length-1;u>=0;u--){if(s[u].id===v.id){return this.splice(u,1)[0]}}},splice:function(w,u){var v;v=s.splice(w===b?0:w,u===b?s.length:u);this.trigger("FilesRemoved",v);this.trigger("QueueChanged");return v},trigger:function(v){var x=o[v.toLowerCase()],w,u;if(x){u=Array.prototype.slice.call(arguments);u[0]=this;for(w=0;w=0;v--){if(x[v].func===w){x.splice(v,1);break}}}else{x=[]}if(!x.length){delete o[u]}}},unbindAll:function(){var u=this;g.each(o,function(w,v){u.unbind(v)})},destroy:function(){this.trigger("Destroy");this.unbindAll()}})};g.File=function(q,o,p){var n=this;n.id=q;n.name=o;n.size=p;n.loaded=0;n.percent=0;n.status=0};g.Runtime=function(){this.getFeatures=function(){};this.init=function(n,o){}};g.QueueProgress=function(){var n=this;n.size=0;n.loaded=0;n.uploaded=0;n.failed=0;n.queued=0;n.percent=0;n.bytesPerSec=0;n.reset=function(){n.size=n.loaded=n.uploaded=n.failed=n.queued=n.percent=n.bytesPerSec=0}};g.runtimes={};window.plupload=g})();(function(e,b,c,d){var f={};function a(l,h,o,n,g){var p,j,i,k;j=google.gears.factory.create("beta.canvas");try{j.decode(l);k=Math.min(h/j.width,o/j.height);if(k<1){j.resize(Math.round(j.width*k),Math.round(j.height*k));return j.encode(g,{quality:n/100})}}catch(m){}return l}c.runtimes.Gears=c.addRuntime("gears",{getFeatures:function(){return{dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true}},init:function(i,k){var j;if(!e.google||!google.gears){return k({success:false})}try{j=google.gears.factory.create("beta.desktop")}catch(h){return k({success:false})}function g(n){var m,l,o=[],p;for(l=0;l0;s=Math.ceil(o.size/p);if(!l){p=o.size;s=1}function m(){var y,A,v=r.settings.multipart,u=0,z={name:o.target_name||o.name},w=r.settings.url;function x(C){var B,H="----pluploadboundary"+c.guid(),E="--",G="\r\n",D,F;if(v){y.setRequestHeader("Content-Type","multipart/form-data; boundary="+H);B=google.gears.factory.create("beta.blobbuilder");c.each(c.extend(z,r.settings.multipart_params),function(J,I){B.append(E+H+G+'Content-Disposition: form-data; name="'+I+'"'+G+G);B.append(J+G)});F=c.mimeTypes[o.name.replace(/^.+\.([^.]+)/,"$1")]||"application/octet-stream";B.append(E+H+G+'Content-Disposition: form-data; name="'+r.settings.file_data_name+'"; filename="'+o.name+'"'+G+"Content-Type: "+F+G+G);B.append(C);B.append(G+E+H+E+G);D=B.getAsBlob();u=D.length-C.length;C=D}y.send(C)}if(o.status==c.DONE||o.status==c.FAILED||r.state==c.STOPPED){return}if(l){z.chunk=t;z.chunks=s}A=Math.min(p,o.size-(t*p));if(!v){w=c.buildUrl(r.settings.url,z)}y=google.gears.factory.create("beta.httprequest");y.open("POST",w);if(!v){y.setRequestHeader("Content-Disposition",'attachment; filename="'+o.name+'"');y.setRequestHeader("Content-Type","application/octet-stream")}c.each(r.settings.headers,function(C,B){y.setRequestHeader(B,C)});y.upload.onprogress=function(B){o.loaded=q+B.loaded-u;r.trigger("UploadProgress",o)};y.onreadystatechange=function(){var B;if(y.readyState==4){if(y.status==200){B={chunk:t,chunks:s,response:y.responseText,status:y.status};r.trigger("ChunkUploaded",o,B);if(B.cancelled){o.status=c.FAILED;return}q+=A;if(++t>=s){o.status=c.DONE;r.trigger("FileUploaded",o,{response:y.responseText,status:y.status})}else{m()}}else{r.trigger("Error",{code:c.HTTP_ERROR,message:c.translate("HTTP Error."),file:o,chunk:t,chunks:s,status:y.status})}}};if(t3){k.pop()}while(k.length<4){k.push(0)}l=r.split(".");while(l.length>4){l.pop()}do{t=parseInt(l[p],10);m=parseInt(k[p],10);p++}while(p8?"":0.01});o.className="plupload silverlight";if(p.settings.container){k=b.getElementById(p.settings.container);k.style.position="relative"}k.appendChild(o);for(l=0;l';function j(){return b.getElementById(p.id+"_silverlight").content.Upload}p.bind("Silverlight:Init",function(){var i,r={};if(h[p.id]){return}h[p.id]=true;p.bind("Silverlight:StartSelectFiles",function(s){i=[]});p.bind("Silverlight:SelectFile",function(s,v,t,u){var w;w=d.guid();r[w]=v;r[v]=w;i.push(new d.File(w,t,u))});p.bind("Silverlight:SelectSuccessful",function(){if(i.length){p.trigger("FilesAdded",i)}});p.bind("Silverlight:UploadChunkError",function(s,v,t,w,u){p.trigger("Error",{code:d.IO_ERROR,message:"IO Error.",details:u,file:s.getFile(r[v])})});p.bind("Silverlight:UploadFileProgress",function(s,w,t,v){var u=s.getFile(r[w]);if(u.status!=d.FAILED){u.size=v;u.loaded=t;s.trigger("UploadProgress",u)}});p.bind("Refresh",function(s){var t,u,v;t=b.getElementById(s.settings.browse_button);if(t){u=d.getPos(t,b.getElementById(s.settings.container));v=d.getSize(t);d.extend(b.getElementById(s.id+"_silverlight_container").style,{top:u.y+"px",left:u.x+"px",width:v.w+"px",height:v.h+"px"})}});p.bind("Silverlight:UploadChunkSuccessful",function(s,v,t,y,x){var w,u=s.getFile(r[v]);w={chunk:t,chunks:y,response:x};s.trigger("ChunkUploaded",u,w);if(u.status!=d.FAILED){j().UploadNextChunk()}if(t==y-1){u.status=d.DONE;s.trigger("FileUploaded",u,{response:x})}});p.bind("Silverlight:UploadSuccessful",function(s,v,t){var u=s.getFile(r[v]);u.status=d.DONE;s.trigger("FileUploaded",u,{response:t})});p.bind("FilesRemoved",function(s,u){var t;for(t=0;t';function m(){return b.getElementById(j.id+"_flash")}function l(){if(p++>5000){o({success:false});return}if(!g[j.id]){setTimeout(l,1)}}l();n=i=null;j.bind("Flash:Init",function(){var s={},r,q=j.settings.resize||{};m().setFileFilters(j.settings.filters,j.settings.multi_selection);if(g[j.id]){return}g[j.id]=true;j.bind("UploadFile",function(t,u){var v=t.settings;m().uploadFile(s[u.id],v.url,{name:u.target_name||u.name,mime:d.mimeTypes[u.name.replace(/^.+\.([^.]+)/,"$1")]||"application/octet-stream",chunk_size:v.chunk_size,width:q.width,height:q.height,quality:q.quality||90,multipart:v.multipart,multipart_params:v.multipart_params||{},file_data_name:v.file_data_name,format:/\.(jpg|jpeg)$/i.test(u.name)?"jpg":"png",headers:v.headers,urlstream_upload:v.urlstream_upload})});j.bind("Flash:UploadProcess",function(u,t){var v=u.getFile(s[t.id]);if(v.status!=d.FAILED){v.loaded=t.loaded;v.size=t.size;u.trigger("UploadProgress",v)}});j.bind("Flash:UploadChunkComplete",function(t,v){var w,u=t.getFile(s[v.id]);w={chunk:v.chunk,chunks:v.chunks,response:v.text};t.trigger("ChunkUploaded",u,w);if(u.status!=d.FAILED){m().uploadNextChunk()}if(v.chunk==v.chunks-1){u.status=d.DONE;t.trigger("FileUploaded",u,{response:v.text})}});j.bind("Flash:SelectFiles",function(t,w){var v,u,x=[],y;for(u=0;u0){q(++s,u)}else{j.status=a.DONE;m.trigger("FileUploaded",j,{response:w.value.body,status:v});if(v>=400){m.trigger("Error",{code:a.HTTP_ERROR,message:a.translate("HTTP Error."),file:j,status:v})}}}else{m.trigger("Error",{code:a.GENERIC_ERROR,message:a.translate("Generic Error."),file:j,details:w.error})}})}function p(s){j.size=s.size;if(k){e.FileAccess.chunk({file:s,chunkSize:k},function(v){if(v.success){var w=v.value,t=w.length;n=Array(t);for(var u=0;u0&&navigator.vendor.indexOf("Apple")!==-1;return{html5:k,dragdrop:m.mozInnerScreenX!==c||j||d,jpgresize:l,pngresize:l,multipart:l||!!m.FileReader||!!m.FormData,progress:n,chunking:j||l,canOpenDialog:navigator.userAgent.indexOf("WebKit")!==-1}},init:function(m,n){var j={},k;function l(s){var q,p,r=[],t,o={};for(p=0;p";A=g.getElementById(m.id+"_html5");A.onchange=function(){l(this.files);this.value=""};B=g.getElementById(s.settings.browse_button);if(B){var u=s.settings.browse_button_hover,v=s.settings.browse_button_active,t=s.features.canOpenDialog?B:C;if(u){f.addEvent(t,"mouseover",function(){f.addClass(B,u)},s.id);f.addEvent(t,"mouseout",function(){f.removeClass(B,u)},s.id)}if(v){f.addEvent(t,"mousedown",function(){f.addClass(B,v)},s.id);f.addEvent(g.body,"mouseup",function(){f.removeClass(B,v)},s.id)}if(s.features.canOpenDialog){f.addEvent(B,"click",function(y){g.getElementById(s.id+"_html5").click();y.preventDefault()},s.id)}}});m.bind("PostInit",function(){var o=g.getElementById(m.settings.drop_element);if(o){if(d){f.addEvent(o,"dragenter",function(s){var r,p,q;r=g.getElementById(m.id+"_drop");if(!r){r=g.createElement("input");r.setAttribute("type","file");r.setAttribute("id",m.id+"_drop");r.setAttribute("multiple","multiple");f.addEvent(r,"change",function(){l(this.files);f.removeEvent(r,"change",m.id);r.parentNode.removeChild(r)},m.id);o.appendChild(r)}p=f.getPos(o,g.getElementById(m.settings.container));q=f.getSize(o);f.extend(o.style,{position:"relative"});f.extend(r.style,{position:"absolute",display:"block",top:0,left:0,width:q.w+"px",height:q.h+"px",opacity:0})},m.id);return}f.addEvent(o,"dragover",function(p){p.preventDefault()},m.id);f.addEvent(o,"drop",function(q){var p=q.dataTransfer;if(p&&p.files){l(p.files)}q.preventDefault()},m.id)}});m.bind("Refresh",function(o){var p,r,s,t,q;p=g.getElementById(m.settings.browse_button);if(p){r=f.getPos(p,g.getElementById(o.settings.container));s=f.getSize(p);t=g.getElementById(m.id+"_html5_container");f.extend(t.style,{top:r.y+"px",left:r.x+"px",width:s.w+"px",height:s.h+"px"});if(m.features.canOpenDialog){q=parseInt(p.parentNode.style.zIndex,10);if(isNaN(q)){q=0}f.extend(p.style,{position:"relative",zIndex:q});f.extend(t.style,{zIndex:q-1})}}});m.bind("UploadFile",function(o,q){var r=o.settings,t,p;function s(u){var x=0,w=0;function v(){var E=u,L,M,H,I,J=0,A="----pluploadboundary"+f.guid(),D,F,B,C="--",K="\r\n",G="",z,y=o.settings.url;if(q.status==f.DONE||q.status==f.FAILED||o.state==f.STOPPED){return}I={name:q.target_name||q.name};if(r.chunk_size&&k.chunking){D=r.chunk_size;H=Math.ceil(q.size/D);F=Math.min(D,q.size-(x*D));if(typeof(u)=="string"){E=u.substring(x*D,x*D+F)}else{E=u.slice(x*D,F)}I.chunk=x;I.chunks=H}else{F=q.size}L=new XMLHttpRequest();M=L.upload;if(M){M.onprogress=function(N){q.loaded=Math.min(q.size,w+N.loaded-J);o.trigger("UploadProgress",q)}}if(!o.settings.multipart||!k.multipart){y=f.buildUrl(o.settings.url,I)}else{I.name=q.target_name||q.name}L.open("post",y,true);L.onreadystatechange=function(){var N,P;if(L.readyState==4){try{N=L.status}catch(O){N=0}if(N>=400){o.trigger("Error",{code:f.HTTP_ERROR,message:f.translate("HTTP Error."),file:q,status:N})}else{if(H){P={chunk:x,chunks:H,response:L.responseText,status:N};o.trigger("ChunkUploaded",q,P);w+=F;if(P.cancelled){q.status=f.FAILED;return}q.loaded=Math.min(q.size,(x+1)*D)}else{q.loaded=q.size}o.trigger("UploadProgress",q);if(!H||++x>=H){q.status=f.DONE;o.trigger("FileUploaded",q,{response:L.responseText,status:N});t=u=j[q.id]=null}else{v()}}L=E=B=G=null}};f.each(o.settings.headers,function(O,N){L.setRequestHeader(N,O)});if(o.settings.multipart&&k.multipart){if(!L.sendAsBinary){B=new FormData();f.each(f.extend(I,o.settings.multipart_params),function(O,N){B.append(N,O)});B.append(o.settings.file_data_name,E);L.send(B);return}L.setRequestHeader("Content-Type","multipart/form-data; boundary="+A);f.each(f.extend(I,o.settings.multipart_params),function(O,N){G+=C+A+K+'Content-Disposition: form-data; name="'+N+'"'+K+K;G+=unescape(encodeURIComponent(O))+K});z=f.mimeTypes[q.name.replace(/^.+\.([^.]+)/,"$1")]||"application/octet-stream";G+=C+A+K+'Content-Disposition: form-data; name="'+o.settings.file_data_name+'"; filename="'+unescape(encodeURIComponent(q.name))+'"'+K+"Content-Type: "+z+K+K+E+K+C+A+C+K;J=G.length-E.length;E=G}else{L.setRequestHeader("Content-Type","application/octet-stream")}if(L.sendAsBinary){L.sendAsBinary(E)}else{L.send(E)}}v()}t=j[q.id];p=o.settings.resize;if(k.jpgresize){if(p&&/\.(png|jpg|jpeg)$/i.test(q.name)){b(t,p.width,p.height,/\.png$/i.test(q.name)?"image/png":"image/jpeg",function(u){if(u.success){q.size=u.data.length;s(u.data)}else{h(t,s)}})}else{h(t,s)}}else{s(t)}});m.bind("Destroy",function(o){var q,r,p=g.body,s={inputContainer:o.id+"_html5_container",inputFile:o.id+"_html5",browseButton:o.settings.browse_button,dropElm:o.settings.drop_element};for(q in s){r=g.getElementById(s[q]);if(r){f.removeAllEvents(r,o.id)}}f.removeAllEvents(g.body,o.id);if(o.settings.container){p=g.getElementById(o.settings.container)}p.removeChild(g.getElementById(s.inputContainer))});n({success:true})}});a=function(){var l,m,B,v,w,q,u,x,G,s,D,z,n,F,j,E,C,o,k;function r(){var K=false,I;function L(N,P){var M=K?0:-8*(P-1),Q=0,O;for(O=0;O>Math.abs(M+P*8))&255)}H(N,R,true)}return{II:function(M){if(M===j){return K}else{K=M}},init:function(M){I=M},SEGMENT:function(M,O,N){if(!arguments.length){return I}if(typeof O=="number"){return I.substr(parseInt(M,10),O)}H(M,O,N)},BYTE:function(M){return L(M,1)},SHORT:function(M){return L(M,2)},LONG:function(M,N){if(N===j){return L(M,4)}else{J(M,N,4)}},SLONG:function(M){var N=L(M,4);return(N>2147483647?N-4294967296:N)},STRING:function(M,N){var O="";for(N+=M;M4){K=G.LONG(K)+F}for(R=0;R4){K=G.LONG(K)+F}S[T]=G.STRING(K,M-1);continue;case 3:if(M>2){K=G.LONG(K)+F}for(R=0;R1){K=G.LONG(K)+F}for(R=0;R