1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
|
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2007 1&1 Internet AG, Germany, http://www.1and1.org
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Andreas Ecker (ecker)
________________________________________________________________________
This class contains code based on the following work:
SWFObject: Javascript Flash Player detection and embed script
http://blog.deconcept.com/swfobject/
Version: 1.4.4
Copyright:
2006 Geoff Stearns
License:
MIT: http://www.opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Authors:
* Geoff Stearns (geoff@deconcept.com)
************************************************************************ */
/* ************************************************************************
************************************************************************ */
/**
* Flash Player detection and embed.
*
* This class contains code based on the following work:<br/>
* SWFObject: Javascript Flash Player detection and embed script<br/>
* http://blog.deconcept.com/swfobject/</br>
* Version: 1.4.4
*
* License:<br/>
* MIT: http://www.opensource.org/licenses/mit-license.php<br/>
* For more info, please see the corresponding source file.
*
* @param vSource {String} Url of the SWF file to embed
* @param vVersion {String} Flash version of the SWF file
*/
qx.OO.defineClass("qx.ui.embed.Flash", qx.ui.basic.Terminator,
function(vSource, vVersion)
{
qx.ui.basic.Terminator.call(this);
// Use background handling of qx.ui.core.Widget instead
this._params = {};
this._variables = {};
if(vSource != null) {
this.setSource(vSource);
}
this.setVersion(vVersion != null ? vVersion : qx.ui.embed.Flash.MINREQUIRED);
});
qx.OO.addProperty({ name : "source", type : "string" });
qx.OO.addProperty({ name : "version" });
qx.OO.addProperty({ name : "enableExpressInstall", type : "boolean", defaultValue : false });
qx.OO.addProperty({ name : "enableDetection", type : "boolean", defaultValue : true });
qx.OO.addProperty({ name : "redirectUrl", type : "string" });
qx.OO.addProperty({ name : "quality", type : "string", impl : "param", defaultValue : "high", possibleValues : [ "low", "autolow", "autohigh", "medium", "high", "best" ] });
qx.OO.addProperty({ name : "scale", type : "string", impl : "param", defaultValue : "showall", possibleValues : [ "showall", "noborder", "excactfit", "noscale" ] });
qx.OO.addProperty({ name : "wmode", type : "string", impl : "param", defaultValue : "", possibleValues : [ "window", "opaque", "transparent" ] });
qx.OO.addProperty({ name : "play", type : "boolean", impl : "param", defaultValue : true });
qx.OO.addProperty({ name : "loop", type : "boolean", impl : "param", defaultValue : true });
qx.OO.addProperty({ name : "menu", type : "boolean", impl : "param", defaultValue : true });
qx.ui.embed.Flash.EXPRESSINSTALL = [6,0,65];
qx.ui.embed.Flash.MINREQUIRED = "1";
qx.ui.embed.Flash.PLAYERVERSION = null;
qx.ui.embed.Flash.PLUGINKEY = "Shockwave Flash";
qx.ui.embed.Flash.ACTIVEXKEY = "ShockwaveFlash.ShockwaveFlash";
/*
---------------------------------------------------------------------------
PLAYER VERSION CACHE
---------------------------------------------------------------------------
*/
qx.ui.embed.Flash.getPlayerVersion = function()
{
if (qx.ui.embed.Flash.PLAYERVERSION != null) {
return qx.ui.embed.Flash.PLAYERVERSION;
}
var vPlayerVersion = new qx.type.Version(0,0,0);
if(navigator.plugins && navigator.mimeTypes.length)
{
var x = navigator.plugins[qx.ui.embed.Flash.PLUGINKEY];
if(x && x.description) {
vPlayerVersion = new qx.type.Version(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
}
}
else if (window.ActiveXObject)
{
// do minor version lookup in IE, but avoid fp6 crashing issues
// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
try {
var axo = new ActiveXObject(qx.ui.embed.Flash.ACTIVEXKEY + ".7");
}
catch(e)
{
try {
var axo = new ActiveXObject(qx.ui.embed.Flash.ACTIVEXKEY + ".6");
vPlayerVersion = new qx.type.Version([6,0,21]);
axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
}
catch(e)
{
if (vPlayerVersion.major == 6) {
return vPlayerVersion;
}
}
try {
axo = new ActiveXObject(qx.ui.embed.Flash.ACTIVEXKEY);
} catch(e) {}
}
if (axo != null) {
vPlayerVersion = new qx.type.Version(axo.GetVariable("$version").split(" ")[1].split(","));
}
}
return qx.ui.embed.Flash.PLAYERVERSION = vPlayerVersion;
};
/*
---------------------------------------------------------------------------
BASICS
---------------------------------------------------------------------------
*/
qx.Proto._version = null;
qx.Proto._source = "";
qx.Proto._applyElementData = function(el)
{
qx.ui.basic.Terminator.prototype._applyElementData.call(this, el);
// Check for ExpressInstall
this._expressInstall = false;
if (this.getEnableExpressInstall())
{
// check to see if we need to do an express install
var expressInstallReqVer = new qx.type.Version(qx.ui.embed.Flash.EXPRESSINSTALL);
var installedVer = qx.ui.embed.Flash.getPlayerVersion();
if (installedVer.versionIsValid(expressInstallReqVer) && !installedVer.versionIsValid(this._version)) {
this._expressInstall = true;
}
}
// this.debug("ExpressInstall Enabled: " + this._expressInstall);
// Apply HTML
if(!this.getEnableDetection() || this._expressInstall || qx.ui.embed.Flash.getPlayerVersion().versionIsValid(this._version))
{
el.innerHTML = this.generateHTML();
}
else
{
var redir = this.getRedirectUrl();
if(redir != "") {
document.location.replace(redir);
}
}
};
/*
---------------------------------------------------------------------------
MODIFIER
---------------------------------------------------------------------------
*/
qx.Proto._modifySource = function(propValue, propOldValue, propName)
{
this._source = qx.util.Validation.isValidString(propValue) ? qx.manager.object.AliasManager.getInstance().resolvePath(propValue) : "";
return true;
};
qx.Proto._modifyVersion = function(propValue, propOldValue, propData)
{
if (this._version)
{
this._version.dispose();
this._version = null;
}
if (qx.util.Validation.isValidString(propValue)) {
this._version = new qx.type.Version(propValue);
}
return true;
};
qx.Proto._modifyParam = function(propValue, propOldValue, propData)
{
this.setParam(propData.name, propValue.toString());
return true;
};
/*
---------------------------------------------------------------------------
OVERWRITE BACKGROUND COLOR HANDLING
---------------------------------------------------------------------------
*/
qx.Proto._modifyBackgroundColor = function(propValue, propOldValue, propData)
{
if (propOldValue) {
propOldValue.remove(this);
}
if (propValue)
{
this._applyBackgroundColor(propValue.getHex());
propValue.add(this);
}
else
{
this._resetBackgroundColor();
}
return true;
};
qx.Proto._applyBackgroundColor = function(vNewValue) {
this.setParam("bgcolor", vNewValue);
};
/*
---------------------------------------------------------------------------
PARAMS
---------------------------------------------------------------------------
*/
qx.Proto.setParam = function(name, value){
this._params[name] = value;
};
qx.Proto.getParam = function(name){
return this._params[name];
};
qx.Proto.getParams = function() {
return this._params;
};
/*
---------------------------------------------------------------------------
VARIABLES
---------------------------------------------------------------------------
*/
qx.Proto.setVariable = function(name, value){
this._variables[name] = value;
};
qx.Proto.getVariable = function(name){
return this._variables[name];
};
qx.Proto.getVariables = function(){
return this._variables;
};
/*
---------------------------------------------------------------------------
HTML UTILITIES
---------------------------------------------------------------------------
*/
qx.Proto.generateParamTags = function()
{
var vParams = this.getParams();
var vParamTags = [];
for (var vKey in vParams)
{
vParamTags.push("<param name='");
vParamTags.push(vKey);
vParamTags.push("' value='");
vParamTags.push(vParams[vKey]);
vParamTags.push("'/>");
}
return vParamTags.join("");
};
qx.Proto.getVariablePairs = function()
{
var variables = this.getVariables();
var variablePairs = [];
for (var key in variables) {
variablePairs.push(key + "=" + variables[key]);
}
return variablePairs.join("&");
};
/*
---------------------------------------------------------------------------
HTML GENERATOR
---------------------------------------------------------------------------
*/
// Netscape Plugin Architecture
if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length)
{
qx.Proto.generateHTML = function()
{
var html = [];
// Express Install Handling
if (this._expressInstall)
{
document.title = document.title.slice(0, 47) + ' - Flash Player Installation';
this.addVariable('MMredirectURL', escape(window.location));
this.addVariable('MMdoctitle', document.title);
this.addVariable('MMplayerType', 'PlugIn');
}
html.push("<embed type='application/x-shockwave-flash' width='100%' height='100%' src='");
html.push(this._source);
html.push("'");
var params = this.getParams();
for (var key in params)
{
html.push(" ");
html.push(key);
html.push("=");
html.push("'");
html.push(params[key]);
html.push("'");
}
var pairs = this.getVariablePairs();
if (pairs.length > 0)
{
html.push(" ");
html.push("flashvars");
html.push("=");
html.push("'");
html.push(pairs);
html.push("'");
}
html.push("></embed>");
return html.join("");
};
}
else
{
// Internet Explorer ActiveX Architecture
qx.Proto.generateHTML = function()
{
var html = [];
// Express Install Handling
if (this._expressInstall)
{
document.title = document.title.slice(0, 47) + ' - Flash Player Installation';
this.addVariable("MMredirectURL", escape(window.location));
this.addVariable("MMdoctitle", document.title);
this.addVariable("MMplayerType", "ActiveX");
}
html.push("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='100%' height='100%'>");
html.push("<param name='movie' value='");
html.push(this._source);
html.push("'/>");
var tags = this.generateParamTags();
if(tags.length > 0) {
html.push(tags);
}
var pairs = this.getVariablePairs();
if(pairs.length > 0)
{
html.push("<param name='flashvars' value='");
html.push(pairs);
html.push("'/>");
}
html.push("</object>");
return html.join("");
};
}
/*
---------------------------------------------------------------------------
METHODS TO GIVE THE LAYOUTERS INFORMATIONS
---------------------------------------------------------------------------
*/
qx.Proto._isWidthEssential = qx.lang.Function.returnTrue;
qx.Proto._isHeightEssential = qx.lang.Function.returnTrue;
/*
---------------------------------------------------------------------------
PREFERRED DIMENSIONS
---------------------------------------------------------------------------
*/
qx.Proto._computePreferredInnerWidth = qx.lang.Function.returnZero;
qx.Proto._computePreferredInnerHeight = qx.lang.Function.returnZero;
/*
---------------------------------------------------------------------------
DISPOSER
---------------------------------------------------------------------------
*/
qx.Proto.dispose = function()
{
if (this.getDisposed()) {
return;
}
delete this._source;
delete this._params;
delete this._variables;
if (this._version)
{
this._version.dispose();
this._version = null;
}
qx.ui.basic.Terminator.prototype.dispose.call(this);
};
|