~ubuntu-branches/ubuntu/utopic/moodle/utopic

« back to all changes in this revision

Viewing changes to blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-debug.js

  • Committer: Package Import Robot
  • Author(s): Thijs Kinkhorst
  • Date: 2014-05-12 16:10:38 UTC
  • mfrom: (36.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140512161038-puyqf65k4e0s8ytz
Tags: 2.6.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
YUI.add('moodle-block_navigation-navigation', function (Y, NAME) {
2
2
 
3
3
/**
 
4
 * Navigation block JS.
 
5
 *
 
6
 * This file contains the Navigation block JS..
 
7
 *
 
8
 * @module moodle-block_navigation-navigation
 
9
 */
 
10
 
 
11
/**
 
12
 * This namespace will contain all of the contents of the navigation blocks
 
13
 * global navigation and settings.
 
14
 * @namespace M
 
15
 * @class block_navigation
 
16
 * @static
 
17
 */
 
18
M.block_navigation = M.block_navigation || {};
 
19
/**
 
20
 * The number of expandable branches in existence.
 
21
 *
 
22
 * @property expandablebranchcount
 
23
 * @protected
 
24
 * @static
 
25
 */
 
26
M.block_navigation.expandablebranchcount = 1;
 
27
/**
 
28
 * The maximum number of courses to show as part of a branch.
 
29
 *
 
30
 * @property courselimit
 
31
 * @protected
 
32
 * @static
 
33
 */
 
34
M.block_navigation.courselimit = 20;
 
35
/**
 
36
 * Add new instance of navigation tree to tree collection
 
37
 *
 
38
 * @method init_add_tree
 
39
 * @static
 
40
 * @param {Object} properties
 
41
 */
 
42
M.block_navigation.init_add_tree = function(properties) {
 
43
    if (properties.courselimit) {
 
44
        this.courselimit = properties.courselimit;
 
45
    }
 
46
    new TREE(properties);
 
47
};
 
48
 
 
49
/**
4
50
 * A 'actionkey' Event to help with Y.delegate().
5
51
 * The event consists of the left arrow, right arrow, enter and space keys.
6
52
 * More keys can be mapped to action meanings.
9
55
 * This event is delegated to branches in the navigation tree.
10
56
 * The on() method to subscribe allows specifying the desired trigger actions as JSON.
11
57
 *
12
 
 * Todo: This could be centralised, a similar Event is defined in blocks/dock.js
 
58
 * @namespace M.block_navigation
 
59
 * @class ActionKey
13
60
 */
14
61
Y.Event.define("actionkey", {
15
 
   // Webkit and IE repeat keydown when you hold down arrow keys.
 
62
    // Webkit and IE repeat keydown when you hold down arrow keys.
16
63
    // Opera links keypress to page scroll; others keydown.
17
64
    // Firefox prevents page scroll via preventDefault() on either
18
65
    // keydown or keypress.
19
66
    _event: (Y.UA.webkit || Y.UA.ie) ? 'keydown' : 'keypress',
20
67
 
 
68
    /**
 
69
     * The keys to trigger on.
 
70
     * @method _keys
 
71
     */
21
72
    _keys: {
22
73
        //arrows
23
74
        '37': 'collapse',
24
75
        '39': 'expand',
25
 
        //(@todo: lrt/rtl/M.core_dock.cfg.orientation decision to assign arrow to meanings)
26
76
        '32': 'toggle',
27
77
        '13': 'enter'
28
78
    },
29
79
 
 
80
    /**
 
81
     * Handles key events
 
82
     * @method _keyHandler
 
83
     * @param {EventFacade} e
 
84
     * @param {SyntheticEvent.Notifier} notifier The notifier used to trigger the execution of subscribers
 
85
     * @param {Object} args
 
86
     */
30
87
    _keyHandler: function (e, notifier, args) {
31
88
        var actObj;
32
89
        if (!args.actions) {
40
97
        }
41
98
    },
42
99
 
 
100
    /**
 
101
     * Subscribes to events.
 
102
     * @method on
 
103
     * @param {Node} node The node this subscription was applied to.
 
104
     * @param {Subscription} sub The object tracking this subscription.
 
105
     * @param {SyntheticEvent.Notifier} notifier The notifier used to trigger the execution of subscribers
 
106
     */
43
107
    on: function (node, sub, notifier) {
44
108
        // subscribe to _event and ask keyHandler to handle with given args[0] (the desired actions).
45
109
        if (sub.args === null) {
50
114
        }
51
115
    },
52
116
 
 
117
    /**
 
118
     * Detaches an event listener
 
119
     * @method detach
 
120
     */
53
121
    detach: function (node, sub) {
54
122
        //detach our _detacher handle of the subscription made in on()
55
123
        sub._detacher.detach();
56
124
    },
57
125
 
 
126
    /**
 
127
     * Creates a delegated event listener.
 
128
     * @method delegate
 
129
     * @param {Node} node The node this subscription was applied to.
 
130
     * @param {Subscription} sub The object tracking this subscription.
 
131
     * @param {SyntheticEvent.Notifier} notifier The notifier used to trigger the execution of subscribers
 
132
     * @param {String|function} filter Selector string or function that accpets an event object and returns null.
 
133
     */
58
134
    delegate: function (node, sub, notifier, filter) {
59
135
        // subscribe to _event and ask keyHandler to handle with given args[0] (the desired actions).
60
136
        if (sub.args === null) {
65
141
        }
66
142
    },
67
143
 
 
144
    /**
 
145
     * Detaches a delegated event listener.
 
146
     * @method detachDelegate
 
147
     * @param {Node} node The node this subscription was applied to.
 
148
     * @param {Subscription} sub The object tracking this subscription.
 
149
     * @param {SyntheticEvent.Notifier} notifier The notifier used to trigger the execution of subscribers
 
150
     * @param {String|function} filter Selector string or function that accpets an event object and returns null.
 
151
     */
68
152
    detachDelegate: function (node, sub) {
69
153
        sub._delegateDetacher.detach();
70
154
    }
71
155
});
72
156
 
73
157
var EXPANSIONLIMIT_EVERYTHING = 0,
74
 
    //EXPANSIONLIMIT_COURSE     = 20,
75
 
    //EXPANSIONLIMIT_SECTION    = 30,
 
158
    EXPANSIONLIMIT_COURSE     = 20,
 
159
    EXPANSIONLIMIT_SECTION    = 30,
76
160
    EXPANSIONLIMIT_ACTIVITY   = 40;
77
161
 
78
 
/**
79
 
 * Mappings for the different types of nodes coming from the navigation.
80
 
 * Copied from lib/navigationlib.php navigation_node constants.
81
 
 * @type object
82
 
 */
 
162
// Mappings for the different types of nodes coming from the navigation.
 
163
// Copied from lib/navigationlib.php navigation_node constants.
83
164
var NODETYPE = {
84
 
    /** @type int Root node = 0 */
 
165
    // @type int Root node = 0
85
166
    ROOTNODE : 0,
86
 
    /** @type int System context = 1 */
 
167
    // @type int System context = 1
87
168
    SYSTEM : 1,
88
 
    /** @type int Course category = 10 */
 
169
    // @type int Course category = 10
89
170
    CATEGORY : 10,
90
 
    /** @type int MYCATEGORY = 11 */
 
171
    // @type int MYCATEGORY = 11
91
172
    MYCATEGORY : 11,
92
 
    /** @type int Course = 20 */
 
173
    // @type int Course = 20
93
174
    COURSE : 20,
94
 
    /** @type int Course section = 30 */
 
175
    // @type int Course section = 30
95
176
    SECTION : 30,
96
 
    /** @type int Activity (course module) = 40 */
 
177
    // @type int Activity (course module) = 40
97
178
    ACTIVITY : 40,
98
 
    /** @type int Resource (course module = 50 */
 
179
    // @type int Resource (course module = 50
99
180
    RESOURCE : 50,
100
 
    /** @type int Custom node (could be anything) = 60 */
 
181
    // @type int Custom node (could be anything) = 60
101
182
    CUSTOM : 60,
102
 
    /** @type int Setting = 70 */
 
183
    // @type int Setting = 70
103
184
    SETTING : 70,
104
 
    /** @type int User context = 80 */
 
185
    // @type int site administration = 71
 
186
    SITEADMIN : 71,
 
187
    // @type int User context = 80
105
188
    USER : 80,
106
 
    /** @type int Container = 90 */
 
189
    // @type int Container = 90
107
190
    CONTAINER : 90
108
191
};
109
192
 
112
195
 *
113
196
 * This class establishes the tree initially, creating expandable branches as
114
197
 * required, and delegating the expand/collapse event.
 
198
 *
 
199
 * @namespace M.block_navigation
 
200
 * @class Tree
 
201
 * @constructor
 
202
 * @extends Y.Base
115
203
 */
116
204
var TREE = function() {
117
205
    TREE.superclass.constructor.apply(this, arguments);
119
207
TREE.prototype = {
120
208
    /**
121
209
     * The tree's ID, normally its block instance id.
 
210
     * @property id
 
211
     * @type Int
 
212
     * @protected
122
213
     */
123
214
    id : null,
124
215
    /**
125
216
     * An array of initialised branches.
 
217
     * @property branches
 
218
     * @type Array
 
219
     * @protected
126
220
     */
127
221
    branches : [],
128
222
    /**
129
223
     * Initialise the tree object when its first created.
 
224
     * @method initializer
 
225
     * @param {Object} config
130
226
     */
131
227
    initializer : function(config) {
132
 
        this.id = config.id;
 
228
        Y.log('Initialising navigation block tree', 'note', 'moodle-block_navigation');
 
229
 
 
230
        this.id = parseInt(config.id, 10);
133
231
 
134
232
        var node = Y.one('#inst'+config.id);
135
233
 
163
261
            M.block_navigation.expandablebranchcount++;
164
262
            this.branches[branch.get('id')] = branch;
165
263
        }
 
264
        // Create siteadmin branch.
 
265
        if (window.siteadminexpansion) {
 
266
            var siteadminbranch = new BRANCH({
 
267
                tree: this,
 
268
                branchobj: window.siteadminexpansion,
 
269
                overrides : {
 
270
                    expandable : true,
 
271
                    children : [],
 
272
                    haschildren : true
 
273
                }
 
274
            }).wire();
 
275
            M.block_navigation.expandablebranchcount++;
 
276
            this.branches[siteadminbranch.get('id')] = siteadminbranch;
 
277
            // Remove link on site admin with JS to keep old UI.
 
278
            if (siteadminbranch.node) {
 
279
                var siteadminlinknode = siteadminbranch.node.get('childNodes').item(0);
 
280
                if (siteadminlinknode) {
 
281
                    var siteadminnode = Y.Node.create('<span tabindex="0">'+siteadminlinknode.get('innerHTML')+'</span>');
 
282
                    siteadminbranch.node.replaceChild(siteadminnode, siteadminlinknode);
 
283
                }
 
284
            }
 
285
        }
166
286
        if (M.block_navigation.expandablebranchcount > 0) {
167
287
            // Delegate some events to handle AJAX loading.
168
288
            Y.delegate('click', this.fire_branch_action, node.one('.block_tree'), '.tree_item.branch[data-expandable]', this);
169
289
            Y.delegate('actionkey', this.fire_branch_action, node.one('.block_tree'), '.tree_item.branch[data-expandable]', this);
170
290
        }
171
 
 
172
 
        // Call the generic blocks init method to add all the generic stuff
173
 
        if (this.get('candock')) {
174
 
            this.initialise_block(Y, node);
175
 
        }
176
291
    },
177
292
    /**
178
293
     * Fire actions for a branch when an event occurs.
 
294
     * @method fire_branch_action
 
295
     * @param {EventFacade} event
179
296
     */
180
297
    fire_branch_action : function(event) {
181
298
        var id = event.currentTarget.getAttribute('id');
185
302
    /**
186
303
     * This is a callback function responsible for expanding and collapsing the
187
304
     * branches of the tree. It is delegated to rather than multiple event handles.
 
305
     * @method toggleExpansion
 
306
     * @param {EventFacade} e
 
307
     * @return Boolean
188
308
     */
189
309
    toggleExpansion : function(e) {
190
310
        // First check if they managed to click on the li iteslf, then find the closest
240
360
 
241
361
        // If this block can dock tell the dock to resize if required and check
242
362
        // the width on the dock panel in case it is presently in use.
243
 
        if (this.get('candock')) {
244
 
            M.core_dock.resize();
245
 
            var panel = M.core_dock.getPanel();
246
 
            if (panel.visible) {
247
 
                panel.correctWidth();
248
 
            }
 
363
        if (this.get('candock') && M.core.dock.notifyBlockChange) {
 
364
            M.core.dock.notifyBlockChange(this.id);
249
365
        }
 
366
        return true;
 
367
 
250
368
    }
251
369
};
252
370
// The tree extends the YUI base foundation.
253
371
Y.extend(TREE, Y.Base, TREE.prototype, {
254
372
    NAME : 'navigation-tree',
255
373
    ATTRS : {
256
 
        instance : {
257
 
            value : null
258
 
        },
 
374
        /**
 
375
         * True if the block can dock.
 
376
         * @attribute candock
 
377
         * @type Boolean
 
378
         */
259
379
        candock : {
260
380
            validator : Y.Lang.isBool,
261
381
            value : false
262
382
        },
 
383
        /**
 
384
         * If set to true nodes will be opened/closed in an accordian fashion.
 
385
         * @attribute accordian
 
386
         * @type Boolean
 
387
         */
263
388
        accordian : {
264
389
            validator : Y.Lang.isBool,
265
390
            value : false
266
391
        },
 
392
        /**
 
393
         * The nodes that get shown.
 
394
         * @attribute expansionlimit
 
395
         * @type Integer
 
396
         */
267
397
        expansionlimit : {
268
398
            value : 0,
269
399
            setter : function(val) {
 
400
                val = parseInt(val, 10);
 
401
                if (val !== EXPANSIONLIMIT_EVERYTHING &&
 
402
                    val !== EXPANSIONLIMIT_COURSE &&
 
403
                    val !== EXPANSIONLIMIT_SECTION &&
 
404
                    val !== EXPANSIONLIMIT_ACTIVITY) {
 
405
                    val = EXPANSIONLIMIT_EVERYTHING;
 
406
                }
 
407
                return val;
 
408
            }
 
409
        },
 
410
        /**
 
411
         * The navigation tree block instance.
 
412
         */
 
413
        instance : {
 
414
            value : false,
 
415
            setter : function(val) {
270
416
                return parseInt(val, 10);
271
417
            }
272
418
        }
273
419
    }
274
420
});
275
 
if (M.core_dock && M.core_dock.genericblock) {
276
 
    Y.augment(TREE, M.core_dock.genericblock);
277
 
}
278
421
 
279
422
/**
280
 
 * The tree branch class.
 
423
 * The Branch class.
 
424
 *
281
425
 * This class is used to manage a tree branch, in particular its ability to load
282
426
 * its contents by AJAX.
 
427
 *
 
428
 * @namespace M.block_navigation
 
429
 * @class Branch
 
430
 * @constructor
 
431
 * @extends Y.Base
283
432
 */
284
433
BRANCH = function() {
285
434
    BRANCH.superclass.constructor.apply(this, arguments);
287
436
BRANCH.prototype = {
288
437
    /**
289
438
     * The node for this branch (p)
 
439
     * @property node
 
440
     * @type Node
 
441
     * @protected
290
442
     */
291
443
    node : null,
292
444
    /**
293
445
     * Initialises the branch when it is first created.
 
446
     * @method initializer
 
447
     * @param {Object} config
294
448
     */
295
449
    initializer : function(config) {
296
450
        var i,
310
464
            }
311
465
        }
312
466
        // Get the node for this branch
313
 
        this.node = Y.one('#', this.get('id'));
314
 
        // Now check whether the branch is not expandable because of the expansionlimit
 
467
        this.node = Y.one('#'+this.get('id'));
315
468
        var expansionlimit = this.get('tree').get('expansionlimit');
316
469
        var type = this.get('type');
317
470
        if (expansionlimit !== EXPANSIONLIMIT_EVERYTHING &&  type >= expansionlimit && type <= EXPANSIONLIMIT_ACTIVITY) {
324
477
     *
325
478
     * This function creates a DOM structure for the branch and then injects
326
479
     * it into the navigation tree at the correct point.
 
480
     *
 
481
     * @method draw
 
482
     * @chainable
 
483
     * @param {Node} element
 
484
     * @return Branch
327
485
     */
328
486
    draw : function(element) {
329
487
 
409
567
    },
410
568
    /**
411
569
     * Gets the UL element that children for this branch should be inserted into.
 
570
     * @method getChildrenUL
 
571
     * @return Node
412
572
     */
413
573
    getChildrenUL : function() {
414
574
        var ul = this.node.next('ul');
423
583
     *
424
584
     * This function calls ajaxProcessResponse with the result of the AJAX
425
585
     * request made here.
 
586
     *
 
587
     * @method ajaxLoad
 
588
     * @param {EventFacade} e
 
589
     * @return Bool
426
590
     */
427
591
    ajaxLoad : function(e) {
428
592
        if (e.type === 'actionkey' && e.action !== 'enter') {
430
594
        } else {
431
595
            e.stopPropagation();
432
596
        }
433
 
        if (e.type === 'actionkey' && e.action === 'enter' && e.target.test('A')) {
 
597
        if ((e.type === 'actionkey' && e.action === 'enter') || e.target.test('a')) {
434
598
            // No ajaxLoad for enter.
435
599
            this.node.setAttribute('data-expandable', '0');
436
600
            this.node.setAttribute('data-loaded', '1');
446
610
            // We've already loaded this stuff.
447
611
            return true;
448
612
        }
 
613
        Y.log('Loading navigation branch via AJAX: '+this.get('key'), 'note', 'moodle-block_navigation');
449
614
        this.node.addClass('loadingbranch');
450
615
 
451
616
        var params = {
456
621
            instance : this.get('tree').get('instance')
457
622
        };
458
623
 
459
 
        Y.io(M.cfg.wwwroot+'/lib/ajax/getnavbranch.php', {
 
624
        var ajaxfile = '/lib/ajax/getnavbranch.php';
 
625
        // For siteadmin navigation get tree from getsiteadminbranch.php.
 
626
        if (this.get('type') === NODETYPE.SITEADMIN) {
 
627
            ajaxfile = '/lib/ajax/getsiteadminbranch.php';
 
628
        }
 
629
 
 
630
        Y.io(M.cfg.wwwroot + ajaxfile, {
460
631
            method:'POST',
461
632
            data:  build_querystring(params),
462
633
            on: {
469
640
    /**
470
641
     * Processes an AJAX request to load the content of this branch through
471
642
     * AJAX.
 
643
     *
 
644
     * @method ajaxProcessResponse
 
645
     * @param {Int} tid The transaction id.
 
646
     * @param {Object} outcome
 
647
     * @return Boolean
472
648
     */
473
649
    ajaxProcessResponse : function(tid, outcome) {
474
650
        this.node.removeClass('loadingbranch');
475
651
        this.node.setAttribute('data-loaded', '1');
476
652
        try {
477
653
            var object = Y.JSON.parse(outcome.responseText);
 
654
            if (object.error) {
 
655
                Y.use('moodle-core-notification-ajaxexception', function () {
 
656
                    return new M.core.ajaxException(object).show();
 
657
                });
 
658
                return false;
 
659
            }
478
660
            if (object.children && object.children.length > 0) {
479
661
                var coursecount = 0;
480
662
                for (var i in object.children) {
481
 
                    if (typeof(object.children[i]) ==='object') {
 
663
                    if (typeof(object.children[i])==='object') {
482
664
                        if (object.children[i].type === NODETYPE.COURSE) {
483
665
                            coursecount++;
484
666
                        }
489
671
                    && coursecount >= M.block_navigation.courselimit) {
490
672
                    this.addViewAllCoursesChild(this);
491
673
                }
 
674
                Y.log('AJAX loading complete.', 'note', 'moodle-block_navigation');
 
675
                // If this block can dock tell the dock to resize if required and check
 
676
                // the width on the dock panel in case it is presently in use.
 
677
                if (this.get('tree').get('candock') && M.core.dock.notifyBlockChange) {
 
678
                    M.core.dock.notifyBlockChange(this.get('tree').id);
 
679
                }
492
680
                return true;
493
681
            }
494
 
        } catch (ex) {
495
 
            // If we got here then there was an error parsing the result
 
682
            Y.log('AJAX loading complete but there were no children.', 'note', 'moodle-block_navigation');
 
683
        } catch (error) {
 
684
            if (outcome && outcome.status && outcome.status > 0) {
 
685
                // If we got here then there was an error parsing the result.
 
686
                Y.log('Error parsing AJAX response or adding branches to the navigation tree', 'error', 'moodle-block_navigation');
 
687
                Y.use('moodle-core-notification-exception', function () {
 
688
                    return new M.core.exception(error).show();
 
689
                });
 
690
            }
 
691
 
 
692
            return false;
496
693
        }
497
694
        // The branch is empty so class it accordingly
498
695
        this.node.replaceClass('branch', 'emptybranch');
501
698
    /**
502
699
     * Turns the branch object passed to the method into a proper branch object
503
700
     * and then adds it as a child of this branch.
 
701
     *
 
702
     * @method addChild
 
703
     * @param {Object} branchobj
 
704
     * @return Boolean
504
705
     */
505
706
    addChild : function(branchobj) {
506
707
        // Make the new branch into an object
528
729
 
529
730
    /**
530
731
     * Add a link to view all courses in a category
 
732
     *
 
733
     * @method addViewAllCoursesChild
 
734
     * @param {BRANCH} branch
531
735
     */
532
736
    addViewAllCoursesChild: function(branch) {
533
737
        var url = null;
552
756
Y.extend(BRANCH, Y.Base, BRANCH.prototype, {
553
757
    NAME : 'navigation-branch',
554
758
    ATTRS : {
 
759
        /**
 
760
         * The Tree this branch belongs to.
 
761
         * @attribute tree
 
762
         * @type TREE
 
763
         * @required
 
764
         * @writeOnce
 
765
         */
555
766
        tree : {
 
767
            writeOnce : 'initOnly',
556
768
            validator : Y.Lang.isObject
557
769
        },
 
770
        /**
 
771
         * The name of this branch.
 
772
         * @attribute name
 
773
         * @type String
 
774
         */
558
775
        name : {
559
776
            value : '',
560
777
            validator : Y.Lang.isString,
562
779
                return val.replace(/\n/g, '<br />');
563
780
            }
564
781
        },
 
782
        /**
 
783
         * The title to use for this branch.
 
784
         * @attribute title
 
785
         * @type String
 
786
         */
565
787
        title : {
566
788
            value : '',
567
789
            validator : Y.Lang.isString
568
790
        },
 
791
        /**
 
792
         * The ID of this branch.
 
793
         * The ID and Type should always form a unique pair.
 
794
         * @attribute id
 
795
         * @type String
 
796
         */
569
797
        id : {
570
798
            value : '',
571
799
            validator : Y.Lang.isString,
577
805
                return val;
578
806
            }
579
807
        },
 
808
        /**
 
809
         * The key used to identify this branch easily if there is one.
 
810
         * @attribute key
 
811
         * @type String
 
812
         */
580
813
        key : {
581
814
            value : null
582
815
        },
 
816
        /**
 
817
         * The type of this branch.
 
818
         * @attribute type
 
819
         * @type Int
 
820
         */
583
821
        type : {
584
 
            value : null
 
822
            value : null,
 
823
            setter : function(value) {
 
824
                return parseInt(value, 10);
 
825
            }
585
826
        },
 
827
        /**
 
828
         * The link to use for this branch.
 
829
         * @attribute link
 
830
         * @type String
 
831
         */
586
832
        link : {
587
833
            value : false
588
834
        },
 
835
        /**
 
836
         * The Icon to add when displaying this branch.
 
837
         * @attribute icon
 
838
         * @type Object
 
839
         */
589
840
        icon : {
590
841
            value : false,
591
842
            validator : Y.Lang.isObject
592
843
        },
 
844
        /**
 
845
         * True if this branch is expandable.
 
846
         * @attribute expandable
 
847
         * @type Boolean
 
848
         */
593
849
        expandable : {
594
850
            value : false,
595
851
            validator : Y.Lang.isBool
596
852
        },
 
853
        /**
 
854
         * True if this branch is hidden and should be displayed greyed out.
 
855
         * @attribute hidden
 
856
         * @type Boolean
 
857
         */
597
858
        hidden : {
598
859
            value : false,
599
860
            validator : Y.Lang.isBool
600
861
        },
 
862
        /**
 
863
         * True if this branch has any children.
 
864
         * @attribute haschildren
 
865
         * @type Boolean
 
866
         */
601
867
        haschildren : {
602
868
            value : false,
603
869
            validator : Y.Lang.isBool
604
870
        },
 
871
        /**
 
872
         * An array of other branches that appear as children of this branch.
 
873
         * @attribute children
 
874
         * @type Array
 
875
         */
605
876
        children : {
606
877
            value : [],
607
878
            validator : Y.Lang.isArray
609
880
    }
610
881
});
611
882
 
612
 
/**
613
 
 * This namespace will contain all of the contents of the navigation blocks
614
 
 * global navigation and settings.
615
 
 * @namespace
616
 
 */
617
 
M.block_navigation = M.block_navigation || {
618
 
    /** The number of expandable branches in existence */
619
 
    expandablebranchcount:1,
620
 
    courselimit : 20,
621
 
    instance : null,
622
 
    /**
623
 
     * Add new instance of navigation tree to tree collection
624
 
     */
625
 
    init_add_tree:function(properties) {
626
 
        if (properties.courselimit) {
627
 
            this.courselimit = properties.courselimit;
628
 
        }
629
 
        if (M.core_dock) {
630
 
            M.core_dock.init(Y);
631
 
        }
632
 
        new TREE(properties);
633
 
    }
634
 
};
635
 
 
636
 
 
637
 
}, '@VERSION@', {
638
 
    "requires": [
639
 
        "base",
640
 
        "core_dock",
641
 
        "io-base",
642
 
        "node",
643
 
        "dom",
644
 
        "event-custom",
645
 
        "event-delegate",
646
 
        "json-parse"
647
 
    ]
648
 
});
 
883
 
 
884
}, '@VERSION@', {"requires": ["base", "io-base", "node", "event-synthetic", "event-delegate", "json-parse"]});