uploader 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/README.rdoc +5 -1
- data/VERSION +1 -1
- data/app/views/uploads/_swf_javascript.html.erb +3 -1
- data/locales/gl.yml +2 -2
- data/locales/th.yml +18 -18
- data/locales/zh-TW.yml +3 -3
- data/public/javascripts/swfupload/swfupload.cookies.js +2 -2
- data/public/javascripts/swfupload/swfupload.js +262 -108
- data/public/javascripts/swfupload/swfupload.proxy.js +96 -0
- data/public/javascripts/swfupload/swfupload.queue.js +4 -3
- data/public/javascripts/swfupload/swfupload.speed.js +10 -6
- data/public/swf/swfupload.swf +0 -0
- data/public/swf/swfupload_fp9.swf +0 -0
- data/test/rails_root/app/views/layouts/application.html.erb +0 -1
- data/test/rails_root/config/database.yml +18 -10
- data/test/rails_root/config/routes.rb +3 -0
- data/test/rails_root/public/swf/swfupload.swf +0 -0
- data/uploader.gemspec +7 -4
- metadata +44 -17
data/.gitignore
CHANGED
data/README.rdoc
CHANGED
@@ -336,5 +336,9 @@ If you intend to develop code and wish to run the tests you may do so using rake
|
|
336
336
|
rake install since the embedded test application will use the gem that is install and not the current code from the project. This is a limitation
|
337
337
|
I attempted to overcome using a special initializer in rails_root/config/initializers/uploader.rb but I didn't have any success getting it working.
|
338
338
|
|
339
|
+
=== Development notes
|
340
|
+
The swfupload.js and swfupload.queue.js have been modified according to this forum post:
|
341
|
+
http://www.swfupload.org/forum/generaldiscussion/2053
|
339
342
|
|
340
|
-
|
343
|
+
|
344
|
+
Copyright (c) 2010 Tatemae.com, released under the MIT license
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.8
|
@@ -28,12 +28,14 @@
|
|
28
28
|
jQuery('.show_degraded_container').hide();
|
29
29
|
jQuery('.degraded_container').show();
|
30
30
|
jQuery('.swfupload_container').hide();
|
31
|
+
return false;
|
31
32
|
});
|
32
33
|
jQuery('.show_swfupload_container').click(function(){
|
33
34
|
jQuery('.show_swfupload_container').hide();
|
34
35
|
jQuery('.show_degraded_container').show();
|
35
36
|
jQuery('.degraded_container').hide();
|
36
37
|
jQuery('.swfupload_container').show();
|
38
|
+
return false;
|
37
39
|
});
|
38
40
|
});
|
39
41
|
</script>
|
@@ -46,6 +48,7 @@
|
|
46
48
|
var settings = {
|
47
49
|
|
48
50
|
flash_url : '/swf/swfupload.swf',
|
51
|
+
flash9_url : '/swf/swfupload_fp9.swf',
|
49
52
|
upload_url: '<%= options[:upload_url] || new_upload_path_with_session_information(parent) %>',
|
50
53
|
|
51
54
|
file_size_limit : '<%= options[:file_size_limit] || "100 MB" %>',
|
@@ -87,7 +90,6 @@
|
|
87
90
|
queue_complete_handler : queueComplete, // Queue plugin event
|
88
91
|
|
89
92
|
// SWFObject settings
|
90
|
-
minimum_flash_version : "9.0.28",
|
91
93
|
swfupload_pre_load_handler : swfUploadPreLoad,
|
92
94
|
swfupload_load_failed_handler : swfUploadLoadFailed
|
93
95
|
};
|
data/locales/gl.yml
CHANGED
@@ -12,9 +12,9 @@ gl:
|
|
12
12
|
permission_denied: "Non ten permiso para completar esta acción."
|
13
13
|
show_degraded_container: "Use uploader estándar"
|
14
14
|
show_swfupload_container: "Use múltiples arquivos de subida. (Require Flash)"
|
15
|
-
standard_file_upload_error: "Houbo un erro ao facer a carga do arquivo: {{error}}. Asegúrese de que o arquivo non é válida. Asegúrese de que o arquivo non está baleiro.
|
15
|
+
standard_file_upload_error: "Houbo un erro ao facer a carga do arquivo: {{error}}. Asegúrese de que o arquivo non é válida. Asegúrese de que o arquivo non está baleiro. A continuación, téntao de novo."
|
16
16
|
successful_upload: "Arquivo subido con éxito."
|
17
|
-
swf_loading: "SWFUpload está cargando. Por
|
17
|
+
swf_loading: "SWFUpload está cargando. Por facor, agarde un intre ..."
|
18
18
|
swf_not_loading: "We're sorry. SWFUpload non puido cargar. Pode instalar ou actualizar o Flash Player. Visita o {{url}} para obter o Flash Player."
|
19
19
|
swf_taking_to_long: "SWFUpload está levando moito tempo para subir ou a carga fallou. Por favor, asegúrese que o plugin de Flash está activado e que unha versión de traballo do Adobe Flash Player instalado."
|
20
20
|
upload_file: "Subida de Arquivos"
|
data/locales/th.yml
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
---
|
2
2
|
th:
|
3
3
|
uploader:
|
4
|
-
cancel_all:
|
5
|
-
file_delete_permission_denied:
|
6
|
-
file_deleted:
|
7
|
-
file_upload_error:
|
8
|
-
javascript_not_enabled: "ขออภัย. SWFUpload
|
9
|
-
manage_files:
|
10
|
-
manage_photos_files: "
|
11
|
-
missing_parent_id_error:
|
12
|
-
permission_denied:
|
13
|
-
show_degraded_container:
|
14
|
-
show_swfupload_container: "
|
15
|
-
standard_file_upload_error: "
|
16
|
-
successful_upload:
|
17
|
-
swf_loading: "SWFUpload
|
18
|
-
swf_not_loading: "ขออภัย. SWFUpload
|
19
|
-
swf_taking_to_long: "SWFUpload
|
20
|
-
upload_file:
|
21
|
-
upload_files:
|
4
|
+
cancel_all: "อัพโหลด ยกเลิก ทั้งหมด"
|
5
|
+
file_delete_permission_denied: "คุณ ไม่ ได้ รับ สิทธิ์ ใน การ ลบ ไฟล์ ที่."
|
6
|
+
file_deleted: "ไฟล์ ที่ ถูก ลบ"
|
7
|
+
file_upload_error: "เกิด ข้อ ผิด พลาด ขณะ อัป โหลด ไฟล์."
|
8
|
+
javascript_not_enabled: "ขออภัย. SWFUpload ไม่ สามารถ โหลด. คุณ ต้อง เปิด การ ใช้ งาน JavaScript สนุก SWFUpload."
|
9
|
+
manage_files: "จัดการ ไฟล์"
|
10
|
+
manage_photos_files: "จัดการ รูปภาพ / Files"
|
11
|
+
missing_parent_id_error: "กรุณา ระบุ วัตถุ ผู้ ปกครอง"
|
12
|
+
permission_denied: "คุณ ไม่ ได้ รับ อนุญาต ให้ ดำเนิน การ นี้ เสร็จ."
|
13
|
+
show_degraded_container: "ใช้ อัพโหลด มาตรฐาน"
|
14
|
+
show_swfupload_container: "หลาย ใช้ ไฟล์ อัพโหลด. (Flash ต้องการ)"
|
15
|
+
standard_file_upload_error: "เกิด ข้อ ผิด พลาด ขณะ อัพโหลด ไฟล์: {{error}}. โปรด ตรวจ สอบ ว่า ไฟล์ นั้น ถูก ต้อง. ตรวจ สอบ เพื่อ ให้ แน่ใจ ว่า แฟ้ม ไม่ ว่าง. แล้ว ลอง อีก ครั้ง."
|
16
|
+
successful_upload: "สำเร็จ ไฟล์ ที่ อัพโหลด."
|
17
|
+
swf_loading: "SWFUpload กำลัง โหลด. โปรด รอ สัก ครู่ ..."
|
18
|
+
swf_not_loading: "ขออภัย. SWFUpload ไม่ สามารถ โหลด. คุณ อาจ ต้อง ติด ตั้ง หรือ อัพเกรด Flash Player. ไป {{url}} เพื่อ รับ Flash Player."
|
19
|
+
swf_taking_to_long: "SWFUpload ต้อง ใช้ เวลา นาน ใน การ โหลด หรือ โหลด ล้ม เหลว. โปรด ตรวจ สอบ ว่า มี การ เปิด ใช้ ปลั๊กอิน Flash และ รุ่น ที่ ทำงาน ของ Adobe Flash Player ติด ตั้ง."
|
20
|
+
upload_file: "อัพโหลด ไฟล์"
|
21
|
+
upload_files: "อัป โหลด ไฟล์"
|
data/locales/zh-TW.yml
CHANGED
@@ -5,7 +5,7 @@ zh-TW:
|
|
5
5
|
file_delete_permission_denied: 您沒有權限刪除該文件。
|
6
6
|
file_deleted: 已刪除的文件
|
7
7
|
file_upload_error: 時發生錯誤上傳文件。
|
8
|
-
javascript_not_enabled: "我們很抱歉。 SWFUpload無法加載。您必須啟用JavaScript享受SWFUpload。"
|
8
|
+
javascript_not_enabled: "我們很抱歉。 SWFUpload無法加載。您必須啟用 JavaScript享受SWFUpload。"
|
9
9
|
manage_files: 管理文件
|
10
10
|
manage_photos_files: 管理照片/文件
|
11
11
|
missing_parent_id_error: 請指定一個父對象
|
@@ -15,7 +15,7 @@ zh-TW:
|
|
15
15
|
standard_file_upload_error: "時發生錯誤上傳文件:{{error}}.請確保該文件是有效的。檢查以確保該文件不是空的。然後再試一次。"
|
16
16
|
successful_upload: 成功上載文件。
|
17
17
|
swf_loading: SWFUpload加載。請稍候...
|
18
|
-
swf_not_loading: "我們很抱歉。 SWFUpload無法加載。您可能需要安裝或升級Flash播放器。訪問{{url}}獲取Flash播放器。"
|
19
|
-
swf_taking_to_long: "SWFUpload花費很長的時間來加載或負載已失敗。請確保Flash插件啟用一個工作版本的Adobe Flash Player的安裝。"
|
18
|
+
swf_not_loading: "我們很抱歉。 SWFUpload無法加載。您可能需要安裝或升級 Flash播放器。訪問 {{url}}獲取 Flash播放器。"
|
19
|
+
swf_taking_to_long: "SWFUpload花費很長的時間來加載或負載已失敗。請確保 Flash插件啟用一個工作版本的Adobe Flash Player的安裝。"
|
20
20
|
upload_file: 上傳文件
|
21
21
|
upload_files: 上傳文件
|
@@ -9,9 +9,9 @@
|
|
9
9
|
var SWFUpload;
|
10
10
|
if (typeof(SWFUpload) === "function") {
|
11
11
|
SWFUpload.prototype.initSettings = function (oldInitSettings) {
|
12
|
-
return function () {
|
12
|
+
return function (userSettings) {
|
13
13
|
if (typeof(oldInitSettings) === "function") {
|
14
|
-
oldInitSettings.call(this);
|
14
|
+
oldInitSettings.call(this, userSettings);
|
15
15
|
}
|
16
16
|
|
17
17
|
this.refreshCookies(false); // The false parameter must be sent since SWFUpload has not initialzed at this point
|
@@ -9,13 +9,17 @@
|
|
9
9
|
* SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
|
10
10
|
* http://www.opensource.org/licenses/mit-license.php
|
11
11
|
*
|
12
|
+
* SWFObject v2.2 <http://code.google.com/p/swfobject/>
|
13
|
+
* is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
|
12
14
|
*/
|
13
15
|
|
14
16
|
|
17
|
+
|
15
18
|
/* ******************* */
|
16
19
|
/* Constructor & Init */
|
17
20
|
/* ******************* */
|
18
21
|
var SWFUpload;
|
22
|
+
var swfobject;
|
19
23
|
|
20
24
|
if (SWFUpload == undefined) {
|
21
25
|
SWFUpload = function (settings) {
|
@@ -23,10 +27,11 @@ if (SWFUpload == undefined) {
|
|
23
27
|
};
|
24
28
|
}
|
25
29
|
|
26
|
-
SWFUpload.prototype.initSWFUpload = function (
|
30
|
+
SWFUpload.prototype.initSWFUpload = function (userSettings) {
|
27
31
|
try {
|
28
32
|
this.customSettings = {}; // A container where developers can place their own settings associated with this instance.
|
29
|
-
this.settings =
|
33
|
+
this.settings = {};
|
34
|
+
this.tmp_settings = userSettings; // Added by Justin. This fixes a bug where userSettings is undefined
|
30
35
|
this.eventQueue = [];
|
31
36
|
this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
|
32
37
|
this.movieElement = null;
|
@@ -36,8 +41,12 @@ SWFUpload.prototype.initSWFUpload = function (settings) {
|
|
36
41
|
SWFUpload.instances[this.movieName] = this;
|
37
42
|
|
38
43
|
// Load the settings. Load the Flash movie.
|
39
|
-
this.initSettings();
|
40
|
-
this.
|
44
|
+
this.initSettings(userSettings);
|
45
|
+
this.loadSupport();
|
46
|
+
if (this.swfuploadPreload()) {
|
47
|
+
this.loadFlash();
|
48
|
+
}
|
49
|
+
|
41
50
|
this.displayDebugInfo();
|
42
51
|
} catch (ex) {
|
43
52
|
delete SWFUpload.instances[this.movieName];
|
@@ -50,67 +59,85 @@ SWFUpload.prototype.initSWFUpload = function (settings) {
|
|
50
59
|
/* *************** */
|
51
60
|
SWFUpload.instances = {};
|
52
61
|
SWFUpload.movieCount = 0;
|
53
|
-
SWFUpload.version = "2.
|
62
|
+
SWFUpload.version = "2.5.0 2010-01-15 Beta 2";
|
54
63
|
SWFUpload.QUEUE_ERROR = {
|
55
|
-
QUEUE_LIMIT_EXCEEDED
|
56
|
-
FILE_EXCEEDS_SIZE_LIMIT
|
57
|
-
ZERO_BYTE_FILE
|
58
|
-
INVALID_FILETYPE
|
64
|
+
QUEUE_LIMIT_EXCEEDED : -100,
|
65
|
+
FILE_EXCEEDS_SIZE_LIMIT : -110,
|
66
|
+
ZERO_BYTE_FILE : -120,
|
67
|
+
INVALID_FILETYPE : -130
|
59
68
|
};
|
60
69
|
SWFUpload.UPLOAD_ERROR = {
|
61
|
-
HTTP_ERROR
|
62
|
-
MISSING_UPLOAD_URL
|
63
|
-
IO_ERROR
|
64
|
-
SECURITY_ERROR
|
65
|
-
UPLOAD_LIMIT_EXCEEDED
|
66
|
-
UPLOAD_FAILED
|
67
|
-
SPECIFIED_FILE_ID_NOT_FOUND
|
68
|
-
FILE_VALIDATION_FAILED
|
69
|
-
FILE_CANCELLED
|
70
|
-
UPLOAD_STOPPED
|
70
|
+
HTTP_ERROR : -200,
|
71
|
+
MISSING_UPLOAD_URL : -210,
|
72
|
+
IO_ERROR : -220,
|
73
|
+
SECURITY_ERROR : -230,
|
74
|
+
UPLOAD_LIMIT_EXCEEDED : -240,
|
75
|
+
UPLOAD_FAILED : -250,
|
76
|
+
SPECIFIED_FILE_ID_NOT_FOUND : -260,
|
77
|
+
FILE_VALIDATION_FAILED : -270,
|
78
|
+
FILE_CANCELLED : -280,
|
79
|
+
UPLOAD_STOPPED : -290,
|
80
|
+
RESIZE : -300
|
71
81
|
};
|
72
82
|
SWFUpload.FILE_STATUS = {
|
73
|
-
QUEUED
|
74
|
-
IN_PROGRESS
|
75
|
-
ERROR
|
76
|
-
COMPLETE
|
77
|
-
CANCELLED
|
83
|
+
QUEUED : -1,
|
84
|
+
IN_PROGRESS : -2,
|
85
|
+
ERROR : -3,
|
86
|
+
COMPLETE : -4,
|
87
|
+
CANCELLED : -5
|
88
|
+
};
|
89
|
+
SWFUpload.UPLOAD_TYPE = {
|
90
|
+
NORMAL : -1,
|
91
|
+
RESIZED : -2
|
78
92
|
};
|
93
|
+
|
79
94
|
SWFUpload.BUTTON_ACTION = {
|
80
|
-
SELECT_FILE
|
81
|
-
SELECT_FILES
|
82
|
-
START_UPLOAD
|
95
|
+
SELECT_FILE : -100,
|
96
|
+
SELECT_FILES : -110,
|
97
|
+
START_UPLOAD : -120,
|
98
|
+
JAVASCRIPT : -130, // DEPRECATED
|
99
|
+
NONE : -130
|
83
100
|
};
|
84
101
|
SWFUpload.CURSOR = {
|
85
102
|
ARROW : -1,
|
86
|
-
HAND
|
103
|
+
HAND : -2
|
87
104
|
};
|
88
105
|
SWFUpload.WINDOW_MODE = {
|
89
|
-
WINDOW
|
90
|
-
TRANSPARENT
|
91
|
-
OPAQUE
|
106
|
+
WINDOW : "window",
|
107
|
+
TRANSPARENT : "transparent",
|
108
|
+
OPAQUE : "opaque"
|
109
|
+
};
|
110
|
+
|
111
|
+
SWFUpload.RESIZE_ENCODING = {
|
112
|
+
JPEG : -1,
|
113
|
+
PNG : -2
|
92
114
|
};
|
93
115
|
|
94
116
|
// Private: takes a URL, determines if it is relative and converts to an absolute URL
|
95
117
|
// using the current site. Only processes the URL if it can, otherwise returns the URL untouched
|
96
|
-
SWFUpload.completeURL = function(url) {
|
97
|
-
|
118
|
+
SWFUpload.completeURL = function (url) {
|
119
|
+
try {
|
120
|
+
var path = "", indexSlash = -1;
|
121
|
+
if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//) || url === "") {
|
122
|
+
return url;
|
123
|
+
}
|
124
|
+
|
125
|
+
indexSlash = window.location.pathname.lastIndexOf("/");
|
126
|
+
if (indexSlash <= 0) {
|
127
|
+
path = "/";
|
128
|
+
} else {
|
129
|
+
path = window.location.pathname.substr(0, indexSlash) + "/";
|
130
|
+
}
|
131
|
+
|
132
|
+
return path + url;
|
133
|
+
} catch (ex) {
|
98
134
|
return url;
|
99
135
|
}
|
100
|
-
|
101
|
-
var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
|
102
|
-
|
103
|
-
var indexSlash = window.location.pathname.lastIndexOf("/");
|
104
|
-
if (indexSlash <= 0) {
|
105
|
-
path = "/";
|
106
|
-
} else {
|
107
|
-
path = window.location.pathname.substr(0, indexSlash) + "/";
|
108
|
-
}
|
109
|
-
|
110
|
-
return /*currentURL +*/ path + url;
|
111
|
-
|
112
136
|
};
|
113
137
|
|
138
|
+
// Public: assign a new function to onload to use swfobject's domLoad functionality
|
139
|
+
SWFUpload.onload = function () {};
|
140
|
+
|
114
141
|
|
115
142
|
/* ******************** */
|
116
143
|
/* Instance Members */
|
@@ -118,9 +145,15 @@ SWFUpload.completeURL = function(url) {
|
|
118
145
|
|
119
146
|
// Private: initSettings ensures that all the
|
120
147
|
// settings are set, getting a default value if one was not assigned.
|
121
|
-
SWFUpload.prototype.initSettings = function () {
|
148
|
+
SWFUpload.prototype.initSettings = function (userSettings) {
|
149
|
+
userSettings = this.tmp_settings; // Fixes a bug where userSettings is undefined
|
122
150
|
this.ensureDefault = function (settingName, defaultValue) {
|
123
|
-
|
151
|
+
var setting = userSettings[settingName];
|
152
|
+
if (setting != undefined) {
|
153
|
+
this.settings[settingName] = setting;
|
154
|
+
} else {
|
155
|
+
this.settings[settingName] = defaultValue;
|
156
|
+
}
|
124
157
|
};
|
125
158
|
|
126
159
|
// Upload backend settings
|
@@ -142,6 +175,7 @@ SWFUpload.prototype.initSettings = function () {
|
|
142
175
|
|
143
176
|
// Flash Settings
|
144
177
|
this.ensureDefault("flash_url", "swfupload.swf");
|
178
|
+
this.ensureDefault("flash9_url", "swfupload_fp9.swf");
|
145
179
|
this.ensureDefault("prevent_swf_caching", true);
|
146
180
|
|
147
181
|
// Button Settings
|
@@ -165,18 +199,25 @@ SWFUpload.prototype.initSettings = function () {
|
|
165
199
|
|
166
200
|
// Event Handlers
|
167
201
|
this.settings.return_upload_start_handler = this.returnUploadStart;
|
202
|
+
this.ensureDefault("swfupload_preload_handler", null);
|
203
|
+
this.ensureDefault("swfupload_load_failed_handler", null);
|
168
204
|
this.ensureDefault("swfupload_loaded_handler", null);
|
169
205
|
this.ensureDefault("file_dialog_start_handler", null);
|
170
206
|
this.ensureDefault("file_queued_handler", null);
|
171
207
|
this.ensureDefault("file_queue_error_handler", null);
|
172
208
|
this.ensureDefault("file_dialog_complete_handler", null);
|
173
209
|
|
210
|
+
this.ensureDefault("upload_resize_start_handler", null);
|
174
211
|
this.ensureDefault("upload_start_handler", null);
|
175
212
|
this.ensureDefault("upload_progress_handler", null);
|
176
213
|
this.ensureDefault("upload_error_handler", null);
|
177
214
|
this.ensureDefault("upload_success_handler", null);
|
178
215
|
this.ensureDefault("upload_complete_handler", null);
|
179
216
|
|
217
|
+
this.ensureDefault("mouse_click_handler", null);
|
218
|
+
this.ensureDefault("mouse_out_handler", null);
|
219
|
+
this.ensureDefault("mouse_over_handler", null);
|
220
|
+
|
180
221
|
this.ensureDefault("debug_handler", this.debugMessage);
|
181
222
|
|
182
223
|
this.ensureDefault("custom_settings", {});
|
@@ -187,10 +228,10 @@ SWFUpload.prototype.initSettings = function () {
|
|
187
228
|
// Update the flash url if needed
|
188
229
|
if (!!this.settings.prevent_swf_caching) {
|
189
230
|
this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
|
231
|
+
this.settings.flash9_url = this.settings.flash9_url + (this.settings.flash9_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
|
190
232
|
}
|
191
233
|
|
192
234
|
if (!this.settings.preserve_relative_urls) {
|
193
|
-
//this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url); // Don't need to do this one since flash doesn't look at it
|
194
235
|
this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
|
195
236
|
this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
|
196
237
|
}
|
@@ -198,42 +239,80 @@ SWFUpload.prototype.initSettings = function () {
|
|
198
239
|
delete this.ensureDefault;
|
199
240
|
};
|
200
241
|
|
242
|
+
// Initializes the supported functionality based the Flash Player version, state, and event that occur during initialization
|
243
|
+
SWFUpload.prototype.loadSupport = function () {
|
244
|
+
this.support = {
|
245
|
+
loading : swfobject.hasFlashPlayerVersion("9.0.28"),
|
246
|
+
imageResize : swfobject.hasFlashPlayerVersion("10.0.0")
|
247
|
+
};
|
248
|
+
|
249
|
+
};
|
250
|
+
|
201
251
|
// Private: loadFlash replaces the button_placeholder element with the flash movie.
|
202
252
|
SWFUpload.prototype.loadFlash = function () {
|
203
|
-
var targetElement, tempParent;
|
253
|
+
var targetElement, tempParent, wrapperType, flashHTML, els;
|
204
254
|
|
255
|
+
if (!this.support.loading) {
|
256
|
+
this.queueEvent("swfupload_load_failed_handler", ["Flash Player doesn't support SWFUpload"]);
|
257
|
+
return;
|
258
|
+
}
|
259
|
+
|
205
260
|
// Make sure an element with the ID we are going to use doesn't already exist
|
206
261
|
if (document.getElementById(this.movieName) !== null) {
|
207
|
-
|
262
|
+
this.support.loading = false;
|
263
|
+
this.queueEvent("swfupload_load_failed_handler", ["Element ID already in use"]);
|
264
|
+
return;
|
208
265
|
}
|
209
266
|
|
210
267
|
// Get the element where we will be placing the flash movie
|
211
268
|
targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
|
212
269
|
|
213
270
|
if (targetElement == undefined) {
|
214
|
-
|
271
|
+
this.support.loading = false;
|
272
|
+
this.queueEvent("swfupload_load_failed_handler", ["button place holder not found"]);
|
273
|
+
return;
|
215
274
|
}
|
216
275
|
|
276
|
+
wrapperType = (targetElement.currentStyle && targetElement.currentStyle["display"] || window.getComputedStyle && document.defaultView.getComputedStyle(targetElement, null).getPropertyValue("display")) !== "block" ? "span" : "div";
|
277
|
+
|
217
278
|
// Append the container and load the flash
|
218
|
-
tempParent = document.createElement(
|
219
|
-
|
279
|
+
tempParent = document.createElement(wrapperType);
|
280
|
+
|
281
|
+
flashHTML = this.getFlashHTML();
|
282
|
+
|
283
|
+
try {
|
284
|
+
tempParent.innerHTML = flashHTML; // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
|
285
|
+
} catch (ex) {
|
286
|
+
this.support.loading = false;
|
287
|
+
this.queueEvent("swfupload_load_failed_handler", ["Exception loading Flash HTML into placeholder"]);
|
288
|
+
return;
|
289
|
+
}
|
290
|
+
|
291
|
+
// Try to get the movie element immediately
|
292
|
+
els = tempParent.getElementsByTagName("object");
|
293
|
+
if (!els || els.length > 1 || els.length === 0) {
|
294
|
+
this.support.loading = false;
|
295
|
+
this.queueEvent("swfupload_load_failed_handler", ["Unable to find movie after adding to DOM"]);
|
296
|
+
return;
|
297
|
+
} else if (els.length === 1) {
|
298
|
+
this.movieElement = els[0];
|
299
|
+
}
|
300
|
+
|
220
301
|
targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
|
221
302
|
|
222
303
|
// Fix IE Flash/Form bug
|
223
304
|
if (window[this.movieName] == undefined) {
|
224
305
|
window[this.movieName] = this.getMovieElement();
|
225
306
|
}
|
226
|
-
|
227
307
|
};
|
228
308
|
|
229
309
|
// Private: getFlashHTML generates the object tag needed to embed the flash in to the document
|
230
|
-
SWFUpload.prototype.getFlashHTML = function () {
|
310
|
+
SWFUpload.prototype.getFlashHTML = function (flashVersion) {
|
231
311
|
// Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
|
232
|
-
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">',
|
312
|
+
return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', (this.support.imageResize ? this.settings.flash_url : this.settings.flash9_url), '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
|
233
313
|
'<param name="wmode" value="', this.settings.button_window_mode, '" />',
|
234
|
-
'<param name="movie" value="', this.settings.flash_url, '" />',
|
314
|
+
'<param name="movie" value="', (this.support.imageResize ? this.settings.flash_url : this.settings.flash9_url), '" />',
|
235
315
|
'<param name="quality" value="high" />',
|
236
|
-
'<param name="menu" value="false" />',
|
237
316
|
'<param name="allowScriptAccess" value="always" />',
|
238
317
|
'<param name="flashvars" value="' + this.getFlashVars() + '" />',
|
239
318
|
'</object>'].join("");
|
@@ -243,8 +322,10 @@ SWFUpload.prototype.getFlashHTML = function () {
|
|
243
322
|
// to flash in the flashvars param.
|
244
323
|
SWFUpload.prototype.getFlashVars = function () {
|
245
324
|
// Build a string from the post param object
|
246
|
-
var paramString
|
247
|
-
|
325
|
+
var httpSuccessString, paramString;
|
326
|
+
|
327
|
+
paramString = this.buildParamString();
|
328
|
+
httpSuccessString = this.settings.http_success.join(",");
|
248
329
|
|
249
330
|
// Build the parameter string
|
250
331
|
return ["movieName=", encodeURIComponent(this.movieName),
|
@@ -274,7 +355,7 @@ SWFUpload.prototype.getFlashVars = function () {
|
|
274
355
|
].join("");
|
275
356
|
};
|
276
357
|
|
277
|
-
// Public:
|
358
|
+
// Public: get retrieves the DOM reference to the Flash element added by SWFUpload
|
278
359
|
// The element is cached after the first lookup
|
279
360
|
SWFUpload.prototype.getMovieElement = function () {
|
280
361
|
if (this.movieElement == undefined) {
|
@@ -291,11 +372,12 @@ SWFUpload.prototype.getMovieElement = function () {
|
|
291
372
|
// Private: buildParamString takes the name/value pairs in the post_params setting object
|
292
373
|
// and joins them up in to a string formatted "name=value&name=value"
|
293
374
|
SWFUpload.prototype.buildParamString = function () {
|
294
|
-
var postParams =
|
295
|
-
|
375
|
+
var name, postParams, paramStringPairs = [];
|
376
|
+
|
377
|
+
postParams = this.settings.post_params;
|
296
378
|
|
297
379
|
if (typeof(postParams) === "object") {
|
298
|
-
for (
|
380
|
+
for (name in postParams) {
|
299
381
|
if (postParams.hasOwnProperty(name)) {
|
300
382
|
paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
|
301
383
|
}
|
@@ -310,31 +392,22 @@ SWFUpload.prototype.buildParamString = function () {
|
|
310
392
|
// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
|
311
393
|
// Credits: Major improvements provided by steffen
|
312
394
|
SWFUpload.prototype.destroy = function () {
|
395
|
+
var movieElement;
|
396
|
+
|
313
397
|
try {
|
314
398
|
// Make sure Flash is done before we try to remove it
|
315
399
|
this.cancelUpload(null, false);
|
316
400
|
|
401
|
+
movieElement = this.cleanUp();
|
317
402
|
|
318
403
|
// Remove the SWFUpload DOM nodes
|
319
|
-
|
320
|
-
movieElement = this.getMovieElement();
|
321
|
-
|
322
|
-
if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
|
323
|
-
// Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround)
|
324
|
-
for (var i in movieElement) {
|
325
|
-
try {
|
326
|
-
if (typeof(movieElement[i]) === "function") {
|
327
|
-
movieElement[i] = null;
|
328
|
-
}
|
329
|
-
} catch (ex1) {}
|
330
|
-
}
|
331
|
-
|
404
|
+
if (movieElement) {
|
332
405
|
// Remove the Movie Element from the page
|
333
406
|
try {
|
334
407
|
movieElement.parentNode.removeChild(movieElement);
|
335
408
|
} catch (ex) {}
|
336
409
|
}
|
337
|
-
|
410
|
+
|
338
411
|
// Remove IE form fix reference
|
339
412
|
window[this.movieName] = null;
|
340
413
|
|
@@ -369,6 +442,7 @@ SWFUpload.prototype.displayDebugInfo = function () {
|
|
369
442
|
"Settings:\n",
|
370
443
|
"\t", "upload_url: ", this.settings.upload_url, "\n",
|
371
444
|
"\t", "flash_url: ", this.settings.flash_url, "\n",
|
445
|
+
"\t", "flash9_url: ", this.settings.flash9_url, "\n",
|
372
446
|
"\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n",
|
373
447
|
"\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n",
|
374
448
|
"\t", "http_success: ", this.settings.http_success.join(", "), "\n",
|
@@ -394,20 +468,32 @@ SWFUpload.prototype.displayDebugInfo = function () {
|
|
394
468
|
"\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n",
|
395
469
|
"\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",
|
396
470
|
"\t", "button_action: ", this.settings.button_action.toString(), "\n",
|
471
|
+
"\t", "button_cursor: ", this.settings.button_cursor.toString(), "\n",
|
397
472
|
"\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n",
|
398
473
|
|
399
474
|
"\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n",
|
400
475
|
"Event Handlers:\n",
|
476
|
+
"\t", "swfupload_preload_handler assigned: ", (typeof this.settings.swfupload_preload_handler === "function").toString(), "\n",
|
477
|
+
"\t", "swfupload_load_failed_handler assigned: ", (typeof this.settings.swfupload_load_failed_handler === "function").toString(), "\n",
|
401
478
|
"\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",
|
479
|
+
"\t", "mouse_click_handler assigned: ", (typeof this.settings.mouse_click_handler === "function").toString(), "\n",
|
480
|
+
"\t", "mouse_over_handler assigned: ", (typeof this.settings.mouse_over_handler === "function").toString(), "\n",
|
481
|
+
"\t", "mouse_out_handler assigned: ", (typeof this.settings.mouse_out_handler === "function").toString(), "\n",
|
402
482
|
"\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",
|
403
483
|
"\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",
|
404
484
|
"\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",
|
485
|
+
"\t", "upload_resize_start_handler assigned: ", (typeof this.settings.upload_resize_start_handler === "function").toString(), "\n",
|
405
486
|
"\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",
|
406
487
|
"\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",
|
407
488
|
"\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",
|
408
489
|
"\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",
|
409
490
|
"\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",
|
410
|
-
"\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n"
|
491
|
+
"\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n",
|
492
|
+
|
493
|
+
"Support:\n",
|
494
|
+
"\t", "Load: ", (this.support.loading ? "Yes" : "No"), "\n",
|
495
|
+
"\t", "Image Resize: ", (this.support.imageResize ? "Yes" : "No"), "\n"
|
496
|
+
|
411
497
|
].join("")
|
412
498
|
);
|
413
499
|
};
|
@@ -439,17 +525,21 @@ SWFUpload.prototype.getSetting = function (name) {
|
|
439
525
|
// Calls are made with a setTimeout for some functions to work around
|
440
526
|
// bugs in the ExternalInterface library.
|
441
527
|
SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
|
442
|
-
|
528
|
+
var movieElement, returnValue, returnString;
|
443
529
|
|
444
|
-
|
445
|
-
|
530
|
+
argumentArray = argumentArray || [];
|
531
|
+
movieElement = this.getMovieElement();
|
446
532
|
|
447
533
|
// Flash's method if calling ExternalInterface methods (code adapted from MooTools).
|
448
534
|
try {
|
449
|
-
|
450
|
-
|
535
|
+
if (movieElement != undefined) {
|
536
|
+
returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
|
537
|
+
returnValue = eval(returnString);
|
538
|
+
} else {
|
539
|
+
this.debug("Can't call flash because the movie wasn't found.");
|
540
|
+
}
|
451
541
|
} catch (ex) {
|
452
|
-
|
542
|
+
this.debug("Exception calling flash function '" + functionName + "': " + ex.message);
|
453
543
|
}
|
454
544
|
|
455
545
|
// Unescape file post param values
|
@@ -490,6 +580,12 @@ SWFUpload.prototype.startUpload = function (fileID) {
|
|
490
580
|
this.callFlash("StartUpload", [fileID]);
|
491
581
|
};
|
492
582
|
|
583
|
+
// Public: startUpload starts uploading the first file in the queue unless
|
584
|
+
// the optional parameter 'fileID' specifies the ID
|
585
|
+
SWFUpload.prototype.startResizedUpload = function (fileID, width, height, encoding, quality, allowEnlarging) {
|
586
|
+
this.callFlash("StartUpload", [fileID, { "width": width, "height" : height, "encoding" : encoding, "quality" : quality, "allowEnlarging" : allowEnlarging }]);
|
587
|
+
};
|
588
|
+
|
493
589
|
// Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index.
|
494
590
|
// If you do not specify a fileID the current uploading file or first file in the queue is cancelled.
|
495
591
|
// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter.
|
@@ -506,6 +602,15 @@ SWFUpload.prototype.stopUpload = function () {
|
|
506
602
|
this.callFlash("StopUpload");
|
507
603
|
};
|
508
604
|
|
605
|
+
|
606
|
+
// Public: requeueUpload requeues any file. If the file is requeued or already queued true is returned.
|
607
|
+
// If the file is not found or is currently uploading false is returned. Requeuing a file bypasses the
|
608
|
+
// file size, queue size, upload limit and other queue checks. Certain files can't be requeued (e.g, invalid or zero bytes files).
|
609
|
+
SWFUpload.prototype.requeueUpload = function (indexOrFileID) {
|
610
|
+
return this.callFlash("RequeueUpload", [indexOrFileID]);
|
611
|
+
};
|
612
|
+
|
613
|
+
|
509
614
|
/* ************************
|
510
615
|
* Settings methods
|
511
616
|
* These methods change the SWFUpload settings.
|
@@ -537,6 +642,17 @@ SWFUpload.prototype.getFile = function (fileID) {
|
|
537
642
|
}
|
538
643
|
};
|
539
644
|
|
645
|
+
// Public: getFileFromQueue retrieves a File object by ID or Index. If the file is
|
646
|
+
// not found then 'null' is returned.
|
647
|
+
SWFUpload.prototype.getQueueFile = function (fileID) {
|
648
|
+
if (typeof(fileID) === "number") {
|
649
|
+
return this.callFlash("GetFileByQueueIndex", [fileID]);
|
650
|
+
} else {
|
651
|
+
return this.callFlash("GetFile", [fileID]);
|
652
|
+
}
|
653
|
+
};
|
654
|
+
|
655
|
+
|
540
656
|
// Public: addFileParam sets a name/value pair that will be posted with the
|
541
657
|
// file specified by the Files ID. If the name already exists then the
|
542
658
|
// exiting value will be overwritten.
|
@@ -711,6 +827,7 @@ SWFUpload.prototype.setButtonCursor = function (cursor) {
|
|
711
827
|
|
712
828
|
SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
|
713
829
|
// Warning: Don't call this.debug inside here or you'll create an infinite loop
|
830
|
+
var self = this;
|
714
831
|
|
715
832
|
if (argumentArray == undefined) {
|
716
833
|
argumentArray = [];
|
@@ -718,7 +835,6 @@ SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
|
|
718
835
|
argumentArray = [argumentArray];
|
719
836
|
}
|
720
837
|
|
721
|
-
var self = this;
|
722
838
|
if (typeof this.settings[handlerName] === "function") {
|
723
839
|
// Queue the event
|
724
840
|
this.eventQueue.push(function () {
|
@@ -750,15 +866,12 @@ SWFUpload.prototype.executeNextEvent = function () {
|
|
750
866
|
// properties that contain characters that are not valid for JavaScript identifiers. To work around this
|
751
867
|
// the Flash Component escapes the parameter names and we must unescape again before passing them along.
|
752
868
|
SWFUpload.prototype.unescapeFilePostParams = function (file) {
|
753
|
-
var reg = /[$]([0-9a-f]{4})/i;
|
754
|
-
var unescapedPost = {};
|
755
|
-
var uk;
|
869
|
+
var reg = /[$]([0-9a-f]{4})/i, unescapedPost = {}, uk, k, match;
|
756
870
|
|
757
871
|
if (file != undefined) {
|
758
|
-
for (
|
872
|
+
for (k in file.post) {
|
759
873
|
if (file.post.hasOwnProperty(k)) {
|
760
874
|
uk = k;
|
761
|
-
var match;
|
762
875
|
while ((match = reg.exec(uk)) !== null) {
|
763
876
|
uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
|
764
877
|
}
|
@@ -772,39 +885,51 @@ SWFUpload.prototype.unescapeFilePostParams = function (file) {
|
|
772
885
|
return file;
|
773
886
|
};
|
774
887
|
|
775
|
-
// Private:
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
888
|
+
// Private: This event is called by SWFUpload Init after we've determined what the user's Flash Player supports.
|
889
|
+
// Use the swfupload_preload_handler event setting to execute custom code when SWFUpload has loaded.
|
890
|
+
// Return false to prevent SWFUpload from loading and allow your script to do something else if your required feature is
|
891
|
+
// not supported
|
892
|
+
SWFUpload.prototype.swfuploadPreload = function () {
|
893
|
+
var returnValue;
|
894
|
+
if (typeof this.settings.swfupload_preload_handler === "function") {
|
895
|
+
returnValue = this.settings.swfupload_preload_handler.call(this);
|
896
|
+
} else if (this.settings.swfupload_preload_handler != undefined) {
|
897
|
+
throw "upload_start_handler must be a function";
|
781
898
|
}
|
782
|
-
|
899
|
+
|
900
|
+
// Convert undefined to true so if nothing is returned from the upload_start_handler it is
|
901
|
+
// interpretted as 'true'.
|
902
|
+
if (returnValue === undefined) {
|
903
|
+
returnValue = true;
|
904
|
+
}
|
905
|
+
|
906
|
+
return !!returnValue;
|
907
|
+
}
|
783
908
|
|
784
909
|
// Private: This event is called by Flash when it has finished loading. Don't modify this.
|
785
910
|
// Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded.
|
786
911
|
SWFUpload.prototype.flashReady = function () {
|
787
912
|
// Check that the movie element is loaded correctly with its ExternalInterface methods defined
|
788
|
-
var movieElement =
|
913
|
+
var movieElement = this.cleanUp();
|
789
914
|
|
790
915
|
if (!movieElement) {
|
791
916
|
this.debug("Flash called back ready but the flash movie can't be found.");
|
792
917
|
return;
|
793
918
|
}
|
794
919
|
|
795
|
-
this.cleanUp(movieElement);
|
796
|
-
|
797
920
|
this.queueEvent("swfupload_loaded_handler");
|
798
921
|
};
|
799
922
|
|
800
923
|
// Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE.
|
801
924
|
// This function is called by Flash each time the ExternalInterface functions are created.
|
802
|
-
SWFUpload.prototype.cleanUp = function (
|
925
|
+
SWFUpload.prototype.cleanUp = function () {
|
926
|
+
var key, movieElement = this.getMovieElement();
|
927
|
+
|
803
928
|
// Pro-actively unhook all the Flash functions
|
804
929
|
try {
|
805
|
-
if (
|
930
|
+
if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
|
806
931
|
this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
|
807
|
-
for (
|
932
|
+
for (key in movieElement) {
|
808
933
|
try {
|
809
934
|
if (typeof(movieElement[key]) === "function") {
|
810
935
|
movieElement[key] = null;
|
@@ -817,7 +942,7 @@ SWFUpload.prototype.cleanUp = function (movieElement) {
|
|
817
942
|
|
818
943
|
}
|
819
944
|
|
820
|
-
// Fix Flashes own cleanup code so if the
|
945
|
+
// Fix Flashes own cleanup code so if the SWF Movie was removed from the page
|
821
946
|
// it doesn't display errors.
|
822
947
|
window["__flash__removeCallback"] = function (instance, name) {
|
823
948
|
try {
|
@@ -828,9 +953,20 @@ SWFUpload.prototype.cleanUp = function (movieElement) {
|
|
828
953
|
|
829
954
|
}
|
830
955
|
};
|
831
|
-
|
956
|
+
|
957
|
+
return movieElement;
|
832
958
|
};
|
833
959
|
|
960
|
+
/* When the button_action is set to None this event gets fired and executes the mouse_click_handler */
|
961
|
+
SWFUpload.prototype.mouseClick = function () {
|
962
|
+
this.queueEvent("mouse_click_handler");
|
963
|
+
};
|
964
|
+
SWFUpload.prototype.mouseOver = function () {
|
965
|
+
this.queueEvent("mouse_over_handler");
|
966
|
+
};
|
967
|
+
SWFUpload.prototype.mouseOut = function () {
|
968
|
+
this.queueEvent("mouse_out_handler");
|
969
|
+
};
|
834
970
|
|
835
971
|
/* This is a chance to do something before the browse window opens */
|
836
972
|
SWFUpload.prototype.fileDialogStart = function () {
|
@@ -857,6 +993,11 @@ SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQue
|
|
857
993
|
this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]);
|
858
994
|
};
|
859
995
|
|
996
|
+
SWFUpload.prototype.uploadResizeStart = function (file, resizeSettings) {
|
997
|
+
file = this.unescapeFilePostParams(file);
|
998
|
+
this.queueEvent("upload_resize_start_handler", [file, resizeSettings.width, resizeSettings.height, resizeSettings.encoding, resizeSettings.quality]);
|
999
|
+
};
|
1000
|
+
|
860
1001
|
SWFUpload.prototype.uploadStart = function (file) {
|
861
1002
|
file = this.unescapeFilePostParams(file);
|
862
1003
|
this.queueEvent("return_upload_start_handler", file);
|
@@ -928,12 +1069,14 @@ SWFUpload.prototype.debug = function (message) {
|
|
928
1069
|
// call the debug() function. When overriding the function your own function should
|
929
1070
|
// check to see if the debug setting is true before outputting debug information.
|
930
1071
|
SWFUpload.prototype.debugMessage = function (message) {
|
1072
|
+
var exceptionMessage, exceptionValues, key;
|
1073
|
+
|
931
1074
|
if (this.settings.debug) {
|
932
|
-
|
1075
|
+
exceptionValues = [];
|
933
1076
|
|
934
1077
|
// Check for an exception object and print it nicely
|
935
1078
|
if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
|
936
|
-
for (
|
1079
|
+
for (key in message) {
|
937
1080
|
if (message.hasOwnProperty(key)) {
|
938
1081
|
exceptionValues.push(key + ": " + message[key]);
|
939
1082
|
}
|
@@ -978,3 +1121,14 @@ SWFUpload.Console.writeLine = function (message) {
|
|
978
1121
|
alert("Exception: " + ex.name + " Message: " + ex.message);
|
979
1122
|
}
|
980
1123
|
};
|
1124
|
+
|
1125
|
+
|
1126
|
+
/* SWFObject v2.2 <http://code.google.com/p/swfobject/>
|
1127
|
+
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
|
1128
|
+
*/
|
1129
|
+
swfobject = function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
|
1130
|
+
swfobject.addDomLoadEvent(function () {
|
1131
|
+
if (typeof(SWFUpload.onload) === "function") {
|
1132
|
+
SWFUpload.onload.call(window);
|
1133
|
+
}
|
1134
|
+
});
|
@@ -0,0 +1,96 @@
|
|
1
|
+
/*
|
2
|
+
Proxy Plug-in
|
3
|
+
|
4
|
+
Features:
|
5
|
+
Times an upload to see if it appear suspiciously fast which might indicate a proxy server or anti-virus suite intercepting the upload.
|
6
|
+
If the upload seems too fast an uploadError event is fired with PROXY error code after the final uploadProgress event.
|
7
|
+
|
8
|
+
Adds a SWFUpload setting allowing you to tweak the bytes/s for triggering the error:
|
9
|
+
proxy_detect_threshold : 256000
|
10
|
+
|
11
|
+
Adds an UPLOAD_ERROR entry called PROXY:
|
12
|
+
function uploadError(file, errorCode, message) {
|
13
|
+
if (errorCode === SWFUpload.UPLOAD_ERROR.PROXY) {
|
14
|
+
alert("You might have a proxy!");
|
15
|
+
}
|
16
|
+
}
|
17
|
+
*/
|
18
|
+
|
19
|
+
var SWFUpload;
|
20
|
+
if (typeof(SWFUpload) === "function") {
|
21
|
+
SWFUpload.proxyDetect = {};
|
22
|
+
SWFUpload.UPLOAD_ERROR.PROXY = -30300;
|
23
|
+
|
24
|
+
SWFUpload.prototype.initSettings = (function (oldInitSettings) {
|
25
|
+
return function (userSettings) {
|
26
|
+
if (typeof(oldInitSettings) === "function") {
|
27
|
+
oldInitSettings.call(this, userSettings);
|
28
|
+
}
|
29
|
+
|
30
|
+
this.ensureDefault = function (settingName, defaultValue) {
|
31
|
+
this.settings[settingName] = (userSettings[settingName] == undefined) ? defaultValue : userSettings[settingName];
|
32
|
+
};
|
33
|
+
|
34
|
+
// List used to keep the speed stats for the files we are tracking
|
35
|
+
this.proxyDetectFileStartTimes = {};
|
36
|
+
this.proxyDetectSettings = {};
|
37
|
+
|
38
|
+
this.ensureDefault("proxy_detect_threshold", 256000); // Default is 250 KB per second
|
39
|
+
|
40
|
+
this.proxyDetectSettings.user_upload_progress_handler = this.settings.upload_progress_handler;
|
41
|
+
this.proxyDetectSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
|
42
|
+
|
43
|
+
this.settings.upload_progress_handler = SWFUpload.proxyDetect.uploadProgressHandler;
|
44
|
+
this.settings.upload_complete_handler = SWFUpload.proxyDetect.uploadCompleteHandler;
|
45
|
+
|
46
|
+
|
47
|
+
delete this.ensureDefault;
|
48
|
+
};
|
49
|
+
}(SWFUpload.prototype.initSettings));
|
50
|
+
|
51
|
+
SWFUpload.proxyDetect.uploadProgressHandler = function (file, bytesComplete, bytesTotal) {
|
52
|
+
var ex1 = null, time, differenceMS, bps;
|
53
|
+
try {
|
54
|
+
if (typeof this.proxyDetectSettings.user_upload_progress_handler === "function") {
|
55
|
+
this.proxyDetectSettings.user_upload_progress_handler.call(this, file, bytesComplete, bytesTotal);
|
56
|
+
}
|
57
|
+
} catch (ex1) { }
|
58
|
+
|
59
|
+
|
60
|
+
if (bytesComplete === 0) {
|
61
|
+
this.proxyDetectFileStartTimes[file.ID] = new Date();
|
62
|
+
|
63
|
+
} else if (bytesComplete === bytesTotal) {
|
64
|
+
try {
|
65
|
+
// Calculate the Bps and decide if we should trigger the error
|
66
|
+
time = new Date();
|
67
|
+
differenceMS = time.getTime() - this.proxyDetectFileStartTimes[file.ID].getTime();
|
68
|
+
|
69
|
+
if (differenceMS === 0) {
|
70
|
+
differenceMS = 1;
|
71
|
+
}
|
72
|
+
|
73
|
+
bps = bytesTotal / (differenceMS * 1000);
|
74
|
+
if (bps > parseInt(this.settings.proxy_detect_threshold, 10)) {
|
75
|
+
this.queueEvent("upload_error_handler", [file, SWFUpload.UPLOAD_ERROR.PROXY, bps]);
|
76
|
+
}
|
77
|
+
} catch (ex) {
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
if (ex1 !== null) {
|
82
|
+
throw(ex1);
|
83
|
+
}
|
84
|
+
};
|
85
|
+
|
86
|
+
SWFUpload.proxyDetect.uploadCompleteHandler = function (file) {
|
87
|
+
try {
|
88
|
+
delete this.proxyDetectFileStartTimes[file.ID];
|
89
|
+
} catch (ex) {
|
90
|
+
}
|
91
|
+
|
92
|
+
if (typeof this.proxyDetectSettings.user_upload_progress_handler === "function") {
|
93
|
+
return this.proxyDetectSettings.user_upload_progress_handler.call(this, file);
|
94
|
+
}
|
95
|
+
};
|
96
|
+
}
|
@@ -16,9 +16,10 @@ if (typeof(SWFUpload) === "function") {
|
|
16
16
|
SWFUpload.queue = {};
|
17
17
|
|
18
18
|
SWFUpload.prototype.initSettings = (function (oldInitSettings) {
|
19
|
-
return function () {
|
19
|
+
return function (userSettings) {
|
20
|
+
userSettings = this.tmp_settings; // This fixes a bug where userSettings is undefined
|
20
21
|
if (typeof(oldInitSettings) === "function") {
|
21
|
-
oldInitSettings.call(this);
|
22
|
+
oldInitSettings.call(this, userSettings);
|
22
23
|
}
|
23
24
|
|
24
25
|
this.queueSettings = {};
|
@@ -31,7 +32,7 @@ if (typeof(SWFUpload) === "function") {
|
|
31
32
|
this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
|
32
33
|
this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler;
|
33
34
|
|
34
|
-
this.settings.queue_complete_handler =
|
35
|
+
this.settings.queue_complete_handler = userSettings.queue_complete_handler || null;
|
35
36
|
};
|
36
37
|
})(SWFUpload.prototype.initSettings);
|
37
38
|
|
@@ -3,9 +3,9 @@
|
|
3
3
|
|
4
4
|
Features:
|
5
5
|
*Adds several properties to the 'file' object indicated upload speed, time left, upload time, etc.
|
6
|
-
- currentSpeed -- String indicating the upload speed,
|
7
|
-
- averageSpeed -- Overall average upload speed,
|
8
|
-
- movingAverageSpeed -- Speed over averaged over the last several measurements,
|
6
|
+
- currentSpeed -- String indicating the upload speed, bits per second
|
7
|
+
- averageSpeed -- Overall average upload speed, bits per second
|
8
|
+
- movingAverageSpeed -- Speed over averaged over the last several measurements, bits per second
|
9
9
|
- timeRemaining -- Estimated remaining upload time in seconds
|
10
10
|
- timeElapsed -- Number of seconds passed for this upload
|
11
11
|
- percentUploaded -- Percentage of the file uploaded (0 to 100)
|
@@ -29,13 +29,13 @@ if (typeof(SWFUpload) === "function") {
|
|
29
29
|
SWFUpload.speed = {};
|
30
30
|
|
31
31
|
SWFUpload.prototype.initSettings = (function (oldInitSettings) {
|
32
|
-
return function () {
|
32
|
+
return function (userSettings) {
|
33
33
|
if (typeof(oldInitSettings) === "function") {
|
34
|
-
oldInitSettings.call(this);
|
34
|
+
oldInitSettings.call(this, userSettings);
|
35
35
|
}
|
36
36
|
|
37
37
|
this.ensureDefault = function (settingName, defaultValue) {
|
38
|
-
this.settings[settingName] = (
|
38
|
+
this.settings[settingName] = (userSettings[settingName] == undefined) ? defaultValue : userSettings[settingName];
|
39
39
|
};
|
40
40
|
|
41
41
|
// List used to keep the speed stats for the files we are tracking
|
@@ -124,6 +124,10 @@ if (typeof(SWFUpload) === "function") {
|
|
124
124
|
SWFUpload.speed.extendFile = function (file, trackingList) {
|
125
125
|
var tracking;
|
126
126
|
|
127
|
+
if (!file) {
|
128
|
+
return file;
|
129
|
+
}
|
130
|
+
|
127
131
|
if (trackingList) {
|
128
132
|
tracking = trackingList[file.id];
|
129
133
|
}
|
data/public/swf/swfupload.swf
CHANGED
Binary file
|
Binary file
|
@@ -1,14 +1,22 @@
|
|
1
1
|
development:
|
2
|
-
adapter:
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
adapter: mysql
|
3
|
+
encoding: utf8
|
4
|
+
database: uploader_development
|
5
|
+
username: root
|
6
|
+
password:
|
7
|
+
host: 127.0.0.1
|
6
8
|
test:
|
7
|
-
adapter:
|
8
|
-
|
9
|
-
|
9
|
+
adapter: mysql
|
10
|
+
encoding: utf8
|
11
|
+
database: uploader_test
|
12
|
+
username: root
|
13
|
+
password:
|
14
|
+
socket: /tmp/mysql.sock
|
10
15
|
|
11
16
|
production:
|
12
|
-
adapter:
|
13
|
-
|
14
|
-
|
17
|
+
adapter: mysql
|
18
|
+
encoding: utf8
|
19
|
+
database: uploader_production
|
20
|
+
username: root
|
21
|
+
password:
|
22
|
+
socket: /tmp/mysql.sock
|
Binary file
|
data/uploader.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{uploader}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Ball", "David South"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-08-24}
|
13
13
|
s.description = %q{Uploader gem that makes it simple add multiple file uploads to your Rails project using SWFUpload and Paperclip}
|
14
14
|
s.email = %q{justinball@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -136,11 +136,13 @@ Gem::Specification.new do |s|
|
|
136
136
|
"public/javascripts/swfupload/handlers.js",
|
137
137
|
"public/javascripts/swfupload/swfupload.cookies.js",
|
138
138
|
"public/javascripts/swfupload/swfupload.js",
|
139
|
+
"public/javascripts/swfupload/swfupload.proxy.js",
|
139
140
|
"public/javascripts/swfupload/swfupload.queue.js",
|
140
141
|
"public/javascripts/swfupload/swfupload.speed.js",
|
141
142
|
"public/javascripts/swfupload/swfupload.swfobject.js",
|
142
143
|
"public/stylesheets/swfupload.css",
|
143
144
|
"public/swf/swfupload.swf",
|
145
|
+
"public/swf/swfupload_fp9.swf",
|
144
146
|
"rails/init.rb",
|
145
147
|
"tasks/rails.rake",
|
146
148
|
"test/rails_root/.gitignore",
|
@@ -261,6 +263,7 @@ Gem::Specification.new do |s|
|
|
261
263
|
"test/rails_root/public/robots.txt",
|
262
264
|
"test/rails_root/public/stylesheets/.keep",
|
263
265
|
"test/rails_root/public/stylesheets/swfupload.css",
|
266
|
+
"test/rails_root/public/swf/swfupload.swf",
|
264
267
|
"test/rails_root/script/about",
|
265
268
|
"test/rails_root/script/breakpointer",
|
266
269
|
"test/rails_root/script/console",
|
@@ -301,7 +304,7 @@ Gem::Specification.new do |s|
|
|
301
304
|
s.rdoc_options = ["--charset=UTF-8"]
|
302
305
|
s.require_paths = ["lib"]
|
303
306
|
s.rubyforge_project = %q{uploader}
|
304
|
-
s.rubygems_version = %q{1.3.
|
307
|
+
s.rubygems_version = %q{1.3.7}
|
305
308
|
s.summary = %q{SWFUpload + Paperclip wrapped in an engine with love.}
|
306
309
|
s.test_files = [
|
307
310
|
"test/rails_root/app/controllers/application_controller.rb",
|
@@ -340,7 +343,7 @@ Gem::Specification.new do |s|
|
|
340
343
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
341
344
|
s.specification_version = 3
|
342
345
|
|
343
|
-
if Gem::Version.new(Gem::
|
346
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
344
347
|
s.add_runtime_dependency(%q<mime-types>, [">= 0"])
|
345
348
|
s.add_runtime_dependency(%q<rack>, [">= 0"])
|
346
349
|
s.add_runtime_dependency(%q<paperclip>, [">= 0"])
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uploader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 7
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 8
|
10
|
+
version: 0.2.8
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Justin Ball
|
@@ -10,39 +16,51 @@ autorequire:
|
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
18
|
|
13
|
-
date:
|
19
|
+
date: 2010-08-24 00:00:00 -06:00
|
14
20
|
default_executable:
|
15
21
|
dependencies:
|
16
22
|
- !ruby/object:Gem::Dependency
|
17
23
|
name: mime-types
|
18
|
-
|
19
|
-
|
20
|
-
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
21
27
|
requirements:
|
22
28
|
- - ">="
|
23
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
24
33
|
version: "0"
|
25
|
-
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
26
36
|
- !ruby/object:Gem::Dependency
|
27
37
|
name: rack
|
28
|
-
|
29
|
-
|
30
|
-
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
31
41
|
requirements:
|
32
42
|
- - ">="
|
33
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
34
47
|
version: "0"
|
35
|
-
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id002
|
36
50
|
- !ruby/object:Gem::Dependency
|
37
51
|
name: paperclip
|
38
|
-
|
39
|
-
|
40
|
-
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
41
55
|
requirements:
|
42
56
|
- - ">="
|
43
57
|
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
44
61
|
version: "0"
|
45
|
-
|
62
|
+
type: :runtime
|
63
|
+
version_requirements: *id003
|
46
64
|
description: Uploader gem that makes it simple add multiple file uploads to your Rails project using SWFUpload and Paperclip
|
47
65
|
email: justinball@gmail.com
|
48
66
|
executables: []
|
@@ -172,11 +190,13 @@ files:
|
|
172
190
|
- public/javascripts/swfupload/handlers.js
|
173
191
|
- public/javascripts/swfupload/swfupload.cookies.js
|
174
192
|
- public/javascripts/swfupload/swfupload.js
|
193
|
+
- public/javascripts/swfupload/swfupload.proxy.js
|
175
194
|
- public/javascripts/swfupload/swfupload.queue.js
|
176
195
|
- public/javascripts/swfupload/swfupload.speed.js
|
177
196
|
- public/javascripts/swfupload/swfupload.swfobject.js
|
178
197
|
- public/stylesheets/swfupload.css
|
179
198
|
- public/swf/swfupload.swf
|
199
|
+
- public/swf/swfupload_fp9.swf
|
180
200
|
- rails/init.rb
|
181
201
|
- tasks/rails.rake
|
182
202
|
- test/rails_root/.gitignore
|
@@ -297,6 +317,7 @@ files:
|
|
297
317
|
- test/rails_root/public/robots.txt
|
298
318
|
- test/rails_root/public/stylesheets/.keep
|
299
319
|
- test/rails_root/public/stylesheets/swfupload.css
|
320
|
+
- test/rails_root/public/swf/swfupload.swf
|
300
321
|
- test/rails_root/script/about
|
301
322
|
- test/rails_root/script/breakpointer
|
302
323
|
- test/rails_root/script/console
|
@@ -342,21 +363,27 @@ rdoc_options:
|
|
342
363
|
require_paths:
|
343
364
|
- lib
|
344
365
|
required_ruby_version: !ruby/object:Gem::Requirement
|
366
|
+
none: false
|
345
367
|
requirements:
|
346
368
|
- - ">="
|
347
369
|
- !ruby/object:Gem::Version
|
370
|
+
hash: 3
|
371
|
+
segments:
|
372
|
+
- 0
|
348
373
|
version: "0"
|
349
|
-
version:
|
350
374
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
375
|
+
none: false
|
351
376
|
requirements:
|
352
377
|
- - ">="
|
353
378
|
- !ruby/object:Gem::Version
|
379
|
+
hash: 3
|
380
|
+
segments:
|
381
|
+
- 0
|
354
382
|
version: "0"
|
355
|
-
version:
|
356
383
|
requirements: []
|
357
384
|
|
358
385
|
rubyforge_project: uploader
|
359
|
-
rubygems_version: 1.3.
|
386
|
+
rubygems_version: 1.3.7
|
360
387
|
signing_key:
|
361
388
|
specification_version: 3
|
362
389
|
summary: SWFUpload + Paperclip wrapped in an engine with love.
|