5 *Adds a cancelQueue() method for cancelling the entire queue.
6 *All queued files are uploaded when startUpload() is called.
7 *If false is returned from uploadComplete then the queue upload is stopped.
8 If false is not returned (strict comparison) then the queue upload is continued.
9 *Adds a QueueComplete event that is fired when all the queued files have finished uploading.
10 Set the event handler with the queue_complete_handler setting.
15 if (typeof(SWFUpload) === "function") {
18 SWFUpload.prototype.initSettings = (function (oldInitSettings) {
20 if (typeof(oldInitSettings) === "function") {
21 oldInitSettings.call(this);
24 this.customSettings.queue_cancelled_flag = false;
25 this.customSettings.queue_upload_count = 0;
27 this.settings.user_upload_complete_handler = this.settings.upload_complete_handler;
28 this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
30 this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
32 })(SWFUpload.prototype.initSettings);
34 SWFUpload.prototype.startUpload = function (fileID) {
35 this.customSettings.queue_cancelled_flag = false;
36 this.callFlash("StartUpload", false, [fileID]);
39 SWFUpload.prototype.cancelQueue = function () {
40 this.customSettings.queue_cancelled_flag = true;
43 var stats = this.getStats();
44 while (stats.files_queued > 0) {
46 stats = this.getStats();
50 SWFUpload.queue.uploadCompleteHandler = function (file) {
51 var user_upload_complete_handler = this.settings.user_upload_complete_handler;
54 if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
55 this.customSettings.queue_upload_count++;
58 if (typeof(user_upload_complete_handler) === "function") {
59 continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
61 continueUpload = true;
65 var stats = this.getStats();
66 if (stats.files_queued > 0 && this.customSettings.queue_cancelled_flag === false) {
68 } else if (this.customSettings.queue_cancelled_flag === false) {
69 this.queueEvent("queue_complete_handler", [this.customSettings.queue_upload_count]);
70 this.customSettings.queue_upload_count = 0;
72 this.customSettings.queue_cancelled_flag = false;
73 this.customSettings.queue_upload_count = 0;