~lutostag/ubuntu/utopic/maas/1.5.2

« back to all changes in this revision

Viewing changes to src/maasserver/static/js/yui/3.4.1/swf/swf-debug.js

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-03-15 18:14:08 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120315181408-zgl94hzo0x4n99an
Tags: 0.1+bzr295+dfsg-0ubuntu2
* debian/patches:
  - 01-fix-database-settings.patch: Update to set PSERV_URL.
  - 02-pserv-config.patch: Set port to 8001.
* debian/maas.postinst: Run maas-import-isos on install.
* debian/control: Depends on rabbitmq-server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
YUI 3.4.1 (build 4118)
3
 
Copyright 2011 Yahoo! Inc. All rights reserved.
4
 
Licensed under the BSD License.
5
 
http://yuilibrary.com/license/
6
 
*/
7
 
YUI.add('swf', function(Y) {
8
 
 
9
 
/**
10
 
 * Embed a Flash applications in a standard manner and communicate with it
11
 
 * via External Interface.
12
 
 * @module swf
13
 
 */
14
 
        
15
 
        var Event = Y.Event,
16
 
        SWFDetect = Y.SWFDetect,
17
 
        Lang = Y.Lang,
18
 
        uA = Y.UA,
19
 
        Node = Y.Node,
20
 
        Escape = Y.Escape,
21
 
 
22
 
                // private
23
 
                FLASH_CID = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",
24
 
                FLASH_TYPE = "application/x-shockwave-flash",
25
 
                FLASH_VER = "10.0.22",
26
 
                EXPRESS_INSTALL_URL = "http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?" + Math.random(),
27
 
                EVENT_HANDLER = "SWF.eventHandler",
28
 
                possibleAttributes = {align:"", allowFullScreen:"", allowNetworking:"", allowScriptAccess:"", base:"", bgcolor:"", menu:"", name:"", quality:"", salign:"", scale:"", tabindex:"", wmode:""};
29
 
                
30
 
                /**
31
 
                 * The SWF utility is a tool for embedding Flash applications in HTML pages.
32
 
                 * @module swf
33
 
                 * @title SWF Utility
34
 
                 * @requires event-custom, node, swfdetect
35
 
                 */
36
 
 
37
 
                /**
38
 
                 * Creates the SWF instance and keeps the configuration data
39
 
                 *
40
 
                 * @class SWF
41
 
                 * @augments Y.Event.Target
42
 
                 * @constructor
43
 
                 * @param {String|HTMLElement} id The id of the element, or the element itself that the SWF will be inserted into.  
44
 
                 *        The width and height of the SWF will be set to the width and height of this container element.
45
 
                 * @param {String} swfURL The URL of the SWF to be embedded into the page.
46
 
                 * @param {Object} p_oAttributes (optional) Configuration parameters for the Flash application and values for Flashvars
47
 
                 *        to be passed to the SWF. The p_oAttributes object allows the following additional properties:
48
 
                 *        <dl>
49
 
         *          <dt>version : String</dt>
50
 
         *          <dd>The minimum version of Flash required on the user's machine.</dd>
51
 
         *          <dt>fixedAttributes : Object</dt>
52
 
         *          <dd>An object literal containing one or more of the following String keys and their values: <code>align, 
53
 
         *              allowFullScreen, allowNetworking, allowScriptAccess, base, bgcolor, menu, name, quality, salign, scale,
54
 
         *              tabindex, wmode.</code> event from the thumb</dd>
55
 
         *        </dl>
56
 
                 */
57
 
                                
58
 
function SWF (p_oElement /*:String*/, swfURL /*:String*/, p_oAttributes /*:Object*/ ) {
59
 
        
60
 
        this._id = Y.guid("yuiswf");
61
 
        
62
 
        
63
 
        var _id = this._id;
64
 
    var oElement = Node.one(p_oElement);
65
 
        
66
 
        var flashVersion = p_oAttributes["version"] || FLASH_VER;
67
 
    var flashVersionSplit = (flashVersion + '').split(".");
68
 
        var isFlashVersionRight = SWFDetect.isFlashVersionAtLeast(parseInt(flashVersionSplit[0]), parseInt(flashVersionSplit[1]), parseInt(flashVersionSplit[2]));
69
 
        var canExpressInstall = (SWFDetect.isFlashVersionAtLeast(8,0,0));
70
 
        var shouldExpressInstall = canExpressInstall && !isFlashVersionRight && p_oAttributes["useExpressInstall"];
71
 
        var flashURL = (shouldExpressInstall)?EXPRESS_INSTALL_URL:swfURL;
72
 
        var objstring = '<object ';
73
 
        var w, h;
74
 
        var flashvarstring = "yId=" + Y.id + "&YUISwfId=" + _id + "&YUIBridgeCallback=" + EVENT_HANDLER + "&allowedDomain=" + document.location.hostname;
75
 
        
76
 
        Y.SWF._instances[_id] = this;
77
 
    if (oElement && (isFlashVersionRight || shouldExpressInstall) && flashURL) {
78
 
                                objstring += 'id="' + _id + '" '; 
79
 
                                if (uA.ie) {
80
 
                                        objstring += 'classid="' + FLASH_CID + '" ';
81
 
                                }
82
 
                                else {
83
 
                                        objstring += 'type="' + FLASH_TYPE + '" data="' + Escape.html(flashURL) + '" ';
84
 
                                }
85
 
                                
86
 
                w = "100%";
87
 
                                h = "100%";
88
 
                                
89
 
                                objstring += 'width="' + w + '" height="' + h + '">';
90
 
                                
91
 
                                if (uA.ie) {
92
 
                                        objstring += '<param name="movie" value="' + Escape.html(flashURL) + '"/>';
93
 
                                }
94
 
                                
95
 
                                for (var attribute in p_oAttributes.fixedAttributes) {
96
 
                                        if (possibleAttributes.hasOwnProperty(attribute)) {
97
 
                                                objstring += '<param name="' + Escape.html(attribute) + '" value="' + Escape.html(p_oAttributes.fixedAttributes[attribute]) + '"/>';
98
 
                                        }
99
 
                                }
100
 
 
101
 
                                for (var flashvar in p_oAttributes.flashVars) {
102
 
                                        var fvar = p_oAttributes.flashVars[flashvar];
103
 
                                        if (Lang.isString(fvar)) {
104
 
                                                flashvarstring += "&" + Escape.html(flashvar) + "=" + Escape.html(encodeURIComponent(fvar));
105
 
                                        }
106
 
                                }
107
 
                                
108
 
                                if (flashvarstring) {
109
 
                                        objstring += '<param name="flashVars" value="' + flashvarstring + '"/>';
110
 
                                }
111
 
                                
112
 
                                objstring += "</object>"; 
113
 
                                oElement.setContent(objstring);
114
 
                        
115
 
                                this._swf = Node.one("#" + _id);
116
 
                        }
117
 
        /**
118
 
        * Fired when the Flash player version on the user's machine is below the required value.
119
 
        *
120
 
        * @event wrongflashversion
121
 
    */
122
 
        else {
123
 
                    var event = {};
124
 
                    event.type = "wrongflashversion";
125
 
                        this.publish("wrongflashversion", {fireOnce:true});
126
 
                this.fire("wrongflashversion", event);
127
 
                }               
128
 
};
129
 
 
130
 
/**
131
 
 * @private
132
 
 * The static collection of all instances of the SWFs on the page.
133
 
 * @property _instances
134
 
 * @type Object
135
 
 */
136
 
 
137
 
SWF._instances = SWF._instances || {};
138
 
 
139
 
/**
140
 
 * @private
141
 
 * Handles an event coming from within the SWF and delegate it
142
 
 * to a specific instance of SWF.
143
 
 * @method eventHandler
144
 
 * @param swfid {String} the id of the SWF dispatching the event
145
 
 * @param event {Object} the event being transmitted.
146
 
 */
147
 
SWF.eventHandler = function (swfid, event) {
148
 
        SWF._instances[swfid]._eventHandler(event);
149
 
};
150
 
 
151
 
SWF.prototype = 
152
 
{
153
 
        /**
154
 
         * @private
155
 
         * Propagates a specific event from Flash to JS.
156
 
         * @method _eventHandler
157
 
         * @param event {Object} The event to be propagated from Flash.
158
 
         */
159
 
        
160
 
        _eventHandler: function(event)
161
 
        {
162
 
                if (event.type === "swfReady") 
163
 
                {
164
 
                        this.publish("swfReady", {fireOnce:true});
165
 
                this.fire("swfReady", event);
166
 
        }
167
 
                else if(event.type === "log")
168
 
                {
169
 
                        Y.log(event.message, event.category, this.toString());
170
 
                }
171
 
        else
172
 
                {
173
 
                        this.fire(event.type, event);
174
 
        } 
175
 
        },
176
 
                
177
 
        /**
178
 
         * Calls a specific function exposed by the SWF's
179
 
         * ExternalInterface.
180
 
         * @method callSWF
181
 
         * @param func {String} the name of the function to call
182
 
         * @param args {Object} the set of arguments to pass to the function.
183
 
         */
184
 
        
185
 
        callSWF: function (func, args)
186
 
        {
187
 
                if (!args) { 
188
 
                          args= []; 
189
 
                };      
190
 
                if (this._swf._node[func]) {
191
 
                return(this._swf._node[func].apply(this._swf._node, args));
192
 
            } else {
193
 
                return null;
194
 
            }
195
 
        },
196
 
        
197
 
        /**
198
 
         * Public accessor to the unique name of the SWF instance.
199
 
         *
200
 
         * @method toString
201
 
         * @return {String} Unique name of the SWF instance.
202
 
         */
203
 
        toString: function()
204
 
        {
205
 
                return "SWF " + this._id;
206
 
        }
207
 
};
208
 
 
209
 
Y.augment(SWF, Y.EventTarget);
210
 
 
211
 
Y.SWF = SWF;
212
 
 
213
 
 
214
 
}, '3.4.1' ,{requires:['event-custom','node','swfdetect','escape']});