rails_kindeditor 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/uploaders/kindeditor/asset_uploader.rb +1 -1
- data/lib/rails_kindeditor/engine.rb +1 -1
- data/lib/rails_kindeditor/version.rb +1 -1
- data/rails_kindeditor.gemspec +0 -1
- data/vendor/assets/javascripts/kindeditor/kindeditor.js +122 -58
- data/vendor/assets/javascripts/kindeditor/lang/ar.js +16 -0
- data/vendor/assets/javascripts/kindeditor/lang/en.js +16 -0
- data/vendor/assets/javascripts/kindeditor/lang/zh_CN.js +23 -7
- data/vendor/assets/javascripts/kindeditor/lang/zh_TW.js +17 -1
- data/vendor/assets/javascripts/kindeditor/plugins/anchor/anchor.js +1 -1
- data/vendor/assets/javascripts/kindeditor/plugins/baidumap/baidumap.js +77 -0
- data/vendor/assets/javascripts/kindeditor/plugins/baidumap/map.html +43 -0
- data/vendor/assets/javascripts/kindeditor/plugins/code/prettify.css +13 -13
- data/vendor/assets/javascripts/kindeditor/plugins/code/prettify.js +28 -28
- data/vendor/assets/javascripts/kindeditor/plugins/filemanager/filemanager.js +1 -1
- data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/file-64.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/folder-64.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/flash/flash.js +8 -4
- data/vendor/assets/javascripts/kindeditor/plugins/image/image.js +61 -40
- data/vendor/assets/javascripts/kindeditor/plugins/insertfile/insertfile.js +8 -5
- data/vendor/assets/javascripts/kindeditor/plugins/link/link.js +5 -5
- data/vendor/assets/javascripts/kindeditor/plugins/media/media.js +8 -3
- data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/image.png +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/select-files-en.png +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/select-files-zh_CN.png +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/swfupload.swf +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/multiimage/multiimage.js +1368 -0
- data/vendor/assets/javascripts/kindeditor/plugins/table/table.js +2 -4
- data/vendor/assets/javascripts/kindeditor/plugins/template/html/1.html +13 -13
- data/vendor/assets/javascripts/kindeditor/plugins/template/html/2.html +41 -41
- data/vendor/assets/javascripts/kindeditor/plugins/template/html/3.html +35 -35
- data/vendor/assets/javascripts/kindeditor/themes/default/default.css +124 -5
- data/vendor/assets/javascripts/kindeditor/themes/default/default.png +0 -0
- data/vendor/assets/javascripts/kindeditor/themes/qq/editor.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/themes/qq/qq.css +143 -0
- data/vendor/assets/javascripts/kindeditor/themes/simple/simple.css +100 -100
- metadata +12 -3
| Binary file | 
| Binary file | 
| @@ -11,11 +11,13 @@ KindEditor.plugin('flash', function(K) { | |
| 11 11 | 
             
            	var self = this, name = 'flash', lang = self.lang(name + '.'),
         | 
| 12 12 | 
             
            		allowFlashUpload = K.undef(self.allowFlashUpload, true),
         | 
| 13 13 | 
             
            		allowFileManager = K.undef(self.allowFileManager, false),
         | 
| 14 | 
            +
            		formatUploadUrl = K.undef(self.formatUploadUrl, true),
         | 
| 15 | 
            +
            		extraParams = K.undef(self.extraFileUploadParams, {}),
         | 
| 14 16 | 
             
            		uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php');
         | 
| 15 17 | 
             
            	self.plugin.flash = {
         | 
| 16 18 | 
             
            		edit : function() {
         | 
| 17 19 | 
             
            			var html = [
         | 
| 18 | 
            -
            				'<div style="padding: | 
| 20 | 
            +
            				'<div style="padding:20px;">',
         | 
| 19 21 | 
             
            				//url
         | 
| 20 22 | 
             
            				'<div class="ke-dialog-row">',
         | 
| 21 23 | 
             
            				'<label for="keUrl" style="width:60px;">' + lang.url + '</label>',
         | 
| @@ -40,7 +42,6 @@ KindEditor.plugin('flash', function(K) { | |
| 40 42 | 
             
            			var dialog = self.createDialog({
         | 
| 41 43 | 
             
            				name : name,
         | 
| 42 44 | 
             
            				width : 450,
         | 
| 43 | 
            -
            				height : 200,
         | 
| 44 45 | 
             
            				title : self.lang(name),
         | 
| 45 46 | 
             
            				body : html,
         | 
| 46 47 | 
             
            				yesBtn : {
         | 
| @@ -86,11 +87,15 @@ KindEditor.plugin('flash', function(K) { | |
| 86 87 | 
             
            				var uploadbutton = K.uploadbutton({
         | 
| 87 88 | 
             
            					button : K('.ke-upload-button', div)[0],
         | 
| 88 89 | 
             
            					fieldName : 'imgFile',
         | 
| 90 | 
            +
            					extraParams : extraParams,
         | 
| 89 91 | 
             
            					url : K.addParam(uploadJson, 'dir=flash'),
         | 
| 90 92 | 
             
            					afterUpload : function(data) {
         | 
| 91 93 | 
             
            						dialog.hideLoading();
         | 
| 92 94 | 
             
            						if (data.error === 0) {
         | 
| 93 | 
            -
            							var url =  | 
| 95 | 
            +
            							var url = data.url;
         | 
| 96 | 
            +
            							if (formatUploadUrl) {
         | 
| 97 | 
            +
            								url = K.formatUrl(url, 'absolute');
         | 
| 98 | 
            +
            							}
         | 
| 94 99 | 
             
            							urlBox.val(url);
         | 
| 95 100 | 
             
            							if (self.afterUpload) {
         | 
| 96 101 | 
             
            								self.afterUpload.call(self, url);
         | 
| @@ -111,7 +116,6 @@ KindEditor.plugin('flash', function(K) { | |
| 111 116 | 
             
            				});
         | 
| 112 117 | 
             
            			} else {
         | 
| 113 118 | 
             
            				K('.ke-upload-button', div).hide();
         | 
| 114 | 
            -
            				urlBox.width(250);
         | 
| 115 119 | 
             
            			}
         | 
| 116 120 |  | 
| 117 121 | 
             
            			if (allowFileManager) {
         | 
| @@ -10,10 +10,12 @@ | |
| 10 10 | 
             
            KindEditor.plugin('image', function(K) {
         | 
| 11 11 | 
             
            	var self = this, name = 'image',
         | 
| 12 12 | 
             
            		allowImageUpload = K.undef(self.allowImageUpload, true),
         | 
| 13 | 
            +
            		formatUploadUrl = K.undef(self.formatUploadUrl, true),
         | 
| 13 14 | 
             
            		allowFileManager = K.undef(self.allowFileManager, false),
         | 
| 14 15 | 
             
            		uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'),
         | 
| 15 16 | 
             
            		imageTabIndex = K.undef(self.imageTabIndex, 0),
         | 
| 16 17 | 
             
            		imgPath = self.pluginsPath + 'image/images/',
         | 
| 18 | 
            +
            		extraParams = K.undef(self.extraFileUploadParams, {}),
         | 
| 17 19 | 
             
            		lang = self.lang(name + '.');
         | 
| 18 20 |  | 
| 19 21 | 
             
            	self.plugin.imageDialog = function(options) {
         | 
| @@ -24,29 +26,29 @@ KindEditor.plugin('image', function(K) { | |
| 24 26 | 
             
            			imageAlign = K.undef(options.imageAlign, ''),
         | 
| 25 27 | 
             
            			tabIndex = K.undef(options.tabIndex, 0),
         | 
| 26 28 | 
             
            			clickFn = options.clickFn;
         | 
| 29 | 
            +
            		var target = 'kindeditor_upload_iframe_' + new Date().getTime();
         | 
| 30 | 
            +
            		var hiddenElements = [];
         | 
| 31 | 
            +
            		for(var k in extraParams){
         | 
| 32 | 
            +
            			hiddenElements.push('<input type="hidden" name="' + k + '" value="' + extraParams[k] + '" />');
         | 
| 33 | 
            +
            		}
         | 
| 27 34 | 
             
            		var html = [
         | 
| 28 | 
            -
            			'<div style="padding: | 
| 35 | 
            +
            			'<div style="padding:20px;">',
         | 
| 29 36 | 
             
            			//tabs
         | 
| 30 37 | 
             
            			'<div class="tabs"></div>',
         | 
| 31 | 
            -
            			// | 
| 32 | 
            -
            			'<div class="ke-dialog-row">',
         | 
| 38 | 
            +
            			//remote image - start
         | 
| 33 39 | 
             
            			'<div class="tab1" style="display:none;">',
         | 
| 34 | 
            -
            			 | 
| 35 | 
            -
            			'< | 
| 40 | 
            +
            			//url
         | 
| 41 | 
            +
            			'<div class="ke-dialog-row">',
         | 
| 42 | 
            +
            			'<label for="remoteUrl" style="width:60px;">' + lang.remoteUrl + '</label>',
         | 
| 43 | 
            +
            			'<input type="text" id="remoteUrl" class="ke-input-text" name="url" value="" style="width:200px;" />  ',
         | 
| 36 44 | 
             
            			'<span class="ke-button-common ke-button-outer">',
         | 
| 37 45 | 
             
            			'<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />',
         | 
| 38 46 | 
             
            			'</span>',
         | 
| 39 47 | 
             
            			'</div>',
         | 
| 40 | 
            -
            			'<div class="tab2" style="display:none;">',
         | 
| 41 | 
            -
            			'<label style="width:60px;">' + lang.localUrl + '</label>',
         | 
| 42 | 
            -
            			'<input type="text" name="localUrl" class="ke-input-text" tabindex="-1" style="width:200px;" readonly="true" />  ',
         | 
| 43 | 
            -
            			'<input type="button" class="ke-upload-button" value="' + lang.viewServer + '" />',
         | 
| 44 | 
            -
            			'</div>',
         | 
| 45 | 
            -
            			'</div>',
         | 
| 46 48 | 
             
            			//size
         | 
| 47 49 | 
             
            			'<div class="ke-dialog-row">',
         | 
| 48 | 
            -
            			'<label for=" | 
| 49 | 
            -
            			lang.width + ' <input type="text" id=" | 
| 50 | 
            +
            			'<label for="remoteWidth" style="width:60px;">' + lang.size + '</label>',
         | 
| 51 | 
            +
            			lang.width + ' <input type="text" id="remoteWidth" class="ke-input-text ke-input-number" name="width" value="" maxlength="4" /> ',
         | 
| 50 52 | 
             
            			lang.height + ' <input type="text" class="ke-input-text ke-input-number" name="height" value="" maxlength="4" /> ',
         | 
| 51 53 | 
             
            			'<img class="ke-refresh-btn" src="' + imgPath + 'refresh.png" width="16" height="16" alt="" style="cursor:pointer;" title="' + lang.resetSize + '" />',
         | 
| 52 54 | 
             
            			'</div>',
         | 
| @@ -59,12 +61,28 @@ KindEditor.plugin('image', function(K) { | |
| 59 61 | 
             
            			'</div>',
         | 
| 60 62 | 
             
            			//title
         | 
| 61 63 | 
             
            			'<div class="ke-dialog-row">',
         | 
| 62 | 
            -
            			'<label for=" | 
| 63 | 
            -
            			'<input type="text" id=" | 
| 64 | 
            +
            			'<label for="remoteTitle" style="width:60px;">' + lang.imgTitle + '</label>',
         | 
| 65 | 
            +
            			'<input type="text" id="remoteTitle" class="ke-input-text" name="title" value="" style="width:200px;" />',
         | 
| 66 | 
            +
            			'</div>',
         | 
| 67 | 
            +
            			'</div>',
         | 
| 68 | 
            +
            			//remote image - end
         | 
| 69 | 
            +
            			//local upload - start
         | 
| 70 | 
            +
            			'<div class="tab2" style="display:none;">',
         | 
| 71 | 
            +
            			'<iframe name="' + target + '" style="display:none;"></iframe>',
         | 
| 72 | 
            +
            			'<form class="ke-upload-area ke-form" method="post" enctype="multipart/form-data" target="' + target + '" action="' + K.addParam(uploadJson, 'dir=image') + '">',
         | 
| 73 | 
            +
            			//file
         | 
| 74 | 
            +
            			'<div class="ke-dialog-row">',
         | 
| 75 | 
            +
            			hiddenElements.join(''),
         | 
| 76 | 
            +
            			'<label style="width:60px;">' + lang.localUrl + '</label>',
         | 
| 77 | 
            +
            			'<input type="text" name="localUrl" class="ke-input-text" tabindex="-1" style="width:200px;" readonly="true" />  ',
         | 
| 78 | 
            +
            			'<input type="button" class="ke-upload-button" value="' + lang.upload + '" />',
         | 
| 79 | 
            +
            			'</div>',
         | 
| 80 | 
            +
            			'</form>',
         | 
| 64 81 | 
             
            			'</div>',
         | 
| 82 | 
            +
            			//local upload - end
         | 
| 65 83 | 
             
            			'</div>'
         | 
| 66 84 | 
             
            		].join('');
         | 
| 67 | 
            -
            		var dialogWidth = allowImageUpload ? 450 : 400 | 
| 85 | 
            +
            		var dialogWidth = allowImageUpload ? 450 : 400,
         | 
| 68 86 | 
             
            			dialogHeight = allowImageUpload ? 300 : 250;
         | 
| 69 87 | 
             
            		var dialog = self.createDialog({
         | 
| 70 88 | 
             
            			name : name,
         | 
| @@ -75,6 +93,10 @@ KindEditor.plugin('image', function(K) { | |
| 75 93 | 
             
            			yesBtn : {
         | 
| 76 94 | 
             
            				name : self.lang('yes'),
         | 
| 77 95 | 
             
            				click : function(e) {
         | 
| 96 | 
            +
            					// Bugfix: http://code.google.com/p/kindeditor/issues/detail?id=319
         | 
| 97 | 
            +
            					if (dialog.isLoading) {
         | 
| 98 | 
            +
            						return;
         | 
| 99 | 
            +
            					}
         | 
| 78 100 | 
             
            					// insert local image
         | 
| 79 101 | 
             
            					if (tabs && tabs.selectedIndex === 1) {
         | 
| 80 102 | 
             
            						if (uploadbutton.fileBox.val() == '') {
         | 
| @@ -121,15 +143,24 @@ KindEditor.plugin('image', function(K) { | |
| 121 143 | 
             
            				widthBox.unbind();
         | 
| 122 144 | 
             
            				heightBox.unbind();
         | 
| 123 145 | 
             
            				refreshBtn.unbind();
         | 
| 124 | 
            -
            				//uploadbutton.remove();
         | 
| 125 146 | 
             
            			}
         | 
| 126 147 | 
             
            		}),
         | 
| 127 148 | 
             
            		div = dialog.div;
         | 
| 128 149 |  | 
| 150 | 
            +
            		var urlBox = K('[name="url"]', div),
         | 
| 151 | 
            +
            			localUrlBox = K('[name="localUrl"]', div),
         | 
| 152 | 
            +
            			viewServerBtn = K('[name="viewServer"]', div),
         | 
| 153 | 
            +
            			widthBox = K('.tab1 [name="width"]', div),
         | 
| 154 | 
            +
            			heightBox = K('.tab1 [name="height"]', div),
         | 
| 155 | 
            +
            			refreshBtn = K('.ke-refresh-btn', div),
         | 
| 156 | 
            +
            			titleBox = K('.tab1 [name="title"]', div),
         | 
| 157 | 
            +
            			alignBox = K('.tab1 [name="align"]', div);
         | 
| 158 | 
            +
             | 
| 129 159 | 
             
            		var tabs;
         | 
| 130 160 | 
             
            		if (allowImageUpload) {
         | 
| 131 161 | 
             
            			tabs = K.tabs({
         | 
| 132 | 
            -
            				src : K('.tabs', div)
         | 
| 162 | 
            +
            				src : K('.tabs', div),
         | 
| 163 | 
            +
            				afterSelect : function(i) {}
         | 
| 133 164 | 
             
            			});
         | 
| 134 165 | 
             
            			tabs.add({
         | 
| 135 166 | 
             
            				title : lang.remoteImage,
         | 
| @@ -144,35 +175,21 @@ KindEditor.plugin('image', function(K) { | |
| 144 175 | 
             
            			K('.tab1', div).show();
         | 
| 145 176 | 
             
            		}
         | 
| 146 177 |  | 
| 147 | 
            -
            		var urlBox = K('[name="url"]', div),
         | 
| 148 | 
            -
            			localUrlBox = K('[name="localUrl"]', div),
         | 
| 149 | 
            -
            			viewServerBtn = K('[name="viewServer"]', div),
         | 
| 150 | 
            -
            			widthBox = K('[name="width"]', div),
         | 
| 151 | 
            -
            			heightBox = K('[name="height"]', div),
         | 
| 152 | 
            -
            			refreshBtn = K('.ke-refresh-btn', div),
         | 
| 153 | 
            -
            			titleBox = K('[name="title"]', div),
         | 
| 154 | 
            -
            			alignBox = K('[name="align"]');
         | 
| 155 | 
            -
             | 
| 156 178 | 
             
            		var uploadbutton = K.uploadbutton({
         | 
| 157 179 | 
             
            			button : K('.ke-upload-button', div)[0],
         | 
| 158 180 | 
             
            			fieldName : 'imgFile',
         | 
| 159 181 | 
             
            			url : K.addParam(uploadJson, 'dir=image'),
         | 
| 182 | 
            +
            			form : K('.ke-form', div),
         | 
| 183 | 
            +
            			target : target,
         | 
| 160 184 | 
             
            			width: 60,
         | 
| 161 185 | 
             
            			afterUpload : function(data) {
         | 
| 162 186 | 
             
            				dialog.hideLoading();
         | 
| 163 187 | 
             
            				if (data.error === 0) {
         | 
| 164 | 
            -
            					var  | 
| 165 | 
            -
             | 
| 166 | 
            -
            						 | 
| 167 | 
            -
             | 
| 168 | 
            -
            					 | 
| 169 | 
            -
            						if (this.checked) {
         | 
| 170 | 
            -
            							align = this.value;
         | 
| 171 | 
            -
            							return false;
         | 
| 172 | 
            -
            						}
         | 
| 173 | 
            -
            					});
         | 
| 174 | 
            -
            					var url = K.formatUrl(data.url, 'absolute');
         | 
| 175 | 
            -
            					clickFn.call(self, url, title, width, height, 0, align);
         | 
| 188 | 
            +
            					var url = data.url;
         | 
| 189 | 
            +
            					if (formatUploadUrl) {
         | 
| 190 | 
            +
            						url = K.formatUrl(url, 'absolute');
         | 
| 191 | 
            +
            					}
         | 
| 192 | 
            +
            					clickFn.call(self, url, '', '', '', 0, '');
         | 
| 176 193 | 
             
            					if (self.afterUpload) {
         | 
| 177 194 | 
             
            						self.afterUpload.call(self, url);
         | 
| 178 195 | 
             
            					}
         | 
| @@ -271,7 +288,11 @@ KindEditor.plugin('image', function(K) { | |
| 271 288 | 
             
            			});
         | 
| 272 289 | 
             
            		},
         | 
| 273 290 | 
             
            		'delete' : function() {
         | 
| 274 | 
            -
            			self.plugin.getSelectedImage() | 
| 291 | 
            +
            			var target = self.plugin.getSelectedImage();
         | 
| 292 | 
            +
            			if (target.parent().name == 'a') {
         | 
| 293 | 
            +
            				target = target.parent();
         | 
| 294 | 
            +
            			}
         | 
| 295 | 
            +
            			target.remove();
         | 
| 275 296 | 
             
            		}
         | 
| 276 297 | 
             
            	};
         | 
| 277 298 | 
             
            	self.clickToolbar(name, self.plugin.image.edit);
         | 
| @@ -11,15 +11,16 @@ KindEditor.plugin('insertfile', function(K) { | |
| 11 11 | 
             
            	var self = this, name = 'insertfile',
         | 
| 12 12 | 
             
            		allowFileUpload = K.undef(self.allowFileUpload, true),
         | 
| 13 13 | 
             
            		allowFileManager = K.undef(self.allowFileManager, false),
         | 
| 14 | 
            +
            		formatUploadUrl = K.undef(self.formatUploadUrl, true),
         | 
| 14 15 | 
             
            		uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'),
         | 
| 16 | 
            +
            		extraParams = K.undef(self.extraFileUploadParams, {}),
         | 
| 15 17 | 
             
            		lang = self.lang(name + '.');
         | 
| 16 | 
            -
            	
         | 
| 17 18 | 
             
            	self.plugin.fileDialog = function(options) {
         | 
| 18 19 | 
             
            		var fileUrl = K.undef(options.fileUrl, 'http://'),
         | 
| 19 20 | 
             
            			fileTitle = K.undef(options.fileTitle, ''),
         | 
| 20 21 | 
             
            			clickFn = options.clickFn;
         | 
| 21 22 | 
             
            		var html = [
         | 
| 22 | 
            -
            			'<div style="padding: | 
| 23 | 
            +
            			'<div style="padding:20px;">',
         | 
| 23 24 | 
             
            			'<div class="ke-dialog-row">',
         | 
| 24 25 | 
             
            			'<label for="keUrl" style="width:60px;">' + lang.url + '</label>',
         | 
| 25 26 | 
             
            			'<input type="text" id="keUrl" name="url" class="ke-input-text" style="width:160px;" />  ',
         | 
| @@ -40,7 +41,6 @@ KindEditor.plugin('insertfile', function(K) { | |
| 40 41 | 
             
            		var dialog = self.createDialog({
         | 
| 41 42 | 
             
            			name : name,
         | 
| 42 43 | 
             
            			width : 450,
         | 
| 43 | 
            -
            			height : 180,
         | 
| 44 44 | 
             
            			title : self.lang(name),
         | 
| 45 45 | 
             
            			body : html,
         | 
| 46 46 | 
             
            			yesBtn : {
         | 
| @@ -71,10 +71,14 @@ KindEditor.plugin('insertfile', function(K) { | |
| 71 71 | 
             
            				button : K('.ke-upload-button', div)[0],
         | 
| 72 72 | 
             
            				fieldName : 'imgFile',
         | 
| 73 73 | 
             
            				url : K.addParam(uploadJson, 'dir=file'),
         | 
| 74 | 
            +
            				extraParams : extraParams,
         | 
| 74 75 | 
             
            				afterUpload : function(data) {
         | 
| 75 76 | 
             
            					dialog.hideLoading();
         | 
| 76 77 | 
             
            					if (data.error === 0) {
         | 
| 77 | 
            -
            						var url =  | 
| 78 | 
            +
            						var url = data.url;
         | 
| 79 | 
            +
            						if (formatUploadUrl) {
         | 
| 80 | 
            +
            							url = K.formatUrl(url, 'absolute');
         | 
| 81 | 
            +
            						}
         | 
| 78 82 | 
             
            						urlBox.val(url);
         | 
| 79 83 | 
             
            						if (self.afterUpload) {
         | 
| 80 84 | 
             
            							self.afterUpload.call(self, url);
         | 
| @@ -95,7 +99,6 @@ KindEditor.plugin('insertfile', function(K) { | |
| 95 99 | 
             
            			});
         | 
| 96 100 | 
             
            		} else {
         | 
| 97 101 | 
             
            			K('.ke-upload-button', div).hide();
         | 
| 98 | 
            -
            			urlBox.width(250);
         | 
| 99 102 | 
             
            		}
         | 
| 100 103 | 
             
            		if (allowFileManager) {
         | 
| 101 104 | 
             
            			viewServerBtn.click(function(e) {
         | 
| @@ -12,20 +12,20 @@ KindEditor.plugin('link', function(K) { | |
| 12 12 | 
             
            	self.plugin.link = {
         | 
| 13 13 | 
             
            		edit : function() {
         | 
| 14 14 | 
             
            			var lang = self.lang(name + '.'),
         | 
| 15 | 
            -
            				html = '<div style="padding: | 
| 15 | 
            +
            				html = '<div style="padding:20px;">' +
         | 
| 16 16 | 
             
            					//url
         | 
| 17 17 | 
             
            					'<div class="ke-dialog-row">' +
         | 
| 18 | 
            -
            					'<label for="keUrl">' + lang.url + '</label>' +
         | 
| 19 | 
            -
            					'<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width: | 
| 18 | 
            +
            					'<label for="keUrl" style="width:60px;">' + lang.url + '</label>' +
         | 
| 19 | 
            +
            					'<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:260px;" /></div>' +
         | 
| 20 20 | 
             
            					//type
         | 
| 21 21 | 
             
            					'<div class="ke-dialog-row"">' +
         | 
| 22 | 
            -
            					'<label for="keType">' + lang.linkType + '</label>' +
         | 
| 22 | 
            +
            					'<label for="keType" style="width:60px;">' + lang.linkType + '</label>' +
         | 
| 23 23 | 
             
            					'<select id="keType" name="type"></select>' +
         | 
| 24 24 | 
             
            					'</div>' +
         | 
| 25 25 | 
             
            					'</div>',
         | 
| 26 26 | 
             
            				dialog = self.createDialog({
         | 
| 27 27 | 
             
            					name : name,
         | 
| 28 | 
            -
            					width :  | 
| 28 | 
            +
            					width : 450,
         | 
| 29 29 | 
             
            					title : self.lang(name),
         | 
| 30 30 | 
             
            					body : html,
         | 
| 31 31 | 
             
            					yesBtn : {
         | 
| @@ -11,11 +11,13 @@ KindEditor.plugin('media', function(K) { | |
| 11 11 | 
             
            	var self = this, name = 'media', lang = self.lang(name + '.'),
         | 
| 12 12 | 
             
            		allowMediaUpload = K.undef(self.allowMediaUpload, true),
         | 
| 13 13 | 
             
            		allowFileManager = K.undef(self.allowFileManager, false),
         | 
| 14 | 
            +
            		formatUploadUrl = K.undef(self.formatUploadUrl, true),
         | 
| 15 | 
            +
            		extraParams = K.undef(self.extraFileUploadParams, {}),
         | 
| 14 16 | 
             
            		uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php');
         | 
| 15 17 | 
             
            	self.plugin.media = {
         | 
| 16 18 | 
             
            		edit : function() {
         | 
| 17 19 | 
             
            			var html = [
         | 
| 18 | 
            -
            				'<div style="padding: | 
| 20 | 
            +
            				'<div style="padding:20px;">',
         | 
| 19 21 | 
             
            				//url
         | 
| 20 22 | 
             
            				'<div class="ke-dialog-row">',
         | 
| 21 23 | 
             
            				'<label for="keUrl" style="width:60px;">' + lang.url + '</label>',
         | 
| @@ -93,11 +95,15 @@ KindEditor.plugin('media', function(K) { | |
| 93 95 | 
             
            				var uploadbutton = K.uploadbutton({
         | 
| 94 96 | 
             
            					button : K('.ke-upload-button', div)[0],
         | 
| 95 97 | 
             
            					fieldName : 'imgFile',
         | 
| 98 | 
            +
            					extraParams : extraParams,
         | 
| 96 99 | 
             
            					url : K.addParam(uploadJson, 'dir=media'),
         | 
| 97 100 | 
             
            					afterUpload : function(data) {
         | 
| 98 101 | 
             
            						dialog.hideLoading();
         | 
| 99 102 | 
             
            						if (data.error === 0) {
         | 
| 100 | 
            -
            							var url =  | 
| 103 | 
            +
            							var url = data.url;
         | 
| 104 | 
            +
            							if (formatUploadUrl) {
         | 
| 105 | 
            +
            								url = K.formatUrl(url, 'absolute');
         | 
| 106 | 
            +
            							}
         | 
| 101 107 | 
             
            							urlBox.val(url);
         | 
| 102 108 | 
             
            							if (self.afterUpload) {
         | 
| 103 109 | 
             
            								self.afterUpload.call(self, url);
         | 
| @@ -118,7 +124,6 @@ KindEditor.plugin('media', function(K) { | |
| 118 124 | 
             
            				});
         | 
| 119 125 | 
             
            			} else {
         | 
| 120 126 | 
             
            				K('.ke-upload-button', div).hide();
         | 
| 121 | 
            -
            				urlBox.width(250);
         | 
| 122 127 | 
             
            			}
         | 
| 123 128 |  | 
| 124 129 | 
             
            			if (allowFileManager) {
         | 
| Binary file | 
| Binary file | 
| @@ -0,0 +1,1368 @@ | |
| 1 | 
            +
            /*******************************************************************************
         | 
| 2 | 
            +
            * KindEditor - WYSIWYG HTML Editor for Internet
         | 
| 3 | 
            +
            * Copyright (C) 2006-2011 kindsoft.net
         | 
| 4 | 
            +
            *
         | 
| 5 | 
            +
            * @author Roddy <luolonghao@gmail.com>
         | 
| 6 | 
            +
            * @site http://www.kindsoft.net/
         | 
| 7 | 
            +
            * @licence http://www.kindsoft.net/license.php
         | 
| 8 | 
            +
            *******************************************************************************/
         | 
| 9 | 
            +
             | 
| 10 | 
            +
             | 
| 11 | 
            +
            (function(K) {
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            function KSWFUpload(options) {
         | 
| 14 | 
            +
            	this.init(options);
         | 
| 15 | 
            +
            }
         | 
| 16 | 
            +
            K.extend(KSWFUpload, {
         | 
| 17 | 
            +
            	init : function(options) {
         | 
| 18 | 
            +
            		var self = this;
         | 
| 19 | 
            +
            		options.afterError = options.afterError || function(str) {
         | 
| 20 | 
            +
            			alert(str);
         | 
| 21 | 
            +
            		};
         | 
| 22 | 
            +
            		self.options = options;
         | 
| 23 | 
            +
            		self.progressbars = {};
         | 
| 24 | 
            +
            		// template
         | 
| 25 | 
            +
            		self.div = K(options.container).html([
         | 
| 26 | 
            +
            			'<div class="ke-swfupload">',
         | 
| 27 | 
            +
            			'<div class="ke-swfupload-top">',
         | 
| 28 | 
            +
            			'<div class="ke-inline-block ke-swfupload-button">',
         | 
| 29 | 
            +
            			'<input type="button" value="Browse" />',
         | 
| 30 | 
            +
            			'</div>',
         | 
| 31 | 
            +
            			'<div class="ke-inline-block ke-swfupload-desc">' + options.uploadDesc + '</div>',
         | 
| 32 | 
            +
            			'<span class="ke-button-common ke-button-outer ke-swfupload-startupload">',
         | 
| 33 | 
            +
            			'<input type="button" class="ke-button-common ke-button" value="' + options.startButtonValue + '" />',
         | 
| 34 | 
            +
            			'</span>',
         | 
| 35 | 
            +
            			'</div>',
         | 
| 36 | 
            +
            			'<div class="ke-swfupload-body"></div>',
         | 
| 37 | 
            +
            			'</div>'
         | 
| 38 | 
            +
            		].join(''));
         | 
| 39 | 
            +
            		self.bodyDiv = K('.ke-swfupload-body', self.div);
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            		function showError(itemDiv, msg) {
         | 
| 42 | 
            +
            			K('.ke-status > div', itemDiv).hide();
         | 
| 43 | 
            +
            			K('.ke-message', itemDiv).addClass('ke-error').show().html(K.escape(msg));
         | 
| 44 | 
            +
            		}
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            		var settings = {
         | 
| 47 | 
            +
            			debug : false,
         | 
| 48 | 
            +
            			upload_url : options.uploadUrl,
         | 
| 49 | 
            +
            			flash_url : options.flashUrl,
         | 
| 50 | 
            +
            			file_post_name : options.filePostName,
         | 
| 51 | 
            +
            			button_placeholder : K('.ke-swfupload-button > input', self.div)[0],
         | 
| 52 | 
            +
            			button_image_url: options.buttonImageUrl,
         | 
| 53 | 
            +
            			button_width: options.buttonWidth,
         | 
| 54 | 
            +
            			button_height: options.buttonHeight,
         | 
| 55 | 
            +
            			button_cursor : SWFUpload.CURSOR.HAND,
         | 
| 56 | 
            +
            			file_types : options.fileTypes,
         | 
| 57 | 
            +
            			file_types_description : options.fileTypesDesc,
         | 
| 58 | 
            +
            			file_upload_limit : options.fileUploadLimit,
         | 
| 59 | 
            +
            			file_size_limit : options.fileSizeLimit,
         | 
| 60 | 
            +
            			file_queued_handler : function(file) {
         | 
| 61 | 
            +
            				file.url = self.options.fileIconUrl;
         | 
| 62 | 
            +
            				self.appendFile(file);
         | 
| 63 | 
            +
            			},
         | 
| 64 | 
            +
            			file_queue_error_handler : function(file, errorCode, message) {
         | 
| 65 | 
            +
            				var errorName = '';
         | 
| 66 | 
            +
            				switch (errorCode) {
         | 
| 67 | 
            +
            					case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
         | 
| 68 | 
            +
            						errorName = options.queueLimitExceeded;
         | 
| 69 | 
            +
            						break;
         | 
| 70 | 
            +
            					case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
         | 
| 71 | 
            +
            						errorName = options.fileExceedsSizeLimit;
         | 
| 72 | 
            +
            						break;
         | 
| 73 | 
            +
            					case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
         | 
| 74 | 
            +
            						errorName = options.zeroByteFile;
         | 
| 75 | 
            +
            						break;
         | 
| 76 | 
            +
            					case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
         | 
| 77 | 
            +
            						errorName = options.invalidFiletype;
         | 
| 78 | 
            +
            						break;
         | 
| 79 | 
            +
            					default:
         | 
| 80 | 
            +
            						errorName = options.unknownError;
         | 
| 81 | 
            +
            						break;
         | 
| 82 | 
            +
            				}
         | 
| 83 | 
            +
            				K.DEBUG && alert(errorName);
         | 
| 84 | 
            +
            			},
         | 
| 85 | 
            +
            			upload_start_handler : function(file) {
         | 
| 86 | 
            +
            				var self = this;
         | 
| 87 | 
            +
            				var itemDiv = K('div[data-id="' + file.id + '"]', self.bodyDiv);
         | 
| 88 | 
            +
            				K('.ke-status > div', itemDiv).hide();
         | 
| 89 | 
            +
            				K('.ke-progressbar', itemDiv).show();
         | 
| 90 | 
            +
            			},
         | 
| 91 | 
            +
            			upload_progress_handler : function(file, bytesLoaded, bytesTotal) {
         | 
| 92 | 
            +
            				var percent = Math.round(bytesLoaded * 100 / bytesTotal);
         | 
| 93 | 
            +
            				var progressbar = self.progressbars[file.id];
         | 
| 94 | 
            +
            				progressbar.bar.css('width', Math.round(percent * 80 / 100) + 'px');
         | 
| 95 | 
            +
            				progressbar.percent.html(percent + '%');
         | 
| 96 | 
            +
            			},
         | 
| 97 | 
            +
            			upload_error_handler : function(file, errorCode, message) {
         | 
| 98 | 
            +
            				if (file && file.filestatus == SWFUpload.FILE_STATUS.ERROR) {
         | 
| 99 | 
            +
            					var itemDiv = K('div[data-id="' + file.id + '"]', self.bodyDiv).eq(0);
         | 
| 100 | 
            +
            					showError(itemDiv, self.options.errorMessage);
         | 
| 101 | 
            +
            				}
         | 
| 102 | 
            +
            			},
         | 
| 103 | 
            +
            			upload_success_handler : function(file, serverData) {
         | 
| 104 | 
            +
            				var itemDiv = K('div[data-id="' + file.id + '"]', self.bodyDiv).eq(0);
         | 
| 105 | 
            +
            				var data = {};
         | 
| 106 | 
            +
            				try {
         | 
| 107 | 
            +
            					data = K.json(serverData);
         | 
| 108 | 
            +
            				} catch (e) {
         | 
| 109 | 
            +
            					self.options.afterError.call(this, '<!doctype html><html>' + serverData + '</html>');
         | 
| 110 | 
            +
            				}
         | 
| 111 | 
            +
            				if (data.error !== 0) {
         | 
| 112 | 
            +
            					showError(itemDiv, K.DEBUG ? data.message : self.options.errorMessage);
         | 
| 113 | 
            +
            					return;
         | 
| 114 | 
            +
            				}
         | 
| 115 | 
            +
            				file.url = data.url;
         | 
| 116 | 
            +
            				K('.ke-img', itemDiv).attr('src', file.url).attr('data-status', file.filestatus);
         | 
| 117 | 
            +
            				K('.ke-status > div', itemDiv).hide();
         | 
| 118 | 
            +
            			}
         | 
| 119 | 
            +
            		};
         | 
| 120 | 
            +
            		self.swfu = new SWFUpload(settings);
         | 
| 121 | 
            +
             | 
| 122 | 
            +
            		K('.ke-swfupload-startupload input', self.div).click(function() {
         | 
| 123 | 
            +
            			self.swfu.startUpload();
         | 
| 124 | 
            +
            		});
         | 
| 125 | 
            +
            	},
         | 
| 126 | 
            +
            	getUrlList : function() {
         | 
| 127 | 
            +
            		var list = [];
         | 
| 128 | 
            +
            		K('.ke-img', self.bodyDiv).each(function() {
         | 
| 129 | 
            +
            			var img = K(this);
         | 
| 130 | 
            +
            			var url = img.attr('src');
         | 
| 131 | 
            +
            			var status = img.attr('data-status');
         | 
| 132 | 
            +
            			if (status == SWFUpload.FILE_STATUS.COMPLETE) {
         | 
| 133 | 
            +
            				list.push(url);
         | 
| 134 | 
            +
            			}
         | 
| 135 | 
            +
            		});
         | 
| 136 | 
            +
            		return list;
         | 
| 137 | 
            +
            	},
         | 
| 138 | 
            +
            	removeFile : function(fileId) {
         | 
| 139 | 
            +
            		var self = this;
         | 
| 140 | 
            +
            		self.swfu.cancelUpload(fileId);
         | 
| 141 | 
            +
            		var itemDiv = K('div[data-id="' + fileId + '"]', self.bodyDiv);
         | 
| 142 | 
            +
            		K('.ke-photo', itemDiv).unbind();
         | 
| 143 | 
            +
            		K('.ke-delete', itemDiv).unbind();
         | 
| 144 | 
            +
            		itemDiv.remove();
         | 
| 145 | 
            +
            	},
         | 
| 146 | 
            +
            	removeFiles : function() {
         | 
| 147 | 
            +
            		var self = this;
         | 
| 148 | 
            +
            		K('.ke-item', self.bodyDiv).each(function() {
         | 
| 149 | 
            +
            			self.removeFile(K(this).attr('data-id'));
         | 
| 150 | 
            +
            		});
         | 
| 151 | 
            +
            	},
         | 
| 152 | 
            +
            	appendFile : function(file) {
         | 
| 153 | 
            +
            		var self = this;
         | 
| 154 | 
            +
            		var itemDiv = K('<div class="ke-inline-block ke-item" data-id="' + file.id + '"></div>');
         | 
| 155 | 
            +
            		self.bodyDiv.append(itemDiv);
         | 
| 156 | 
            +
            		var photoDiv = K('<div class="ke-inline-block ke-photo"></div>')
         | 
| 157 | 
            +
            			.mouseover(function(e) {
         | 
| 158 | 
            +
            				K(this).addClass('ke-on');
         | 
| 159 | 
            +
            			})
         | 
| 160 | 
            +
            			.mouseout(function(e) {
         | 
| 161 | 
            +
            				K(this).removeClass('ke-on');
         | 
| 162 | 
            +
            			});
         | 
| 163 | 
            +
            		itemDiv.append(photoDiv);
         | 
| 164 | 
            +
             | 
| 165 | 
            +
            		var img = K('<img src="' + file.url + '" class="ke-img" data-status="' + file.filestatus + '" width="80" height="80" alt="' + file.name + '" />');
         | 
| 166 | 
            +
            		photoDiv.append(img);
         | 
| 167 | 
            +
            		K('<span class="ke-delete"></span>').appendTo(photoDiv).click(function() {
         | 
| 168 | 
            +
            			self.removeFile(file.id);
         | 
| 169 | 
            +
            		});
         | 
| 170 | 
            +
            		var statusDiv = K('<div class="ke-status"></div>').appendTo(photoDiv);
         | 
| 171 | 
            +
            		// progressbar
         | 
| 172 | 
            +
            		K(['<div class="ke-progressbar">',
         | 
| 173 | 
            +
            			'<div class="ke-progressbar-bar"><div class="ke-progressbar-bar-inner"></div></div>',
         | 
| 174 | 
            +
            			'<div class="ke-progressbar-percent">0%</div></div>'].join('')).hide().appendTo(statusDiv);
         | 
| 175 | 
            +
            		// message
         | 
| 176 | 
            +
            		K('<div class="ke-message">' + self.options.pendingMessage + '</div>').appendTo(statusDiv);
         | 
| 177 | 
            +
             | 
| 178 | 
            +
            		itemDiv.append('<div class="ke-name">' + file.name + '</div>');
         | 
| 179 | 
            +
             | 
| 180 | 
            +
            		self.progressbars[file.id] = {
         | 
| 181 | 
            +
            			bar : K('.ke-progressbar-bar-inner', photoDiv),
         | 
| 182 | 
            +
            			percent : K('.ke-progressbar-percent', photoDiv)
         | 
| 183 | 
            +
            		};
         | 
| 184 | 
            +
            	},
         | 
| 185 | 
            +
            	remove : function() {
         | 
| 186 | 
            +
            		this.removeFiles();
         | 
| 187 | 
            +
            		this.swfu.destroy();
         | 
| 188 | 
            +
            		this.div.html('');
         | 
| 189 | 
            +
            	}
         | 
| 190 | 
            +
            });
         | 
| 191 | 
            +
             | 
| 192 | 
            +
            K.swfupload = function(element, options) {
         | 
| 193 | 
            +
            	return new KSWFUpload(element, options);
         | 
| 194 | 
            +
            };
         | 
| 195 | 
            +
             | 
| 196 | 
            +
            })(KindEditor);
         | 
| 197 | 
            +
             | 
| 198 | 
            +
            KindEditor.plugin('multiimage', function(K) {
         | 
| 199 | 
            +
            	var self = this, name = 'multiimage',
         | 
| 200 | 
            +
            		formatUploadUrl = K.undef(self.formatUploadUrl, true),
         | 
| 201 | 
            +
            		uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'),
         | 
| 202 | 
            +
            		imgPath = self.pluginsPath + 'multiimage/images/',
         | 
| 203 | 
            +
            		imageSizeLimit = K.undef(self.imageSizeLimit, '1MB'),
         | 
| 204 | 
            +
            		imageFileTypes = K.undef(self.imageFileTypes, '*.jpg;*.gif;*.png'),
         | 
| 205 | 
            +
            		imageUploadLimit = K.undef(self.imageUploadLimit, 20),
         | 
| 206 | 
            +
            		lang = self.lang(name + '.');
         | 
| 207 | 
            +
             | 
| 208 | 
            +
            	self.plugin.multiImageDialog = function(options) {
         | 
| 209 | 
            +
            		var clickFn = options.clickFn,
         | 
| 210 | 
            +
            			uploadDesc = K.tmpl(lang.uploadDesc, {uploadLimit : imageUploadLimit, sizeLimit : imageSizeLimit});
         | 
| 211 | 
            +
            		var html = [
         | 
| 212 | 
            +
            			'<div style="padding:20px;">',
         | 
| 213 | 
            +
            			'<div class="swfupload">',
         | 
| 214 | 
            +
            			'</div>',
         | 
| 215 | 
            +
            			'</div>'
         | 
| 216 | 
            +
            		].join('');
         | 
| 217 | 
            +
            		var dialog = self.createDialog({
         | 
| 218 | 
            +
            			name : name,
         | 
| 219 | 
            +
            			width : 650,
         | 
| 220 | 
            +
            			height : 510,
         | 
| 221 | 
            +
            			title : self.lang(name),
         | 
| 222 | 
            +
            			body : html,
         | 
| 223 | 
            +
            			previewBtn : {
         | 
| 224 | 
            +
            				name : lang.insertAll,
         | 
| 225 | 
            +
            				click : function(e) {
         | 
| 226 | 
            +
            					clickFn.call(self, swfupload.getUrlList());
         | 
| 227 | 
            +
            				}
         | 
| 228 | 
            +
            			},
         | 
| 229 | 
            +
            			yesBtn : {
         | 
| 230 | 
            +
            				name : lang.clearAll,
         | 
| 231 | 
            +
            				click : function(e) {
         | 
| 232 | 
            +
            					swfupload.removeFiles();
         | 
| 233 | 
            +
            				}
         | 
| 234 | 
            +
            			},
         | 
| 235 | 
            +
            			beforeRemove : function() {
         | 
| 236 | 
            +
            				swfupload.remove();
         | 
| 237 | 
            +
            			}
         | 
| 238 | 
            +
            		}),
         | 
| 239 | 
            +
            		div = dialog.div;
         | 
| 240 | 
            +
             | 
| 241 | 
            +
            		var swfupload = K.swfupload({
         | 
| 242 | 
            +
            			container : K('.swfupload', div),
         | 
| 243 | 
            +
            			buttonImageUrl : imgPath + (self.langType == 'zh_CN' ? 'select-files-zh_CN.png' : 'select-files-en.png'),
         | 
| 244 | 
            +
            			buttonWidth : self.langType == 'zh_CN' ? 72 : 88,
         | 
| 245 | 
            +
            			buttonHeight : 23,
         | 
| 246 | 
            +
            			fileIconUrl : imgPath + 'image.png',
         | 
| 247 | 
            +
            			uploadDesc : uploadDesc,
         | 
| 248 | 
            +
            			startButtonValue : lang.startUpload,
         | 
| 249 | 
            +
            			uploadUrl : K.addParam(uploadJson, 'dir=image'),
         | 
| 250 | 
            +
            			flashUrl : imgPath + 'swfupload.swf',
         | 
| 251 | 
            +
            			filePostName : 'imgFile',
         | 
| 252 | 
            +
            			fileTypes : '*.jpg;*.jpeg;*.gif;*.png;*.bmp',
         | 
| 253 | 
            +
            			fileTypesDesc : 'Image Files',
         | 
| 254 | 
            +
            			fileUploadLimit : imageUploadLimit,
         | 
| 255 | 
            +
            			fileSizeLimit : imageSizeLimit,
         | 
| 256 | 
            +
            			queueLimitExceeded : lang.queueLimitExceeded,
         | 
| 257 | 
            +
            			fileExceedsSizeLimit : lang.fileExceedsSizeLimit,
         | 
| 258 | 
            +
            			zeroByteFile : lang.zeroByteFile,
         | 
| 259 | 
            +
            			invalidFiletype : lang.invalidFiletype,
         | 
| 260 | 
            +
            			unknownError : lang.unknownError,
         | 
| 261 | 
            +
            			pendingMessage : lang.pending,
         | 
| 262 | 
            +
            			errorMessage : lang.uploadError,
         | 
| 263 | 
            +
            			afterError : function(html) {
         | 
| 264 | 
            +
            				self.errorDialog(html);
         | 
| 265 | 
            +
            			}
         | 
| 266 | 
            +
            		});
         | 
| 267 | 
            +
             | 
| 268 | 
            +
            		return dialog;
         | 
| 269 | 
            +
            	};
         | 
| 270 | 
            +
            	self.clickToolbar(name, function() {
         | 
| 271 | 
            +
            		self.plugin.multiImageDialog({
         | 
| 272 | 
            +
            			clickFn : function (urlList) {
         | 
| 273 | 
            +
            				if (urlList.length === 0) {
         | 
| 274 | 
            +
            					return;
         | 
| 275 | 
            +
            				}
         | 
| 276 | 
            +
            				var html = '';
         | 
| 277 | 
            +
            				K.each(urlList, function(i, url) {
         | 
| 278 | 
            +
            					html += '<img src="' + K.escape(url) + '" data-ke-src="' + K.escape(url) + '" alt="" /><br />';
         | 
| 279 | 
            +
            				});
         | 
| 280 | 
            +
            				self.insertHtml(html);
         | 
| 281 | 
            +
            				// Bugfix: [Firefox] 上传图片后,总是出现正在加载的样式,需要延迟执行hideDialog
         | 
| 282 | 
            +
            				setTimeout(function() {
         | 
| 283 | 
            +
            					self.hideDialog().focus();
         | 
| 284 | 
            +
            				}, 0);
         | 
| 285 | 
            +
            			}
         | 
| 286 | 
            +
            		});
         | 
| 287 | 
            +
            	});
         | 
| 288 | 
            +
            });
         | 
| 289 | 
            +
             | 
| 290 | 
            +
             | 
| 291 | 
            +
            /**
         | 
| 292 | 
            +
             * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
         | 
| 293 | 
            +
             *
         | 
| 294 | 
            +
             * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/,  http://www.vinterwebb.se/
         | 
| 295 | 
            +
             *
         | 
| 296 | 
            +
             * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilz閚 and Mammon Media and is released under the MIT License:
         | 
| 297 | 
            +
             * http://www.opensource.org/licenses/mit-license.php
         | 
| 298 | 
            +
             *
         | 
| 299 | 
            +
             * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
         | 
| 300 | 
            +
             * http://www.opensource.org/licenses/mit-license.php
         | 
| 301 | 
            +
             *
         | 
| 302 | 
            +
             */
         | 
| 303 | 
            +
             | 
| 304 | 
            +
             | 
| 305 | 
            +
            /* ******************* */
         | 
| 306 | 
            +
            /* Constructor & Init  */
         | 
| 307 | 
            +
            /* ******************* */
         | 
| 308 | 
            +
            var SWFUpload;
         | 
| 309 | 
            +
             | 
| 310 | 
            +
            if (SWFUpload == undefined) {
         | 
| 311 | 
            +
            	SWFUpload = function (settings) {
         | 
| 312 | 
            +
            		this.initSWFUpload(settings);
         | 
| 313 | 
            +
            	};
         | 
| 314 | 
            +
            }
         | 
| 315 | 
            +
             | 
| 316 | 
            +
            SWFUpload.prototype.initSWFUpload = function (settings) {
         | 
| 317 | 
            +
            	try {
         | 
| 318 | 
            +
            		this.customSettings = {};	// A container where developers can place their own settings associated with this instance.
         | 
| 319 | 
            +
            		this.settings = settings;
         | 
| 320 | 
            +
            		this.eventQueue = [];
         | 
| 321 | 
            +
            		this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
         | 
| 322 | 
            +
            		this.movieElement = null;
         | 
| 323 | 
            +
             | 
| 324 | 
            +
             | 
| 325 | 
            +
            		// Setup global control tracking
         | 
| 326 | 
            +
            		SWFUpload.instances[this.movieName] = this;
         | 
| 327 | 
            +
             | 
| 328 | 
            +
            		// Load the settings.  Load the Flash movie.
         | 
| 329 | 
            +
            		this.initSettings();
         | 
| 330 | 
            +
            		this.loadFlash();
         | 
| 331 | 
            +
            		this.displayDebugInfo();
         | 
| 332 | 
            +
            	} catch (ex) {
         | 
| 333 | 
            +
            		delete SWFUpload.instances[this.movieName];
         | 
| 334 | 
            +
            		throw ex;
         | 
| 335 | 
            +
            	}
         | 
| 336 | 
            +
            };
         | 
| 337 | 
            +
             | 
| 338 | 
            +
            /* *************** */
         | 
| 339 | 
            +
            /* Static Members  */
         | 
| 340 | 
            +
            /* *************** */
         | 
| 341 | 
            +
            SWFUpload.instances = {};
         | 
| 342 | 
            +
            SWFUpload.movieCount = 0;
         | 
| 343 | 
            +
            SWFUpload.version = "2.2.0 2009-03-25";
         | 
| 344 | 
            +
            SWFUpload.QUEUE_ERROR = {
         | 
| 345 | 
            +
            	QUEUE_LIMIT_EXCEEDED	  		: -100,
         | 
| 346 | 
            +
            	FILE_EXCEEDS_SIZE_LIMIT  		: -110,
         | 
| 347 | 
            +
            	ZERO_BYTE_FILE			  		: -120,
         | 
| 348 | 
            +
            	INVALID_FILETYPE		  		: -130
         | 
| 349 | 
            +
            };
         | 
| 350 | 
            +
            SWFUpload.UPLOAD_ERROR = {
         | 
| 351 | 
            +
            	HTTP_ERROR				  		: -200,
         | 
| 352 | 
            +
            	MISSING_UPLOAD_URL	      		: -210,
         | 
| 353 | 
            +
            	IO_ERROR				  		: -220,
         | 
| 354 | 
            +
            	SECURITY_ERROR			  		: -230,
         | 
| 355 | 
            +
            	UPLOAD_LIMIT_EXCEEDED	  		: -240,
         | 
| 356 | 
            +
            	UPLOAD_FAILED			  		: -250,
         | 
| 357 | 
            +
            	SPECIFIED_FILE_ID_NOT_FOUND		: -260,
         | 
| 358 | 
            +
            	FILE_VALIDATION_FAILED	  		: -270,
         | 
| 359 | 
            +
            	FILE_CANCELLED			  		: -280,
         | 
| 360 | 
            +
            	UPLOAD_STOPPED					: -290
         | 
| 361 | 
            +
            };
         | 
| 362 | 
            +
            SWFUpload.FILE_STATUS = {
         | 
| 363 | 
            +
            	QUEUED		 : -1,
         | 
| 364 | 
            +
            	IN_PROGRESS	 : -2,
         | 
| 365 | 
            +
            	ERROR		 : -3,
         | 
| 366 | 
            +
            	COMPLETE	 : -4,
         | 
| 367 | 
            +
            	CANCELLED	 : -5
         | 
| 368 | 
            +
            };
         | 
| 369 | 
            +
            SWFUpload.BUTTON_ACTION = {
         | 
| 370 | 
            +
            	SELECT_FILE  : -100,
         | 
| 371 | 
            +
            	SELECT_FILES : -110,
         | 
| 372 | 
            +
            	START_UPLOAD : -120
         | 
| 373 | 
            +
            };
         | 
| 374 | 
            +
            SWFUpload.CURSOR = {
         | 
| 375 | 
            +
            	ARROW : -1,
         | 
| 376 | 
            +
            	HAND : -2
         | 
| 377 | 
            +
            };
         | 
| 378 | 
            +
            SWFUpload.WINDOW_MODE = {
         | 
| 379 | 
            +
            	WINDOW : "window",
         | 
| 380 | 
            +
            	TRANSPARENT : "transparent",
         | 
| 381 | 
            +
            	OPAQUE : "opaque"
         | 
| 382 | 
            +
            };
         | 
| 383 | 
            +
             | 
| 384 | 
            +
            // Private: takes a URL, determines if it is relative and converts to an absolute URL
         | 
| 385 | 
            +
            // using the current site. Only processes the URL if it can, otherwise returns the URL untouched
         | 
| 386 | 
            +
            SWFUpload.completeURL = function(url) {
         | 
| 387 | 
            +
            	if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) {
         | 
| 388 | 
            +
            		return url;
         | 
| 389 | 
            +
            	}
         | 
| 390 | 
            +
             | 
| 391 | 
            +
            	var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
         | 
| 392 | 
            +
             | 
| 393 | 
            +
            	var indexSlash = window.location.pathname.lastIndexOf("/");
         | 
| 394 | 
            +
            	if (indexSlash <= 0) {
         | 
| 395 | 
            +
            		path = "/";
         | 
| 396 | 
            +
            	} else {
         | 
| 397 | 
            +
            		path = window.location.pathname.substr(0, indexSlash) + "/";
         | 
| 398 | 
            +
            	}
         | 
| 399 | 
            +
             | 
| 400 | 
            +
            	return /*currentURL +*/ path + url;
         | 
| 401 | 
            +
             | 
| 402 | 
            +
            };
         | 
| 403 | 
            +
             | 
| 404 | 
            +
             | 
| 405 | 
            +
            /* ******************** */
         | 
| 406 | 
            +
            /* Instance Members  */
         | 
| 407 | 
            +
            /* ******************** */
         | 
| 408 | 
            +
             | 
| 409 | 
            +
            // Private: initSettings ensures that all the
         | 
| 410 | 
            +
            // settings are set, getting a default value if one was not assigned.
         | 
| 411 | 
            +
            SWFUpload.prototype.initSettings = function () {
         | 
| 412 | 
            +
            	this.ensureDefault = function (settingName, defaultValue) {
         | 
| 413 | 
            +
            		this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
         | 
| 414 | 
            +
            	};
         | 
| 415 | 
            +
             | 
| 416 | 
            +
            	// Upload backend settings
         | 
| 417 | 
            +
            	this.ensureDefault("upload_url", "");
         | 
| 418 | 
            +
            	this.ensureDefault("preserve_relative_urls", false);
         | 
| 419 | 
            +
            	this.ensureDefault("file_post_name", "Filedata");
         | 
| 420 | 
            +
            	this.ensureDefault("post_params", {});
         | 
| 421 | 
            +
            	this.ensureDefault("use_query_string", false);
         | 
| 422 | 
            +
            	this.ensureDefault("requeue_on_error", false);
         | 
| 423 | 
            +
            	this.ensureDefault("http_success", []);
         | 
| 424 | 
            +
            	this.ensureDefault("assume_success_timeout", 0);
         | 
| 425 | 
            +
             | 
| 426 | 
            +
            	// File Settings
         | 
| 427 | 
            +
            	this.ensureDefault("file_types", "*.*");
         | 
| 428 | 
            +
            	this.ensureDefault("file_types_description", "All Files");
         | 
| 429 | 
            +
            	this.ensureDefault("file_size_limit", 0);	// Default zero means "unlimited"
         | 
| 430 | 
            +
            	this.ensureDefault("file_upload_limit", 0);
         | 
| 431 | 
            +
            	this.ensureDefault("file_queue_limit", 0);
         | 
| 432 | 
            +
             | 
| 433 | 
            +
            	// Flash Settings
         | 
| 434 | 
            +
            	this.ensureDefault("flash_url", "swfupload.swf");
         | 
| 435 | 
            +
            	this.ensureDefault("prevent_swf_caching", true);
         | 
| 436 | 
            +
             | 
| 437 | 
            +
            	// Button Settings
         | 
| 438 | 
            +
            	this.ensureDefault("button_image_url", "");
         | 
| 439 | 
            +
            	this.ensureDefault("button_width", 1);
         | 
| 440 | 
            +
            	this.ensureDefault("button_height", 1);
         | 
| 441 | 
            +
            	this.ensureDefault("button_text", "");
         | 
| 442 | 
            +
            	this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");
         | 
| 443 | 
            +
            	this.ensureDefault("button_text_top_padding", 0);
         | 
| 444 | 
            +
            	this.ensureDefault("button_text_left_padding", 0);
         | 
| 445 | 
            +
            	this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
         | 
| 446 | 
            +
            	this.ensureDefault("button_disabled", false);
         | 
| 447 | 
            +
            	this.ensureDefault("button_placeholder_id", "");
         | 
| 448 | 
            +
            	this.ensureDefault("button_placeholder", null);
         | 
| 449 | 
            +
            	this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
         | 
| 450 | 
            +
            	this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
         | 
| 451 | 
            +
             | 
| 452 | 
            +
            	// Debug Settings
         | 
| 453 | 
            +
            	this.ensureDefault("debug", false);
         | 
| 454 | 
            +
            	this.settings.debug_enabled = this.settings.debug;	// Here to maintain v2 API
         | 
| 455 | 
            +
             | 
| 456 | 
            +
            	// Event Handlers
         | 
| 457 | 
            +
            	this.settings.return_upload_start_handler = this.returnUploadStart;
         | 
| 458 | 
            +
            	this.ensureDefault("swfupload_loaded_handler", null);
         | 
| 459 | 
            +
            	this.ensureDefault("file_dialog_start_handler", null);
         | 
| 460 | 
            +
            	this.ensureDefault("file_queued_handler", null);
         | 
| 461 | 
            +
            	this.ensureDefault("file_queue_error_handler", null);
         | 
| 462 | 
            +
            	this.ensureDefault("file_dialog_complete_handler", null);
         | 
| 463 | 
            +
             | 
| 464 | 
            +
            	this.ensureDefault("upload_start_handler", null);
         | 
| 465 | 
            +
            	this.ensureDefault("upload_progress_handler", null);
         | 
| 466 | 
            +
            	this.ensureDefault("upload_error_handler", null);
         | 
| 467 | 
            +
            	this.ensureDefault("upload_success_handler", null);
         | 
| 468 | 
            +
            	this.ensureDefault("upload_complete_handler", null);
         | 
| 469 | 
            +
             | 
| 470 | 
            +
            	this.ensureDefault("debug_handler", this.debugMessage);
         | 
| 471 | 
            +
             | 
| 472 | 
            +
            	this.ensureDefault("custom_settings", {});
         | 
| 473 | 
            +
             | 
| 474 | 
            +
            	// Other settings
         | 
| 475 | 
            +
            	this.customSettings = this.settings.custom_settings;
         | 
| 476 | 
            +
             | 
| 477 | 
            +
            	// Update the flash url if needed
         | 
| 478 | 
            +
            	if (!!this.settings.prevent_swf_caching) {
         | 
| 479 | 
            +
            		this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
         | 
| 480 | 
            +
            	}
         | 
| 481 | 
            +
             | 
| 482 | 
            +
            	if (!this.settings.preserve_relative_urls) {
         | 
| 483 | 
            +
            		//this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url);	// Don't need to do this one since flash doesn't look at it
         | 
| 484 | 
            +
            		this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
         | 
| 485 | 
            +
            		this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
         | 
| 486 | 
            +
            	}
         | 
| 487 | 
            +
             | 
| 488 | 
            +
            	delete this.ensureDefault;
         | 
| 489 | 
            +
            };
         | 
| 490 | 
            +
             | 
| 491 | 
            +
            // Private: loadFlash replaces the button_placeholder element with the flash movie.
         | 
| 492 | 
            +
            SWFUpload.prototype.loadFlash = function () {
         | 
| 493 | 
            +
            	var targetElement, tempParent;
         | 
| 494 | 
            +
             | 
| 495 | 
            +
            	// Make sure an element with the ID we are going to use doesn't already exist
         | 
| 496 | 
            +
            	if (document.getElementById(this.movieName) !== null) {
         | 
| 497 | 
            +
            		throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
         | 
| 498 | 
            +
            	}
         | 
| 499 | 
            +
             | 
| 500 | 
            +
            	// Get the element where we will be placing the flash movie
         | 
| 501 | 
            +
            	targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
         | 
| 502 | 
            +
             | 
| 503 | 
            +
            	if (targetElement == undefined) {
         | 
| 504 | 
            +
            		throw "Could not find the placeholder element: " + this.settings.button_placeholder_id;
         | 
| 505 | 
            +
            	}
         | 
| 506 | 
            +
             | 
| 507 | 
            +
            	// Append the container and load the flash
         | 
| 508 | 
            +
            	tempParent = document.createElement("div");
         | 
| 509 | 
            +
            	tempParent.innerHTML = this.getFlashHTML();	// Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
         | 
| 510 | 
            +
            	targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
         | 
| 511 | 
            +
             | 
| 512 | 
            +
            	// Fix IE Flash/Form bug
         | 
| 513 | 
            +
            	if (window[this.movieName] == undefined) {
         | 
| 514 | 
            +
            		window[this.movieName] = this.getMovieElement();
         | 
| 515 | 
            +
            	}
         | 
| 516 | 
            +
             | 
| 517 | 
            +
            };
         | 
| 518 | 
            +
             | 
| 519 | 
            +
            // Private: getFlashHTML generates the object tag needed to embed the flash in to the document
         | 
| 520 | 
            +
            SWFUpload.prototype.getFlashHTML = function () {
         | 
| 521 | 
            +
            	// Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
         | 
| 522 | 
            +
            	return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
         | 
| 523 | 
            +
            				'<param name="wmode" value="', this.settings.button_window_mode, '" />',
         | 
| 524 | 
            +
            				'<param name="movie" value="', this.settings.flash_url, '" />',
         | 
| 525 | 
            +
            				'<param name="quality" value="high" />',
         | 
| 526 | 
            +
            				'<param name="menu" value="false" />',
         | 
| 527 | 
            +
            				'<param name="allowScriptAccess" value="always" />',
         | 
| 528 | 
            +
            				'<param name="flashvars" value="' + this.getFlashVars() + '" />',
         | 
| 529 | 
            +
            				'</object>'].join("");
         | 
| 530 | 
            +
            };
         | 
| 531 | 
            +
             | 
| 532 | 
            +
            // Private: getFlashVars builds the parameter string that will be passed
         | 
| 533 | 
            +
            // to flash in the flashvars param.
         | 
| 534 | 
            +
            SWFUpload.prototype.getFlashVars = function () {
         | 
| 535 | 
            +
            	// Build a string from the post param object
         | 
| 536 | 
            +
            	var paramString = this.buildParamString();
         | 
| 537 | 
            +
            	var httpSuccessString = this.settings.http_success.join(",");
         | 
| 538 | 
            +
             | 
| 539 | 
            +
            	// Build the parameter string
         | 
| 540 | 
            +
            	return ["movieName=", encodeURIComponent(this.movieName),
         | 
| 541 | 
            +
            			"&uploadURL=", encodeURIComponent(this.settings.upload_url),
         | 
| 542 | 
            +
            			"&useQueryString=", encodeURIComponent(this.settings.use_query_string),
         | 
| 543 | 
            +
            			"&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
         | 
| 544 | 
            +
            			"&httpSuccess=", encodeURIComponent(httpSuccessString),
         | 
| 545 | 
            +
            			"&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout),
         | 
| 546 | 
            +
            			"&params=", encodeURIComponent(paramString),
         | 
| 547 | 
            +
            			"&filePostName=", encodeURIComponent(this.settings.file_post_name),
         | 
| 548 | 
            +
            			"&fileTypes=", encodeURIComponent(this.settings.file_types),
         | 
| 549 | 
            +
            			"&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description),
         | 
| 550 | 
            +
            			"&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit),
         | 
| 551 | 
            +
            			"&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit),
         | 
| 552 | 
            +
            			"&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit),
         | 
| 553 | 
            +
            			"&debugEnabled=", encodeURIComponent(this.settings.debug_enabled),
         | 
| 554 | 
            +
            			"&buttonImageURL=", encodeURIComponent(this.settings.button_image_url),
         | 
| 555 | 
            +
            			"&buttonWidth=", encodeURIComponent(this.settings.button_width),
         | 
| 556 | 
            +
            			"&buttonHeight=", encodeURIComponent(this.settings.button_height),
         | 
| 557 | 
            +
            			"&buttonText=", encodeURIComponent(this.settings.button_text),
         | 
| 558 | 
            +
            			"&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding),
         | 
| 559 | 
            +
            			"&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding),
         | 
| 560 | 
            +
            			"&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style),
         | 
| 561 | 
            +
            			"&buttonAction=", encodeURIComponent(this.settings.button_action),
         | 
| 562 | 
            +
            			"&buttonDisabled=", encodeURIComponent(this.settings.button_disabled),
         | 
| 563 | 
            +
            			"&buttonCursor=", encodeURIComponent(this.settings.button_cursor)
         | 
| 564 | 
            +
            		].join("");
         | 
| 565 | 
            +
            };
         | 
| 566 | 
            +
             | 
| 567 | 
            +
            // Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload
         | 
| 568 | 
            +
            // The element is cached after the first lookup
         | 
| 569 | 
            +
            SWFUpload.prototype.getMovieElement = function () {
         | 
| 570 | 
            +
            	if (this.movieElement == undefined) {
         | 
| 571 | 
            +
            		this.movieElement = document.getElementById(this.movieName);
         | 
| 572 | 
            +
            	}
         | 
| 573 | 
            +
             | 
| 574 | 
            +
            	if (this.movieElement === null) {
         | 
| 575 | 
            +
            		throw "Could not find Flash element";
         | 
| 576 | 
            +
            	}
         | 
| 577 | 
            +
             | 
| 578 | 
            +
            	return this.movieElement;
         | 
| 579 | 
            +
            };
         | 
| 580 | 
            +
             | 
| 581 | 
            +
            // Private: buildParamString takes the name/value pairs in the post_params setting object
         | 
| 582 | 
            +
            // and joins them up in to a string formatted "name=value&name=value"
         | 
| 583 | 
            +
            SWFUpload.prototype.buildParamString = function () {
         | 
| 584 | 
            +
            	var postParams = this.settings.post_params;
         | 
| 585 | 
            +
            	var paramStringPairs = [];
         | 
| 586 | 
            +
             | 
| 587 | 
            +
            	if (typeof(postParams) === "object") {
         | 
| 588 | 
            +
            		for (var name in postParams) {
         | 
| 589 | 
            +
            			if (postParams.hasOwnProperty(name)) {
         | 
| 590 | 
            +
            				paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
         | 
| 591 | 
            +
            			}
         | 
| 592 | 
            +
            		}
         | 
| 593 | 
            +
            	}
         | 
| 594 | 
            +
             | 
| 595 | 
            +
            	return paramStringPairs.join("&");
         | 
| 596 | 
            +
            };
         | 
| 597 | 
            +
             | 
| 598 | 
            +
            // Public: Used to remove a SWFUpload instance from the page. This method strives to remove
         | 
| 599 | 
            +
            // all references to the SWF, and other objects so memory is properly freed.
         | 
| 600 | 
            +
            // Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
         | 
| 601 | 
            +
            // Credits: Major improvements provided by steffen
         | 
| 602 | 
            +
            SWFUpload.prototype.destroy = function () {
         | 
| 603 | 
            +
            	try {
         | 
| 604 | 
            +
            		// Make sure Flash is done before we try to remove it
         | 
| 605 | 
            +
            		this.cancelUpload(null, false);
         | 
| 606 | 
            +
             | 
| 607 | 
            +
             | 
| 608 | 
            +
            		// Remove the SWFUpload DOM nodes
         | 
| 609 | 
            +
            		var movieElement = null;
         | 
| 610 | 
            +
            		movieElement = this.getMovieElement();
         | 
| 611 | 
            +
             | 
| 612 | 
            +
            		if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
         | 
| 613 | 
            +
            			// Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround)
         | 
| 614 | 
            +
            			for (var i in movieElement) {
         | 
| 615 | 
            +
            				try {
         | 
| 616 | 
            +
            					if (typeof(movieElement[i]) === "function") {
         | 
| 617 | 
            +
            						movieElement[i] = null;
         | 
| 618 | 
            +
            					}
         | 
| 619 | 
            +
            				} catch (ex1) {}
         | 
| 620 | 
            +
            			}
         | 
| 621 | 
            +
             | 
| 622 | 
            +
            			// Remove the Movie Element from the page
         | 
| 623 | 
            +
            			try {
         | 
| 624 | 
            +
            				movieElement.parentNode.removeChild(movieElement);
         | 
| 625 | 
            +
            			} catch (ex) {}
         | 
| 626 | 
            +
            		}
         | 
| 627 | 
            +
             | 
| 628 | 
            +
            		// Remove IE form fix reference
         | 
| 629 | 
            +
            		window[this.movieName] = null;
         | 
| 630 | 
            +
             | 
| 631 | 
            +
            		// Destroy other references
         | 
| 632 | 
            +
            		SWFUpload.instances[this.movieName] = null;
         | 
| 633 | 
            +
            		delete SWFUpload.instances[this.movieName];
         | 
| 634 | 
            +
             | 
| 635 | 
            +
            		this.movieElement = null;
         | 
| 636 | 
            +
            		this.settings = null;
         | 
| 637 | 
            +
            		this.customSettings = null;
         | 
| 638 | 
            +
            		this.eventQueue = null;
         | 
| 639 | 
            +
            		this.movieName = null;
         | 
| 640 | 
            +
             | 
| 641 | 
            +
             | 
| 642 | 
            +
            		return true;
         | 
| 643 | 
            +
            	} catch (ex2) {
         | 
| 644 | 
            +
            		return false;
         | 
| 645 | 
            +
            	}
         | 
| 646 | 
            +
            };
         | 
| 647 | 
            +
             | 
| 648 | 
            +
             | 
| 649 | 
            +
            // Public: displayDebugInfo prints out settings and configuration
         | 
| 650 | 
            +
            // information about this SWFUpload instance.
         | 
| 651 | 
            +
            // This function (and any references to it) can be deleted when placing
         | 
| 652 | 
            +
            // SWFUpload in production.
         | 
| 653 | 
            +
            SWFUpload.prototype.displayDebugInfo = function () {
         | 
| 654 | 
            +
            	this.debug(
         | 
| 655 | 
            +
            		[
         | 
| 656 | 
            +
            			"---SWFUpload Instance Info---\n",
         | 
| 657 | 
            +
            			"Version: ", SWFUpload.version, "\n",
         | 
| 658 | 
            +
            			"Movie Name: ", this.movieName, "\n",
         | 
| 659 | 
            +
            			"Settings:\n",
         | 
| 660 | 
            +
            			"\t", "upload_url:               ", this.settings.upload_url, "\n",
         | 
| 661 | 
            +
            			"\t", "flash_url:                ", this.settings.flash_url, "\n",
         | 
| 662 | 
            +
            			"\t", "use_query_string:         ", this.settings.use_query_string.toString(), "\n",
         | 
| 663 | 
            +
            			"\t", "requeue_on_error:         ", this.settings.requeue_on_error.toString(), "\n",
         | 
| 664 | 
            +
            			"\t", "http_success:             ", this.settings.http_success.join(", "), "\n",
         | 
| 665 | 
            +
            			"\t", "assume_success_timeout:   ", this.settings.assume_success_timeout, "\n",
         | 
| 666 | 
            +
            			"\t", "file_post_name:           ", this.settings.file_post_name, "\n",
         | 
| 667 | 
            +
            			"\t", "post_params:              ", this.settings.post_params.toString(), "\n",
         | 
| 668 | 
            +
            			"\t", "file_types:               ", this.settings.file_types, "\n",
         | 
| 669 | 
            +
            			"\t", "file_types_description:   ", this.settings.file_types_description, "\n",
         | 
| 670 | 
            +
            			"\t", "file_size_limit:          ", this.settings.file_size_limit, "\n",
         | 
| 671 | 
            +
            			"\t", "file_upload_limit:        ", this.settings.file_upload_limit, "\n",
         | 
| 672 | 
            +
            			"\t", "file_queue_limit:         ", this.settings.file_queue_limit, "\n",
         | 
| 673 | 
            +
            			"\t", "debug:                    ", this.settings.debug.toString(), "\n",
         | 
| 674 | 
            +
             | 
| 675 | 
            +
            			"\t", "prevent_swf_caching:      ", this.settings.prevent_swf_caching.toString(), "\n",
         | 
| 676 | 
            +
             | 
| 677 | 
            +
            			"\t", "button_placeholder_id:    ", this.settings.button_placeholder_id.toString(), "\n",
         | 
| 678 | 
            +
            			"\t", "button_placeholder:       ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n",
         | 
| 679 | 
            +
            			"\t", "button_image_url:         ", this.settings.button_image_url.toString(), "\n",
         | 
| 680 | 
            +
            			"\t", "button_width:             ", this.settings.button_width.toString(), "\n",
         | 
| 681 | 
            +
            			"\t", "button_height:            ", this.settings.button_height.toString(), "\n",
         | 
| 682 | 
            +
            			"\t", "button_text:              ", this.settings.button_text.toString(), "\n",
         | 
| 683 | 
            +
            			"\t", "button_text_style:        ", this.settings.button_text_style.toString(), "\n",
         | 
| 684 | 
            +
            			"\t", "button_text_top_padding:  ", this.settings.button_text_top_padding.toString(), "\n",
         | 
| 685 | 
            +
            			"\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",
         | 
| 686 | 
            +
            			"\t", "button_action:            ", this.settings.button_action.toString(), "\n",
         | 
| 687 | 
            +
            			"\t", "button_disabled:          ", this.settings.button_disabled.toString(), "\n",
         | 
| 688 | 
            +
             | 
| 689 | 
            +
            			"\t", "custom_settings:          ", this.settings.custom_settings.toString(), "\n",
         | 
| 690 | 
            +
            			"Event Handlers:\n",
         | 
| 691 | 
            +
            			"\t", "swfupload_loaded_handler assigned:  ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",
         | 
| 692 | 
            +
            			"\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",
         | 
| 693 | 
            +
            			"\t", "file_queued_handler assigned:       ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",
         | 
| 694 | 
            +
            			"\t", "file_queue_error_handler assigned:  ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",
         | 
| 695 | 
            +
            			"\t", "upload_start_handler assigned:      ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",
         | 
| 696 | 
            +
            			"\t", "upload_progress_handler assigned:   ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",
         | 
| 697 | 
            +
            			"\t", "upload_error_handler assigned:      ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",
         | 
| 698 | 
            +
            			"\t", "upload_success_handler assigned:    ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",
         | 
| 699 | 
            +
            			"\t", "upload_complete_handler assigned:   ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",
         | 
| 700 | 
            +
            			"\t", "debug_handler assigned:             ", (typeof this.settings.debug_handler === "function").toString(), "\n"
         | 
| 701 | 
            +
            		].join("")
         | 
| 702 | 
            +
            	);
         | 
| 703 | 
            +
            };
         | 
| 704 | 
            +
             | 
| 705 | 
            +
            /* Note: addSetting and getSetting are no longer used by SWFUpload but are included
         | 
| 706 | 
            +
            	the maintain v2 API compatibility
         | 
| 707 | 
            +
            */
         | 
| 708 | 
            +
            // Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
         | 
| 709 | 
            +
            SWFUpload.prototype.addSetting = function (name, value, default_value) {
         | 
| 710 | 
            +
                if (value == undefined) {
         | 
| 711 | 
            +
                    return (this.settings[name] = default_value);
         | 
| 712 | 
            +
                } else {
         | 
| 713 | 
            +
                    return (this.settings[name] = value);
         | 
| 714 | 
            +
            	}
         | 
| 715 | 
            +
            };
         | 
| 716 | 
            +
             | 
| 717 | 
            +
            // Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
         | 
| 718 | 
            +
            SWFUpload.prototype.getSetting = function (name) {
         | 
| 719 | 
            +
                if (this.settings[name] != undefined) {
         | 
| 720 | 
            +
                    return this.settings[name];
         | 
| 721 | 
            +
            	}
         | 
| 722 | 
            +
             | 
| 723 | 
            +
                return "";
         | 
| 724 | 
            +
            };
         | 
| 725 | 
            +
             | 
| 726 | 
            +
             | 
| 727 | 
            +
             | 
| 728 | 
            +
            // Private: callFlash handles function calls made to the Flash element.
         | 
| 729 | 
            +
            // Calls are made with a setTimeout for some functions to work around
         | 
| 730 | 
            +
            // bugs in the ExternalInterface library.
         | 
| 731 | 
            +
            SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
         | 
| 732 | 
            +
            	argumentArray = argumentArray || [];
         | 
| 733 | 
            +
             | 
| 734 | 
            +
            	var movieElement = this.getMovieElement();
         | 
| 735 | 
            +
            	var returnValue, returnString;
         | 
| 736 | 
            +
             | 
| 737 | 
            +
            	// Flash's method if calling ExternalInterface methods (code adapted from MooTools).
         | 
| 738 | 
            +
            	try {
         | 
| 739 | 
            +
            		returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
         | 
| 740 | 
            +
            		returnValue = eval(returnString);
         | 
| 741 | 
            +
            	} catch (ex) {
         | 
| 742 | 
            +
            		throw "Call to " + functionName + " failed";
         | 
| 743 | 
            +
            	}
         | 
| 744 | 
            +
             | 
| 745 | 
            +
            	// Unescape file post param values
         | 
| 746 | 
            +
            	if (returnValue != undefined && typeof returnValue.post === "object") {
         | 
| 747 | 
            +
            		returnValue = this.unescapeFilePostParams(returnValue);
         | 
| 748 | 
            +
            	}
         | 
| 749 | 
            +
             | 
| 750 | 
            +
            	return returnValue;
         | 
| 751 | 
            +
            };
         | 
| 752 | 
            +
             | 
| 753 | 
            +
            /* *****************************
         | 
| 754 | 
            +
            	-- Flash control methods --
         | 
| 755 | 
            +
            	Your UI should use these
         | 
| 756 | 
            +
            	to operate SWFUpload
         | 
| 757 | 
            +
               ***************************** */
         | 
| 758 | 
            +
             | 
| 759 | 
            +
            // WARNING: this function does not work in Flash Player 10
         | 
| 760 | 
            +
            // Public: selectFile causes a File Selection Dialog window to appear.  This
         | 
| 761 | 
            +
            // dialog only allows 1 file to be selected.
         | 
| 762 | 
            +
            SWFUpload.prototype.selectFile = function () {
         | 
| 763 | 
            +
            	this.callFlash("SelectFile");
         | 
| 764 | 
            +
            };
         | 
| 765 | 
            +
             | 
| 766 | 
            +
            // WARNING: this function does not work in Flash Player 10
         | 
| 767 | 
            +
            // Public: selectFiles causes a File Selection Dialog window to appear/ This
         | 
| 768 | 
            +
            // dialog allows the user to select any number of files
         | 
| 769 | 
            +
            // Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
         | 
| 770 | 
            +
            // If the selection name length is too long the dialog will fail in an unpredictable manner.  There is no work-around
         | 
| 771 | 
            +
            // for this bug.
         | 
| 772 | 
            +
            SWFUpload.prototype.selectFiles = function () {
         | 
| 773 | 
            +
            	this.callFlash("SelectFiles");
         | 
| 774 | 
            +
            };
         | 
| 775 | 
            +
             | 
| 776 | 
            +
             | 
| 777 | 
            +
            // Public: startUpload starts uploading the first file in the queue unless
         | 
| 778 | 
            +
            // the optional parameter 'fileID' specifies the ID
         | 
| 779 | 
            +
            SWFUpload.prototype.startUpload = function (fileID) {
         | 
| 780 | 
            +
            	this.callFlash("StartUpload", [fileID]);
         | 
| 781 | 
            +
            };
         | 
| 782 | 
            +
             | 
| 783 | 
            +
            // Public: cancelUpload cancels any queued file.  The fileID parameter may be the file ID or index.
         | 
| 784 | 
            +
            // If you do not specify a fileID the current uploading file or first file in the queue is cancelled.
         | 
| 785 | 
            +
            // If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter.
         | 
| 786 | 
            +
            SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) {
         | 
| 787 | 
            +
            	if (triggerErrorEvent !== false) {
         | 
| 788 | 
            +
            		triggerErrorEvent = true;
         | 
| 789 | 
            +
            	}
         | 
| 790 | 
            +
            	this.callFlash("CancelUpload", [fileID, triggerErrorEvent]);
         | 
| 791 | 
            +
            };
         | 
| 792 | 
            +
             | 
| 793 | 
            +
            // Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
         | 
| 794 | 
            +
            // If nothing is currently uploading then nothing happens.
         | 
| 795 | 
            +
            SWFUpload.prototype.stopUpload = function () {
         | 
| 796 | 
            +
            	this.callFlash("StopUpload");
         | 
| 797 | 
            +
            };
         | 
| 798 | 
            +
             | 
| 799 | 
            +
            /* ************************
         | 
| 800 | 
            +
             * Settings methods
         | 
| 801 | 
            +
             *   These methods change the SWFUpload settings.
         | 
| 802 | 
            +
             *   SWFUpload settings should not be changed directly on the settings object
         | 
| 803 | 
            +
             *   since many of the settings need to be passed to Flash in order to take
         | 
| 804 | 
            +
             *   effect.
         | 
| 805 | 
            +
             * *********************** */
         | 
| 806 | 
            +
             | 
| 807 | 
            +
            // Public: getStats gets the file statistics object.
         | 
| 808 | 
            +
            SWFUpload.prototype.getStats = function () {
         | 
| 809 | 
            +
            	return this.callFlash("GetStats");
         | 
| 810 | 
            +
            };
         | 
| 811 | 
            +
             | 
| 812 | 
            +
            // Public: setStats changes the SWFUpload statistics.  You shouldn't need to
         | 
| 813 | 
            +
            // change the statistics but you can.  Changing the statistics does not
         | 
| 814 | 
            +
            // affect SWFUpload accept for the successful_uploads count which is used
         | 
| 815 | 
            +
            // by the upload_limit setting to determine how many files the user may upload.
         | 
| 816 | 
            +
            SWFUpload.prototype.setStats = function (statsObject) {
         | 
| 817 | 
            +
            	this.callFlash("SetStats", [statsObject]);
         | 
| 818 | 
            +
            };
         | 
| 819 | 
            +
             | 
| 820 | 
            +
            // Public: getFile retrieves a File object by ID or Index.  If the file is
         | 
| 821 | 
            +
            // not found then 'null' is returned.
         | 
| 822 | 
            +
            SWFUpload.prototype.getFile = function (fileID) {
         | 
| 823 | 
            +
            	if (typeof(fileID) === "number") {
         | 
| 824 | 
            +
            		return this.callFlash("GetFileByIndex", [fileID]);
         | 
| 825 | 
            +
            	} else {
         | 
| 826 | 
            +
            		return this.callFlash("GetFile", [fileID]);
         | 
| 827 | 
            +
            	}
         | 
| 828 | 
            +
            };
         | 
| 829 | 
            +
             | 
| 830 | 
            +
            // Public: addFileParam sets a name/value pair that will be posted with the
         | 
| 831 | 
            +
            // file specified by the Files ID.  If the name already exists then the
         | 
| 832 | 
            +
            // exiting value will be overwritten.
         | 
| 833 | 
            +
            SWFUpload.prototype.addFileParam = function (fileID, name, value) {
         | 
| 834 | 
            +
            	return this.callFlash("AddFileParam", [fileID, name, value]);
         | 
| 835 | 
            +
            };
         | 
| 836 | 
            +
             | 
| 837 | 
            +
            // Public: removeFileParam removes a previously set (by addFileParam) name/value
         | 
| 838 | 
            +
            // pair from the specified file.
         | 
| 839 | 
            +
            SWFUpload.prototype.removeFileParam = function (fileID, name) {
         | 
| 840 | 
            +
            	this.callFlash("RemoveFileParam", [fileID, name]);
         | 
| 841 | 
            +
            };
         | 
| 842 | 
            +
             | 
| 843 | 
            +
            // Public: setUploadUrl changes the upload_url setting.
         | 
| 844 | 
            +
            SWFUpload.prototype.setUploadURL = function (url) {
         | 
| 845 | 
            +
            	this.settings.upload_url = url.toString();
         | 
| 846 | 
            +
            	this.callFlash("SetUploadURL", [url]);
         | 
| 847 | 
            +
            };
         | 
| 848 | 
            +
             | 
| 849 | 
            +
            // Public: setPostParams changes the post_params setting
         | 
| 850 | 
            +
            SWFUpload.prototype.setPostParams = function (paramsObject) {
         | 
| 851 | 
            +
            	this.settings.post_params = paramsObject;
         | 
| 852 | 
            +
            	this.callFlash("SetPostParams", [paramsObject]);
         | 
| 853 | 
            +
            };
         | 
| 854 | 
            +
             | 
| 855 | 
            +
            // Public: addPostParam adds post name/value pair.  Each name can have only one value.
         | 
| 856 | 
            +
            SWFUpload.prototype.addPostParam = function (name, value) {
         | 
| 857 | 
            +
            	this.settings.post_params[name] = value;
         | 
| 858 | 
            +
            	this.callFlash("SetPostParams", [this.settings.post_params]);
         | 
| 859 | 
            +
            };
         | 
| 860 | 
            +
             | 
| 861 | 
            +
            // Public: removePostParam deletes post name/value pair.
         | 
| 862 | 
            +
            SWFUpload.prototype.removePostParam = function (name) {
         | 
| 863 | 
            +
            	delete this.settings.post_params[name];
         | 
| 864 | 
            +
            	this.callFlash("SetPostParams", [this.settings.post_params]);
         | 
| 865 | 
            +
            };
         | 
| 866 | 
            +
             | 
| 867 | 
            +
            // Public: setFileTypes changes the file_types setting and the file_types_description setting
         | 
| 868 | 
            +
            SWFUpload.prototype.setFileTypes = function (types, description) {
         | 
| 869 | 
            +
            	this.settings.file_types = types;
         | 
| 870 | 
            +
            	this.settings.file_types_description = description;
         | 
| 871 | 
            +
            	this.callFlash("SetFileTypes", [types, description]);
         | 
| 872 | 
            +
            };
         | 
| 873 | 
            +
             | 
| 874 | 
            +
            // Public: setFileSizeLimit changes the file_size_limit setting
         | 
| 875 | 
            +
            SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {
         | 
| 876 | 
            +
            	this.settings.file_size_limit = fileSizeLimit;
         | 
| 877 | 
            +
            	this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
         | 
| 878 | 
            +
            };
         | 
| 879 | 
            +
             | 
| 880 | 
            +
            // Public: setFileUploadLimit changes the file_upload_limit setting
         | 
| 881 | 
            +
            SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {
         | 
| 882 | 
            +
            	this.settings.file_upload_limit = fileUploadLimit;
         | 
| 883 | 
            +
            	this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
         | 
| 884 | 
            +
            };
         | 
| 885 | 
            +
             | 
| 886 | 
            +
            // Public: setFileQueueLimit changes the file_queue_limit setting
         | 
| 887 | 
            +
            SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {
         | 
| 888 | 
            +
            	this.settings.file_queue_limit = fileQueueLimit;
         | 
| 889 | 
            +
            	this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
         | 
| 890 | 
            +
            };
         | 
| 891 | 
            +
             | 
| 892 | 
            +
            // Public: setFilePostName changes the file_post_name setting
         | 
| 893 | 
            +
            SWFUpload.prototype.setFilePostName = function (filePostName) {
         | 
| 894 | 
            +
            	this.settings.file_post_name = filePostName;
         | 
| 895 | 
            +
            	this.callFlash("SetFilePostName", [filePostName]);
         | 
| 896 | 
            +
            };
         | 
| 897 | 
            +
             | 
| 898 | 
            +
            // Public: setUseQueryString changes the use_query_string setting
         | 
| 899 | 
            +
            SWFUpload.prototype.setUseQueryString = function (useQueryString) {
         | 
| 900 | 
            +
            	this.settings.use_query_string = useQueryString;
         | 
| 901 | 
            +
            	this.callFlash("SetUseQueryString", [useQueryString]);
         | 
| 902 | 
            +
            };
         | 
| 903 | 
            +
             | 
| 904 | 
            +
            // Public: setRequeueOnError changes the requeue_on_error setting
         | 
| 905 | 
            +
            SWFUpload.prototype.setRequeueOnError = function (requeueOnError) {
         | 
| 906 | 
            +
            	this.settings.requeue_on_error = requeueOnError;
         | 
| 907 | 
            +
            	this.callFlash("SetRequeueOnError", [requeueOnError]);
         | 
| 908 | 
            +
            };
         | 
| 909 | 
            +
             | 
| 910 | 
            +
            // Public: setHTTPSuccess changes the http_success setting
         | 
| 911 | 
            +
            SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) {
         | 
| 912 | 
            +
            	if (typeof http_status_codes === "string") {
         | 
| 913 | 
            +
            		http_status_codes = http_status_codes.replace(" ", "").split(",");
         | 
| 914 | 
            +
            	}
         | 
| 915 | 
            +
             | 
| 916 | 
            +
            	this.settings.http_success = http_status_codes;
         | 
| 917 | 
            +
            	this.callFlash("SetHTTPSuccess", [http_status_codes]);
         | 
| 918 | 
            +
            };
         | 
| 919 | 
            +
             | 
| 920 | 
            +
            // Public: setHTTPSuccess changes the http_success setting
         | 
| 921 | 
            +
            SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) {
         | 
| 922 | 
            +
            	this.settings.assume_success_timeout = timeout_seconds;
         | 
| 923 | 
            +
            	this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]);
         | 
| 924 | 
            +
            };
         | 
| 925 | 
            +
             | 
| 926 | 
            +
            // Public: setDebugEnabled changes the debug_enabled setting
         | 
| 927 | 
            +
            SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
         | 
| 928 | 
            +
            	this.settings.debug_enabled = debugEnabled;
         | 
| 929 | 
            +
            	this.callFlash("SetDebugEnabled", [debugEnabled]);
         | 
| 930 | 
            +
            };
         | 
| 931 | 
            +
             | 
| 932 | 
            +
            // Public: setButtonImageURL loads a button image sprite
         | 
| 933 | 
            +
            SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) {
         | 
| 934 | 
            +
            	if (buttonImageURL == undefined) {
         | 
| 935 | 
            +
            		buttonImageURL = "";
         | 
| 936 | 
            +
            	}
         | 
| 937 | 
            +
             | 
| 938 | 
            +
            	this.settings.button_image_url = buttonImageURL;
         | 
| 939 | 
            +
            	this.callFlash("SetButtonImageURL", [buttonImageURL]);
         | 
| 940 | 
            +
            };
         | 
| 941 | 
            +
             | 
| 942 | 
            +
            // Public: setButtonDimensions resizes the Flash Movie and button
         | 
| 943 | 
            +
            SWFUpload.prototype.setButtonDimensions = function (width, height) {
         | 
| 944 | 
            +
            	this.settings.button_width = width;
         | 
| 945 | 
            +
            	this.settings.button_height = height;
         | 
| 946 | 
            +
             | 
| 947 | 
            +
            	var movie = this.getMovieElement();
         | 
| 948 | 
            +
            	if (movie != undefined) {
         | 
| 949 | 
            +
            		movie.style.width = width + "px";
         | 
| 950 | 
            +
            		movie.style.height = height + "px";
         | 
| 951 | 
            +
            	}
         | 
| 952 | 
            +
             | 
| 953 | 
            +
            	this.callFlash("SetButtonDimensions", [width, height]);
         | 
| 954 | 
            +
            };
         | 
| 955 | 
            +
            // Public: setButtonText Changes the text overlaid on the button
         | 
| 956 | 
            +
            SWFUpload.prototype.setButtonText = function (html) {
         | 
| 957 | 
            +
            	this.settings.button_text = html;
         | 
| 958 | 
            +
            	this.callFlash("SetButtonText", [html]);
         | 
| 959 | 
            +
            };
         | 
| 960 | 
            +
            // Public: setButtonTextPadding changes the top and left padding of the text overlay
         | 
| 961 | 
            +
            SWFUpload.prototype.setButtonTextPadding = function (left, top) {
         | 
| 962 | 
            +
            	this.settings.button_text_top_padding = top;
         | 
| 963 | 
            +
            	this.settings.button_text_left_padding = left;
         | 
| 964 | 
            +
            	this.callFlash("SetButtonTextPadding", [left, top]);
         | 
| 965 | 
            +
            };
         | 
| 966 | 
            +
             | 
| 967 | 
            +
            // Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
         | 
| 968 | 
            +
            SWFUpload.prototype.setButtonTextStyle = function (css) {
         | 
| 969 | 
            +
            	this.settings.button_text_style = css;
         | 
| 970 | 
            +
            	this.callFlash("SetButtonTextStyle", [css]);
         | 
| 971 | 
            +
            };
         | 
| 972 | 
            +
            // Public: setButtonDisabled disables/enables the button
         | 
| 973 | 
            +
            SWFUpload.prototype.setButtonDisabled = function (isDisabled) {
         | 
| 974 | 
            +
            	this.settings.button_disabled = isDisabled;
         | 
| 975 | 
            +
            	this.callFlash("SetButtonDisabled", [isDisabled]);
         | 
| 976 | 
            +
            };
         | 
| 977 | 
            +
            // Public: setButtonAction sets the action that occurs when the button is clicked
         | 
| 978 | 
            +
            SWFUpload.prototype.setButtonAction = function (buttonAction) {
         | 
| 979 | 
            +
            	this.settings.button_action = buttonAction;
         | 
| 980 | 
            +
            	this.callFlash("SetButtonAction", [buttonAction]);
         | 
| 981 | 
            +
            };
         | 
| 982 | 
            +
             | 
| 983 | 
            +
            // Public: setButtonCursor changes the mouse cursor displayed when hovering over the button
         | 
| 984 | 
            +
            SWFUpload.prototype.setButtonCursor = function (cursor) {
         | 
| 985 | 
            +
            	this.settings.button_cursor = cursor;
         | 
| 986 | 
            +
            	this.callFlash("SetButtonCursor", [cursor]);
         | 
| 987 | 
            +
            };
         | 
| 988 | 
            +
             | 
| 989 | 
            +
            /* *******************************
         | 
| 990 | 
            +
            	Flash Event Interfaces
         | 
| 991 | 
            +
            	These functions are used by Flash to trigger the various
         | 
| 992 | 
            +
            	events.
         | 
| 993 | 
            +
             | 
| 994 | 
            +
            	All these functions a Private.
         | 
| 995 | 
            +
             | 
| 996 | 
            +
            	Because the ExternalInterface library is buggy the event calls
         | 
| 997 | 
            +
            	are added to a queue and the queue then executed by a setTimeout.
         | 
| 998 | 
            +
            	This ensures that events are executed in a determinate order and that
         | 
| 999 | 
            +
            	the ExternalInterface bugs are avoided.
         | 
| 1000 | 
            +
            ******************************* */
         | 
| 1001 | 
            +
             | 
| 1002 | 
            +
            SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
         | 
| 1003 | 
            +
            	// Warning: Don't call this.debug inside here or you'll create an infinite loop
         | 
| 1004 | 
            +
             | 
| 1005 | 
            +
            	if (argumentArray == undefined) {
         | 
| 1006 | 
            +
            		argumentArray = [];
         | 
| 1007 | 
            +
            	} else if (!(argumentArray instanceof Array)) {
         | 
| 1008 | 
            +
            		argumentArray = [argumentArray];
         | 
| 1009 | 
            +
            	}
         | 
| 1010 | 
            +
             | 
| 1011 | 
            +
            	var self = this;
         | 
| 1012 | 
            +
            	if (typeof this.settings[handlerName] === "function") {
         | 
| 1013 | 
            +
            		// Queue the event
         | 
| 1014 | 
            +
            		this.eventQueue.push(function () {
         | 
| 1015 | 
            +
            			this.settings[handlerName].apply(this, argumentArray);
         | 
| 1016 | 
            +
            		});
         | 
| 1017 | 
            +
             | 
| 1018 | 
            +
            		// Execute the next queued event
         | 
| 1019 | 
            +
            		setTimeout(function () {
         | 
| 1020 | 
            +
            			self.executeNextEvent();
         | 
| 1021 | 
            +
            		}, 0);
         | 
| 1022 | 
            +
             | 
| 1023 | 
            +
            	} else if (this.settings[handlerName] !== null) {
         | 
| 1024 | 
            +
            		throw "Event handler " + handlerName + " is unknown or is not a function";
         | 
| 1025 | 
            +
            	}
         | 
| 1026 | 
            +
            };
         | 
| 1027 | 
            +
             | 
| 1028 | 
            +
            // Private: Causes the next event in the queue to be executed.  Since events are queued using a setTimeout
         | 
| 1029 | 
            +
            // we must queue them in order to garentee that they are executed in order.
         | 
| 1030 | 
            +
            SWFUpload.prototype.executeNextEvent = function () {
         | 
| 1031 | 
            +
            	// Warning: Don't call this.debug inside here or you'll create an infinite loop
         | 
| 1032 | 
            +
             | 
| 1033 | 
            +
            	var  f = this.eventQueue ? this.eventQueue.shift() : null;
         | 
| 1034 | 
            +
            	if (typeof(f) === "function") {
         | 
| 1035 | 
            +
            		f.apply(this);
         | 
| 1036 | 
            +
            	}
         | 
| 1037 | 
            +
            };
         | 
| 1038 | 
            +
             | 
| 1039 | 
            +
            // Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have
         | 
| 1040 | 
            +
            // properties that contain characters that are not valid for JavaScript identifiers. To work around this
         | 
| 1041 | 
            +
            // the Flash Component escapes the parameter names and we must unescape again before passing them along.
         | 
| 1042 | 
            +
            SWFUpload.prototype.unescapeFilePostParams = function (file) {
         | 
| 1043 | 
            +
            	var reg = /[$]([0-9a-f]{4})/i;
         | 
| 1044 | 
            +
            	var unescapedPost = {};
         | 
| 1045 | 
            +
            	var uk;
         | 
| 1046 | 
            +
             | 
| 1047 | 
            +
            	if (file != undefined) {
         | 
| 1048 | 
            +
            		for (var k in file.post) {
         | 
| 1049 | 
            +
            			if (file.post.hasOwnProperty(k)) {
         | 
| 1050 | 
            +
            				uk = k;
         | 
| 1051 | 
            +
            				var match;
         | 
| 1052 | 
            +
            				while ((match = reg.exec(uk)) !== null) {
         | 
| 1053 | 
            +
            					uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
         | 
| 1054 | 
            +
            				}
         | 
| 1055 | 
            +
            				unescapedPost[uk] = file.post[k];
         | 
| 1056 | 
            +
            			}
         | 
| 1057 | 
            +
            		}
         | 
| 1058 | 
            +
             | 
| 1059 | 
            +
            		file.post = unescapedPost;
         | 
| 1060 | 
            +
            	}
         | 
| 1061 | 
            +
             | 
| 1062 | 
            +
            	return file;
         | 
| 1063 | 
            +
            };
         | 
| 1064 | 
            +
             | 
| 1065 | 
            +
            // Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working)
         | 
| 1066 | 
            +
            SWFUpload.prototype.testExternalInterface = function () {
         | 
| 1067 | 
            +
            	try {
         | 
| 1068 | 
            +
            		return this.callFlash("TestExternalInterface");
         | 
| 1069 | 
            +
            	} catch (ex) {
         | 
| 1070 | 
            +
            		return false;
         | 
| 1071 | 
            +
            	}
         | 
| 1072 | 
            +
            };
         | 
| 1073 | 
            +
             | 
| 1074 | 
            +
            // Private: This event is called by Flash when it has finished loading. Don't modify this.
         | 
| 1075 | 
            +
            // Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded.
         | 
| 1076 | 
            +
            SWFUpload.prototype.flashReady = function () {
         | 
| 1077 | 
            +
            	// Check that the movie element is loaded correctly with its ExternalInterface methods defined
         | 
| 1078 | 
            +
            	var movieElement = this.getMovieElement();
         | 
| 1079 | 
            +
             | 
| 1080 | 
            +
            	if (!movieElement) {
         | 
| 1081 | 
            +
            		this.debug("Flash called back ready but the flash movie can't be found.");
         | 
| 1082 | 
            +
            		return;
         | 
| 1083 | 
            +
            	}
         | 
| 1084 | 
            +
             | 
| 1085 | 
            +
            	this.cleanUp(movieElement);
         | 
| 1086 | 
            +
             | 
| 1087 | 
            +
            	this.queueEvent("swfupload_loaded_handler");
         | 
| 1088 | 
            +
            };
         | 
| 1089 | 
            +
             | 
| 1090 | 
            +
            // Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE.
         | 
| 1091 | 
            +
            // This function is called by Flash each time the ExternalInterface functions are created.
         | 
| 1092 | 
            +
            SWFUpload.prototype.cleanUp = function (movieElement) {
         | 
| 1093 | 
            +
            	// Pro-actively unhook all the Flash functions
         | 
| 1094 | 
            +
            	try {
         | 
| 1095 | 
            +
            		if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
         | 
| 1096 | 
            +
            			this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
         | 
| 1097 | 
            +
            			for (var key in movieElement) {
         | 
| 1098 | 
            +
            				try {
         | 
| 1099 | 
            +
            					if (typeof(movieElement[key]) === "function") {
         | 
| 1100 | 
            +
            						movieElement[key] = null;
         | 
| 1101 | 
            +
            					}
         | 
| 1102 | 
            +
            				} catch (ex) {
         | 
| 1103 | 
            +
            				}
         | 
| 1104 | 
            +
            			}
         | 
| 1105 | 
            +
            		}
         | 
| 1106 | 
            +
            	} catch (ex1) {
         | 
| 1107 | 
            +
             | 
| 1108 | 
            +
            	}
         | 
| 1109 | 
            +
             | 
| 1110 | 
            +
            	// Fix Flashes own cleanup code so if the SWFMovie was removed from the page
         | 
| 1111 | 
            +
            	// it doesn't display errors.
         | 
| 1112 | 
            +
            	window["__flash__removeCallback"] = function (instance, name) {
         | 
| 1113 | 
            +
            		try {
         | 
| 1114 | 
            +
            			if (instance) {
         | 
| 1115 | 
            +
            				instance[name] = null;
         | 
| 1116 | 
            +
            			}
         | 
| 1117 | 
            +
            		} catch (flashEx) {
         | 
| 1118 | 
            +
             | 
| 1119 | 
            +
            		}
         | 
| 1120 | 
            +
            	};
         | 
| 1121 | 
            +
             | 
| 1122 | 
            +
            };
         | 
| 1123 | 
            +
             | 
| 1124 | 
            +
             | 
| 1125 | 
            +
            /* This is a chance to do something before the browse window opens */
         | 
| 1126 | 
            +
            SWFUpload.prototype.fileDialogStart = function () {
         | 
| 1127 | 
            +
            	this.queueEvent("file_dialog_start_handler");
         | 
| 1128 | 
            +
            };
         | 
| 1129 | 
            +
             | 
| 1130 | 
            +
             | 
| 1131 | 
            +
            /* Called when a file is successfully added to the queue. */
         | 
| 1132 | 
            +
            SWFUpload.prototype.fileQueued = function (file) {
         | 
| 1133 | 
            +
            	file = this.unescapeFilePostParams(file);
         | 
| 1134 | 
            +
            	this.queueEvent("file_queued_handler", file);
         | 
| 1135 | 
            +
            };
         | 
| 1136 | 
            +
             | 
| 1137 | 
            +
             | 
| 1138 | 
            +
            /* Handle errors that occur when an attempt to queue a file fails. */
         | 
| 1139 | 
            +
            SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
         | 
| 1140 | 
            +
            	file = this.unescapeFilePostParams(file);
         | 
| 1141 | 
            +
            	this.queueEvent("file_queue_error_handler", [file, errorCode, message]);
         | 
| 1142 | 
            +
            };
         | 
| 1143 | 
            +
             | 
| 1144 | 
            +
            /* Called after the file dialog has closed and the selected files have been queued.
         | 
| 1145 | 
            +
            	You could call startUpload here if you want the queued files to begin uploading immediately. */
         | 
| 1146 | 
            +
            SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) {
         | 
| 1147 | 
            +
            	this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]);
         | 
| 1148 | 
            +
            };
         | 
| 1149 | 
            +
             | 
| 1150 | 
            +
            SWFUpload.prototype.uploadStart = function (file) {
         | 
| 1151 | 
            +
            	file = this.unescapeFilePostParams(file);
         | 
| 1152 | 
            +
            	this.queueEvent("return_upload_start_handler", file);
         | 
| 1153 | 
            +
            };
         | 
| 1154 | 
            +
             | 
| 1155 | 
            +
            SWFUpload.prototype.returnUploadStart = function (file) {
         | 
| 1156 | 
            +
            	var returnValue;
         | 
| 1157 | 
            +
            	if (typeof this.settings.upload_start_handler === "function") {
         | 
| 1158 | 
            +
            		file = this.unescapeFilePostParams(file);
         | 
| 1159 | 
            +
            		returnValue = this.settings.upload_start_handler.call(this, file);
         | 
| 1160 | 
            +
            	} else if (this.settings.upload_start_handler != undefined) {
         | 
| 1161 | 
            +
            		throw "upload_start_handler must be a function";
         | 
| 1162 | 
            +
            	}
         | 
| 1163 | 
            +
             | 
| 1164 | 
            +
            	// Convert undefined to true so if nothing is returned from the upload_start_handler it is
         | 
| 1165 | 
            +
            	// interpretted as 'true'.
         | 
| 1166 | 
            +
            	if (returnValue === undefined) {
         | 
| 1167 | 
            +
            		returnValue = true;
         | 
| 1168 | 
            +
            	}
         | 
| 1169 | 
            +
             | 
| 1170 | 
            +
            	returnValue = !!returnValue;
         | 
| 1171 | 
            +
             | 
| 1172 | 
            +
            	this.callFlash("ReturnUploadStart", [returnValue]);
         | 
| 1173 | 
            +
            };
         | 
| 1174 | 
            +
             | 
| 1175 | 
            +
             | 
| 1176 | 
            +
             | 
| 1177 | 
            +
            SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
         | 
| 1178 | 
            +
            	file = this.unescapeFilePostParams(file);
         | 
| 1179 | 
            +
            	this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
         | 
| 1180 | 
            +
            };
         | 
| 1181 | 
            +
             | 
| 1182 | 
            +
            SWFUpload.prototype.uploadError = function (file, errorCode, message) {
         | 
| 1183 | 
            +
            	file = this.unescapeFilePostParams(file);
         | 
| 1184 | 
            +
            	this.queueEvent("upload_error_handler", [file, errorCode, message]);
         | 
| 1185 | 
            +
            };
         | 
| 1186 | 
            +
             | 
| 1187 | 
            +
            SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) {
         | 
| 1188 | 
            +
            	file = this.unescapeFilePostParams(file);
         | 
| 1189 | 
            +
            	this.queueEvent("upload_success_handler", [file, serverData, responseReceived]);
         | 
| 1190 | 
            +
            };
         | 
| 1191 | 
            +
             | 
| 1192 | 
            +
            SWFUpload.prototype.uploadComplete = function (file) {
         | 
| 1193 | 
            +
            	file = this.unescapeFilePostParams(file);
         | 
| 1194 | 
            +
            	this.queueEvent("upload_complete_handler", file);
         | 
| 1195 | 
            +
            };
         | 
| 1196 | 
            +
             | 
| 1197 | 
            +
            /* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
         | 
| 1198 | 
            +
               internal debug console.  You can override this event and have messages written where you want. */
         | 
| 1199 | 
            +
            SWFUpload.prototype.debug = function (message) {
         | 
| 1200 | 
            +
            	this.queueEvent("debug_handler", message);
         | 
| 1201 | 
            +
            };
         | 
| 1202 | 
            +
             | 
| 1203 | 
            +
             | 
| 1204 | 
            +
            /* **********************************
         | 
| 1205 | 
            +
            	Debug Console
         | 
| 1206 | 
            +
            	The debug console is a self contained, in page location
         | 
| 1207 | 
            +
            	for debug message to be sent.  The Debug Console adds
         | 
| 1208 | 
            +
            	itself to the body if necessary.
         | 
| 1209 | 
            +
             | 
| 1210 | 
            +
            	The console is automatically scrolled as messages appear.
         | 
| 1211 | 
            +
             | 
| 1212 | 
            +
            	If you are using your own debug handler or when you deploy to production and
         | 
| 1213 | 
            +
            	have debug disabled you can remove these functions to reduce the file size
         | 
| 1214 | 
            +
            	and complexity.
         | 
| 1215 | 
            +
            ********************************** */
         | 
| 1216 | 
            +
             | 
| 1217 | 
            +
            // Private: debugMessage is the default debug_handler.  If you want to print debug messages
         | 
| 1218 | 
            +
            // call the debug() function.  When overriding the function your own function should
         | 
| 1219 | 
            +
            // check to see if the debug setting is true before outputting debug information.
         | 
| 1220 | 
            +
            SWFUpload.prototype.debugMessage = function (message) {
         | 
| 1221 | 
            +
            	if (this.settings.debug) {
         | 
| 1222 | 
            +
            		var exceptionMessage, exceptionValues = [];
         | 
| 1223 | 
            +
             | 
| 1224 | 
            +
            		// Check for an exception object and print it nicely
         | 
| 1225 | 
            +
            		if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
         | 
| 1226 | 
            +
            			for (var key in message) {
         | 
| 1227 | 
            +
            				if (message.hasOwnProperty(key)) {
         | 
| 1228 | 
            +
            					exceptionValues.push(key + ": " + message[key]);
         | 
| 1229 | 
            +
            				}
         | 
| 1230 | 
            +
            			}
         | 
| 1231 | 
            +
            			exceptionMessage = exceptionValues.join("\n") || "";
         | 
| 1232 | 
            +
            			exceptionValues = exceptionMessage.split("\n");
         | 
| 1233 | 
            +
            			exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
         | 
| 1234 | 
            +
            			SWFUpload.Console.writeLine(exceptionMessage);
         | 
| 1235 | 
            +
            		} else {
         | 
| 1236 | 
            +
            			SWFUpload.Console.writeLine(message);
         | 
| 1237 | 
            +
            		}
         | 
| 1238 | 
            +
            	}
         | 
| 1239 | 
            +
            };
         | 
| 1240 | 
            +
             | 
| 1241 | 
            +
            SWFUpload.Console = {};
         | 
| 1242 | 
            +
            SWFUpload.Console.writeLine = function (message) {
         | 
| 1243 | 
            +
            	var console, documentForm;
         | 
| 1244 | 
            +
             | 
| 1245 | 
            +
            	try {
         | 
| 1246 | 
            +
            		console = document.getElementById("SWFUpload_Console");
         | 
| 1247 | 
            +
             | 
| 1248 | 
            +
            		if (!console) {
         | 
| 1249 | 
            +
            			documentForm = document.createElement("form");
         | 
| 1250 | 
            +
            			document.getElementsByTagName("body")[0].appendChild(documentForm);
         | 
| 1251 | 
            +
             | 
| 1252 | 
            +
            			console = document.createElement("textarea");
         | 
| 1253 | 
            +
            			console.id = "SWFUpload_Console";
         | 
| 1254 | 
            +
            			console.style.fontFamily = "monospace";
         | 
| 1255 | 
            +
            			console.setAttribute("wrap", "off");
         | 
| 1256 | 
            +
            			console.wrap = "off";
         | 
| 1257 | 
            +
            			console.style.overflow = "auto";
         | 
| 1258 | 
            +
            			console.style.width = "700px";
         | 
| 1259 | 
            +
            			console.style.height = "350px";
         | 
| 1260 | 
            +
            			console.style.margin = "5px";
         | 
| 1261 | 
            +
            			documentForm.appendChild(console);
         | 
| 1262 | 
            +
            		}
         | 
| 1263 | 
            +
             | 
| 1264 | 
            +
            		console.value += message + "\n";
         | 
| 1265 | 
            +
             | 
| 1266 | 
            +
            		console.scrollTop = console.scrollHeight - console.clientHeight;
         | 
| 1267 | 
            +
            	} catch (ex) {
         | 
| 1268 | 
            +
            		alert("Exception: " + ex.name + " Message: " + ex.message);
         | 
| 1269 | 
            +
            	}
         | 
| 1270 | 
            +
            };
         | 
| 1271 | 
            +
             | 
| 1272 | 
            +
            /*
         | 
| 1273 | 
            +
            	Queue Plug-in
         | 
| 1274 | 
            +
             | 
| 1275 | 
            +
            	Features:
         | 
| 1276 | 
            +
            		*Adds a cancelQueue() method for cancelling the entire queue.
         | 
| 1277 | 
            +
            		*All queued files are uploaded when startUpload() is called.
         | 
| 1278 | 
            +
            		*If false is returned from uploadComplete then the queue upload is stopped.
         | 
| 1279 | 
            +
            		 If false is not returned (strict comparison) then the queue upload is continued.
         | 
| 1280 | 
            +
            		*Adds a QueueComplete event that is fired when all the queued files have finished uploading.
         | 
| 1281 | 
            +
            		 Set the event handler with the queue_complete_handler setting.
         | 
| 1282 | 
            +
             | 
| 1283 | 
            +
            	*/
         | 
| 1284 | 
            +
             | 
| 1285 | 
            +
            if (typeof(SWFUpload) === "function") {
         | 
| 1286 | 
            +
            	SWFUpload.queue = {};
         | 
| 1287 | 
            +
             | 
| 1288 | 
            +
            	SWFUpload.prototype.initSettings = (function (oldInitSettings) {
         | 
| 1289 | 
            +
            		return function () {
         | 
| 1290 | 
            +
            			if (typeof(oldInitSettings) === "function") {
         | 
| 1291 | 
            +
            				oldInitSettings.call(this);
         | 
| 1292 | 
            +
            			}
         | 
| 1293 | 
            +
             | 
| 1294 | 
            +
            			this.queueSettings = {};
         | 
| 1295 | 
            +
             | 
| 1296 | 
            +
            			this.queueSettings.queue_cancelled_flag = false;
         | 
| 1297 | 
            +
            			this.queueSettings.queue_upload_count = 0;
         | 
| 1298 | 
            +
             | 
| 1299 | 
            +
            			this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
         | 
| 1300 | 
            +
            			this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler;
         | 
| 1301 | 
            +
            			this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
         | 
| 1302 | 
            +
            			this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler;
         | 
| 1303 | 
            +
             | 
| 1304 | 
            +
            			this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
         | 
| 1305 | 
            +
            		};
         | 
| 1306 | 
            +
            	})(SWFUpload.prototype.initSettings);
         | 
| 1307 | 
            +
             | 
| 1308 | 
            +
            	SWFUpload.prototype.startUpload = function (fileID) {
         | 
| 1309 | 
            +
            		this.queueSettings.queue_cancelled_flag = false;
         | 
| 1310 | 
            +
            		this.callFlash("StartUpload", [fileID]);
         | 
| 1311 | 
            +
            	};
         | 
| 1312 | 
            +
             | 
| 1313 | 
            +
            	SWFUpload.prototype.cancelQueue = function () {
         | 
| 1314 | 
            +
            		this.queueSettings.queue_cancelled_flag = true;
         | 
| 1315 | 
            +
            		this.stopUpload();
         | 
| 1316 | 
            +
             | 
| 1317 | 
            +
            		var stats = this.getStats();
         | 
| 1318 | 
            +
            		while (stats.files_queued > 0) {
         | 
| 1319 | 
            +
            			this.cancelUpload();
         | 
| 1320 | 
            +
            			stats = this.getStats();
         | 
| 1321 | 
            +
            		}
         | 
| 1322 | 
            +
            	};
         | 
| 1323 | 
            +
             | 
| 1324 | 
            +
            	SWFUpload.queue.uploadStartHandler = function (file) {
         | 
| 1325 | 
            +
            		var returnValue;
         | 
| 1326 | 
            +
            		if (typeof(this.queueSettings.user_upload_start_handler) === "function") {
         | 
| 1327 | 
            +
            			returnValue = this.queueSettings.user_upload_start_handler.call(this, file);
         | 
| 1328 | 
            +
            		}
         | 
| 1329 | 
            +
             | 
| 1330 | 
            +
            		// To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value.
         | 
| 1331 | 
            +
            		returnValue = (returnValue === false) ? false : true;
         | 
| 1332 | 
            +
             | 
| 1333 | 
            +
            		this.queueSettings.queue_cancelled_flag = !returnValue;
         | 
| 1334 | 
            +
             | 
| 1335 | 
            +
            		return returnValue;
         | 
| 1336 | 
            +
            	};
         | 
| 1337 | 
            +
             | 
| 1338 | 
            +
            	SWFUpload.queue.uploadCompleteHandler = function (file) {
         | 
| 1339 | 
            +
            		var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler;
         | 
| 1340 | 
            +
            		var continueUpload;
         | 
| 1341 | 
            +
             | 
| 1342 | 
            +
            		if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
         | 
| 1343 | 
            +
            			this.queueSettings.queue_upload_count++;
         | 
| 1344 | 
            +
            		}
         | 
| 1345 | 
            +
             | 
| 1346 | 
            +
            		if (typeof(user_upload_complete_handler) === "function") {
         | 
| 1347 | 
            +
            			continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
         | 
| 1348 | 
            +
            		} else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) {
         | 
| 1349 | 
            +
            			// If the file was stopped and re-queued don't restart the upload
         | 
| 1350 | 
            +
            			continueUpload = false;
         | 
| 1351 | 
            +
            		} else {
         | 
| 1352 | 
            +
            			continueUpload = true;
         | 
| 1353 | 
            +
            		}
         | 
| 1354 | 
            +
             | 
| 1355 | 
            +
            		if (continueUpload) {
         | 
| 1356 | 
            +
            			var stats = this.getStats();
         | 
| 1357 | 
            +
            			if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) {
         | 
| 1358 | 
            +
            				this.startUpload();
         | 
| 1359 | 
            +
            			} else if (this.queueSettings.queue_cancelled_flag === false) {
         | 
| 1360 | 
            +
            				this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]);
         | 
| 1361 | 
            +
            				this.queueSettings.queue_upload_count = 0;
         | 
| 1362 | 
            +
            			} else {
         | 
| 1363 | 
            +
            				this.queueSettings.queue_cancelled_flag = false;
         | 
| 1364 | 
            +
            				this.queueSettings.queue_upload_count = 0;
         | 
| 1365 | 
            +
            			}
         | 
| 1366 | 
            +
            		}
         | 
| 1367 | 
            +
            	};
         | 
| 1368 | 
            +
            }
         |