applicious_utils 0.1.25 → 0.1.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/app/assets/javascripts/applicious_utils/Plupload/changelog.txt +152 -0
  2. data/app/assets/javascripts/applicious_utils/Plupload/examples/bg.jpg +0 -0
  3. data/app/assets/javascripts/applicious_utils/Plupload/examples/custom.html +94 -0
  4. data/app/assets/javascripts/applicious_utils/Plupload/examples/dump.php +36 -0
  5. data/app/assets/javascripts/applicious_utils/Plupload/examples/jquery/events.html +196 -0
  6. data/app/assets/javascripts/applicious_utils/Plupload/examples/jquery/jquery_ui_widget.html +103 -0
  7. data/app/assets/javascripts/applicious_utils/Plupload/examples/jquery/queue_widget.html +174 -0
  8. data/app/assets/javascripts/applicious_utils/Plupload/examples/jquery/s3.php +158 -0
  9. data/app/assets/javascripts/applicious_utils/Plupload/examples/upload.php +124 -0
  10. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.plupload.queue/css/jquery.plupload.queue.css +177 -0
  11. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.plupload.queue/img/backgrounds.gif +0 -0
  12. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.plupload.queue/img/buttons-disabled.png +0 -0
  13. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.plupload.queue/img/buttons.png +0 -0
  14. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.plupload.queue/img/delete.gif +0 -0
  15. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.plupload.queue/img/done.gif +0 -0
  16. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.plupload.queue/img/error.gif +0 -0
  17. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.plupload.queue/img/throbber.gif +0 -0
  18. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.plupload.queue/img/transp50.png +0 -0
  19. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.plupload.queue/jquery.plupload.queue.js +1 -0
  20. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.ui.plupload/css/jquery.ui.plupload.css +139 -0
  21. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.ui.plupload/img/plupload-bw.png +0 -0
  22. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.ui.plupload/img/plupload.png +0 -0
  23. data/app/assets/javascripts/applicious_utils/Plupload/js/jquery.ui.plupload/jquery.ui.plupload.js +1 -0
  24. data/app/assets/javascripts/applicious_utils/Plupload/js/plupload.browserplus.js +1 -0
  25. data/app/assets/javascripts/applicious_utils/Plupload/js/plupload.flash.js +1 -0
  26. data/app/assets/javascripts/applicious_utils/Plupload/js/plupload.flash.swf +0 -0
  27. data/app/assets/javascripts/applicious_utils/Plupload/js/plupload.full.js +2 -0
  28. data/app/assets/javascripts/applicious_utils/Plupload/js/plupload.gears.js +1 -0
  29. data/app/assets/javascripts/applicious_utils/Plupload/js/plupload.html4.js +1 -0
  30. data/app/assets/javascripts/applicious_utils/Plupload/js/plupload.html5.js +1 -0
  31. data/app/assets/javascripts/applicious_utils/Plupload/js/plupload.js +2 -0
  32. data/app/assets/javascripts/applicious_utils/Plupload/js/plupload.silverlight.js +1 -0
  33. data/app/assets/javascripts/applicious_utils/Plupload/js/plupload.silverlight.xap +0 -0
  34. data/app/assets/javascripts/applicious_utils/Plupload/license.txt +339 -0
  35. data/app/assets/javascripts/applicious_utils/Plupload/readme.md +46 -0
  36. data/app/assets/javascripts/applicious_utils/index.js +1 -1
  37. data/applicious_utils.gemspec +2 -1
  38. data/lib/applicious_utils/engine.rb +2 -0
  39. data/lib/applicious_utils/uploads_helper.rb +148 -0
  40. data/lib/applicious_utils/version.rb +1 -1
  41. data/lib/applicious_utils.rb +11 -2
  42. data/lib/generators/applicious_uploader_initializer.rb +9 -0
  43. data/lib/generators/templates/amazon_s3.yml +8 -0
  44. data/lib/generators/templates/session_store.rb +69 -0
  45. metadata +41 -14
  46. data/app/assets/javascripts/applicious_utils/swfupload-jquery/README +0 -70
  47. data/app/assets/javascripts/applicious_utils/swfupload-jquery/examples/01 - single uploader.html +0 -73
  48. data/app/assets/javascripts/applicious_utils/swfupload-jquery/examples/02 - multiple uploaders.html +0 -123
  49. data/app/assets/javascripts/applicious_utils/swfupload-jquery/examples/upload.php +0 -7
  50. data/app/assets/javascripts/applicious_utils/swfupload-jquery/src/jquery.swfupload.js +0 -64
  51. data/app/assets/javascripts/applicious_utils/swfupload-jquery/vendor/swfupload/XPButtonUploadText_61x22.png +0 -0
  52. data/app/assets/javascripts/applicious_utils/swfupload-jquery/vendor/swfupload/swfupload.js +0 -980
  53. data/app/assets/javascripts/applicious_utils/swfupload-jquery/vendor/swfupload/swfupload.queue.js +0 -99
  54. data/app/assets/javascripts/applicious_utils/swfupload-jquery/vendor/swfupload/swfupload.swf +0 -0
  55. data/lib/applicious_utils/applicious_railtie.rb +0 -11
  56. data/lib/applicious_utils/view_helpers.rb +0 -16
@@ -0,0 +1,152 @@
1
+ Version 1.4.3.2 (2011-04-13)
2
+ Fixed bug in HTML5 runtime, when was reduced by a factor of 100 after every upload.
3
+ Version 1.4.3.1 (2011-04-12)
4
+ Fixed build script, mistakenly populating jquery.plupload.queue directory from jquery.ui.plupload sources.
5
+ Fixed script urls in all examples, build script now will alter them automatically from dev to release when needed.
6
+ Fixed isEmptyObj undefined error in HTML4 runtime.
7
+ Fixed bug in UI Widget preventing UploadComplete from triggering.
8
+ Version 1.4.3 (2011-04-11)
9
+ Added Latvian language pack and updated French.
10
+ Fixed bug in Flash runtime when JPEG header was not investigated deep enough to reach SOFn marker in large images.
11
+ Fixed bug, when PNGs were cropped to width in Flash runtimes, rather then resized.
12
+ Fixed Flash to allow multiple uploading of the same file, with different settings.
13
+ Fixed Flash runtime to clean anonymous listeners properly.
14
+ Fixed HTML5 runtime to resolve to mimeType in case-insensitive way.
15
+ Fixed HTML5/Flash/SilverLight/Gears runtimes for inconsistency in naming of chunks feature, comparing to other runtimes.
16
+ Fixed HTML4/HTML5 runtimes for input[type=file] to outsize contaner effectively enough to fill the whole click area.
17
+ Fixed all runtimes to preserve position (relative/absolute) rule on containers that already have it.
18
+ Fixed SilverLight runtime to support large files (over 2GB).
19
+ Restructured the examples, src and build scripts to make it more clear that jQuery is optional.
20
+ Added support for *.* filter.
21
+ Added support for preserving ICC and IPTC headers when resizing JPEGs.
22
+ Added Image.onerror/onabort handlers to HTML5 in order to gracefully bypass faulty images.
23
+ Added ability to drop image size (by lowering quality), while preserving original dimension (HTML5/Flash/Gears).
24
+ Ported EXIF, ICC, IPTC preservation code to Flash runtime.
25
+ Version 1.4.2 (2011-02-20)
26
+ Added Brazilian Portuguese, German, Russian and Spanish translations.
27
+ Added support for file_data_name option to SilverLight runtime.
28
+ Added support for better quality image resizing to Flash runtime.
29
+ Added support for properly handling images with dimensions up to 8191x8191 pixels to Flash runtime.
30
+ Added 'updatelist' event to UI Widget, which will be triggered every time file list will get redrawn.
31
+ Added support for dynamically changing options to UI Widget.
32
+ Fixed HTML4 runtime bug, when UploadFile handler was attached twice.
33
+ Fixed HTML5 to use FileReader.readAsBinaryString() instead of File.getAsBinary() on newer WebKit browsers (like Chrome 9).
34
+ Fixed Flash runtime from sending duplicate Filename param, when using FileReference.upload().
35
+ Updated S3 example to illustrate support for a proper progress indication.
36
+ Version 1.4.1 (2011-02-01)
37
+ Added an example on how to use Plupload with Amazon S3 written in PHP but can easily be ported to other languages.
38
+ Fixed bug where hidden input elements wasn't created when the multiple_queues option wasn't used.
39
+ Fixed bug where FF4 would produce an exception about missing BlobBuilder.
40
+ Version 1.4.0 (2011-01-26)
41
+ Added removeEvent and removeAllEvents methods and modified addEvent accordingly, in order to support dynamic unload.
42
+ Added unbindAll method.
43
+ Added UploadComplete event, which fires when internal iterator reaches the end of the queue.
44
+ Added public destroy method to plupload object, new event - Destroy, and corresponding handlers to all runtimes.
45
+ Added Czech, Italian, French, Dutch translations.
46
+ Added support for translatable error messages.
47
+ Added two new options: browse_button_hover and browse_button_active, in order to support browse_button interactivity.
48
+ Added support for 'multi_selection: false' to Silverlight runtime.
49
+ Added support for video/mp4, video/x-m4v and audio/mp4 MIME Types.
50
+ Added artificial sendAsBinary method to XMLHttpRequest.prototype for browsers that have support for BlobBuilder and typed arrays.
51
+ Added version tracking variable into plupload object and version comment to the header of every file.
52
+ Fixed measurements of browse_button element in order to size and position input[type=file] element to fit it fully.
53
+ Fixed Flash runtime behavior for multiple_select=false and other simpleUpload usage cases: basically new FileReference has to be created for every select dialog.
54
+ Fixed browser sniffer to match only Safari, for fakeSafariDragDrop (seems like Safari on Mac doesn't require it either).
55
+ Fixed so that ExternalInterface escapes strings properly, before passing them to JS.
56
+ Fixed eventual reinitialization of flash/silverlight runtimes, especially for cases when object wrapper needed to be programmatically hidden and then shown again.
57
+ 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).
58
+ Fixed bug, when final UploadProgress was firing after FileUploaded for Flash simpleUpload.
59
+ Fixed bug where upload would fail if an error was produced inside the FilesAdded event.
60
+ Fixed bug in Flash runtime when it used a wrong size when resizing, but not chunking.
61
+ Fixed bug in Silverlight runtime that would keep sending 0 byte packages when a picture was chunked before resized.
62
+ Disabled blur filter (is going to be replaced with some bilinear resampling in next release).
63
+ Completely revised UI Widget, to be more jQuery UI oriented. Optionally depends on UI Button, UI Sortable, UI ProgressBar.
64
+ Version 1.3.0 (2010-11-24)
65
+ Added new jQuery UI widget that supports jQuery UI themes.
66
+ Added new multiple_queues option that enables you to upload multiple times in the queue widgets.
67
+ Added support for crossdomain loading of the XAP and SWF files and crossdomain upload.
68
+ Added new multiple_queues option that enables you to upload multiple times in the queue widgets.
69
+ Added support for crossdomain loading of the XAP and SWF files and crossdomain upload.
70
+ Added preinit/init options to to ease up the binding of custom events to queueWidget and the Uploader class.
71
+ Added drag/drop support for Safari until they fix the broken drag/drop support on Windows.
72
+ Added events example file that show how to bind all events and display event specific data.
73
+ Added support for retaining Exif data on images when they where resized using the HTML5 runtime.
74
+ Fixed logic issue with the upload.php example file. Chunking wasn't working correctly.
75
+ Fixed issue with HTML4 not handling the form encoding correctly on older IE versions. Patch contributed by jinxdone.
76
+ Fixed so the HTML4 runtime only submits the defined multipart_params arguments.
77
+ Fixes issue where it wasn't possible to dynamically override url or mutlipart_params for the HTML4 runtime.
78
+ Fixed so all runtimes pass the name, chunk and chunks parameters as multipart parameters instead of querystring parameters.
79
+ Fixed so files are read using the newer FileReader class if it's available if not it tries the older getAsXXX on Gecko.
80
+ Fixed bug where IE 9 beta 1 wouldn't render Silverlight properly.
81
+ Fixed bug where Flash would do extra empty requests if images below a specific size would be uploaded.
82
+ Fixed bug where Google Gears would resize and re-encode images even if the it wasn't changed in scale.
83
+ Fixed bug where the HTML5 runtime wouldn't free memory after each request on Gecko.
84
+ Version 1.2.4 (2010-09-08)
85
+ Added new BeforeUpload event to make it easier to override settings before a file is uploaded.
86
+ Added new automatic usage of FileReference in Flash if it's possible. Contributed by Marcel Jackwerth.
87
+ Added new chunking support for Chrome 5 and Firefox 3.6 using the HTML 5 runtime.
88
+ Added new multipart upload support for WebKit using the HTML 5 runtime and the FormData object.
89
+ Added new image scaling method for the Flash runtime contributed by rcoopman.
90
+ Added new alert error message if the user selected invalid files.
91
+ Added new automatic unique name generation to the example.php script. Contributed by Brandon Kelly.
92
+ Changed so the default upload method is multipart and the default chunk size is 0.
93
+ Fixed progress issue with the HTML5 runtime running on Gecko.
94
+ Fixed so longer extensions can be used such as .tar.gz.
95
+ Fixed so the file extension is retained when using the unique_names option.
96
+ Version 1.2.3 (2010-05-27)
97
+ Added new drag/drop support for HTML5 running on Chrome beta.
98
+ Added new multipart state for the features object. It's now possible to detect multipart support.
99
+ Added new getFeatures function to all runtime. Basic concept by Javier Martinez Fernandez.
100
+ Fixed bug where runtimes where initialized even if they didn't match the required_features setting.
101
+ Version 1.2.2.1 (2010-05-04)
102
+ Added new headers option, enables you to set custom headers for the upload requests.
103
+ Fixed bug where the file extension checking was case sensitive.
104
+ Version 1.2.2 (2010-04-26)
105
+ Added new file_data_name option that enables you to set the multipart file data param. Patch contributed by Alex Ganov.
106
+ Added new FILE_SIZE_ERROR type that will be triggered if the user selected a file that is to large or zero bytes.
107
+ Added new FILE_EXTENSION_ERROR type that will be triggered if you add a file with an invalid file extension.
108
+ Added new required_features setting, enables you to specify a list of required features that the runtime must have.
109
+ Fixed so the plupload.buildUrl function uses the UTF compatible encodeURIComponent method instead of escape.
110
+ Fixed so that all file types can be selected if you don't specify a filter setting.
111
+ Fixed so more valid HTTP status codes are accepted as valid responses.
112
+ Fixed so all runtimes fills the features object with available features.
113
+ Fixed some issues with the HTML4 runtime if there wasn't any existing forms on the page.
114
+ Fixed some conflict issues with HTML4 runtime and forms with the input names of action or target.
115
+ Fixed bug where some Gecko versions would produce exceptions when checking the HTTP status of a XHR.
116
+ Version 1.2.1 (2010-03-22)
117
+ Fixed bug with incorrect aspect ratio in Flash image scaling.
118
+ Fixed bug where chunked uploads could get scrambled in the Flash runtime. Patch contributed by Grady Werner.
119
+ Fixed bug where a beta version of Chrome wouldn't handle drag/drop correctly because of missing drag effect.
120
+ Fixed so the HTML 4 runtime displays N/A for file sizes and the progress is based on uploaded files instead of bytes.
121
+ Fixed so chunking can be disabled properly in Flash but that will affect the progress bar.
122
+ Fixed so queue widget displays the drag/drop message if file queue is emptied.
123
+ Fixed small files are uploaded as one single chunk and not forced into 4 chunks in the Flash runtime.
124
+ Version 1.2 (2010-03-09)
125
+ Added new rename file support for jQuery queue widget, click on a file name to rename it if it's enabled.
126
+ Added official ChunkUploaded event, it similar to FileUploaded but executed for each chunk.
127
+ Added bytes per second support to total queue progress.
128
+ Added better error handling to core API using the new Error event.
129
+ Added better error handling to jQuery queue widget.
130
+ Fixed so chunking uploads is dispatch from JS not from inside Flash/Silverlight.
131
+ Version 1.1.1 (2010-02-25)
132
+ Added new setup setting to queue widget. Makes it easier to bind custom events to uploader instance.
133
+ Fixed so it's possible to disable chunking compleatly. It's now disabled by default.
134
+ Fixed bug where multipart mode was enabled all the time in the Flash runtime.
135
+ Fixed bug where chunked uploading in Silverlight would fail.
136
+ Fixed bug where the delete button was visible while uploading.
137
+ Fixed bug where unique_names setting wasn't working when the core API was used.
138
+ Fixed bug where the queue widget wouldn't display the currently uploaded file if the unique_names was enabled.
139
+ Version 1.1 (2010-02-24)
140
+ Added new multipart and multipart_params support.
141
+ Added new container option, enables you to specify where flash/silverlight objects would be added.
142
+ Added chunking support to BrowserPlus runtime, contributed by Steve Spencer.
143
+ Added FileUploaded event that fires when a file is uploaded.
144
+ Added more easily understandable buttons to queue widget.
145
+ Added html4 runtime, contributed by Ryan Demmer.
146
+ Fixed issues with i18n support and added a Swedish and Danish language pack.
147
+ Fixed bug where the Flash runtime could do empty requests if the image was scaled down.
148
+ Fixed bug where uploading small images in Silverlight would produce an exception.
149
+ Fixed so the runtime list can include whitespace or missing runtimes. Patch contributed by �yvind Sean Kinsey.
150
+ Fixed so to large files are ignored and never dispatched to the FilesAdded event.
151
+ Version 1.0 (2010-02-03)
152
+ First official release of Plupload.
@@ -0,0 +1,94 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
5
+
6
+ <title>Plupload - Queue widget example</title>
7
+
8
+ <style type="text/css">
9
+ body {
10
+ font-family:Verdana, Geneva, sans-serif;
11
+ font-size:13px;
12
+ color:#333;
13
+ background:url(bg.jpg);
14
+ }
15
+ </style>
16
+
17
+ <script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>
18
+
19
+ <script type="text/javascript" src="../js/plupload.js"></script>
20
+ <script type="text/javascript" src="../js/plupload.gears.js"></script>
21
+ <script type="text/javascript" src="../js/plupload.silverlight.js"></script>
22
+ <script type="text/javascript" src="../js/plupload.flash.js"></script>
23
+ <script type="text/javascript" src="../js/plupload.browserplus.js"></script>
24
+ <script type="text/javascript" src="../js/plupload.html4.js"></script>
25
+ <script type="text/javascript" src="../js/plupload.html5.js"></script>
26
+
27
+ <!-- <script type="text/javascript" src="http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js"></script> -->
28
+
29
+ </head>
30
+ <body>
31
+
32
+ <form id="submit-form" method="post" action="dump.php">
33
+ <h1>Custom example</h1>
34
+
35
+ <p>Shows you how to use the core plupload API.</p>
36
+
37
+ <div>
38
+ <div id="filelist">No runtime found.</div>
39
+ <br />
40
+ <a id="pickfiles" href="javascript:;">[Select files]</a>
41
+ <a id="uploadfiles" href="javascript:;">[Upload files]</a>
42
+ </div>
43
+
44
+ <input type="submit" />
45
+ </form>
46
+
47
+ <script type="text/javascript">
48
+ // Custom example logic
49
+ function $(id) {
50
+ return document.getElementById(id);
51
+ }
52
+
53
+
54
+ var uploader = new plupload.Uploader({
55
+ runtimes : 'gears,html5,flash,silverlight,browserplus',
56
+ browse_button : 'pickfiles',
57
+ max_file_size : '10mb',
58
+ url : 'upload.php',
59
+ resize : {width : 320, height : 240, quality : 90},
60
+ flash_swf_url : '../js/plupload.flash.swf',
61
+ silverlight_xap_url : '../js/plupload.silverlight.xap',
62
+ filters : [
63
+ {title : "Image files", extensions : "jpg,gif,png"},
64
+ {title : "Zip files", extensions : "zip"}
65
+ ]
66
+ });
67
+
68
+ uploader.bind('Init', function(up, params) {
69
+ $('filelist').innerHTML = "<div>Current runtime: " + params.runtime + "</div>";
70
+ });
71
+
72
+ uploader.bind('FilesAdded', function(up, files) {
73
+ for (var i in files) {
74
+ $('filelist').innerHTML += '<div id="' + files[i].id + '">' + files[i].name + ' (' + plupload.formatSize(files[i].size) + ') <b></b></div>';
75
+ }
76
+ });
77
+
78
+ uploader.bind('UploadFile', function(up, file) {
79
+ $('submit-form').innerHTML += '<input type="hidden" name="file-' + file.id + '" value="' + file.name + '" />';
80
+ });
81
+
82
+ uploader.bind('UploadProgress', function(up, file) {
83
+ $(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
84
+ });
85
+
86
+ $('uploadfiles').onclick = function() {
87
+ uploader.start();
88
+ return false;
89
+ };
90
+
91
+ uploader.init();
92
+ </script>
93
+ </body>
94
+ </html>
@@ -0,0 +1,36 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
5
+ <link rel="stylesheet" href="css/plupload.css" type="text/css" media="screen" />
6
+ <title>Plupload - Form dump</title>
7
+ <style type="text/css">
8
+ body {
9
+ font-family:Verdana, Geneva, sans-serif;
10
+ font-size:13px;
11
+ color:#333;
12
+ background:url(bg.jpg);
13
+ }
14
+ </style>
15
+ </head>
16
+ <body>
17
+
18
+ <h1>Post dump</h1>
19
+
20
+ <p>Shows the form items posted.</p>
21
+
22
+ <table>
23
+ <tr>
24
+ <th>Name</th>
25
+ <th>Value</th>
26
+ </tr>
27
+ <?php $count = 0; foreach ($_POST as $name => $value) { ?>
28
+ <tr class="<?php echo $count % 2 == 0 ? 'alt' : ''; ?>">
29
+ <td><?php echo $name ?></td>
30
+ <td><?php echo nl2br(htmlentities(stripslashes($value))) ?></td>
31
+ </tr>
32
+ <?php } ?>
33
+ </table>
34
+
35
+ </body>
36
+ </html>
@@ -0,0 +1,196 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
5
+ <link rel="stylesheet" href="../../js/jquery.plupload.queue/css/jquery.plupload.queue.css" type="text/css" media="screen" />
6
+ <title>Plupload - Events example</title>
7
+ <style type="text/css">
8
+ body {
9
+ font-family:Verdana, Geneva, sans-serif;
10
+ font-size:13px;
11
+ color:#333;
12
+ background:url(../bg.jpg);
13
+ }
14
+ </style>
15
+
16
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
17
+ <script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>
18
+
19
+ <script type="text/javascript" src="../../js/plupload.js"></script>
20
+ <script type="text/javascript" src="../../js/plupload.gears.js"></script>
21
+ <script type="text/javascript" src="../../js/plupload.silverlight.js"></script>
22
+ <script type="text/javascript" src="../../js/plupload.flash.js"></script>
23
+ <script type="text/javascript" src="../../js/plupload.browserplus.js"></script>
24
+ <script type="text/javascript" src="../../js/plupload.html4.js"></script>
25
+ <script type="text/javascript" src="../../js/plupload.html5.js"></script>
26
+ <script type="text/javascript" src="../../js/jquery.plupload.queue/jquery.plupload.queue.js"></script>
27
+
28
+ </head>
29
+ <body>
30
+
31
+ <form method="post" action="dump.php">
32
+ <h1>Events example</h1>
33
+
34
+ <p>Shows how to bind and use all available events.</p>
35
+
36
+ <h3>Log messages</h3>
37
+ <textarea id="log" style="width: 100%; height: 150px; font-size: 11px" spellcheck="false" wrap="off"></textarea>
38
+
39
+ <h3>Queue widget</h3>
40
+ <div id="uploader" style="width: 450px; height: 330px;">You browser doesn't support upload.</div>
41
+ <a id="clear" href="#">Clear queue</a>
42
+ </form>
43
+ <script type="text/javascript">
44
+ $(function() {
45
+ function log() {
46
+ var str = "";
47
+
48
+ plupload.each(arguments, function(arg) {
49
+ var row = "";
50
+
51
+ if (typeof(arg) != "string") {
52
+ plupload.each(arg, function(value, key) {
53
+ // Convert items in File objects to human readable form
54
+ if (arg instanceof plupload.File) {
55
+ // Convert status to human readable
56
+ switch (value) {
57
+ case plupload.QUEUED:
58
+ value = 'QUEUED';
59
+ break;
60
+
61
+ case plupload.UPLOADING:
62
+ value = 'UPLOADING';
63
+ break;
64
+
65
+ case plupload.FAILED:
66
+ value = 'FAILED';
67
+ break;
68
+
69
+ case plupload.DONE:
70
+ value = 'DONE';
71
+ break;
72
+ }
73
+ }
74
+
75
+ if (typeof(value) != "function") {
76
+ row += (row ? ', ': '') + key + '=' + value;
77
+ }
78
+ });
79
+
80
+ str += row + " ";
81
+ } else {
82
+ str += arg + " ";
83
+ }
84
+ });
85
+
86
+ $('#log').val($('#log').val() + str + "\r\n");
87
+ }
88
+
89
+ $("#uploader").pluploadQueue({
90
+ // General settings
91
+ runtimes: 'html5,gears,browserplus,silverlight,flash,html4',
92
+ url: '../upload.php',
93
+ max_file_size: '10mb',
94
+ chunk_size: '1mb',
95
+ unique_names: true,
96
+
97
+ // Resize images on clientside if we can
98
+ resize: {width: 320, height: 240, quality: 90},
99
+
100
+ // Specify what files to browse for
101
+ filters: [
102
+ {title: "Image files", extensions: "jpg,gif,png"},
103
+ {title: "Zip files", extensions: "zip"}
104
+ ],
105
+
106
+ // Flash/Silverlight paths
107
+ flash_swf_url: '../../js/plupload.flash.swf',
108
+ silverlight_xap_url: '../../js/plupload.silverlight.xap',
109
+
110
+ // PreInit events, bound before any internal events
111
+ preinit: {
112
+ Init: function(up, info) {
113
+ log('[Init]', 'Info:', info, 'Features:', up.features);
114
+ },
115
+
116
+ UploadFile: function(up, file) {
117
+ log('[UploadFile]', file);
118
+
119
+ // You can override settings before the file is uploaded
120
+ // up.settings.url = 'upload.php?id=' + file.id;
121
+ // up.settings.multipart_params = {param1: 'value1', param2: 'value2'};
122
+ }
123
+ },
124
+
125
+ // Post init events, bound after the internal events
126
+ init: {
127
+ Refresh: function(up) {
128
+ // Called when upload shim is moved
129
+ log('[Refresh]');
130
+ },
131
+
132
+ StateChanged: function(up) {
133
+ // Called when the state of the queue is changed
134
+ log('[StateChanged]', up.state == plupload.STARTED ? "STARTED": "STOPPED");
135
+ },
136
+
137
+ QueueChanged: function(up) {
138
+ // Called when the files in queue are changed by adding/removing files
139
+ log('[QueueChanged]');
140
+ },
141
+
142
+ UploadProgress: function(up, file) {
143
+ // Called while a file is being uploaded
144
+ log('[UploadProgress]', 'File:', file, "Total:", up.total);
145
+ },
146
+
147
+ FilesAdded: function(up, files) {
148
+ // Callced when files are added to queue
149
+ log('[FilesAdded]');
150
+
151
+ plupload.each(files, function(file) {
152
+ log(' File:', file);
153
+ });
154
+ },
155
+
156
+ FilesRemoved: function(up, files) {
157
+ // Called when files where removed from queue
158
+ log('[FilesRemoved]');
159
+
160
+ plupload.each(files, function(file) {
161
+ log(' File:', file);
162
+ });
163
+ },
164
+
165
+ FileUploaded: function(up, file, info) {
166
+ // Called when a file has finished uploading
167
+ log('[FileUploaded] File:', file, "Info:", info);
168
+ },
169
+
170
+ ChunkUploaded: function(up, file, info) {
171
+ // Called when a file chunk has finished uploading
172
+ log('[ChunkUploaded] File:', file, "Info:", info);
173
+ },
174
+
175
+ Error: function(up, args) {
176
+ // Called when a error has occured
177
+
178
+ // Handle file specific error and general error
179
+ if (args.file) {
180
+ log('[error]', args, "File:", args.file);
181
+ } else {
182
+ log('[error]', args);
183
+ }
184
+ }
185
+ }
186
+ });
187
+
188
+ $('#log').val('');
189
+ $('#clear').click(function(e) {
190
+ e.preventDefault();
191
+ $("#uploader").pluploadQueue().splice();
192
+ });
193
+ });
194
+ </script>
195
+ </body>
196
+ </html>
@@ -0,0 +1,103 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
5
+ <title>Plupload - Queue widget example</title>
6
+ <style type="text/css">
7
+ body {
8
+ font-family:Verdana, Geneva, sans-serif;
9
+ font-size:13px;
10
+ color:#333;
11
+ background:url(../bg.jpg);
12
+ }
13
+ </style>
14
+ <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" />
15
+ <link rel="stylesheet" href="../../js/jquery.ui.plupload/css/jquery.ui.plupload.css" type="text/css" />
16
+
17
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
18
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
19
+ <script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>
20
+
21
+ <script type="text/javascript" src="../../js/plupload.js"></script>
22
+ <script type="text/javascript" src="../../js/plupload.gears.js"></script>
23
+ <script type="text/javascript" src="../../js/plupload.silverlight.js"></script>
24
+ <script type="text/javascript" src="../../js/plupload.flash.js"></script>
25
+ <script type="text/javascript" src="../../js/plupload.browserplus.js"></script>
26
+ <script type="text/javascript" src="../../js/plupload.html4.js"></script>
27
+ <script type="text/javascript" src="../../js/plupload.html5.js"></script>
28
+ <script type="text/javascript" src="../../js/jquery.ui.plupload/jquery.ui.plupload.js"></script>
29
+
30
+ <!--<script type="text/javascript" src="http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js"></script>-->
31
+ </head>
32
+ <body>
33
+
34
+ <h1>jQuery UI Widget</h1>
35
+
36
+ <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>
37
+
38
+ <form method="post" action="dump.php">
39
+ <div id="uploader">
40
+ <p>You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p>
41
+ </div>
42
+ </form>
43
+ <script type="text/javascript">
44
+ // Convert divs to queue widgets when the DOM is ready
45
+ $(function() {
46
+ $("#uploader").plupload({
47
+ // General settings
48
+ runtimes : 'flash,html5,browserplus,silverlight,gears,html4',
49
+ url : '../upload.php',
50
+ max_file_size : '1000mb',
51
+ max_file_count: 20, // user can add no more then 20 files at a time
52
+ chunk_size : '1mb',
53
+ unique_names : true,
54
+ multiple_queues : true,
55
+
56
+ // Resize images on clientside if we can
57
+ resize : {width : 320, height : 240, quality : 90},
58
+
59
+ // Rename files by clicking on their titles
60
+ rename: true,
61
+
62
+ // Sort files
63
+ sortable: true,
64
+
65
+ // Specify what files to browse for
66
+ filters : [
67
+ {title : "Image files", extensions : "jpg,gif,png"},
68
+ {title : "Zip files", extensions : "zip,avi"}
69
+ ],
70
+
71
+ // Flash settings
72
+ flash_swf_url : '../../js/plupload.flash.swf',
73
+
74
+ // Silverlight settings
75
+ silverlight_xap_url : '../../js/plupload.silverlight.xap'
76
+ });
77
+
78
+ // Client side form validation
79
+ $('form').submit(function(e) {
80
+ var uploader = $('#uploader').plupload('getUploader');
81
+
82
+ // Validate number of uploaded files
83
+ if (uploader.total.uploaded == 0) {
84
+ // Files in queue upload them first
85
+ if (uploader.files.length > 0) {
86
+ // When all files are uploaded submit form
87
+ uploader.bind('UploadProgress', function() {
88
+ if (uploader.total.uploaded == uploader.files.length)
89
+ $('form').submit();
90
+ });
91
+
92
+ uploader.start();
93
+ } else
94
+ alert('You must at least upload one file.');
95
+
96
+ e.preventDefault();
97
+ }
98
+ });
99
+
100
+ });
101
+ </script>
102
+ </body>
103
+ </html>