From 5c89bbcb586e7228e35c5e726cee710b0df10719 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 16 Sep 2007 02:34:55 +0000 Subject: [PATCH] elofgren: ENHANCEMENT: Added support for canceling and starting upload. (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42064 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/Upload.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/javascript/Upload.js b/javascript/Upload.js index c7ea5d24..6da2a8d7 100644 --- a/javascript/Upload.js +++ b/javascript/Upload.js @@ -7,8 +7,8 @@ Upload.prototype = { this.uploadInProgress = false; this.uploadMessage = ''; if(typeof params.fileSizeLimit != 'undefined') this.setFileSizeLimit = params.fileSizeLimit; else this.fileSizeLimit = '30720'; - if(typeof params.fileTypes != 'undefined') this.fileTypes = params.fileTypes; else params.fileTypes = '*.*'; - if(typeof params.fileTypesDescription != 'underfined') this.fileTypesDescription = params.fileTypesDescription; else this.fileTypesDescription = 'All Files'; + if(typeof params.fileTypes != 'undefined') this.fileTypes = params.fileTypes; else this.fileTypes = '*.*'; + if(typeof params.fileTypesDescription != 'undefined') this.fileTypesDescription = params.fileTypesDescription; else this.fileTypesDescription = 'All Files'; if(typeof params.fileUploadLimit != 'undefined') this.fileUploadLimit = params.fileUploadLimit; else this.fileUploadLimit = '6'; if(typeof params.beginUploadOnQueue != 'undefined') this.beginUploadOnQueue = params.beginUploadOnQueue; else this.beginUploadOnQueue = false; if(typeof params.fileQueued != 'undefined') this.fileQueued = params.fileQueued; @@ -28,7 +28,7 @@ Upload.prototype = { file_post_name: 'Files', file_size_limit : this.fileSizeLimit, // 30 MB file_types : this.fileTypes, // or you could use something like: '*.doc;*.wpd;*.pdf', - file_types_description : this.fileTypeDescription, + file_types_description : this.fileTypesDescription, file_upload_limit : this.fileUploadLimit, begin_upload_on_queue : this.beginUploadOnQueue, use_server_data_event : true, @@ -140,6 +140,15 @@ Upload.prototype = { this.swfu.browse(); }, + startUpload: function() { + this.swfu.startUpload(); + }, + + cancelUpload: function(fileId) { + this.filesToUpload--; + this.swfu.cancelUpload(fileId); + }, + setFolderID: function(id) { this.folderID = id; }, @@ -152,6 +161,10 @@ Upload.prototype = { return this.filesToUpload; }, + getUploadMessage: function() { + return this.uploadMessage; + }, + isUploadInProgress: function() { return this.uploadInProgress; }