~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/build/base-build/base-build-debug.js

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

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('base-build', function(Y) {
8
 
 
9
 
    /**
10
 
     * The base-build submodule provides Base.build functionality, which
11
 
     * can be used to create custom classes, by aggregating extensions onto 
12
 
     * a main class.
13
 
     *
14
 
     * @module base
15
 
     * @submodule base-build
16
 
     * @for Base
17
 
     */
18
 
    var Base = Y.Base,
19
 
        L = Y.Lang,
20
 
        INITIALIZER = "initializer",
21
 
        DESTRUCTOR = "destructor",
22
 
        build;
23
 
 
24
 
    Base._build = function(name, main, extensions, px, sx, cfg) {
25
 
 
26
 
        var build = Base._build,
27
 
 
28
 
            builtClass = build._ctor(main, cfg),
29
 
            buildCfg = build._cfg(main, cfg),
30
 
 
31
 
            _mixCust = build._mixCust,
32
 
 
33
 
            aggregates = buildCfg.aggregates,
34
 
            custom = buildCfg.custom,
35
 
 
36
 
            dynamic = builtClass._yuibuild.dynamic,
37
 
 
38
 
            i, l, val, extClass, extProto,
39
 
            initializer,
40
 
            destructor;
41
 
 
42
 
        if (dynamic && aggregates) {
43
 
            for (i = 0, l = aggregates.length; i < l; ++i) {
44
 
                val = aggregates[i];
45
 
                if (main.hasOwnProperty(val)) {
46
 
                    builtClass[val] = L.isArray(main[val]) ? [] : {};
47
 
                }
48
 
            }
49
 
        }
50
 
 
51
 
        // Augment/Aggregate
52
 
        for (i = 0, l = extensions.length; i < l; i++) {
53
 
            extClass = extensions[i];
54
 
 
55
 
            extProto = extClass.prototype;
56
 
            
57
 
            initializer = extProto[INITIALIZER];
58
 
            destructor = extProto[DESTRUCTOR];
59
 
            delete extProto[INITIALIZER];
60
 
            delete extProto[DESTRUCTOR];
61
 
 
62
 
            // Prototype, old non-displacing augment
63
 
            Y.mix(builtClass, extClass, true, null, 1);
64
 
 
65
 
             // Custom Statics
66
 
            _mixCust(builtClass, extClass, aggregates, custom);
67
 
            
68
 
            if (initializer) { 
69
 
                extProto[INITIALIZER] = initializer;
70
 
            }
71
 
 
72
 
            if (destructor) {
73
 
                extProto[DESTRUCTOR] = destructor;
74
 
            }
75
 
 
76
 
            builtClass._yuibuild.exts.push(extClass);
77
 
        }
78
 
 
79
 
        if (px) {
80
 
            Y.mix(builtClass.prototype, px, true);
81
 
        }
82
 
 
83
 
        if (sx) {
84
 
            Y.mix(builtClass, build._clean(sx, aggregates, custom), true);
85
 
            _mixCust(builtClass, sx, aggregates, custom);
86
 
        }
87
 
 
88
 
        builtClass.prototype.hasImpl = build._impl;
89
 
 
90
 
        if (dynamic) {
91
 
            builtClass.NAME = name;
92
 
            builtClass.prototype.constructor = builtClass;
93
 
        }
94
 
 
95
 
        return builtClass;
96
 
    };
97
 
 
98
 
    build = Base._build;
99
 
 
100
 
    Y.mix(build, {
101
 
 
102
 
        _mixCust: function(r, s, aggregates, custom) {
103
 
 
104
 
            if (aggregates) {
105
 
                Y.aggregate(r, s, true, aggregates);
106
 
            }
107
 
 
108
 
            if (custom) {
109
 
                for (var j in custom) {
110
 
                    if (custom.hasOwnProperty(j)) {
111
 
                        custom[j](j, r, s);
112
 
                    }
113
 
                }
114
 
            }
115
 
        },
116
 
 
117
 
        _tmpl: function(main) {
118
 
 
119
 
            function BuiltClass() {
120
 
                BuiltClass.superclass.constructor.apply(this, arguments);
121
 
            }
122
 
            Y.extend(BuiltClass, main);
123
 
 
124
 
            return BuiltClass;
125
 
        },
126
 
 
127
 
        _impl : function(extClass) {
128
 
            var classes = this._getClasses(), i, l, cls, exts, ll, j;
129
 
            for (i = 0, l = classes.length; i < l; i++) {
130
 
                cls = classes[i];
131
 
                if (cls._yuibuild) {
132
 
                    exts = cls._yuibuild.exts;
133
 
                    ll = exts.length;
134
 
    
135
 
                    for (j = 0; j < ll; j++) {
136
 
                        if (exts[j] === extClass) {
137
 
                            return true;
138
 
                        }
139
 
                    }
140
 
                }
141
 
            }
142
 
            return false;
143
 
        },
144
 
 
145
 
        _ctor : function(main, cfg) {
146
 
 
147
 
           var dynamic = (cfg && false === cfg.dynamic) ? false : true,
148
 
               builtClass = (dynamic) ? build._tmpl(main) : main,
149
 
               buildCfg = builtClass._yuibuild;
150
 
 
151
 
            if (!buildCfg) {
152
 
                buildCfg = builtClass._yuibuild = {};
153
 
            }
154
 
 
155
 
            buildCfg.id = buildCfg.id || null;
156
 
            buildCfg.exts = buildCfg.exts || [];
157
 
            buildCfg.dynamic = dynamic;
158
 
 
159
 
            return builtClass;
160
 
        },
161
 
 
162
 
        _cfg : function(main, cfg) {
163
 
            var aggr = [], 
164
 
                cust = {},
165
 
                buildCfg,
166
 
                cfgAggr = (cfg && cfg.aggregates),
167
 
                cfgCustBuild = (cfg && cfg.custom),
168
 
                c = main;
169
 
 
170
 
            while (c && c.prototype) {
171
 
                buildCfg = c._buildCfg; 
172
 
                if (buildCfg) {
173
 
                    if (buildCfg.aggregates) {
174
 
                        aggr = aggr.concat(buildCfg.aggregates);
175
 
                    }
176
 
                    if (buildCfg.custom) {
177
 
                        Y.mix(cust, buildCfg.custom, true);
178
 
                    }
179
 
                }
180
 
                c = c.superclass ? c.superclass.constructor : null;
181
 
            }
182
 
 
183
 
            if (cfgAggr) {
184
 
                aggr = aggr.concat(cfgAggr);
185
 
            }
186
 
            if (cfgCustBuild) {
187
 
                Y.mix(cust, cfg.cfgBuild, true);
188
 
            }
189
 
 
190
 
            return {
191
 
                aggregates: aggr,
192
 
                custom: cust
193
 
            };
194
 
        },
195
 
 
196
 
        _clean : function(sx, aggregates, custom) {
197
 
            var prop, i, l, sxclone = Y.merge(sx);
198
 
 
199
 
            for (prop in custom) {
200
 
                if (sxclone.hasOwnProperty(prop)) {
201
 
                    delete sxclone[prop];
202
 
                }
203
 
            }
204
 
 
205
 
            for (i = 0, l = aggregates.length; i < l; i++) {
206
 
                prop = aggregates[i];
207
 
                if (sxclone.hasOwnProperty(prop)) {
208
 
                    delete sxclone[prop];
209
 
                }
210
 
            }
211
 
 
212
 
            return sxclone;
213
 
        }
214
 
    });
215
 
 
216
 
    /**
217
 
     * <p>
218
 
     * Builds a custom constructor function (class) from the
219
 
     * main function, and array of extension functions (classes)
220
 
     * provided. The NAME field for the constructor function is 
221
 
     * defined by the first argument passed in.
222
 
     * </p>
223
 
     * <p>
224
 
     * The cfg object supports the following properties
225
 
     * </p>
226
 
     * <dl>
227
 
     *    <dt>dynamic &#60;boolean&#62;</dt>
228
 
     *    <dd>
229
 
     *    <p>If true (default), a completely new class
230
 
     *    is created which extends the main class, and acts as the 
231
 
     *    host on which the extension classes are augmented.</p>
232
 
     *    <p>If false, the extensions classes are augmented directly to
233
 
     *    the main class, modifying the main class' prototype.</p>
234
 
     *    </dd>
235
 
     *    <dt>aggregates &#60;String[]&#62;</dt>
236
 
     *    <dd>An array of static property names, which will get aggregated
237
 
     *    on to the built class, in addition to the default properties build 
238
 
     *    will always aggregate as defined by the main class' static _buildCfg
239
 
     *    property.
240
 
     *    </dd>
241
 
     * </dl>
242
 
     *
243
 
     * @method build
244
 
     * @deprecated Use the more convenient Base.create and Base.mix methods instead
245
 
     * @static
246
 
     * @param {Function} name The name of the new class. Used to defined the NAME property for the new class.
247
 
     * @param {Function} main The main class on which to base the built class
248
 
     * @param {Function[]} extensions The set of extension classes which will be
249
 
     * augmented/aggregated to the built class.
250
 
     * @param {Object} cfg Optional. Build configuration for the class (see description).
251
 
     * @return {Function} A custom class, created from the provided main and extension classes
252
 
     */
253
 
    Base.build = function(name, main, extensions, cfg) {
254
 
        return build(name, main, extensions, null, null, cfg);
255
 
    };
256
 
 
257
 
    /**
258
 
     * <p>Creates a new class (constructor function) which extends the base class passed in as the second argument, 
259
 
     * and mixes in the array of extensions provided.</p>
260
 
     * <p>Prototype properties or methods can be added to the new class, using the px argument (similar to Y.extend).</p>
261
 
     * <p>Static properties or methods can be added to the new class, using the sx argument (similar to Y.extend).</p>
262
 
     * <p>
263
 
     * 
264
 
     * </p>
265
 
     * @method create
266
 
     * @static
267
 
     * @param {Function} name The name of the newly created class. Used to defined the NAME property for the new class.
268
 
     * @param {Function} main The base class which the new class should extend. This class needs to be Base or a class derived from base (e.g. Widget).
269
 
     * @param {Function[]} extensions The list of extensions which will be mixed into the built class.
270
 
     * @param {Object} px The set of prototype properties/methods to add to the built class.
271
 
     * @param {Object} sx The set of static properties/methods to add to the built class.
272
 
     * @return {Function} The newly created class.
273
 
     */
274
 
    Base.create = function(name, base, extensions, px, sx) {
275
 
        return build(name, base, extensions, px, sx);
276
 
    };
277
 
 
278
 
    /**
279
 
     * <p>Mixes in a list of extensions to an existing class.</p>
280
 
     * @method mix
281
 
     * @static
282
 
     * @param {Function} main The existing class into which the extensions should be mixed.  The class needs to be Base or a class derived from Base (e.g. Widget)
283
 
     * @param {Function[]} extensions The set of extension classes which will mixed into the existing main class.
284
 
     * @return {Function} The modified main class, with extensions mixed in.
285
 
     */
286
 
    Base.mix = function(main, extensions) {
287
 
        return build(null, main, extensions, null, null, {dynamic:false});
288
 
    };
289
 
 
290
 
    /**
291
 
     * The build configuration for the Base class.
292
 
     *
293
 
     * Defines the static fields which need to be aggregated
294
 
     * when the Base class is used as the main class passed to
295
 
     * the <a href="#method_Base.build">Base.build</a> method.
296
 
     *
297
 
     * @property _buildCfg
298
 
     * @type Object
299
 
     * @static
300
 
     * @final
301
 
     * @private
302
 
     */
303
 
    Base._buildCfg = {
304
 
        custom : {
305
 
            ATTRS : function(prop, r, s) {
306
 
 
307
 
                r.ATTRS = r.ATTRS || {};
308
 
 
309
 
                if (s.ATTRS) {
310
 
 
311
 
                    var sAttrs = s.ATTRS,
312
 
                        rAttrs = r.ATTRS,
313
 
                        a;
314
 
 
315
 
                    for (a in sAttrs) {
316
 
                        if (sAttrs.hasOwnProperty(a)) {
317
 
                            rAttrs[a] = rAttrs[a] || {};
318
 
                            Y.mix(rAttrs[a], sAttrs[a], true);
319
 
                        }
320
 
                    }
321
 
                }
322
 
            }
323
 
        },
324
 
        aggregates : ["_PLUG", "_UNPLUG"]
325
 
    };
326
 
 
327
 
 
328
 
}, '3.4.1' ,{requires:['base-base']});