1 |
efrain |
1 |
YUI.add('yui2-uploader', function(Y) {
|
|
|
2 |
var YAHOO = Y.YUI2;
|
|
|
3 |
/*
|
|
|
4 |
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
|
|
|
5 |
Code licensed under the BSD License:
|
|
|
6 |
http://developer.yahoo.com/yui/license.html
|
|
|
7 |
version: 2.9.0
|
|
|
8 |
*/
|
|
|
9 |
/*extern ActiveXObject, __flash_unloadHandler, __flash_savedUnloadHandler */
|
|
|
10 |
/*!
|
|
|
11 |
* SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
|
|
|
12 |
*
|
|
|
13 |
* SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
|
|
|
14 |
* http://www.opensource.org/licenses/mit-license.php
|
|
|
15 |
* @namespace YAHOO
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
YAHOO.namespace("deconcept");
|
|
|
19 |
|
|
|
20 |
YAHOO.deconcept = YAHOO.deconcept || {};
|
|
|
21 |
|
|
|
22 |
if(typeof YAHOO.deconcept.util == "undefined" || !YAHOO.deconcept.util)
|
|
|
23 |
{
|
|
|
24 |
YAHOO.deconcept.util = {};
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
if(typeof YAHOO.deconcept.SWFObjectUtil == "undefined" || !YAHOO.deconcept.SWFObjectUtil)
|
|
|
28 |
{
|
|
|
29 |
YAHOO.deconcept.SWFObjectUtil = {};
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
YAHOO.deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey)
|
|
|
33 |
{
|
|
|
34 |
if(!document.getElementById) { return; }
|
|
|
35 |
this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
|
|
|
36 |
this.skipDetect = YAHOO.deconcept.util.getRequestParameter(this.DETECT_KEY);
|
|
|
37 |
this.params = {};
|
|
|
38 |
this.variables = {};
|
|
|
39 |
this.attributes = [];
|
|
|
40 |
if(swf) { this.setAttribute('swf', swf); }
|
|
|
41 |
if(id) { this.setAttribute('id', id); }
|
|
|
42 |
if(w) { this.setAttribute('width', w); }
|
|
|
43 |
if(h) { this.setAttribute('height', h); }
|
|
|
44 |
if(ver) { this.setAttribute('version', new YAHOO.deconcept.PlayerVersion(ver.toString().split("."))); }
|
|
|
45 |
this.installedVer = YAHOO.deconcept.SWFObjectUtil.getPlayerVersion();
|
|
|
46 |
if (!window.opera && document.all && this.installedVer.major > 7)
|
|
|
47 |
{
|
|
|
48 |
// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
|
|
|
49 |
YAHOO.deconcept.SWFObject.doPrepUnload = true;
|
|
|
50 |
}
|
|
|
51 |
if(c)
|
|
|
52 |
{
|
|
|
53 |
this.addParam('bgcolor', c);
|
|
|
54 |
}
|
|
|
55 |
var q = quality ? quality : 'high';
|
|
|
56 |
this.addParam('quality', q);
|
|
|
57 |
this.setAttribute('useExpressInstall', false);
|
|
|
58 |
this.setAttribute('doExpressInstall', false);
|
|
|
59 |
var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
|
|
|
60 |
this.setAttribute('xiRedirectUrl', xir);
|
|
|
61 |
this.setAttribute('redirectUrl', '');
|
|
|
62 |
if(redirectUrl)
|
|
|
63 |
{
|
|
|
64 |
this.setAttribute('redirectUrl', redirectUrl);
|
|
|
65 |
}
|
|
|
66 |
};
|
|
|
67 |
|
|
|
68 |
YAHOO.deconcept.SWFObject.prototype =
|
|
|
69 |
{
|
|
|
70 |
useExpressInstall: function(path)
|
|
|
71 |
{
|
|
|
72 |
this.xiSWFPath = !path ? "expressinstall.swf" : path;
|
|
|
73 |
this.setAttribute('useExpressInstall', true);
|
|
|
74 |
},
|
|
|
75 |
setAttribute: function(name, value){
|
|
|
76 |
this.attributes[name] = value;
|
|
|
77 |
},
|
|
|
78 |
getAttribute: function(name){
|
|
|
79 |
return this.attributes[name];
|
|
|
80 |
},
|
|
|
81 |
addParam: function(name, value){
|
|
|
82 |
this.params[name] = value;
|
|
|
83 |
},
|
|
|
84 |
getParams: function(){
|
|
|
85 |
return this.params;
|
|
|
86 |
},
|
|
|
87 |
addVariable: function(name, value){
|
|
|
88 |
this.variables[name] = value;
|
|
|
89 |
},
|
|
|
90 |
getVariable: function(name){
|
|
|
91 |
return this.variables[name];
|
|
|
92 |
},
|
|
|
93 |
getVariables: function(){
|
|
|
94 |
return this.variables;
|
|
|
95 |
},
|
|
|
96 |
getVariablePairs: function(){
|
|
|
97 |
var variablePairs = [];
|
|
|
98 |
var key;
|
|
|
99 |
var variables = this.getVariables();
|
|
|
100 |
for(key in variables)
|
|
|
101 |
{
|
|
|
102 |
if(variables.hasOwnProperty(key))
|
|
|
103 |
{
|
|
|
104 |
variablePairs[variablePairs.length] = YAHOO.lang.escapeHTML(key || '') +"="+ YAHOO.lang.escapeHTML(encodeURIComponent(variables[key] || ''));
|
|
|
105 |
}
|
|
|
106 |
}
|
|
|
107 |
return variablePairs;
|
|
|
108 |
},
|
|
|
109 |
getSWFHTML: function() {
|
|
|
110 |
var swfNode = "";
|
|
|
111 |
var params = {};
|
|
|
112 |
var key = "";
|
|
|
113 |
var pairs = "";
|
|
|
114 |
if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
|
|
|
115 |
if (this.getAttribute("doExpressInstall")) {
|
|
|
116 |
this.addVariable("MMplayerType", "PlugIn");
|
|
|
117 |
this.setAttribute('swf', this.xiSWFPath);
|
|
|
118 |
}
|
|
|
119 |
swfNode = '<embed type="application/x-shockwave-flash" src="'+ YAHOO.lang.escapeHTML(this.getAttribute('swf') || '') +'" width="'+ YAHOO.lang.escapeHTML(this.getAttribute('width') || '') +'" height="'+ YAHOO.lang.escapeHTML(this.getAttribute('height') || '') +'" style="'+ YAHOO.lang.escapeHTML(this.getAttribute('style') || '') +'"';
|
|
|
120 |
swfNode += ' id="'+ YAHOO.lang.escapeHTML(this.getAttribute('id') || '') +'" name="'+ YAHOO.lang.escapeHTML(this.getAttribute('id') || '') +'" ';
|
|
|
121 |
params = this.getParams();
|
|
|
122 |
for(key in params)
|
|
|
123 |
{
|
|
|
124 |
if(params.hasOwnProperty(key))
|
|
|
125 |
{
|
|
|
126 |
swfNode += YAHOO.lang.escapeHTML(key || '') +'="'+ YAHOO.lang.escapeHTML(params[key] || '') +'" ';
|
|
|
127 |
}
|
|
|
128 |
}
|
|
|
129 |
pairs = this.getVariablePairs().join("&");
|
|
|
130 |
if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
|
|
|
131 |
swfNode += '/>';
|
|
|
132 |
} else { // PC IE
|
|
|
133 |
if (this.getAttribute("doExpressInstall")) {
|
|
|
134 |
this.addVariable("MMplayerType", "ActiveX");
|
|
|
135 |
this.setAttribute('swf', this.xiSWFPath);
|
|
|
136 |
}
|
|
|
137 |
swfNode = '<object id="'+ YAHOO.lang.escapeHTML(this.getAttribute('id') || '') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ YAHOO.lang.escapeHTML(this.getAttribute('width') || '') +'" height="'+ YAHOO.lang.escapeHTML(this.getAttribute('height') || '') +'" style="'+ YAHOO.lang.escapeHTML(this.getAttribute('style') || '') +'">';
|
|
|
138 |
swfNode += '<param name="movie" value="'+ YAHOO.lang.escapeHTML(this.getAttribute('swf') || '') +'" />';
|
|
|
139 |
params = this.getParams();
|
|
|
140 |
for(key in params)
|
|
|
141 |
{
|
|
|
142 |
if(params.hasOwnProperty(key))
|
|
|
143 |
{
|
|
|
144 |
swfNode += '<param name="'+ YAHOO.lang.escapeHTML(key || '') +'" value="'+ YAHOO.lang.escapeHTML(params[key] || '') +'" />';
|
|
|
145 |
}
|
|
|
146 |
}
|
|
|
147 |
pairs = this.getVariablePairs().join("&");
|
|
|
148 |
if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
|
|
|
149 |
swfNode += "</object>";
|
|
|
150 |
}
|
|
|
151 |
return swfNode;
|
|
|
152 |
},
|
|
|
153 |
write: function(elementId)
|
|
|
154 |
{
|
|
|
155 |
if(this.getAttribute('useExpressInstall')) {
|
|
|
156 |
// check to see if we need to do an express install
|
|
|
157 |
var expressInstallReqVer = new YAHOO.deconcept.PlayerVersion([6,0,65]);
|
|
|
158 |
if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
|
|
|
159 |
this.setAttribute('doExpressInstall', true);
|
|
|
160 |
this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
|
|
|
161 |
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
|
|
|
162 |
this.addVariable("MMdoctitle", document.title);
|
|
|
163 |
}
|
|
|
164 |
}
|
|
|
165 |
if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version')))
|
|
|
166 |
{
|
|
|
167 |
var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
|
|
|
168 |
n.innerHTML = this.getSWFHTML();
|
|
|
169 |
return true;
|
|
|
170 |
}
|
|
|
171 |
else
|
|
|
172 |
{
|
|
|
173 |
if(this.getAttribute('redirectUrl') !== "")
|
|
|
174 |
{
|
|
|
175 |
document.location.replace(this.getAttribute('redirectUrl'));
|
|
|
176 |
}
|
|
|
177 |
}
|
|
|
178 |
return false;
|
|
|
179 |
}
|
|
|
180 |
};
|
|
|
181 |
|
|
|
182 |
/* ---- detection functions ---- */
|
|
|
183 |
YAHOO.deconcept.SWFObjectUtil.getPlayerVersion = function()
|
|
|
184 |
{
|
|
|
185 |
var axo = null;
|
|
|
186 |
var PlayerVersion = new YAHOO.deconcept.PlayerVersion([0,0,0]);
|
|
|
187 |
if(navigator.plugins && navigator.mimeTypes.length)
|
|
|
188 |
{
|
|
|
189 |
var x = navigator.plugins["Shockwave Flash"];
|
|
|
190 |
if(x && x.description)
|
|
|
191 |
{
|
|
|
192 |
PlayerVersion = new YAHOO.deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
|
|
|
193 |
}
|
|
|
194 |
}
|
|
|
195 |
else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0)
|
|
|
196 |
{ // if Windows CE
|
|
|
197 |
var counter = 3;
|
|
|
198 |
while(axo)
|
|
|
199 |
{
|
|
|
200 |
try
|
|
|
201 |
{
|
|
|
202 |
counter++;
|
|
|
203 |
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
|
|
|
204 |
// document.write("player v: "+ counter);
|
|
|
205 |
PlayerVersion = new YAHOO.deconcept.PlayerVersion([counter,0,0]);
|
|
|
206 |
}
|
|
|
207 |
catch(e)
|
|
|
208 |
{
|
|
|
209 |
axo = null;
|
|
|
210 |
}
|
|
|
211 |
}
|
|
|
212 |
}
|
|
|
213 |
else
|
|
|
214 |
{ // Win IE (non mobile)
|
|
|
215 |
// do minor version lookup in IE, but avoid fp6 crashing issues
|
|
|
216 |
// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
|
|
|
217 |
try
|
|
|
218 |
{
|
|
|
219 |
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
|
|
|
220 |
}
|
|
|
221 |
catch(e)
|
|
|
222 |
{
|
|
|
223 |
try
|
|
|
224 |
{
|
|
|
225 |
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
|
|
|
226 |
PlayerVersion = new YAHOO.deconcept.PlayerVersion([6,0,21]);
|
|
|
227 |
axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
|
|
|
228 |
}
|
|
|
229 |
catch(e)
|
|
|
230 |
{
|
|
|
231 |
if(PlayerVersion.major == 6)
|
|
|
232 |
{
|
|
|
233 |
return PlayerVersion;
|
|
|
234 |
}
|
|
|
235 |
}
|
|
|
236 |
try
|
|
|
237 |
{
|
|
|
238 |
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
|
|
|
239 |
}
|
|
|
240 |
catch(e) {}
|
|
|
241 |
}
|
|
|
242 |
|
|
|
243 |
if(axo !== null)
|
|
|
244 |
{
|
|
|
245 |
PlayerVersion = new YAHOO.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
|
|
|
246 |
}
|
|
|
247 |
}
|
|
|
248 |
return PlayerVersion;
|
|
|
249 |
};
|
|
|
250 |
|
|
|
251 |
YAHOO.deconcept.PlayerVersion = function(arrVersion)
|
|
|
252 |
{
|
|
|
253 |
this.major = arrVersion[0] !== null ? parseInt(arrVersion[0], 0) : 0;
|
|
|
254 |
this.minor = arrVersion[1] !== null ? parseInt(arrVersion[1], 0) : 0;
|
|
|
255 |
this.rev = arrVersion[2] !== null ? parseInt(arrVersion[2], 0) : 0;
|
|
|
256 |
};
|
|
|
257 |
|
|
|
258 |
YAHOO.deconcept.PlayerVersion.prototype.versionIsValid = function(fv)
|
|
|
259 |
{
|
|
|
260 |
if(this.major < fv.major)
|
|
|
261 |
{
|
|
|
262 |
return false;
|
|
|
263 |
}
|
|
|
264 |
if(this.major > fv.major)
|
|
|
265 |
{
|
|
|
266 |
return true;
|
|
|
267 |
}
|
|
|
268 |
if(this.minor < fv.minor)
|
|
|
269 |
{
|
|
|
270 |
return false;
|
|
|
271 |
}
|
|
|
272 |
if(this.minor > fv.minor)
|
|
|
273 |
{
|
|
|
274 |
return true;
|
|
|
275 |
}
|
|
|
276 |
if(this.rev < fv.rev)
|
|
|
277 |
{
|
|
|
278 |
return false;
|
|
|
279 |
}
|
|
|
280 |
return true;
|
|
|
281 |
};
|
|
|
282 |
|
|
|
283 |
/* ---- get value of query string param ---- */
|
|
|
284 |
YAHOO.deconcept.util =
|
|
|
285 |
{
|
|
|
286 |
getRequestParameter: function(param)
|
|
|
287 |
{
|
|
|
288 |
var q = document.location.search || document.location.hash;
|
|
|
289 |
if(param === null) { return q; }
|
|
|
290 |
if(q)
|
|
|
291 |
{
|
|
|
292 |
var pairs = q.substring(1).split("&");
|
|
|
293 |
for(var i=0; i < pairs.length; i++)
|
|
|
294 |
{
|
|
|
295 |
if (pairs[i].substring(0, pairs[i].indexOf("=")) == param)
|
|
|
296 |
{
|
|
|
297 |
return pairs[i].substring((pairs[i].indexOf("=") + 1));
|
|
|
298 |
}
|
|
|
299 |
}
|
|
|
300 |
}
|
|
|
301 |
return "";
|
|
|
302 |
}
|
|
|
303 |
};
|
|
|
304 |
|
|
|
305 |
/* fix for video streaming bug */
|
|
|
306 |
YAHOO.deconcept.SWFObjectUtil.cleanupSWFs = function()
|
|
|
307 |
{
|
|
|
308 |
var objects = document.getElementsByTagName("OBJECT");
|
|
|
309 |
for(var i = objects.length - 1; i >= 0; i--)
|
|
|
310 |
{
|
|
|
311 |
objects[i].style.display = 'none';
|
|
|
312 |
for(var x in objects[i])
|
|
|
313 |
{
|
|
|
314 |
if(typeof objects[i][x] == 'function')
|
|
|
315 |
{
|
|
|
316 |
objects[i][x] = function(){};
|
|
|
317 |
}
|
|
|
318 |
}
|
|
|
319 |
}
|
|
|
320 |
};
|
|
|
321 |
|
|
|
322 |
// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
|
|
|
323 |
if(YAHOO.deconcept.SWFObject.doPrepUnload)
|
|
|
324 |
{
|
|
|
325 |
if(!YAHOO.deconcept.unloadSet)
|
|
|
326 |
{
|
|
|
327 |
YAHOO.deconcept.SWFObjectUtil.prepUnload = function()
|
|
|
328 |
{
|
|
|
329 |
__flash_unloadHandler = function(){};
|
|
|
330 |
__flash_savedUnloadHandler = function(){};
|
|
|
331 |
window.attachEvent("onunload", YAHOO.deconcept.SWFObjectUtil.cleanupSWFs);
|
|
|
332 |
};
|
|
|
333 |
window.attachEvent("onbeforeunload", YAHOO.deconcept.SWFObjectUtil.prepUnload);
|
|
|
334 |
YAHOO.deconcept.unloadSet = true;
|
|
|
335 |
}
|
|
|
336 |
}
|
|
|
337 |
|
|
|
338 |
/* add document.getElementById if needed (mobile IE < 5) */
|
|
|
339 |
if(!document.getElementById && document.all)
|
|
|
340 |
{
|
|
|
341 |
document.getElementById = function(id) { return document.all[id]; };
|
|
|
342 |
}
|
|
|
343 |
/**
|
|
|
344 |
* Wraps Flash embedding functionality and allows communication with SWF through
|
|
|
345 |
* attributes.
|
|
|
346 |
*
|
|
|
347 |
* @namespace YAHOO.widget
|
|
|
348 |
* @class FlashAdapter
|
|
|
349 |
* @uses YAHOO.util.AttributeProvider
|
|
|
350 |
*/
|
|
|
351 |
YAHOO.widget.FlashAdapter = function(swfURL, containerID, attributes, buttonSkin)
|
|
|
352 |
{
|
|
|
353 |
|
|
|
354 |
this._queue = this._queue || [];
|
|
|
355 |
this._events = this._events || {};
|
|
|
356 |
this._configs = this._configs || {};
|
|
|
357 |
attributes = attributes || {};
|
|
|
358 |
|
|
|
359 |
//the Flash Player external interface code from Adobe doesn't play nicely
|
|
|
360 |
//with the default value, yui-gen, in IE
|
|
|
361 |
this._id = attributes.id = attributes.id || YAHOO.util.Dom.generateId(null, "yuigen");
|
|
|
362 |
attributes.version = attributes.version || "9.0.45";
|
|
|
363 |
attributes.backgroundColor = attributes.backgroundColor || "#ffffff";
|
|
|
364 |
|
|
|
365 |
//we can't use the initial attributes right away
|
|
|
366 |
//so save them for once the SWF finishes loading
|
|
|
367 |
this._attributes = attributes;
|
|
|
368 |
|
|
|
369 |
this._swfURL = swfURL;
|
|
|
370 |
this._containerID = containerID;
|
|
|
371 |
|
|
|
372 |
//embed the SWF file in the page
|
|
|
373 |
this._embedSWF(this._swfURL, this._containerID, attributes.id, attributes.version,
|
|
|
374 |
attributes.backgroundColor, attributes.expressInstall, attributes.wmode, buttonSkin);
|
|
|
375 |
|
|
|
376 |
/**
|
|
|
377 |
* Fires when the SWF is initialized and communication is possible.
|
|
|
378 |
* @event contentReady
|
|
|
379 |
*/
|
|
|
380 |
//Fix for iframe cross-domain issue with FF2x
|
|
|
381 |
try
|
|
|
382 |
{
|
|
|
383 |
this.createEvent("contentReady");
|
|
|
384 |
}
|
|
|
385 |
catch(e){}
|
|
|
386 |
};
|
|
|
387 |
|
|
|
388 |
YAHOO.widget.FlashAdapter.owners = YAHOO.widget.FlashAdapter.owners || {};
|
|
|
389 |
|
|
|
390 |
YAHOO.extend(YAHOO.widget.FlashAdapter, YAHOO.util.AttributeProvider,
|
|
|
391 |
{
|
|
|
392 |
/**
|
|
|
393 |
* The URL of the SWF file.
|
|
|
394 |
* @property _swfURL
|
|
|
395 |
* @type String
|
|
|
396 |
* @private
|
|
|
397 |
*/
|
|
|
398 |
_swfURL: null,
|
|
|
399 |
|
|
|
400 |
/**
|
|
|
401 |
* The ID of the containing DIV.
|
|
|
402 |
* @property _containerID
|
|
|
403 |
* @type String
|
|
|
404 |
* @private
|
|
|
405 |
*/
|
|
|
406 |
_containerID: null,
|
|
|
407 |
|
|
|
408 |
/**
|
|
|
409 |
* A reference to the embedded SWF file.
|
|
|
410 |
* @property _swf
|
|
|
411 |
* @private
|
|
|
412 |
*/
|
|
|
413 |
_swf: null,
|
|
|
414 |
|
|
|
415 |
/**
|
|
|
416 |
* The id of this instance.
|
|
|
417 |
* @property _id
|
|
|
418 |
* @type String
|
|
|
419 |
* @private
|
|
|
420 |
*/
|
|
|
421 |
_id: null,
|
|
|
422 |
|
|
|
423 |
/**
|
|
|
424 |
* Indicates whether the SWF has been initialized and is ready
|
|
|
425 |
* to communicate with JavaScript
|
|
|
426 |
* @property _initialized
|
|
|
427 |
* @type Boolean
|
|
|
428 |
* @private
|
|
|
429 |
*/
|
|
|
430 |
_initialized: false,
|
|
|
431 |
|
|
|
432 |
/**
|
|
|
433 |
* The initializing attributes are stored here until the SWF is ready.
|
|
|
434 |
* @property _attributes
|
|
|
435 |
* @type Object
|
|
|
436 |
* @private
|
|
|
437 |
*/
|
|
|
438 |
_attributes: null, //the intializing attributes
|
|
|
439 |
|
|
|
440 |
/**
|
|
|
441 |
* Public accessor to the unique name of the FlashAdapter instance.
|
|
|
442 |
*
|
|
|
443 |
* @method toString
|
|
|
444 |
* @return {String} Unique name of the FlashAdapter instance.
|
|
|
445 |
*/
|
|
|
446 |
toString: function()
|
|
|
447 |
{
|
|
|
448 |
return "FlashAdapter " + this._id;
|
|
|
449 |
},
|
|
|
450 |
|
|
|
451 |
/**
|
|
|
452 |
* Nulls out the entire FlashAdapter instance and related objects and removes attached
|
|
|
453 |
* event listeners and clears out DOM elements inside the container. After calling
|
|
|
454 |
* this method, the instance reference should be expliclitly nulled by implementer,
|
|
|
455 |
* as in myChart = null. Use with caution!
|
|
|
456 |
*
|
|
|
457 |
* @method destroy
|
|
|
458 |
*/
|
|
|
459 |
destroy: function()
|
|
|
460 |
{
|
|
|
461 |
//kill the Flash Player instance
|
|
|
462 |
if(this._swf)
|
|
|
463 |
{
|
|
|
464 |
var container = YAHOO.util.Dom.get(this._containerID);
|
|
|
465 |
container.removeChild(this._swf);
|
|
|
466 |
}
|
|
|
467 |
|
|
|
468 |
var instanceName = this._id;
|
|
|
469 |
|
|
|
470 |
//null out properties
|
|
|
471 |
for(var prop in this)
|
|
|
472 |
{
|
|
|
473 |
if(YAHOO.lang.hasOwnProperty(this, prop))
|
|
|
474 |
{
|
|
|
475 |
this[prop] = null;
|
|
|
476 |
}
|
|
|
477 |
}
|
|
|
478 |
|
|
|
479 |
YAHOO.log("FlashAdapter instance destroyed: " + instanceName);
|
|
|
480 |
},
|
|
|
481 |
|
|
|
482 |
/**
|
|
|
483 |
* Embeds the SWF in the page and associates it with this instance.
|
|
|
484 |
*
|
|
|
485 |
* @method _embedSWF
|
|
|
486 |
* @private
|
|
|
487 |
*/
|
|
|
488 |
_embedSWF: function(swfURL, containerID, swfID, version, backgroundColor, expressInstall, wmode, buttonSkin)
|
|
|
489 |
{
|
|
|
490 |
//standard SWFObject embed
|
|
|
491 |
var swfObj = new YAHOO.deconcept.SWFObject(swfURL, swfID, "100%", "100%", version, backgroundColor);
|
|
|
492 |
|
|
|
493 |
if(expressInstall)
|
|
|
494 |
{
|
|
|
495 |
swfObj.useExpressInstall(expressInstall);
|
|
|
496 |
}
|
|
|
497 |
|
|
|
498 |
//make sure we can communicate with ExternalInterface
|
|
|
499 |
swfObj.addParam("allowScriptAccess", "always");
|
|
|
500 |
|
|
|
501 |
if(wmode)
|
|
|
502 |
{
|
|
|
503 |
swfObj.addParam("wmode", wmode);
|
|
|
504 |
}
|
|
|
505 |
|
|
|
506 |
swfObj.addParam("menu", "false");
|
|
|
507 |
|
|
|
508 |
//again, a useful ExternalInterface trick
|
|
|
509 |
swfObj.addVariable("allowedDomain", document.location.hostname);
|
|
|
510 |
|
|
|
511 |
//tell the SWF which HTML element it is in
|
|
|
512 |
swfObj.addVariable("YUISwfId", swfID);
|
|
|
513 |
|
|
|
514 |
// set the name of the function to call when the swf has an event
|
|
|
515 |
swfObj.addVariable("YUIBridgeCallback", "YAHOO.widget.FlashAdapter.eventHandler");
|
|
|
516 |
if (buttonSkin) {
|
|
|
517 |
swfObj.addVariable("buttonSkin", buttonSkin);
|
|
|
518 |
}
|
|
|
519 |
var container = YAHOO.util.Dom.get(containerID);
|
|
|
520 |
var result = swfObj.write(container);
|
|
|
521 |
if(result)
|
|
|
522 |
{
|
|
|
523 |
this._swf = YAHOO.util.Dom.get(swfID);
|
|
|
524 |
YAHOO.widget.FlashAdapter.owners[swfID] = this;
|
|
|
525 |
}
|
|
|
526 |
else
|
|
|
527 |
{
|
|
|
528 |
YAHOO.log("Unable to load SWF " + swfURL);
|
|
|
529 |
}
|
|
|
530 |
},
|
|
|
531 |
|
|
|
532 |
/**
|
|
|
533 |
* Handles or re-dispatches events received from the SWF.
|
|
|
534 |
*
|
|
|
535 |
* @method _eventHandler
|
|
|
536 |
* @private
|
|
|
537 |
*/
|
|
|
538 |
_eventHandler: function(event)
|
|
|
539 |
{
|
|
|
540 |
var type = event.type;
|
|
|
541 |
switch(type)
|
|
|
542 |
{
|
|
|
543 |
case "swfReady":
|
|
|
544 |
this._loadHandler();
|
|
|
545 |
return;
|
|
|
546 |
case "log":
|
|
|
547 |
YAHOO.log(event.message, event.category, this.toString());
|
|
|
548 |
return;
|
|
|
549 |
}
|
|
|
550 |
|
|
|
551 |
|
|
|
552 |
//be sure to return after your case or the event will automatically fire!
|
|
|
553 |
this.fireEvent(type, event);
|
|
|
554 |
},
|
|
|
555 |
|
|
|
556 |
/**
|
|
|
557 |
* Called when the SWF has been initialized.
|
|
|
558 |
*
|
|
|
559 |
* @method _loadHandler
|
|
|
560 |
* @private
|
|
|
561 |
*/
|
|
|
562 |
_loadHandler: function()
|
|
|
563 |
{
|
|
|
564 |
this._initialized = false;
|
|
|
565 |
this._initAttributes(this._attributes);
|
|
|
566 |
this.setAttributes(this._attributes, true);
|
|
|
567 |
|
|
|
568 |
this._initialized = true;
|
|
|
569 |
this.fireEvent("contentReady");
|
|
|
570 |
},
|
|
|
571 |
|
|
|
572 |
set: function(name, value)
|
|
|
573 |
{
|
|
|
574 |
//save all the attributes in case the swf reloads
|
|
|
575 |
//so that we can pass them in again
|
|
|
576 |
this._attributes[name] = value;
|
|
|
577 |
YAHOO.widget.FlashAdapter.superclass.set.call(this, name, value);
|
|
|
578 |
},
|
|
|
579 |
|
|
|
580 |
/**
|
|
|
581 |
* Initializes the attributes.
|
|
|
582 |
*
|
|
|
583 |
* @method _initAttributes
|
|
|
584 |
* @private
|
|
|
585 |
*/
|
|
|
586 |
_initAttributes: function(attributes)
|
|
|
587 |
{
|
|
|
588 |
//should be overridden if other attributes need to be set up
|
|
|
589 |
|
|
|
590 |
/**
|
|
|
591 |
* @attribute wmode
|
|
|
592 |
* @description Sets the window mode of the Flash Player control. May be
|
|
|
593 |
* "window", "opaque", or "transparent". Only available in the constructor
|
|
|
594 |
* because it may not be set after Flash Player has been embedded in the page.
|
|
|
595 |
* @type String
|
|
|
596 |
*/
|
|
|
597 |
|
|
|
598 |
/**
|
|
|
599 |
* @attribute expressInstall
|
|
|
600 |
* @description URL pointing to a SWF file that handles Flash Player's express
|
|
|
601 |
* install feature. Only available in the constructor because it may not be
|
|
|
602 |
* set after Flash Player has been embedded in the page.
|
|
|
603 |
* @type String
|
|
|
604 |
*/
|
|
|
605 |
|
|
|
606 |
/**
|
|
|
607 |
* @attribute version
|
|
|
608 |
* @description Minimum required version for the SWF file. Only available in the constructor because it may not be
|
|
|
609 |
* set after Flash Player has been embedded in the page.
|
|
|
610 |
* @type String
|
|
|
611 |
*/
|
|
|
612 |
|
|
|
613 |
/**
|
|
|
614 |
* @attribute backgroundColor
|
|
|
615 |
* @description The background color of the SWF. Only available in the constructor because it may not be
|
|
|
616 |
* set after Flash Player has been embedded in the page.
|
|
|
617 |
* @type String
|
|
|
618 |
*/
|
|
|
619 |
|
|
|
620 |
/**
|
|
|
621 |
* @attribute altText
|
|
|
622 |
* @description The alternative text to provide for screen readers and other assistive technology.
|
|
|
623 |
* @type String
|
|
|
624 |
*/
|
|
|
625 |
this.getAttributeConfig("altText",
|
|
|
626 |
{
|
|
|
627 |
method: this._getAltText
|
|
|
628 |
});
|
|
|
629 |
this.setAttributeConfig("altText",
|
|
|
630 |
{
|
|
|
631 |
method: this._setAltText
|
|
|
632 |
});
|
|
|
633 |
|
|
|
634 |
/**
|
|
|
635 |
* @attribute swfURL
|
|
|
636 |
* @description Absolute or relative URL to the SWF displayed by the FlashAdapter. Only available in the constructor because it may not be
|
|
|
637 |
* set after Flash Player has been embedded in the page.
|
|
|
638 |
* @type String
|
|
|
639 |
*/
|
|
|
640 |
this.getAttributeConfig("swfURL",
|
|
|
641 |
{
|
|
|
642 |
method: this._getSWFURL
|
|
|
643 |
});
|
|
|
644 |
},
|
|
|
645 |
|
|
|
646 |
/**
|
|
|
647 |
* Getter for swfURL attribute.
|
|
|
648 |
*
|
|
|
649 |
* @method _getSWFURL
|
|
|
650 |
* @private
|
|
|
651 |
*/
|
|
|
652 |
_getSWFURL: function()
|
|
|
653 |
{
|
|
|
654 |
return this._swfURL;
|
|
|
655 |
},
|
|
|
656 |
|
|
|
657 |
/**
|
|
|
658 |
* Getter for altText attribute.
|
|
|
659 |
*
|
|
|
660 |
* @method _getAltText
|
|
|
661 |
* @private
|
|
|
662 |
*/
|
|
|
663 |
_getAltText: function()
|
|
|
664 |
{
|
|
|
665 |
return this._swf.getAltText();
|
|
|
666 |
},
|
|
|
667 |
|
|
|
668 |
/**
|
|
|
669 |
* Setter for altText attribute.
|
|
|
670 |
*
|
|
|
671 |
* @method _setAltText
|
|
|
672 |
* @private
|
|
|
673 |
*/
|
|
|
674 |
_setAltText: function(value)
|
|
|
675 |
{
|
|
|
676 |
return this._swf.setAltText(value);
|
|
|
677 |
}
|
|
|
678 |
});
|
|
|
679 |
|
|
|
680 |
|
|
|
681 |
/**
|
|
|
682 |
* Receives event messages from SWF and passes them to the correct instance
|
|
|
683 |
* of FlashAdapter.
|
|
|
684 |
*
|
|
|
685 |
* @method YAHOO.widget.FlashAdapter.eventHandler
|
|
|
686 |
* @static
|
|
|
687 |
* @private
|
|
|
688 |
*/
|
|
|
689 |
YAHOO.widget.FlashAdapter.eventHandler = function(elementID, event)
|
|
|
690 |
{
|
|
|
691 |
|
|
|
692 |
if(!YAHOO.widget.FlashAdapter.owners[elementID])
|
|
|
693 |
{
|
|
|
694 |
//fix for ie: if owner doesn't exist yet, try again in a moment
|
|
|
695 |
setTimeout(function() { YAHOO.widget.FlashAdapter.eventHandler( elementID, event ); }, 0);
|
|
|
696 |
}
|
|
|
697 |
else
|
|
|
698 |
{
|
|
|
699 |
YAHOO.widget.FlashAdapter.owners[elementID]._eventHandler(event);
|
|
|
700 |
}
|
|
|
701 |
};
|
|
|
702 |
|
|
|
703 |
/**
|
|
|
704 |
* The number of proxy functions that have been created.
|
|
|
705 |
* @static
|
|
|
706 |
* @private
|
|
|
707 |
*/
|
|
|
708 |
YAHOO.widget.FlashAdapter.proxyFunctionCount = 0;
|
|
|
709 |
|
|
|
710 |
/**
|
|
|
711 |
* Creates a globally accessible function that wraps a function reference.
|
|
|
712 |
* Returns the proxy function's name as a string for use by the SWF through
|
|
|
713 |
* ExternalInterface.
|
|
|
714 |
*
|
|
|
715 |
* @method YAHOO.widget.FlashAdapter.createProxyFunction
|
|
|
716 |
* @static
|
|
|
717 |
* @private
|
|
|
718 |
*/
|
|
|
719 |
YAHOO.widget.FlashAdapter.createProxyFunction = function(func)
|
|
|
720 |
{
|
|
|
721 |
var index = YAHOO.widget.FlashAdapter.proxyFunctionCount;
|
|
|
722 |
YAHOO.widget.FlashAdapter["proxyFunction" + index] = function()
|
|
|
723 |
{
|
|
|
724 |
return func.apply(null, arguments);
|
|
|
725 |
};
|
|
|
726 |
YAHOO.widget.FlashAdapter.proxyFunctionCount++;
|
|
|
727 |
return "YAHOO.widget.FlashAdapter.proxyFunction" + index.toString();
|
|
|
728 |
};
|
|
|
729 |
|
|
|
730 |
/**
|
|
|
731 |
* Removes a function created with createProxyFunction()
|
|
|
732 |
*
|
|
|
733 |
* @method YAHOO.widget.FlashAdapter.removeProxyFunction
|
|
|
734 |
* @static
|
|
|
735 |
* @private
|
|
|
736 |
*/
|
|
|
737 |
YAHOO.widget.FlashAdapter.removeProxyFunction = function(funcName)
|
|
|
738 |
{
|
|
|
739 |
//quick error check
|
|
|
740 |
if(!funcName || funcName.indexOf("YAHOO.widget.FlashAdapter.proxyFunction") < 0)
|
|
|
741 |
{
|
|
|
742 |
return;
|
|
|
743 |
}
|
|
|
744 |
|
|
|
745 |
funcName = funcName.substr(26);
|
|
|
746 |
YAHOO.widget.FlashAdapter[funcName] = null;
|
|
|
747 |
};
|
|
|
748 |
/**
|
|
|
749 |
* The YUI Uploader Control
|
|
|
750 |
* @module uploader
|
|
|
751 |
* @description <p>YUI Uploader provides file upload functionality that goes beyond the basic browser-based methods.
|
|
|
752 |
* Specifically, the YUI Uploader allows for:
|
|
|
753 |
* <ol>
|
|
|
754 |
* <li> Multiple file selection in a single "Open File" dialog.</li>
|
|
|
755 |
* <li> File extension filters to facilitate the user's selection.</li>
|
|
|
756 |
* <li> Progress tracking for file uploads.</li>
|
|
|
757 |
* <li> A range of file metadata: filename, size, date created, date modified, and author.</li>
|
|
|
758 |
* <li> A set of events dispatched on various aspects of the file upload process: file selection, upload progress, upload completion, etc.</li>
|
|
|
759 |
* <li> Inclusion of additional data in the file upload POST request.</li>
|
|
|
760 |
* <li> Faster file upload on broadband connections due to the modified SEND buffer size.</li>
|
|
|
761 |
* <li> Same-page server response upon completion of the file upload.</li>
|
|
|
762 |
* </ol>
|
|
|
763 |
* </p>
|
|
|
764 |
* @title Uploader
|
|
|
765 |
* @namespace YAHOO.widget
|
|
|
766 |
* @requires yahoo, dom, element, event
|
|
|
767 |
*/
|
|
|
768 |
/**
|
|
|
769 |
* Uploader class for the YUI Uploader component.
|
|
|
770 |
*
|
|
|
771 |
* @namespace YAHOO.widget
|
|
|
772 |
* @class Uploader
|
|
|
773 |
* @uses YAHOO.widget.FlashAdapter
|
|
|
774 |
* @constructor
|
|
|
775 |
* @param containerId {HTMLElement} Container element for the Flash Player instance.
|
|
|
776 |
* @param buttonSkin {String} [optional]. If defined, the uploader is
|
|
|
777 |
* rendered as a button. This parameter must provide the URL of a button
|
|
|
778 |
* skin sprite image. Acceptable types are: jpg, gif, png and swf. The
|
|
|
779 |
* sprite is divided evenly into four sections along its height (e.g., if
|
|
|
780 |
* the sprite is 200 px tall, it's divided into four sections 50px each).
|
|
|
781 |
* Each section is used as a skin for a specific state of the button: top
|
|
|
782 |
* section is "up", second section is "over", third section is "down", and
|
|
|
783 |
* fourth section is "disabled".
|
|
|
784 |
* If the parameter is not supplied, the uploader is rendered transparent,
|
|
|
785 |
* and it's the developer's responsibility to create a visible UI below it.
|
|
|
786 |
* @param forceTransparent {Boolean} This parameter, if true, forces the Flash
|
|
|
787 |
* UI to be rendered with wmode set to "transparent". This behavior is useful
|
|
|
788 |
* in conjunction with non-rectangular button skins with PNG transparency.
|
|
|
789 |
* The parameter is false by default, and ignored if no buttonSkin is defined.
|
|
|
790 |
*/
|
|
|
791 |
YAHOO.widget.Uploader = function(containerId, buttonSkin, forceTransparent)
|
|
|
792 |
{
|
|
|
793 |
var newWMode = "window";
|
|
|
794 |
|
|
|
795 |
if (!(buttonSkin) || (buttonSkin && forceTransparent)) {
|
|
|
796 |
newWMode = "transparent";
|
|
|
797 |
}
|
|
|
798 |
|
|
|
799 |
|
|
|
800 |
YAHOO.widget.Uploader.superclass.constructor.call(this, YAHOO.widget.Uploader.SWFURL, containerId, {wmode:newWMode}, buttonSkin);
|
|
|
801 |
|
|
|
802 |
/**
|
|
|
803 |
* Fires when the mouse is pressed over the Uploader.
|
|
|
804 |
* Only fires when the Uploader UI is enabled and
|
|
|
805 |
* the render type is 'transparent'.
|
|
|
806 |
*
|
|
|
807 |
* @event mouseDown
|
|
|
808 |
* @param event.type {String} The event type
|
|
|
809 |
*/
|
|
|
810 |
this.createEvent("mouseDown");
|
|
|
811 |
|
|
|
812 |
/**
|
|
|
813 |
* Fires when the mouse is released over the Uploader.
|
|
|
814 |
* Only fires when the Uploader UI is enabled and
|
|
|
815 |
* the render type is 'transparent'.
|
|
|
816 |
*
|
|
|
817 |
* @event mouseUp
|
|
|
818 |
* @param event.type {String} The event type
|
|
|
819 |
*/
|
|
|
820 |
this.createEvent("mouseUp");
|
|
|
821 |
|
|
|
822 |
/**
|
|
|
823 |
* Fires when the mouse rolls over the Uploader.
|
|
|
824 |
*
|
|
|
825 |
* @event rollOver
|
|
|
826 |
* @param event.type {String} The event type
|
|
|
827 |
*/
|
|
|
828 |
this.createEvent("rollOver");
|
|
|
829 |
|
|
|
830 |
/**
|
|
|
831 |
* Fires when the mouse rolls out of the Uploader.
|
|
|
832 |
*
|
|
|
833 |
* @event rollOut
|
|
|
834 |
* @param event.type {String} The event type
|
|
|
835 |
*/
|
|
|
836 |
this.createEvent("rollOut");
|
|
|
837 |
|
|
|
838 |
/**
|
|
|
839 |
* Fires when the uploader is clicked.
|
|
|
840 |
*
|
|
|
841 |
* @event click
|
|
|
842 |
* @param event.type {String} The event type
|
|
|
843 |
*/
|
|
|
844 |
this.createEvent("click");
|
|
|
845 |
|
|
|
846 |
/**
|
|
|
847 |
* Fires when the user has finished selecting files in the "Open File" dialog.
|
|
|
848 |
*
|
|
|
849 |
* @event fileSelect
|
|
|
850 |
* @param event.type {String} The event type
|
|
|
851 |
* @param event.fileList {Object} A dictionary of objects with file information
|
|
|
852 |
* @param event.fileList[].size {Number} File size in bytes for a specific file in fileList
|
|
|
853 |
* @param event.fileList[].cDate {Date} Creation date for a specific file in fileList
|
|
|
854 |
* @param event.fileList[].mDate {Date} Modification date for a specific file in fileList
|
|
|
855 |
* @param event.fileList[].name {String} File name for a specific file in fileList
|
|
|
856 |
* @param event.fileList[].id {String} Unique file id of a specific file in fileList
|
|
|
857 |
*/
|
|
|
858 |
this.createEvent("fileSelect");
|
|
|
859 |
|
|
|
860 |
/**
|
|
|
861 |
* Fires when an upload of a specific file has started.
|
|
|
862 |
*
|
|
|
863 |
* @event uploadStart
|
|
|
864 |
* @param event.type {String} The event type
|
|
|
865 |
* @param event.id {String} The id of the file that's started to upload
|
|
|
866 |
*/
|
|
|
867 |
this.createEvent("uploadStart");
|
|
|
868 |
|
|
|
869 |
/**
|
|
|
870 |
* Fires when new information about the upload progress for a specific file is available.
|
|
|
871 |
*
|
|
|
872 |
* @event uploadProgress
|
|
|
873 |
* @param event.type {String} The event type
|
|
|
874 |
* @param event.id {String} The id of the file with which the upload progress data is associated
|
|
|
875 |
* @param bytesLoaded {Number} The number of bytes of the file uploaded so far
|
|
|
876 |
* @param bytesTotal {Number} The total size of the file
|
|
|
877 |
*/
|
|
|
878 |
this.createEvent("uploadProgress");
|
|
|
879 |
|
|
|
880 |
/**
|
|
|
881 |
* Fires when an upload for a specific file is cancelled.
|
|
|
882 |
*
|
|
|
883 |
* @event uploadCancel
|
|
|
884 |
* @param event.type {String} The event type
|
|
|
885 |
* @param event.id {String} The id of the file with which the upload has been cancelled.
|
|
|
886 |
*/
|
|
|
887 |
this.createEvent("uploadCancel");
|
|
|
888 |
|
|
|
889 |
/**
|
|
|
890 |
* Fires when an upload for a specific file is complete.
|
|
|
891 |
*
|
|
|
892 |
* @event uploadComplete
|
|
|
893 |
* @param event.type {String} The event type
|
|
|
894 |
* @param event.id {String} The id of the file for which the upload has been completed.
|
|
|
895 |
*/
|
|
|
896 |
this.createEvent("uploadComplete");
|
|
|
897 |
|
|
|
898 |
/**
|
|
|
899 |
* Fires when the server sends data in response to a completed upload.
|
|
|
900 |
*
|
|
|
901 |
* @event uploadCompleteData
|
|
|
902 |
* @param event.type {String} The event type
|
|
|
903 |
* @param event.id {String} The id of the file for which the upload has been completed.
|
|
|
904 |
* @param event.data {String} The raw data returned by the server in response to the upload.
|
|
|
905 |
*/
|
|
|
906 |
this.createEvent("uploadCompleteData");
|
|
|
907 |
|
|
|
908 |
/**
|
|
|
909 |
* Fires when an upload error occurs.
|
|
|
910 |
*
|
|
|
911 |
* @event uploadError
|
|
|
912 |
* @param event.type {String} The event type
|
|
|
913 |
* @param event.id {String} The id of the file that was being uploaded when the error has occurred.
|
|
|
914 |
* @param event.status {String} The status message associated with the error.
|
|
|
915 |
*/
|
|
|
916 |
this.createEvent("uploadError");
|
|
|
917 |
}
|
|
|
918 |
|
|
|
919 |
/**
|
|
|
920 |
* Location of the Uploader SWF
|
|
|
921 |
*
|
|
|
922 |
* @property Chart.SWFURL
|
|
|
923 |
* @private
|
|
|
924 |
* @static
|
|
|
925 |
* @final
|
|
|
926 |
* @default "assets/uploader.swf"
|
|
|
927 |
*/
|
|
|
928 |
YAHOO.widget.Uploader.SWFURL = "assets/uploader.swf";
|
|
|
929 |
|
|
|
930 |
YAHOO.extend(YAHOO.widget.Uploader, YAHOO.widget.FlashAdapter,
|
|
|
931 |
{
|
|
|
932 |
/**
|
|
|
933 |
* Starts the upload of the file specified by fileID to the location specified by uploadScriptPath.
|
|
|
934 |
*
|
|
|
935 |
* @param fileID {String} The id of the file to start uploading.
|
|
|
936 |
* @param uploadScriptPath {String} The URL of the upload location.
|
|
|
937 |
* @param method {String} Either "GET" or "POST", specifying how the variables accompanying the file upload POST request should be submitted. "GET" by default.
|
|
|
938 |
* @param vars {Object} The object containing variables to be sent in the same request as the file upload.
|
|
|
939 |
* @param fieldName {String} The name of the variable in the POST request containing the file data. "Filedata" by default.
|
|
|
940 |
* </code>
|
|
|
941 |
*/
|
|
|
942 |
upload: function(fileID, uploadScriptPath, method, vars, fieldName)
|
|
|
943 |
{
|
|
|
944 |
this._swf.upload(fileID, uploadScriptPath, method, vars, fieldName);
|
|
|
945 |
},
|
|
|
946 |
|
|
|
947 |
/**
|
|
|
948 |
* Starts the upload of the files specified by fileIDs, or adds them to a currently running queue. The upload queue is automatically managed.
|
|
|
949 |
*
|
|
|
950 |
* @param fileIDs {Array} The ids of the files to start uploading.
|
|
|
951 |
* @param uploadScriptPath {String} The URL of the upload location.
|
|
|
952 |
* @param method {String} Either "GET" or "POST", specifying how the variables accompanying the file upload POST request should be submitted. "GET" by default.
|
|
|
953 |
* @param vars {Object} The object containing variables to be sent in the same request as the file upload.
|
|
|
954 |
* @param fieldName {String} The name of the variable in the POST request containing the file data. "Filedata" by default.
|
|
|
955 |
* </code>
|
|
|
956 |
*/
|
|
|
957 |
uploadThese: function(fileIDs, uploadScriptPath, method, vars, fieldName)
|
|
|
958 |
{
|
|
|
959 |
this._swf.uploadThese(fileIDs, uploadScriptPath, method, vars, fieldName);
|
|
|
960 |
},
|
|
|
961 |
|
|
|
962 |
/**
|
|
|
963 |
* Starts uploading all files in the queue. If this function is called, the upload queue is automatically managed.
|
|
|
964 |
*
|
|
|
965 |
* @param uploadScriptPath {String} The URL of the upload location.
|
|
|
966 |
* @param method {String} Either "GET" or "POST", specifying how the variables accompanying the file upload POST request should be submitted. "GET" by default.
|
|
|
967 |
* @param vars {Object} The object containing variables to be sent in the same request as the file upload.
|
|
|
968 |
* @param fieldName {String} The name of the variable in the POST request containing the file data. "Filedata" by default.
|
|
|
969 |
* </code>
|
|
|
970 |
*/
|
|
|
971 |
uploadAll: function(uploadScriptPath, method, vars, fieldName)
|
|
|
972 |
{
|
|
|
973 |
this._swf.uploadAll(uploadScriptPath, method, vars, fieldName);
|
|
|
974 |
},
|
|
|
975 |
|
|
|
976 |
/**
|
|
|
977 |
* Cancels the upload of a specified file. If no file id is specified, all ongoing uploads are cancelled.
|
|
|
978 |
*
|
|
|
979 |
* @param fileID {String} The ID of the file whose upload should be cancelled.
|
|
|
980 |
*/
|
|
|
981 |
cancel: function(fileID)
|
|
|
982 |
{
|
|
|
983 |
this._swf.cancel(fileID);
|
|
|
984 |
},
|
|
|
985 |
|
|
|
986 |
/**
|
|
|
987 |
* Clears the list of files queued for upload.
|
|
|
988 |
*
|
|
|
989 |
*/
|
|
|
990 |
clearFileList: function()
|
|
|
991 |
{
|
|
|
992 |
this._swf.clearFileList();
|
|
|
993 |
},
|
|
|
994 |
|
|
|
995 |
/**
|
|
|
996 |
* Removes the specified file from the upload queue.
|
|
|
997 |
*
|
|
|
998 |
* @param fileID {String} The id of the file to remove from the upload queue.
|
|
|
999 |
*/
|
|
|
1000 |
removeFile: function (fileID)
|
|
|
1001 |
{
|
|
|
1002 |
this._swf.removeFile(fileID);
|
|
|
1003 |
},
|
|
|
1004 |
|
|
|
1005 |
/**
|
|
|
1006 |
* Turns the logging functionality on.
|
|
|
1007 |
* Uses Flash internal trace logging, as well as YUI Logger, if available.
|
|
|
1008 |
*
|
|
|
1009 |
* @param allowLogging {Boolean} If true, logs are output; otherwise, no logs are produced.
|
|
|
1010 |
*/
|
|
|
1011 |
setAllowLogging: function (allowLogging)
|
|
|
1012 |
{
|
|
|
1013 |
this._swf.setAllowLogging(allowLogging);
|
|
|
1014 |
},
|
|
|
1015 |
|
|
|
1016 |
/**
|
|
|
1017 |
* Sets the number of simultaneous uploads when using uploadAll()
|
|
|
1018 |
* The minimum value is 1, and maximum value is 5. The default value is 2.
|
|
|
1019 |
*
|
|
|
1020 |
* @param simUploadLimit {int} Number of simultaneous uploads, between 1 and 5.
|
|
|
1021 |
*/
|
|
|
1022 |
setSimUploadLimit : function (simUploadLimit)
|
|
|
1023 |
{
|
|
|
1024 |
this._swf.setSimUploadLimit(simUploadLimit);
|
|
|
1025 |
},
|
|
|
1026 |
|
|
|
1027 |
/**
|
|
|
1028 |
* Sets the flag allowing users to select multiple files for the upload.
|
|
|
1029 |
*
|
|
|
1030 |
* @param allowMultipleFiles {Boolean} If true, multiple files can be selected. False by default.
|
|
|
1031 |
*/
|
|
|
1032 |
setAllowMultipleFiles : function (allowMultipleFiles)
|
|
|
1033 |
{
|
|
|
1034 |
this._swf.setAllowMultipleFiles(allowMultipleFiles);
|
|
|
1035 |
},
|
|
|
1036 |
|
|
|
1037 |
/**
|
|
|
1038 |
* Sets the file filters for the "Browse" dialog.
|
|
|
1039 |
*
|
|
|
1040 |
* @param newFilterArray An array of sets of key-value pairs of the form
|
|
|
1041 |
* {extensions: extensionString, description: descriptionString, [optional]macType: macTypeString}
|
|
|
1042 |
* The extensions string is a semicolon-delimited list of elements of the form "*.xxx",
|
|
|
1043 |
* e.g. "*.jpg;*.gif;*.png".
|
|
|
1044 |
*/
|
|
|
1045 |
setFileFilters : function (fileFilters)
|
|
|
1046 |
{
|
|
|
1047 |
this._swf.setFileFilters(fileFilters);
|
|
|
1048 |
},
|
|
|
1049 |
|
|
|
1050 |
/**
|
|
|
1051 |
* Enables the mouse events on the Uploader.
|
|
|
1052 |
* If the uploader is being rendered as a button,
|
|
|
1053 |
* then the button's skin is set to "up"
|
|
|
1054 |
* (first section of the button skin sprite).
|
|
|
1055 |
*
|
|
|
1056 |
*/
|
|
|
1057 |
enable : function ()
|
|
|
1058 |
{
|
|
|
1059 |
this._swf.enable();
|
|
|
1060 |
},
|
|
|
1061 |
|
|
|
1062 |
/**
|
|
|
1063 |
* Disables the mouse events on the Uploader.
|
|
|
1064 |
* If the uploader is being rendered as a button,
|
|
|
1065 |
* then the button's skin is set to "disabled"
|
|
|
1066 |
* (fourth section of the button skin sprite).
|
|
|
1067 |
*
|
|
|
1068 |
*/
|
|
|
1069 |
disable : function ()
|
|
|
1070 |
{
|
|
|
1071 |
this._swf.disable();
|
|
|
1072 |
}
|
|
|
1073 |
});
|
|
|
1074 |
YAHOO.register("uploader", YAHOO.widget.Uploader, {version: "2.9.0", build: "2800"});
|
|
|
1075 |
|
|
|
1076 |
}, '2.9.0' ,{"requires": ["yui2-yahoo", "yui2-dom", "yui2-event", "yui2-element"]});
|