Subversion Repositories eFlore/Applications.cel

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2108 mathias 1
/*
2
 * Ext JS Library 2.0.2
3
 * Copyright(c) 2006-2008, Ext JS, LLC.
4
 * licensing@extjs.com
5
 *
6
 * http://extjs.com/license
7
 */
8
 
9
 
10
Ext.DomHelper = function(){
11
    var tempTableEl = null;
12
    var emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;
13
    var tableRe = /^table|tbody|tr|td$/i;
14
 
15
 
16
    var createHtml = function(o){
17
        if(typeof o == 'string'){
18
            return o;
19
        }
20
        var b = "";
21
        if (Ext.isArray(o)) {
22
            for (var i = 0, l = o.length; i < l; i++) {
23
                b += createHtml(o[i]);
24
            }
25
            return b;
26
        }
27
        if(!o.tag){
28
            o.tag = "div";
29
        }
30
        b += "<" + o.tag;
31
        for(var attr in o){
32
            if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || typeof o[attr] == "function") continue;
33
            if(attr == "style"){
34
                var s = o["style"];
35
                if(typeof s == "function"){
36
                    s = s.call();
37
                }
38
                if(typeof s == "string"){
39
                    b += ' style="' + s + '"';
40
                }else if(typeof s == "object"){
41
                    b += ' style="';
42
                    for(var key in s){
43
                        if(typeof s[key] != "function"){
44
                            b += key + ":" + s[key] + ";";
45
                        }
46
                    }
47
                    b += '"';
48
                }
49
            }else{
50
                if(attr == "cls"){
51
                    b += ' class="' + o["cls"] + '"';
52
                }else if(attr == "htmlFor"){
53
                    b += ' for="' + o["htmlFor"] + '"';
54
                }else{
55
                    b += " " + attr + '="' + o[attr] + '"';
56
                }
57
            }
58
        }
59
        if(emptyTags.test(o.tag)){
60
            b += "/>";
61
        }else{
62
            b += ">";
63
            var cn = o.children || o.cn;
64
            if(cn){
65
                b += createHtml(cn);
66
            } else if(o.html){
67
                b += o.html;
68
            }
69
            b += "</" + o.tag + ">";
70
        }
71
        return b;
72
    };
73
 
74
 
75
 
76
    var createDom = function(o, parentNode){
77
        var el;
78
        if (Ext.isArray(o)) {
79
            el = document.createDocumentFragment();
80
            for(var i = 0, l = o.length; i < l; i++) {
81
                createDom(o[i], el);
82
            }
83
        } else if (typeof o == "string)") {
84
            el = document.createTextNode(o);
85
        } else {
86
            el = document.createElement(o.tag||'div');
87
            var useSet = !!el.setAttribute;
88
            for(var attr in o){
89
                if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || attr == "style" || typeof o[attr] == "function") continue;
90
                if(attr=="cls"){
91
                    el.className = o["cls"];
92
                }else{
93
                    if(useSet) el.setAttribute(attr, o[attr]);
94
                    else el[attr] = o[attr];
95
                }
96
            }
97
            Ext.DomHelper.applyStyles(el, o.style);
98
            var cn = o.children || o.cn;
99
            if(cn){
100
                createDom(cn, el);
101
            } else if(o.html){
102
                el.innerHTML = o.html;
103
            }
104
        }
105
        if(parentNode){
106
           parentNode.appendChild(el);
107
        }
108
        return el;
109
    };
110
 
111
    var ieTable = function(depth, s, h, e){
112
        tempTableEl.innerHTML = [s, h, e].join('');
113
        var i = -1, el = tempTableEl;
114
        while(++i < depth){
115
            el = el.firstChild;
116
        }
117
        return el;
118
    };
119
 
120
 
121
    var ts = '<table>',
122
        te = '</table>',
123
        tbs = ts+'<tbody>',
124
        tbe = '</tbody>'+te,
125
        trs = tbs + '<tr>',
126
        tre = '</tr>'+tbe;
127
 
128
 
129
    var insertIntoTable = function(tag, where, el, html){
130
        if(!tempTableEl){
131
            tempTableEl = document.createElement('div');
132
        }
133
        var node;
134
        var before = null;
135
        if(tag == 'td'){
136
            if(where == 'afterbegin' || where == 'beforeend'){
137
                return;
138
            }
139
            if(where == 'beforebegin'){
140
                before = el;
141
                el = el.parentNode;
142
            } else{
143
                before = el.nextSibling;
144
                el = el.parentNode;
145
            }
146
            node = ieTable(4, trs, html, tre);
147
        }
148
        else if(tag == 'tr'){
149
            if(where == 'beforebegin'){
150
                before = el;
151
                el = el.parentNode;
152
                node = ieTable(3, tbs, html, tbe);
153
            } else if(where == 'afterend'){
154
                before = el.nextSibling;
155
                el = el.parentNode;
156
                node = ieTable(3, tbs, html, tbe);
157
            } else{
158
                if(where == 'afterbegin'){
159
                    before = el.firstChild;
160
                }
161
                node = ieTable(4, trs, html, tre);
162
            }
163
        } else if(tag == 'tbody'){
164
            if(where == 'beforebegin'){
165
                before = el;
166
                el = el.parentNode;
167
                node = ieTable(2, ts, html, te);
168
            } else if(where == 'afterend'){
169
                before = el.nextSibling;
170
                el = el.parentNode;
171
                node = ieTable(2, ts, html, te);
172
            } else{
173
                if(where == 'afterbegin'){
174
                    before = el.firstChild;
175
                }
176
                node = ieTable(3, tbs, html, tbe);
177
            }
178
        } else{
179
            if(where == 'beforebegin' || where == 'afterend'){
180
                return;
181
            }
182
            if(where == 'afterbegin'){
183
                before = el.firstChild;
184
            }
185
            node = ieTable(2, ts, html, te);
186
        }
187
        el.insertBefore(node, before);
188
        return node;
189
    };
190
 
191
 
192
    return {
193
 
194
    useDom : false,
195
 
196
 
197
    markup : function(o){
198
        return createHtml(o);
199
    },
200
 
201
 
202
    applyStyles : function(el, styles){
203
        if(styles){
204
           el = Ext.fly(el);
205
           if(typeof styles == "string"){
206
               var re = /\s?([a-z\-]*)\:\s?([^;]*);?/gi;
207
               var matches;
208
               while ((matches = re.exec(styles)) != null){
209
                   el.setStyle(matches[1], matches[2]);
210
               }
211
           }else if (typeof styles == "object"){
212
               for (var style in styles){
213
                  el.setStyle(style, styles[style]);
214
               }
215
           }else if (typeof styles == "function"){
216
                Ext.DomHelper.applyStyles(el, styles.call());
217
           }
218
        }
219
    },
220
 
221
 
222
    insertHtml : function(where, el, html){
223
        where = where.toLowerCase();
224
        if(el.insertAdjacentHTML){
225
            if(tableRe.test(el.tagName)){
226
                var rs;
227
                if(rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html)){
228
                    return rs;
229
                }
230
            }
231
            switch(where){
232
                case "beforebegin":
233
                    el.insertAdjacentHTML('BeforeBegin', html);
234
                    return el.previousSibling;
235
                case "afterbegin":
236
                    el.insertAdjacentHTML('AfterBegin', html);
237
                    return el.firstChild;
238
                case "beforeend":
239
                    el.insertAdjacentHTML('BeforeEnd', html);
240
                    return el.lastChild;
241
                case "afterend":
242
                    el.insertAdjacentHTML('AfterEnd', html);
243
                    return el.nextSibling;
244
            }
245
            throw 'Illegal insertion point -> "' + where + '"';
246
        }
247
        var range = el.ownerDocument.createRange();
248
        var frag;
249
        switch(where){
250
             case "beforebegin":
251
                range.setStartBefore(el);
252
                frag = range.createContextualFragment(html);
253
                el.parentNode.insertBefore(frag, el);
254
                return el.previousSibling;
255
             case "afterbegin":
256
                if(el.firstChild){
257
                    range.setStartBefore(el.firstChild);
258
                    frag = range.createContextualFragment(html);
259
                    el.insertBefore(frag, el.firstChild);
260
                    return el.firstChild;
261
                }else{
262
                    el.innerHTML = html;
263
                    return el.firstChild;
264
                }
265
            case "beforeend":
266
                if(el.lastChild){
267
                    range.setStartAfter(el.lastChild);
268
                    frag = range.createContextualFragment(html);
269
                    el.appendChild(frag);
270
                    return el.lastChild;
271
                }else{
272
                    el.innerHTML = html;
273
                    return el.lastChild;
274
                }
275
            case "afterend":
276
                range.setStartAfter(el);
277
                frag = range.createContextualFragment(html);
278
                el.parentNode.insertBefore(frag, el.nextSibling);
279
                return el.nextSibling;
280
            }
281
            throw 'Illegal insertion point -> "' + where + '"';
282
    },
283
 
284
 
285
    insertBefore : function(el, o, returnElement){
286
        return this.doInsert(el, o, returnElement, "beforeBegin");
287
    },
288
 
289
 
290
    insertAfter : function(el, o, returnElement){
291
        return this.doInsert(el, o, returnElement, "afterEnd", "nextSibling");
292
    },
293
 
294
 
295
    insertFirst : function(el, o, returnElement){
296
        return this.doInsert(el, o, returnElement, "afterBegin", "firstChild");
297
    },
298
 
299
 
300
    doInsert : function(el, o, returnElement, pos, sibling){
301
        el = Ext.getDom(el);
302
        var newNode;
303
        if(this.useDom){
304
            newNode = createDom(o, null);
305
            (sibling === "firstChild" ? el : el.parentNode).insertBefore(newNode, sibling ? el[sibling] : el);
306
        }else{
307
            var html = createHtml(o);
308
            newNode = this.insertHtml(pos, el, html);
309
        }
310
        return returnElement ? Ext.get(newNode, true) : newNode;
311
    },
312
 
313
 
314
    append : function(el, o, returnElement){
315
        el = Ext.getDom(el);
316
        var newNode;
317
        if(this.useDom){
318
            newNode = createDom(o, null);
319
            el.appendChild(newNode);
320
        }else{
321
            var html = createHtml(o);
322
            newNode = this.insertHtml("beforeEnd", el, html);
323
        }
324
        return returnElement ? Ext.get(newNode, true) : newNode;
325
    },
326
 
327
 
328
    overwrite : function(el, o, returnElement){
329
        el = Ext.getDom(el);
330
        el.innerHTML = createHtml(o);
331
        return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
332
    },
333
 
334
 
335
    createTemplate : function(o){
336
        var html = createHtml(o);
337
        return new Ext.Template(html);
338
    }
339
    };
340
}();
341
 
342
 
343
Ext.Template = function(html){
344
    var a = arguments;
345
    if(Ext.isArray(html)){
346
        html = html.join("");
347
    }else if(a.length > 1){
348
        var buf = [];
349
        for(var i = 0, len = a.length; i < len; i++){
350
            if(typeof a[i] == 'object'){
351
                Ext.apply(this, a[i]);
352
            }else{
353
                buf[buf.length] = a[i];
354
            }
355
        }
356
        html = buf.join('');
357
    }
358
 
359
    this.html = html;
360
    if(this.compiled){
361
        this.compile();
362
    }
363
};
364
Ext.Template.prototype = {
365
 
366
    applyTemplate : function(values){
367
        if(this.compiled){
368
            return this.compiled(values);
369
        }
370
        var useF = this.disableFormats !== true;
371
        var fm = Ext.util.Format, tpl = this;
372
        var fn = function(m, name, format, args){
373
            if(format && useF){
374
                if(format.substr(0, 5) == "this."){
375
                    return tpl.call(format.substr(5), values[name], values);
376
                }else{
377
                    if(args){
378
 
379
 
380
 
381
                        var re = /^\s*['"](.*)["']\s*$/;
382
                        args = args.split(',');
383
                        for(var i = 0, len = args.length; i < len; i++){
384
                            args[i] = args[i].replace(re, "$1");
385
                        }
386
                        args = [values[name]].concat(args);
387
                    }else{
388
                        args = [values[name]];
389
                    }
390
                    return fm[format].apply(fm, args);
391
                }
392
            }else{
393
                return values[name] !== undefined ? values[name] : "";
394
            }
395
        };
396
        return this.html.replace(this.re, fn);
397
    },
398
 
399
 
400
    set : function(html, compile){
401
        this.html = html;
402
        this.compiled = null;
403
        if(compile){
404
            this.compile();
405
        }
406
        return this;
407
    },
408
 
409
 
410
    disableFormats : false,
411
 
412
 
413
    re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
414
 
415
 
416
    compile : function(){
417
        var fm = Ext.util.Format;
418
        var useF = this.disableFormats !== true;
419
        var sep = Ext.isGecko ? "+" : ",";
420
        var fn = function(m, name, format, args){
421
            if(format && useF){
422
                args = args ? ',' + args : "";
423
                if(format.substr(0, 5) != "this."){
424
                    format = "fm." + format + '(';
425
                }else{
426
                    format = 'this.call("'+ format.substr(5) + '", ';
427
                    args = ", values";
428
                }
429
            }else{
430
                args= ''; format = "(values['" + name + "'] == undefined ? '' : ";
431
            }
432
            return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";
433
        };
434
        var body;
435
 
436
        if(Ext.isGecko){
437
            body = "this.compiled = function(values){ return '" +
438
                   this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
439
                    "';};";
440
        }else{
441
            body = ["this.compiled = function(values){ return ['"];
442
            body.push(this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));
443
            body.push("'].join('');};");
444
            body = body.join('');
445
        }
446
        eval(body);
447
        return this;
448
    },
449
 
450
 
451
    call : function(fnName, value, allValues){
452
        return this[fnName](value, allValues);
453
    },
454
 
455
 
456
    insertFirst: function(el, values, returnElement){
457
        return this.doInsert('afterBegin', el, values, returnElement);
458
    },
459
 
460
 
461
    insertBefore: function(el, values, returnElement){
462
        return this.doInsert('beforeBegin', el, values, returnElement);
463
    },
464
 
465
 
466
    insertAfter : function(el, values, returnElement){
467
        return this.doInsert('afterEnd', el, values, returnElement);
468
    },
469
 
470
 
471
    append : function(el, values, returnElement){
472
        return this.doInsert('beforeEnd', el, values, returnElement);
473
    },
474
 
475
    doInsert : function(where, el, values, returnEl){
476
        el = Ext.getDom(el);
477
        var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values));
478
        return returnEl ? Ext.get(newNode, true) : newNode;
479
    },
480
 
481
 
482
    overwrite : function(el, values, returnElement){
483
        el = Ext.getDom(el);
484
        el.innerHTML = this.applyTemplate(values);
485
        return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
486
    }
487
};
488
 
489
Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
490
 
491
 
492
Ext.DomHelper.Template = Ext.Template;
493
 
494
 
495
Ext.Template.from = function(el, config){
496
    el = Ext.getDom(el);
497
    return new Ext.Template(el.value || el.innerHTML, config || '');
498
};
499
 
500
 
501
Ext.DomQuery = function(){
502
    var cache = {}, simpleCache = {}, valueCache = {};
503
    var nonSpace = /\S/;
504
    var trimRe = /^\s+|\s+$/g;
505
    var tplRe = /\{(\d+)\}/g;
506
    var modeRe = /^(\s?[\/>+~]\s?|\s|$)/;
507
    var tagTokenRe = /^(#)?([\w-\*]+)/;
508
    var nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/;
509
 
510
    function child(p, index){
511
        var i = 0;
512
        var n = p.firstChild;
513
        while(n){
514
            if(n.nodeType == 1){
515
               if(++i == index){
516
                   return n;
517
               }
518
            }
519
            n = n.nextSibling;
520
        }
521
        return null;
522
    };
523
 
524
    function next(n){
525
        while((n = n.nextSibling) && n.nodeType != 1);
526
        return n;
527
    };
528
 
529
    function prev(n){
530
        while((n = n.previousSibling) && n.nodeType != 1);
531
        return n;
532
    };
533
 
534
    function children(d){
535
        var n = d.firstChild, ni = -1;
536
 	    while(n){
537
 	        var nx = n.nextSibling;
538
 	        if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
539
 	            d.removeChild(n);
540
 	        }else{
541
 	            n.nodeIndex = ++ni;
542
 	        }
543
 	        n = nx;
544
 	    }
545
 	    return this;
546
 	};
547
 
548
    function byClassName(c, a, v){
549
        if(!v){
550
            return c;
551
        }
552
        var r = [], ri = -1, cn;
553
        for(var i = 0, ci; ci = c[i]; i++){
554
            if((' '+ci.className+' ').indexOf(v) != -1){
555
                r[++ri] = ci;
556
            }
557
        }
558
        return r;
559
    };
560
 
561
    function attrValue(n, attr){
562
        if(!n.tagName && typeof n.length != "undefined"){
563
            n = n[0];
564
        }
565
        if(!n){
566
            return null;
567
        }
568
        if(attr == "for"){
569
            return n.htmlFor;
570
        }
571
        if(attr == "class" || attr == "className"){
572
            return n.className;
573
        }
574
        return n.getAttribute(attr) || n[attr];
575
 
576
    };
577
 
578
    function getNodes(ns, mode, tagName){
579
        var result = [], ri = -1, cs;
580
        if(!ns){
581
            return result;
582
        }
583
        tagName = tagName || "*";
584
        if(typeof ns.getElementsByTagName != "undefined"){
585
            ns = [ns];
586
        }
587
        if(!mode){
588
            for(var i = 0, ni; ni = ns[i]; i++){
589
                cs = ni.getElementsByTagName(tagName);
590
                for(var j = 0, ci; ci = cs[j]; j++){
591
                    result[++ri] = ci;
592
                }
593
            }
594
        }else if(mode == "/" || mode == ">"){
595
            var utag = tagName.toUpperCase();
596
            for(var i = 0, ni, cn; ni = ns[i]; i++){
597
                cn = ni.children || ni.childNodes;
598
                for(var j = 0, cj; cj = cn[j]; j++){
599
                    if(cj.nodeName == utag || cj.nodeName == tagName  || tagName == '*'){
600
                        result[++ri] = cj;
601
                    }
602
                }
603
            }
604
        }else if(mode == "+"){
605
            var utag = tagName.toUpperCase();
606
            for(var i = 0, n; n = ns[i]; i++){
607
                while((n = n.nextSibling) && n.nodeType != 1);
608
                if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
609
                    result[++ri] = n;
610
                }
611
            }
612
        }else if(mode == "~"){
613
            for(var i = 0, n; n = ns[i]; i++){
614
                while((n = n.nextSibling) && (n.nodeType != 1 || (tagName == '*' || n.tagName.toLowerCase()!=tagName)));
615
                if(n){
616
                    result[++ri] = n;
617
                }
618
            }
619
        }
620
        return result;
621
    };
622
 
623
    function concat(a, b){
624
        if(b.slice){
625
            return a.concat(b);
626
        }
627
        for(var i = 0, l = b.length; i < l; i++){
628
            a[a.length] = b[i];
629
        }
630
        return a;
631
    }
632
 
633
    function byTag(cs, tagName){
634
        if(cs.tagName || cs == document){
635
            cs = [cs];
636
        }
637
        if(!tagName){
638
            return cs;
639
        }
640
        var r = [], ri = -1;
641
        tagName = tagName.toLowerCase();
642
        for(var i = 0, ci; ci = cs[i]; i++){
643
            if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){
644
                r[++ri] = ci;
645
            }
646
        }
647
        return r;
648
    };
649
 
650
    function byId(cs, attr, id){
651
        if(cs.tagName || cs == document){
652
            cs = [cs];
653
        }
654
        if(!id){
655
            return cs;
656
        }
657
        var r = [], ri = -1;
658
        for(var i = 0,ci; ci = cs[i]; i++){
659
            if(ci && ci.id == id){
660
                r[++ri] = ci;
661
                return r;
662
            }
663
        }
664
        return r;
665
    };
666
 
667
    function byAttribute(cs, attr, value, op, custom){
668
        var r = [], ri = -1, st = custom=="{";
669
        var f = Ext.DomQuery.operators[op];
670
        for(var i = 0, ci; ci = cs[i]; i++){
671
            var a;
672
            if(st){
673
                a = Ext.DomQuery.getStyle(ci, attr);
674
            }
675
            else if(attr == "class" || attr == "className"){
676
                a = ci.className;
677
            }else if(attr == "for"){
678
                a = ci.htmlFor;
679
            }else if(attr == "href"){
680
                a = ci.getAttribute("href", 2);
681
            }else{
682
                a = ci.getAttribute(attr);
683
            }
684
            if((f && f(a, value)) || (!f && a)){
685
                r[++ri] = ci;
686
            }
687
        }
688
        return r;
689
    };
690
 
691
    function byPseudo(cs, name, value){
692
        return Ext.DomQuery.pseudos[name](cs, value);
693
    };
694
 
695
 
696
 
697
 
698
    var isIE = window.ActiveXObject ? true : false;
699
 
700
 
701
 
702
    eval("var batch = 30803;");
703
 
704
    var key = 30803;
705
 
706
    function nodupIEXml(cs){
707
        var d = ++key;
708
        cs[0].setAttribute("_nodup", d);
709
        var r = [cs[0]];
710
        for(var i = 1, len = cs.length; i < len; i++){
711
            var c = cs[i];
712
            if(!c.getAttribute("_nodup") != d){
713
                c.setAttribute("_nodup", d);
714
                r[r.length] = c;
715
            }
716
        }
717
        for(var i = 0, len = cs.length; i < len; i++){
718
            cs[i].removeAttribute("_nodup");
719
        }
720
        return r;
721
    }
722
 
723
    function nodup(cs){
724
        if(!cs){
725
            return [];
726
        }
727
        var len = cs.length, c, i, r = cs, cj, ri = -1;
728
        if(!len || typeof cs.nodeType != "undefined" || len == 1){
729
            return cs;
730
        }
731
        if(isIE && typeof cs[0].selectSingleNode != "undefined"){
732
            return nodupIEXml(cs);
733
        }
734
        var d = ++key;
735
        cs[0]._nodup = d;
736
        for(i = 1; c = cs[i]; i++){
737
            if(c._nodup != d){
738
                c._nodup = d;
739
            }else{
740
                r = [];
741
                for(var j = 0; j < i; j++){
742
                    r[++ri] = cs[j];
743
                }
744
                for(j = i+1; cj = cs[j]; j++){
745
                    if(cj._nodup != d){
746
                        cj._nodup = d;
747
                        r[++ri] = cj;
748
                    }
749
                }
750
                return r;
751
            }
752
        }
753
        return r;
754
    }
755
 
756
    function quickDiffIEXml(c1, c2){
757
        var d = ++key;
758
        for(var i = 0, len = c1.length; i < len; i++){
759
            c1[i].setAttribute("_qdiff", d);
760
        }
761
        var r = [];
762
        for(var i = 0, len = c2.length; i < len; i++){
763
            if(c2[i].getAttribute("_qdiff") != d){
764
                r[r.length] = c2[i];
765
            }
766
        }
767
        for(var i = 0, len = c1.length; i < len; i++){
768
           c1[i].removeAttribute("_qdiff");
769
        }
770
        return r;
771
    }
772
 
773
    function quickDiff(c1, c2){
774
        var len1 = c1.length;
775
        if(!len1){
776
            return c2;
777
        }
778
        if(isIE && c1[0].selectSingleNode){
779
            return quickDiffIEXml(c1, c2);
780
        }
781
        var d = ++key;
782
        for(var i = 0; i < len1; i++){
783
            c1[i]._qdiff = d;
784
        }
785
        var r = [];
786
        for(var i = 0, len = c2.length; i < len; i++){
787
            if(c2[i]._qdiff != d){
788
                r[r.length] = c2[i];
789
            }
790
        }
791
        return r;
792
    }
793
 
794
    function quickId(ns, mode, root, id){
795
        if(ns == root){
796
           var d = root.ownerDocument || root;
797
           return d.getElementById(id);
798
        }
799
        ns = getNodes(ns, mode, "*");
800
        return byId(ns, null, id);
801
    }
802
 
803
    return {
804
        getStyle : function(el, name){
805
            return Ext.fly(el).getStyle(name);
806
        },
807
 
808
        compile : function(path, type){
809
            type = type || "select";
810
 
811
            var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];
812
            var q = path, mode, lq;
813
            var tk = Ext.DomQuery.matchers;
814
            var tklen = tk.length;
815
            var mm;
816
 
817
 
818
            var lmode = q.match(modeRe);
819
            if(lmode && lmode[1]){
820
                fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
821
                q = q.replace(lmode[1], "");
822
            }
823
 
824
            while(path.substr(0, 1)=="/"){
825
                path = path.substr(1);
826
            }
827
 
828
            while(q && lq != q){
829
                lq = q;
830
                var tm = q.match(tagTokenRe);
831
                if(type == "select"){
832
                    if(tm){
833
                        if(tm[1] == "#"){
834
                            fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");';
835
                        }else{
836
                            fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");';
837
                        }
838
                        q = q.replace(tm[0], "");
839
                    }else if(q.substr(0, 1) != '@'){
840
                        fn[fn.length] = 'n = getNodes(n, mode, "*");';
841
                    }
842
                }else{
843
                    if(tm){
844
                        if(tm[1] == "#"){
845
                            fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");';
846
                        }else{
847
                            fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");';
848
                        }
849
                        q = q.replace(tm[0], "");
850
                    }
851
                }
852
                while(!(mm = q.match(modeRe))){
853
                    var matched = false;
854
                    for(var j = 0; j < tklen; j++){
855
                        var t = tk[j];
856
                        var m = q.match(t.re);
857
                        if(m){
858
                            fn[fn.length] = t.select.replace(tplRe, function(x, i){
859
                                                    return m[i];
860
                                                });
861
                            q = q.replace(m[0], "");
862
                            matched = true;
863
                            break;
864
                        }
865
                    }
866
 
867
                    if(!matched){
868
                        throw 'Error parsing selector, parsing failed at "' + q + '"';
869
                    }
870
                }
871
                if(mm[1]){
872
                    fn[fn.length] = 'mode="'+mm[1].replace(trimRe, "")+'";';
873
                    q = q.replace(mm[1], "");
874
                }
875
            }
876
            fn[fn.length] = "return nodup(n);\n}";
877
            eval(fn.join(""));
878
            return f;
879
        },
880
 
881
 
882
        select : function(path, root, type){
883
            if(!root || root == document){
884
                root = document;
885
            }
886
            if(typeof root == "string"){
887
                root = document.getElementById(root);
888
            }
889
            var paths = path.split(",");
890
            var results = [];
891
            for(var i = 0, len = paths.length; i < len; i++){
892
                var p = paths[i].replace(trimRe, "");
893
                if(!cache[p]){
894
                    cache[p] = Ext.DomQuery.compile(p);
895
                    if(!cache[p]){
896
                        throw p + " is not a valid selector";
897
                    }
898
                }
899
                var result = cache[p](root);
900
                if(result && result != document){
901
                    results = results.concat(result);
902
                }
903
            }
904
            if(paths.length > 1){
905
                return nodup(results);
906
            }
907
            return results;
908
        },
909
 
910
 
911
        selectNode : function(path, root){
912
            return Ext.DomQuery.select(path, root)[0];
913
        },
914
 
915
 
916
        selectValue : function(path, root, defaultValue){
917
            path = path.replace(trimRe, "");
918
            if(!valueCache[path]){
919
                valueCache[path] = Ext.DomQuery.compile(path, "select");
920
            }
921
            var n = valueCache[path](root);
922
            n = n[0] ? n[0] : n;
923
            var v = (n && n.firstChild ? n.firstChild.nodeValue : null);
924
            return ((v === null||v === undefined||v==='') ? defaultValue : v);
925
        },
926
 
927
 
928
        selectNumber : function(path, root, defaultValue){
929
            var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
930
            return parseFloat(v);
931
        },
932
 
933
 
934
        is : function(el, ss){
935
            if(typeof el == "string"){
936
                el = document.getElementById(el);
937
            }
938
            var isArray = Ext.isArray(el);
939
            var result = Ext.DomQuery.filter(isArray ? el : [el], ss);
940
            return isArray ? (result.length == el.length) : (result.length > 0);
941
        },
942
 
943
 
944
        filter : function(els, ss, nonMatches){
945
            ss = ss.replace(trimRe, "");
946
            if(!simpleCache[ss]){
947
                simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
948
            }
949
            var result = simpleCache[ss](els);
950
            return nonMatches ? quickDiff(result, els) : result;
951
        },
952
 
953
 
954
        matchers : [{
955
                re: /^\.([\w-]+)/,
956
                select: 'n = byClassName(n, null, " {1} ");'
957
            }, {
958
                re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
959
                select: 'n = byPseudo(n, "{1}", "{2}");'
960
            },{
961
                re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
962
                select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
963
            }, {
964
                re: /^#([\w-]+)/,
965
                select: 'n = byId(n, null, "{1}");'
966
            },{
967
                re: /^@([\w-]+)/,
968
                select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
969
            }
970
        ],
971
 
972
 
973
        operators : {
974
            "=" : function(a, v){
975
                return a == v;
976
            },
977
            "!=" : function(a, v){
978
                return a != v;
979
            },
980
            "^=" : function(a, v){
981
                return a && a.substr(0, v.length) == v;
982
            },
983
            "$=" : function(a, v){
984
                return a && a.substr(a.length-v.length) == v;
985
            },
986
            "*=" : function(a, v){
987
                return a && a.indexOf(v) !== -1;
988
            },
989
            "%=" : function(a, v){
990
                return (a % v) == 0;
991
            },
992
            "|=" : function(a, v){
993
                return a && (a == v || a.substr(0, v.length+1) == v+'-');
994
            },
995
            "~=" : function(a, v){
996
                return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
997
            }
998
        },
999
 
1000
 
1001
        pseudos : {
1002
            "first-child" : function(c){
1003
                var r = [], ri = -1, n;
1004
                for(var i = 0, ci; ci = n = c[i]; i++){
1005
                    while((n = n.previousSibling) && n.nodeType != 1);
1006
                    if(!n){
1007
                        r[++ri] = ci;
1008
                    }
1009
                }
1010
                return r;
1011
            },
1012
 
1013
            "last-child" : function(c){
1014
                var r = [], ri = -1, n;
1015
                for(var i = 0, ci; ci = n = c[i]; i++){
1016
                    while((n = n.nextSibling) && n.nodeType != 1);
1017
                    if(!n){
1018
                        r[++ri] = ci;
1019
                    }
1020
                }
1021
                return r;
1022
            },
1023
 
1024
            "nth-child" : function(c, a) {
1025
                var r = [], ri = -1;
1026
                var m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a);
1027
                var f = (m[1] || 1) - 0, l = m[2] - 0;
1028
                for(var i = 0, n; n = c[i]; i++){
1029
                    var pn = n.parentNode;
1030
                    if (batch != pn._batch) {
1031
                        var j = 0;
1032
                        for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
1033
                            if(cn.nodeType == 1){
1034
                               cn.nodeIndex = ++j;
1035
                            }
1036
                        }
1037
                        pn._batch = batch;
1038
                    }
1039
                    if (f == 1) {
1040
                        if (l == 0 || n.nodeIndex == l){
1041
                            r[++ri] = n;
1042
                        }
1043
                    } else if ((n.nodeIndex + l) % f == 0){
1044
                        r[++ri] = n;
1045
                    }
1046
                }
1047
 
1048
                return r;
1049
            },
1050
 
1051
            "only-child" : function(c){
1052
                var r = [], ri = -1;;
1053
                for(var i = 0, ci; ci = c[i]; i++){
1054
                    if(!prev(ci) && !next(ci)){
1055
                        r[++ri] = ci;
1056
                    }
1057
                }
1058
                return r;
1059
            },
1060
 
1061
            "empty" : function(c){
1062
                var r = [], ri = -1;
1063
                for(var i = 0, ci; ci = c[i]; i++){
1064
                    var cns = ci.childNodes, j = 0, cn, empty = true;
1065
                    while(cn = cns[j]){
1066
                        ++j;
1067
                        if(cn.nodeType == 1 || cn.nodeType == 3){
1068
                            empty = false;
1069
                            break;
1070
                        }
1071
                    }
1072
                    if(empty){
1073
                        r[++ri] = ci;
1074
                    }
1075
                }
1076
                return r;
1077
            },
1078
 
1079
            "contains" : function(c, v){
1080
                var r = [], ri = -1;
1081
                for(var i = 0, ci; ci = c[i]; i++){
1082
                    if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
1083
                        r[++ri] = ci;
1084
                    }
1085
                }
1086
                return r;
1087
            },
1088
 
1089
            "nodeValue" : function(c, v){
1090
                var r = [], ri = -1;
1091
                for(var i = 0, ci; ci = c[i]; i++){
1092
                    if(ci.firstChild && ci.firstChild.nodeValue == v){
1093
                        r[++ri] = ci;
1094
                    }
1095
                }
1096
                return r;
1097
            },
1098
 
1099
            "checked" : function(c){
1100
                var r = [], ri = -1;
1101
                for(var i = 0, ci; ci = c[i]; i++){
1102
                    if(ci.checked == true){
1103
                        r[++ri] = ci;
1104
                    }
1105
                }
1106
                return r;
1107
            },
1108
 
1109
            "not" : function(c, ss){
1110
                return Ext.DomQuery.filter(c, ss, true);
1111
            },
1112
 
1113
            "any" : function(c, selectors){
1114
                var ss = selectors.split('|');
1115
                var r = [], ri = -1, s;
1116
                for(var i = 0, ci; ci = c[i]; i++){
1117
                    for(var j = 0; s = ss[j]; j++){
1118
                        if(Ext.DomQuery.is(ci, s)){
1119
                            r[++ri] = ci;
1120
                            break;
1121
                        }
1122
                    }
1123
                }
1124
                return r;
1125
            },
1126
 
1127
            "odd" : function(c){
1128
                return this["nth-child"](c, "odd");
1129
            },
1130
 
1131
            "even" : function(c){
1132
                return this["nth-child"](c, "even");
1133
            },
1134
 
1135
            "nth" : function(c, a){
1136
                return c[a-1] || [];
1137
            },
1138
 
1139
            "first" : function(c){
1140
                return c[0] || [];
1141
            },
1142
 
1143
            "last" : function(c){
1144
                return c[c.length-1] || [];
1145
            },
1146
 
1147
            "has" : function(c, ss){
1148
                var s = Ext.DomQuery.select;
1149
                var r = [], ri = -1;
1150
                for(var i = 0, ci; ci = c[i]; i++){
1151
                    if(s(ss, ci).length > 0){
1152
                        r[++ri] = ci;
1153
                    }
1154
                }
1155
                return r;
1156
            },
1157
 
1158
            "next" : function(c, ss){
1159
                var is = Ext.DomQuery.is;
1160
                var r = [], ri = -1;
1161
                for(var i = 0, ci; ci = c[i]; i++){
1162
                    var n = next(ci);
1163
                    if(n && is(n, ss)){
1164
                        r[++ri] = ci;
1165
                    }
1166
                }
1167
                return r;
1168
            },
1169
 
1170
            "prev" : function(c, ss){
1171
                var is = Ext.DomQuery.is;
1172
                var r = [], ri = -1;
1173
                for(var i = 0, ci; ci = c[i]; i++){
1174
                    var n = prev(ci);
1175
                    if(n && is(n, ss)){
1176
                        r[++ri] = ci;
1177
                    }
1178
                }
1179
                return r;
1180
            }
1181
        }
1182
    };
1183
}();
1184
 
1185
 
1186
Ext.query = Ext.DomQuery.select;
1187
 
1188
 
1189
Ext.util.Observable = function(){
1190
 
1191
    if(this.listeners){
1192
        this.on(this.listeners);
1193
        delete this.listeners;
1194
    }
1195
};
1196
Ext.util.Observable.prototype = {
1197
 
1198
    fireEvent : function(){
1199
        if(this.eventsSuspended !== true){
1200
            var ce = this.events[arguments[0].toLowerCase()];
1201
            if(typeof ce == "object"){
1202
                return ce.fire.apply(ce, Array.prototype.slice.call(arguments, 1));
1203
            }
1204
        }
1205
        return true;
1206
    },
1207
 
1208
        filterOptRe : /^(?:scope|delay|buffer|single)$/,
1209
 
1210
 
1211
    addListener : function(eventName, fn, scope, o){
1212
        if(typeof eventName == "object"){
1213
            o = eventName;
1214
            for(var e in o){
1215
                if(this.filterOptRe.test(e)){
1216
                    continue;
1217
                }
1218
                if(typeof o[e] == "function"){
1219
                                        this.addListener(e, o[e], o.scope,  o);
1220
                }else{
1221
                                        this.addListener(e, o[e].fn, o[e].scope, o[e]);
1222
                }
1223
            }
1224
            return;
1225
        }
1226
        o = (!o || typeof o == "boolean") ? {} : o;
1227
        eventName = eventName.toLowerCase();
1228
        var ce = this.events[eventName] || true;
1229
        if(typeof ce == "boolean"){
1230
            ce = new Ext.util.Event(this, eventName);
1231
            this.events[eventName] = ce;
1232
        }
1233
        ce.addListener(fn, scope, o);
1234
    },
1235
 
1236
 
1237
    removeListener : function(eventName, fn, scope){
1238
        var ce = this.events[eventName.toLowerCase()];
1239
        if(typeof ce == "object"){
1240
            ce.removeListener(fn, scope);
1241
        }
1242
    },
1243
 
1244
 
1245
    purgeListeners : function(){
1246
        for(var evt in this.events){
1247
            if(typeof this.events[evt] == "object"){
1248
                 this.events[evt].clearListeners();
1249
            }
1250
        }
1251
    },
1252
 
1253
    relayEvents : function(o, events){
1254
        var createHandler = function(ename){
1255
            return function(){
1256
                return this.fireEvent.apply(this, Ext.combine(ename, Array.prototype.slice.call(arguments, 0)));
1257
            };
1258
        };
1259
        for(var i = 0, len = events.length; i < len; i++){
1260
            var ename = events[i];
1261
            if(!this.events[ename]){ this.events[ename] = true; };
1262
            o.on(ename, createHandler(ename), this);
1263
        }
1264
    },
1265
 
1266
 
1267
    addEvents : function(o){
1268
        if(!this.events){
1269
            this.events = {};
1270
        }
1271
        if(typeof o == 'string'){
1272
            for(var i = 0, a = arguments, v; v = a[i]; i++){
1273
                if(!this.events[a[i]]){
1274
                    o[a[i]] = true;
1275
                }
1276
            }
1277
        }else{
1278
            Ext.applyIf(this.events, o);
1279
        }
1280
    },
1281
 
1282
 
1283
    hasListener : function(eventName){
1284
        var e = this.events[eventName];
1285
        return typeof e == "object" && e.listeners.length > 0;
1286
    },
1287
 
1288
 
1289
    suspendEvents : function(){
1290
        this.eventsSuspended = true;
1291
    },
1292
 
1293
 
1294
    resumeEvents : function(){
1295
        this.eventsSuspended = false;
1296
    },
1297
 
1298
                getMethodEvent : function(method){
1299
        if(!this.methodEvents){
1300
            this.methodEvents = {};
1301
        }
1302
        var e = this.methodEvents[method];
1303
        if(!e){
1304
            e = {};
1305
            this.methodEvents[method] = e;
1306
 
1307
            e.originalFn = this[method];
1308
            e.methodName = method;
1309
            e.before = [];
1310
            e.after = [];
1311
 
1312
 
1313
            var returnValue, v, cancel;
1314
            var obj = this;
1315
 
1316
            var makeCall = function(fn, scope, args){
1317
                if((v = fn.apply(scope || obj, args)) !== undefined){
1318
                    if(typeof v === 'object'){
1319
                        if(v.returnValue !== undefined){
1320
                            returnValue = v.returnValue;
1321
                        }else{
1322
                            returnValue = v;
1323
                        }
1324
                        if(v.cancel === true){
1325
                            cancel = true;
1326
                        }
1327
                    }else if(v === false){
1328
                        cancel = true;
1329
                    }else {
1330
                        returnValue = v;
1331
                    }
1332
                }
1333
            }
1334
 
1335
            this[method] = function(){
1336
                returnValue = v = undefined; cancel = false;
1337
                var args = Array.prototype.slice.call(arguments, 0);
1338
                for(var i = 0, len = e.before.length; i < len; i++){
1339
                    makeCall(e.before[i].fn, e.before[i].scope, args);
1340
                    if(cancel){
1341
                        return returnValue;
1342
                    }
1343
                }
1344
 
1345
                if((v = e.originalFn.apply(obj, args)) !== undefined){
1346
                    returnValue = v;
1347
                }
1348
 
1349
                for(var i = 0, len = e.after.length; i < len; i++){
1350
                    makeCall(e.after[i].fn, e.after[i].scope, args);
1351
                    if(cancel){
1352
                        return returnValue;
1353
                    }
1354
                }
1355
                return returnValue;
1356
            };
1357
        }
1358
        return e;
1359
    },
1360
 
1361
        beforeMethod : function(method, fn, scope){
1362
        var e = this.getMethodEvent(method);
1363
        e.before.push({fn: fn, scope: scope});
1364
    },
1365
 
1366
        afterMethod : function(method, fn, scope){
1367
        var e = this.getMethodEvent(method);
1368
        e.after.push({fn: fn, scope: scope});
1369
    },
1370
 
1371
    removeMethodListener : function(method, fn, scope){
1372
        var e = this.getMethodEvent(method);
1373
        for(var i = 0, len = e.before.length; i < len; i++){
1374
            if(e.before[i].fn == fn && e.before[i].scope == scope){
1375
                e.before.splice(i, 1);
1376
                return;
1377
            }
1378
        }
1379
        for(var i = 0, len = e.after.length; i < len; i++){
1380
            if(e.after[i].fn == fn && e.after[i].scope == scope){
1381
                e.after.splice(i, 1);
1382
                return;
1383
            }
1384
        }
1385
    }
1386
};
1387
 
1388
Ext.util.Observable.prototype.on = Ext.util.Observable.prototype.addListener;
1389
 
1390
Ext.util.Observable.prototype.un = Ext.util.Observable.prototype.removeListener;
1391
 
1392
 
1393
Ext.util.Observable.capture = function(o, fn, scope){
1394
    o.fireEvent = o.fireEvent.createInterceptor(fn, scope);
1395
};
1396
 
1397
 
1398
Ext.util.Observable.releaseCapture = function(o){
1399
    o.fireEvent = Ext.util.Observable.prototype.fireEvent;
1400
};
1401
 
1402
(function(){
1403
 
1404
    var createBuffered = function(h, o, scope){
1405
        var task = new Ext.util.DelayedTask();
1406
        return function(){
1407
            task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));
1408
        };
1409
    };
1410
 
1411
    var createSingle = function(h, e, fn, scope){
1412
        return function(){
1413
            e.removeListener(fn, scope);
1414
            return h.apply(scope, arguments);
1415
        };
1416
    };
1417
 
1418
    var createDelayed = function(h, o, scope){
1419
        return function(){
1420
            var args = Array.prototype.slice.call(arguments, 0);
1421
            setTimeout(function(){
1422
                h.apply(scope, args);
1423
            }, o.delay || 10);
1424
        };
1425
    };
1426
 
1427
    Ext.util.Event = function(obj, name){
1428
        this.name = name;
1429
        this.obj = obj;
1430
        this.listeners = [];
1431
    };
1432
 
1433
    Ext.util.Event.prototype = {
1434
        addListener : function(fn, scope, options){
1435
            scope = scope || this.obj;
1436
            if(!this.isListening(fn, scope)){
1437
                var l = this.createListener(fn, scope, options);
1438
                if(!this.firing){
1439
                    this.listeners.push(l);
1440
                }else{                     this.listeners = this.listeners.slice(0);
1441
                    this.listeners.push(l);
1442
                }
1443
            }
1444
        },
1445
 
1446
        createListener : function(fn, scope, o){
1447
            o = o || {};
1448
            scope = scope || this.obj;
1449
            var l = {fn: fn, scope: scope, options: o};
1450
            var h = fn;
1451
            if(o.delay){
1452
                h = createDelayed(h, o, scope);
1453
            }
1454
            if(o.single){
1455
                h = createSingle(h, this, fn, scope);
1456
            }
1457
            if(o.buffer){
1458
                h = createBuffered(h, o, scope);
1459
            }
1460
            l.fireFn = h;
1461
            return l;
1462
        },
1463
 
1464
        findListener : function(fn, scope){
1465
            scope = scope || this.obj;
1466
            var ls = this.listeners;
1467
            for(var i = 0, len = ls.length; i < len; i++){
1468
                var l = ls[i];
1469
                if(l.fn == fn && l.scope == scope){
1470
                    return i;
1471
                }
1472
            }
1473
            return -1;
1474
        },
1475
 
1476
        isListening : function(fn, scope){
1477
            return this.findListener(fn, scope) != -1;
1478
        },
1479
 
1480
        removeListener : function(fn, scope){
1481
            var index;
1482
            if((index = this.findListener(fn, scope)) != -1){
1483
                if(!this.firing){
1484
                    this.listeners.splice(index, 1);
1485
                }else{
1486
                    this.listeners = this.listeners.slice(0);
1487
                    this.listeners.splice(index, 1);
1488
                }
1489
                return true;
1490
            }
1491
            return false;
1492
        },
1493
 
1494
        clearListeners : function(){
1495
            this.listeners = [];
1496
        },
1497
 
1498
        fire : function(){
1499
            var ls = this.listeners, scope, len = ls.length;
1500
            if(len > 0){
1501
                this.firing = true;
1502
                var args = Array.prototype.slice.call(arguments, 0);
1503
                for(var i = 0; i < len; i++){
1504
                    var l = ls[i];
1505
                    if(l.fireFn.apply(l.scope||this.obj||window, arguments) === false){
1506
                        this.firing = false;
1507
                        return false;
1508
                    }
1509
                }
1510
                this.firing = false;
1511
            }
1512
            return true;
1513
        }
1514
    };
1515
})();
1516
 
1517
Ext.EventManager = function(){
1518
    var docReadyEvent, docReadyProcId, docReadyState = false;
1519
    var resizeEvent, resizeTask, textEvent, textSize;
1520
    var E = Ext.lib.Event;
1521
    var D = Ext.lib.Dom;
1522
 
1523
 
1524
    var fireDocReady = function(){
1525
        if(!docReadyState){
1526
            docReadyState = true;
1527
            Ext.isReady = true;
1528
            if(docReadyProcId){
1529
                clearInterval(docReadyProcId);
1530
            }
1531
            if(Ext.isGecko || Ext.isOpera) {
1532
                document.removeEventListener("DOMContentLoaded", fireDocReady, false);
1533
            }
1534
            if(Ext.isIE){
1535
                var defer = document.getElementById("ie-deferred-loader");
1536
                if(defer){
1537
                    defer.onreadystatechange = null;
1538
                    defer.parentNode.removeChild(defer);
1539
                }
1540
            }
1541
            if(docReadyEvent){
1542
                docReadyEvent.fire();
1543
                docReadyEvent.clearListeners();
1544
            }
1545
        }
1546
    };
1547
 
1548
    var initDocReady = function(){
1549
        docReadyEvent = new Ext.util.Event();
1550
        if(Ext.isGecko || Ext.isOpera) {
1551
            document.addEventListener("DOMContentLoaded", fireDocReady, false);
1552
        }else if(Ext.isIE){
1553
            document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>");
1554
            var defer = document.getElementById("ie-deferred-loader");
1555
            defer.onreadystatechange = function(){
1556
                if(this.readyState == "complete"){
1557
                    fireDocReady();
1558
                }
1559
            };
1560
        }else if(Ext.isSafari){
1561
            docReadyProcId = setInterval(function(){
1562
                var rs = document.readyState;
1563
                if(rs == "complete") {
1564
                    fireDocReady();
1565
                 }
1566
            }, 10);
1567
        }
1568
 
1569
        E.on(window, "load", fireDocReady);
1570
    };
1571
 
1572
    var createBuffered = function(h, o){
1573
        var task = new Ext.util.DelayedTask(h);
1574
        return function(e){
1575
 
1576
            e = new Ext.EventObjectImpl(e);
1577
            task.delay(o.buffer, h, null, [e]);
1578
        };
1579
    };
1580
 
1581
    var createSingle = function(h, el, ename, fn){
1582
        return function(e){
1583
            Ext.EventManager.removeListener(el, ename, fn);
1584
            h(e);
1585
        };
1586
    };
1587
 
1588
    var createDelayed = function(h, o){
1589
        return function(e){
1590
 
1591
            e = new Ext.EventObjectImpl(e);
1592
            setTimeout(function(){
1593
                h(e);
1594
            }, o.delay || 10);
1595
        };
1596
    };
1597
 
1598
    var listen = function(element, ename, opt, fn, scope){
1599
        var o = (!opt || typeof opt == "boolean") ? {} : opt;
1600
        fn = fn || o.fn; scope = scope || o.scope;
1601
        var el = Ext.getDom(element);
1602
        if(!el){
1603
            throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';
1604
        }
1605
        var h = function(e){
1606
            e = Ext.EventObject.setEvent(e);
1607
            var t;
1608
            if(o.delegate){
1609
                t = e.getTarget(o.delegate, el);
1610
                if(!t){
1611
                    return;
1612
                }
1613
            }else{
1614
                t = e.target;
1615
            }
1616
            if(o.stopEvent === true){
1617
                e.stopEvent();
1618
            }
1619
            if(o.preventDefault === true){
1620
               e.preventDefault();
1621
            }
1622
            if(o.stopPropagation === true){
1623
                e.stopPropagation();
1624
            }
1625
 
1626
            if(o.normalized === false){
1627
                e = e.browserEvent;
1628
            }
1629
 
1630
            fn.call(scope || el, e, t, o);
1631
        };
1632
        if(o.delay){
1633
            h = createDelayed(h, o);
1634
        }
1635
        if(o.single){
1636
            h = createSingle(h, el, ename, fn);
1637
        }
1638
        if(o.buffer){
1639
            h = createBuffered(h, o);
1640
        }
1641
        fn._handlers = fn._handlers || [];
1642
        fn._handlers.push([Ext.id(el), ename, h]);
1643
 
1644
        E.on(el, ename, h);
1645
        if(ename == "mousewheel" && el.addEventListener){
1646
            el.addEventListener("DOMMouseScroll", h, false);
1647
            E.on(window, 'unload', function(){
1648
                el.removeEventListener("DOMMouseScroll", h, false);
1649
            });
1650
        }
1651
        if(ename == "mousedown" && el == document){
1652
            Ext.EventManager.stoppedMouseDownEvent.addListener(h);
1653
        }
1654
        return h;
1655
    };
1656
 
1657
    var stopListening = function(el, ename, fn){
1658
        var id = Ext.id(el), hds = fn._handlers, hd = fn;
1659
        if(hds){
1660
            for(var i = 0, len = hds.length; i < len; i++){
1661
                var h = hds[i];
1662
                if(h[0] == id && h[1] == ename){
1663
                    hd = h[2];
1664
                    hds.splice(i, 1);
1665
                    break;
1666
                }
1667
            }
1668
        }
1669
        E.un(el, ename, hd);
1670
        el = Ext.getDom(el);
1671
        if(ename == "mousewheel" && el.addEventListener){
1672
            el.removeEventListener("DOMMouseScroll", hd, false);
1673
        }
1674
        if(ename == "mousedown" && el == document){
1675
            Ext.EventManager.stoppedMouseDownEvent.removeListener(hd);
1676
        }
1677
    };
1678
 
1679
    var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
1680
    var pub = {
1681
 
1682
 
1683
        addListener : function(element, eventName, fn, scope, options){
1684
            if(typeof eventName == "object"){
1685
                var o = eventName;
1686
                for(var e in o){
1687
                    if(propRe.test(e)){
1688
                        continue;
1689
                    }
1690
                    if(typeof o[e] == "function"){
1691
 
1692
                        listen(element, e, o, o[e], o.scope);
1693
                    }else{
1694
 
1695
                        listen(element, e, o[e]);
1696
                    }
1697
                }
1698
                return;
1699
            }
1700
            return listen(element, eventName, options, fn, scope);
1701
        },
1702
 
1703
 
1704
        removeListener : function(element, eventName, fn){
1705
            return stopListening(element, eventName, fn);
1706
        },
1707
 
1708
 
1709
        onDocumentReady : function(fn, scope, options){
1710
            if(docReadyState){
1711
                docReadyEvent.addListener(fn, scope, options);
1712
                docReadyEvent.fire();
1713
                docReadyEvent.clearListeners();
1714
                return;
1715
            }
1716
            if(!docReadyEvent){
1717
                initDocReady();
1718
            }
1719
            docReadyEvent.addListener(fn, scope, options);
1720
        },
1721
 
1722
 
1723
        onWindowResize : function(fn, scope, options){
1724
            if(!resizeEvent){
1725
                resizeEvent = new Ext.util.Event();
1726
                resizeTask = new Ext.util.DelayedTask(function(){
1727
                    resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1728
                });
1729
                E.on(window, "resize", this.fireWindowResize, this);
1730
            }
1731
            resizeEvent.addListener(fn, scope, options);
1732
        },
1733
 
1734
 
1735
        fireWindowResize : function(){
1736
            if(resizeEvent){
1737
                if((Ext.isIE||Ext.isAir) && resizeTask){
1738
                    resizeTask.delay(50);
1739
                }else{
1740
                    resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1741
                }
1742
            }
1743
        },
1744
 
1745
 
1746
        onTextResize : function(fn, scope, options){
1747
            if(!textEvent){
1748
                textEvent = new Ext.util.Event();
1749
                var textEl = new Ext.Element(document.createElement('div'));
1750
                textEl.dom.className = 'x-text-resize';
1751
                textEl.dom.innerHTML = 'X';
1752
                textEl.appendTo(document.body);
1753
                textSize = textEl.dom.offsetHeight;
1754
                setInterval(function(){
1755
                    if(textEl.dom.offsetHeight != textSize){
1756
                        textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);
1757
                    }
1758
                }, this.textResizeInterval);
1759
            }
1760
            textEvent.addListener(fn, scope, options);
1761
        },
1762
 
1763
 
1764
        removeResizeListener : function(fn, scope){
1765
            if(resizeEvent){
1766
                resizeEvent.removeListener(fn, scope);
1767
            }
1768
        },
1769
 
1770
 
1771
        fireResize : function(){
1772
            if(resizeEvent){
1773
                resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1774
            }
1775
        },
1776
 
1777
        ieDeferSrc : false,
1778
 
1779
        textResizeInterval : 50
1780
    };
1781
 
1782
    pub.on = pub.addListener;
1783
 
1784
    pub.un = pub.removeListener;
1785
 
1786
    pub.stoppedMouseDownEvent = new Ext.util.Event();
1787
    return pub;
1788
}();
1789
 
1790
Ext.onReady = Ext.EventManager.onDocumentReady;
1791
 
1792
Ext.onReady(function(){
1793
    var bd = Ext.getBody();
1794
    if(!bd){ return; }
1795
 
1796
    var cls = [
1797
            Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : 'ext-ie7')
1798
            : Ext.isGecko ? "ext-gecko"
1799
            : Ext.isOpera ? "ext-opera"
1800
            : Ext.isSafari ? "ext-safari" : ""];
1801
 
1802
    if(Ext.isMac){
1803
        cls.push("ext-mac");
1804
    }
1805
    if(Ext.isLinux){
1806
        cls.push("ext-linux");
1807
    }
1808
    if(Ext.isBorderBox){
1809
        cls.push('ext-border-box');
1810
    }
1811
    if(Ext.isStrict){
1812
        var p = bd.dom.parentNode;
1813
        if(p){
1814
            p.className += ' ext-strict';
1815
        }
1816
    }
1817
    bd.addClass(cls.join(' '));
1818
});
1819
 
1820
 
1821
Ext.EventObject = function(){
1822
 
1823
    var E = Ext.lib.Event;
1824
 
1825
 
1826
    var safariKeys = {
1827
        63234 : 37,
1828
        63235 : 39,
1829
        63232 : 38,
1830
        63233 : 40,
1831
        63276 : 33,
1832
        63277 : 34,
1833
        63272 : 46,
1834
        63273 : 36,
1835
        63275 : 35
1836
    };
1837
 
1838
 
1839
    var btnMap = Ext.isIE ? {1:0,4:1,2:2} :
1840
                (Ext.isSafari ? {1:0,2:1,3:2} : {0:0,1:1,2:2});
1841
 
1842
    Ext.EventObjectImpl = function(e){
1843
        if(e){
1844
            this.setEvent(e.browserEvent || e);
1845
        }
1846
    };
1847
    Ext.EventObjectImpl.prototype = {
1848
 
1849
        browserEvent : null,
1850
 
1851
        button : -1,
1852
 
1853
        shiftKey : false,
1854
 
1855
        ctrlKey : false,
1856
 
1857
        altKey : false,
1858
 
1859
 
1860
        BACKSPACE : 8,
1861
 
1862
        TAB : 9,
1863
 
1864
        RETURN : 13,
1865
 
1866
        ENTER : 13,
1867
 
1868
        SHIFT : 16,
1869
 
1870
        CONTROL : 17,
1871
 
1872
        ESC : 27,
1873
 
1874
        SPACE : 32,
1875
 
1876
        PAGEUP : 33,
1877
 
1878
        PAGEDOWN : 34,
1879
 
1880
        END : 35,
1881
 
1882
        HOME : 36,
1883
 
1884
        LEFT : 37,
1885
 
1886
        UP : 38,
1887
 
1888
        RIGHT : 39,
1889
 
1890
        DOWN : 40,
1891
 
1892
        DELETE : 46,
1893
 
1894
        F5 : 116,
1895
 
1896
 
1897
        setEvent : function(e){
1898
            if(e == this || (e && e.browserEvent)){
1899
                return e;
1900
            }
1901
            this.browserEvent = e;
1902
            if(e){
1903
 
1904
                this.button = e.button ? btnMap[e.button] : (e.which ? e.which-1 : -1);
1905
                if(e.type == 'click' && this.button == -1){
1906
                    this.button = 0;
1907
                }
1908
                this.type = e.type;
1909
                this.shiftKey = e.shiftKey;
1910
 
1911
                this.ctrlKey = e.ctrlKey || e.metaKey;
1912
                this.altKey = e.altKey;
1913
 
1914
                this.keyCode = e.keyCode;
1915
                this.charCode = e.charCode;
1916
 
1917
                this.target = E.getTarget(e);
1918
 
1919
                this.xy = E.getXY(e);
1920
            }else{
1921
                this.button = -1;
1922
                this.shiftKey = false;
1923
                this.ctrlKey = false;
1924
                this.altKey = false;
1925
                this.keyCode = 0;
1926
                this.charCode =0;
1927
                this.target = null;
1928
                this.xy = [0, 0];
1929
            }
1930
            return this;
1931
        },
1932
 
1933
 
1934
        stopEvent : function(){
1935
            if(this.browserEvent){
1936
                if(this.browserEvent.type == 'mousedown'){
1937
                    Ext.EventManager.stoppedMouseDownEvent.fire(this);
1938
                }
1939
                E.stopEvent(this.browserEvent);
1940
            }
1941
        },
1942
 
1943
 
1944
        preventDefault : function(){
1945
            if(this.browserEvent){
1946
                E.preventDefault(this.browserEvent);
1947
            }
1948
        },
1949
 
1950
 
1951
        isNavKeyPress : function(){
1952
            var k = this.keyCode;
1953
            k = Ext.isSafari ? (safariKeys[k] || k) : k;
1954
            return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB || k == this.ESC;
1955
        },
1956
 
1957
        isSpecialKey : function(){
1958
            var k = this.keyCode;
1959
            return (this.type == 'keypress' && this.ctrlKey) || k == 9 || k == 13  || k == 40 || k == 27 ||
1960
            (k == 16) || (k == 17) ||
1961
            (k >= 18 && k <= 20) ||
1962
            (k >= 33 && k <= 35) ||
1963
            (k >= 36 && k <= 39) ||
1964
            (k >= 44 && k <= 45);
1965
        },
1966
 
1967
        stopPropagation : function(){
1968
            if(this.browserEvent){
1969
                if(this.browserEvent.type == 'mousedown'){
1970
                    Ext.EventManager.stoppedMouseDownEvent.fire(this);
1971
                }
1972
                E.stopPropagation(this.browserEvent);
1973
            }
1974
        },
1975
 
1976
 
1977
        getCharCode : function(){
1978
            return this.charCode || this.keyCode;
1979
        },
1980
 
1981
 
1982
        getKey : function(){
1983
            var k = this.keyCode || this.charCode;
1984
            return Ext.isSafari ? (safariKeys[k] || k) : k;
1985
        },
1986
 
1987
 
1988
        getPageX : function(){
1989
            return this.xy[0];
1990
        },
1991
 
1992
 
1993
        getPageY : function(){
1994
            return this.xy[1];
1995
        },
1996
 
1997
 
1998
        getTime : function(){
1999
            if(this.browserEvent){
2000
                return E.getTime(this.browserEvent);
2001
            }
2002
            return null;
2003
        },
2004
 
2005
 
2006
        getXY : function(){
2007
            return this.xy;
2008
        },
2009
 
2010
 
2011
        getTarget : function(selector, maxDepth, returnEl){
2012
        	var t = Ext.get(this.target);
2013
            return selector ? t.findParent(selector, maxDepth, returnEl) : (returnEl ? t : this.target);
2014
        },
2015
 
2016
 
2017
        getRelatedTarget : function(){
2018
            if(this.browserEvent){
2019
                return E.getRelatedTarget(this.browserEvent);
2020
            }
2021
            return null;
2022
        },
2023
 
2024
 
2025
        getWheelDelta : function(){
2026
            var e = this.browserEvent;
2027
            var delta = 0;
2028
            if(e.wheelDelta){
2029
                delta = e.wheelDelta/120;
2030
            }else if(e.detail){
2031
                delta = -e.detail/3;
2032
            }
2033
            return delta;
2034
        },
2035
 
2036
 
2037
        hasModifier : function(){
2038
            return ((this.ctrlKey || this.altKey) || this.shiftKey) ? true : false;
2039
        },
2040
 
2041
 
2042
        within : function(el, related){
2043
            var t = this[related ? "getRelatedTarget" : "getTarget"]();
2044
            return t && Ext.fly(el).contains(t);
2045
        },
2046
 
2047
        getPoint : function(){
2048
            return new Ext.lib.Point(this.xy[0], this.xy[1]);
2049
        }
2050
    };
2051
 
2052
    return new Ext.EventObjectImpl();
2053
}();
2054
 
2055
(function(){
2056
var D = Ext.lib.Dom;
2057
var E = Ext.lib.Event;
2058
var A = Ext.lib.Anim;
2059
 
2060
var propCache = {};
2061
var camelRe = /(-[a-z])/gi;
2062
var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };
2063
var view = document.defaultView;
2064
 
2065
Ext.Element = function(element, forceNew){
2066
    var dom = typeof element == "string" ?
2067
            document.getElementById(element) : element;
2068
    if(!dom){         return null;
2069
    }
2070
    var id = dom.id;
2071
    if(forceNew !== true && id && Ext.Element.cache[id]){         return Ext.Element.cache[id];
2072
    }
2073
 
2074
 
2075
    this.dom = dom;
2076
 
2077
 
2078
    this.id = id || Ext.id(dom);
2079
};
2080
 
2081
var El = Ext.Element;
2082
 
2083
El.prototype = {
2084
 
2085
    originalDisplay : "",
2086
 
2087
    visibilityMode : 1,
2088
 
2089
    defaultUnit : "px",
2090
 
2091
    setVisibilityMode : function(visMode){
2092
        this.visibilityMode = visMode;
2093
        return this;
2094
    },
2095
 
2096
    enableDisplayMode : function(display){
2097
        this.setVisibilityMode(El.DISPLAY);
2098
        if(typeof display != "undefined") this.originalDisplay = display;
2099
        return this;
2100
    },
2101
 
2102
 
2103
    findParent : function(simpleSelector, maxDepth, returnEl){
2104
        var p = this.dom, b = document.body, depth = 0, dq = Ext.DomQuery, stopEl;
2105
        maxDepth = maxDepth || 50;
2106
        if(typeof maxDepth != "number"){
2107
            stopEl = Ext.getDom(maxDepth);
2108
            maxDepth = 10;
2109
        }
2110
        while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){
2111
            if(dq.is(p, simpleSelector)){
2112
                return returnEl ? Ext.get(p) : p;
2113
            }
2114
            depth++;
2115
            p = p.parentNode;
2116
        }
2117
        return null;
2118
    },
2119
 
2120
 
2121
 
2122
    findParentNode : function(simpleSelector, maxDepth, returnEl){
2123
        var p = Ext.fly(this.dom.parentNode, '_internal');
2124
        return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
2125
    },
2126
 
2127
 
2128
    up : function(simpleSelector, maxDepth){
2129
        return this.findParentNode(simpleSelector, maxDepth, true);
2130
    },
2131
 
2132
 
2133
 
2134
 
2135
    is : function(simpleSelector){
2136
        return Ext.DomQuery.is(this.dom, simpleSelector);
2137
    },
2138
 
2139
 
2140
    animate : function(args, duration, onComplete, easing, animType){
2141
        this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType);
2142
        return this;
2143
    },
2144
 
2145
 
2146
    anim : function(args, opt, animType, defaultDur, defaultEase, cb){
2147
        animType = animType || 'run';
2148
        opt = opt || {};
2149
        var anim = Ext.lib.Anim[animType](
2150
            this.dom, args,
2151
            (opt.duration || defaultDur) || .35,
2152
            (opt.easing || defaultEase) || 'easeOut',
2153
            function(){
2154
                Ext.callback(cb, this);
2155
                Ext.callback(opt.callback, opt.scope || this, [this, opt]);
2156
            },
2157
            this
2158
        );
2159
        opt.anim = anim;
2160
        return anim;
2161
    },
2162
 
2163
        preanim : function(a, i){
2164
        return !a[i] ? false : (typeof a[i] == "object" ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]});
2165
    },
2166
 
2167
 
2168
    clean : function(forceReclean){
2169
        if(this.isCleaned && forceReclean !== true){
2170
            return this;
2171
        }
2172
        var ns = /\S/;
2173
        var d = this.dom, n = d.firstChild, ni = -1;
2174
 	    while(n){
2175
 	        var nx = n.nextSibling;
2176
 	        if(n.nodeType == 3 && !ns.test(n.nodeValue)){
2177
 	            d.removeChild(n);
2178
 	        }else{
2179
 	            n.nodeIndex = ++ni;
2180
 	        }
2181
 	        n = nx;
2182
 	    }
2183
 	    this.isCleaned = true;
2184
 	    return this;
2185
 	},
2186
 
2187
 
2188
    scrollIntoView : function(container, hscroll){
2189
        var c = Ext.getDom(container) || Ext.getBody().dom;
2190
        var el = this.dom;
2191
 
2192
        var o = this.getOffsetsTo(c),
2193
            l = o[0] + c.scrollLeft,
2194
            t = o[1] + c.scrollTop,
2195
            b = t+el.offsetHeight,
2196
            r = l+el.offsetWidth;
2197
 
2198
        var ch = c.clientHeight;
2199
        var ct = parseInt(c.scrollTop, 10);
2200
        var cl = parseInt(c.scrollLeft, 10);
2201
        var cb = ct + ch;
2202
        var cr = cl + c.clientWidth;
2203
 
2204
        if(el.offsetHeight > ch || t < ct){
2205
        	c.scrollTop = t;
2206
        }else if(b > cb){
2207
            c.scrollTop = b-ch;
2208
        }
2209
        c.scrollTop = c.scrollTop;
2210
        if(hscroll !== false){
2211
			if(el.offsetWidth > c.clientWidth || l < cl){
2212
                c.scrollLeft = l;
2213
            }else if(r > cr){
2214
                c.scrollLeft = r-c.clientWidth;
2215
            }
2216
            c.scrollLeft = c.scrollLeft;
2217
        }
2218
        return this;
2219
    },
2220
 
2221
        scrollChildIntoView : function(child, hscroll){
2222
        Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);
2223
    },
2224
 
2225
 
2226
    autoHeight : function(animate, duration, onComplete, easing){
2227
        var oldHeight = this.getHeight();
2228
        this.clip();
2229
        this.setHeight(1);         setTimeout(function(){
2230
            var height = parseInt(this.dom.scrollHeight, 10);             if(!animate){
2231
                this.setHeight(height);
2232
                this.unclip();
2233
                if(typeof onComplete == "function"){
2234
                    onComplete();
2235
                }
2236
            }else{
2237
                this.setHeight(oldHeight);                 this.setHeight(height, animate, duration, function(){
2238
                    this.unclip();
2239
                    if(typeof onComplete == "function") onComplete();
2240
                }.createDelegate(this), easing);
2241
            }
2242
        }.createDelegate(this), 0);
2243
        return this;
2244
    },
2245
 
2246
 
2247
    contains : function(el){
2248
        if(!el){return false;}
2249
        return D.isAncestor(this.dom, el.dom ? el.dom : el);
2250
    },
2251
 
2252
 
2253
    isVisible : function(deep) {
2254
        var vis = !(this.getStyle("visibility") == "hidden" || this.getStyle("display") == "none");
2255
        if(deep !== true || !vis){
2256
            return vis;
2257
        }
2258
        var p = this.dom.parentNode;
2259
        while(p && p.tagName.toLowerCase() != "body"){
2260
            if(!Ext.fly(p, '_isVisible').isVisible()){
2261
                return false;
2262
            }
2263
            p = p.parentNode;
2264
        }
2265
        return true;
2266
    },
2267
 
2268
 
2269
    select : function(selector, unique){
2270
        return El.select(selector, unique, this.dom);
2271
    },
2272
 
2273
 
2274
    query : function(selector, unique){
2275
        return Ext.DomQuery.select(selector, this.dom);
2276
    },
2277
 
2278
 
2279
    child : function(selector, returnDom){
2280
        var n = Ext.DomQuery.selectNode(selector, this.dom);
2281
        return returnDom ? n : Ext.get(n);
2282
    },
2283
 
2284
 
2285
    down : function(selector, returnDom){
2286
        var n = Ext.DomQuery.selectNode(" > " + selector, this.dom);
2287
        return returnDom ? n : Ext.get(n);
2288
    },
2289
 
2290
 
2291
    initDD : function(group, config, overrides){
2292
        var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);
2293
        return Ext.apply(dd, overrides);
2294
    },
2295
 
2296
 
2297
    initDDProxy : function(group, config, overrides){
2298
        var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);
2299
        return Ext.apply(dd, overrides);
2300
    },
2301
 
2302
 
2303
    initDDTarget : function(group, config, overrides){
2304
        var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);
2305
        return Ext.apply(dd, overrides);
2306
    },
2307
 
2308
 
2309
     setVisible : function(visible, animate){
2310
        if(!animate || !A){
2311
            if(this.visibilityMode == El.DISPLAY){
2312
                this.setDisplayed(visible);
2313
            }else{
2314
                this.fixDisplay();
2315
                this.dom.style.visibility = visible ? "visible" : "hidden";
2316
            }
2317
        }else{
2318
                        var dom = this.dom;
2319
            var visMode = this.visibilityMode;
2320
            if(visible){
2321
                this.setOpacity(.01);
2322
                this.setVisible(true);
2323
            }
2324
            this.anim({opacity: { to: (visible?1:0) }},
2325
                  this.preanim(arguments, 1),
2326
                  null, .35, 'easeIn', function(){
2327
                     if(!visible){
2328
                         if(visMode == El.DISPLAY){
2329
                             dom.style.display = "none";
2330
                         }else{
2331
                             dom.style.visibility = "hidden";
2332
                         }
2333
                         Ext.get(dom).setOpacity(1);
2334
                     }
2335
                 });
2336
        }
2337
        return this;
2338
    },
2339
 
2340
 
2341
    isDisplayed : function() {
2342
        return this.getStyle("display") != "none";
2343
    },
2344
 
2345
 
2346
    toggle : function(animate){
2347
        this.setVisible(!this.isVisible(), this.preanim(arguments, 0));
2348
        return this;
2349
    },
2350
 
2351
 
2352
    setDisplayed : function(value) {
2353
        if(typeof value == "boolean"){
2354
           value = value ? this.originalDisplay : "none";
2355
        }
2356
        this.setStyle("display", value);
2357
        return this;
2358
    },
2359
 
2360
 
2361
    focus : function() {
2362
        try{
2363
            this.dom.focus();
2364
        }catch(e){}
2365
        return this;
2366
    },
2367
 
2368
 
2369
    blur : function() {
2370
        try{
2371
            this.dom.blur();
2372
        }catch(e){}
2373
        return this;
2374
    },
2375
 
2376
 
2377
    addClass : function(className){
2378
        if(Ext.isArray(className)){
2379
            for(var i = 0, len = className.length; i < len; i++) {
2380
            	this.addClass(className[i]);
2381
            }
2382
        }else{
2383
            if(className && !this.hasClass(className)){
2384
                this.dom.className = this.dom.className + " " + className;
2385
            }
2386
        }
2387
        return this;
2388
    },
2389
 
2390
 
2391
    radioClass : function(className){
2392
        var siblings = this.dom.parentNode.childNodes;
2393
        for(var i = 0; i < siblings.length; i++) {
2394
        	var s = siblings[i];
2395
        	if(s.nodeType == 1){
2396
        	    Ext.get(s).removeClass(className);
2397
        	}
2398
        }
2399
        this.addClass(className);
2400
        return this;
2401
    },
2402
 
2403
 
2404
    removeClass : function(className){
2405
        if(!className || !this.dom.className){
2406
            return this;
2407
        }
2408
        if(Ext.isArray(className)){
2409
            for(var i = 0, len = className.length; i < len; i++) {
2410
            	this.removeClass(className[i]);
2411
            }
2412
        }else{
2413
            if(this.hasClass(className)){
2414
                var re = this.classReCache[className];
2415
                if (!re) {
2416
                   re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', "g");
2417
                   this.classReCache[className] = re;
2418
                }
2419
                this.dom.className =
2420
                    this.dom.className.replace(re, " ");
2421
            }
2422
        }
2423
        return this;
2424
    },
2425
 
2426
        classReCache: {},
2427
 
2428
 
2429
    toggleClass : function(className){
2430
        if(this.hasClass(className)){
2431
            this.removeClass(className);
2432
        }else{
2433
            this.addClass(className);
2434
        }
2435
        return this;
2436
    },
2437
 
2438
 
2439
    hasClass : function(className){
2440
        return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;
2441
    },
2442
 
2443
 
2444
    replaceClass : function(oldClassName, newClassName){
2445
        this.removeClass(oldClassName);
2446
        this.addClass(newClassName);
2447
        return this;
2448
    },
2449
 
2450
 
2451
    getStyles : function(){
2452
        var a = arguments, len = a.length, r = {};
2453
        for(var i = 0; i < len; i++){
2454
            r[a[i]] = this.getStyle(a[i]);
2455
        }
2456
        return r;
2457
    },
2458
 
2459
 
2460
    getStyle : function(){
2461
        return view && view.getComputedStyle ?
2462
            function(prop){
2463
                var el = this.dom, v, cs, camel;
2464
                if(prop == 'float'){
2465
                    prop = "cssFloat";
2466
                }
2467
                if(v = el.style[prop]){
2468
                    return v;
2469
                }
2470
                if(cs = view.getComputedStyle(el, "")){
2471
                    if(!(camel = propCache[prop])){
2472
                        camel = propCache[prop] = prop.replace(camelRe, camelFn);
2473
                    }
2474
                    return cs[camel];
2475
                }
2476
                return null;
2477
            } :
2478
            function(prop){
2479
                var el = this.dom, v, cs, camel;
2480
                if(prop == 'opacity'){
2481
                    if(typeof el.style.filter == 'string'){
2482
                        var m = el.style.filter.match(/alpha\(opacity=(.*)\)/i);
2483
                        if(m){
2484
                            var fv = parseFloat(m[1]);
2485
                            if(!isNaN(fv)){
2486
                                return fv ? fv / 100 : 0;
2487
                            }
2488
                        }
2489
                    }
2490
                    return 1;
2491
                }else if(prop == 'float'){
2492
                    prop = "styleFloat";
2493
                }
2494
                if(!(camel = propCache[prop])){
2495
                    camel = propCache[prop] = prop.replace(camelRe, camelFn);
2496
                }
2497
                if(v = el.style[camel]){
2498
                    return v;
2499
                }
2500
                if(cs = el.currentStyle){
2501
                    return cs[camel];
2502
                }
2503
                return null;
2504
            };
2505
    }(),
2506
 
2507
 
2508
    setStyle : function(prop, value){
2509
        if(typeof prop == "string"){
2510
            var camel;
2511
            if(!(camel = propCache[prop])){
2512
                camel = propCache[prop] = prop.replace(camelRe, camelFn);
2513
            }
2514
            if(camel == 'opacity') {
2515
                this.setOpacity(value);
2516
            }else{
2517
                this.dom.style[camel] = value;
2518
            }
2519
        }else{
2520
            for(var style in prop){
2521
                if(typeof prop[style] != "function"){
2522
                   this.setStyle(style, prop[style]);
2523
                }
2524
            }
2525
        }
2526
        return this;
2527
    },
2528
 
2529
 
2530
    applyStyles : function(style){
2531
        Ext.DomHelper.applyStyles(this.dom, style);
2532
        return this;
2533
    },
2534
 
2535
 
2536
    getX : function(){
2537
        return D.getX(this.dom);
2538
    },
2539
 
2540
 
2541
    getY : function(){
2542
        return D.getY(this.dom);
2543
    },
2544
 
2545
 
2546
    getXY : function(){
2547
        return D.getXY(this.dom);
2548
    },
2549
 
2550
 
2551
    getOffsetsTo : function(el){
2552
        var o = this.getXY();
2553
        var e = Ext.fly(el, '_internal').getXY();
2554
        return [o[0]-e[0],o[1]-e[1]];
2555
    },
2556
 
2557
 
2558
    setX : function(x, animate){
2559
        if(!animate || !A){
2560
            D.setX(this.dom, x);
2561
        }else{
2562
            this.setXY([x, this.getY()], this.preanim(arguments, 1));
2563
        }
2564
        return this;
2565
    },
2566
 
2567
 
2568
    setY : function(y, animate){
2569
        if(!animate || !A){
2570
            D.setY(this.dom, y);
2571
        }else{
2572
            this.setXY([this.getX(), y], this.preanim(arguments, 1));
2573
        }
2574
        return this;
2575
    },
2576
 
2577
 
2578
    setLeft : function(left){
2579
        this.setStyle("left", this.addUnits(left));
2580
        return this;
2581
    },
2582
 
2583
 
2584
    setTop : function(top){
2585
        this.setStyle("top", this.addUnits(top));
2586
        return this;
2587
    },
2588
 
2589
 
2590
    setRight : function(right){
2591
        this.setStyle("right", this.addUnits(right));
2592
        return this;
2593
    },
2594
 
2595
 
2596
    setBottom : function(bottom){
2597
        this.setStyle("bottom", this.addUnits(bottom));
2598
        return this;
2599
    },
2600
 
2601
 
2602
    setXY : function(pos, animate){
2603
        if(!animate || !A){
2604
            D.setXY(this.dom, pos);
2605
        }else{
2606
            this.anim({points: {to: pos}}, this.preanim(arguments, 1), 'motion');
2607
        }
2608
        return this;
2609
    },
2610
 
2611
 
2612
    setLocation : function(x, y, animate){
2613
        this.setXY([x, y], this.preanim(arguments, 2));
2614
        return this;
2615
    },
2616
 
2617
 
2618
    moveTo : function(x, y, animate){
2619
        this.setXY([x, y], this.preanim(arguments, 2));
2620
        return this;
2621
    },
2622
 
2623
 
2624
    getRegion : function(){
2625
        return D.getRegion(this.dom);
2626
    },
2627
 
2628
 
2629
    getHeight : function(contentHeight){
2630
        var h = this.dom.offsetHeight || 0;
2631
        h = contentHeight !== true ? h : h-this.getBorderWidth("tb")-this.getPadding("tb");
2632
        return h < 0 ? 0 : h;
2633
    },
2634
 
2635
 
2636
    getWidth : function(contentWidth){
2637
        var w = this.dom.offsetWidth || 0;
2638
        w = contentWidth !== true ? w : w-this.getBorderWidth("lr")-this.getPadding("lr");
2639
        return w < 0 ? 0 : w;
2640
    },
2641
 
2642
 
2643
    getComputedHeight : function(){
2644
        var h = Math.max(this.dom.offsetHeight, this.dom.clientHeight);
2645
        if(!h){
2646
            h = parseInt(this.getStyle('height'), 10) || 0;
2647
            if(!this.isBorderBox()){
2648
                h += this.getFrameWidth('tb');
2649
            }
2650
        }
2651
        return h;
2652
    },
2653
 
2654
 
2655
    getComputedWidth : function(){
2656
        var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth);
2657
        if(!w){
2658
            w = parseInt(this.getStyle('width'), 10) || 0;
2659
            if(!this.isBorderBox()){
2660
                w += this.getFrameWidth('lr');
2661
            }
2662
        }
2663
        return w;
2664
    },
2665
 
2666
 
2667
    getSize : function(contentSize){
2668
        return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};
2669
    },
2670
 
2671
    getStyleSize : function(){
2672
        var w, h, d = this.dom, s = d.style;
2673
        if(s.width && s.width != 'auto'){
2674
            w = parseInt(s.width, 10);
2675
            if(Ext.isBorderBox){
2676
               w -= this.getFrameWidth('lr');
2677
            }
2678
        }
2679
        if(s.height && s.height != 'auto'){
2680
            h = parseInt(s.height, 10);
2681
            if(Ext.isBorderBox){
2682
               h -= this.getFrameWidth('tb');
2683
            }
2684
        }
2685
        return {width: w || this.getWidth(true), height: h || this.getHeight(true)};
2686
 
2687
    },
2688
 
2689
 
2690
    getViewSize : function(){
2691
        var d = this.dom, doc = document, aw = 0, ah = 0;
2692
        if(d == doc || d == doc.body){
2693
            return {width : D.getViewWidth(), height: D.getViewHeight()};
2694
        }else{
2695
            return {
2696
                width : d.clientWidth,
2697
                height: d.clientHeight
2698
            };
2699
        }
2700
    },
2701
 
2702
 
2703
    getValue : function(asNumber){
2704
        return asNumber ? parseInt(this.dom.value, 10) : this.dom.value;
2705
    },
2706
 
2707
        adjustWidth : function(width){
2708
        if(typeof width == "number"){
2709
            if(this.autoBoxAdjust && !this.isBorderBox()){
2710
               width -= (this.getBorderWidth("lr") + this.getPadding("lr"));
2711
            }
2712
            if(width < 0){
2713
                width = 0;
2714
            }
2715
        }
2716
        return width;
2717
    },
2718
 
2719
        adjustHeight : function(height){
2720
        if(typeof height == "number"){
2721
           if(this.autoBoxAdjust && !this.isBorderBox()){
2722
               height -= (this.getBorderWidth("tb") + this.getPadding("tb"));
2723
           }
2724
           if(height < 0){
2725
               height = 0;
2726
           }
2727
        }
2728
        return height;
2729
    },
2730
 
2731
 
2732
    setWidth : function(width, animate){
2733
        width = this.adjustWidth(width);
2734
        if(!animate || !A){
2735
            this.dom.style.width = this.addUnits(width);
2736
        }else{
2737
            this.anim({width: {to: width}}, this.preanim(arguments, 1));
2738
        }
2739
        return this;
2740
    },
2741
 
2742
 
2743
     setHeight : function(height, animate){
2744
        height = this.adjustHeight(height);
2745
        if(!animate || !A){
2746
            this.dom.style.height = this.addUnits(height);
2747
        }else{
2748
            this.anim({height: {to: height}}, this.preanim(arguments, 1));
2749
        }
2750
        return this;
2751
    },
2752
 
2753
 
2754
     setSize : function(width, height, animate){
2755
        if(typeof width == "object"){             height = width.height; width = width.width;
2756
        }
2757
        width = this.adjustWidth(width); height = this.adjustHeight(height);
2758
        if(!animate || !A){
2759
            this.dom.style.width = this.addUnits(width);
2760
            this.dom.style.height = this.addUnits(height);
2761
        }else{
2762
            this.anim({width: {to: width}, height: {to: height}}, this.preanim(arguments, 2));
2763
        }
2764
        return this;
2765
    },
2766
 
2767
 
2768
    setBounds : function(x, y, width, height, animate){
2769
        if(!animate || !A){
2770
            this.setSize(width, height);
2771
            this.setLocation(x, y);
2772
        }else{
2773
            width = this.adjustWidth(width); height = this.adjustHeight(height);
2774
            this.anim({points: {to: [x, y]}, width: {to: width}, height: {to: height}},
2775
                          this.preanim(arguments, 4), 'motion');
2776
        }
2777
        return this;
2778
    },
2779
 
2780
 
2781
    setRegion : function(region, animate){
2782
        this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.preanim(arguments, 1));
2783
        return this;
2784
    },
2785
 
2786
 
2787
    addListener : function(eventName, fn, scope, options){
2788
        Ext.EventManager.on(this.dom,  eventName, fn, scope || this, options);
2789
    },
2790
 
2791
 
2792
    removeListener : function(eventName, fn){
2793
        Ext.EventManager.removeListener(this.dom,  eventName, fn);
2794
        return this;
2795
    },
2796
 
2797
 
2798
    removeAllListeners : function(){
2799
        E.purgeElement(this.dom);
2800
        return this;
2801
    },
2802
 
2803
 
2804
    relayEvent : function(eventName, observable){
2805
        this.on(eventName, function(e){
2806
            observable.fireEvent(eventName, e);
2807
        });
2808
    },
2809
 
2810
 
2811
     setOpacity : function(opacity, animate){
2812
        if(!animate || !A){
2813
            var s = this.dom.style;
2814
            if(Ext.isIE){
2815
                s.zoom = 1;
2816
                s.filter = (s.filter || '').replace(/alpha\([^\)]*\)/gi,"") +
2817
                           (opacity == 1 ? "" : " alpha(opacity=" + opacity * 100 + ")");
2818
            }else{
2819
                s.opacity = opacity;
2820
            }
2821
        }else{
2822
            this.anim({opacity: {to: opacity}}, this.preanim(arguments, 1), null, .35, 'easeIn');
2823
        }
2824
        return this;
2825
    },
2826
 
2827
 
2828
    getLeft : function(local){
2829
        if(!local){
2830
            return this.getX();
2831
        }else{
2832
            return parseInt(this.getStyle("left"), 10) || 0;
2833
        }
2834
    },
2835
 
2836
 
2837
    getRight : function(local){
2838
        if(!local){
2839
            return this.getX() + this.getWidth();
2840
        }else{
2841
            return (this.getLeft(true) + this.getWidth()) || 0;
2842
        }
2843
    },
2844
 
2845
 
2846
    getTop : function(local) {
2847
        if(!local){
2848
            return this.getY();
2849
        }else{
2850
            return parseInt(this.getStyle("top"), 10) || 0;
2851
        }
2852
    },
2853
 
2854
 
2855
    getBottom : function(local){
2856
        if(!local){
2857
            return this.getY() + this.getHeight();
2858
        }else{
2859
            return (this.getTop(true) + this.getHeight()) || 0;
2860
        }
2861
    },
2862
 
2863
 
2864
    position : function(pos, zIndex, x, y){
2865
        if(!pos){
2866
           if(this.getStyle('position') == 'static'){
2867
               this.setStyle('position', 'relative');
2868
           }
2869
        }else{
2870
            this.setStyle("position", pos);
2871
        }
2872
        if(zIndex){
2873
            this.setStyle("z-index", zIndex);
2874
        }
2875
        if(x !== undefined && y !== undefined){
2876
            this.setXY([x, y]);
2877
        }else if(x !== undefined){
2878
            this.setX(x);
2879
        }else if(y !== undefined){
2880
            this.setY(y);
2881
        }
2882
    },
2883
 
2884
 
2885
    clearPositioning : function(value){
2886
        value = value ||'';
2887
        this.setStyle({
2888
            "left": value,
2889
            "right": value,
2890
            "top": value,
2891
            "bottom": value,
2892
            "z-index": "",
2893
            "position" : "static"
2894
        });
2895
        return this;
2896
    },
2897
 
2898
 
2899
    getPositioning : function(){
2900
        var l = this.getStyle("left");
2901
        var t = this.getStyle("top");
2902
        return {
2903
            "position" : this.getStyle("position"),
2904
            "left" : l,
2905
            "right" : l ? "" : this.getStyle("right"),
2906
            "top" : t,
2907
            "bottom" : t ? "" : this.getStyle("bottom"),
2908
            "z-index" : this.getStyle("z-index")
2909
        };
2910
    },
2911
 
2912
 
2913
    getBorderWidth : function(side){
2914
        return this.addStyles(side, El.borders);
2915
    },
2916
 
2917
 
2918
    getPadding : function(side){
2919
        return this.addStyles(side, El.paddings);
2920
    },
2921
 
2922
 
2923
    setPositioning : function(pc){
2924
        this.applyStyles(pc);
2925
        if(pc.right == "auto"){
2926
            this.dom.style.right = "";
2927
        }
2928
        if(pc.bottom == "auto"){
2929
            this.dom.style.bottom = "";
2930
        }
2931
        return this;
2932
    },
2933
 
2934
        fixDisplay : function(){
2935
        if(this.getStyle("display") == "none"){
2936
            this.setStyle("visibility", "hidden");
2937
            this.setStyle("display", this.originalDisplay);             if(this.getStyle("display") == "none"){                 this.setStyle("display", "block");
2938
            }
2939
        }
2940
    },
2941
 
2942
    	setOverflow : function(v){
2943
    	if(v=='auto' && Ext.isMac && Ext.isGecko){     		this.dom.style.overflow = 'hidden';
2944
        	(function(){this.dom.style.overflow = 'auto';}).defer(1, this);
2945
    	}else{
2946
    		this.dom.style.overflow = v;
2947
    	}
2948
	},
2949
 
2950
 
2951
     setLeftTop : function(left, top){
2952
        this.dom.style.left = this.addUnits(left);
2953
        this.dom.style.top = this.addUnits(top);
2954
        return this;
2955
    },
2956
 
2957
 
2958
     move : function(direction, distance, animate){
2959
        var xy = this.getXY();
2960
        direction = direction.toLowerCase();
2961
        switch(direction){
2962
            case "l":
2963
            case "left":
2964
                this.moveTo(xy[0]-distance, xy[1], this.preanim(arguments, 2));
2965
                break;
2966
           case "r":
2967
           case "right":
2968
                this.moveTo(xy[0]+distance, xy[1], this.preanim(arguments, 2));
2969
                break;
2970
           case "t":
2971
           case "top":
2972
           case "up":
2973
                this.moveTo(xy[0], xy[1]-distance, this.preanim(arguments, 2));
2974
                break;
2975
           case "b":
2976
           case "bottom":
2977
           case "down":
2978
                this.moveTo(xy[0], xy[1]+distance, this.preanim(arguments, 2));
2979
                break;
2980
        }
2981
        return this;
2982
    },
2983
 
2984
 
2985
    clip : function(){
2986
        if(!this.isClipped){
2987
           this.isClipped = true;
2988
           this.originalClip = {
2989
               "o": this.getStyle("overflow"),
2990
               "x": this.getStyle("overflow-x"),
2991
               "y": this.getStyle("overflow-y")
2992
           };
2993
           this.setStyle("overflow", "hidden");
2994
           this.setStyle("overflow-x", "hidden");
2995
           this.setStyle("overflow-y", "hidden");
2996
        }
2997
        return this;
2998
    },
2999
 
3000
 
3001
    unclip : function(){
3002
        if(this.isClipped){
3003
            this.isClipped = false;
3004
            var o = this.originalClip;
3005
            if(o.o){this.setStyle("overflow", o.o);}
3006
            if(o.x){this.setStyle("overflow-x", o.x);}
3007
            if(o.y){this.setStyle("overflow-y", o.y);}
3008
        }
3009
        return this;
3010
    },
3011
 
3012
 
3013
 
3014
    getAnchorXY : function(anchor, local, s){
3015
 
3016
        var w, h, vp = false;
3017
        if(!s){
3018
            var d = this.dom;
3019
            if(d == document.body || d == document){
3020
                vp = true;
3021
                w = D.getViewWidth(); h = D.getViewHeight();
3022
            }else{
3023
                w = this.getWidth(); h = this.getHeight();
3024
            }
3025
        }else{
3026
            w = s.width;  h = s.height;
3027
        }
3028
        var x = 0, y = 0, r = Math.round;
3029
        switch((anchor || "tl").toLowerCase()){
3030
            case "c":
3031
                x = r(w*.5);
3032
                y = r(h*.5);
3033
            break;
3034
            case "t":
3035
                x = r(w*.5);
3036
                y = 0;
3037
            break;
3038
            case "l":
3039
                x = 0;
3040
                y = r(h*.5);
3041
            break;
3042
            case "r":
3043
                x = w;
3044
                y = r(h*.5);
3045
            break;
3046
            case "b":
3047
                x = r(w*.5);
3048
                y = h;
3049
            break;
3050
            case "tl":
3051
                x = 0;
3052
                y = 0;
3053
            break;
3054
            case "bl":
3055
                x = 0;
3056
                y = h;
3057
            break;
3058
            case "br":
3059
                x = w;
3060
                y = h;
3061
            break;
3062
            case "tr":
3063
                x = w;
3064
                y = 0;
3065
            break;
3066
        }
3067
        if(local === true){
3068
            return [x, y];
3069
        }
3070
        if(vp){
3071
            var sc = this.getScroll();
3072
            return [x + sc.left, y + sc.top];
3073
        }
3074
                var o = this.getXY();
3075
        return [x+o[0], y+o[1]];
3076
    },
3077
 
3078
 
3079
    getAlignToXY : function(el, p, o){
3080
        el = Ext.get(el);
3081
        if(!el || !el.dom){
3082
            throw "Element.alignToXY with an element that doesn't exist";
3083
        }
3084
        var d = this.dom;
3085
        var c = false;         var p1 = "", p2 = "";
3086
        o = o || [0,0];
3087
 
3088
        if(!p){
3089
            p = "tl-bl";
3090
        }else if(p == "?"){
3091
            p = "tl-bl?";
3092
        }else if(p.indexOf("-") == -1){
3093
            p = "tl-" + p;
3094
        }
3095
        p = p.toLowerCase();
3096
        var m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/);
3097
        if(!m){
3098
           throw "Element.alignTo with an invalid alignment " + p;
3099
        }
3100
        p1 = m[1]; p2 = m[2]; c = !!m[3];
3101
 
3102
                        var a1 = this.getAnchorXY(p1, true);
3103
        var a2 = el.getAnchorXY(p2, false);
3104
 
3105
        var x = a2[0] - a1[0] + o[0];
3106
        var y = a2[1] - a1[1] + o[1];
3107
 
3108
        if(c){
3109
                        var w = this.getWidth(), h = this.getHeight(), r = el.getRegion();
3110
                        var dw = D.getViewWidth()-5, dh = D.getViewHeight()-5;
3111
 
3112
                                                var p1y = p1.charAt(0), p1x = p1.charAt(p1.length-1);
3113
           var p2y = p2.charAt(0), p2x = p2.charAt(p2.length-1);
3114
           var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t"));
3115
           var swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r"));
3116
 
3117
           var doc = document;
3118
           var scrollX = (doc.documentElement.scrollLeft || doc.body.scrollLeft || 0)+5;
3119
           var scrollY = (doc.documentElement.scrollTop || doc.body.scrollTop || 0)+5;
3120
 
3121
           if((x+w) > dw + scrollX){
3122
                x = swapX ? r.left-w : dw+scrollX-w;
3123
            }
3124
           if(x < scrollX){
3125
               x = swapX ? r.right : scrollX;
3126
           }
3127
           if((y+h) > dh + scrollY){
3128
                y = swapY ? r.top-h : dh+scrollY-h;
3129
            }
3130
           if (y < scrollY){
3131
               y = swapY ? r.bottom : scrollY;
3132
           }
3133
        }
3134
        return [x,y];
3135
    },
3136
 
3137
        getConstrainToXY : function(){
3138
        var os = {top:0, left:0, bottom:0, right: 0};
3139
 
3140
        return function(el, local, offsets, proposedXY){
3141
            el = Ext.get(el);
3142
            offsets = offsets ? Ext.applyIf(offsets, os) : os;
3143
 
3144
            var vw, vh, vx = 0, vy = 0;
3145
            if(el.dom == document.body || el.dom == document){
3146
                vw = Ext.lib.Dom.getViewWidth();
3147
                vh = Ext.lib.Dom.getViewHeight();
3148
            }else{
3149
                vw = el.dom.clientWidth;
3150
                vh = el.dom.clientHeight;
3151
                if(!local){
3152
                    var vxy = el.getXY();
3153
                    vx = vxy[0];
3154
                    vy = vxy[1];
3155
                }
3156
            }
3157
 
3158
            var s = el.getScroll();
3159
 
3160
            vx += offsets.left + s.left;
3161
            vy += offsets.top + s.top;
3162
 
3163
            vw -= offsets.right;
3164
            vh -= offsets.bottom;
3165
 
3166
            var vr = vx+vw;
3167
            var vb = vy+vh;
3168
 
3169
            var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]);
3170
            var x = xy[0], y = xy[1];
3171
            var w = this.dom.offsetWidth, h = this.dom.offsetHeight;
3172
 
3173
                        var moved = false;
3174
 
3175
                        if((x + w) > vr){
3176
                x = vr - w;
3177
                moved = true;
3178
            }
3179
            if((y + h) > vb){
3180
                y = vb - h;
3181
                moved = true;
3182
            }
3183
                        if(x < vx){
3184
                x = vx;
3185
                moved = true;
3186
            }
3187
            if(y < vy){
3188
                y = vy;
3189
                moved = true;
3190
            }
3191
            return moved ? [x, y] : false;
3192
        };
3193
    }(),
3194
 
3195
        adjustForConstraints : function(xy, parent, offsets){
3196
        return this.getConstrainToXY(parent || document, false, offsets, xy) ||  xy;
3197
    },
3198
 
3199
 
3200
    alignTo : function(element, position, offsets, animate){
3201
        var xy = this.getAlignToXY(element, position, offsets);
3202
        this.setXY(xy, this.preanim(arguments, 3));
3203
        return this;
3204
    },
3205
 
3206
 
3207
    anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){
3208
        var action = function(){
3209
            this.alignTo(el, alignment, offsets, animate);
3210
            Ext.callback(callback, this);
3211
        };
3212
        Ext.EventManager.onWindowResize(action, this);
3213
        var tm = typeof monitorScroll;
3214
        if(tm != 'undefined'){
3215
            Ext.EventManager.on(window, 'scroll', action, this,
3216
                {buffer: tm == 'number' ? monitorScroll : 50});
3217
        }
3218
        action.call(this);         return this;
3219
    },
3220
 
3221
    clearOpacity : function(){
3222
        if (window.ActiveXObject) {
3223
            if(typeof this.dom.style.filter == 'string' && (/alpha/i).test(this.dom.style.filter)){
3224
                this.dom.style.filter = "";
3225
            }
3226
        } else {
3227
            this.dom.style.opacity = "";
3228
            this.dom.style["-moz-opacity"] = "";
3229
            this.dom.style["-khtml-opacity"] = "";
3230
        }
3231
        return this;
3232
    },
3233
 
3234
 
3235
    hide : function(animate){
3236
        this.setVisible(false, this.preanim(arguments, 0));
3237
        return this;
3238
    },
3239
 
3240
 
3241
    show : function(animate){
3242
        this.setVisible(true, this.preanim(arguments, 0));
3243
        return this;
3244
    },
3245
 
3246
 
3247
    addUnits : function(size){
3248
        return Ext.Element.addUnits(size, this.defaultUnit);
3249
    },
3250
 
3251
 
3252
    update : function(html, loadScripts, callback){
3253
        if(typeof html == "undefined"){
3254
            html = "";
3255
        }
3256
        if(loadScripts !== true){
3257
            this.dom.innerHTML = html;
3258
            if(typeof callback == "function"){
3259
                callback();
3260
            }
3261
            return this;
3262
        }
3263
        var id = Ext.id();
3264
        var dom = this.dom;
3265
 
3266
        html += '<span id="' + id + '"></span>';
3267
 
3268
        E.onAvailable(id, function(){
3269
            var hd = document.getElementsByTagName("head")[0];
3270
            var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;
3271
            var srcRe = /\ssrc=([\'\"])(.*?)\1/i;
3272
            var typeRe = /\stype=([\'\"])(.*?)\1/i;
3273
 
3274
            var match;
3275
            while(match = re.exec(html)){
3276
                var attrs = match[1];
3277
                var srcMatch = attrs ? attrs.match(srcRe) : false;
3278
                if(srcMatch && srcMatch[2]){
3279
                   var s = document.createElement("script");
3280
                   s.src = srcMatch[2];
3281
                   var typeMatch = attrs.match(typeRe);
3282
                   if(typeMatch && typeMatch[2]){
3283
                       s.type = typeMatch[2];
3284
                   }
3285
                   hd.appendChild(s);
3286
                }else if(match[2] && match[2].length > 0){
3287
                    if(window.execScript) {
3288
                       window.execScript(match[2]);
3289
                    } else {
3290
                       window.eval(match[2]);
3291
                    }
3292
                }
3293
            }
3294
            var el = document.getElementById(id);
3295
            if(el){Ext.removeNode(el);}
3296
            if(typeof callback == "function"){
3297
                callback();
3298
            }
3299
        });
3300
        dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");
3301
        return this;
3302
    },
3303
 
3304
 
3305
    load : function(){
3306
        var um = this.getUpdater();
3307
        um.update.apply(um, arguments);
3308
        return this;
3309
    },
3310
 
3311
 
3312
    getUpdater : function(){
3313
        if(!this.updateManager){
3314
            this.updateManager = new Ext.Updater(this);
3315
        }
3316
        return this.updateManager;
3317
    },
3318
 
3319
 
3320
    unselectable : function(){
3321
        this.dom.unselectable = "on";
3322
        this.swallowEvent("selectstart", true);
3323
        this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");
3324
        this.addClass("x-unselectable");
3325
        return this;
3326
    },
3327
 
3328
 
3329
    getCenterXY : function(){
3330
        return this.getAlignToXY(document, 'c-c');
3331
    },
3332
 
3333
 
3334
    center : function(centerIn){
3335
        this.alignTo(centerIn || document, 'c-c');
3336
        return this;
3337
    },
3338
 
3339
 
3340
    isBorderBox : function(){
3341
        return noBoxAdjust[this.dom.tagName.toLowerCase()] || Ext.isBorderBox;
3342
    },
3343
 
3344
 
3345
    getBox : function(contentBox, local){
3346
        var xy;
3347
        if(!local){
3348
            xy = this.getXY();
3349
        }else{
3350
            var left = parseInt(this.getStyle("left"), 10) || 0;
3351
            var top = parseInt(this.getStyle("top"), 10) || 0;
3352
            xy = [left, top];
3353
        }
3354
        var el = this.dom, w = el.offsetWidth, h = el.offsetHeight, bx;
3355
        if(!contentBox){
3356
            bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h};
3357
        }else{
3358
            var l = this.getBorderWidth("l")+this.getPadding("l");
3359
            var r = this.getBorderWidth("r")+this.getPadding("r");
3360
            var t = this.getBorderWidth("t")+this.getPadding("t");
3361
            var b = this.getBorderWidth("b")+this.getPadding("b");
3362
            bx = {x: xy[0]+l, y: xy[1]+t, 0: xy[0]+l, 1: xy[1]+t, width: w-(l+r), height: h-(t+b)};
3363
        }
3364
        bx.right = bx.x + bx.width;
3365
        bx.bottom = bx.y + bx.height;
3366
        return bx;
3367
    },
3368
 
3369
 
3370
    getFrameWidth : function(sides, onlyContentBox){
3371
        return onlyContentBox && Ext.isBorderBox ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));
3372
    },
3373
 
3374
 
3375
    setBox : function(box, adjust, animate){
3376
        var w = box.width, h = box.height;
3377
        if((adjust && !this.autoBoxAdjust) && !this.isBorderBox()){
3378
           w -= (this.getBorderWidth("lr") + this.getPadding("lr"));
3379
           h -= (this.getBorderWidth("tb") + this.getPadding("tb"));
3380
        }
3381
        this.setBounds(box.x, box.y, w, h, this.preanim(arguments, 2));
3382
        return this;
3383
    },
3384
 
3385
 
3386
     repaint : function(){
3387
        var dom = this.dom;
3388
        this.addClass("x-repaint");
3389
        setTimeout(function(){
3390
            Ext.get(dom).removeClass("x-repaint");
3391
        }, 1);
3392
        return this;
3393
    },
3394
 
3395
 
3396
    getMargins : function(side){
3397
        if(!side){
3398
            return {
3399
                top: parseInt(this.getStyle("margin-top"), 10) || 0,
3400
                left: parseInt(this.getStyle("margin-left"), 10) || 0,
3401
                bottom: parseInt(this.getStyle("margin-bottom"), 10) || 0,
3402
                right: parseInt(this.getStyle("margin-right"), 10) || 0
3403
            };
3404
        }else{
3405
            return this.addStyles(side, El.margins);
3406
         }
3407
    },
3408
 
3409
        addStyles : function(sides, styles){
3410
        var val = 0, v, w;
3411
        for(var i = 0, len = sides.length; i < len; i++){
3412
            v = this.getStyle(styles[sides.charAt(i)]);
3413
            if(v){
3414
                 w = parseInt(v, 10);
3415
                 if(w){ val += (w >= 0 ? w : -1 * w); }
3416
            }
3417
        }
3418
        return val;
3419
    },
3420
 
3421
 
3422
    createProxy : function(config, renderTo, matchBox){
3423
        config = typeof config == "object" ?
3424
            config : {tag : "div", cls: config};
3425
 
3426
        var proxy;
3427
        if(renderTo){
3428
            proxy = Ext.DomHelper.append(renderTo, config, true);
3429
        }else {
3430
            proxy = Ext.DomHelper.insertBefore(this.dom, config, true);
3431
        }
3432
        if(matchBox){
3433
           proxy.setBox(this.getBox());
3434
        }
3435
        return proxy;
3436
    },
3437
 
3438
 
3439
    mask : function(msg, msgCls){
3440
        if(this.getStyle("position") == "static"){
3441
            this.setStyle("position", "relative");
3442
        }
3443
        if(this._maskMsg){
3444
            this._maskMsg.remove();
3445
        }
3446
        if(this._mask){
3447
            this._mask.remove();
3448
        }
3449
 
3450
        this._mask = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask"}, true);
3451
 
3452
        this.addClass("x-masked");
3453
        this._mask.setDisplayed(true);
3454
        if(typeof msg == 'string'){
3455
            this._maskMsg = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask-msg", cn:{tag:'div'}}, true);
3456
            var mm = this._maskMsg;
3457
            mm.dom.className = msgCls ? "ext-el-mask-msg " + msgCls : "ext-el-mask-msg";
3458
            mm.dom.firstChild.innerHTML = msg;
3459
            mm.setDisplayed(true);
3460
            mm.center(this);
3461
        }
3462
        if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && this.getStyle('height') == 'auto'){             this._mask.setSize(this.dom.clientWidth, this.getHeight());
3463
        }
3464
        return this._mask;
3465
    },
3466
 
3467
 
3468
    unmask : function(){
3469
        if(this._mask){
3470
            if(this._maskMsg){
3471
                this._maskMsg.remove();
3472
                delete this._maskMsg;
3473
            }
3474
            this._mask.remove();
3475
            delete this._mask;
3476
        }
3477
        this.removeClass("x-masked");
3478
    },
3479
 
3480
 
3481
    isMasked : function(){
3482
        return this._mask && this._mask.isVisible();
3483
    },
3484
 
3485
 
3486
    createShim : function(){
3487
        var el = document.createElement('iframe');
3488
        el.frameBorder = 'no';
3489
        el.className = 'ext-shim';
3490
        if(Ext.isIE && Ext.isSecure){
3491
            el.src = Ext.SSL_SECURE_URL;
3492
        }
3493
        var shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
3494
        shim.autoBoxAdjust = false;
3495
        return shim;
3496
    },
3497
 
3498
 
3499
    remove : function(){
3500
        Ext.removeNode(this.dom);
3501
        delete El.cache[this.dom.id];
3502
    },
3503
 
3504
 
3505
    hover : function(overFn, outFn, scope){
3506
        var preOverFn = function(e){
3507
            if(!e.within(this, true)){
3508
                overFn.apply(scope || this, arguments);
3509
            }
3510
        };
3511
        var preOutFn = function(e){
3512
            if(!e.within(this, true)){
3513
                outFn.apply(scope || this, arguments);
3514
            }
3515
        };
3516
        this.on("mouseover", preOverFn, this.dom);
3517
        this.on("mouseout", preOutFn, this.dom);
3518
        return this;
3519
    },
3520
 
3521
 
3522
    addClassOnOver : function(className, preventFlicker){
3523
        this.hover(
3524
            function(){
3525
                Ext.fly(this, '_internal').addClass(className);
3526
            },
3527
            function(){
3528
                Ext.fly(this, '_internal').removeClass(className);
3529
            }
3530
        );
3531
        return this;
3532
    },
3533
 
3534
 
3535
    addClassOnFocus : function(className){
3536
        this.on("focus", function(){
3537
            Ext.fly(this, '_internal').addClass(className);
3538
        }, this.dom);
3539
        this.on("blur", function(){
3540
            Ext.fly(this, '_internal').removeClass(className);
3541
        }, this.dom);
3542
        return this;
3543
    },
3544
 
3545
    addClassOnClick : function(className){
3546
        var dom = this.dom;
3547
        this.on("mousedown", function(){
3548
            Ext.fly(dom, '_internal').addClass(className);
3549
            var d = Ext.getDoc();
3550
            var fn = function(){
3551
                Ext.fly(dom, '_internal').removeClass(className);
3552
                d.removeListener("mouseup", fn);
3553
            };
3554
            d.on("mouseup", fn);
3555
        });
3556
        return this;
3557
    },
3558
 
3559
 
3560
    swallowEvent : function(eventName, preventDefault){
3561
        var fn = function(e){
3562
            e.stopPropagation();
3563
            if(preventDefault){
3564
                e.preventDefault();
3565
            }
3566
        };
3567
        if(Ext.isArray(eventName)){
3568
            for(var i = 0, len = eventName.length; i < len; i++){
3569
                 this.on(eventName[i], fn);
3570
            }
3571
            return this;
3572
        }
3573
        this.on(eventName, fn);
3574
        return this;
3575
    },
3576
 
3577
 
3578
    parent : function(selector, returnDom){
3579
        return this.matchNode('parentNode', 'parentNode', selector, returnDom);
3580
    },
3581
 
3582
 
3583
    next : function(selector, returnDom){
3584
        return this.matchNode('nextSibling', 'nextSibling', selector, returnDom);
3585
    },
3586
 
3587
 
3588
    prev : function(selector, returnDom){
3589
        return this.matchNode('previousSibling', 'previousSibling', selector, returnDom);
3590
    },
3591
 
3592
 
3593
 
3594
    first : function(selector, returnDom){
3595
        return this.matchNode('nextSibling', 'firstChild', selector, returnDom);
3596
    },
3597
 
3598
 
3599
    last : function(selector, returnDom){
3600
        return this.matchNode('previousSibling', 'lastChild', selector, returnDom);
3601
    },
3602
 
3603
    matchNode : function(dir, start, selector, returnDom){
3604
        var n = this.dom[start];
3605
        while(n){
3606
            if(n.nodeType == 1 && (!selector || Ext.DomQuery.is(n, selector))){
3607
                return !returnDom ? Ext.get(n) : n;
3608
            }
3609
            n = n[dir];
3610
        }
3611
        return null;
3612
    },
3613
 
3614
 
3615
    appendChild: function(el){
3616
        el = Ext.get(el);
3617
        el.appendTo(this);
3618
        return this;
3619
    },
3620
 
3621
 
3622
    createChild: function(config, insertBefore, returnDom){
3623
        config = config || {tag:'div'};
3624
        if(insertBefore){
3625
            return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
3626
        }
3627
        return Ext.DomHelper[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config,  returnDom !== true);
3628
    },
3629
 
3630
 
3631
    appendTo: function(el){
3632
        el = Ext.getDom(el);
3633
        el.appendChild(this.dom);
3634
        return this;
3635
    },
3636
 
3637
 
3638
    insertBefore: function(el){
3639
        el = Ext.getDom(el);
3640
        el.parentNode.insertBefore(this.dom, el);
3641
        return this;
3642
    },
3643
 
3644
 
3645
    insertAfter: function(el){
3646
        el = Ext.getDom(el);
3647
        el.parentNode.insertBefore(this.dom, el.nextSibling);
3648
        return this;
3649
    },
3650
 
3651
 
3652
    insertFirst: function(el, returnDom){
3653
        el = el || {};
3654
        if(typeof el == 'object' && !el.nodeType && !el.dom){             return this.createChild(el, this.dom.firstChild, returnDom);
3655
        }else{
3656
            el = Ext.getDom(el);
3657
            this.dom.insertBefore(el, this.dom.firstChild);
3658
            return !returnDom ? Ext.get(el) : el;
3659
        }
3660
    },
3661
 
3662
 
3663
    insertSibling: function(el, where, returnDom){
3664
        var rt;
3665
        if(Ext.isArray(el)){
3666
            for(var i = 0, len = el.length; i < len; i++){
3667
                rt = this.insertSibling(el[i], where, returnDom);
3668
            }
3669
            return rt;
3670
        }
3671
        where = where ? where.toLowerCase() : 'before';
3672
        el = el || {};
3673
        var refNode = where == 'before' ? this.dom : this.dom.nextSibling;
3674
 
3675
        if(typeof el == 'object' && !el.nodeType && !el.dom){             if(where == 'after' && !this.dom.nextSibling){
3676
                rt = Ext.DomHelper.append(this.dom.parentNode, el, !returnDom);
3677
            }else{
3678
                rt = Ext.DomHelper[where == 'after' ? 'insertAfter' : 'insertBefore'](this.dom, el, !returnDom);
3679
            }
3680
 
3681
        }else{
3682
            rt = this.dom.parentNode.insertBefore(Ext.getDom(el), refNode);
3683
            if(!returnDom){
3684
                rt = Ext.get(rt);
3685
            }
3686
        }
3687
        return rt;
3688
    },
3689
 
3690
 
3691
    wrap: function(config, returnDom){
3692
        if(!config){
3693
            config = {tag: "div"};
3694
        }
3695
        var newEl = Ext.DomHelper.insertBefore(this.dom, config, !returnDom);
3696
        newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);
3697
        return newEl;
3698
    },
3699
 
3700
 
3701
    replace: function(el){
3702
        el = Ext.get(el);
3703
        this.insertBefore(el);
3704
        el.remove();
3705
        return this;
3706
    },
3707
 
3708
 
3709
    replaceWith: function(el){
3710
        if(typeof el == 'object' && !el.nodeType && !el.dom){             el = this.insertSibling(el, 'before');
3711
        }else{
3712
            el = Ext.getDom(el);
3713
            this.dom.parentNode.insertBefore(el, this.dom);
3714
        }
3715
        El.uncache(this.id);
3716
        this.dom.parentNode.removeChild(this.dom);
3717
        this.dom = el;
3718
        this.id = Ext.id(el);
3719
        El.cache[this.id] = this;
3720
        return this;
3721
    },
3722
 
3723
 
3724
    insertHtml : function(where, html, returnEl){
3725
        var el = Ext.DomHelper.insertHtml(where, this.dom, html);
3726
        return returnEl ? Ext.get(el) : el;
3727
    },
3728
 
3729
 
3730
    set : function(o, useSet){
3731
        var el = this.dom;
3732
        useSet = typeof useSet == 'undefined' ? (el.setAttribute ? true : false) : useSet;
3733
        for(var attr in o){
3734
            if(attr == "style" || typeof o[attr] == "function") continue;
3735
            if(attr=="cls"){
3736
                el.className = o["cls"];
3737
            }else if(o.hasOwnProperty(attr)){
3738
                if(useSet) el.setAttribute(attr, o[attr]);
3739
                else el[attr] = o[attr];
3740
            }
3741
        }
3742
        if(o.style){
3743
            Ext.DomHelper.applyStyles(el, o.style);
3744
        }
3745
        return this;
3746
    },
3747
 
3748
 
3749
    addKeyListener : function(key, fn, scope){
3750
        var config;
3751
        if(typeof key != "object" || Ext.isArray(key)){
3752
            config = {
3753
                key: key,
3754
                fn: fn,
3755
                scope: scope
3756
            };
3757
        }else{
3758
            config = {
3759
                key : key.key,
3760
                shift : key.shift,
3761
                ctrl : key.ctrl,
3762
                alt : key.alt,
3763
                fn: fn,
3764
                scope: scope
3765
            };
3766
        }
3767
        return new Ext.KeyMap(this, config);
3768
    },
3769
 
3770
 
3771
    addKeyMap : function(config){
3772
        return new Ext.KeyMap(this, config);
3773
    },
3774
 
3775
 
3776
     isScrollable : function(){
3777
        var dom = this.dom;
3778
        return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
3779
    },
3780
 
3781
 
3782
    scrollTo : function(side, value, animate){
3783
        var prop = side.toLowerCase() == "left" ? "scrollLeft" : "scrollTop";
3784
        if(!animate || !A){
3785
            this.dom[prop] = value;
3786
        }else{
3787
            var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [this.dom.scrollLeft, value];
3788
            this.anim({scroll: {"to": to}}, this.preanim(arguments, 2), 'scroll');
3789
        }
3790
        return this;
3791
    },
3792
 
3793
 
3794
     scroll : function(direction, distance, animate){
3795
         if(!this.isScrollable()){
3796
             return;
3797
         }
3798
         var el = this.dom;
3799
         var l = el.scrollLeft, t = el.scrollTop;
3800
         var w = el.scrollWidth, h = el.scrollHeight;
3801
         var cw = el.clientWidth, ch = el.clientHeight;
3802
         direction = direction.toLowerCase();
3803
         var scrolled = false;
3804
         var a = this.preanim(arguments, 2);
3805
         switch(direction){
3806
             case "l":
3807
             case "left":
3808
                 if(w - l > cw){
3809
                     var v = Math.min(l + distance, w-cw);
3810
                     this.scrollTo("left", v, a);
3811
                     scrolled = true;
3812
                 }
3813
                 break;
3814
            case "r":
3815
            case "right":
3816
                 if(l > 0){
3817
                     var v = Math.max(l - distance, 0);
3818
                     this.scrollTo("left", v, a);
3819
                     scrolled = true;
3820
                 }
3821
                 break;
3822
            case "t":
3823
            case "top":
3824
            case "up":
3825
                 if(t > 0){
3826
                     var v = Math.max(t - distance, 0);
3827
                     this.scrollTo("top", v, a);
3828
                     scrolled = true;
3829
                 }
3830
                 break;
3831
            case "b":
3832
            case "bottom":
3833
            case "down":
3834
                 if(h - t > ch){
3835
                     var v = Math.min(t + distance, h-ch);
3836
                     this.scrollTo("top", v, a);
3837
                     scrolled = true;
3838
                 }
3839
                 break;
3840
         }
3841
         return scrolled;
3842
    },
3843
 
3844
 
3845
    translatePoints : function(x, y){
3846
        if(typeof x == 'object' || Ext.isArray(x)){
3847
            y = x[1]; x = x[0];
3848
        }
3849
        var p = this.getStyle('position');
3850
        var o = this.getXY();
3851
 
3852
        var l = parseInt(this.getStyle('left'), 10);
3853
        var t = parseInt(this.getStyle('top'), 10);
3854
 
3855
        if(isNaN(l)){
3856
            l = (p == "relative") ? 0 : this.dom.offsetLeft;
3857
        }
3858
        if(isNaN(t)){
3859
            t = (p == "relative") ? 0 : this.dom.offsetTop;
3860
        }
3861
 
3862
        return {left: (x - o[0] + l), top: (y - o[1] + t)};
3863
    },
3864
 
3865
 
3866
    getScroll : function(){
3867
        var d = this.dom, doc = document;
3868
        if(d == doc || d == doc.body){
3869
            var l, t;
3870
            if(Ext.isIE && Ext.isStrict){
3871
                l = doc.documentElement.scrollLeft || (doc.body.scrollLeft || 0);
3872
                t = doc.documentElement.scrollTop || (doc.body.scrollTop || 0);
3873
            }else{
3874
                l = window.pageXOffset || (doc.body.scrollLeft || 0);
3875
                t = window.pageYOffset || (doc.body.scrollTop || 0);
3876
            }
3877
            return {left: l, top: t};
3878
        }else{
3879
            return {left: d.scrollLeft, top: d.scrollTop};
3880
        }
3881
    },
3882
 
3883
 
3884
    getColor : function(attr, defaultValue, prefix){
3885
        var v = this.getStyle(attr);
3886
        if(!v || v == "transparent" || v == "inherit") {
3887
            return defaultValue;
3888
        }
3889
        var color = typeof prefix == "undefined" ? "#" : prefix;
3890
        if(v.substr(0, 4) == "rgb("){
3891
            var rvs = v.slice(4, v.length -1).split(",");
3892
            for(var i = 0; i < 3; i++){
3893
                var h = parseInt(rvs[i]);
3894
                var s = h.toString(16);
3895
                if(h < 16){
3896
                    s = "0" + s;
3897
                }
3898
                color += s;
3899
            }
3900
        } else {
3901
            if(v.substr(0, 1) == "#"){
3902
                if(v.length == 4) {
3903
                    for(var i = 1; i < 4; i++){
3904
                        var c = v.charAt(i);
3905
                        color +=  c + c;
3906
                    }
3907
                }else if(v.length == 7){
3908
                    color += v.substr(1);
3909
                }
3910
            }
3911
        }
3912
        return(color.length > 5 ? color.toLowerCase() : defaultValue);
3913
    },
3914
 
3915
 
3916
    boxWrap : function(cls){
3917
        cls = cls || 'x-box';
3918
        var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+El.boxMarkup+'</div>', cls)));
3919
        el.child('.'+cls+'-mc').dom.appendChild(this.dom);
3920
        return el;
3921
    },
3922
 
3923
 
3924
    getAttributeNS : Ext.isIE ? function(ns, name){
3925
        var d = this.dom;
3926
        var type = typeof d[ns+":"+name];
3927
        if(type != 'undefined' && type != 'unknown'){
3928
            return d[ns+":"+name];
3929
        }
3930
        return d[name];
3931
    } : function(ns, name){
3932
        var d = this.dom;
3933
        return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name];
3934
    },
3935
 
3936
    getTextWidth : function(text, min, max){
3937
        return (Ext.util.TextMetrics.measure(this.dom, Ext.value(text, this.dom.innerHTML, true)).width).constrain(min || 0, max || 1000000);
3938
    }
3939
};
3940
 
3941
var ep = El.prototype;
3942
 
3943
 
3944
ep.on = ep.addListener;
3945
    ep.mon = ep.addListener;
3946
 
3947
ep.getUpdateManager = ep.getUpdater;
3948
 
3949
 
3950
ep.un = ep.removeListener;
3951
 
3952
 
3953
ep.autoBoxAdjust = true;
3954
 
3955
El.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;
3956
 
3957
El.addUnits = function(v, defaultUnit){
3958
    if(v === "" || v == "auto"){
3959
        return v;
3960
    }
3961
    if(v === undefined){
3962
        return '';
3963
    }
3964
    if(typeof v == "number" || !El.unitPattern.test(v)){
3965
        return v + (defaultUnit || 'px');
3966
    }
3967
    return v;
3968
};
3969
 
3970
El.boxMarkup = '<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';
3971
 
3972
El.VISIBILITY = 1;
3973
 
3974
El.DISPLAY = 2;
3975
 
3976
El.borders = {l: "border-left-width", r: "border-right-width", t: "border-top-width", b: "border-bottom-width"};
3977
El.paddings = {l: "padding-left", r: "padding-right", t: "padding-top", b: "padding-bottom"};
3978
El.margins = {l: "margin-left", r: "margin-right", t: "margin-top", b: "margin-bottom"};
3979
 
3980
 
3981
 
3982
 
3983
El.cache = {};
3984
 
3985
var docEl;
3986
 
3987
 
3988
El.get = function(el){
3989
    var ex, elm, id;
3990
    if(!el){ return null; }
3991
    if(typeof el == "string"){         if(!(elm = document.getElementById(el))){
3992
            return null;
3993
        }
3994
        if(ex = El.cache[el]){
3995
            ex.dom = elm;
3996
        }else{
3997
            ex = El.cache[el] = new El(elm);
3998
        }
3999
        return ex;
4000
    }else if(el.tagName){         if(!(id = el.id)){
4001
            id = Ext.id(el);
4002
        }
4003
        if(ex = El.cache[id]){
4004
            ex.dom = el;
4005
        }else{
4006
            ex = El.cache[id] = new El(el);
4007
        }
4008
        return ex;
4009
    }else if(el instanceof El){
4010
        if(el != docEl){
4011
            el.dom = document.getElementById(el.id) || el.dom;                                                                       El.cache[el.id] = el;         }
4012
        return el;
4013
    }else if(el.isComposite){
4014
        return el;
4015
    }else if(Ext.isArray(el)){
4016
        return El.select(el);
4017
    }else if(el == document){
4018
                if(!docEl){
4019
            var f = function(){};
4020
            f.prototype = El.prototype;
4021
            docEl = new f();
4022
            docEl.dom = document;
4023
        }
4024
        return docEl;
4025
    }
4026
    return null;
4027
};
4028
 
4029
El.uncache = function(el){
4030
    for(var i = 0, a = arguments, len = a.length; i < len; i++) {
4031
        if(a[i]){
4032
            delete El.cache[a[i].id || a[i]];
4033
        }
4034
    }
4035
};
4036
 
4037
El.garbageCollect = function(){
4038
    if(!Ext.enableGarbageCollector){
4039
        clearInterval(El.collectorThread);
4040
        return;
4041
    }
4042
    for(var eid in El.cache){
4043
        var el = El.cache[eid], d = el.dom;
4044
                                                                                                                                                if(!d || !d.parentNode || (!d.offsetParent && !document.getElementById(eid))){
4045
            delete El.cache[eid];
4046
            if(d && Ext.enableListenerCollection){
4047
                E.purgeElement(d);
4048
            }
4049
        }
4050
    }
4051
}
4052
El.collectorThreadId = setInterval(El.garbageCollect, 30000);
4053
 
4054
var flyFn = function(){};
4055
flyFn.prototype = El.prototype;
4056
var _cls = new flyFn();
4057
 
4058
El.Flyweight = function(dom){
4059
    this.dom = dom;
4060
};
4061
 
4062
El.Flyweight.prototype = _cls;
4063
El.Flyweight.prototype.isFlyweight = true;
4064
 
4065
El._flyweights = {};
4066
 
4067
El.fly = function(el, named){
4068
    named = named || '_global';
4069
    el = Ext.getDom(el);
4070
    if(!el){
4071
        return null;
4072
    }
4073
    if(!El._flyweights[named]){
4074
        El._flyweights[named] = new El.Flyweight();
4075
    }
4076
    El._flyweights[named].dom = el;
4077
    return El._flyweights[named];
4078
};
4079
 
4080
 
4081
Ext.get = El.get;
4082
 
4083
Ext.fly = El.fly;
4084
 
4085
var noBoxAdjust = Ext.isStrict ? {
4086
    select:1
4087
} : {
4088
    input:1, select:1, textarea:1
4089
};
4090
if(Ext.isIE || Ext.isGecko){
4091
    noBoxAdjust['button'] = 1;
4092
}
4093
 
4094
 
4095
Ext.EventManager.on(window, 'unload', function(){
4096
    delete El.cache;
4097
    delete El._flyweights;
4098
});
4099
})();
4100
 
4101
Ext.enableFx = true;
4102
 
4103
 
4104
Ext.Fx = {
4105
 
4106
    slideIn : function(anchor, o){
4107
        var el = this.getFxEl();
4108
        o = o || {};
4109
 
4110
        el.queueFx(o, function(){
4111
 
4112
            anchor = anchor || "t";
4113
 
4114
                        this.fixDisplay();
4115
 
4116
                        var r = this.getFxRestore();
4117
            var b = this.getBox();
4118
                        this.setSize(b);
4119
 
4120
                        var wrap = this.fxWrap(r.pos, o, "hidden");
4121
 
4122
            var st = this.dom.style;
4123
            st.visibility = "visible";
4124
            st.position = "absolute";
4125
 
4126
                        var after = function(){
4127
                el.fxUnwrap(wrap, r.pos, o);
4128
                st.width = r.width;
4129
                st.height = r.height;
4130
                el.afterFx(o);
4131
            };
4132
                        var a, pt = {to: [b.x, b.y]}, bw = {to: b.width}, bh = {to: b.height};
4133
 
4134
            switch(anchor.toLowerCase()){
4135
                case "t":
4136
                    wrap.setSize(b.width, 0);
4137
                    st.left = st.bottom = "0";
4138
                    a = {height: bh};
4139
                break;
4140
                case "l":
4141
                    wrap.setSize(0, b.height);
4142
                    st.right = st.top = "0";
4143
                    a = {width: bw};
4144
                break;
4145
                case "r":
4146
                    wrap.setSize(0, b.height);
4147
                    wrap.setX(b.right);
4148
                    st.left = st.top = "0";
4149
                    a = {width: bw, points: pt};
4150
                break;
4151
                case "b":
4152
                    wrap.setSize(b.width, 0);
4153
                    wrap.setY(b.bottom);
4154
                    st.left = st.top = "0";
4155
                    a = {height: bh, points: pt};
4156
                break;
4157
                case "tl":
4158
                    wrap.setSize(0, 0);
4159
                    st.right = st.bottom = "0";
4160
                    a = {width: bw, height: bh};
4161
                break;
4162
                case "bl":
4163
                    wrap.setSize(0, 0);
4164
                    wrap.setY(b.y+b.height);
4165
                    st.right = st.top = "0";
4166
                    a = {width: bw, height: bh, points: pt};
4167
                break;
4168
                case "br":
4169
                    wrap.setSize(0, 0);
4170
                    wrap.setXY([b.right, b.bottom]);
4171
                    st.left = st.top = "0";
4172
                    a = {width: bw, height: bh, points: pt};
4173
                break;
4174
                case "tr":
4175
                    wrap.setSize(0, 0);
4176
                    wrap.setX(b.x+b.width);
4177
                    st.left = st.bottom = "0";
4178
                    a = {width: bw, height: bh, points: pt};
4179
                break;
4180
            }
4181
            this.dom.style.visibility = "visible";
4182
            wrap.show();
4183
 
4184
            arguments.callee.anim = wrap.fxanim(a,
4185
                o,
4186
                'motion',
4187
                .5,
4188
                'easeOut', after);
4189
        });
4190
        return this;
4191
    },
4192
 
4193
 
4194
    slideOut : function(anchor, o){
4195
        var el = this.getFxEl();
4196
        o = o || {};
4197
 
4198
        el.queueFx(o, function(){
4199
 
4200
            anchor = anchor || "t";
4201
 
4202
                        var r = this.getFxRestore();
4203
 
4204
            var b = this.getBox();
4205
                        this.setSize(b);
4206
 
4207
                        var wrap = this.fxWrap(r.pos, o, "visible");
4208
 
4209
            var st = this.dom.style;
4210
            st.visibility = "visible";
4211
            st.position = "absolute";
4212
 
4213
            wrap.setSize(b);
4214
 
4215
            var after = function(){
4216
                if(o.useDisplay){
4217
                    el.setDisplayed(false);
4218
                }else{
4219
                    el.hide();
4220
                }
4221
 
4222
                el.fxUnwrap(wrap, r.pos, o);
4223
 
4224
                st.width = r.width;
4225
                st.height = r.height;
4226
 
4227
                el.afterFx(o);
4228
            };
4229
 
4230
            var a, zero = {to: 0};
4231
            switch(anchor.toLowerCase()){
4232
                case "t":
4233
                    st.left = st.bottom = "0";
4234
                    a = {height: zero};
4235
                break;
4236
                case "l":
4237
                    st.right = st.top = "0";
4238
                    a = {width: zero};
4239
                break;
4240
                case "r":
4241
                    st.left = st.top = "0";
4242
                    a = {width: zero, points: {to:[b.right, b.y]}};
4243
                break;
4244
                case "b":
4245
                    st.left = st.top = "0";
4246
                    a = {height: zero, points: {to:[b.x, b.bottom]}};
4247
                break;
4248
                case "tl":
4249
                    st.right = st.bottom = "0";
4250
                    a = {width: zero, height: zero};
4251
                break;
4252
                case "bl":
4253
                    st.right = st.top = "0";
4254
                    a = {width: zero, height: zero, points: {to:[b.x, b.bottom]}};
4255
                break;
4256
                case "br":
4257
                    st.left = st.top = "0";
4258
                    a = {width: zero, height: zero, points: {to:[b.x+b.width, b.bottom]}};
4259
                break;
4260
                case "tr":
4261
                    st.left = st.bottom = "0";
4262
                    a = {width: zero, height: zero, points: {to:[b.right, b.y]}};
4263
                break;
4264
            }
4265
 
4266
            arguments.callee.anim = wrap.fxanim(a,
4267
                o,
4268
                'motion',
4269
                .5,
4270
                "easeOut", after);
4271
        });
4272
        return this;
4273
    },
4274
 
4275
 
4276
    puff : function(o){
4277
        var el = this.getFxEl();
4278
        o = o || {};
4279
 
4280
        el.queueFx(o, function(){
4281
            this.clearOpacity();
4282
            this.show();
4283
 
4284
                        var r = this.getFxRestore();
4285
            var st = this.dom.style;
4286
 
4287
            var after = function(){
4288
                if(o.useDisplay){
4289
                    el.setDisplayed(false);
4290
                }else{
4291
                    el.hide();
4292
                }
4293
 
4294
                el.clearOpacity();
4295
 
4296
                el.setPositioning(r.pos);
4297
                st.width = r.width;
4298
                st.height = r.height;
4299
                st.fontSize = '';
4300
                el.afterFx(o);
4301
            };
4302
 
4303
            var width = this.getWidth();
4304
            var height = this.getHeight();
4305
 
4306
            arguments.callee.anim = this.fxanim({
4307
                    width : {to: this.adjustWidth(width * 2)},
4308
                    height : {to: this.adjustHeight(height * 2)},
4309
                    points : {by: [-(width * .5), -(height * .5)]},
4310
                    opacity : {to: 0},
4311
                    fontSize: {to:200, unit: "%"}
4312
                },
4313
                o,
4314
                'motion',
4315
                .5,
4316
                "easeOut", after);
4317
        });
4318
        return this;
4319
    },
4320
 
4321
 
4322
    switchOff : function(o){
4323
        var el = this.getFxEl();
4324
        o = o || {};
4325
 
4326
        el.queueFx(o, function(){
4327
            this.clearOpacity();
4328
            this.clip();
4329
 
4330
                        var r = this.getFxRestore();
4331
            var st = this.dom.style;
4332
 
4333
            var after = function(){
4334
                if(o.useDisplay){
4335
                    el.setDisplayed(false);
4336
                }else{
4337
                    el.hide();
4338
                }
4339
 
4340
                el.clearOpacity();
4341
                el.setPositioning(r.pos);
4342
                st.width = r.width;
4343
                st.height = r.height;
4344
 
4345
                el.afterFx(o);
4346
            };
4347
 
4348
            this.fxanim({opacity:{to:0.3}}, null, null, .1, null, function(){
4349
                this.clearOpacity();
4350
                (function(){
4351
                    this.fxanim({
4352
                        height:{to:1},
4353
                        points:{by:[0, this.getHeight() * .5]}
4354
                    }, o, 'motion', 0.3, 'easeIn', after);
4355
                }).defer(100, this);
4356
            });
4357
        });
4358
        return this;
4359
    },
4360
 
4361
 
4362
    highlight : function(color, o){
4363
        var el = this.getFxEl();
4364
        o = o || {};
4365
 
4366
        el.queueFx(o, function(){
4367
            color = color || "ffff9c";
4368
            var attr = o.attr || "backgroundColor";
4369
 
4370
            this.clearOpacity();
4371
            this.show();
4372
 
4373
            var origColor = this.getColor(attr);
4374
            var restoreColor = this.dom.style[attr];
4375
            var endColor = (o.endColor || origColor) || "ffffff";
4376
 
4377
            var after = function(){
4378
                el.dom.style[attr] = restoreColor;
4379
                el.afterFx(o);
4380
            };
4381
 
4382
            var a = {};
4383
            a[attr] = {from: color, to: endColor};
4384
            arguments.callee.anim = this.fxanim(a,
4385
                o,
4386
                'color',
4387
                1,
4388
                'easeIn', after);
4389
        });
4390
        return this;
4391
    },
4392
 
4393
 
4394
    frame : function(color, count, o){
4395
        var el = this.getFxEl();
4396
        o = o || {};
4397
 
4398
        el.queueFx(o, function(){
4399
            color = color || "#C3DAF9";
4400
            if(color.length == 6){
4401
                color = "#" + color;
4402
            }
4403
            count = count || 1;
4404
            var duration = o.duration || 1;
4405
            this.show();
4406
 
4407
            var b = this.getBox();
4408
            var animFn = function(){
4409
                var proxy = Ext.getBody().createChild({
4410
                     style:{
4411
                        visbility:"hidden",
4412
                        position:"absolute",
4413
                        "z-index":"35000",                         border:"0px solid " + color
4414
                     }
4415
                  });
4416
                var scale = Ext.isBorderBox ? 2 : 1;
4417
                proxy.animate({
4418
                    top:{from:b.y, to:b.y - 20},
4419
                    left:{from:b.x, to:b.x - 20},
4420
                    borderWidth:{from:0, to:10},
4421
                    opacity:{from:1, to:0},
4422
                    height:{from:b.height, to:(b.height + (20*scale))},
4423
                    width:{from:b.width, to:(b.width + (20*scale))}
4424
                }, duration, function(){
4425
                    proxy.remove();
4426
                    if(--count > 0){
4427
                         animFn();
4428
                    }else{
4429
                        el.afterFx(o);
4430
                    }
4431
                });
4432
            };
4433
            animFn.call(this);
4434
        });
4435
        return this;
4436
    },
4437
 
4438
 
4439
    pause : function(seconds){
4440
        var el = this.getFxEl();
4441
        var o = {};
4442
 
4443
        el.queueFx(o, function(){
4444
            setTimeout(function(){
4445
                el.afterFx(o);
4446
            }, seconds * 1000);
4447
        });
4448
        return this;
4449
    },
4450
 
4451
 
4452
    fadeIn : function(o){
4453
        var el = this.getFxEl();
4454
        o = o || {};
4455
        el.queueFx(o, function(){
4456
            this.setOpacity(0);
4457
            this.fixDisplay();
4458
            this.dom.style.visibility = 'visible';
4459
            var to = o.endOpacity || 1;
4460
            arguments.callee.anim = this.fxanim({opacity:{to:to}},
4461
                o, null, .5, "easeOut", function(){
4462
                if(to == 1){
4463
                    this.clearOpacity();
4464
                }
4465
                el.afterFx(o);
4466
            });
4467
        });
4468
        return this;
4469
    },
4470
 
4471
 
4472
    fadeOut : function(o){
4473
        var el = this.getFxEl();
4474
        o = o || {};
4475
        el.queueFx(o, function(){
4476
            arguments.callee.anim = this.fxanim({opacity:{to:o.endOpacity || 0}},
4477
                o, null, .5, "easeOut", function(){
4478
                if(this.visibilityMode == Ext.Element.DISPLAY || o.useDisplay){
4479
                     this.dom.style.display = "none";
4480
                }else{
4481
                     this.dom.style.visibility = "hidden";
4482
                }
4483
                this.clearOpacity();
4484
                el.afterFx(o);
4485
            });
4486
        });
4487
        return this;
4488
    },
4489
 
4490
 
4491
    scale : function(w, h, o){
4492
        this.shift(Ext.apply({}, o, {
4493
            width: w,
4494
            height: h
4495
        }));
4496
        return this;
4497
    },
4498
 
4499
 
4500
    shift : function(o){
4501
        var el = this.getFxEl();
4502
        o = o || {};
4503
        el.queueFx(o, function(){
4504
            var a = {}, w = o.width, h = o.height, x = o.x, y = o.y,  op = o.opacity;
4505
            if(w !== undefined){
4506
                a.width = {to: this.adjustWidth(w)};
4507
            }
4508
            if(h !== undefined){
4509
                a.height = {to: this.adjustHeight(h)};
4510
            }
4511
            if(x !== undefined || y !== undefined){
4512
                a.points = {to: [
4513
                    x !== undefined ? x : this.getX(),
4514
                    y !== undefined ? y : this.getY()
4515
                ]};
4516
            }
4517
            if(op !== undefined){
4518
                a.opacity = {to: op};
4519
            }
4520
            if(o.xy !== undefined){
4521
                a.points = {to: o.xy};
4522
            }
4523
            arguments.callee.anim = this.fxanim(a,
4524
                o, 'motion', .35, "easeOut", function(){
4525
                el.afterFx(o);
4526
            });
4527
        });
4528
        return this;
4529
    },
4530
 
4531
 
4532
    ghost : function(anchor, o){
4533
        var el = this.getFxEl();
4534
        o = o || {};
4535
 
4536
        el.queueFx(o, function(){
4537
            anchor = anchor || "b";
4538
 
4539
                        var r = this.getFxRestore();
4540
            var w = this.getWidth(),
4541
                h = this.getHeight();
4542
 
4543
            var st = this.dom.style;
4544
 
4545
            var after = function(){
4546
                if(o.useDisplay){
4547
                    el.setDisplayed(false);
4548
                }else{
4549
                    el.hide();
4550
                }
4551
 
4552
                el.clearOpacity();
4553
                el.setPositioning(r.pos);
4554
                st.width = r.width;
4555
                st.height = r.height;
4556
 
4557
                el.afterFx(o);
4558
            };
4559
 
4560
            var a = {opacity: {to: 0}, points: {}}, pt = a.points;
4561
            switch(anchor.toLowerCase()){
4562
                case "t":
4563
                    pt.by = [0, -h];
4564
                break;
4565
                case "l":
4566
                    pt.by = [-w, 0];
4567
                break;
4568
                case "r":
4569
                    pt.by = [w, 0];
4570
                break;
4571
                case "b":
4572
                    pt.by = [0, h];
4573
                break;
4574
                case "tl":
4575
                    pt.by = [-w, -h];
4576
                break;
4577
                case "bl":
4578
                    pt.by = [-w, h];
4579
                break;
4580
                case "br":
4581
                    pt.by = [w, h];
4582
                break;
4583
                case "tr":
4584
                    pt.by = [w, -h];
4585
                break;
4586
            }
4587
 
4588
            arguments.callee.anim = this.fxanim(a,
4589
                o,
4590
                'motion',
4591
                .5,
4592
                "easeOut", after);
4593
        });
4594
        return this;
4595
    },
4596
 
4597
 
4598
    syncFx : function(){
4599
        this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
4600
            block : false,
4601
            concurrent : true,
4602
            stopFx : false
4603
        });
4604
        return this;
4605
    },
4606
 
4607
 
4608
    sequenceFx : function(){
4609
        this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
4610
            block : false,
4611
            concurrent : false,
4612
            stopFx : false
4613
        });
4614
        return this;
4615
    },
4616
 
4617
 
4618
    nextFx : function(){
4619
        var ef = this.fxQueue[0];
4620
        if(ef){
4621
            ef.call(this);
4622
        }
4623
    },
4624
 
4625
 
4626
    hasActiveFx : function(){
4627
        return this.fxQueue && this.fxQueue[0];
4628
    },
4629
 
4630
 
4631
    stopFx : function(){
4632
        if(this.hasActiveFx()){
4633
            var cur = this.fxQueue[0];
4634
            if(cur && cur.anim && cur.anim.isAnimated()){
4635
                this.fxQueue = [cur];                 cur.anim.stop(true);
4636
            }
4637
        }
4638
        return this;
4639
    },
4640
 
4641
 
4642
    beforeFx : function(o){
4643
        if(this.hasActiveFx() && !o.concurrent){
4644
           if(o.stopFx){
4645
               this.stopFx();
4646
               return true;
4647
           }
4648
           return false;
4649
        }
4650
        return true;
4651
    },
4652
 
4653
 
4654
    hasFxBlock : function(){
4655
        var q = this.fxQueue;
4656
        return q && q[0] && q[0].block;
4657
    },
4658
 
4659
 
4660
    queueFx : function(o, fn){
4661
        if(!this.fxQueue){
4662
            this.fxQueue = [];
4663
        }
4664
        if(!this.hasFxBlock()){
4665
            Ext.applyIf(o, this.fxDefaults);
4666
            if(!o.concurrent){
4667
                var run = this.beforeFx(o);
4668
                fn.block = o.block;
4669
                this.fxQueue.push(fn);
4670
                if(run){
4671
                    this.nextFx();
4672
                }
4673
            }else{
4674
                fn.call(this);
4675
            }
4676
        }
4677
        return this;
4678
    },
4679
 
4680
 
4681
    fxWrap : function(pos, o, vis){
4682
        var wrap;
4683
        if(!o.wrap || !(wrap = Ext.get(o.wrap))){
4684
            var wrapXY;
4685
            if(o.fixPosition){
4686
                wrapXY = this.getXY();
4687
            }
4688
            var div = document.createElement("div");
4689
            div.style.visibility = vis;
4690
            wrap = Ext.get(this.dom.parentNode.insertBefore(div, this.dom));
4691
            wrap.setPositioning(pos);
4692
            if(wrap.getStyle("position") == "static"){
4693
                wrap.position("relative");
4694
            }
4695
            this.clearPositioning('auto');
4696
            wrap.clip();
4697
            wrap.dom.appendChild(this.dom);
4698
            if(wrapXY){
4699
                wrap.setXY(wrapXY);
4700
            }
4701
        }
4702
        return wrap;
4703
    },
4704
 
4705
 
4706
    fxUnwrap : function(wrap, pos, o){
4707
        this.clearPositioning();
4708
        this.setPositioning(pos);
4709
        if(!o.wrap){
4710
            wrap.dom.parentNode.insertBefore(this.dom, wrap.dom);
4711
            wrap.remove();
4712
        }
4713
    },
4714
 
4715
 
4716
    getFxRestore : function(){
4717
        var st = this.dom.style;
4718
        return {pos: this.getPositioning(), width: st.width, height : st.height};
4719
    },
4720
 
4721
 
4722
    afterFx : function(o){
4723
        if(o.afterStyle){
4724
            this.applyStyles(o.afterStyle);
4725
        }
4726
        if(o.afterCls){
4727
            this.addClass(o.afterCls);
4728
        }
4729
        if(o.remove === true){
4730
            this.remove();
4731
        }
4732
        Ext.callback(o.callback, o.scope, [this]);
4733
        if(!o.concurrent){
4734
            this.fxQueue.shift();
4735
            this.nextFx();
4736
        }
4737
    },
4738
 
4739
 
4740
    getFxEl : function(){         return Ext.get(this.dom);
4741
    },
4742
 
4743
 
4744
    fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){
4745
        animType = animType || 'run';
4746
        opt = opt || {};
4747
        var anim = Ext.lib.Anim[animType](
4748
            this.dom, args,
4749
            (opt.duration || defaultDur) || .35,
4750
            (opt.easing || defaultEase) || 'easeOut',
4751
            function(){
4752
                Ext.callback(cb, this);
4753
            },
4754
            this
4755
        );
4756
        opt.anim = anim;
4757
        return anim;
4758
    }
4759
};
4760
 
4761
Ext.Fx.resize = Ext.Fx.scale;
4762
 
4763
Ext.apply(Ext.Element.prototype, Ext.Fx);
4764
 
4765
 
4766
Ext.CompositeElement = function(els){
4767
    this.elements = [];
4768
    this.addElements(els);
4769
};
4770
Ext.CompositeElement.prototype = {
4771
    isComposite: true,
4772
    addElements : function(els){
4773
        if(!els) return this;
4774
        if(typeof els == "string"){
4775
            els = Ext.Element.selectorFunction(els);
4776
        }
4777
        var yels = this.elements;
4778
        var index = yels.length-1;
4779
        for(var i = 0, len = els.length; i < len; i++) {
4780
        	yels[++index] = Ext.get(els[i]);
4781
        }
4782
        return this;
4783
    },
4784
 
4785
 
4786
    fill : function(els){
4787
        this.elements = [];
4788
        this.add(els);
4789
        return this;
4790
    },
4791
 
4792
 
4793
    filter : function(selector){
4794
        var els = [];
4795
        this.each(function(el){
4796
            if(el.is(selector)){
4797
                els[els.length] = el.dom;
4798
            }
4799
        });
4800
        this.fill(els);
4801
        return this;
4802
    },
4803
 
4804
    invoke : function(fn, args){
4805
        var els = this.elements;
4806
        for(var i = 0, len = els.length; i < len; i++) {
4807
        	Ext.Element.prototype[fn].apply(els[i], args);
4808
        }
4809
        return this;
4810
    },
4811
 
4812
    add : function(els){
4813
        if(typeof els == "string"){
4814
            this.addElements(Ext.Element.selectorFunction(els));
4815
        }else if(els.length !== undefined){
4816
            this.addElements(els);
4817
        }else{
4818
            this.addElements([els]);
4819
        }
4820
        return this;
4821
    },
4822
 
4823
    each : function(fn, scope){
4824
        var els = this.elements;
4825
        for(var i = 0, len = els.length; i < len; i++){
4826
            if(fn.call(scope || els[i], els[i], this, i) === false) {
4827
                break;
4828
            }
4829
        }
4830
        return this;
4831
    },
4832
 
4833
 
4834
    item : function(index){
4835
        return this.elements[index] || null;
4836
    },
4837
 
4838
 
4839
    first : function(){
4840
        return this.item(0);
4841
    },
4842
 
4843
 
4844
    last : function(){
4845
        return this.item(this.elements.length-1);
4846
    },
4847
 
4848
 
4849
    getCount : function(){
4850
        return this.elements.length;
4851
    },
4852
 
4853
 
4854
    contains : function(el){
4855
        return this.indexOf(el) !== -1;
4856
    },
4857
 
4858
 
4859
    indexOf : function(el){
4860
        return this.elements.indexOf(Ext.get(el));
4861
    },
4862
 
4863
 
4864
 
4865
    removeElement : function(el, removeDom){
4866
        if(Ext.isArray(el)){
4867
            for(var i = 0, len = el.length; i < len; i++){
4868
                this.removeElement(el[i]);
4869
            }
4870
            return this;
4871
        }
4872
        var index = typeof el == 'number' ? el : this.indexOf(el);
4873
        if(index !== -1 && this.elements[index]){
4874
            if(removeDom){
4875
                var d = this.elements[index];
4876
                if(d.dom){
4877
                    d.remove();
4878
                }else{
4879
                    Ext.removeNode(d);
4880
                }
4881
            }
4882
            this.elements.splice(index, 1);
4883
        }
4884
        return this;
4885
    },
4886
 
4887
 
4888
    replaceElement : function(el, replacement, domReplace){
4889
        var index = typeof el == 'number' ? el : this.indexOf(el);
4890
        if(index !== -1){
4891
            if(domReplace){
4892
                this.elements[index].replaceWith(replacement);
4893
            }else{
4894
                this.elements.splice(index, 1, Ext.get(replacement))
4895
            }
4896
        }
4897
        return this;
4898
    },
4899
 
4900
 
4901
    clear : function(){
4902
        this.elements = [];
4903
    }
4904
};
4905
(function(){
4906
Ext.CompositeElement.createCall = function(proto, fnName){
4907
    if(!proto[fnName]){
4908
        proto[fnName] = function(){
4909
            return this.invoke(fnName, arguments);
4910
        };
4911
    }
4912
};
4913
for(var fnName in Ext.Element.prototype){
4914
    if(typeof Ext.Element.prototype[fnName] == "function"){
4915
        Ext.CompositeElement.createCall(Ext.CompositeElement.prototype, fnName);
4916
    }
4917
};
4918
})();
4919
 
4920
 
4921
Ext.CompositeElementLite = function(els){
4922
    Ext.CompositeElementLite.superclass.constructor.call(this, els);
4923
    this.el = new Ext.Element.Flyweight();
4924
};
4925
Ext.extend(Ext.CompositeElementLite, Ext.CompositeElement, {
4926
    addElements : function(els){
4927
        if(els){
4928
            if(Ext.isArray(els)){
4929
                this.elements = this.elements.concat(els);
4930
            }else{
4931
                var yels = this.elements;
4932
                var index = yels.length-1;
4933
                for(var i = 0, len = els.length; i < len; i++) {
4934
                    yels[++index] = els[i];
4935
                }
4936
            }
4937
        }
4938
        return this;
4939
    },
4940
    invoke : function(fn, args){
4941
        var els = this.elements;
4942
        var el = this.el;
4943
        for(var i = 0, len = els.length; i < len; i++) {
4944
            el.dom = els[i];
4945
        	Ext.Element.prototype[fn].apply(el, args);
4946
        }
4947
        return this;
4948
    },
4949
 
4950
    item : function(index){
4951
        if(!this.elements[index]){
4952
            return null;
4953
        }
4954
        this.el.dom = this.elements[index];
4955
        return this.el;
4956
    },
4957
 
4958
 
4959
    addListener : function(eventName, handler, scope, opt){
4960
        var els = this.elements;
4961
        for(var i = 0, len = els.length; i < len; i++) {
4962
            Ext.EventManager.on(els[i], eventName, handler, scope || els[i], opt);
4963
        }
4964
        return this;
4965
    },
4966
 
4967
 
4968
    each : function(fn, scope){
4969
        var els = this.elements;
4970
        var el = this.el;
4971
        for(var i = 0, len = els.length; i < len; i++){
4972
            el.dom = els[i];
4973
        	if(fn.call(scope || el, el, this, i) === false){
4974
                break;
4975
            }
4976
        }
4977
        return this;
4978
    },
4979
 
4980
    indexOf : function(el){
4981
        return this.elements.indexOf(Ext.getDom(el));
4982
    },
4983
 
4984
    replaceElement : function(el, replacement, domReplace){
4985
        var index = typeof el == 'number' ? el : this.indexOf(el);
4986
        if(index !== -1){
4987
            replacement = Ext.getDom(replacement);
4988
            if(domReplace){
4989
                var d = this.elements[index];
4990
                d.parentNode.insertBefore(replacement, d);
4991
                Ext.removeNode(d);
4992
            }
4993
            this.elements.splice(index, 1, replacement);
4994
        }
4995
        return this;
4996
    }
4997
});
4998
Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;
4999
if(Ext.DomQuery){
5000
    Ext.Element.selectorFunction = Ext.DomQuery.select;
5001
}
5002
 
5003
Ext.Element.select = function(selector, unique, root){
5004
    var els;
5005
    if(typeof selector == "string"){
5006
        els = Ext.Element.selectorFunction(selector, root);
5007
    }else if(selector.length !== undefined){
5008
        els = selector;
5009
    }else{
5010
        throw "Invalid selector";
5011
    }
5012
    if(unique === true){
5013
        return new Ext.CompositeElement(els);
5014
    }else{
5015
        return new Ext.CompositeElementLite(els);
5016
    }
5017
};
5018
 
5019
Ext.select = Ext.Element.select;
5020
 
5021
Ext.data.Connection = function(config){
5022
    Ext.apply(this, config);
5023
    this.addEvents(
5024
 
5025
        "beforerequest",
5026
 
5027
        "requestcomplete",
5028
 
5029
        "requestexception"
5030
    );
5031
    Ext.data.Connection.superclass.constructor.call(this);
5032
};
5033
 
5034
Ext.extend(Ext.data.Connection, Ext.util.Observable, {
5035
 
5036
 
5037
 
5038
 
5039
 
5040
    timeout : 30000,
5041
 
5042
    autoAbort:false,
5043
 
5044
 
5045
    disableCaching: true,
5046
 
5047
 
5048
    request : function(o){
5049
        if(this.fireEvent("beforerequest", this, o) !== false){
5050
            var p = o.params;
5051
 
5052
            if(typeof p == "function"){
5053
                p = p.call(o.scope||window, o);
5054
            }
5055
            if(typeof p == "object"){
5056
                p = Ext.urlEncode(p);
5057
            }
5058
            if(this.extraParams){
5059
                var extras = Ext.urlEncode(this.extraParams);
5060
                p = p ? (p + '&' + extras) : extras;
5061
            }
5062
 
5063
            var url = o.url || this.url;
5064
            if(typeof url == 'function'){
5065
                url = url.call(o.scope||window, o);
5066
            }
5067
 
5068
            if(o.form){
5069
                var form = Ext.getDom(o.form);
5070
                url = url || form.action;
5071
 
5072
                var enctype = form.getAttribute("enctype");
5073
                if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){
5074
                    return this.doFormUpload(o, p, url);
5075
                }
5076
                var f = Ext.lib.Ajax.serializeForm(form);
5077
                p = p ? (p + '&' + f) : f;
5078
            }
5079
 
5080
            var hs = o.headers;
5081
            if(this.defaultHeaders){
5082
                hs = Ext.apply(hs || {}, this.defaultHeaders);
5083
                if(!o.headers){
5084
                    o.headers = hs;
5085
                }
5086
            }
5087
 
5088
            var cb = {
5089
                success: this.handleResponse,
5090
                failure: this.handleFailure,
5091
                scope: this,
5092
                argument: {options: o},
5093
                timeout : o.timeout || this.timeout
5094
            };
5095
 
5096
            var method = o.method||this.method||(p ? "POST" : "GET");
5097
 
5098
            if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){
5099
                url += (url.indexOf('?') != -1 ? '&' : '?') + '_dc=' + (new Date().getTime());
5100
            }
5101
 
5102
            if(typeof o.autoAbort == 'boolean'){
5103
                if(o.autoAbort){
5104
                    this.abort();
5105
                }
5106
            }else if(this.autoAbort !== false){
5107
                this.abort();
5108
            }
5109
            if((method == 'GET' && p) || o.xmlData || o.jsonData){
5110
                url += (url.indexOf('?') != -1 ? '&' : '?') + p;
5111
                p = '';
5112
            }
5113
            this.transId = Ext.lib.Ajax.request(method, url, cb, p, o);
5114
            return this.transId;
5115
        }else{
5116
            Ext.callback(o.callback, o.scope, [o, null, null]);
5117
            return null;
5118
        }
5119
    },
5120
 
5121
 
5122
    isLoading : function(transId){
5123
        if(transId){
5124
            return Ext.lib.Ajax.isCallInProgress(transId);
5125
        }else{
5126
            return this.transId ? true : false;
5127
        }
5128
    },
5129
 
5130
 
5131
    abort : function(transId){
5132
        if(transId || this.isLoading()){
5133
            Ext.lib.Ajax.abort(transId || this.transId);
5134
        }
5135
    },
5136
 
5137
 
5138
    handleResponse : function(response){
5139
        this.transId = false;
5140
        var options = response.argument.options;
5141
        response.argument = options ? options.argument : null;
5142
        this.fireEvent("requestcomplete", this, response, options);
5143
        Ext.callback(options.success, options.scope, [response, options]);
5144
        Ext.callback(options.callback, options.scope, [options, true, response]);
5145
    },
5146
 
5147
 
5148
    handleFailure : function(response, e){
5149
        this.transId = false;
5150
        var options = response.argument.options;
5151
        response.argument = options ? options.argument : null;
5152
        this.fireEvent("requestexception", this, response, options, e);
5153
        Ext.callback(options.failure, options.scope, [response, options]);
5154
        Ext.callback(options.callback, options.scope, [options, false, response]);
5155
    },
5156
 
5157
 
5158
    doFormUpload : function(o, ps, url){
5159
        var id = Ext.id();
5160
        var frame = document.createElement('iframe');
5161
        frame.id = id;
5162
        frame.name = id;
5163
        frame.className = 'x-hidden';
5164
        if(Ext.isIE){
5165
            frame.src = Ext.SSL_SECURE_URL;
5166
        }
5167
        document.body.appendChild(frame);
5168
 
5169
        if(Ext.isIE){
5170
           document.frames[id].name = id;
5171
        }
5172
 
5173
        var form = Ext.getDom(o.form);
5174
        form.target = id;
5175
        form.method = 'POST';
5176
        form.enctype = form.encoding = 'multipart/form-data';
5177
        if(url){
5178
            form.action = url;
5179
        }
5180
 
5181
        var hiddens, hd;
5182
        if(ps){
5183
            hiddens = [];
5184
            ps = Ext.urlDecode(ps, false);
5185
            for(var k in ps){
5186
                if(ps.hasOwnProperty(k)){
5187
                    hd = document.createElement('input');
5188
                    hd.type = 'hidden';
5189
                    hd.name = k;
5190
                    hd.value = ps[k];
5191
                    form.appendChild(hd);
5192
                    hiddens.push(hd);
5193
                }
5194
            }
5195
        }
5196
 
5197
        function cb(){
5198
            var r = {
5199
                responseText : '',
5200
                responseXML : null
5201
            };
5202
 
5203
            r.argument = o ? o.argument : null;
5204
 
5205
            try {
5206
                var doc;
5207
                if(Ext.isIE){
5208
                    doc = frame.contentWindow.document;
5209
                }else {
5210
                    doc = (frame.contentDocument || window.frames[id].document);
5211
                }
5212
                if(doc && doc.body){
5213
                    r.responseText = doc.body.innerHTML;
5214
                }
5215
                if(doc && doc.XMLDocument){
5216
                    r.responseXML = doc.XMLDocument;
5217
                }else {
5218
                    r.responseXML = doc;
5219
                }
5220
            }
5221
            catch(e) {
5222
 
5223
            }
5224
 
5225
            Ext.EventManager.removeListener(frame, 'load', cb, this);
5226
 
5227
            this.fireEvent("requestcomplete", this, r, o);
5228
 
5229
            Ext.callback(o.success, o.scope, [r, o]);
5230
            Ext.callback(o.callback, o.scope, [o, true, r]);
5231
 
5232
            setTimeout(function(){Ext.removeNode(frame);}, 100);
5233
        }
5234
 
5235
        Ext.EventManager.on(frame, 'load', cb, this);
5236
        form.submit();
5237
 
5238
        if(hiddens){
5239
            for(var i = 0, len = hiddens.length; i < len; i++){
5240
                Ext.removeNode(hiddens[i]);
5241
            }
5242
        }
5243
    }
5244
});
5245
 
5246
 
5247
Ext.Ajax = new Ext.data.Connection({
5248
 
5249
 
5250
 
5251
 
5252
 
5253
 
5254
 
5255
 
5256
 
5257
 
5258
 
5259
 
5260
 
5261
 
5262
 
5263
 
5264
 
5265
    autoAbort : false,
5266
 
5267
 
5268
    serializeForm : function(form){
5269
        return Ext.lib.Ajax.serializeForm(form);
5270
    }
5271
});
5272
 
5273
Ext.Updater = function(el, forceNew){
5274
    el = Ext.get(el);
5275
    if(!forceNew && el.updateManager){
5276
        return el.updateManager;
5277
    }
5278
 
5279
    this.el = el;
5280
 
5281
    this.defaultUrl = null;
5282
 
5283
    this.addEvents(
5284
 
5285
        "beforeupdate",
5286
 
5287
        "update",
5288
 
5289
        "failure"
5290
    );
5291
    var d = Ext.Updater.defaults;
5292
 
5293
    this.sslBlankUrl = d.sslBlankUrl;
5294
 
5295
    this.disableCaching = d.disableCaching;
5296
 
5297
    this.indicatorText = d.indicatorText;
5298
 
5299
    this.showLoadIndicator = d.showLoadIndicator;
5300
 
5301
    this.timeout = d.timeout;
5302
 
5303
 
5304
    this.loadScripts = d.loadScripts;
5305
 
5306
 
5307
    this.transaction = null;
5308
 
5309
 
5310
    this.autoRefreshProcId = null;
5311
 
5312
    this.refreshDelegate = this.refresh.createDelegate(this);
5313
 
5314
    this.updateDelegate = this.update.createDelegate(this);
5315
 
5316
    this.formUpdateDelegate = this.formUpdate.createDelegate(this);
5317
 
5318
    if(!this.renderer){
5319
 
5320
    this.renderer = new Ext.Updater.BasicRenderer();
5321
    }
5322
    Ext.Updater.superclass.constructor.call(this);
5323
};
5324
 
5325
Ext.extend(Ext.Updater, Ext.util.Observable, {
5326
 
5327
    getEl : function(){
5328
        return this.el;
5329
    },
5330
 
5331
    update : function(url, params, callback, discardUrl){
5332
        if(this.fireEvent("beforeupdate", this.el, url, params) !== false){
5333
            var method = this.method, cfg, callerScope;
5334
            if(typeof url == "object"){
5335
                cfg = url;
5336
                url = cfg.url;
5337
                params = params || cfg.params;
5338
                callback = callback || cfg.callback;
5339
                discardUrl = discardUrl || cfg.discardUrl;
5340
	            callerScope = cfg.scope;
5341
                if(typeof cfg.method != "undefined"){method = cfg.method;};
5342
                if(typeof cfg.nocache != "undefined"){this.disableCaching = cfg.nocache;};
5343
                if(typeof cfg.text != "undefined"){this.indicatorText = '<div class="loading-indicator">'+cfg.text+"</div>";};
5344
                if(typeof cfg.scripts != "undefined"){this.loadScripts = cfg.scripts;};
5345
                if(typeof cfg.timeout != "undefined"){this.timeout = cfg.timeout;};
5346
            }
5347
            this.showLoading();
5348
            if(!discardUrl){
5349
                this.defaultUrl = url;
5350
            }
5351
            if(typeof url == "function"){
5352
                url = url.call(this);
5353
            }
5354
 
5355
            method = method || (params ? "POST" : "GET");
5356
            if(method == "GET"){
5357
                url = this.prepareUrl(url);
5358
            }
5359
 
5360
            var o = Ext.apply(cfg ||{}, {
5361
                url : url,
5362
                params: (typeof params == "function" && callerScope) ? params.createDelegate(callerScope) : params,
5363
                success: this.processSuccess,
5364
                failure: this.processFailure,
5365
                scope: this,
5366
                callback: undefined,
5367
                timeout: (this.timeout*1000),
5368
                argument: {
5369
                	"options": cfg,
5370
                	"url": url,
5371
                	"form": null,
5372
                	"callback": callback,
5373
                	"scope": callerScope || window,
5374
                	"params": params
5375
                }
5376
            });
5377
 
5378
            this.transaction = Ext.Ajax.request(o);
5379
        }
5380
    },
5381
 
5382
 
5383
    formUpdate : function(form, url, reset, callback){
5384
        if(this.fireEvent("beforeupdate", this.el, form, url) !== false){
5385
            if(typeof url == "function"){
5386
                url = url.call(this);
5387
            }
5388
            form = Ext.getDom(form)
5389
            this.transaction = Ext.Ajax.request({
5390
                form: form,
5391
                url:url,
5392
                success: this.processSuccess,
5393
                failure: this.processFailure,
5394
                scope: this,
5395
                timeout: (this.timeout*1000),
5396
                argument: {
5397
                	"url": url,
5398
                	"form": form,
5399
                	"callback": callback,
5400
                	"reset": reset
5401
                }
5402
            });
5403
            this.showLoading.defer(1, this);
5404
        }
5405
    },
5406
 
5407
 
5408
    refresh : function(callback){
5409
        if(this.defaultUrl == null){
5410
            return;
5411
        }
5412
        this.update(this.defaultUrl, null, callback, true);
5413
    },
5414
 
5415
 
5416
    startAutoRefresh : function(interval, url, params, callback, refreshNow){
5417
        if(refreshNow){
5418
            this.update(url || this.defaultUrl, params, callback, true);
5419
        }
5420
        if(this.autoRefreshProcId){
5421
            clearInterval(this.autoRefreshProcId);
5422
        }
5423
        this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000);
5424
    },
5425
 
5426
 
5427
     stopAutoRefresh : function(){
5428
        if(this.autoRefreshProcId){
5429
            clearInterval(this.autoRefreshProcId);
5430
            delete this.autoRefreshProcId;
5431
        }
5432
    },
5433
 
5434
    isAutoRefreshing : function(){
5435
       return this.autoRefreshProcId ? true : false;
5436
    },
5437
 
5438
    showLoading : function(){
5439
        if(this.showLoadIndicator){
5440
            this.el.update(this.indicatorText);
5441
        }
5442
    },
5443
 
5444
 
5445
    prepareUrl : function(url){
5446
        if(this.disableCaching){
5447
            var append = "_dc=" + (new Date().getTime());
5448
            if(url.indexOf("?") !== -1){
5449
                url += "&" + append;
5450
            }else{
5451
                url += "?" + append;
5452
            }
5453
        }
5454
        return url;
5455
    },
5456
 
5457
 
5458
    processSuccess : function(response){
5459
        this.transaction = null;
5460
        if(response.argument.form && response.argument.reset){
5461
            try{
5462
                response.argument.form.reset();
5463
            }catch(e){}
5464
        }
5465
        if(this.loadScripts){
5466
            this.renderer.render(this.el, response, this,
5467
                this.updateComplete.createDelegate(this, [response]));
5468
        }else{
5469
            this.renderer.render(this.el, response, this);
5470
            this.updateComplete(response);
5471
        }
5472
    },
5473
 
5474
    updateComplete : function(response){
5475
        this.fireEvent("update", this.el, response);
5476
        if(typeof response.argument.callback == "function"){
5477
            response.argument.callback.call(response.argument.scope, this.el, true, response, response.argument.options);
5478
        }
5479
    },
5480
 
5481
 
5482
    processFailure : function(response){
5483
        this.transaction = null;
5484
        this.fireEvent("failure", this.el, response);
5485
        if(typeof response.argument.callback == "function"){
5486
            response.argument.callback.call(response.argument.scope, this.el, false, response, response.argument.options);
5487
        }
5488
    },
5489
 
5490
 
5491
    setRenderer : function(renderer){
5492
        this.renderer = renderer;
5493
    },
5494
 
5495
    getRenderer : function(){
5496
       return this.renderer;
5497
    },
5498
 
5499
 
5500
    setDefaultUrl : function(defaultUrl){
5501
        this.defaultUrl = defaultUrl;
5502
    },
5503
 
5504
 
5505
    abort : function(){
5506
        if(this.transaction){
5507
            Ext.Ajax.abort(this.transaction);
5508
        }
5509
    },
5510
 
5511
 
5512
    isUpdating : function(){
5513
        if(this.transaction){
5514
            return Ext.Ajax.isLoading(this.transaction);
5515
        }
5516
        return false;
5517
    }
5518
});
5519
 
5520
 
5521
   Ext.Updater.defaults = {
5522
 
5523
         timeout : 30,
5524
 
5525
 
5526
        loadScripts : false,
5527
 
5528
 
5529
        sslBlankUrl : (Ext.SSL_SECURE_URL || "javascript:false"),
5530
 
5531
        disableCaching : false,
5532
 
5533
        showLoadIndicator : true,
5534
 
5535
        indicatorText : '<div class="loading-indicator">Loading...</div>'
5536
   };
5537
 
5538
 
5539
Ext.Updater.updateElement = function(el, url, params, options){
5540
    var um = Ext.get(el).getUpdater();
5541
    Ext.apply(um, options);
5542
    um.update(url, params, options ? options.callback : null);
5543
};
5544
 
5545
Ext.Updater.update = Ext.Updater.updateElement;
5546
 
5547
Ext.Updater.BasicRenderer = function(){};
5548
 
5549
Ext.Updater.BasicRenderer.prototype = {
5550
 
5551
     render : function(el, response, updateManager, callback){
5552
        el.update(response.responseText, updateManager.loadScripts, callback);
5553
    }
5554
};
5555
 
5556
Ext.UpdateManager = Ext.Updater;
5557
 
5558
 
5559
 
5560
 
5561
 
5562
Date.parseFunctions = {count:0};
5563
Date.parseRegexes = [];
5564
Date.formatFunctions = {count:0};
5565
 
5566
Date.prototype.dateFormat = function(format) {
5567
    if (Date.formatFunctions[format] == null) {
5568
        Date.createNewFormat(format);
5569
    }
5570
    var func = Date.formatFunctions[format];
5571
    return this[func]();
5572
};
5573
 
5574
 
5575
 
5576
Date.prototype.format = Date.prototype.dateFormat;
5577
 
5578
Date.createNewFormat = function(format) {
5579
    var funcName = "format" + Date.formatFunctions.count++;
5580
    Date.formatFunctions[format] = funcName;
5581
    var code = "Date.prototype." + funcName + " = function(){return ";
5582
    var special = false;
5583
    var ch = '';
5584
    for (var i = 0; i < format.length; ++i) {
5585
        ch = format.charAt(i);
5586
        if (!special && ch == "\\") {
5587
            special = true;
5588
        }
5589
        else if (special) {
5590
            special = false;
5591
            code += "'" + String.escape(ch) + "' + ";
5592
        }
5593
        else {
5594
            code += Date.getFormatCode(ch);
5595
        }
5596
    }
5597
    eval(code.substring(0, code.length - 3) + ";}");
5598
};
5599
 
5600
Date.getFormatCode = function(character) {
5601
    switch (character) {
5602
    case "d":
5603
        return "String.leftPad(this.getDate(), 2, '0') + ";
5604
    case "D":
5605
        return "Date.getShortDayName(this.getDay()) + ";     case "j":
5606
        return "this.getDate() + ";
5607
    case "l":
5608
        return "Date.dayNames[this.getDay()] + ";
5609
    case "N":
5610
        return "(this.getDay() ? this.getDay() : 7) + ";
5611
    case "S":
5612
        return "this.getSuffix() + ";
5613
    case "w":
5614
        return "this.getDay() + ";
5615
    case "z":
5616
        return "this.getDayOfYear() + ";
5617
    case "W":
5618
        return "String.leftPad(this.getWeekOfYear(), 2, '0') + ";
5619
    case "F":
5620
        return "Date.monthNames[this.getMonth()] + ";
5621
    case "m":
5622
        return "String.leftPad(this.getMonth() + 1, 2, '0') + ";
5623
    case "M":
5624
        return "Date.getShortMonthName(this.getMonth()) + ";     case "n":
5625
        return "(this.getMonth() + 1) + ";
5626
    case "t":
5627
        return "this.getDaysInMonth() + ";
5628
    case "L":
5629
        return "(this.isLeapYear() ? 1 : 0) + ";
5630
    case "o":
5631
        return "(this.getFullYear() + (this.getWeekOfYear() == 1 && this.getMonth() > 0 ? +1 : (this.getWeekOfYear() >= 52 && this.getMonth() < 11 ? -1 : 0))) + ";
5632
    case "Y":
5633
        return "this.getFullYear() + ";
5634
    case "y":
5635
        return "('' + this.getFullYear()).substring(2, 4) + ";
5636
    case "a":
5637
        return "(this.getHours() < 12 ? 'am' : 'pm') + ";
5638
    case "A":
5639
        return "(this.getHours() < 12 ? 'AM' : 'PM') + ";
5640
    case "g":
5641
        return "((this.getHours() % 12) ? this.getHours() % 12 : 12) + ";
5642
    case "G":
5643
        return "this.getHours() + ";
5644
    case "h":
5645
        return "String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0') + ";
5646
    case "H":
5647
        return "String.leftPad(this.getHours(), 2, '0') + ";
5648
    case "i":
5649
        return "String.leftPad(this.getMinutes(), 2, '0') + ";
5650
    case "s":
5651
        return "String.leftPad(this.getSeconds(), 2, '0') + ";
5652
    case "u":
5653
        return "String.leftPad(this.getMilliseconds(), 3, '0') + ";
5654
    case "O":
5655
        return "this.getGMTOffset() + ";
5656
    case "P":
5657
        return "this.getGMTOffset(true) + ";
5658
    case "T":
5659
        return "this.getTimezone() + ";
5660
    case "Z":
5661
        return "(this.getTimezoneOffset() * -60) + ";
5662
    case "c":
5663
        for (var df = Date.getFormatCode, c = "Y-m-dTH:i:sP", code = "", i = 0, l = c.length; i < l; ++i) {
5664
          var e = c.charAt(i);
5665
          code += e == "T" ? "'T' + " : df(e);         }
5666
        return code;
5667
    case "U":
5668
        return "Math.round(this.getTime() / 1000) + ";
5669
    default:
5670
        return "'" + String.escape(character) + "' + ";
5671
    }
5672
};
5673
 
5674
 
5675
Date.parseDate = function(input, format) {
5676
    if (Date.parseFunctions[format] == null) {
5677
        Date.createParser(format);
5678
    }
5679
    var func = Date.parseFunctions[format];
5680
    return Date[func](input);
5681
};
5682
 
5683
Date.createParser = function(format) {
5684
    var funcName = "parse" + Date.parseFunctions.count++;
5685
    var regexNum = Date.parseRegexes.length;
5686
    var currentGroup = 1;
5687
    Date.parseFunctions[format] = funcName;
5688
 
5689
    var code = "Date." + funcName + " = function(input){\n"
5690
        + "var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, ms = -1, o, z, u, v;\n"
5691
        + "input = String(input);var d = new Date();\n"
5692
        + "y = d.getFullYear();\n"
5693
        + "m = d.getMonth();\n"
5694
        + "d = d.getDate();\n"
5695
        + "var results = input.match(Date.parseRegexes[" + regexNum + "]);\n"
5696
        + "if (results && results.length > 0) {";
5697
    var regex = "";
5698
 
5699
    var special = false;
5700
    var ch = '';
5701
    for (var i = 0; i < format.length; ++i) {
5702
        ch = format.charAt(i);
5703
        if (!special && ch == "\\") {
5704
            special = true;
5705
        }
5706
        else if (special) {
5707
            special = false;
5708
            regex += String.escape(ch);
5709
        }
5710
        else {
5711
            var obj = Date.formatCodeToRegex(ch, currentGroup);
5712
            currentGroup += obj.g;
5713
            regex += obj.s;
5714
            if (obj.g && obj.c) {
5715
                code += obj.c;
5716
            }
5717
        }
5718
    }
5719
 
5720
    code += "if (u)\n"
5721
        + "{v = new Date(u * 1000);}"         + "else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0 && ms >= 0)\n"
5722
        + "{v = new Date(y, m, d, h, i, s, ms);}\n"
5723
        + "else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n"
5724
        + "{v = new Date(y, m, d, h, i, s);}\n"
5725
        + "else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n"
5726
        + "{v = new Date(y, m, d, h, i);}\n"
5727
        + "else if (y >= 0 && m >= 0 && d > 0 && h >= 0)\n"
5728
        + "{v = new Date(y, m, d, h);}\n"
5729
        + "else if (y >= 0 && m >= 0 && d > 0)\n"
5730
        + "{v = new Date(y, m, d);}\n"
5731
        + "else if (y >= 0 && m >= 0)\n"
5732
        + "{v = new Date(y, m);}\n"
5733
        + "else if (y >= 0)\n"
5734
        + "{v = new Date(y);}\n"
5735
        + "}return (v && (z || o))?\n"         + "    (z ? v.add(Date.SECOND, (v.getTimezoneOffset() * 60) + (z*1)) :\n"         + "        v.add(Date.HOUR, (v.getGMTOffset() / 100) + (o / -100))) : v\n"         + ";}";
5736
 
5737
    Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$", "i");
5738
    eval(code);
5739
};
5740
 
5741
Date.formatCodeToRegex = function(character, currentGroup) {
5742
 
5743
    switch (character) {
5744
    case "d":
5745
        return {g:1,
5746
            c:"d = parseInt(results[" + currentGroup + "], 10);\n",
5747
            s:"(\\d{2})"};     case "D":
5748
        for (var a = [], i = 0; i < 7; a.push(Date.getShortDayName(i)), ++i);         return {g:0,
5749
            c:null,
5750
            s:"(?:" + a.join("|") +")"};
5751
    case "j":
5752
        return {g:1,
5753
            c:"d = parseInt(results[" + currentGroup + "], 10);\n",
5754
            s:"(\\d{1,2})"};     case "l":
5755
        return {g:0,
5756
            c:null,
5757
            s:"(?:" + Date.dayNames.join("|") + ")"};
5758
    case "N":
5759
        return {g:0,
5760
            c:null,
5761
            s:"[1-7]"};     case "S":
5762
        return {g:0,
5763
            c:null,
5764
            s:"(?:st|nd|rd|th)"};
5765
    case "w":
5766
        return {g:0,
5767
            c:null,
5768
            s:"[0-6]"};     case "z":
5769
        return {g:0,
5770
            c:null,
5771
            s:"(?:\\d{1,3}"};     case "W":
5772
        return {g:0,
5773
            c:null,
5774
            s:"(?:\\d{2})"};     case "F":
5775
        return {g:1,
5776
            c:"m = parseInt(Date.getMonthNumber(results[" + currentGroup + "]), 10);\n",             s:"(" + Date.monthNames.join("|") + ")"};
5777
    case "m":
5778
        return {g:1,
5779
            c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n",
5780
            s:"(\\d{2})"};     case "M":
5781
        for (var a = [], i = 0; i < 12; a.push(Date.getShortMonthName(i)), ++i);         return {g:1,
5782
            c:"m = parseInt(Date.getMonthNumber(results[" + currentGroup + "]), 10);\n",             s:"(" + a.join("|") + ")"};
5783
    case "n":
5784
        return {g:1,
5785
            c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n",
5786
            s:"(\\d{1,2})"};     case "t":
5787
        return {g:0,
5788
            c:null,
5789
            s:"(?:\\d{2})"};     case "L":
5790
        return {g:0,
5791
            c:null,
5792
            s:"(?:1|0)"};
5793
    case "o":
5794
    case "Y":
5795
        return {g:1,
5796
            c:"y = parseInt(results[" + currentGroup + "], 10);\n",
5797
            s:"(\\d{4})"};     case "y":
5798
        return {g:1,
5799
            c:"var ty = parseInt(results[" + currentGroup + "], 10);\n"
5800
                + "y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",
5801
            s:"(\\d{1,2})"};     case "a":
5802
        return {g:1,
5803
            c:"if (results[" + currentGroup + "] == 'am') {\n"
5804
                + "if (h == 12) { h = 0; }\n"
5805
                + "} else { if (h < 12) { h += 12; }}",
5806
            s:"(am|pm)"};
5807
    case "A":
5808
        return {g:1,
5809
            c:"if (results[" + currentGroup + "] == 'AM') {\n"
5810
                + "if (h == 12) { h = 0; }\n"
5811
                + "} else { if (h < 12) { h += 12; }}",
5812
            s:"(AM|PM)"};
5813
    case "g":
5814
    case "G":
5815
        return {g:1,
5816
            c:"h = parseInt(results[" + currentGroup + "], 10);\n",
5817
            s:"(\\d{1,2})"};     case "h":
5818
    case "H":
5819
        return {g:1,
5820
            c:"h = parseInt(results[" + currentGroup + "], 10);\n",
5821
            s:"(\\d{2})"};     case "i":
5822
        return {g:1,
5823
            c:"i = parseInt(results[" + currentGroup + "], 10);\n",
5824
            s:"(\\d{2})"};     case "s":
5825
        return {g:1,
5826
            c:"s = parseInt(results[" + currentGroup + "], 10);\n",
5827
            s:"(\\d{2})"};     case "u":
5828
        return {g:1,
5829
            c:"ms = parseInt(results[" + currentGroup + "], 10);\n",
5830
            s:"(\\d{3})"};     case "O":
5831
        return {g:1,
5832
            c:[
5833
                "o = results[", currentGroup, "];\n",
5834
                "var sn = o.substring(0,1);\n",                 "var hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60);\n",                 "var mn = o.substring(3,5) % 60;\n",                 "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))?\n",                 "    (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n"
5835
            ].join(""),
5836
            s: "([+\-]\\d{4})"};     case "P":
5837
        return {g:1,
5838
            c:[
5839
                "o = results[", currentGroup, "];\n",
5840
                "var sn = o.substring(0,1);\n",                 "var hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60);\n",                 "var mn = o.substring(4,6) % 60;\n",                 "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))?\n",                 "    (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n"
5841
            ].join(""),
5842
            s: "([+\-]\\d{2}:\\d{2})"};     case "T":
5843
        return {g:0,
5844
            c:null,
5845
            s:"[A-Z]{1,4}"};     case "Z":
5846
        return {g:1,
5847
            c:"z = results[" + currentGroup + "] * 1;\n"                   + "z = (-43200 <= z && z <= 50400)? z : null;\n",
5848
            s:"([+\-]?\\d{1,5})"};     case "c":
5849
        var df = Date.formatCodeToRegex, calc = [];
5850
        var arr = [df("Y", 1), df("m", 2), df("d", 3), df("h", 4), df("i", 5), df("s", 6), df("P", 7)];
5851
        for (var i = 0, l = arr.length; i < l; ++i) {
5852
          calc.push(arr[i].c);
5853
        }
5854
        return {g:1,
5855
            c:calc.join(""),
5856
            s:arr[0].s + "-" + arr[1].s + "-" + arr[2].s + "T" + arr[3].s + ":" + arr[4].s + ":" + arr[5].s + arr[6].s};
5857
    case "U":
5858
        return {g:1,
5859
            c:"u = parseInt(results[" + currentGroup + "], 10);\n",
5860
            s:"(-?\\d+)"};     default:
5861
        return {g:0,
5862
            c:null,
5863
            s:Ext.escapeRe(character)};
5864
    }
5865
};
5866
 
5867
 
5868
Date.prototype.getTimezone = function() {
5869
                                                    return this.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");
5870
};
5871
 
5872
 
5873
Date.prototype.getGMTOffset = function(colon) {
5874
    return (this.getTimezoneOffset() > 0 ? "-" : "+")
5875
        + String.leftPad(Math.abs(Math.floor(this.getTimezoneOffset() / 60)), 2, "0")
5876
        + (colon ? ":" : "")
5877
        + String.leftPad(this.getTimezoneOffset() % 60, 2, "0");
5878
};
5879
 
5880
 
5881
Date.prototype.getDayOfYear = function() {
5882
    var num = 0;
5883
    Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;
5884
    for (var i = 0; i < this.getMonth(); ++i) {
5885
        num += Date.daysInMonth[i];
5886
    }
5887
    return num + this.getDate() - 1;
5888
};
5889
 
5890
 
5891
Date.prototype.getWeekOfYear = function() {
5892
        var ms1d = 864e5;     var ms7d = 7 * ms1d;     var DC3 = Date.UTC(this.getFullYear(), this.getMonth(), this.getDate() + 3) / ms1d;     var AWN = Math.floor(DC3 / 7);     var Wyr = new Date(AWN * ms7d).getUTCFullYear();
5893
    return AWN - Math.floor(Date.UTC(Wyr, 0, 7) / ms7d) + 1;
5894
};
5895
 
5896
 
5897
Date.prototype.isLeapYear = function() {
5898
    var year = this.getFullYear();
5899
    return !!((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
5900
};
5901
 
5902
 
5903
Date.prototype.getFirstDayOfMonth = function() {
5904
    var day = (this.getDay() - (this.getDate() - 1)) % 7;
5905
    return (day < 0) ? (day + 7) : day;
5906
};
5907
 
5908
 
5909
Date.prototype.getLastDayOfMonth = function() {
5910
    var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7;
5911
    return (day < 0) ? (day + 7) : day;
5912
};
5913
 
5914
 
5915
 
5916
Date.prototype.getFirstDateOfMonth = function() {
5917
    return new Date(this.getFullYear(), this.getMonth(), 1);
5918
};
5919
 
5920
 
5921
Date.prototype.getLastDateOfMonth = function() {
5922
    return new Date(this.getFullYear(), this.getMonth(), this.getDaysInMonth());
5923
};
5924
 
5925
Date.prototype.getDaysInMonth = function() {
5926
    Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;
5927
    return Date.daysInMonth[this.getMonth()];
5928
};
5929
 
5930
 
5931
Date.prototype.getSuffix = function() {
5932
    switch (this.getDate()) {
5933
        case 1:
5934
        case 21:
5935
        case 31:
5936
            return "st";
5937
        case 2:
5938
        case 22:
5939
            return "nd";
5940
        case 3:
5941
        case 23:
5942
            return "rd";
5943
        default:
5944
            return "th";
5945
    }
5946
};
5947
 
5948
Date.daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31];
5949
 
5950
 
5951
Date.monthNames =
5952
   ["January",
5953
    "February",
5954
    "March",
5955
    "April",
5956
    "May",
5957
    "June",
5958
    "July",
5959
    "August",
5960
    "September",
5961
    "October",
5962
    "November",
5963
    "December"];
5964
 
5965
 
5966
Date.getShortMonthName = function(month) {
5967
    return Date.monthNames[month].substring(0, 3);
5968
}
5969
 
5970
 
5971
Date.dayNames =
5972
   ["Sunday",
5973
    "Monday",
5974
    "Tuesday",
5975
    "Wednesday",
5976
    "Thursday",
5977
    "Friday",
5978
    "Saturday"];
5979
 
5980
 
5981
Date.getShortDayName = function(day) {
5982
    return Date.dayNames[day].substring(0, 3);
5983
}
5984
 
5985
Date.y2kYear = 50;
5986
 
5987
 
5988
Date.monthNumbers = {
5989
    Jan:0,
5990
    Feb:1,
5991
    Mar:2,
5992
    Apr:3,
5993
    May:4,
5994
    Jun:5,
5995
    Jul:6,
5996
    Aug:7,
5997
    Sep:8,
5998
    Oct:9,
5999
    Nov:10,
6000
    Dec:11};
6001
 
6002
 
6003
Date.getMonthNumber = function(name) {
6004
        return Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
6005
}
6006
 
6007
 
6008
Date.prototype.clone = function() {
6009
  return new Date(this.getTime());
6010
};
6011
 
6012
 
6013
Date.prototype.clearTime = function(clone){
6014
    if(clone){
6015
        return this.clone().clearTime();
6016
    }
6017
    this.setHours(0);
6018
    this.setMinutes(0);
6019
    this.setSeconds(0);
6020
    this.setMilliseconds(0);
6021
    return this;
6022
};
6023
 
6024
if(Ext.isSafari){
6025
    Date.brokenSetMonth = Date.prototype.setMonth;
6026
  Date.prototype.setMonth = function(num){
6027
    if(num <= -1){
6028
      var n = Math.ceil(-num);
6029
      var back_year = Math.ceil(n/12);
6030
      var month = (n % 12) ? 12 - n % 12 : 0 ;
6031
      this.setFullYear(this.getFullYear() - back_year);
6032
      return Date.brokenSetMonth.call(this, month);
6033
    } else {
6034
      return Date.brokenSetMonth.apply(this, arguments);
6035
    }
6036
  };
6037
}
6038
 
6039
 
6040
Date.MILLI = "ms";
6041
 
6042
Date.SECOND = "s";
6043
 
6044
Date.MINUTE = "mi";
6045
 
6046
Date.HOUR = "h";
6047
 
6048
Date.DAY = "d";
6049
 
6050
Date.MONTH = "mo";
6051
 
6052
Date.YEAR = "y";
6053
 
6054
 
6055
Date.prototype.add = function(interval, value){
6056
  var d = this.clone();
6057
  if (!interval || value === 0) return d;
6058
  switch(interval.toLowerCase()){
6059
    case Date.MILLI:
6060
      d.setMilliseconds(this.getMilliseconds() + value);
6061
      break;
6062
    case Date.SECOND:
6063
      d.setSeconds(this.getSeconds() + value);
6064
      break;
6065
    case Date.MINUTE:
6066
      d.setMinutes(this.getMinutes() + value);
6067
      break;
6068
    case Date.HOUR:
6069
      d.setHours(this.getHours() + value);
6070
      break;
6071
    case Date.DAY:
6072
      d.setDate(this.getDate() + value);
6073
      break;
6074
    case Date.MONTH:
6075
      var day = this.getDate();
6076
      if(day > 28){
6077
          day = Math.min(day, this.getFirstDateOfMonth().add('mo', value).getLastDateOfMonth().getDate());
6078
      }
6079
      d.setDate(day);
6080
      d.setMonth(this.getMonth() + value);
6081
      break;
6082
    case Date.YEAR:
6083
      d.setFullYear(this.getFullYear() + value);
6084
      break;
6085
  }
6086
  return d;
6087
};
6088
 
6089
 
6090
Date.prototype.between = function(start, end){
6091
    var t = this.getTime();
6092
    return start.getTime() <= t && t <= end.getTime();
6093
}
6094
 
6095
Ext.util.DelayedTask = function(fn, scope, args){
6096
    var id = null, d, t;
6097
 
6098
    var call = function(){
6099
        var now = new Date().getTime();
6100
        if(now - t >= d){
6101
            clearInterval(id);
6102
            id = null;
6103
            fn.apply(scope, args || []);
6104
        }
6105
    };
6106
 
6107
    this.delay = function(delay, newFn, newScope, newArgs){
6108
        if(id && delay != d){
6109
            this.cancel();
6110
        }
6111
        d = delay;
6112
        t = new Date().getTime();
6113
        fn = newFn || fn;
6114
        scope = newScope || scope;
6115
        args = newArgs || args;
6116
        if(!id){
6117
            id = setInterval(call, d);
6118
        }
6119
    };
6120
 
6121
 
6122
    this.cancel = function(){
6123
        if(id){
6124
            clearInterval(id);
6125
            id = null;
6126
        }
6127
    };
6128
};
6129
 
6130
Ext.util.TaskRunner = function(interval){
6131
    interval = interval || 10;
6132
    var tasks = [], removeQueue = [];
6133
    var id = 0;
6134
    var running = false;
6135
 
6136
        var stopThread = function(){
6137
        running = false;
6138
        clearInterval(id);
6139
        id = 0;
6140
    };
6141
 
6142
        var startThread = function(){
6143
        if(!running){
6144
            running = true;
6145
            id = setInterval(runTasks, interval);
6146
        }
6147
    };
6148
 
6149
        var removeTask = function(t){
6150
        removeQueue.push(t);
6151
        if(t.onStop){
6152
            t.onStop.apply(t.scope || t);
6153
        }
6154
    };
6155
 
6156
        var runTasks = function(){
6157
        if(removeQueue.length > 0){
6158
            for(var i = 0, len = removeQueue.length; i < len; i++){
6159
                tasks.remove(removeQueue[i]);
6160
            }
6161
            removeQueue = [];
6162
            if(tasks.length < 1){
6163
                stopThread();
6164
                return;
6165
            }
6166
        }
6167
        var now = new Date().getTime();
6168
        for(var i = 0, len = tasks.length; i < len; ++i){
6169
            var t = tasks[i];
6170
            var itime = now - t.taskRunTime;
6171
            if(t.interval <= itime){
6172
                var rt = t.run.apply(t.scope || t, t.args || [++t.taskRunCount]);
6173
                t.taskRunTime = now;
6174
                if(rt === false || t.taskRunCount === t.repeat){
6175
                    removeTask(t);
6176
                    return;
6177
                }
6178
            }
6179
            if(t.duration && t.duration <= (now - t.taskStartTime)){
6180
                removeTask(t);
6181
            }
6182
        }
6183
    };
6184
 
6185
 
6186
    this.start = function(task){
6187
        tasks.push(task);
6188
        task.taskStartTime = new Date().getTime();
6189
        task.taskRunTime = 0;
6190
        task.taskRunCount = 0;
6191
        startThread();
6192
        return task;
6193
    };
6194
 
6195
 
6196
    this.stop = function(task){
6197
        removeTask(task);
6198
        return task;
6199
    };
6200
 
6201
 
6202
    this.stopAll = function(){
6203
        stopThread();
6204
        for(var i = 0, len = tasks.length; i < len; i++){
6205
            if(tasks[i].onStop){
6206
                tasks[i].onStop();
6207
            }
6208
        }
6209
        tasks = [];
6210
        removeQueue = [];
6211
    };
6212
};
6213
 
6214
 
6215
Ext.TaskMgr = new Ext.util.TaskRunner();
6216
 
6217
Ext.util.MixedCollection = function(allowFunctions, keyFn){
6218
    this.items = [];
6219
    this.map = {};
6220
    this.keys = [];
6221
    this.length = 0;
6222
    this.addEvents(
6223
 
6224
        "clear",
6225
 
6226
        "add",
6227
 
6228
        "replace",
6229
 
6230
        "remove",
6231
        "sort"
6232
    );
6233
    this.allowFunctions = allowFunctions === true;
6234
    if(keyFn){
6235
        this.getKey = keyFn;
6236
    }
6237
    Ext.util.MixedCollection.superclass.constructor.call(this);
6238
};
6239
 
6240
Ext.extend(Ext.util.MixedCollection, Ext.util.Observable, {
6241
    allowFunctions : false,
6242
 
6243
 
6244
    add : function(key, o){
6245
        if(arguments.length == 1){
6246
            o = arguments[0];
6247
            key = this.getKey(o);
6248
        }
6249
        if(typeof key == "undefined" || key === null){
6250
            this.length++;
6251
            this.items.push(o);
6252
            this.keys.push(null);
6253
        }else{
6254
            var old = this.map[key];
6255
            if(old){
6256
                return this.replace(key, o);
6257
            }
6258
            this.length++;
6259
            this.items.push(o);
6260
            this.map[key] = o;
6261
            this.keys.push(key);
6262
        }
6263
        this.fireEvent("add", this.length-1, o, key);
6264
        return o;
6265
    },
6266
 
6267
 
6268
    getKey : function(o){
6269
         return o.id;
6270
    },
6271
 
6272
 
6273
    replace : function(key, o){
6274
        if(arguments.length == 1){
6275
            o = arguments[0];
6276
            key = this.getKey(o);
6277
        }
6278
        var old = this.item(key);
6279
        if(typeof key == "undefined" || key === null || typeof old == "undefined"){
6280
             return this.add(key, o);
6281
        }
6282
        var index = this.indexOfKey(key);
6283
        this.items[index] = o;
6284
        this.map[key] = o;
6285
        this.fireEvent("replace", key, old, o);
6286
        return o;
6287
    },
6288
 
6289
 
6290
    addAll : function(objs){
6291
        if(arguments.length > 1 || Ext.isArray(objs)){
6292
            var args = arguments.length > 1 ? arguments : objs;
6293
            for(var i = 0, len = args.length; i < len; i++){
6294
                this.add(args[i]);
6295
            }
6296
        }else{
6297
            for(var key in objs){
6298
                if(this.allowFunctions || typeof objs[key] != "function"){
6299
                    this.add(key, objs[key]);
6300
                }
6301
            }
6302
        }
6303
    },
6304
 
6305
 
6306
    each : function(fn, scope){
6307
        var items = [].concat(this.items);
6308
        for(var i = 0, len = items.length; i < len; i++){
6309
            if(fn.call(scope || items[i], items[i], i, len) === false){
6310
                break;
6311
            }
6312
        }
6313
    },
6314
 
6315
 
6316
    eachKey : function(fn, scope){
6317
        for(var i = 0, len = this.keys.length; i < len; i++){
6318
            fn.call(scope || window, this.keys[i], this.items[i], i, len);
6319
        }
6320
    },
6321
 
6322
 
6323
    find : function(fn, scope){
6324
        for(var i = 0, len = this.items.length; i < len; i++){
6325
            if(fn.call(scope || window, this.items[i], this.keys[i])){
6326
                return this.items[i];
6327
            }
6328
        }
6329
        return null;
6330
    },
6331
 
6332
 
6333
    insert : function(index, key, o){
6334
        if(arguments.length == 2){
6335
            o = arguments[1];
6336
            key = this.getKey(o);
6337
        }
6338
        if(index >= this.length){
6339
            return this.add(key, o);
6340
        }
6341
        this.length++;
6342
        this.items.splice(index, 0, o);
6343
        if(typeof key != "undefined" && key != null){
6344
            this.map[key] = o;
6345
        }
6346
        this.keys.splice(index, 0, key);
6347
        this.fireEvent("add", index, o, key);
6348
        return o;
6349
    },
6350
 
6351
 
6352
    remove : function(o){
6353
        return this.removeAt(this.indexOf(o));
6354
    },
6355
 
6356
 
6357
    removeAt : function(index){
6358
        if(index < this.length && index >= 0){
6359
            this.length--;
6360
            var o = this.items[index];
6361
            this.items.splice(index, 1);
6362
            var key = this.keys[index];
6363
            if(typeof key != "undefined"){
6364
                delete this.map[key];
6365
            }
6366
            this.keys.splice(index, 1);
6367
            this.fireEvent("remove", o, key);
6368
            return o;
6369
        }
6370
        return false;
6371
    },
6372
 
6373
 
6374
    removeKey : function(key){
6375
        return this.removeAt(this.indexOfKey(key));
6376
    },
6377
 
6378
 
6379
    getCount : function(){
6380
        return this.length;
6381
    },
6382
 
6383
 
6384
    indexOf : function(o){
6385
        return this.items.indexOf(o);
6386
    },
6387
 
6388
 
6389
    indexOfKey : function(key){
6390
        return this.keys.indexOf(key);
6391
    },
6392
 
6393
 
6394
    item : function(key){
6395
        var item = typeof this.map[key] != "undefined" ? this.map[key] : this.items[key];
6396
        return typeof item != 'function' || this.allowFunctions ? item : null;
6397
    },
6398
 
6399
 
6400
    itemAt : function(index){
6401
        return this.items[index];
6402
    },
6403
 
6404
 
6405
    key : function(key){
6406
        return this.map[key];
6407
    },
6408
 
6409
 
6410
    contains : function(o){
6411
        return this.indexOf(o) != -1;
6412
    },
6413
 
6414
 
6415
    containsKey : function(key){
6416
        return typeof this.map[key] != "undefined";
6417
    },
6418
 
6419
 
6420
    clear : function(){
6421
        this.length = 0;
6422
        this.items = [];
6423
        this.keys = [];
6424
        this.map = {};
6425
        this.fireEvent("clear");
6426
    },
6427
 
6428
 
6429
    first : function(){
6430
        return this.items[0];
6431
    },
6432
 
6433
 
6434
    last : function(){
6435
        return this.items[this.length-1];
6436
    },
6437
 
6438
 
6439
    _sort : function(property, dir, fn){
6440
        var dsc = String(dir).toUpperCase() == "DESC" ? -1 : 1;
6441
        fn = fn || function(a, b){
6442
            return a-b;
6443
        };
6444
        var c = [], k = this.keys, items = this.items;
6445
        for(var i = 0, len = items.length; i < len; i++){
6446
            c[c.length] = {key: k[i], value: items[i], index: i};
6447
        }
6448
        c.sort(function(a, b){
6449
            var v = fn(a[property], b[property]) * dsc;
6450
            if(v == 0){
6451
                v = (a.index < b.index ? -1 : 1);
6452
            }
6453
            return v;
6454
        });
6455
        for(var i = 0, len = c.length; i < len; i++){
6456
            items[i] = c[i].value;
6457
            k[i] = c[i].key;
6458
        }
6459
        this.fireEvent("sort", this);
6460
    },
6461
 
6462
 
6463
    sort : function(dir, fn){
6464
        this._sort("value", dir, fn);
6465
    },
6466
 
6467
 
6468
    keySort : function(dir, fn){
6469
        this._sort("key", dir, fn || function(a, b){
6470
            return String(a).toUpperCase()-String(b).toUpperCase();
6471
        });
6472
    },
6473
 
6474
 
6475
    getRange : function(start, end){
6476
        var items = this.items;
6477
        if(items.length < 1){
6478
            return [];
6479
        }
6480
        start = start || 0;
6481
        end = Math.min(typeof end == "undefined" ? this.length-1 : end, this.length-1);
6482
        var r = [];
6483
        if(start <= end){
6484
            for(var i = start; i <= end; i++) {
6485
        	    r[r.length] = items[i];
6486
            }
6487
        }else{
6488
            for(var i = start; i >= end; i--) {
6489
        	    r[r.length] = items[i];
6490
            }
6491
        }
6492
        return r;
6493
    },
6494
 
6495
 
6496
    filter : function(property, value, anyMatch, caseSensitive){
6497
        if(Ext.isEmpty(value, false)){
6498
            return this.clone();
6499
        }
6500
        value = this.createValueMatcher(value, anyMatch, caseSensitive);
6501
        return this.filterBy(function(o){
6502
            return o && value.test(o[property]);
6503
        });
6504
	},
6505
 
6506
 
6507
    filterBy : function(fn, scope){
6508
        var r = new Ext.util.MixedCollection();
6509
        r.getKey = this.getKey;
6510
        var k = this.keys, it = this.items;
6511
        for(var i = 0, len = it.length; i < len; i++){
6512
            if(fn.call(scope||this, it[i], k[i])){
6513
				r.add(k[i], it[i]);
6514
			}
6515
        }
6516
        return r;
6517
    },
6518
 
6519
 
6520
    findIndex : function(property, value, start, anyMatch, caseSensitive){
6521
        if(Ext.isEmpty(value, false)){
6522
            return -1;
6523
        }
6524
        value = this.createValueMatcher(value, anyMatch, caseSensitive);
6525
        return this.findIndexBy(function(o){
6526
            return o && value.test(o[property]);
6527
        }, null, start);
6528
	},
6529
 
6530
 
6531
    findIndexBy : function(fn, scope, start){
6532
        var k = this.keys, it = this.items;
6533
        for(var i = (start||0), len = it.length; i < len; i++){
6534
            if(fn.call(scope||this, it[i], k[i])){
6535
				return i;
6536
            }
6537
        }
6538
        if(typeof start == 'number' && start > 0){
6539
            for(var i = 0; i < start; i++){
6540
                if(fn.call(scope||this, it[i], k[i])){
6541
                    return i;
6542
                }
6543
            }
6544
        }
6545
        return -1;
6546
    },
6547
 
6548
 
6549
    createValueMatcher : function(value, anyMatch, caseSensitive){
6550
        if(!value.exec){
6551
            value = String(value);
6552
            value = new RegExp((anyMatch === true ? '' : '^') + Ext.escapeRe(value), caseSensitive ? '' : 'i');
6553
        }
6554
        return value;
6555
    },
6556
 
6557
 
6558
    clone : function(){
6559
        var r = new Ext.util.MixedCollection();
6560
        var k = this.keys, it = this.items;
6561
        for(var i = 0, len = it.length; i < len; i++){
6562
            r.add(k[i], it[i]);
6563
        }
6564
        r.getKey = this.getKey;
6565
        return r;
6566
    }
6567
});
6568
 
6569
Ext.util.MixedCollection.prototype.get = Ext.util.MixedCollection.prototype.item;
6570
 
6571
Ext.util.JSON = new (function(){
6572
    var useHasOwn = {}.hasOwnProperty ? true : false;
6573
 
6574
 
6575
 
6576
 
6577
    var pad = function(n) {
6578
        return n < 10 ? "0" + n : n;
6579
    };
6580
 
6581
    var m = {
6582
        "\b": '\\b',
6583
        "\t": '\\t',
6584
        "\n": '\\n',
6585
        "\f": '\\f',
6586
        "\r": '\\r',
6587
        '"' : '\\"',
6588
        "\\": '\\\\'
6589
    };
6590
 
6591
    var encodeString = function(s){
6592
        if (/["\\\x00-\x1f]/.test(s)) {
6593
            return '"' + s.replace(/([\x00-\x1f\\"])/g, function(a, b) {
6594
                var c = m[b];
6595
                if(c){
6596
                    return c;
6597
                }
6598
                c = b.charCodeAt();
6599
                return "\\u00" +
6600
                    Math.floor(c / 16).toString(16) +
6601
                    (c % 16).toString(16);
6602
            }) + '"';
6603
        }
6604
        return '"' + s + '"';
6605
    };
6606
 
6607
    var encodeArray = function(o){
6608
        var a = ["["], b, i, l = o.length, v;
6609
            for (i = 0; i < l; i += 1) {
6610
                v = o[i];
6611
                switch (typeof v) {
6612
                    case "undefined":
6613
                    case "function":
6614
                    case "unknown":
6615
                        break;
6616
                    default:
6617
                        if (b) {
6618
                            a.push(',');
6619
                        }
6620
                        a.push(v === null ? "null" : Ext.util.JSON.encode(v));
6621
                        b = true;
6622
                }
6623
            }
6624
            a.push("]");
6625
            return a.join("");
6626
    };
6627
 
6628
    var encodeDate = function(o){
6629
        return '"' + o.getFullYear() + "-" +
6630
                pad(o.getMonth() + 1) + "-" +
6631
                pad(o.getDate()) + "T" +
6632
                pad(o.getHours()) + ":" +
6633
                pad(o.getMinutes()) + ":" +
6634
                pad(o.getSeconds()) + '"';
6635
    };
6636
 
6637
 
6638
    this.encode = function(o){
6639
        if(typeof o == "undefined" || o === null){
6640
            return "null";
6641
        }else if(Ext.isArray(o)){
6642
            return encodeArray(o);
6643
        }else if(Ext.isDate(o)){
6644
            return encodeDate(o);
6645
        }else if(typeof o == "string"){
6646
            return encodeString(o);
6647
        }else if(typeof o == "number"){
6648
            return isFinite(o) ? String(o) : "null";
6649
        }else if(typeof o == "boolean"){
6650
            return String(o);
6651
        }else {
6652
            var a = ["{"], b, i, v;
6653
            for (i in o) {
6654
                if(!useHasOwn || o.hasOwnProperty(i)) {
6655
                    v = o[i];
6656
                    switch (typeof v) {
6657
                    case "undefined":
6658
                    case "function":
6659
                    case "unknown":
6660
                        break;
6661
                    default:
6662
                        if(b){
6663
                            a.push(',');
6664
                        }
6665
                        a.push(this.encode(i), ":",
6666
                                v === null ? "null" : this.encode(v));
6667
                        b = true;
6668
                    }
6669
                }
6670
            }
6671
            a.push("}");
6672
            return a.join("");
6673
        }
6674
    };
6675
 
6676
 
6677
    this.decode = function(json){
6678
        return eval("(" + json + ')');
6679
    };
6680
})();
6681
 
6682
Ext.encode = Ext.util.JSON.encode;
6683
 
6684
Ext.decode = Ext.util.JSON.decode;
6685
 
6686
 
6687
Ext.util.Format = function(){
6688
    var trimRe = /^\s+|\s+$/g;
6689
    return {
6690
 
6691
        ellipsis : function(value, len){
6692
            if(value && value.length > len){
6693
                return value.substr(0, len-3)+"...";
6694
            }
6695
            return value;
6696
        },
6697
 
6698
 
6699
        undef : function(value){
6700
            return value !== undefined ? value : "";
6701
        },
6702
 
6703
 
6704
        defaultValue : function(value, defaultValue){
6705
            return value !== undefined && value !== '' ? value : defaultValue;
6706
        },
6707
 
6708
 
6709
        htmlEncode : function(value){
6710
            return !value ? value : String(value).replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;").replace(/"/g, "&quot;");
6711
        },
6712
 
6713
 
6714
        htmlDecode : function(value){
6715
            return !value ? value : String(value).replace(/&amp;/g, "&").replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"');
6716
        },
6717
 
6718
 
6719
        trim : function(value){
6720
            return String(value).replace(trimRe, "");
6721
        },
6722
 
6723
 
6724
        substr : function(value, start, length){
6725
            return String(value).substr(start, length);
6726
        },
6727
 
6728
 
6729
        lowercase : function(value){
6730
            return String(value).toLowerCase();
6731
        },
6732
 
6733
 
6734
        uppercase : function(value){
6735
            return String(value).toUpperCase();
6736
        },
6737
 
6738
 
6739
        capitalize : function(value){
6740
            return !value ? value : value.charAt(0).toUpperCase() + value.substr(1).toLowerCase();
6741
        },
6742
 
6743
 
6744
        call : function(value, fn){
6745
            if(arguments.length > 2){
6746
                var args = Array.prototype.slice.call(arguments, 2);
6747
                args.unshift(value);
6748
                return eval(fn).apply(window, args);
6749
            }else{
6750
                return eval(fn).call(window, value);
6751
            }
6752
        },
6753
 
6754
 
6755
        usMoney : function(v){
6756
            v = (Math.round((v-0)*100))/100;
6757
            v = (v == Math.floor(v)) ? v + ".00" : ((v*10 == Math.floor(v*10)) ? v + "0" : v);
6758
            v = String(v);
6759
            var ps = v.split('.');
6760
            var whole = ps[0];
6761
            var sub = ps[1] ? '.'+ ps[1] : '.00';
6762
            var r = /(\d+)(\d{3})/;
6763
            while (r.test(whole)) {
6764
                whole = whole.replace(r, '$1' + ',' + '$2');
6765
            }
6766
            v = whole + sub;
6767
            if(v.charAt(0) == '-'){
6768
                return '-$' + v.substr(1);
6769
            }
6770
            return "$" +  v;
6771
        },
6772
 
6773
 
6774
        date : function(v, format){
6775
            if(!v){
6776
                return "";
6777
            }
6778
            if(!Ext.isDate(v)){
6779
                v = new Date(Date.parse(v));
6780
            }
6781
            return v.dateFormat(format || "m/d/Y");
6782
        },
6783
 
6784
 
6785
        dateRenderer : function(format){
6786
            return function(v){
6787
                return Ext.util.Format.date(v, format);
6788
            };
6789
        },
6790
 
6791
 
6792
        stripTagsRE : /<\/?[^>]+>/gi,
6793
 
6794
 
6795
        stripTags : function(v){
6796
            return !v ? v : String(v).replace(this.stripTagsRE, "");
6797
        },
6798
 
6799
        stripScriptsRe : /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,
6800
 
6801
 
6802
        stripScripts : function(v){
6803
            return !v ? v : String(v).replace(this.stripScriptsRe, "");
6804
        },
6805
 
6806
 
6807
        fileSize : function(size){
6808
            if(size < 1024) {
6809
                return size + " bytes";
6810
            } else if(size < 1048576) {
6811
                return (Math.round(((size*10) / 1024))/10) + " KB";
6812
            } else {
6813
                return (Math.round(((size*10) / 1048576))/10) + " MB";
6814
            }
6815
        },
6816
 
6817
        math : function(){
6818
            var fns = {};
6819
            return function(v, a){
6820
                if(!fns[a]){
6821
                    fns[a] = new Function('v', 'return v ' + a + ';');
6822
                }
6823
                return fns[a](v);
6824
            }
6825
        }()
6826
    };
6827
}();
6828
 
6829
Ext.XTemplate = function(){
6830
    Ext.XTemplate.superclass.constructor.apply(this, arguments);
6831
    var s = this.html;
6832
 
6833
    s = ['<tpl>', s, '</tpl>'].join('');
6834
 
6835
    var re = /<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/;
6836
 
6837
    var nameRe = /^<tpl\b[^>]*?for="(.*?)"/;
6838
    var ifRe = /^<tpl\b[^>]*?if="(.*?)"/;
6839
    var execRe = /^<tpl\b[^>]*?exec="(.*?)"/;
6840
    var m, id = 0;
6841
    var tpls = [];
6842
 
6843
    while(m = s.match(re)){
6844
       var m2 = m[0].match(nameRe);
6845
       var m3 = m[0].match(ifRe);
6846
       var m4 = m[0].match(execRe);
6847
       var exp = null, fn = null, exec = null;
6848
       var name = m2 && m2[1] ? m2[1] : '';
6849
       if(m3){
6850
           exp = m3 && m3[1] ? m3[1] : null;
6851
           if(exp){
6852
               fn = new Function('values', 'parent', 'xindex', 'xcount', 'with(values){ return '+(Ext.util.Format.htmlDecode(exp))+'; }');
6853
           }
6854
       }
6855
       if(m4){
6856
           exp = m4 && m4[1] ? m4[1] : null;
6857
           if(exp){
6858
               exec = new Function('values', 'parent', 'xindex', 'xcount', 'with(values){ '+(Ext.util.Format.htmlDecode(exp))+'; }');
6859
           }
6860
       }
6861
       if(name){
6862
           switch(name){
6863
               case '.': name = new Function('values', 'parent', 'with(values){ return values; }'); break;
6864
               case '..': name = new Function('values', 'parent', 'with(values){ return parent; }'); break;
6865
               default: name = new Function('values', 'parent', 'with(values){ return '+name+'; }');
6866
           }
6867
       }
6868
       tpls.push({
6869
            id: id,
6870
            target: name,
6871
            exec: exec,
6872
            test: fn,
6873
            body: m[1]||''
6874
        });
6875
       s = s.replace(m[0], '{xtpl'+ id + '}');
6876
       ++id;
6877
    }
6878
    for(var i = tpls.length-1; i >= 0; --i){
6879
        this.compileTpl(tpls[i]);
6880
    }
6881
    this.master = tpls[tpls.length-1];
6882
    this.tpls = tpls;
6883
};
6884
Ext.extend(Ext.XTemplate, Ext.Template, {
6885
 
6886
    re : /\{([\w-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\\]\s?[\d\.\+\-\*\\\(\)]+)?\}/g,
6887
 
6888
    codeRe : /\{\[((?:\\\]|.|\n)*?)\]\}/g,
6889
 
6890
 
6891
    applySubTemplate : function(id, values, parent, xindex, xcount){
6892
        var t = this.tpls[id];
6893
        if(t.test && !t.test.call(this, values, parent, xindex, xcount)){
6894
            return '';
6895
        }
6896
        if(t.exec && t.exec.call(this, values, parent, xindex, xcount)){
6897
            return '';
6898
        }
6899
        var vs = t.target ? t.target.call(this, values, parent) : values;
6900
        parent = t.target ? values : parent;
6901
        if(t.target && Ext.isArray(vs)){
6902
            var buf = [];
6903
            for(var i = 0, len = vs.length; i < len; i++){
6904
                buf[buf.length] = t.compiled.call(this, vs[i], parent, i+1, len);
6905
            }
6906
            return buf.join('');
6907
        }
6908
        return t.compiled.call(this, vs, parent, xindex, xcount);
6909
    },
6910
 
6911
 
6912
    compileTpl : function(tpl){
6913
        var fm = Ext.util.Format;
6914
        var useF = this.disableFormats !== true;
6915
        var sep = Ext.isGecko ? "+" : ",";
6916
        var fn = function(m, name, format, args, math){
6917
            if(name.substr(0, 4) == 'xtpl'){
6918
                return "'"+ sep +'this.applySubTemplate('+name.substr(4)+', values, parent, xindex, xcount)'+sep+"'";
6919
            }
6920
            var v;
6921
            if(name === '.'){
6922
                v = 'values';
6923
            }else if(name === '#'){
6924
                v = 'xindex';
6925
            }else if(name.indexOf('.') != -1){
6926
                v = name;
6927
            }else{
6928
                v = "values['" + name + "']";
6929
            }
6930
            if(math){
6931
                v = '(' + v + math + ')';
6932
            }
6933
            if(format && useF){
6934
                args = args ? ',' + args : "";
6935
                if(format.substr(0, 5) != "this."){
6936
                    format = "fm." + format + '(';
6937
                }else{
6938
                    format = 'this.call("'+ format.substr(5) + '", ';
6939
                    args = ", values";
6940
                }
6941
            }else{
6942
                args= ''; format = "("+v+" === undefined ? '' : ";
6943
            }
6944
            return "'"+ sep + format + v + args + ")"+sep+"'";
6945
        };
6946
        var codeFn = function(m, code){
6947
            return "'"+ sep +'('+code+')'+sep+"'";
6948
        };
6949
 
6950
        var body;
6951
 
6952
        if(Ext.isGecko){
6953
            body = "tpl.compiled = function(values, parent, xindex, xcount){ return '" +
6954
                   tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn).replace(this.codeRe, codeFn) +
6955
                    "';};";
6956
        }else{
6957
            body = ["tpl.compiled = function(values, parent, xindex, xcount){ return ['"];
6958
            body.push(tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn).replace(this.codeRe, codeFn));
6959
            body.push("'].join('');};");
6960
            body = body.join('');
6961
        }
6962
        eval(body);
6963
        return this;
6964
    },
6965
 
6966
 
6967
    apply : function(values){
6968
        return this.master.compiled.call(this, values, {}, 1, 1);
6969
    },
6970
 
6971
 
6972
    applyTemplate : function(values){
6973
        return this.master.compiled.call(this, values, {}, 1, 1);
6974
    },
6975
 
6976
 
6977
    compile : function(){return this;}
6978
 
6979
 
6980
 
6981
 
6982
 
6983
});
6984
 
6985
 
6986
Ext.XTemplate.from = function(el){
6987
    el = Ext.getDom(el);
6988
    return new Ext.XTemplate(el.value || el.innerHTML);
6989
};
6990
 
6991
Ext.util.CSS = function(){
6992
	var rules = null;
6993
   	var doc = document;
6994
 
6995
    var camelRe = /(-[a-z])/gi;
6996
    var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };
6997
 
6998
   return {
6999
 
7000
   createStyleSheet : function(cssText, id){
7001
       var ss;
7002
       var head = doc.getElementsByTagName("head")[0];
7003
       var rules = doc.createElement("style");
7004
       rules.setAttribute("type", "text/css");
7005
       if(id){
7006
           rules.setAttribute("id", id);
7007
       }
7008
       if(Ext.isIE){
7009
           head.appendChild(rules);
7010
           ss = rules.styleSheet;
7011
           ss.cssText = cssText;
7012
       }else{
7013
           try{
7014
                rules.appendChild(doc.createTextNode(cssText));
7015
           }catch(e){
7016
               rules.cssText = cssText;
7017
           }
7018
           head.appendChild(rules);
7019
           ss = rules.styleSheet ? rules.styleSheet : (rules.sheet || doc.styleSheets[doc.styleSheets.length-1]);
7020
       }
7021
       this.cacheStyleSheet(ss);
7022
       return ss;
7023
   },
7024
 
7025
 
7026
   removeStyleSheet : function(id){
7027
       var existing = doc.getElementById(id);
7028
       if(existing){
7029
           existing.parentNode.removeChild(existing);
7030
       }
7031
   },
7032
 
7033
 
7034
   swapStyleSheet : function(id, url){
7035
       this.removeStyleSheet(id);
7036
       var ss = doc.createElement("link");
7037
       ss.setAttribute("rel", "stylesheet");
7038
       ss.setAttribute("type", "text/css");
7039
       ss.setAttribute("id", id);
7040
       ss.setAttribute("href", url);
7041
       doc.getElementsByTagName("head")[0].appendChild(ss);
7042
   },
7043
 
7044
 
7045
   refreshCache : function(){
7046
       return this.getRules(true);
7047
   },
7048
 
7049
 
7050
   cacheStyleSheet : function(ss){
7051
       if(!rules){
7052
           rules = {};
7053
       }
7054
       try{
7055
           var ssRules = ss.cssRules || ss.rules;
7056
           for(var j = ssRules.length-1; j >= 0; --j){
7057
               rules[ssRules[j].selectorText] = ssRules[j];
7058
           }
7059
       }catch(e){}
7060
   },
7061
 
7062
 
7063
   getRules : function(refreshCache){
7064
   		if(rules == null || refreshCache){
7065
   			rules = {};
7066
   			var ds = doc.styleSheets;
7067
   			for(var i =0, len = ds.length; i < len; i++){
7068
   			    try{
7069
    		        this.cacheStyleSheet(ds[i]);
7070
    		    }catch(e){}
7071
	        }
7072
   		}
7073
   		return rules;
7074
   	},
7075
 
7076
 
7077
   getRule : function(selector, refreshCache){
7078
   		var rs = this.getRules(refreshCache);
7079
   		if(!Ext.isArray(selector)){
7080
   		    return rs[selector];
7081
   		}
7082
   		for(var i = 0; i < selector.length; i++){
7083
			if(rs[selector[i]]){
7084
				return rs[selector[i]];
7085
			}
7086
		}
7087
		return null;
7088
   	},
7089
 
7090
 
7091
 
7092
   updateRule : function(selector, property, value){
7093
   		if(!Ext.isArray(selector)){
7094
   			var rule = this.getRule(selector);
7095
   			if(rule){
7096
   				rule.style[property.replace(camelRe, camelFn)] = value;
7097
   				return true;
7098
   			}
7099
   		}else{
7100
   			for(var i = 0; i < selector.length; i++){
7101
   				if(this.updateRule(selector[i], property, value)){
7102
   					return true;
7103
   				}
7104
   			}
7105
   		}
7106
   		return false;
7107
   	}
7108
   };
7109
}();
7110
 
7111
Ext.util.ClickRepeater = function(el, config)
7112
{
7113
    this.el = Ext.get(el);
7114
    this.el.unselectable();
7115
 
7116
    Ext.apply(this, config);
7117
 
7118
    this.addEvents(
7119
 
7120
        "mousedown",
7121
 
7122
        "click",
7123
 
7124
        "mouseup"
7125
    );
7126
 
7127
    this.el.on("mousedown", this.handleMouseDown, this);
7128
    if(this.preventDefault || this.stopDefault){
7129
        this.el.on("click", function(e){
7130
            if(this.preventDefault){
7131
                e.preventDefault();
7132
            }
7133
            if(this.stopDefault){
7134
                e.stopEvent();
7135
            }
7136
        }, this);
7137
    }
7138
 
7139
        if(this.handler){
7140
        this.on("click", this.handler,  this.scope || this);
7141
    }
7142
 
7143
    Ext.util.ClickRepeater.superclass.constructor.call(this);
7144
};
7145
 
7146
Ext.extend(Ext.util.ClickRepeater, Ext.util.Observable, {
7147
    interval : 20,
7148
    delay: 250,
7149
    preventDefault : true,
7150
    stopDefault : false,
7151
    timer : 0,
7152
 
7153
        handleMouseDown : function(){
7154
        clearTimeout(this.timer);
7155
        this.el.blur();
7156
        if(this.pressClass){
7157
            this.el.addClass(this.pressClass);
7158
        }
7159
        this.mousedownTime = new Date();
7160
 
7161
        Ext.getDoc().on("mouseup", this.handleMouseUp, this);
7162
        this.el.on("mouseout", this.handleMouseOut, this);
7163
 
7164
        this.fireEvent("mousedown", this);
7165
        this.fireEvent("click", this);
7166
 
7167
        if (this.accelerate) {
7168
            this.delay = 400;
7169
	    }
7170
        this.timer = this.click.defer(this.delay || this.interval, this);
7171
    },
7172
 
7173
        click : function(){
7174
        this.fireEvent("click", this);
7175
        this.timer = this.click.defer(this.accelerate ?
7176
            this.easeOutExpo(this.mousedownTime.getElapsed(),
7177
                400,
7178
                -390,
7179
                12000) :
7180
            this.interval, this);
7181
    },
7182
 
7183
    easeOutExpo : function (t, b, c, d) {
7184
        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
7185
    },
7186
 
7187
        handleMouseOut : function(){
7188
        clearTimeout(this.timer);
7189
        if(this.pressClass){
7190
            this.el.removeClass(this.pressClass);
7191
        }
7192
        this.el.on("mouseover", this.handleMouseReturn, this);
7193
    },
7194
 
7195
        handleMouseReturn : function(){
7196
        this.el.un("mouseover", this.handleMouseReturn);
7197
        if(this.pressClass){
7198
            this.el.addClass(this.pressClass);
7199
        }
7200
        this.click();
7201
    },
7202
 
7203
        handleMouseUp : function(){
7204
        clearTimeout(this.timer);
7205
        this.el.un("mouseover", this.handleMouseReturn);
7206
        this.el.un("mouseout", this.handleMouseOut);
7207
        Ext.getDoc().un("mouseup", this.handleMouseUp);
7208
        this.el.removeClass(this.pressClass);
7209
        this.fireEvent("mouseup", this);
7210
    }
7211
});
7212
 
7213
Ext.KeyNav = function(el, config){
7214
    this.el = Ext.get(el);
7215
    Ext.apply(this, config);
7216
    if(!this.disabled){
7217
        this.disabled = true;
7218
        this.enable();
7219
    }
7220
};
7221
 
7222
Ext.KeyNav.prototype = {
7223
 
7224
    disabled : false,
7225
 
7226
    defaultEventAction: "stopEvent",
7227
 
7228
    forceKeyDown : false,
7229
 
7230
        prepareEvent : function(e){
7231
        var k = e.getKey();
7232
        var h = this.keyToHandler[k];
7233
                                if(Ext.isSafari && h && k >= 37 && k <= 40){
7234
            e.stopEvent();
7235
        }
7236
    },
7237
 
7238
        relay : function(e){
7239
        var k = e.getKey();
7240
        var h = this.keyToHandler[k];
7241
        if(h && this[h]){
7242
            if(this.doRelay(e, this[h], h) !== true){
7243
                e[this.defaultEventAction]();
7244
            }
7245
        }
7246
    },
7247
 
7248
        doRelay : function(e, h, hname){
7249
        return h.call(this.scope || this, e);
7250
    },
7251
 
7252
        enter : false,
7253
    left : false,
7254
    right : false,
7255
    up : false,
7256
    down : false,
7257
    tab : false,
7258
    esc : false,
7259
    pageUp : false,
7260
    pageDown : false,
7261
    del : false,
7262
    home : false,
7263
    end : false,
7264
 
7265
        keyToHandler : {
7266
        37 : "left",
7267
        39 : "right",
7268
        38 : "up",
7269
        40 : "down",
7270
        33 : "pageUp",
7271
        34 : "pageDown",
7272
        46 : "del",
7273
        36 : "home",
7274
        35 : "end",
7275
        13 : "enter",
7276
        27 : "esc",
7277
        9  : "tab"
7278
    },
7279
 
7280
 
7281
	enable: function(){
7282
		if(this.disabled){
7283
                                    if(this.forceKeyDown || Ext.isIE || Ext.isAir){
7284
                this.el.on("keydown", this.relay,  this);
7285
            }else{
7286
                this.el.on("keydown", this.prepareEvent,  this);
7287
                this.el.on("keypress", this.relay,  this);
7288
            }
7289
		    this.disabled = false;
7290
		}
7291
	},
7292
 
7293
 
7294
	disable: function(){
7295
		if(!this.disabled){
7296
		    if(this.forceKeyDown || Ext.isIE || Ext.isAir){
7297
                this.el.un("keydown", this.relay);
7298
            }else{
7299
                this.el.un("keydown", this.prepareEvent);
7300
                this.el.un("keypress", this.relay);
7301
            }
7302
		    this.disabled = true;
7303
		}
7304
	}
7305
};
7306
 
7307
Ext.KeyMap = function(el, config, eventName){
7308
    this.el  = Ext.get(el);
7309
    this.eventName = eventName || "keydown";
7310
    this.bindings = [];
7311
    if(config){
7312
        this.addBinding(config);
7313
    }
7314
    this.enable();
7315
};
7316
 
7317
Ext.KeyMap.prototype = {
7318
 
7319
    stopEvent : false,
7320
 
7321
 
7322
	addBinding : function(config){
7323
        if(Ext.isArray(config)){
7324
            for(var i = 0, len = config.length; i < len; i++){
7325
                this.addBinding(config[i]);
7326
            }
7327
            return;
7328
        }
7329
        var keyCode = config.key,
7330
            shift = config.shift,
7331
            ctrl = config.ctrl,
7332
            alt = config.alt,
7333
            fn = config.fn || config.handler,
7334
            scope = config.scope;
7335
 
7336
        if(typeof keyCode == "string"){
7337
            var ks = [];
7338
            var keyString = keyCode.toUpperCase();
7339
            for(var j = 0, len = keyString.length; j < len; j++){
7340
                ks.push(keyString.charCodeAt(j));
7341
            }
7342
            keyCode = ks;
7343
        }
7344
        var keyArray = Ext.isArray(keyCode);
7345
 
7346
        var handler = function(e){
7347
            if((!shift || e.shiftKey) && (!ctrl || e.ctrlKey) &&  (!alt || e.altKey)){
7348
                var k = e.getKey();
7349
                if(keyArray){
7350
                    for(var i = 0, len = keyCode.length; i < len; i++){
7351
                        if(keyCode[i] == k){
7352
                          if(this.stopEvent){
7353
                              e.stopEvent();
7354
                          }
7355
                          fn.call(scope || window, k, e);
7356
                          return;
7357
                        }
7358
                    }
7359
                }else{
7360
                    if(k == keyCode){
7361
                        if(this.stopEvent){
7362
                           e.stopEvent();
7363
                        }
7364
                        fn.call(scope || window, k, e);
7365
                    }
7366
                }
7367
            }
7368
        };
7369
        this.bindings.push(handler);
7370
	},
7371
 
7372
 
7373
    on : function(key, fn, scope){
7374
        var keyCode, shift, ctrl, alt;
7375
        if(typeof key == "object" && !Ext.isArray(key)){
7376
            keyCode = key.key;
7377
            shift = key.shift;
7378
            ctrl = key.ctrl;
7379
            alt = key.alt;
7380
        }else{
7381
            keyCode = key;
7382
        }
7383
        this.addBinding({
7384
            key: keyCode,
7385
            shift: shift,
7386
            ctrl: ctrl,
7387
            alt: alt,
7388
            fn: fn,
7389
            scope: scope
7390
        })
7391
    },
7392
 
7393
 
7394
    handleKeyDown : function(e){
7395
	    if(this.enabled){
7396
    	    var b = this.bindings;
7397
    	    for(var i = 0, len = b.length; i < len; i++){
7398
    	        b[i].call(this, e);
7399
    	    }
7400
	    }
7401
	},
7402
 
7403
 
7404
	isEnabled : function(){
7405
	    return this.enabled;
7406
	},
7407
 
7408
 
7409
	enable: function(){
7410
		if(!this.enabled){
7411
		    this.el.on(this.eventName, this.handleKeyDown, this);
7412
		    this.enabled = true;
7413
		}
7414
	},
7415
 
7416
 
7417
	disable: function(){
7418
		if(this.enabled){
7419
		    this.el.removeListener(this.eventName, this.handleKeyDown, this);
7420
		    this.enabled = false;
7421
		}
7422
	}
7423
};
7424
 
7425
Ext.util.TextMetrics = function(){
7426
    var shared;
7427
    return {
7428
 
7429
        measure : function(el, text, fixedWidth){
7430
            if(!shared){
7431
                shared = Ext.util.TextMetrics.Instance(el, fixedWidth);
7432
            }
7433
            shared.bind(el);
7434
            shared.setFixedWidth(fixedWidth || 'auto');
7435
            return shared.getSize(text);
7436
        },
7437
 
7438
 
7439
        createInstance : function(el, fixedWidth){
7440
            return Ext.util.TextMetrics.Instance(el, fixedWidth);
7441
        }
7442
    };
7443
}();
7444
 
7445
Ext.util.TextMetrics.Instance = function(bindTo, fixedWidth){
7446
    var ml = new Ext.Element(document.createElement('div'));
7447
    document.body.appendChild(ml.dom);
7448
    ml.position('absolute');
7449
    ml.setLeftTop(-1000, -1000);
7450
    ml.hide();
7451
 
7452
    if(fixedWidth){
7453
        ml.setWidth(fixedWidth);
7454
    }
7455
 
7456
    var instance = {
7457
 
7458
        getSize : function(text){
7459
            ml.update(text);
7460
            var s = ml.getSize();
7461
            ml.update('');
7462
            return s;
7463
        },
7464
 
7465
 
7466
        bind : function(el){
7467
            ml.setStyle(
7468
                Ext.fly(el).getStyles('font-size','font-style', 'font-weight', 'font-family','line-height')
7469
            );
7470
        },
7471
 
7472
 
7473
        setFixedWidth : function(width){
7474
            ml.setWidth(width);
7475
        },
7476
 
7477
 
7478
        getWidth : function(text){
7479
            ml.dom.style.width = 'auto';
7480
            return this.getSize(text).width;
7481
        },
7482
 
7483
 
7484
        getHeight : function(text){
7485
            return this.getSize(text).height;
7486
        }
7487
    };
7488
 
7489
    instance.bind(bindTo);
7490
 
7491
    return instance;
7492
};
7493
 
7494
Ext.Element.measureText = Ext.util.TextMetrics.measure;
7495
 
7496
 
7497
(function() {
7498
 
7499
var Event=Ext.EventManager;
7500
var Dom=Ext.lib.Dom;
7501
 
7502
 
7503
Ext.dd.DragDrop = function(id, sGroup, config) {
7504
    if(id) {
7505
        this.init(id, sGroup, config);
7506
    }
7507
};
7508
 
7509
Ext.dd.DragDrop.prototype = {
7510
 
7511
 
7512
    id: null,
7513
 
7514
 
7515
    config: null,
7516
 
7517
 
7518
    dragElId: null,
7519
 
7520
 
7521
    handleElId: null,
7522
 
7523
 
7524
    invalidHandleTypes: null,
7525
 
7526
 
7527
    invalidHandleIds: null,
7528
 
7529
 
7530
    invalidHandleClasses: null,
7531
 
7532
 
7533
    startPageX: 0,
7534
 
7535
 
7536
    startPageY: 0,
7537
 
7538
 
7539
    groups: null,
7540
 
7541
 
7542
    locked: false,
7543
 
7544
 
7545
    lock: function() { this.locked = true; },
7546
 
7547
 
7548
    unlock: function() { this.locked = false; },
7549
 
7550
 
7551
    isTarget: true,
7552
 
7553
 
7554
    padding: null,
7555
 
7556
 
7557
    _domRef: null,
7558
 
7559
 
7560
    __ygDragDrop: true,
7561
 
7562
 
7563
    constrainX: false,
7564
 
7565
 
7566
    constrainY: false,
7567
 
7568
 
7569
    minX: 0,
7570
 
7571
 
7572
    maxX: 0,
7573
 
7574
 
7575
    minY: 0,
7576
 
7577
 
7578
    maxY: 0,
7579
 
7580
 
7581
    maintainOffset: false,
7582
 
7583
 
7584
    xTicks: null,
7585
 
7586
 
7587
    yTicks: null,
7588
 
7589
 
7590
    primaryButtonOnly: true,
7591
 
7592
 
7593
    available: false,
7594
 
7595
 
7596
    hasOuterHandles: false,
7597
 
7598
 
7599
    b4StartDrag: function(x, y) { },
7600
 
7601
 
7602
    startDrag: function(x, y) {  },
7603
 
7604
 
7605
    b4Drag: function(e) { },
7606
 
7607
 
7608
    onDrag: function(e) {  },
7609
 
7610
 
7611
    onDragEnter: function(e, id) {  },
7612
 
7613
 
7614
    b4DragOver: function(e) { },
7615
 
7616
 
7617
    onDragOver: function(e, id) {  },
7618
 
7619
 
7620
    b4DragOut: function(e) { },
7621
 
7622
 
7623
    onDragOut: function(e, id) {  },
7624
 
7625
 
7626
    b4DragDrop: function(e) { },
7627
 
7628
 
7629
    onDragDrop: function(e, id) {  },
7630
 
7631
 
7632
    onInvalidDrop: function(e) {  },
7633
 
7634
 
7635
    b4EndDrag: function(e) { },
7636
 
7637
 
7638
    endDrag: function(e) {  },
7639
 
7640
 
7641
    b4MouseDown: function(e) {  },
7642
 
7643
 
7644
    onMouseDown: function(e) {  },
7645
 
7646
 
7647
    onMouseUp: function(e) {  },
7648
 
7649
 
7650
    onAvailable: function () {
7651
    },
7652
 
7653
 
7654
    defaultPadding : {left:0, right:0, top:0, bottom:0},
7655
 
7656
 
7657
    constrainTo : function(constrainTo, pad, inContent){
7658
        if(typeof pad == "number"){
7659
            pad = {left: pad, right:pad, top:pad, bottom:pad};
7660
        }
7661
        pad = pad || this.defaultPadding;
7662
        var b = Ext.get(this.getEl()).getBox();
7663
        var ce = Ext.get(constrainTo);
7664
        var s = ce.getScroll();
7665
        var c, cd = ce.dom;
7666
        if(cd == document.body){
7667
            c = { x: s.left, y: s.top, width: Ext.lib.Dom.getViewWidth(), height: Ext.lib.Dom.getViewHeight()};
7668
        }else{
7669
            var xy = ce.getXY();
7670
            c = {x : xy[0]+s.left, y: xy[1]+s.top, width: cd.clientWidth, height: cd.clientHeight};
7671
        }
7672
 
7673
 
7674
        var topSpace = b.y - c.y;
7675
        var leftSpace = b.x - c.x;
7676
 
7677
        this.resetConstraints();
7678
        this.setXConstraint(leftSpace - (pad.left||0),
7679
                c.width - leftSpace - b.width - (pad.right||0),
7680
				this.xTickSize
7681
        );
7682
        this.setYConstraint(topSpace - (pad.top||0),
7683
                c.height - topSpace - b.height - (pad.bottom||0),
7684
				this.yTickSize
7685
        );
7686
    },
7687
 
7688
 
7689
    getEl: function() {
7690
        if (!this._domRef) {
7691
            this._domRef = Ext.getDom(this.id);
7692
        }
7693
 
7694
        return this._domRef;
7695
    },
7696
 
7697
 
7698
    getDragEl: function() {
7699
        return Ext.getDom(this.dragElId);
7700
    },
7701
 
7702
 
7703
    init: function(id, sGroup, config) {
7704
        this.initTarget(id, sGroup, config);
7705
        Event.on(this.id, "mousedown", this.handleMouseDown, this);
7706
 
7707
    },
7708
 
7709
 
7710
    initTarget: function(id, sGroup, config) {
7711
 
7712
 
7713
        this.config = config || {};
7714
 
7715
 
7716
        this.DDM = Ext.dd.DDM;
7717
 
7718
        this.groups = {};
7719
 
7720
 
7721
 
7722
        if (typeof id !== "string") {
7723
            id = Ext.id(id);
7724
        }
7725
 
7726
 
7727
        this.id = id;
7728
 
7729
 
7730
        this.addToGroup((sGroup) ? sGroup : "default");
7731
 
7732
 
7733
 
7734
        this.handleElId = id;
7735
 
7736
 
7737
        this.setDragElId(id);
7738
 
7739
 
7740
        this.invalidHandleTypes = { A: "A" };
7741
        this.invalidHandleIds = {};
7742
        this.invalidHandleClasses = [];
7743
 
7744
        this.applyConfig();
7745
 
7746
        this.handleOnAvailable();
7747
    },
7748
 
7749
 
7750
    applyConfig: function() {
7751
 
7752
 
7753
 
7754
        this.padding           = this.config.padding || [0, 0, 0, 0];
7755
        this.isTarget          = (this.config.isTarget !== false);
7756
        this.maintainOffset    = (this.config.maintainOffset);
7757
        this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);
7758
 
7759
    },
7760
 
7761
 
7762
    handleOnAvailable: function() {
7763
        this.available = true;
7764
        this.resetConstraints();
7765
        this.onAvailable();
7766
    },
7767
 
7768
 
7769
    setPadding: function(iTop, iRight, iBot, iLeft) {
7770
 
7771
        if (!iRight && 0 !== iRight) {
7772
            this.padding = [iTop, iTop, iTop, iTop];
7773
        } else if (!iBot && 0 !== iBot) {
7774
            this.padding = [iTop, iRight, iTop, iRight];
7775
        } else {
7776
            this.padding = [iTop, iRight, iBot, iLeft];
7777
        }
7778
    },
7779
 
7780
 
7781
    setInitPosition: function(diffX, diffY) {
7782
        var el = this.getEl();
7783
 
7784
        if (!this.DDM.verifyEl(el)) {
7785
            return;
7786
        }
7787
 
7788
        var dx = diffX || 0;
7789
        var dy = diffY || 0;
7790
 
7791
        var p = Dom.getXY( el );
7792
 
7793
        this.initPageX = p[0] - dx;
7794
        this.initPageY = p[1] - dy;
7795
 
7796
        this.lastPageX = p[0];
7797
        this.lastPageY = p[1];
7798
 
7799
 
7800
        this.setStartPosition(p);
7801
    },
7802
 
7803
 
7804
    setStartPosition: function(pos) {
7805
        var p = pos || Dom.getXY( this.getEl() );
7806
        this.deltaSetXY = null;
7807
 
7808
        this.startPageX = p[0];
7809
        this.startPageY = p[1];
7810
    },
7811
 
7812
 
7813
    addToGroup: function(sGroup) {
7814
        this.groups[sGroup] = true;
7815
        this.DDM.regDragDrop(this, sGroup);
7816
    },
7817
 
7818
 
7819
    removeFromGroup: function(sGroup) {
7820
        if (this.groups[sGroup]) {
7821
            delete this.groups[sGroup];
7822
        }
7823
 
7824
        this.DDM.removeDDFromGroup(this, sGroup);
7825
    },
7826
 
7827
 
7828
    setDragElId: function(id) {
7829
        this.dragElId = id;
7830
    },
7831
 
7832
 
7833
    setHandleElId: function(id) {
7834
        if (typeof id !== "string") {
7835
            id = Ext.id(id);
7836
        }
7837
        this.handleElId = id;
7838
        this.DDM.regHandle(this.id, id);
7839
    },
7840
 
7841
 
7842
    setOuterHandleElId: function(id) {
7843
        if (typeof id !== "string") {
7844
            id = Ext.id(id);
7845
        }
7846
        Event.on(id, "mousedown",
7847
                this.handleMouseDown, this);
7848
        this.setHandleElId(id);
7849
 
7850
        this.hasOuterHandles = true;
7851
    },
7852
 
7853
 
7854
    unreg: function() {
7855
        Event.un(this.id, "mousedown",
7856
                this.handleMouseDown);
7857
        this._domRef = null;
7858
        this.DDM._remove(this);
7859
    },
7860
 
7861
    destroy : function(){
7862
        this.unreg();
7863
    },
7864
 
7865
 
7866
    isLocked: function() {
7867
        return (this.DDM.isLocked() || this.locked);
7868
    },
7869
 
7870
 
7871
    handleMouseDown: function(e, oDD){
7872
        if (this.primaryButtonOnly && e.button != 0) {
7873
            return;
7874
        }
7875
 
7876
        if (this.isLocked()) {
7877
            return;
7878
        }
7879
 
7880
        this.DDM.refreshCache(this.groups);
7881
 
7882
        var pt = new Ext.lib.Point(Ext.lib.Event.getPageX(e), Ext.lib.Event.getPageY(e));
7883
        if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) )  {
7884
        } else {
7885
            if (this.clickValidator(e)) {
7886
 
7887
 
7888
                this.setStartPosition();
7889
 
7890
 
7891
                this.b4MouseDown(e);
7892
                this.onMouseDown(e);
7893
 
7894
                this.DDM.handleMouseDown(e, this);
7895
 
7896
                this.DDM.stopEvent(e);
7897
            } else {
7898
 
7899
 
7900
            }
7901
        }
7902
    },
7903
 
7904
    clickValidator: function(e) {
7905
        var target = e.getTarget();
7906
        return ( this.isValidHandleChild(target) &&
7907
                    (this.id == this.handleElId ||
7908
                        this.DDM.handleWasClicked(target, this.id)) );
7909
    },
7910
 
7911
 
7912
    addInvalidHandleType: function(tagName) {
7913
        var type = tagName.toUpperCase();
7914
        this.invalidHandleTypes[type] = type;
7915
    },
7916
 
7917
 
7918
    addInvalidHandleId: function(id) {
7919
        if (typeof id !== "string") {
7920
            id = Ext.id(id);
7921
        }
7922
        this.invalidHandleIds[id] = id;
7923
    },
7924
 
7925
 
7926
    addInvalidHandleClass: function(cssClass) {
7927
        this.invalidHandleClasses.push(cssClass);
7928
    },
7929
 
7930
 
7931
    removeInvalidHandleType: function(tagName) {
7932
        var type = tagName.toUpperCase();
7933
 
7934
        delete this.invalidHandleTypes[type];
7935
    },
7936
 
7937
 
7938
    removeInvalidHandleId: function(id) {
7939
        if (typeof id !== "string") {
7940
            id = Ext.id(id);
7941
        }
7942
        delete this.invalidHandleIds[id];
7943
    },
7944
 
7945
 
7946
    removeInvalidHandleClass: function(cssClass) {
7947
        for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {
7948
            if (this.invalidHandleClasses[i] == cssClass) {
7949
                delete this.invalidHandleClasses[i];
7950
            }
7951
        }
7952
    },
7953
 
7954
 
7955
    isValidHandleChild: function(node) {
7956
 
7957
        var valid = true;
7958
 
7959
        var nodeName;
7960
        try {
7961
            nodeName = node.nodeName.toUpperCase();
7962
        } catch(e) {
7963
            nodeName = node.nodeName;
7964
        }
7965
        valid = valid && !this.invalidHandleTypes[nodeName];
7966
        valid = valid && !this.invalidHandleIds[node.id];
7967
 
7968
        for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {
7969
            valid = !Dom.hasClass(node, this.invalidHandleClasses[i]);
7970
        }
7971
 
7972
 
7973
        return valid;
7974
 
7975
    },
7976
 
7977
 
7978
    setXTicks: function(iStartX, iTickSize) {
7979
        this.xTicks = [];
7980
        this.xTickSize = iTickSize;
7981
 
7982
        var tickMap = {};
7983
 
7984
        for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {
7985
            if (!tickMap[i]) {
7986
                this.xTicks[this.xTicks.length] = i;
7987
                tickMap[i] = true;
7988
            }
7989
        }
7990
 
7991
        for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {
7992
            if (!tickMap[i]) {
7993
                this.xTicks[this.xTicks.length] = i;
7994
                tickMap[i] = true;
7995
            }
7996
        }
7997
 
7998
        this.xTicks.sort(this.DDM.numericSort) ;
7999
    },
8000
 
8001
 
8002
    setYTicks: function(iStartY, iTickSize) {
8003
        this.yTicks = [];
8004
        this.yTickSize = iTickSize;
8005
 
8006
        var tickMap = {};
8007
 
8008
        for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {
8009
            if (!tickMap[i]) {
8010
                this.yTicks[this.yTicks.length] = i;
8011
                tickMap[i] = true;
8012
            }
8013
        }
8014
 
8015
        for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {
8016
            if (!tickMap[i]) {
8017
                this.yTicks[this.yTicks.length] = i;
8018
                tickMap[i] = true;
8019
            }
8020
        }
8021
 
8022
        this.yTicks.sort(this.DDM.numericSort) ;
8023
    },
8024
 
8025
 
8026
    setXConstraint: function(iLeft, iRight, iTickSize) {
8027
        this.leftConstraint = iLeft;
8028
        this.rightConstraint = iRight;
8029
 
8030
        this.minX = this.initPageX - iLeft;
8031
        this.maxX = this.initPageX + iRight;
8032
        if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
8033
 
8034
        this.constrainX = true;
8035
    },
8036
 
8037
 
8038
    clearConstraints: function() {
8039
        this.constrainX = false;
8040
        this.constrainY = false;
8041
        this.clearTicks();
8042
    },
8043
 
8044
 
8045
    clearTicks: function() {
8046
        this.xTicks = null;
8047
        this.yTicks = null;
8048
        this.xTickSize = 0;
8049
        this.yTickSize = 0;
8050
    },
8051
 
8052
 
8053
    setYConstraint: function(iUp, iDown, iTickSize) {
8054
        this.topConstraint = iUp;
8055
        this.bottomConstraint = iDown;
8056
 
8057
        this.minY = this.initPageY - iUp;
8058
        this.maxY = this.initPageY + iDown;
8059
        if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
8060
 
8061
        this.constrainY = true;
8062
 
8063
    },
8064
 
8065
 
8066
    resetConstraints: function() {
8067
 
8068
 
8069
 
8070
        if (this.initPageX || this.initPageX === 0) {
8071
 
8072
            var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
8073
            var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;
8074
 
8075
            this.setInitPosition(dx, dy);
8076
 
8077
 
8078
        } else {
8079
            this.setInitPosition();
8080
        }
8081
 
8082
        if (this.constrainX) {
8083
            this.setXConstraint( this.leftConstraint,
8084
                                 this.rightConstraint,
8085
                                 this.xTickSize        );
8086
        }
8087
 
8088
        if (this.constrainY) {
8089
            this.setYConstraint( this.topConstraint,
8090
                                 this.bottomConstraint,
8091
                                 this.yTickSize         );
8092
        }
8093
    },
8094
 
8095
 
8096
    getTick: function(val, tickArray) {
8097
 
8098
        if (!tickArray) {
8099
 
8100
 
8101
            return val;
8102
        } else if (tickArray[0] >= val) {
8103
 
8104
 
8105
            return tickArray[0];
8106
        } else {
8107
            for (var i=0, len=tickArray.length; i<len; ++i) {
8108
                var next = i + 1;
8109
                if (tickArray[next] && tickArray[next] >= val) {
8110
                    var diff1 = val - tickArray[i];
8111
                    var diff2 = tickArray[next] - val;
8112
                    return (diff2 > diff1) ? tickArray[i] : tickArray[next];
8113
                }
8114
            }
8115
 
8116
 
8117
 
8118
            return tickArray[tickArray.length - 1];
8119
        }
8120
    },
8121
 
8122
 
8123
    toString: function() {
8124
        return ("DragDrop " + this.id);
8125
    }
8126
 
8127
};
8128
 
8129
})();
8130
 
8131
 
8132
 
8133
 
8134
if (!Ext.dd.DragDropMgr) {
8135
 
8136
 
8137
Ext.dd.DragDropMgr = function() {
8138
 
8139
    var Event = Ext.EventManager;
8140
 
8141
    return {
8142
 
8143
 
8144
        ids: {},
8145
 
8146
 
8147
        handleIds: {},
8148
 
8149
 
8150
        dragCurrent: null,
8151
 
8152
 
8153
        dragOvers: {},
8154
 
8155
 
8156
        deltaX: 0,
8157
 
8158
 
8159
        deltaY: 0,
8160
 
8161
 
8162
        preventDefault: true,
8163
 
8164
 
8165
        stopPropagation: true,
8166
 
8167
 
8168
        initalized: false,
8169
 
8170
 
8171
        locked: false,
8172
 
8173
 
8174
        init: function() {
8175
            this.initialized = true;
8176
        },
8177
 
8178
 
8179
        POINT: 0,
8180
 
8181
 
8182
        INTERSECT: 1,
8183
 
8184
 
8185
        mode: 0,
8186
 
8187
 
8188
        _execOnAll: function(sMethod, args) {
8189
            for (var i in this.ids) {
8190
                for (var j in this.ids[i]) {
8191
                    var oDD = this.ids[i][j];
8192
                    if (! this.isTypeOfDD(oDD)) {
8193
                        continue;
8194
                    }
8195
                    oDD[sMethod].apply(oDD, args);
8196
                }
8197
            }
8198
        },
8199
 
8200
 
8201
        _onLoad: function() {
8202
 
8203
            this.init();
8204
 
8205
 
8206
            Event.on(document, "mouseup",   this.handleMouseUp, this, true);
8207
            Event.on(document, "mousemove", this.handleMouseMove, this, true);
8208
            Event.on(window,   "unload",    this._onUnload, this, true);
8209
            Event.on(window,   "resize",    this._onResize, this, true);
8210
 
8211
 
8212
        },
8213
 
8214
 
8215
        _onResize: function(e) {
8216
            this._execOnAll("resetConstraints", []);
8217
        },
8218
 
8219
 
8220
        lock: function() { this.locked = true; },
8221
 
8222
 
8223
        unlock: function() { this.locked = false; },
8224
 
8225
 
8226
        isLocked: function() { return this.locked; },
8227
 
8228
 
8229
        locationCache: {},
8230
 
8231
 
8232
        useCache: true,
8233
 
8234
 
8235
        clickPixelThresh: 3,
8236
 
8237
 
8238
        clickTimeThresh: 350,
8239
 
8240
 
8241
        dragThreshMet: false,
8242
 
8243
 
8244
        clickTimeout: null,
8245
 
8246
 
8247
        startX: 0,
8248
 
8249
 
8250
        startY: 0,
8251
 
8252
 
8253
        regDragDrop: function(oDD, sGroup) {
8254
            if (!this.initialized) { this.init(); }
8255
 
8256
            if (!this.ids[sGroup]) {
8257
                this.ids[sGroup] = {};
8258
            }
8259
            this.ids[sGroup][oDD.id] = oDD;
8260
        },
8261
 
8262
 
8263
        removeDDFromGroup: function(oDD, sGroup) {
8264
            if (!this.ids[sGroup]) {
8265
                this.ids[sGroup] = {};
8266
            }
8267
 
8268
            var obj = this.ids[sGroup];
8269
            if (obj && obj[oDD.id]) {
8270
                delete obj[oDD.id];
8271
            }
8272
        },
8273
 
8274
 
8275
        _remove: function(oDD) {
8276
            for (var g in oDD.groups) {
8277
                if (g && this.ids[g][oDD.id]) {
8278
                    delete this.ids[g][oDD.id];
8279
                }
8280
            }
8281
            delete this.handleIds[oDD.id];
8282
        },
8283
 
8284
 
8285
        regHandle: function(sDDId, sHandleId) {
8286
            if (!this.handleIds[sDDId]) {
8287
                this.handleIds[sDDId] = {};
8288
            }
8289
            this.handleIds[sDDId][sHandleId] = sHandleId;
8290
        },
8291
 
8292
 
8293
        isDragDrop: function(id) {
8294
            return ( this.getDDById(id) ) ? true : false;
8295
        },
8296
 
8297
 
8298
        getRelated: function(p_oDD, bTargetsOnly) {
8299
            var oDDs = [];
8300
            for (var i in p_oDD.groups) {
8301
                for (j in this.ids[i]) {
8302
                    var dd = this.ids[i][j];
8303
                    if (! this.isTypeOfDD(dd)) {
8304
                        continue;
8305
                    }
8306
                    if (!bTargetsOnly || dd.isTarget) {
8307
                        oDDs[oDDs.length] = dd;
8308
                    }
8309
                }
8310
            }
8311
 
8312
            return oDDs;
8313
        },
8314
 
8315
 
8316
        isLegalTarget: function (oDD, oTargetDD) {
8317
            var targets = this.getRelated(oDD, true);
8318
            for (var i=0, len=targets.length;i<len;++i) {
8319
                if (targets[i].id == oTargetDD.id) {
8320
                    return true;
8321
                }
8322
            }
8323
 
8324
            return false;
8325
        },
8326
 
8327
 
8328
        isTypeOfDD: function (oDD) {
8329
            return (oDD && oDD.__ygDragDrop);
8330
        },
8331
 
8332
 
8333
        isHandle: function(sDDId, sHandleId) {
8334
            return ( this.handleIds[sDDId] &&
8335
                            this.handleIds[sDDId][sHandleId] );
8336
        },
8337
 
8338
 
8339
        getDDById: function(id) {
8340
            for (var i in this.ids) {
8341
                if (this.ids[i][id]) {
8342
                    return this.ids[i][id];
8343
                }
8344
            }
8345
            return null;
8346
        },
8347
 
8348
 
8349
        handleMouseDown: function(e, oDD) {
8350
            if(Ext.QuickTips){
8351
                Ext.QuickTips.disable();
8352
            }
8353
            this.currentTarget = e.getTarget();
8354
 
8355
            this.dragCurrent = oDD;
8356
 
8357
            var el = oDD.getEl();
8358
 
8359
 
8360
            this.startX = e.getPageX();
8361
            this.startY = e.getPageY();
8362
 
8363
            this.deltaX = this.startX - el.offsetLeft;
8364
            this.deltaY = this.startY - el.offsetTop;
8365
 
8366
            this.dragThreshMet = false;
8367
 
8368
            this.clickTimeout = setTimeout(
8369
                    function() {
8370
                        var DDM = Ext.dd.DDM;
8371
                        DDM.startDrag(DDM.startX, DDM.startY);
8372
                    },
8373
                    this.clickTimeThresh );
8374
        },
8375
 
8376
 
8377
        startDrag: function(x, y) {
8378
            clearTimeout(this.clickTimeout);
8379
            if (this.dragCurrent) {
8380
                this.dragCurrent.b4StartDrag(x, y);
8381
                this.dragCurrent.startDrag(x, y);
8382
            }
8383
            this.dragThreshMet = true;
8384
        },
8385
 
8386
 
8387
        handleMouseUp: function(e) {
8388
 
8389
            if(Ext.QuickTips){
8390
                Ext.QuickTips.enable();
8391
            }
8392
            if (! this.dragCurrent) {
8393
                return;
8394
            }
8395
 
8396
            clearTimeout(this.clickTimeout);
8397
 
8398
            if (this.dragThreshMet) {
8399
                this.fireEvents(e, true);
8400
            } else {
8401
            }
8402
 
8403
            this.stopDrag(e);
8404
 
8405
            this.stopEvent(e);
8406
        },
8407
 
8408
 
8409
        stopEvent: function(e){
8410
            if(this.stopPropagation) {
8411
                e.stopPropagation();
8412
            }
8413
 
8414
            if (this.preventDefault) {
8415
                e.preventDefault();
8416
            }
8417
        },
8418
 
8419
 
8420
        stopDrag: function(e) {
8421
 
8422
            if (this.dragCurrent) {
8423
                if (this.dragThreshMet) {
8424
                    this.dragCurrent.b4EndDrag(e);
8425
                    this.dragCurrent.endDrag(e);
8426
                }
8427
 
8428
                this.dragCurrent.onMouseUp(e);
8429
            }
8430
 
8431
            this.dragCurrent = null;
8432
            this.dragOvers = {};
8433
        },
8434
 
8435
 
8436
        handleMouseMove: function(e) {
8437
            if (! this.dragCurrent) {
8438
                return true;
8439
            }
8440
 
8441
 
8442
 
8443
 
8444
            if (Ext.isIE && (e.button !== 0 && e.button !== 1 && e.button !== 2)) {
8445
                this.stopEvent(e);
8446
                return this.handleMouseUp(e);
8447
            }
8448
 
8449
            if (!this.dragThreshMet) {
8450
                var diffX = Math.abs(this.startX - e.getPageX());
8451
                var diffY = Math.abs(this.startY - e.getPageY());
8452
                if (diffX > this.clickPixelThresh ||
8453
                            diffY > this.clickPixelThresh) {
8454
                    this.startDrag(this.startX, this.startY);
8455
                }
8456
            }
8457
 
8458
            if (this.dragThreshMet) {
8459
                this.dragCurrent.b4Drag(e);
8460
                this.dragCurrent.onDrag(e);
8461
                if(!this.dragCurrent.moveOnly){
8462
                    this.fireEvents(e, false);
8463
                }
8464
            }
8465
 
8466
            this.stopEvent(e);
8467
 
8468
            return true;
8469
        },
8470
 
8471
 
8472
        fireEvents: function(e, isDrop) {
8473
            var dc = this.dragCurrent;
8474
 
8475
 
8476
 
8477
            if (!dc || dc.isLocked()) {
8478
                return;
8479
            }
8480
 
8481
            var pt = e.getPoint();
8482
 
8483
 
8484
            var oldOvers = [];
8485
 
8486
            var outEvts   = [];
8487
            var overEvts  = [];
8488
            var dropEvts  = [];
8489
            var enterEvts = [];
8490
 
8491
 
8492
 
8493
            for (var i in this.dragOvers) {
8494
 
8495
                var ddo = this.dragOvers[i];
8496
 
8497
                if (! this.isTypeOfDD(ddo)) {
8498
                    continue;
8499
                }
8500
 
8501
                if (! this.isOverTarget(pt, ddo, this.mode)) {
8502
                    outEvts.push( ddo );
8503
                }
8504
 
8505
                oldOvers[i] = true;
8506
                delete this.dragOvers[i];
8507
            }
8508
 
8509
            for (var sGroup in dc.groups) {
8510
 
8511
                if ("string" != typeof sGroup) {
8512
                    continue;
8513
                }
8514
 
8515
                for (i in this.ids[sGroup]) {
8516
                    var oDD = this.ids[sGroup][i];
8517
                    if (! this.isTypeOfDD(oDD)) {
8518
                        continue;
8519
                    }
8520
 
8521
                    if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {
8522
                        if (this.isOverTarget(pt, oDD, this.mode)) {
8523
 
8524
                            if (isDrop) {
8525
                                dropEvts.push( oDD );
8526
 
8527
                            } else {
8528
 
8529
 
8530
                                if (!oldOvers[oDD.id]) {
8531
                                    enterEvts.push( oDD );
8532
 
8533
                                } else {
8534
                                    overEvts.push( oDD );
8535
                                }
8536
 
8537
                                this.dragOvers[oDD.id] = oDD;
8538
                            }
8539
                        }
8540
                    }
8541
                }
8542
            }
8543
 
8544
            if (this.mode) {
8545
                if (outEvts.length) {
8546
                    dc.b4DragOut(e, outEvts);
8547
                    dc.onDragOut(e, outEvts);
8548
                }
8549
 
8550
                if (enterEvts.length) {
8551
                    dc.onDragEnter(e, enterEvts);
8552
                }
8553
 
8554
                if (overEvts.length) {
8555
                    dc.b4DragOver(e, overEvts);
8556
                    dc.onDragOver(e, overEvts);
8557
                }
8558
 
8559
                if (dropEvts.length) {
8560
                    dc.b4DragDrop(e, dropEvts);
8561
                    dc.onDragDrop(e, dropEvts);
8562
                }
8563
 
8564
            } else {
8565
 
8566
                var len = 0;
8567
                for (i=0, len=outEvts.length; i<len; ++i) {
8568
                    dc.b4DragOut(e, outEvts[i].id);
8569
                    dc.onDragOut(e, outEvts[i].id);
8570
                }
8571
 
8572
 
8573
                for (i=0,len=enterEvts.length; i<len; ++i) {
8574
 
8575
                    dc.onDragEnter(e, enterEvts[i].id);
8576
                }
8577
 
8578
 
8579
                for (i=0,len=overEvts.length; i<len; ++i) {
8580
                    dc.b4DragOver(e, overEvts[i].id);
8581
                    dc.onDragOver(e, overEvts[i].id);
8582
                }
8583
 
8584
 
8585
                for (i=0, len=dropEvts.length; i<len; ++i) {
8586
                    dc.b4DragDrop(e, dropEvts[i].id);
8587
                    dc.onDragDrop(e, dropEvts[i].id);
8588
                }
8589
 
8590
            }
8591
 
8592
 
8593
            if (isDrop && !dropEvts.length) {
8594
                dc.onInvalidDrop(e);
8595
            }
8596
 
8597
        },
8598
 
8599
 
8600
        getBestMatch: function(dds) {
8601
            var winner = null;
8602
 
8603
 
8604
 
8605
 
8606
 
8607
 
8608
            var len = dds.length;
8609
 
8610
            if (len == 1) {
8611
                winner = dds[0];
8612
            } else {
8613
 
8614
                for (var i=0; i<len; ++i) {
8615
                    var dd = dds[i];
8616
 
8617
 
8618
 
8619
                    if (dd.cursorIsOver) {
8620
                        winner = dd;
8621
                        break;
8622
 
8623
                    } else {
8624
                        if (!winner ||
8625
                            winner.overlap.getArea() < dd.overlap.getArea()) {
8626
                            winner = dd;
8627
                        }
8628
                    }
8629
                }
8630
            }
8631
 
8632
            return winner;
8633
        },
8634
 
8635
 
8636
        refreshCache: function(groups) {
8637
            for (var sGroup in groups) {
8638
                if ("string" != typeof sGroup) {
8639
                    continue;
8640
                }
8641
                for (var i in this.ids[sGroup]) {
8642
                    var oDD = this.ids[sGroup][i];
8643
 
8644
                    if (this.isTypeOfDD(oDD)) {
8645
 
8646
                        var loc = this.getLocation(oDD);
8647
                        if (loc) {
8648
                            this.locationCache[oDD.id] = loc;
8649
                        } else {
8650
                            delete this.locationCache[oDD.id];
8651
 
8652
 
8653
 
8654
                        }
8655
                    }
8656
                }
8657
            }
8658
        },
8659
 
8660
 
8661
        verifyEl: function(el) {
8662
            if (el) {
8663
                var parent;
8664
                if(Ext.isIE){
8665
                    try{
8666
                        parent = el.offsetParent;
8667
                    }catch(e){}
8668
                }else{
8669
                    parent = el.offsetParent;
8670
                }
8671
                if (parent) {
8672
                    return true;
8673
                }
8674
            }
8675
 
8676
            return false;
8677
        },
8678
 
8679
 
8680
        getLocation: function(oDD) {
8681
            if (! this.isTypeOfDD(oDD)) {
8682
                return null;
8683
            }
8684
 
8685
            var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
8686
 
8687
            try {
8688
                pos= Ext.lib.Dom.getXY(el);
8689
            } catch (e) { }
8690
 
8691
            if (!pos) {
8692
                return null;
8693
            }
8694
 
8695
            x1 = pos[0];
8696
            x2 = x1 + el.offsetWidth;
8697
            y1 = pos[1];
8698
            y2 = y1 + el.offsetHeight;
8699
 
8700
            t = y1 - oDD.padding[0];
8701
            r = x2 + oDD.padding[1];
8702
            b = y2 + oDD.padding[2];
8703
            l = x1 - oDD.padding[3];
8704
 
8705
            return new Ext.lib.Region( t, r, b, l );
8706
        },
8707
 
8708
 
8709
        isOverTarget: function(pt, oTarget, intersect) {
8710
 
8711
            var loc = this.locationCache[oTarget.id];
8712
            if (!loc || !this.useCache) {
8713
                loc = this.getLocation(oTarget);
8714
                this.locationCache[oTarget.id] = loc;
8715
 
8716
            }
8717
 
8718
            if (!loc) {
8719
                return false;
8720
            }
8721
 
8722
            oTarget.cursorIsOver = loc.contains( pt );
8723
 
8724
 
8725
 
8726
 
8727
 
8728
 
8729
            var dc = this.dragCurrent;
8730
            if (!dc || !dc.getTargetCoord ||
8731
                    (!intersect && !dc.constrainX && !dc.constrainY)) {
8732
                return oTarget.cursorIsOver;
8733
            }
8734
 
8735
            oTarget.overlap = null;
8736
 
8737
 
8738
 
8739
 
8740
 
8741
            var pos = dc.getTargetCoord(pt.x, pt.y);
8742
 
8743
            var el = dc.getDragEl();
8744
            var curRegion = new Ext.lib.Region( pos.y,
8745
                                                   pos.x + el.offsetWidth,
8746
                                                   pos.y + el.offsetHeight,
8747
                                                   pos.x );
8748
 
8749
            var overlap = curRegion.intersect(loc);
8750
 
8751
            if (overlap) {
8752
                oTarget.overlap = overlap;
8753
                return (intersect) ? true : oTarget.cursorIsOver;
8754
            } else {
8755
                return false;
8756
            }
8757
        },
8758
 
8759
 
8760
        _onUnload: function(e, me) {
8761
            Ext.dd.DragDropMgr.unregAll();
8762
        },
8763
 
8764
 
8765
        unregAll: function() {
8766
 
8767
            if (this.dragCurrent) {
8768
                this.stopDrag();
8769
                this.dragCurrent = null;
8770
            }
8771
 
8772
            this._execOnAll("unreg", []);
8773
 
8774
            for (var i in this.elementCache) {
8775
                delete this.elementCache[i];
8776
            }
8777
 
8778
            this.elementCache = {};
8779
            this.ids = {};
8780
        },
8781
 
8782
 
8783
        elementCache: {},
8784
 
8785
 
8786
        getElWrapper: function(id) {
8787
            var oWrapper = this.elementCache[id];
8788
            if (!oWrapper || !oWrapper.el) {
8789
                oWrapper = this.elementCache[id] =
8790
                    new this.ElementWrapper(Ext.getDom(id));
8791
            }
8792
            return oWrapper;
8793
        },
8794
 
8795
 
8796
        getElement: function(id) {
8797
            return Ext.getDom(id);
8798
        },
8799
 
8800
 
8801
        getCss: function(id) {
8802
            var el = Ext.getDom(id);
8803
            return (el) ? el.style : null;
8804
        },
8805
 
8806
 
8807
        ElementWrapper: function(el) {
8808
 
8809
                this.el = el || null;
8810
 
8811
                this.id = this.el && el.id;
8812
 
8813
                this.css = this.el && el.style;
8814
            },
8815
 
8816
 
8817
        getPosX: function(el) {
8818
            return Ext.lib.Dom.getX(el);
8819
        },
8820
 
8821
 
8822
        getPosY: function(el) {
8823
            return Ext.lib.Dom.getY(el);
8824
        },
8825
 
8826
 
8827
        swapNode: function(n1, n2) {
8828
            if (n1.swapNode) {
8829
                n1.swapNode(n2);
8830
            } else {
8831
                var p = n2.parentNode;
8832
                var s = n2.nextSibling;
8833
 
8834
                if (s == n1) {
8835
                    p.insertBefore(n1, n2);
8836
                } else if (n2 == n1.nextSibling) {
8837
                    p.insertBefore(n2, n1);
8838
                } else {
8839
                    n1.parentNode.replaceChild(n2, n1);
8840
                    p.insertBefore(n1, s);
8841
                }
8842
            }
8843
        },
8844
 
8845
 
8846
        getScroll: function () {
8847
            var t, l, dde=document.documentElement, db=document.body;
8848
            if (dde && (dde.scrollTop || dde.scrollLeft)) {
8849
                t = dde.scrollTop;
8850
                l = dde.scrollLeft;
8851
            } else if (db) {
8852
                t = db.scrollTop;
8853
                l = db.scrollLeft;
8854
            } else {
8855
 
8856
            }
8857
            return { top: t, left: l };
8858
        },
8859
 
8860
 
8861
        getStyle: function(el, styleProp) {
8862
            return Ext.fly(el).getStyle(styleProp);
8863
        },
8864
 
8865
 
8866
        getScrollTop: function () { return this.getScroll().top; },
8867
 
8868
 
8869
        getScrollLeft: function () { return this.getScroll().left; },
8870
 
8871
 
8872
        moveToEl: function (moveEl, targetEl) {
8873
            var aCoord = Ext.lib.Dom.getXY(targetEl);
8874
            Ext.lib.Dom.setXY(moveEl, aCoord);
8875
        },
8876
 
8877
 
8878
        numericSort: function(a, b) { return (a - b); },
8879
 
8880
 
8881
        _timeoutCount: 0,
8882
 
8883
 
8884
        _addListeners: function() {
8885
            var DDM = Ext.dd.DDM;
8886
            if ( Ext.lib.Event && document ) {
8887
                DDM._onLoad();
8888
            } else {
8889
                if (DDM._timeoutCount > 2000) {
8890
                } else {
8891
                    setTimeout(DDM._addListeners, 10);
8892
                    if (document && document.body) {
8893
                        DDM._timeoutCount += 1;
8894
                    }
8895
                }
8896
            }
8897
        },
8898
 
8899
 
8900
        handleWasClicked: function(node, id) {
8901
            if (this.isHandle(id, node.id)) {
8902
                return true;
8903
            } else {
8904
 
8905
                var p = node.parentNode;
8906
 
8907
                while (p) {
8908
                    if (this.isHandle(id, p.id)) {
8909
                        return true;
8910
                    } else {
8911
                        p = p.parentNode;
8912
                    }
8913
                }
8914
            }
8915
 
8916
            return false;
8917
        }
8918
 
8919
    };
8920
 
8921
}();
8922
 
8923
 
8924
Ext.dd.DDM = Ext.dd.DragDropMgr;
8925
Ext.dd.DDM._addListeners();
8926
 
8927
}
8928
 
8929
 
8930
Ext.dd.DD = function(id, sGroup, config) {
8931
    if (id) {
8932
        this.init(id, sGroup, config);
8933
    }
8934
};
8935
 
8936
Ext.extend(Ext.dd.DD, Ext.dd.DragDrop, {
8937
 
8938
 
8939
    scroll: true,
8940
 
8941
 
8942
    autoOffset: function(iPageX, iPageY) {
8943
        var x = iPageX - this.startPageX;
8944
        var y = iPageY - this.startPageY;
8945
        this.setDelta(x, y);
8946
    },
8947
 
8948
 
8949
    setDelta: function(iDeltaX, iDeltaY) {
8950
        this.deltaX = iDeltaX;
8951
        this.deltaY = iDeltaY;
8952
    },
8953
 
8954
 
8955
    setDragElPos: function(iPageX, iPageY) {
8956
 
8957
 
8958
 
8959
        var el = this.getDragEl();
8960
        this.alignElWithMouse(el, iPageX, iPageY);
8961
    },
8962
 
8963
 
8964
    alignElWithMouse: function(el, iPageX, iPageY) {
8965
        var oCoord = this.getTargetCoord(iPageX, iPageY);
8966
        var fly = el.dom ? el : Ext.fly(el, '_dd');
8967
        if (!this.deltaSetXY) {
8968
            var aCoord = [oCoord.x, oCoord.y];
8969
            fly.setXY(aCoord);
8970
            var newLeft = fly.getLeft(true);
8971
            var newTop  = fly.getTop(true);
8972
            this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
8973
        } else {
8974
            fly.setLeftTop(oCoord.x + this.deltaSetXY[0], oCoord.y + this.deltaSetXY[1]);
8975
        }
8976
 
8977
        this.cachePosition(oCoord.x, oCoord.y);
8978
        this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
8979
        return oCoord;
8980
    },
8981
 
8982
 
8983
    cachePosition: function(iPageX, iPageY) {
8984
        if (iPageX) {
8985
            this.lastPageX = iPageX;
8986
            this.lastPageY = iPageY;
8987
        } else {
8988
            var aCoord = Ext.lib.Dom.getXY(this.getEl());
8989
            this.lastPageX = aCoord[0];
8990
            this.lastPageY = aCoord[1];
8991
        }
8992
    },
8993
 
8994
 
8995
    autoScroll: function(x, y, h, w) {
8996
 
8997
        if (this.scroll) {
8998
 
8999
            var clientH = Ext.lib.Dom.getViewHeight();
9000
 
9001
 
9002
            var clientW = Ext.lib.Dom.getViewWidth();
9003
 
9004
 
9005
            var st = this.DDM.getScrollTop();
9006
 
9007
 
9008
            var sl = this.DDM.getScrollLeft();
9009
 
9010
 
9011
            var bot = h + y;
9012
 
9013
 
9014
            var right = w + x;
9015
 
9016
 
9017
 
9018
 
9019
            var toBot = (clientH + st - y - this.deltaY);
9020
 
9021
 
9022
            var toRight = (clientW + sl - x - this.deltaX);
9023
 
9024
 
9025
 
9026
 
9027
            var thresh = 40;
9028
 
9029
 
9030
 
9031
 
9032
            var scrAmt = (document.all) ? 80 : 30;
9033
 
9034
 
9035
 
9036
            if ( bot > clientH && toBot < thresh ) {
9037
                window.scrollTo(sl, st + scrAmt);
9038
            }
9039
 
9040
 
9041
 
9042
            if ( y < st && st > 0 && y - st < thresh ) {
9043
                window.scrollTo(sl, st - scrAmt);
9044
            }
9045
 
9046
 
9047
 
9048
            if ( right > clientW && toRight < thresh ) {
9049
                window.scrollTo(sl + scrAmt, st);
9050
            }
9051
 
9052
 
9053
 
9054
            if ( x < sl && sl > 0 && x - sl < thresh ) {
9055
                window.scrollTo(sl - scrAmt, st);
9056
            }
9057
        }
9058
    },
9059
 
9060
 
9061
    getTargetCoord: function(iPageX, iPageY) {
9062
 
9063
 
9064
        var x = iPageX - this.deltaX;
9065
        var y = iPageY - this.deltaY;
9066
 
9067
        if (this.constrainX) {
9068
            if (x < this.minX) { x = this.minX; }
9069
            if (x > this.maxX) { x = this.maxX; }
9070
        }
9071
 
9072
        if (this.constrainY) {
9073
            if (y < this.minY) { y = this.minY; }
9074
            if (y > this.maxY) { y = this.maxY; }
9075
        }
9076
 
9077
        x = this.getTick(x, this.xTicks);
9078
        y = this.getTick(y, this.yTicks);
9079
 
9080
 
9081
        return {x:x, y:y};
9082
    },
9083
 
9084
 
9085
    applyConfig: function() {
9086
        Ext.dd.DD.superclass.applyConfig.call(this);
9087
        this.scroll = (this.config.scroll !== false);
9088
    },
9089
 
9090
 
9091
    b4MouseDown: function(e) {
9092
 
9093
        this.autoOffset(e.getPageX(),
9094
                            e.getPageY());
9095
    },
9096
 
9097
 
9098
    b4Drag: function(e) {
9099
        this.setDragElPos(e.getPageX(),
9100
                            e.getPageY());
9101
    },
9102
 
9103
    toString: function() {
9104
        return ("DD " + this.id);
9105
    }
9106
 
9107
 
9108
 
9109
 
9110
 
9111
 
9112
});
9113
 
9114
Ext.dd.DDProxy = function(id, sGroup, config) {
9115
    if (id) {
9116
        this.init(id, sGroup, config);
9117
        this.initFrame();
9118
    }
9119
};
9120
 
9121
 
9122
Ext.dd.DDProxy.dragElId = "ygddfdiv";
9123
 
9124
Ext.extend(Ext.dd.DDProxy, Ext.dd.DD, {
9125
 
9126
 
9127
    resizeFrame: true,
9128
 
9129
 
9130
    centerFrame: false,
9131
 
9132
 
9133
    createFrame: function() {
9134
        var self = this;
9135
        var body = document.body;
9136
 
9137
        if (!body || !body.firstChild) {
9138
            setTimeout( function() { self.createFrame(); }, 50 );
9139
            return;
9140
        }
9141
 
9142
        var div = this.getDragEl();
9143
 
9144
        if (!div) {
9145
            div    = document.createElement("div");
9146
            div.id = this.dragElId;
9147
            var s  = div.style;
9148
 
9149
            s.position   = "absolute";
9150
            s.visibility = "hidden";
9151
            s.cursor     = "move";
9152
            s.border     = "2px solid #aaa";
9153
            s.zIndex     = 999;
9154
 
9155
 
9156
 
9157
 
9158
            body.insertBefore(div, body.firstChild);
9159
        }
9160
    },
9161
 
9162
 
9163
    initFrame: function() {
9164
        this.createFrame();
9165
    },
9166
 
9167
    applyConfig: function() {
9168
        Ext.dd.DDProxy.superclass.applyConfig.call(this);
9169
 
9170
        this.resizeFrame = (this.config.resizeFrame !== false);
9171
        this.centerFrame = (this.config.centerFrame);
9172
        this.setDragElId(this.config.dragElId || Ext.dd.DDProxy.dragElId);
9173
    },
9174
 
9175
 
9176
    showFrame: function(iPageX, iPageY) {
9177
        var el = this.getEl();
9178
        var dragEl = this.getDragEl();
9179
        var s = dragEl.style;
9180
 
9181
        this._resizeProxy();
9182
 
9183
        if (this.centerFrame) {
9184
            this.setDelta( Math.round(parseInt(s.width,  10)/2),
9185
                           Math.round(parseInt(s.height, 10)/2) );
9186
        }
9187
 
9188
        this.setDragElPos(iPageX, iPageY);
9189
 
9190
        Ext.fly(dragEl).show();
9191
    },
9192
 
9193
 
9194
    _resizeProxy: function() {
9195
        if (this.resizeFrame) {
9196
            var el = this.getEl();
9197
            Ext.fly(this.getDragEl()).setSize(el.offsetWidth, el.offsetHeight);
9198
        }
9199
    },
9200
 
9201
 
9202
    b4MouseDown: function(e) {
9203
        var x = e.getPageX();
9204
        var y = e.getPageY();
9205
        this.autoOffset(x, y);
9206
        this.setDragElPos(x, y);
9207
    },
9208
 
9209
 
9210
    b4StartDrag: function(x, y) {
9211
 
9212
        this.showFrame(x, y);
9213
    },
9214
 
9215
 
9216
    b4EndDrag: function(e) {
9217
        Ext.fly(this.getDragEl()).hide();
9218
    },
9219
 
9220
 
9221
 
9222
 
9223
    endDrag: function(e) {
9224
 
9225
        var lel = this.getEl();
9226
        var del = this.getDragEl();
9227
 
9228
 
9229
        del.style.visibility = "";
9230
 
9231
        this.beforeMove();
9232
 
9233
 
9234
        lel.style.visibility = "hidden";
9235
        Ext.dd.DDM.moveToEl(lel, del);
9236
        del.style.visibility = "hidden";
9237
        lel.style.visibility = "";
9238
 
9239
        this.afterDrag();
9240
    },
9241
 
9242
    beforeMove : function(){
9243
 
9244
    },
9245
 
9246
    afterDrag : function(){
9247
 
9248
    },
9249
 
9250
    toString: function() {
9251
        return ("DDProxy " + this.id);
9252
    }
9253
 
9254
});
9255
 
9256
Ext.dd.DDTarget = function(id, sGroup, config) {
9257
    if (id) {
9258
        this.initTarget(id, sGroup, config);
9259
    }
9260
};
9261
 
9262
 
9263
Ext.extend(Ext.dd.DDTarget, Ext.dd.DragDrop, {
9264
    toString: function() {
9265
        return ("DDTarget " + this.id);
9266
    }
9267
});
9268
 
9269
Ext.dd.DragTracker = function(config){
9270
    Ext.apply(this, config);
9271
    this.addEvents(
9272
        'mousedown',
9273
        'mouseup',
9274
        'mousemove',
9275
        'dragstart',
9276
        'dragend',
9277
        'drag'
9278
    );
9279
 
9280
    this.dragRegion = new Ext.lib.Region(0,0,0,0);
9281
 
9282
    if(this.el){
9283
        this.initEl(this.el);
9284
    }
9285
}
9286
 
9287
Ext.extend(Ext.dd.DragTracker, Ext.util.Observable,  {
9288
    active: false,
9289
    tolerance: 5,
9290
    autoStart: false,
9291
 
9292
    initEl: function(el){
9293
        this.el = Ext.get(el);
9294
        el.on('mousedown', this.onMouseDown, this,
9295
                this.delegate ? {delegate: this.delegate} : undefined);
9296
    },
9297
 
9298
    destroy : function(){
9299
        this.el.un('mousedown', this.onMouseDown, this);
9300
    },
9301
 
9302
    onMouseDown: function(e, target){
9303
        if(this.fireEvent('mousedown', this, e) !== false && this.onBeforeStart(e) !== false){
9304
            this.startXY = this.lastXY = e.getXY();
9305
            this.dragTarget = this.delegate ? target : this.el.dom;
9306
            e.preventDefault();
9307
            var doc = Ext.getDoc();
9308
            doc.on('mouseup', this.onMouseUp, this);
9309
            doc.on('mousemove', this.onMouseMove, this);
9310
            doc.on('selectstart', this.stopSelect, this);
9311
            if(this.autoStart){
9312
                this.timer = this.triggerStart.defer(this.autoStart === true ? 1000 : this.autoStart, this);
9313
            }
9314
        }
9315
    },
9316
 
9317
    onMouseMove: function(e, target){
9318
        e.preventDefault();
9319
        var xy = e.getXY(), s = this.startXY;
9320
        this.lastXY = xy;
9321
        if(!this.active){
9322
            if(Math.abs(s[0]-xy[0]) > this.tolerance || Math.abs(s[1]-xy[1]) > this.tolerance){
9323
                this.triggerStart();
9324
            }else{
9325
                return;
9326
            }
9327
        }
9328
        this.fireEvent('mousemove', this, e);
9329
        this.onDrag(e);
9330
        this.fireEvent('drag', this, e);
9331
    },
9332
 
9333
    onMouseUp: function(e){
9334
        var doc = Ext.getDoc();
9335
        doc.un('mousemove', this.onMouseMove, this);
9336
        doc.un('mouseup', this.onMouseUp, this);
9337
        doc.un('selectstart', this.stopSelect, this);
9338
        e.preventDefault();
9339
        this.clearStart();
9340
        this.active = false;
9341
        delete this.elRegion;
9342
        this.fireEvent('mouseup', this, e);
9343
        this.onEnd(e);
9344
        this.fireEvent('dragend', this, e);
9345
    },
9346
 
9347
    triggerStart: function(isTimer){
9348
        this.clearStart();
9349
        this.active = true;
9350
        this.onStart(this.startXY);
9351
        this.fireEvent('dragstart', this, this.startXY);
9352
    },
9353
 
9354
    clearStart : function(){
9355
        if(this.timer){
9356
            clearTimeout(this.timer);
9357
            delete this.timer;
9358
        }
9359
    },
9360
 
9361
    stopSelect : function(e){
9362
        e.stopEvent();
9363
        return false;
9364
    },
9365
 
9366
    onBeforeStart : function(e){
9367
 
9368
    },
9369
 
9370
    onStart : function(xy){
9371
 
9372
    },
9373
 
9374
    onDrag : function(e){
9375
 
9376
    },
9377
 
9378
    onEnd : function(e){
9379
 
9380
    },
9381
 
9382
    getDragTarget : function(){
9383
        return this.dragTarget;
9384
    },
9385
 
9386
    getDragCt : function(){
9387
        return this.el;
9388
    },
9389
 
9390
    getXY : function(constrain){
9391
        return constrain ?
9392
               this.constrainModes[constrain].call(this, this.lastXY) : this.lastXY;
9393
    },
9394
 
9395
    getOffset : function(constrain){
9396
        var xy = this.getXY(constrain);
9397
        var s = this.startXY;
9398
        return [s[0]-xy[0], s[1]-xy[1]];
9399
    },
9400
 
9401
    constrainModes: {
9402
        'point' : function(xy){
9403
 
9404
            if(!this.elRegion){
9405
                this.elRegion = this.getDragCt().getRegion();
9406
            }
9407
 
9408
            var dr = this.dragRegion;
9409
 
9410
            dr.left = xy[0];
9411
            dr.top = xy[1];
9412
            dr.right = xy[0];
9413
            dr.bottom = xy[1];
9414
 
9415
            dr.constrainTo(this.elRegion);
9416
 
9417
            return [dr.left, dr.top];
9418
        }
9419
    }
9420
});
9421
 
9422
Ext.dd.ScrollManager = function(){
9423
    var ddm = Ext.dd.DragDropMgr;
9424
    var els = {};
9425
    var dragEl = null;
9426
    var proc = {};
9427
 
9428
    var onStop = function(e){
9429
        dragEl = null;
9430
        clearProc();
9431
    };
9432
 
9433
    var triggerRefresh = function(){
9434
        if(ddm.dragCurrent){
9435
             ddm.refreshCache(ddm.dragCurrent.groups);
9436
        }
9437
    };
9438
 
9439
    var doScroll = function(){
9440
        if(ddm.dragCurrent){
9441
            var dds = Ext.dd.ScrollManager;
9442
            var inc = proc.el.ddScrollConfig ?
9443
                      proc.el.ddScrollConfig.increment : dds.increment;
9444
            if(!dds.animate){
9445
                if(proc.el.scroll(proc.dir, inc)){
9446
                    triggerRefresh();
9447
                }
9448
            }else{
9449
                proc.el.scroll(proc.dir, inc, true, dds.animDuration, triggerRefresh);
9450
            }
9451
        }
9452
    };
9453
 
9454
    var clearProc = function(){
9455
        if(proc.id){
9456
            clearInterval(proc.id);
9457
        }
9458
        proc.id = 0;
9459
        proc.el = null;
9460
        proc.dir = "";
9461
    };
9462
 
9463
    var startProc = function(el, dir){
9464
        clearProc();
9465
        proc.el = el;
9466
        proc.dir = dir;
9467
        proc.id = setInterval(doScroll, Ext.dd.ScrollManager.frequency);
9468
    };
9469
 
9470
    var onFire = function(e, isDrop){
9471
        if(isDrop || !ddm.dragCurrent){ return; }
9472
        var dds = Ext.dd.ScrollManager;
9473
        if(!dragEl || dragEl != ddm.dragCurrent){
9474
            dragEl = ddm.dragCurrent;
9475
 
9476
            dds.refreshCache();
9477
        }
9478
 
9479
        var xy = Ext.lib.Event.getXY(e);
9480
        var pt = new Ext.lib.Point(xy[0], xy[1]);
9481
        for(var id in els){
9482
            var el = els[id], r = el._region;
9483
            var c = el.ddScrollConfig ? el.ddScrollConfig : dds;
9484
            if(r && r.contains(pt) && el.isScrollable()){
9485
                if(r.bottom - pt.y <= c.vthresh){
9486
                    if(proc.el != el){
9487
                        startProc(el, "down");
9488
                    }
9489
                    return;
9490
                }else if(r.right - pt.x <= c.hthresh){
9491
                    if(proc.el != el){
9492
                        startProc(el, "left");
9493
                    }
9494
                    return;
9495
                }else if(pt.y - r.top <= c.vthresh){
9496
                    if(proc.el != el){
9497
                        startProc(el, "up");
9498
                    }
9499
                    return;
9500
                }else if(pt.x - r.left <= c.hthresh){
9501
                    if(proc.el != el){
9502
                        startProc(el, "right");
9503
                    }
9504
                    return;
9505
                }
9506
            }
9507
        }
9508
        clearProc();
9509
    };
9510
 
9511
    ddm.fireEvents = ddm.fireEvents.createSequence(onFire, ddm);
9512
    ddm.stopDrag = ddm.stopDrag.createSequence(onStop, ddm);
9513
 
9514
    return {
9515
 
9516
        register : function(el){
9517
            if(Ext.isArray(el)){
9518
                for(var i = 0, len = el.length; i < len; i++) {
9519
                	this.register(el[i]);
9520
                }
9521
            }else{
9522
                el = Ext.get(el);
9523
                els[el.id] = el;
9524
            }
9525
        },
9526
 
9527
 
9528
        unregister : function(el){
9529
            if(Ext.isArray(el)){
9530
                for(var i = 0, len = el.length; i < len; i++) {
9531
                	this.unregister(el[i]);
9532
                }
9533
            }else{
9534
                el = Ext.get(el);
9535
                delete els[el.id];
9536
            }
9537
        },
9538
 
9539
 
9540
        vthresh : 25,
9541
 
9542
        hthresh : 25,
9543
 
9544
 
9545
        increment : 100,
9546
 
9547
 
9548
        frequency : 500,
9549
 
9550
 
9551
        animate: true,
9552
 
9553
 
9554
        animDuration: .4,
9555
 
9556
 
9557
        refreshCache : function(){
9558
            for(var id in els){
9559
                if(typeof els[id] == 'object'){
9560
                    els[id]._region = els[id].getRegion();
9561
                }
9562
            }
9563
        }
9564
    };
9565
}();
9566
 
9567
Ext.dd.Registry = function(){
9568
    var elements = {};
9569
    var handles = {};
9570
    var autoIdSeed = 0;
9571
 
9572
    var getId = function(el, autogen){
9573
        if(typeof el == "string"){
9574
            return el;
9575
        }
9576
        var id = el.id;
9577
        if(!id && autogen !== false){
9578
            id = "extdd-" + (++autoIdSeed);
9579
            el.id = id;
9580
        }
9581
        return id;
9582
    };
9583
 
9584
    return {
9585
 
9586
        register : function(el, data){
9587
            data = data || {};
9588
            if(typeof el == "string"){
9589
                el = document.getElementById(el);
9590
            }
9591
            data.ddel = el;
9592
            elements[getId(el)] = data;
9593
            if(data.isHandle !== false){
9594
                handles[data.ddel.id] = data;
9595
            }
9596
            if(data.handles){
9597
                var hs = data.handles;
9598
                for(var i = 0, len = hs.length; i < len; i++){
9599
                	handles[getId(hs[i])] = data;
9600
                }
9601
            }
9602
        },
9603
 
9604
 
9605
        unregister : function(el){
9606
            var id = getId(el, false);
9607
            var data = elements[id];
9608
            if(data){
9609
                delete elements[id];
9610
                if(data.handles){
9611
                    var hs = data.handles;
9612
                    for(var i = 0, len = hs.length; i < len; i++){
9613
                    	delete handles[getId(hs[i], false)];
9614
                    }
9615
                }
9616
            }
9617
        },
9618
 
9619
 
9620
        getHandle : function(id){
9621
            if(typeof id != "string"){
9622
                id = id.id;
9623
            }
9624
            return handles[id];
9625
        },
9626
 
9627
 
9628
        getHandleFromEvent : function(e){
9629
            var t = Ext.lib.Event.getTarget(e);
9630
            return t ? handles[t.id] : null;
9631
        },
9632
 
9633
 
9634
        getTarget : function(id){
9635
            if(typeof id != "string"){
9636
                id = id.id;
9637
            }
9638
            return elements[id];
9639
        },
9640
 
9641
 
9642
        getTargetFromEvent : function(e){
9643
            var t = Ext.lib.Event.getTarget(e);
9644
            return t ? elements[t.id] || handles[t.id] : null;
9645
        }
9646
    };
9647
}();
9648
 
9649
Ext.dd.StatusProxy = function(config){
9650
    Ext.apply(this, config);
9651
    this.id = this.id || Ext.id();
9652
    this.el = new Ext.Layer({
9653
        dh: {
9654
            id: this.id, tag: "div", cls: "x-dd-drag-proxy "+this.dropNotAllowed, children: [
9655
                {tag: "div", cls: "x-dd-drop-icon"},
9656
                {tag: "div", cls: "x-dd-drag-ghost"}
9657
            ]
9658
        },
9659
        shadow: !config || config.shadow !== false
9660
    });
9661
    this.ghost = Ext.get(this.el.dom.childNodes[1]);
9662
    this.dropStatus = this.dropNotAllowed;
9663
};
9664
 
9665
Ext.dd.StatusProxy.prototype = {
9666
 
9667
    dropAllowed : "x-dd-drop-ok",
9668
 
9669
    dropNotAllowed : "x-dd-drop-nodrop",
9670
 
9671
 
9672
    setStatus : function(cssClass){
9673
        cssClass = cssClass || this.dropNotAllowed;
9674
        if(this.dropStatus != cssClass){
9675
            this.el.replaceClass(this.dropStatus, cssClass);
9676
            this.dropStatus = cssClass;
9677
        }
9678
    },
9679
 
9680
 
9681
    reset : function(clearGhost){
9682
        this.el.dom.className = "x-dd-drag-proxy " + this.dropNotAllowed;
9683
        this.dropStatus = this.dropNotAllowed;
9684
        if(clearGhost){
9685
            this.ghost.update("");
9686
        }
9687
    },
9688
 
9689
 
9690
    update : function(html){
9691
        if(typeof html == "string"){
9692
            this.ghost.update(html);
9693
        }else{
9694
            this.ghost.update("");
9695
            html.style.margin = "0";
9696
            this.ghost.dom.appendChild(html);
9697
        }
9698
    },
9699
 
9700
 
9701
    getEl : function(){
9702
        return this.el;
9703
    },
9704
 
9705
 
9706
    getGhost : function(){
9707
        return this.ghost;
9708
    },
9709
 
9710
 
9711
    hide : function(clear){
9712
        this.el.hide();
9713
        if(clear){
9714
            this.reset(true);
9715
        }
9716
    },
9717
 
9718
 
9719
    stop : function(){
9720
        if(this.anim && this.anim.isAnimated && this.anim.isAnimated()){
9721
            this.anim.stop();
9722
        }
9723
    },
9724
 
9725
 
9726
    show : function(){
9727
        this.el.show();
9728
    },
9729
 
9730
 
9731
    sync : function(){
9732
        this.el.sync();
9733
    },
9734
 
9735
 
9736
    repair : function(xy, callback, scope){
9737
        this.callback = callback;
9738
        this.scope = scope;
9739
        if(xy && this.animRepair !== false){
9740
            this.el.addClass("x-dd-drag-repair");
9741
            this.el.hideUnders(true);
9742
            this.anim = this.el.shift({
9743
                duration: this.repairDuration || .5,
9744
                easing: 'easeOut',
9745
                xy: xy,
9746
                stopFx: true,
9747
                callback: this.afterRepair,
9748
                scope: this
9749
            });
9750
        }else{
9751
            this.afterRepair();
9752
        }
9753
    },
9754
 
9755
 
9756
    afterRepair : function(){
9757
        this.hide(true);
9758
        if(typeof this.callback == "function"){
9759
            this.callback.call(this.scope || this);
9760
        }
9761
        this.callback = null;
9762
        this.scope = null;
9763
    }
9764
};
9765
 
9766
Ext.dd.DragSource = function(el, config){
9767
    this.el = Ext.get(el);
9768
    if(!this.dragData){
9769
        this.dragData = {};
9770
    }
9771
 
9772
    Ext.apply(this, config);
9773
 
9774
    if(!this.proxy){
9775
        this.proxy = new Ext.dd.StatusProxy();
9776
    }
9777
    Ext.dd.DragSource.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group,
9778
          {dragElId : this.proxy.id, resizeFrame: false, isTarget: false, scroll: this.scroll === true});
9779
 
9780
    this.dragging = false;
9781
};
9782
 
9783
Ext.extend(Ext.dd.DragSource, Ext.dd.DDProxy, {
9784
 
9785
 
9786
    dropAllowed : "x-dd-drop-ok",
9787
 
9788
    dropNotAllowed : "x-dd-drop-nodrop",
9789
 
9790
 
9791
    getDragData : function(e){
9792
        return this.dragData;
9793
    },
9794
 
9795
 
9796
    onDragEnter : function(e, id){
9797
        var target = Ext.dd.DragDropMgr.getDDById(id);
9798
        this.cachedTarget = target;
9799
        if(this.beforeDragEnter(target, e, id) !== false){
9800
            if(target.isNotifyTarget){
9801
                var status = target.notifyEnter(this, e, this.dragData);
9802
                this.proxy.setStatus(status);
9803
            }else{
9804
                this.proxy.setStatus(this.dropAllowed);
9805
            }
9806
 
9807
            if(this.afterDragEnter){
9808
 
9809
                this.afterDragEnter(target, e, id);
9810
            }
9811
        }
9812
    },
9813
 
9814
 
9815
    beforeDragEnter : function(target, e, id){
9816
        return true;
9817
    },
9818
 
9819
 
9820
    alignElWithMouse: function() {
9821
        Ext.dd.DragSource.superclass.alignElWithMouse.apply(this, arguments);
9822
        this.proxy.sync();
9823
    },
9824
 
9825
 
9826
    onDragOver : function(e, id){
9827
        var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);
9828
        if(this.beforeDragOver(target, e, id) !== false){
9829
            if(target.isNotifyTarget){
9830
                var status = target.notifyOver(this, e, this.dragData);
9831
                this.proxy.setStatus(status);
9832
            }
9833
 
9834
            if(this.afterDragOver){
9835
 
9836
                this.afterDragOver(target, e, id);
9837
            }
9838
        }
9839
    },
9840
 
9841
 
9842
    beforeDragOver : function(target, e, id){
9843
        return true;
9844
    },
9845
 
9846
 
9847
    onDragOut : function(e, id){
9848
        var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);
9849
        if(this.beforeDragOut(target, e, id) !== false){
9850
            if(target.isNotifyTarget){
9851
                target.notifyOut(this, e, this.dragData);
9852
            }
9853
            this.proxy.reset();
9854
            if(this.afterDragOut){
9855
 
9856
                this.afterDragOut(target, e, id);
9857
            }
9858
        }
9859
        this.cachedTarget = null;
9860
    },
9861
 
9862
 
9863
    beforeDragOut : function(target, e, id){
9864
        return true;
9865
    },
9866
 
9867
 
9868
    onDragDrop : function(e, id){
9869
        var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);
9870
        if(this.beforeDragDrop(target, e, id) !== false){
9871
            if(target.isNotifyTarget){
9872
                if(target.notifyDrop(this, e, this.dragData)){
9873
                    this.onValidDrop(target, e, id);
9874
                }else{
9875
                    this.onInvalidDrop(target, e, id);
9876
                }
9877
            }else{
9878
                this.onValidDrop(target, e, id);
9879
            }
9880
 
9881
            if(this.afterDragDrop){
9882
 
9883
                this.afterDragDrop(target, e, id);
9884
            }
9885
        }
9886
        delete this.cachedTarget;
9887
    },
9888
 
9889
 
9890
    beforeDragDrop : function(target, e, id){
9891
        return true;
9892
    },
9893
 
9894
 
9895
    onValidDrop : function(target, e, id){
9896
        this.hideProxy();
9897
        if(this.afterValidDrop){
9898
 
9899
            this.afterValidDrop(target, e, id);
9900
        }
9901
    },
9902
 
9903
 
9904
    getRepairXY : function(e, data){
9905
        return this.el.getXY();
9906
    },
9907
 
9908
 
9909
    onInvalidDrop : function(target, e, id){
9910
        this.beforeInvalidDrop(target, e, id);
9911
        if(this.cachedTarget){
9912
            if(this.cachedTarget.isNotifyTarget){
9913
                this.cachedTarget.notifyOut(this, e, this.dragData);
9914
            }
9915
            this.cacheTarget = null;
9916
        }
9917
        this.proxy.repair(this.getRepairXY(e, this.dragData), this.afterRepair, this);
9918
 
9919
        if(this.afterInvalidDrop){
9920
 
9921
            this.afterInvalidDrop(e, id);
9922
        }
9923
    },
9924
 
9925
 
9926
    afterRepair : function(){
9927
        if(Ext.enableFx){
9928
            this.el.highlight(this.hlColor || "c3daf9");
9929
        }
9930
        this.dragging = false;
9931
    },
9932
 
9933
 
9934
    beforeInvalidDrop : function(target, e, id){
9935
        return true;
9936
    },
9937
 
9938
 
9939
    handleMouseDown : function(e){
9940
        if(this.dragging) {
9941
            return;
9942
        }
9943
        var data = this.getDragData(e);
9944
        if(data && this.onBeforeDrag(data, e) !== false){
9945
            this.dragData = data;
9946
            this.proxy.stop();
9947
            Ext.dd.DragSource.superclass.handleMouseDown.apply(this, arguments);
9948
        }
9949
    },
9950
 
9951
 
9952
    onBeforeDrag : function(data, e){
9953
        return true;
9954
    },
9955
 
9956
 
9957
    onStartDrag : Ext.emptyFn,
9958
 
9959
 
9960
    startDrag : function(x, y){
9961
        this.proxy.reset();
9962
        this.dragging = true;
9963
        this.proxy.update("");
9964
        this.onInitDrag(x, y);
9965
        this.proxy.show();
9966
    },
9967
 
9968
 
9969
    onInitDrag : function(x, y){
9970
        var clone = this.el.dom.cloneNode(true);
9971
        clone.id = Ext.id();
9972
        this.proxy.update(clone);
9973
        this.onStartDrag(x, y);
9974
        return true;
9975
    },
9976
 
9977
 
9978
    getProxy : function(){
9979
        return this.proxy;
9980
    },
9981
 
9982
 
9983
    hideProxy : function(){
9984
        this.proxy.hide();
9985
        this.proxy.reset(true);
9986
        this.dragging = false;
9987
    },
9988
 
9989
 
9990
    triggerCacheRefresh : function(){
9991
        Ext.dd.DDM.refreshCache(this.groups);
9992
    },
9993
 
9994
 
9995
    b4EndDrag: function(e) {
9996
    },
9997
 
9998
 
9999
    endDrag : function(e){
10000
        this.onEndDrag(this.dragData, e);
10001
    },
10002
 
10003
 
10004
    onEndDrag : function(data, e){
10005
    },
10006
 
10007
 
10008
    autoOffset : function(x, y) {
10009
        this.setDelta(-12, -20);
10010
    }
10011
});
10012
 
10013
Ext.dd.DropTarget = function(el, config){
10014
    this.el = Ext.get(el);
10015
 
10016
    Ext.apply(this, config);
10017
 
10018
    if(this.containerScroll){
10019
        Ext.dd.ScrollManager.register(this.el);
10020
    }
10021
 
10022
    Ext.dd.DropTarget.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group,
10023
          {isTarget: true});
10024
 
10025
};
10026
 
10027
Ext.extend(Ext.dd.DropTarget, Ext.dd.DDTarget, {
10028
 
10029
 
10030
 
10031
    dropAllowed : "x-dd-drop-ok",
10032
 
10033
    dropNotAllowed : "x-dd-drop-nodrop",
10034
 
10035
 
10036
    isTarget : true,
10037
 
10038
 
10039
    isNotifyTarget : true,
10040
 
10041
 
10042
    notifyEnter : function(dd, e, data){
10043
        if(this.overClass){
10044
            this.el.addClass(this.overClass);
10045
        }
10046
        return this.dropAllowed;
10047
    },
10048
 
10049
 
10050
    notifyOver : function(dd, e, data){
10051
        return this.dropAllowed;
10052
    },
10053
 
10054
 
10055
    notifyOut : function(dd, e, data){
10056
        if(this.overClass){
10057
            this.el.removeClass(this.overClass);
10058
        }
10059
    },
10060
 
10061
 
10062
    notifyDrop : function(dd, e, data){
10063
        return false;
10064
    }
10065
});
10066
 
10067
Ext.dd.DragZone = function(el, config){
10068
    Ext.dd.DragZone.superclass.constructor.call(this, el, config);
10069
    if(this.containerScroll){
10070
        Ext.dd.ScrollManager.register(this.el);
10071
    }
10072
};
10073
 
10074
Ext.extend(Ext.dd.DragZone, Ext.dd.DragSource, {
10075
 
10076
 
10077
 
10078
 
10079
    getDragData : function(e){
10080
        return Ext.dd.Registry.getHandleFromEvent(e);
10081
    },
10082
 
10083
 
10084
    onInitDrag : function(x, y){
10085
        this.proxy.update(this.dragData.ddel.cloneNode(true));
10086
        this.onStartDrag(x, y);
10087
        return true;
10088
    },
10089
 
10090
 
10091
    afterRepair : function(){
10092
        if(Ext.enableFx){
10093
            Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9");
10094
        }
10095
        this.dragging = false;
10096
    },
10097
 
10098
 
10099
    getRepairXY : function(e){
10100
        return Ext.Element.fly(this.dragData.ddel).getXY();
10101
    }
10102
});
10103
 
10104
Ext.dd.DropZone = function(el, config){
10105
    Ext.dd.DropZone.superclass.constructor.call(this, el, config);
10106
};
10107
 
10108
Ext.extend(Ext.dd.DropZone, Ext.dd.DropTarget, {
10109
 
10110
    getTargetFromEvent : function(e){
10111
        return Ext.dd.Registry.getTargetFromEvent(e);
10112
    },
10113
 
10114
 
10115
    onNodeEnter : function(n, dd, e, data){
10116
 
10117
    },
10118
 
10119
 
10120
    onNodeOver : function(n, dd, e, data){
10121
        return this.dropAllowed;
10122
    },
10123
 
10124
 
10125
    onNodeOut : function(n, dd, e, data){
10126
 
10127
    },
10128
 
10129
 
10130
    onNodeDrop : function(n, dd, e, data){
10131
        return false;
10132
    },
10133
 
10134
 
10135
    onContainerOver : function(dd, e, data){
10136
        return this.dropNotAllowed;
10137
    },
10138
 
10139
 
10140
    onContainerDrop : function(dd, e, data){
10141
        return false;
10142
    },
10143
 
10144
 
10145
    notifyEnter : function(dd, e, data){
10146
        return this.dropNotAllowed;
10147
    },
10148
 
10149
 
10150
    notifyOver : function(dd, e, data){
10151
        var n = this.getTargetFromEvent(e);
10152
        if(!n){
10153
            if(this.lastOverNode){
10154
                this.onNodeOut(this.lastOverNode, dd, e, data);
10155
                this.lastOverNode = null;
10156
            }
10157
            return this.onContainerOver(dd, e, data);
10158
        }
10159
        if(this.lastOverNode != n){
10160
            if(this.lastOverNode){
10161
                this.onNodeOut(this.lastOverNode, dd, e, data);
10162
            }
10163
            this.onNodeEnter(n, dd, e, data);
10164
            this.lastOverNode = n;
10165
        }
10166
        return this.onNodeOver(n, dd, e, data);
10167
    },
10168
 
10169
 
10170
    notifyOut : function(dd, e, data){
10171
        if(this.lastOverNode){
10172
            this.onNodeOut(this.lastOverNode, dd, e, data);
10173
            this.lastOverNode = null;
10174
        }
10175
    },
10176
 
10177
 
10178
    notifyDrop : function(dd, e, data){
10179
        if(this.lastOverNode){
10180
            this.onNodeOut(this.lastOverNode, dd, e, data);
10181
            this.lastOverNode = null;
10182
        }
10183
        var n = this.getTargetFromEvent(e);
10184
        return n ?
10185
            this.onNodeDrop(n, dd, e, data) :
10186
            this.onContainerDrop(dd, e, data);
10187
    },
10188
 
10189
 
10190
    triggerCacheRefresh : function(){
10191
        Ext.dd.DDM.refreshCache(this.groups);
10192
    }
10193
});
10194
 
10195
 
10196
Ext.data.SortTypes = {
10197
 
10198
    none : function(s){
10199
        return s;
10200
    },
10201
 
10202
 
10203
    stripTagsRE : /<\/?[^>]+>/gi,
10204
 
10205
 
10206
    asText : function(s){
10207
        return String(s).replace(this.stripTagsRE, "");
10208
    },
10209
 
10210
 
10211
    asUCText : function(s){
10212
        return String(s).toUpperCase().replace(this.stripTagsRE, "");
10213
    },
10214
 
10215
 
10216
    asUCString : function(s) {
10217
    	return String(s).toUpperCase();
10218
    },
10219
 
10220
 
10221
    asDate : function(s) {
10222
        if(!s){
10223
            return 0;
10224
        }
10225
        if(Ext.isDate(s)){
10226
            return s.getTime();
10227
        }
10228
    	return Date.parse(String(s));
10229
    },
10230
 
10231
 
10232
    asFloat : function(s) {
10233
    	var val = parseFloat(String(s).replace(/,/g, ""));
10234
        if(isNaN(val)) val = 0;
10235
    	return val;
10236
    },
10237
 
10238
 
10239
    asInt : function(s) {
10240
        var val = parseInt(String(s).replace(/,/g, ""));
10241
        if(isNaN(val)) val = 0;
10242
    	return val;
10243
    }
10244
};
10245
 
10246
Ext.data.Record = function(data, id){
10247
    this.id = (id || id === 0) ? id : ++Ext.data.Record.AUTO_ID;
10248
    this.data = data;
10249
};
10250
 
10251
 
10252
Ext.data.Record.create = function(o){
10253
    var f = Ext.extend(Ext.data.Record, {});
10254
	var p = f.prototype;
10255
    p.fields = new Ext.util.MixedCollection(false, function(field){
10256
        return field.name;
10257
    });
10258
    for(var i = 0, len = o.length; i < len; i++){
10259
        p.fields.add(new Ext.data.Field(o[i]));
10260
    }
10261
    f.getField = function(name){
10262
        return p.fields.get(name);
10263
    };
10264
    return f;
10265
};
10266
 
10267
Ext.data.Record.AUTO_ID = 1000;
10268
Ext.data.Record.EDIT = 'edit';
10269
Ext.data.Record.REJECT = 'reject';
10270
Ext.data.Record.COMMIT = 'commit';
10271
 
10272
Ext.data.Record.prototype = {
10273
 
10274
 
10275
 
10276
    dirty : false,
10277
    editing : false,
10278
    error: null,
10279
 
10280
    modified: null,
10281
 
10282
 
10283
    join : function(store){
10284
        this.store = store;
10285
    },
10286
 
10287
 
10288
    set : function(name, value){
10289
        if(String(this.data[name]) == String(value)){
10290
            return;
10291
        }
10292
        this.dirty = true;
10293
        if(!this.modified){
10294
            this.modified = {};
10295
        }
10296
        if(typeof this.modified[name] == 'undefined'){
10297
            this.modified[name] = this.data[name];
10298
        }
10299
        this.data[name] = value;
10300
        if(!this.editing && this.store){
10301
            this.store.afterEdit(this);
10302
        }
10303
    },
10304
 
10305
 
10306
    get : function(name){
10307
        return this.data[name];
10308
    },
10309
 
10310
 
10311
    beginEdit : function(){
10312
        this.editing = true;
10313
        this.modified = {};
10314
    },
10315
 
10316
 
10317
    cancelEdit : function(){
10318
        this.editing = false;
10319
        delete this.modified;
10320
    },
10321
 
10322
 
10323
    endEdit : function(){
10324
        this.editing = false;
10325
        if(this.dirty && this.store){
10326
            this.store.afterEdit(this);
10327
        }
10328
    },
10329
 
10330
 
10331
    reject : function(silent){
10332
        var m = this.modified;
10333
        for(var n in m){
10334
            if(typeof m[n] != "function"){
10335
                this.data[n] = m[n];
10336
            }
10337
        }
10338
        this.dirty = false;
10339
        delete this.modified;
10340
        this.editing = false;
10341
        if(this.store && silent !== true){
10342
            this.store.afterReject(this);
10343
        }
10344
    },
10345
 
10346
 
10347
    commit : function(silent){
10348
        this.dirty = false;
10349
        delete this.modified;
10350
        this.editing = false;
10351
        if(this.store && silent !== true){
10352
            this.store.afterCommit(this);
10353
        }
10354
    },
10355
 
10356
 
10357
    getChanges : function(){
10358
        var m = this.modified, cs = {};
10359
        for(var n in m){
10360
            if(m.hasOwnProperty(n)){
10361
                cs[n] = this.data[n];
10362
            }
10363
        }
10364
        return cs;
10365
    },
10366
 
10367
 
10368
    hasError : function(){
10369
        return this.error != null;
10370
    },
10371
 
10372
 
10373
    clearError : function(){
10374
        this.error = null;
10375
    },
10376
 
10377
 
10378
    copy : function(newId) {
10379
        return new this.constructor(Ext.apply({}, this.data), newId || this.id);
10380
    },
10381
 
10382
 
10383
    isModified : function(fieldName){
10384
        return this.modified && this.modified.hasOwnProperty(fieldName);
10385
    }
10386
};
10387
 
10388
Ext.StoreMgr = Ext.apply(new Ext.util.MixedCollection(), {
10389
    register : function(){
10390
        for(var i = 0, s; s = arguments[i]; i++){
10391
            this.add(s);
10392
        }
10393
    },
10394
 
10395
    unregister : function(){
10396
        for(var i = 0, s; s = arguments[i]; i++){
10397
            this.remove(this.lookup(s));
10398
        }
10399
    },
10400
 
10401
 
10402
    lookup : function(id){
10403
        return typeof id == "object" ? id : this.get(id);
10404
    },
10405
 
10406
 
10407
    getKey : function(o){
10408
         return o.storeId || o.id;
10409
    }
10410
});
10411
 
10412
Ext.data.Store = function(config){
10413
    this.data = new Ext.util.MixedCollection(false);
10414
    this.data.getKey = function(o){
10415
        return o.id;
10416
    };
10417
 
10418
    this.baseParams = {};
10419
 
10420
    this.paramNames = {
10421
        "start" : "start",
10422
        "limit" : "limit",
10423
        "sort" : "sort",
10424
        "dir" : "dir"
10425
    };
10426
 
10427
    if(config && config.data){
10428
        this.inlineData = config.data;
10429
        delete config.data;
10430
    }
10431
 
10432
    Ext.apply(this, config);
10433
 
10434
    if(this.url && !this.proxy){
10435
        this.proxy = new Ext.data.HttpProxy({url: this.url});
10436
    }
10437
 
10438
    if(this.reader){
10439
        if(!this.recordType){
10440
            this.recordType = this.reader.recordType;
10441
        }
10442
        if(this.reader.onMetaChange){
10443
            this.reader.onMetaChange = this.onMetaChange.createDelegate(this);
10444
        }
10445
    }
10446
 
10447
    if(this.recordType){
10448
        this.fields = this.recordType.prototype.fields;
10449
    }
10450
    this.modified = [];
10451
 
10452
    this.addEvents(
10453
 
10454
        'datachanged',
10455
 
10456
        'metachange',
10457
 
10458
        'add',
10459
 
10460
        'remove',
10461
 
10462
        'update',
10463
 
10464
        'clear',
10465
 
10466
        'beforeload',
10467
 
10468
        'load',
10469
 
10470
        'loadexception'
10471
    );
10472
 
10473
    if(this.proxy){
10474
        this.relayEvents(this.proxy,  ["loadexception"]);
10475
    }
10476
 
10477
    this.sortToggle = {};
10478
	if(this.sortInfo){
10479
		this.setDefaultSort(this.sortInfo.field, this.sortInfo.direction);
10480
	}
10481
 
10482
    Ext.data.Store.superclass.constructor.call(this);
10483
 
10484
    if(this.storeId || this.id){
10485
        Ext.StoreMgr.register(this);
10486
    }
10487
    if(this.inlineData){
10488
        this.loadData(this.inlineData);
10489
        delete this.inlineData;
10490
    }else if(this.autoLoad){
10491
        this.load.defer(10, this, [
10492
            typeof this.autoLoad == 'object' ?
10493
                this.autoLoad : undefined]);
10494
    }
10495
};
10496
Ext.extend(Ext.data.Store, Ext.util.Observable, {
10497
 
10498
 
10499
 
10500
 
10501
 
10502
 
10503
 
10504
 
10505
 
10506
    remoteSort : false,
10507
 
10508
 
10509
    pruneModifiedRecords : false,
10510
 
10511
 
10512
   lastOptions : null,
10513
 
10514
    destroy : function(){
10515
        if(this.id){
10516
            Ext.StoreMgr.unregister(this);
10517
        }
10518
        this.data = null;
10519
        this.purgeListeners();
10520
    },
10521
 
10522
 
10523
    add : function(records){
10524
        records = [].concat(records);
10525
        if(records.length < 1){
10526
            return;
10527
        }
10528
        for(var i = 0, len = records.length; i < len; i++){
10529
            records[i].join(this);
10530
        }
10531
        var index = this.data.length;
10532
        this.data.addAll(records);
10533
        if(this.snapshot){
10534
            this.snapshot.addAll(records);
10535
        }
10536
        this.fireEvent("add", this, records, index);
10537
    },
10538
 
10539
 
10540
    addSorted : function(record){
10541
        var index = this.findInsertIndex(record);
10542
        this.insert(index, record);
10543
    },
10544
 
10545
 
10546
    remove : function(record){
10547
        var index = this.data.indexOf(record);
10548
        this.data.removeAt(index);
10549
        if(this.pruneModifiedRecords){
10550
            this.modified.remove(record);
10551
        }
10552
        if(this.snapshot){
10553
            this.snapshot.remove(record);
10554
        }
10555
        this.fireEvent("remove", this, record, index);
10556
    },
10557
 
10558
 
10559
    removeAll : function(){
10560
        this.data.clear();
10561
        if(this.snapshot){
10562
            this.snapshot.clear();
10563
        }
10564
        if(this.pruneModifiedRecords){
10565
            this.modified = [];
10566
        }
10567
        this.fireEvent("clear", this);
10568
    },
10569
 
10570
 
10571
    insert : function(index, records){
10572
        records = [].concat(records);
10573
        for(var i = 0, len = records.length; i < len; i++){
10574
            this.data.insert(index, records[i]);
10575
            records[i].join(this);
10576
        }
10577
        this.fireEvent("add", this, records, index);
10578
    },
10579
 
10580
 
10581
    indexOf : function(record){
10582
        return this.data.indexOf(record);
10583
    },
10584
 
10585
 
10586
    indexOfId : function(id){
10587
        return this.data.indexOfKey(id);
10588
    },
10589
 
10590
 
10591
    getById : function(id){
10592
        return this.data.key(id);
10593
    },
10594
 
10595
 
10596
    getAt : function(index){
10597
        return this.data.itemAt(index);
10598
    },
10599
 
10600
 
10601
    getRange : function(start, end){
10602
        return this.data.getRange(start, end);
10603
    },
10604
 
10605
 
10606
    storeOptions : function(o){
10607
        o = Ext.apply({}, o);
10608
        delete o.callback;
10609
        delete o.scope;
10610
        this.lastOptions = o;
10611
    },
10612
 
10613
 
10614
    load : function(options){
10615
        options = options || {};
10616
        if(this.fireEvent("beforeload", this, options) !== false){
10617
            this.storeOptions(options);
10618
            var p = Ext.apply(options.params || {}, this.baseParams);
10619
            if(this.sortInfo && this.remoteSort){
10620
                var pn = this.paramNames;
10621
                p[pn["sort"]] = this.sortInfo.field;
10622
                p[pn["dir"]] = this.sortInfo.direction;
10623
            }
10624
            this.proxy.load(p, this.reader, this.loadRecords, this, options);
10625
            return true;
10626
        } else {
10627
          return false;
10628
        }
10629
    },
10630
 
10631
 
10632
    reload : function(options){
10633
        this.load(Ext.applyIf(options||{}, this.lastOptions));
10634
    },
10635
 
10636
 
10637
 
10638
    loadRecords : function(o, options, success){
10639
        if(!o || success === false){
10640
            if(success !== false){
10641
                this.fireEvent("load", this, [], options);
10642
            }
10643
            if(options.callback){
10644
                options.callback.call(options.scope || this, [], options, false);
10645
            }
10646
            return;
10647
        }
10648
        var r = o.records, t = o.totalRecords || r.length;
10649
        if(!options || options.add !== true){
10650
            if(this.pruneModifiedRecords){
10651
                this.modified = [];
10652
            }
10653
            for(var i = 0, len = r.length; i < len; i++){
10654
                r[i].join(this);
10655
            }
10656
            if(this.snapshot){
10657
                this.data = this.snapshot;
10658
                delete this.snapshot;
10659
            }
10660
            this.data.clear();
10661
            this.data.addAll(r);
10662
            this.totalLength = t;
10663
            this.applySort();
10664
            this.fireEvent("datachanged", this);
10665
        }else{
10666
            this.totalLength = Math.max(t, this.data.length+r.length);
10667
            this.add(r);
10668
        }
10669
        this.fireEvent("load", this, r, options);
10670
        if(options.callback){
10671
            options.callback.call(options.scope || this, r, options, true);
10672
        }
10673
    },
10674
 
10675
 
10676
    loadData : function(o, append){
10677
        var r = this.reader.readRecords(o);
10678
        this.loadRecords(r, {add: append}, true);
10679
    },
10680
 
10681
 
10682
    getCount : function(){
10683
        return this.data.length || 0;
10684
    },
10685
 
10686
 
10687
    getTotalCount : function(){
10688
        return this.totalLength || 0;
10689
    },
10690
 
10691
 
10692
    getSortState : function(){
10693
        return this.sortInfo;
10694
    },
10695
 
10696
 
10697
    applySort : function(){
10698
        if(this.sortInfo && !this.remoteSort){
10699
            var s = this.sortInfo, f = s.field;
10700
            this.sortData(f, s.direction);
10701
        }
10702
    },
10703
 
10704
 
10705
    sortData : function(f, direction){
10706
        direction = direction || 'ASC';
10707
        var st = this.fields.get(f).sortType;
10708
        var fn = function(r1, r2){
10709
            var v1 = st(r1.data[f]), v2 = st(r2.data[f]);
10710
            return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
10711
        };
10712
        this.data.sort(direction, fn);
10713
        if(this.snapshot && this.snapshot != this.data){
10714
            this.snapshot.sort(direction, fn);
10715
        }
10716
    },
10717
 
10718
 
10719
    setDefaultSort : function(field, dir){
10720
        dir = dir ? dir.toUpperCase() : "ASC";
10721
        this.sortInfo = {field: field, direction: dir};
10722
        this.sortToggle[field] = dir;
10723
    },
10724
 
10725
 
10726
    sort : function(fieldName, dir){
10727
        var f = this.fields.get(fieldName);
10728
        if(!f){
10729
            return false;
10730
        }
10731
        if(!dir){
10732
            if(this.sortInfo && this.sortInfo.field == f.name){
10733
                dir = (this.sortToggle[f.name] || "ASC").toggle("ASC", "DESC");
10734
            }else{
10735
                dir = f.sortDir;
10736
            }
10737
        }
10738
        var st = (this.sortToggle) ? this.sortToggle[f.name] : null;
10739
        var si = (this.sortInfo) ? this.sortInfo : null;
10740
 
10741
        this.sortToggle[f.name] = dir;
10742
        this.sortInfo = {field: f.name, direction: dir};
10743
        if(!this.remoteSort){
10744
            this.applySort();
10745
            this.fireEvent("datachanged", this);
10746
        }else{
10747
            if (!this.load(this.lastOptions)) {
10748
                if (st) {
10749
                    this.sortToggle[f.name] = st;
10750
                }
10751
                if (si) {
10752
                    this.sortInfo = si;
10753
                }
10754
            }
10755
        }
10756
    },
10757
 
10758
 
10759
    each : function(fn, scope){
10760
        this.data.each(fn, scope);
10761
    },
10762
 
10763
 
10764
    getModifiedRecords : function(){
10765
        return this.modified;
10766
    },
10767
 
10768
 
10769
    createFilterFn : function(property, value, anyMatch, caseSensitive){
10770
        if(Ext.isEmpty(value, false)){
10771
            return false;
10772
        }
10773
        value = this.data.createValueMatcher(value, anyMatch, caseSensitive);
10774
        return function(r){
10775
            return value.test(r.data[property]);
10776
        };
10777
    },
10778
 
10779
 
10780
    sum : function(property, start, end){
10781
        var rs = this.data.items, v = 0;
10782
        start = start || 0;
10783
        end = (end || end === 0) ? end : rs.length-1;
10784
 
10785
        for(var i = start; i <= end; i++){
10786
            v += (rs[i].data[property] || 0);
10787
        }
10788
        return v;
10789
    },
10790
 
10791
 
10792
    filter : function(property, value, anyMatch, caseSensitive){
10793
        var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);
10794
        return fn ? this.filterBy(fn) : this.clearFilter();
10795
    },
10796
 
10797
 
10798
    filterBy : function(fn, scope){
10799
        this.snapshot = this.snapshot || this.data;
10800
        this.data = this.queryBy(fn, scope||this);
10801
        this.fireEvent("datachanged", this);
10802
    },
10803
 
10804
 
10805
    query : function(property, value, anyMatch, caseSensitive){
10806
        var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);
10807
        return fn ? this.queryBy(fn) : this.data.clone();
10808
    },
10809
 
10810
 
10811
    queryBy : function(fn, scope){
10812
        var data = this.snapshot || this.data;
10813
        return data.filterBy(fn, scope||this);
10814
    },
10815
 
10816
 
10817
    find : function(property, value, start, anyMatch, caseSensitive){
10818
        var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);
10819
        return fn ? this.data.findIndexBy(fn, null, start) : -1;
10820
    },
10821
 
10822
 
10823
    findBy : function(fn, scope, start){
10824
        return this.data.findIndexBy(fn, scope, start);
10825
    },
10826
 
10827
 
10828
    collect : function(dataIndex, allowNull, bypassFilter){
10829
        var d = (bypassFilter === true && this.snapshot) ?
10830
                this.snapshot.items : this.data.items;
10831
        var v, sv, r = [], l = {};
10832
        for(var i = 0, len = d.length; i < len; i++){
10833
            v = d[i].data[dataIndex];
10834
            sv = String(v);
10835
            if((allowNull || !Ext.isEmpty(v)) && !l[sv]){
10836
                l[sv] = true;
10837
                r[r.length] = v;
10838
            }
10839
        }
10840
        return r;
10841
    },
10842
 
10843
 
10844
    clearFilter : function(suppressEvent){
10845
        if(this.isFiltered()){
10846
            this.data = this.snapshot;
10847
            delete this.snapshot;
10848
            if(suppressEvent !== true){
10849
                this.fireEvent("datachanged", this);
10850
            }
10851
        }
10852
    },
10853
 
10854
 
10855
    isFiltered : function(){
10856
        return this.snapshot && this.snapshot != this.data;
10857
    },
10858
 
10859
 
10860
    afterEdit : function(record){
10861
        if(this.modified.indexOf(record) == -1){
10862
            this.modified.push(record);
10863
        }
10864
        this.fireEvent("update", this, record, Ext.data.Record.EDIT);
10865
    },
10866
 
10867
 
10868
    afterReject : function(record){
10869
        this.modified.remove(record);
10870
        this.fireEvent("update", this, record, Ext.data.Record.REJECT);
10871
    },
10872
 
10873
 
10874
    afterCommit : function(record){
10875
        this.modified.remove(record);
10876
        this.fireEvent("update", this, record, Ext.data.Record.COMMIT);
10877
    },
10878
 
10879
 
10880
    commitChanges : function(){
10881
        var m = this.modified.slice(0);
10882
        this.modified = [];
10883
        for(var i = 0, len = m.length; i < len; i++){
10884
            m[i].commit();
10885
        }
10886
    },
10887
 
10888
 
10889
    rejectChanges : function(){
10890
        var m = this.modified.slice(0);
10891
        this.modified = [];
10892
        for(var i = 0, len = m.length; i < len; i++){
10893
            m[i].reject();
10894
        }
10895
    },
10896
 
10897
 
10898
    onMetaChange : function(meta, rtype, o){
10899
        this.recordType = rtype;
10900
        this.fields = rtype.prototype.fields;
10901
        delete this.snapshot;
10902
        this.sortInfo = meta.sortInfo;
10903
        this.modified = [];
10904
        this.fireEvent('metachange', this, this.reader.meta);
10905
    },
10906
 
10907
 
10908
    findInsertIndex : function(record){
10909
        this.suspendEvents();
10910
        var data = this.data.clone();
10911
        this.data.add(record);
10912
        this.applySort();
10913
        var index = this.data.indexOf(record);
10914
        this.data = data;
10915
        this.resumeEvents();
10916
        return index;
10917
    }
10918
});
10919
 
10920
Ext.data.SimpleStore = function(config){
10921
    Ext.data.SimpleStore.superclass.constructor.call(this, Ext.apply(config, {
10922
        reader: new Ext.data.ArrayReader({
10923
                id: config.id
10924
            },
10925
            Ext.data.Record.create(config.fields)
10926
        )
10927
    }));
10928
};
10929
Ext.extend(Ext.data.SimpleStore, Ext.data.Store, {
10930
    loadData : function(data, append){
10931
        if(this.expandData === true){
10932
            var r = [];
10933
            for(var i = 0, len = data.length; i < len; i++){
10934
                r[r.length] = [data[i]];
10935
            }
10936
            data = r;
10937
        }
10938
        Ext.data.SimpleStore.superclass.loadData.call(this, data, append);
10939
    }
10940
});
10941
 
10942
Ext.data.JsonStore = function(c){
10943
    Ext.data.JsonStore.superclass.constructor.call(this, Ext.apply(c, {
10944
        proxy: !c.data ? new Ext.data.HttpProxy({url: c.url}) : undefined,
10945
        reader: new Ext.data.JsonReader(c, c.fields)
10946
    }));
10947
};
10948
Ext.extend(Ext.data.JsonStore, Ext.data.Store);
10949
 
10950
 
10951
 
10952
Ext.data.Field = function(config){
10953
    if(typeof config == "string"){
10954
        config = {name: config};
10955
    }
10956
    Ext.apply(this, config);
10957
 
10958
    if(!this.type){
10959
        this.type = "auto";
10960
    }
10961
 
10962
    var st = Ext.data.SortTypes;
10963
 
10964
    if(typeof this.sortType == "string"){
10965
        this.sortType = st[this.sortType];
10966
    }
10967
 
10968
 
10969
    if(!this.sortType){
10970
        switch(this.type){
10971
            case "string":
10972
                this.sortType = st.asUCString;
10973
                break;
10974
            case "date":
10975
                this.sortType = st.asDate;
10976
                break;
10977
            default:
10978
                this.sortType = st.none;
10979
        }
10980
    }
10981
 
10982
 
10983
    var stripRe = /[\$,%]/g;
10984
 
10985
 
10986
 
10987
    if(!this.convert){
10988
        var cv, dateFormat = this.dateFormat;
10989
        switch(this.type){
10990
            case "":
10991
            case "auto":
10992
            case undefined:
10993
                cv = function(v){ return v; };
10994
                break;
10995
            case "string":
10996
                cv = function(v){ return (v === undefined || v === null) ? '' : String(v); };
10997
                break;
10998
            case "int":
10999
                cv = function(v){
11000
                    return v !== undefined && v !== null && v !== '' ?
11001
                           parseInt(String(v).replace(stripRe, ""), 10) : '';
11002
                    };
11003
                break;
11004
            case "float":
11005
                cv = function(v){
11006
                    return v !== undefined && v !== null && v !== '' ?
11007
                           parseFloat(String(v).replace(stripRe, ""), 10) : '';
11008
                    };
11009
                break;
11010
            case "bool":
11011
            case "boolean":
11012
                cv = function(v){ return v === true || v === "true" || v == 1; };
11013
                break;
11014
            case "date":
11015
                cv = function(v){
11016
                    if(!v){
11017
                        return '';
11018
                    }
11019
                    if(Ext.isDate(v)){
11020
                        return v;
11021
                    }
11022
                    if(dateFormat){
11023
                        if(dateFormat == "timestamp"){
11024
                            return new Date(v*1000);
11025
                        }
11026
                        if(dateFormat == "time"){
11027
                            return new Date(parseInt(v, 10));
11028
                        }
11029
                        return Date.parseDate(v, dateFormat);
11030
                    }
11031
                    var parsed = Date.parse(v);
11032
                    return parsed ? new Date(parsed) : null;
11033
                };
11034
             break;
11035
 
11036
        }
11037
        this.convert = cv;
11038
    }
11039
};
11040
 
11041
Ext.data.Field.prototype = {
11042
    dateFormat: null,
11043
    defaultValue: "",
11044
    mapping: null,
11045
    sortType : null,
11046
    sortDir : "ASC"
11047
};
11048
 
11049
Ext.data.DataReader = function(meta, recordType){
11050
 
11051
    this.meta = meta;
11052
    this.recordType = Ext.isArray(recordType) ?
11053
        Ext.data.Record.create(recordType) : recordType;
11054
};
11055
 
11056
Ext.data.DataReader.prototype = {
11057
 
11058
};
11059
 
11060
Ext.data.DataProxy = function(){
11061
    this.addEvents(
11062
 
11063
        'beforeload',
11064
 
11065
        'load',
11066
 
11067
        'loadexception'
11068
    );
11069
    Ext.data.DataProxy.superclass.constructor.call(this);
11070
};
11071
 
11072
Ext.extend(Ext.data.DataProxy, Ext.util.Observable);
11073
 
11074
Ext.data.MemoryProxy = function(data){
11075
    Ext.data.MemoryProxy.superclass.constructor.call(this);
11076
    this.data = data;
11077
};
11078
 
11079
Ext.extend(Ext.data.MemoryProxy, Ext.data.DataProxy, {
11080
 
11081
    load : function(params, reader, callback, scope, arg){
11082
        params = params || {};
11083
        var result;
11084
        try {
11085
            result = reader.readRecords(this.data);
11086
        }catch(e){
11087
            this.fireEvent("loadexception", this, arg, null, e);
11088
            callback.call(scope, null, arg, false);
11089
            return;
11090
        }
11091
        callback.call(scope, result, arg, true);
11092
    },
11093
 
11094
 
11095
    update : function(params, records){
11096
 
11097
    }
11098
});
11099
 
11100
Ext.data.HttpProxy = function(conn){
11101
    Ext.data.HttpProxy.superclass.constructor.call(this);
11102
 
11103
    this.conn = conn;
11104
    this.useAjax = !conn || !conn.events;
11105
};
11106
 
11107
Ext.extend(Ext.data.HttpProxy, Ext.data.DataProxy, {
11108
 
11109
    getConnection : function(){
11110
        return this.useAjax ? Ext.Ajax : this.conn;
11111
    },
11112
 
11113
 
11114
    load : function(params, reader, callback, scope, arg){
11115
        if(this.fireEvent("beforeload", this, params) !== false){
11116
            var  o = {
11117
                params : params || {},
11118
                request: {
11119
                    callback : callback,
11120
                    scope : scope,
11121
                    arg : arg
11122
                },
11123
                reader: reader,
11124
                callback : this.loadResponse,
11125
                scope: this
11126
            };
11127
            if(this.useAjax){
11128
                Ext.applyIf(o, this.conn);
11129
                if(this.activeRequest){
11130
                    Ext.Ajax.abort(this.activeRequest);
11131
                }
11132
                this.activeRequest = Ext.Ajax.request(o);
11133
            }else{
11134
                this.conn.request(o);
11135
            }
11136
        }else{
11137
            callback.call(scope||this, null, arg, false);
11138
        }
11139
    },
11140
 
11141
 
11142
    loadResponse : function(o, success, response){
11143
        delete this.activeRequest;
11144
        if(!success){
11145
            this.fireEvent("loadexception", this, o, response);
11146
            o.request.callback.call(o.request.scope, null, o.request.arg, false);
11147
            return;
11148
        }
11149
        var result;
11150
        try {
11151
            result = o.reader.read(response);
11152
        }catch(e){
11153
            this.fireEvent("loadexception", this, o, response, e);
11154
            o.request.callback.call(o.request.scope, null, o.request.arg, false);
11155
            return;
11156
        }
11157
        this.fireEvent("load", this, o, o.request.arg);
11158
        o.request.callback.call(o.request.scope, result, o.request.arg, true);
11159
    },
11160
 
11161
 
11162
    update : function(dataSet){
11163
 
11164
    },
11165
 
11166
 
11167
    updateResponse : function(dataSet){
11168
 
11169
    }
11170
});
11171
 
11172
Ext.data.ScriptTagProxy = function(config){
11173
    Ext.data.ScriptTagProxy.superclass.constructor.call(this);
11174
    Ext.apply(this, config);
11175
    this.head = document.getElementsByTagName("head")[0];
11176
};
11177
 
11178
Ext.data.ScriptTagProxy.TRANS_ID = 1000;
11179
 
11180
Ext.extend(Ext.data.ScriptTagProxy, Ext.data.DataProxy, {
11181
 
11182
 
11183
    timeout : 30000,
11184
 
11185
    callbackParam : "callback",
11186
 
11187
    nocache : true,
11188
 
11189
 
11190
    load : function(params, reader, callback, scope, arg){
11191
        if(this.fireEvent("beforeload", this, params) !== false){
11192
 
11193
            var p = Ext.urlEncode(Ext.apply(params, this.extraParams));
11194
 
11195
            var url = this.url;
11196
            url += (url.indexOf("?") != -1 ? "&" : "?") + p;
11197
            if(this.nocache){
11198
                url += "&_dc=" + (new Date().getTime());
11199
            }
11200
            var transId = ++Ext.data.ScriptTagProxy.TRANS_ID;
11201
            var trans = {
11202
                id : transId,
11203
                cb : "stcCallback"+transId,
11204
                scriptId : "stcScript"+transId,
11205
                params : params,
11206
                arg : arg,
11207
                url : url,
11208
                callback : callback,
11209
                scope : scope,
11210
                reader : reader
11211
            };
11212
            var conn = this;
11213
 
11214
            window[trans.cb] = function(o){
11215
                conn.handleResponse(o, trans);
11216
            };
11217
 
11218
            url += String.format("&{0}={1}", this.callbackParam, trans.cb);
11219
 
11220
            if(this.autoAbort !== false){
11221
                this.abort();
11222
            }
11223
 
11224
            trans.timeoutId = this.handleFailure.defer(this.timeout, this, [trans]);
11225
 
11226
            var script = document.createElement("script");
11227
            script.setAttribute("src", url);
11228
            script.setAttribute("type", "text/javascript");
11229
            script.setAttribute("id", trans.scriptId);
11230
            this.head.appendChild(script);
11231
 
11232
            this.trans = trans;
11233
        }else{
11234
            callback.call(scope||this, null, arg, false);
11235
        }
11236
    },
11237
 
11238
 
11239
    isLoading : function(){
11240
        return this.trans ? true : false;
11241
    },
11242
 
11243
 
11244
    abort : function(){
11245
        if(this.isLoading()){
11246
            this.destroyTrans(this.trans);
11247
        }
11248
    },
11249
 
11250
 
11251
    destroyTrans : function(trans, isLoaded){
11252
        this.head.removeChild(document.getElementById(trans.scriptId));
11253
        clearTimeout(trans.timeoutId);
11254
        if(isLoaded){
11255
            window[trans.cb] = undefined;
11256
            try{
11257
                delete window[trans.cb];
11258
            }catch(e){}
11259
        }else{
11260
 
11261
            window[trans.cb] = function(){
11262
                window[trans.cb] = undefined;
11263
                try{
11264
                    delete window[trans.cb];
11265
                }catch(e){}
11266
            };
11267
        }
11268
    },
11269
 
11270
 
11271
    handleResponse : function(o, trans){
11272
        this.trans = false;
11273
        this.destroyTrans(trans, true);
11274
        var result;
11275
        try {
11276
            result = trans.reader.readRecords(o);
11277
        }catch(e){
11278
            this.fireEvent("loadexception", this, o, trans.arg, e);
11279
            trans.callback.call(trans.scope||window, null, trans.arg, false);
11280
            return;
11281
        }
11282
        this.fireEvent("load", this, o, trans.arg);
11283
        trans.callback.call(trans.scope||window, result, trans.arg, true);
11284
    },
11285
 
11286
 
11287
    handleFailure : function(trans){
11288
        this.trans = false;
11289
        this.destroyTrans(trans, false);
11290
        this.fireEvent("loadexception", this, null, trans.arg);
11291
        trans.callback.call(trans.scope||window, null, trans.arg, false);
11292
    }
11293
});
11294
 
11295
Ext.data.JsonReader = function(meta, recordType){
11296
    meta = meta || {};
11297
    Ext.data.JsonReader.superclass.constructor.call(this, meta, recordType || meta.fields);
11298
};
11299
Ext.extend(Ext.data.JsonReader, Ext.data.DataReader, {
11300
 
11301
 
11302
    read : function(response){
11303
        var json = response.responseText;
11304
        var o = eval("("+json+")");
11305
        if(!o) {
11306
            throw {message: "JsonReader.read: Json object not found"};
11307
        }
11308
        if(o.metaData){
11309
            delete this.ef;
11310
            this.meta = o.metaData;
11311
            this.recordType = Ext.data.Record.create(o.metaData.fields);
11312
            this.onMetaChange(this.meta, this.recordType, o);
11313
        }
11314
        return this.readRecords(o);
11315
    },
11316
 
11317
 
11318
    onMetaChange : function(meta, recordType, o){
11319
 
11320
    },
11321
 
11322
 
11323
    simpleAccess: function(obj, subsc) {
11324
    	return obj[subsc];
11325
    },
11326
 
11327
 
11328
    getJsonAccessor: function(){
11329
        var re = /[\[\.]/;
11330
        return function(expr) {
11331
            try {
11332
                return(re.test(expr))
11333
                    ? new Function("obj", "return obj." + expr)
11334
                    : function(obj){
11335
                        return obj[expr];
11336
                    };
11337
            } catch(e){}
11338
            return Ext.emptyFn;
11339
        };
11340
    }(),
11341
 
11342
 
11343
    readRecords : function(o){
11344
 
11345
        this.jsonData = o;
11346
        var s = this.meta, Record = this.recordType,
11347
            f = Record.prototype.fields, fi = f.items, fl = f.length;
11348
 
11349
 
11350
        if (!this.ef) {
11351
            if(s.totalProperty) {
11352
	            this.getTotal = this.getJsonAccessor(s.totalProperty);
11353
	        }
11354
	        if(s.successProperty) {
11355
	            this.getSuccess = this.getJsonAccessor(s.successProperty);
11356
	        }
11357
	        this.getRoot = s.root ? this.getJsonAccessor(s.root) : function(p){return p;};
11358
	        if (s.id) {
11359
	        	var g = this.getJsonAccessor(s.id);
11360
	        	this.getId = function(rec) {
11361
	        		var r = g(rec);
11362
		        	return (r === undefined || r === "") ? null : r;
11363
	        	};
11364
	        } else {
11365
	        	this.getId = function(){return null;};
11366
	        }
11367
            this.ef = [];
11368
            for(var i = 0; i < fl; i++){
11369
                f = fi[i];
11370
                var map = (f.mapping !== undefined && f.mapping !== null) ? f.mapping : f.name;
11371
                this.ef[i] = this.getJsonAccessor(map);
11372
            }
11373
        }
11374
 
11375
    	var root = this.getRoot(o), c = root.length, totalRecords = c, success = true;
11376
    	if(s.totalProperty){
11377
            var v = parseInt(this.getTotal(o), 10);
11378
            if(!isNaN(v)){
11379
                totalRecords = v;
11380
            }
11381
        }
11382
        if(s.successProperty){
11383
            var v = this.getSuccess(o);
11384
            if(v === false || v === 'false'){
11385
                success = false;
11386
            }
11387
        }
11388
        var records = [];
11389
	    for(var i = 0; i < c; i++){
11390
		    var n = root[i];
11391
	        var values = {};
11392
	        var id = this.getId(n);
11393
	        for(var j = 0; j < fl; j++){
11394
	            f = fi[j];
11395
                var v = this.ef[j](n);
11396
                values[f.name] = f.convert((v !== undefined) ? v : f.defaultValue, n);
11397
	        }
11398
	        var record = new Record(values, id);
11399
	        record.json = n;
11400
	        records[i] = record;
11401
	    }
11402
	    return {
11403
	        success : success,
11404
	        records : records,
11405
	        totalRecords : totalRecords
11406
	    };
11407
    }
11408
});
11409
 
11410
Ext.data.XmlReader = function(meta, recordType){
11411
    meta = meta || {};
11412
    Ext.data.XmlReader.superclass.constructor.call(this, meta, recordType || meta.fields);
11413
};
11414
Ext.extend(Ext.data.XmlReader, Ext.data.DataReader, {
11415
 
11416
    read : function(response){
11417
        var doc = response.responseXML;
11418
        if(!doc) {
11419
            throw {message: "XmlReader.read: XML Document not available"};
11420
        }
11421
        return this.readRecords(doc);
11422
    },
11423
 
11424
 
11425
    readRecords : function(doc){
11426
 
11427
        this.xmlData = doc;
11428
        var root = doc.documentElement || doc;
11429
    	var q = Ext.DomQuery;
11430
    	var recordType = this.recordType, fields = recordType.prototype.fields;
11431
    	var sid = this.meta.id;
11432
    	var totalRecords = 0, success = true;
11433
    	if(this.meta.totalRecords){
11434
    	    totalRecords = q.selectNumber(this.meta.totalRecords, root, 0);
11435
    	}
11436
 
11437
        if(this.meta.success){
11438
            var sv = q.selectValue(this.meta.success, root, true);
11439
            success = sv !== false && sv !== 'false';
11440
    	}
11441
    	var records = [];
11442
    	var ns = q.select(this.meta.record, root);
11443
        for(var i = 0, len = ns.length; i < len; i++) {
11444
	        var n = ns[i];
11445
	        var values = {};
11446
	        var id = sid ? q.selectValue(sid, n) : undefined;
11447
	        for(var j = 0, jlen = fields.length; j < jlen; j++){
11448
	            var f = fields.items[j];
11449
                var v = q.selectValue(f.mapping || f.name, n, f.defaultValue);
11450
	            v = f.convert(v, n);
11451
	            values[f.name] = v;
11452
	        }
11453
	        var record = new recordType(values, id);
11454
	        record.node = n;
11455
	        records[records.length] = record;
11456
	    }
11457
 
11458
	    return {
11459
	        success : success,
11460
	        records : records,
11461
	        totalRecords : totalRecords || records.length
11462
	    };
11463
    }
11464
});
11465
 
11466
Ext.data.ArrayReader = Ext.extend(Ext.data.JsonReader, {
11467
 
11468
    readRecords : function(o){
11469
        var sid = this.meta ? this.meta.id : null;
11470
    	var recordType = this.recordType, fields = recordType.prototype.fields;
11471
    	var records = [];
11472
    	var root = o;
11473
	    for(var i = 0; i < root.length; i++){
11474
		    var n = root[i];
11475
	        var values = {};
11476
	        var id = ((sid || sid === 0) && n[sid] !== undefined && n[sid] !== "" ? n[sid] : null);
11477
	        for(var j = 0, jlen = fields.length; j < jlen; j++){
11478
                var f = fields.items[j];
11479
                var k = f.mapping !== undefined && f.mapping !== null ? f.mapping : j;
11480
                var v = n[k] !== undefined ? n[k] : f.defaultValue;
11481
                v = f.convert(v, n);
11482
                values[f.name] = v;
11483
            }
11484
	        var record = new recordType(values, id);
11485
	        record.json = n;
11486
	        records[records.length] = record;
11487
	    }
11488
	    return {
11489
	        records : records,
11490
	        totalRecords : records.length
11491
	    };
11492
    }
11493
});
11494
 
11495
Ext.data.Tree = function(root){
11496
   this.nodeHash = {};
11497
 
11498
   this.root = null;
11499
   if(root){
11500
       this.setRootNode(root);
11501
   }
11502
   this.addEvents(
11503
 
11504
       "append",
11505
 
11506
       "remove",
11507
 
11508
       "move",
11509
 
11510
       "insert",
11511
 
11512
       "beforeappend",
11513
 
11514
       "beforeremove",
11515
 
11516
       "beforemove",
11517
 
11518
       "beforeinsert"
11519
   );
11520
 
11521
    Ext.data.Tree.superclass.constructor.call(this);
11522
};
11523
 
11524
Ext.extend(Ext.data.Tree, Ext.util.Observable, {
11525
 
11526
    pathSeparator: "/",
11527
 
11528
 
11529
    proxyNodeEvent : function(){
11530
        return this.fireEvent.apply(this, arguments);
11531
    },
11532
 
11533
 
11534
    getRootNode : function(){
11535
        return this.root;
11536
    },
11537
 
11538
 
11539
    setRootNode : function(node){
11540
        this.root = node;
11541
        node.ownerTree = this;
11542
        node.isRoot = true;
11543
        this.registerNode(node);
11544
        return node;
11545
    },
11546
 
11547
 
11548
    getNodeById : function(id){
11549
        return this.nodeHash[id];
11550
    },
11551
 
11552
 
11553
    registerNode : function(node){
11554
        this.nodeHash[node.id] = node;
11555
    },
11556
 
11557
 
11558
    unregisterNode : function(node){
11559
        delete this.nodeHash[node.id];
11560
    },
11561
 
11562
    toString : function(){
11563
        return "[Tree"+(this.id?" "+this.id:"")+"]";
11564
    }
11565
});
11566
 
11567
 
11568
Ext.data.Node = function(attributes){
11569
 
11570
    this.attributes = attributes || {};
11571
    this.leaf = this.attributes.leaf;
11572
 
11573
    this.id = this.attributes.id;
11574
    if(!this.id){
11575
        this.id = Ext.id(null, "ynode-");
11576
        this.attributes.id = this.id;
11577
    }
11578
 
11579
    this.childNodes = [];
11580
    if(!this.childNodes.indexOf){
11581
        this.childNodes.indexOf = function(o){
11582
            for(var i = 0, len = this.length; i < len; i++){
11583
                if(this[i] == o) return i;
11584
            }
11585
            return -1;
11586
        };
11587
    }
11588
 
11589
    this.parentNode = null;
11590
 
11591
    this.firstChild = null;
11592
 
11593
    this.lastChild = null;
11594
 
11595
    this.previousSibling = null;
11596
 
11597
    this.nextSibling = null;
11598
 
11599
    this.addEvents({
11600
 
11601
       "append" : true,
11602
 
11603
       "remove" : true,
11604
 
11605
       "move" : true,
11606
 
11607
       "insert" : true,
11608
 
11609
       "beforeappend" : true,
11610
 
11611
       "beforeremove" : true,
11612
 
11613
       "beforemove" : true,
11614
 
11615
       "beforeinsert" : true
11616
   });
11617
    this.listeners = this.attributes.listeners;
11618
    Ext.data.Node.superclass.constructor.call(this);
11619
};
11620
 
11621
Ext.extend(Ext.data.Node, Ext.util.Observable, {
11622
 
11623
    fireEvent : function(evtName){
11624
 
11625
        if(Ext.data.Node.superclass.fireEvent.apply(this, arguments) === false){
11626
            return false;
11627
        }
11628
 
11629
        var ot = this.getOwnerTree();
11630
        if(ot){
11631
            if(ot.proxyNodeEvent.apply(ot, arguments) === false){
11632
                return false;
11633
            }
11634
        }
11635
        return true;
11636
    },
11637
 
11638
 
11639
    isLeaf : function(){
11640
        return this.leaf === true;
11641
    },
11642
 
11643
 
11644
    setFirstChild : function(node){
11645
        this.firstChild = node;
11646
    },
11647
 
11648
 
11649
    setLastChild : function(node){
11650
        this.lastChild = node;
11651
    },
11652
 
11653
 
11654
 
11655
    isLast : function(){
11656
       return (!this.parentNode ? true : this.parentNode.lastChild == this);
11657
    },
11658
 
11659
 
11660
    isFirst : function(){
11661
       return (!this.parentNode ? true : this.parentNode.firstChild == this);
11662
    },
11663
 
11664
    hasChildNodes : function(){
11665
        return !this.isLeaf() && this.childNodes.length > 0;
11666
    },
11667
 
11668
 
11669
    appendChild : function(node){
11670
        var multi = false;
11671
        if(Ext.isArray(node)){
11672
            multi = node;
11673
        }else if(arguments.length > 1){
11674
            multi = arguments;
11675
        }
11676
 
11677
        if(multi){
11678
            for(var i = 0, len = multi.length; i < len; i++) {
11679
            	this.appendChild(multi[i]);
11680
            }
11681
        }else{
11682
            if(this.fireEvent("beforeappend", this.ownerTree, this, node) === false){
11683
                return false;
11684
            }
11685
            var index = this.childNodes.length;
11686
            var oldParent = node.parentNode;
11687
 
11688
            if(oldParent){
11689
                if(node.fireEvent("beforemove", node.getOwnerTree(), node, oldParent, this, index) === false){
11690
                    return false;
11691
                }
11692
                oldParent.removeChild(node);
11693
            }
11694
            index = this.childNodes.length;
11695
            if(index == 0){
11696
                this.setFirstChild(node);
11697
            }
11698
            this.childNodes.push(node);
11699
            node.parentNode = this;
11700
            var ps = this.childNodes[index-1];
11701
            if(ps){
11702
                node.previousSibling = ps;
11703
                ps.nextSibling = node;
11704
            }else{
11705
                node.previousSibling = null;
11706
            }
11707
            node.nextSibling = null;
11708
            this.setLastChild(node);
11709
            node.setOwnerTree(this.getOwnerTree());
11710
            this.fireEvent("append", this.ownerTree, this, node, index);
11711
            if(oldParent){
11712
                node.fireEvent("move", this.ownerTree, node, oldParent, this, index);
11713
            }
11714
            return node;
11715
        }
11716
    },
11717
 
11718
 
11719
    removeChild : function(node){
11720
        var index = this.childNodes.indexOf(node);
11721
        if(index == -1){
11722
            return false;
11723
        }
11724
        if(this.fireEvent("beforeremove", this.ownerTree, this, node) === false){
11725
            return false;
11726
        }
11727
 
11728
 
11729
        this.childNodes.splice(index, 1);
11730
 
11731
 
11732
        if(node.previousSibling){
11733
            node.previousSibling.nextSibling = node.nextSibling;
11734
        }
11735
        if(node.nextSibling){
11736
            node.nextSibling.previousSibling = node.previousSibling;
11737
        }
11738
 
11739
 
11740
        if(this.firstChild == node){
11741
            this.setFirstChild(node.nextSibling);
11742
        }
11743
        if(this.lastChild == node){
11744
            this.setLastChild(node.previousSibling);
11745
        }
11746
 
11747
        node.setOwnerTree(null);
11748
 
11749
        node.parentNode = null;
11750
        node.previousSibling = null;
11751
        node.nextSibling = null;
11752
        this.fireEvent("remove", this.ownerTree, this, node);
11753
        return node;
11754
    },
11755
 
11756
 
11757
    insertBefore : function(node, refNode){
11758
        if(!refNode){
11759
            return this.appendChild(node);
11760
        }
11761
 
11762
        if(node == refNode){
11763
            return false;
11764
        }
11765
 
11766
        if(this.fireEvent("beforeinsert", this.ownerTree, this, node, refNode) === false){
11767
            return false;
11768
        }
11769
        var index = this.childNodes.indexOf(refNode);
11770
        var oldParent = node.parentNode;
11771
        var refIndex = index;
11772
 
11773
 
11774
        if(oldParent == this && this.childNodes.indexOf(node) < index){
11775
            refIndex--;
11776
        }
11777
 
11778
 
11779
        if(oldParent){
11780
            if(node.fireEvent("beforemove", node.getOwnerTree(), node, oldParent, this, index, refNode) === false){
11781
                return false;
11782
            }
11783
            oldParent.removeChild(node);
11784
        }
11785
        if(refIndex == 0){
11786
            this.setFirstChild(node);
11787
        }
11788
        this.childNodes.splice(refIndex, 0, node);
11789
        node.parentNode = this;
11790
        var ps = this.childNodes[refIndex-1];
11791
        if(ps){
11792
            node.previousSibling = ps;
11793
            ps.nextSibling = node;
11794
        }else{
11795
            node.previousSibling = null;
11796
        }
11797
        node.nextSibling = refNode;
11798
        refNode.previousSibling = node;
11799
        node.setOwnerTree(this.getOwnerTree());
11800
        this.fireEvent("insert", this.ownerTree, this, node, refNode);
11801
        if(oldParent){
11802
            node.fireEvent("move", this.ownerTree, node, oldParent, this, refIndex, refNode);
11803
        }
11804
        return node;
11805
    },
11806
 
11807
 
11808
    remove : function(){
11809
        this.parentNode.removeChild(this);
11810
        return this;
11811
    },
11812
 
11813
 
11814
    item : function(index){
11815
        return this.childNodes[index];
11816
    },
11817
 
11818
 
11819
    replaceChild : function(newChild, oldChild){
11820
        this.insertBefore(newChild, oldChild);
11821
        this.removeChild(oldChild);
11822
        return oldChild;
11823
    },
11824
 
11825
 
11826
    indexOf : function(child){
11827
        return this.childNodes.indexOf(child);
11828
    },
11829
 
11830
 
11831
    getOwnerTree : function(){
11832
 
11833
        if(!this.ownerTree){
11834
            var p = this;
11835
            while(p){
11836
                if(p.ownerTree){
11837
                    this.ownerTree = p.ownerTree;
11838
                    break;
11839
                }
11840
                p = p.parentNode;
11841
            }
11842
        }
11843
        return this.ownerTree;
11844
    },
11845
 
11846
 
11847
    getDepth : function(){
11848
        var depth = 0;
11849
        var p = this;
11850
        while(p.parentNode){
11851
            ++depth;
11852
            p = p.parentNode;
11853
        }
11854
        return depth;
11855
    },
11856
 
11857
 
11858
    setOwnerTree : function(tree){
11859
 
11860
        if(tree != this.ownerTree){
11861
            if(this.ownerTree){
11862
                this.ownerTree.unregisterNode(this);
11863
            }
11864
            this.ownerTree = tree;
11865
            var cs = this.childNodes;
11866
            for(var i = 0, len = cs.length; i < len; i++) {
11867
            	cs[i].setOwnerTree(tree);
11868
            }
11869
            if(tree){
11870
                tree.registerNode(this);
11871
            }
11872
        }
11873
    },
11874
 
11875
 
11876
    getPath : function(attr){
11877
        attr = attr || "id";
11878
        var p = this.parentNode;
11879
        var b = [this.attributes[attr]];
11880
        while(p){
11881
            b.unshift(p.attributes[attr]);
11882
            p = p.parentNode;
11883
        }
11884
        var sep = this.getOwnerTree().pathSeparator;
11885
        return sep + b.join(sep);
11886
    },
11887
 
11888
 
11889
    bubble : function(fn, scope, args){
11890
        var p = this;
11891
        while(p){
11892
            if(fn.apply(scope || p, args || [p]) === false){
11893
                break;
11894
            }
11895
            p = p.parentNode;
11896
        }
11897
    },
11898
 
11899
 
11900
    cascade : function(fn, scope, args){
11901
        if(fn.apply(scope || this, args || [this]) !== false){
11902
            var cs = this.childNodes;
11903
            for(var i = 0, len = cs.length; i < len; i++) {
11904
            	cs[i].cascade(fn, scope, args);
11905
            }
11906
        }
11907
    },
11908
 
11909
 
11910
    eachChild : function(fn, scope, args){
11911
        var cs = this.childNodes;
11912
        for(var i = 0, len = cs.length; i < len; i++) {
11913
        	if(fn.apply(scope || this, args || [cs[i]]) === false){
11914
        	    break;
11915
        	}
11916
        }
11917
    },
11918
 
11919
 
11920
    findChild : function(attribute, value){
11921
        var cs = this.childNodes;
11922
        for(var i = 0, len = cs.length; i < len; i++) {
11923
        	if(cs[i].attributes[attribute] == value){
11924
        	    return cs[i];
11925
        	}
11926
        }
11927
        return null;
11928
    },
11929
 
11930
 
11931
    findChildBy : function(fn, scope){
11932
        var cs = this.childNodes;
11933
        for(var i = 0, len = cs.length; i < len; i++) {
11934
        	if(fn.call(scope||cs[i], cs[i]) === true){
11935
        	    return cs[i];
11936
        	}
11937
        }
11938
        return null;
11939
    },
11940
 
11941
 
11942
    sort : function(fn, scope){
11943
        var cs = this.childNodes;
11944
        var len = cs.length;
11945
        if(len > 0){
11946
            var sortFn = scope ? function(){fn.apply(scope, arguments);} : fn;
11947
            cs.sort(sortFn);
11948
            for(var i = 0; i < len; i++){
11949
                var n = cs[i];
11950
                n.previousSibling = cs[i-1];
11951
                n.nextSibling = cs[i+1];
11952
                if(i == 0){
11953
                    this.setFirstChild(n);
11954
                }
11955
                if(i == len-1){
11956
                    this.setLastChild(n);
11957
                }
11958
            }
11959
        }
11960
    },
11961
 
11962
 
11963
    contains : function(node){
11964
        return node.isAncestor(this);
11965
    },
11966
 
11967
 
11968
    isAncestor : function(node){
11969
        var p = this.parentNode;
11970
        while(p){
11971
            if(p == node){
11972
                return true;
11973
            }
11974
            p = p.parentNode;
11975
        }
11976
        return false;
11977
    },
11978
 
11979
    toString : function(){
11980
        return "[Node"+(this.id?" "+this.id:"")+"]";
11981
    }
11982
});
11983
 
11984
Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {
11985
 
11986
 
11987
    remoteGroup : false,
11988
 
11989
    groupOnSort:false,
11990
 
11991
 
11992
    clearGrouping : function(){
11993
        this.groupField = false;
11994
        if(this.remoteGroup){
11995
            if(this.baseParams){
11996
                delete this.baseParams.groupBy;
11997
            }
11998
            this.reload();
11999
        }else{
12000
            this.applySort();
12001
            this.fireEvent('datachanged', this);
12002
        }
12003
    },
12004
 
12005
 
12006
    groupBy : function(field, forceRegroup){
12007
        if(this.groupField == field && !forceRegroup){
12008
            return;
12009
        }
12010
        this.groupField = field;
12011
        if(this.remoteGroup){
12012
            if(!this.baseParams){
12013
                this.baseParams = {};
12014
            }
12015
            this.baseParams['groupBy'] = field;
12016
        }
12017
        if(this.groupOnSort){
12018
            this.sort(field);
12019
            return;
12020
        }
12021
        if(this.remoteGroup){
12022
            this.reload();
12023
        }else{
12024
            var si = this.sortInfo || {};
12025
            if(si.field != field){
12026
                this.applySort();
12027
            }else{
12028
                this.sortData(field);
12029
            }
12030
            this.fireEvent('datachanged', this);
12031
        }
12032
    },
12033
 
12034
 
12035
    applySort : function(){
12036
        Ext.data.GroupingStore.superclass.applySort.call(this);
12037
        if(!this.groupOnSort && !this.remoteGroup){
12038
            var gs = this.getGroupState();
12039
            if(gs && gs != this.sortInfo.field){
12040
                this.sortData(this.groupField);
12041
            }
12042
        }
12043
    },
12044
 
12045
 
12046
    applyGrouping : function(alwaysFireChange){
12047
        if(this.groupField !== false){
12048
            this.groupBy(this.groupField, true);
12049
            return true;
12050
        }else{
12051
            if(alwaysFireChange === true){
12052
                this.fireEvent('datachanged', this);
12053
            }
12054
            return false;
12055
        }
12056
    },
12057
 
12058
 
12059
    getGroupState : function(){
12060
        return this.groupOnSort && this.groupField !== false ?
12061
               (this.sortInfo ? this.sortInfo.field : undefined) : this.groupField;
12062
    }
12063
});
12064
 
12065
Ext.ComponentMgr = function(){
12066
    var all = new Ext.util.MixedCollection();
12067
    var types = {};
12068
 
12069
    return {
12070
 
12071
        register : function(c){
12072
            all.add(c);
12073
        },
12074
 
12075
 
12076
        unregister : function(c){
12077
            all.remove(c);
12078
        },
12079
 
12080
 
12081
        get : function(id){
12082
            return all.get(id);
12083
        },
12084
 
12085
 
12086
        onAvailable : function(id, fn, scope){
12087
            all.on("add", function(index, o){
12088
                if(o.id == id){
12089
                    fn.call(scope || o, o);
12090
                    all.un("add", fn, scope);
12091
                }
12092
            });
12093
        },
12094
 
12095
 
12096
        all : all,
12097
 
12098
 
12099
        registerType : function(xtype, cls){
12100
            types[xtype] = cls;
12101
            cls.xtype = xtype;
12102
        },
12103
 
12104
 
12105
        create : function(config, defaultType){
12106
            return new types[config.xtype || defaultType](config);
12107
        }
12108
    };
12109
}();
12110
 
12111
 
12112
 
12113
Ext.reg = Ext.ComponentMgr.registerType;
12114
 
12115
Ext.Component = function(config){
12116
    config = config || {};
12117
    if(config.initialConfig){
12118
        if(config.isAction){                       this.baseAction = config;
12119
        }
12120
        config = config.initialConfig;     }else if(config.tagName || config.dom || typeof config == "string"){         config = {applyTo: config, id: config.id || config};
12121
    }
12122
 
12123
 
12124
    this.initialConfig = config;
12125
 
12126
    Ext.apply(this, config);
12127
    this.addEvents(
12128
 
12129
        'disable',
12130
 
12131
        'enable',
12132
 
12133
        'beforeshow',
12134
 
12135
        'show',
12136
 
12137
        'beforehide',
12138
 
12139
        'hide',
12140
 
12141
        'beforerender',
12142
 
12143
        'render',
12144
 
12145
        'beforedestroy',
12146
 
12147
        'destroy',
12148
 
12149
        'beforestaterestore',
12150
 
12151
        'staterestore',
12152
 
12153
        'beforestatesave',
12154
 
12155
        'statesave'
12156
    );
12157
    this.getId();
12158
    Ext.ComponentMgr.register(this);
12159
    Ext.Component.superclass.constructor.call(this);
12160
 
12161
    if(this.baseAction){
12162
        this.baseAction.addComponent(this);
12163
    }
12164
 
12165
    this.initComponent();
12166
 
12167
    if(this.plugins){
12168
        if(Ext.isArray(this.plugins)){
12169
            for(var i = 0, len = this.plugins.length; i < len; i++){
12170
                this.plugins[i].init(this);
12171
            }
12172
        }else{
12173
            this.plugins.init(this);
12174
        }
12175
    }
12176
 
12177
    if(this.stateful !== false){
12178
        this.initState(config);
12179
    }
12180
 
12181
    if(this.applyTo){
12182
        this.applyToMarkup(this.applyTo);
12183
        delete this.applyTo;
12184
    }else if(this.renderTo){
12185
        this.render(this.renderTo);
12186
        delete this.renderTo;
12187
    }
12188
};
12189
 
12190
Ext.Component.AUTO_ID = 1000;
12191
 
12192
Ext.extend(Ext.Component, Ext.util.Observable, {
12193
 
12194
 
12195
 
12196
 
12197
 
12198
 
12199
 
12200
 
12201
 
12202
 
12203
 
12204
 
12205
 
12206
 
12207
 
12208
    disabledClass : "x-item-disabled",
12209
 
12210
    allowDomMove : true,
12211
 
12212
    autoShow : false,
12213
 
12214
    hideMode: 'display',
12215
 
12216
    hideParent: false,
12217
 
12218
 
12219
 
12220
    hidden : false,
12221
 
12222
    disabled : false,
12223
 
12224
    rendered : false,
12225
 
12226
        ctype : "Ext.Component",
12227
 
12228
        actionMode : "el",
12229
 
12230
        getActionEl : function(){
12231
        return this[this.actionMode];
12232
    },
12233
 
12234
 
12235
    initComponent : Ext.emptyFn,
12236
 
12237
 
12238
    render : function(container, position){
12239
        if(!this.rendered && this.fireEvent("beforerender", this) !== false){
12240
            if(!container && this.el){
12241
                this.el = Ext.get(this.el);
12242
                container = this.el.dom.parentNode;
12243
                this.allowDomMove = false;
12244
            }
12245
            this.container = Ext.get(container);
12246
            if(this.ctCls){
12247
                this.container.addClass(this.ctCls);
12248
            }
12249
            this.rendered = true;
12250
            if(position !== undefined){
12251
                if(typeof position == 'number'){
12252
                    position = this.container.dom.childNodes[position];
12253
                }else{
12254
                    position = Ext.getDom(position);
12255
                }
12256
            }
12257
            this.onRender(this.container, position || null);
12258
            if(this.autoShow){
12259
                this.el.removeClass(['x-hidden','x-hide-' + this.hideMode]);
12260
            }
12261
            if(this.cls){
12262
                this.el.addClass(this.cls);
12263
                delete this.cls;
12264
            }
12265
            if(this.style){
12266
                this.el.applyStyles(this.style);
12267
                delete this.style;
12268
            }
12269
            this.fireEvent("render", this);
12270
            this.afterRender(this.container);
12271
            if(this.hidden){
12272
                this.hide();
12273
            }
12274
            if(this.disabled){
12275
                this.disable();
12276
            }
12277
 
12278
            this.initStateEvents();
12279
        }
12280
        return this;
12281
    },
12282
 
12283
        initState : function(config){
12284
        if(Ext.state.Manager){
12285
            var state = Ext.state.Manager.get(this.stateId || this.id);
12286
            if(state){
12287
                if(this.fireEvent('beforestaterestore', this, state) !== false){
12288
                    this.applyState(state);
12289
                    this.fireEvent('staterestore', this, state);
12290
                }
12291
            }
12292
        }
12293
    },
12294
 
12295
        initStateEvents : function(){
12296
        if(this.stateEvents){
12297
            for(var i = 0, e; e = this.stateEvents[i]; i++){
12298
                this.on(e, this.saveState, this, {delay:100});
12299
            }
12300
        }
12301
    },
12302
 
12303
        applyState : function(state, config){
12304
        if(state){
12305
            Ext.apply(this, state);
12306
        }
12307
    },
12308
 
12309
        getState : function(){
12310
        return null;
12311
    },
12312
 
12313
        saveState : function(){
12314
        if(Ext.state.Manager){
12315
            var state = this.getState();
12316
            if(this.fireEvent('beforestatesave', this, state) !== false){
12317
                Ext.state.Manager.set(this.stateId || this.id, state);
12318
                this.fireEvent('statesave', this, state);
12319
            }
12320
        }
12321
    },
12322
 
12323
 
12324
    applyToMarkup : function(el){
12325
        this.allowDomMove = false;
12326
        this.el = Ext.get(el);
12327
        this.render(this.el.dom.parentNode);
12328
    },
12329
 
12330
 
12331
    addClass : function(cls){
12332
        if(this.el){
12333
            this.el.addClass(cls);
12334
        }else{
12335
            this.cls = this.cls ? this.cls + ' ' + cls : cls;
12336
        }
12337
    },
12338
 
12339
 
12340
    removeClass : function(cls){
12341
        if(this.el){
12342
            this.el.removeClass(cls);
12343
        }else if(this.cls){
12344
            this.cls = this.cls.split(' ').remove(cls).join(' ');
12345
        }
12346
    },
12347
 
12348
            onRender : function(ct, position){
12349
        if(this.autoEl){
12350
            if(typeof this.autoEl == 'string'){
12351
                this.el = document.createElement(this.autoEl);
12352
            }else{
12353
                var div = document.createElement('div');
12354
                Ext.DomHelper.overwrite(div, this.autoEl);
12355
                this.el = div.firstChild;
12356
            }
12357
            if (!this.el.id) {
12358
            	this.el.id = this.getId();
12359
            }
12360
        }
12361
        if(this.el){
12362
            this.el = Ext.get(this.el);
12363
            if(this.allowDomMove !== false){
12364
                ct.dom.insertBefore(this.el.dom, position);
12365
            }
12366
        }
12367
    },
12368
 
12369
        getAutoCreate : function(){
12370
        var cfg = typeof this.autoCreate == "object" ?
12371
                      this.autoCreate : Ext.apply({}, this.defaultAutoCreate);
12372
        if(this.id && !cfg.id){
12373
            cfg.id = this.id;
12374
        }
12375
        return cfg;
12376
    },
12377
 
12378
        afterRender : Ext.emptyFn,
12379
 
12380
 
12381
    destroy : function(){
12382
        if(this.fireEvent("beforedestroy", this) !== false){
12383
            this.beforeDestroy();
12384
            if(this.rendered){
12385
                this.el.removeAllListeners();
12386
                this.el.remove();
12387
                if(this.actionMode == "container"){
12388
                    this.container.remove();
12389
                }
12390
            }
12391
            this.onDestroy();
12392
            Ext.ComponentMgr.unregister(this);
12393
            this.fireEvent("destroy", this);
12394
            this.purgeListeners();
12395
        }
12396
    },
12397
 
12398
	    beforeDestroy : Ext.emptyFn,
12399
 
12400
	    onDestroy  : Ext.emptyFn,
12401
 
12402
 
12403
    getEl : function(){
12404
        return this.el;
12405
    },
12406
 
12407
 
12408
    getId : function(){
12409
        return this.id || (this.id = "ext-comp-" + (++Ext.Component.AUTO_ID));
12410
    },
12411
 
12412
 
12413
    getItemId : function(){
12414
        return this.itemId || this.getId();
12415
    },
12416
 
12417
 
12418
    focus : function(selectText, delay){
12419
        if(delay){
12420
            this.focus.defer(typeof delay == 'number' ? delay : 10, this, [selectText, false]);
12421
            return;
12422
        }
12423
        if(this.rendered){
12424
            this.el.focus();
12425
            if(selectText === true){
12426
                this.el.dom.select();
12427
            }
12428
        }
12429
        return this;
12430
    },
12431
 
12432
        blur : function(){
12433
        if(this.rendered){
12434
            this.el.blur();
12435
        }
12436
        return this;
12437
    },
12438
 
12439
 
12440
    disable : function(){
12441
        if(this.rendered){
12442
            this.onDisable();
12443
        }
12444
        this.disabled = true;
12445
        this.fireEvent("disable", this);
12446
        return this;
12447
    },
12448
 
12449
	    onDisable : function(){
12450
        this.getActionEl().addClass(this.disabledClass);
12451
        this.el.dom.disabled = true;
12452
    },
12453
 
12454
 
12455
    enable : function(){
12456
        if(this.rendered){
12457
            this.onEnable();
12458
        }
12459
        this.disabled = false;
12460
        this.fireEvent("enable", this);
12461
        return this;
12462
    },
12463
 
12464
	    onEnable : function(){
12465
        this.getActionEl().removeClass(this.disabledClass);
12466
        this.el.dom.disabled = false;
12467
    },
12468
 
12469
 
12470
    setDisabled : function(disabled){
12471
        this[disabled ? "disable" : "enable"]();
12472
    },
12473
 
12474
 
12475
    show: function(){
12476
        if(this.fireEvent("beforeshow", this) !== false){
12477
            this.hidden = false;
12478
            if(this.autoRender){
12479
                this.render(typeof this.autoRender == 'boolean' ? Ext.getBody() : this.autoRender);
12480
            }
12481
            if(this.rendered){
12482
                this.onShow();
12483
            }
12484
            this.fireEvent("show", this);
12485
        }
12486
        return this;
12487
    },
12488
 
12489
        onShow : function(){
12490
        if(this.hideParent){
12491
            this.container.removeClass('x-hide-' + this.hideMode);
12492
        }else{
12493
            this.getActionEl().removeClass('x-hide-' + this.hideMode);
12494
        }
12495
 
12496
    },
12497
 
12498
 
12499
    hide: function(){
12500
        if(this.fireEvent("beforehide", this) !== false){
12501
            this.hidden = true;
12502
            if(this.rendered){
12503
                this.onHide();
12504
            }
12505
            this.fireEvent("hide", this);
12506
        }
12507
        return this;
12508
    },
12509
 
12510
        onHide : function(){
12511
        if(this.hideParent){
12512
            this.container.addClass('x-hide-' + this.hideMode);
12513
        }else{
12514
            this.getActionEl().addClass('x-hide-' + this.hideMode);
12515
        }
12516
    },
12517
 
12518
 
12519
    setVisible: function(visible){
12520
        if(visible) {
12521
            this.show();
12522
        }else{
12523
            this.hide();
12524
        }
12525
        return this;
12526
    },
12527
 
12528
 
12529
    isVisible : function(){
12530
        return this.rendered && this.getActionEl().isVisible();
12531
    },
12532
 
12533
 
12534
    cloneConfig : function(overrides){
12535
        overrides = overrides || {};
12536
        var id = overrides.id || Ext.id();
12537
        var cfg = Ext.applyIf(overrides, this.initialConfig);
12538
        cfg.id = id;         return new this.constructor(cfg);
12539
    },
12540
 
12541
 
12542
    getXType : function(){
12543
        return this.constructor.xtype;
12544
    },
12545
 
12546
 
12547
    isXType : function(xtype, shallow){
12548
        return !shallow ?
12549
               ('/' + this.getXTypes() + '/').indexOf('/' + xtype + '/') != -1 :
12550
                this.constructor.xtype == xtype;
12551
    },
12552
 
12553
 
12554
    getXTypes : function(){
12555
        var tc = this.constructor;
12556
        if(!tc.xtypes){
12557
            var c = [], sc = this;
12558
            while(sc && sc.constructor.xtype){
12559
                c.unshift(sc.constructor.xtype);
12560
                sc = sc.constructor.superclass;
12561
            }
12562
            tc.xtypeChain = c;
12563
            tc.xtypes = c.join('/');
12564
        }
12565
        return tc.xtypes;
12566
    },
12567
 
12568
 
12569
    findParentBy: function(fn) {
12570
        for (var p = this.ownerCt; (p != null) && !fn(p, this); p = p.ownerCt);
12571
        return p || null;
12572
    },
12573
 
12574
 
12575
    findParentByType: function(xtype) {
12576
        return typeof xtype == 'function' ?
12577
            this.findParentBy(function(p){
12578
                return p.constructor === xtype;
12579
            }) :
12580
            this.findParentBy(function(p){
12581
                return p.constructor.xtype === xtype;
12582
            });
12583
    }
12584
});
12585
 
12586
Ext.reg('component', Ext.Component);
12587
 
12588
 
12589
Ext.Action = function(config){
12590
    this.initialConfig = config;
12591
    this.items = [];
12592
}
12593
 
12594
Ext.Action.prototype = {
12595
 
12596
 
12597
 
12598
 
12599
 
12600
 
12601
 
12602
 
12603
    isAction : true,
12604
 
12605
 
12606
    setText : function(text){
12607
        this.initialConfig.text = text;
12608
        this.callEach('setText', [text]);
12609
    },
12610
 
12611
 
12612
    getText : function(){
12613
        return this.initialConfig.text;
12614
    },
12615
 
12616
 
12617
    setIconClass : function(cls){
12618
        this.initialConfig.iconCls = cls;
12619
        this.callEach('setIconClass', [cls]);
12620
    },
12621
 
12622
 
12623
    getIconClass : function(){
12624
        return this.initialConfig.iconCls;
12625
    },
12626
 
12627
 
12628
    setDisabled : function(v){
12629
        this.initialConfig.disabled = v;
12630
        this.callEach('setDisabled', [v]);
12631
    },
12632
 
12633
 
12634
    enable : function(){
12635
        this.setDisabled(false);
12636
    },
12637
 
12638
 
12639
    disable : function(){
12640
        this.setDisabled(true);
12641
    },
12642
 
12643
 
12644
    isDisabled : function(){
12645
        return this.initialConfig.disabled;
12646
    },
12647
 
12648
 
12649
    setHidden : function(v){
12650
        this.initialConfig.hidden = v;
12651
        this.callEach('setVisible', [!v]);
12652
    },
12653
 
12654
 
12655
    show : function(){
12656
        this.setHidden(false);
12657
    },
12658
 
12659
 
12660
    hide : function(){
12661
        this.setHidden(true);
12662
    },
12663
 
12664
 
12665
    isHidden : function(){
12666
        return this.initialConfig.hidden;
12667
    },
12668
 
12669
 
12670
    setHandler : function(fn, scope){
12671
        this.initialConfig.handler = fn;
12672
        this.initialConfig.scope = scope;
12673
        this.callEach('setHandler', [fn, scope]);
12674
    },
12675
 
12676
 
12677
    each : function(fn, scope){
12678
        Ext.each(this.items, fn, scope);
12679
    },
12680
 
12681
 
12682
    callEach : function(fnName, args){
12683
        var cs = this.items;
12684
        for(var i = 0, len = cs.length; i < len; i++){
12685
            cs[i][fnName].apply(cs[i], args);
12686
        }
12687
    },
12688
 
12689
 
12690
    addComponent : function(comp){
12691
        this.items.push(comp);
12692
        comp.on('destroy', this.removeComponent, this);
12693
    },
12694
 
12695
 
12696
    removeComponent : function(comp){
12697
        this.items.remove(comp);
12698
    },
12699
 
12700
 
12701
    execute : function(){
12702
        this.initialConfig.handler.apply(this.initialConfig.scope || window, arguments);
12703
    }
12704
};
12705
 
12706
(function(){
12707
Ext.Layer = function(config, existingEl){
12708
    config = config || {};
12709
    var dh = Ext.DomHelper;
12710
    var cp = config.parentEl, pel = cp ? Ext.getDom(cp) : document.body;
12711
    if(existingEl){
12712
        this.dom = Ext.getDom(existingEl);
12713
    }
12714
    if(!this.dom){
12715
        var o = config.dh || {tag: "div", cls: "x-layer"};
12716
        this.dom = dh.append(pel, o);
12717
    }
12718
    if(config.cls){
12719
        this.addClass(config.cls);
12720
    }
12721
    this.constrain = config.constrain !== false;
12722
    this.visibilityMode = Ext.Element.VISIBILITY;
12723
    if(config.id){
12724
        this.id = this.dom.id = config.id;
12725
    }else{
12726
        this.id = Ext.id(this.dom);
12727
    }
12728
    this.zindex = config.zindex || this.getZIndex();
12729
    this.position("absolute", this.zindex);
12730
    if(config.shadow){
12731
        this.shadowOffset = config.shadowOffset || 4;
12732
        this.shadow = new Ext.Shadow({
12733
            offset : this.shadowOffset,
12734
            mode : config.shadow
12735
        });
12736
    }else{
12737
        this.shadowOffset = 0;
12738
    }
12739
    this.useShim = config.shim !== false && Ext.useShims;
12740
    this.useDisplay = config.useDisplay;
12741
    this.hide();
12742
};
12743
 
12744
var supr = Ext.Element.prototype;
12745
 
12746
 
12747
var shims = [];
12748
 
12749
Ext.extend(Ext.Layer, Ext.Element, {
12750
 
12751
    getZIndex : function(){
12752
        return this.zindex || parseInt(this.getStyle("z-index"), 10) || 11000;
12753
    },
12754
 
12755
    getShim : function(){
12756
        if(!this.useShim){
12757
            return null;
12758
        }
12759
        if(this.shim){
12760
            return this.shim;
12761
        }
12762
        var shim = shims.shift();
12763
        if(!shim){
12764
            shim = this.createShim();
12765
            shim.enableDisplayMode('block');
12766
            shim.dom.style.display = 'none';
12767
            shim.dom.style.visibility = 'visible';
12768
        }
12769
        var pn = this.dom.parentNode;
12770
        if(shim.dom.parentNode != pn){
12771
            pn.insertBefore(shim.dom, this.dom);
12772
        }
12773
        shim.setStyle('z-index', this.getZIndex()-2);
12774
        this.shim = shim;
12775
        return shim;
12776
    },
12777
 
12778
    hideShim : function(){
12779
        if(this.shim){
12780
            this.shim.setDisplayed(false);
12781
            shims.push(this.shim);
12782
            delete this.shim;
12783
        }
12784
    },
12785
 
12786
    disableShadow : function(){
12787
        if(this.shadow){
12788
            this.shadowDisabled = true;
12789
            this.shadow.hide();
12790
            this.lastShadowOffset = this.shadowOffset;
12791
            this.shadowOffset = 0;
12792
        }
12793
    },
12794
 
12795
    enableShadow : function(show){
12796
        if(this.shadow){
12797
            this.shadowDisabled = false;
12798
            this.shadowOffset = this.lastShadowOffset;
12799
            delete this.lastShadowOffset;
12800
            if(show){
12801
                this.sync(true);
12802
            }
12803
        }
12804
    },
12805
 
12806
 
12807
 
12808
 
12809
    sync : function(doShow){
12810
        var sw = this.shadow;
12811
        if(!this.updating && this.isVisible() && (sw || this.useShim)){
12812
            var sh = this.getShim();
12813
 
12814
            var w = this.getWidth(),
12815
                h = this.getHeight();
12816
 
12817
            var l = this.getLeft(true),
12818
                t = this.getTop(true);
12819
 
12820
            if(sw && !this.shadowDisabled){
12821
                if(doShow && !sw.isVisible()){
12822
                    sw.show(this);
12823
                }else{
12824
                    sw.realign(l, t, w, h);
12825
                }
12826
                if(sh){
12827
                    if(doShow){
12828
                       sh.show();
12829
                    }
12830
 
12831
                    var a = sw.adjusts, s = sh.dom.style;
12832
                    s.left = (Math.min(l, l+a.l))+"px";
12833
                    s.top = (Math.min(t, t+a.t))+"px";
12834
                    s.width = (w+a.w)+"px";
12835
                    s.height = (h+a.h)+"px";
12836
                }
12837
            }else if(sh){
12838
                if(doShow){
12839
                   sh.show();
12840
                }
12841
                sh.setSize(w, h);
12842
                sh.setLeftTop(l, t);
12843
            }
12844
 
12845
        }
12846
    },
12847
 
12848
 
12849
    destroy : function(){
12850
        this.hideShim();
12851
        if(this.shadow){
12852
            this.shadow.hide();
12853
        }
12854
        this.removeAllListeners();
12855
        Ext.removeNode(this.dom);
12856
        Ext.Element.uncache(this.id);
12857
    },
12858
 
12859
    remove : function(){
12860
        this.destroy();
12861
    },
12862
 
12863
 
12864
    beginUpdate : function(){
12865
        this.updating = true;
12866
    },
12867
 
12868
 
12869
    endUpdate : function(){
12870
        this.updating = false;
12871
        this.sync(true);
12872
    },
12873
 
12874
 
12875
    hideUnders : function(negOffset){
12876
        if(this.shadow){
12877
            this.shadow.hide();
12878
        }
12879
        this.hideShim();
12880
    },
12881
 
12882
 
12883
    constrainXY : function(){
12884
        if(this.constrain){
12885
            var vw = Ext.lib.Dom.getViewWidth(),
12886
                vh = Ext.lib.Dom.getViewHeight();
12887
            var s = Ext.getDoc().getScroll();
12888
 
12889
            var xy = this.getXY();
12890
            var x = xy[0], y = xy[1];
12891
            var w = this.dom.offsetWidth+this.shadowOffset, h = this.dom.offsetHeight+this.shadowOffset;
12892
 
12893
            var moved = false;
12894
 
12895
            if((x + w) > vw+s.left){
12896
                x = vw - w - this.shadowOffset;
12897
                moved = true;
12898
            }
12899
            if((y + h) > vh+s.top){
12900
                y = vh - h - this.shadowOffset;
12901
                moved = true;
12902
            }
12903
 
12904
            if(x < s.left){
12905
                x = s.left;
12906
                moved = true;
12907
            }
12908
            if(y < s.top){
12909
                y = s.top;
12910
                moved = true;
12911
            }
12912
            if(moved){
12913
                if(this.avoidY){
12914
                    var ay = this.avoidY;
12915
                    if(y <= ay && (y+h) >= ay){
12916
                        y = ay-h-5;
12917
                    }
12918
                }
12919
                xy = [x, y];
12920
                this.storeXY(xy);
12921
                supr.setXY.call(this, xy);
12922
                this.sync();
12923
            }
12924
        }
12925
    },
12926
 
12927
    isVisible : function(){
12928
        return this.visible;
12929
    },
12930
 
12931
 
12932
    showAction : function(){
12933
        this.visible = true;
12934
        if(this.useDisplay === true){
12935
            this.setDisplayed("");
12936
        }else if(this.lastXY){
12937
            supr.setXY.call(this, this.lastXY);
12938
        }else if(this.lastLT){
12939
            supr.setLeftTop.call(this, this.lastLT[0], this.lastLT[1]);
12940
        }
12941
    },
12942
 
12943
 
12944
    hideAction : function(){
12945
        this.visible = false;
12946
        if(this.useDisplay === true){
12947
            this.setDisplayed(false);
12948
        }else{
12949
            this.setLeftTop(-10000,-10000);
12950
        }
12951
    },
12952
 
12953
 
12954
    setVisible : function(v, a, d, c, e){
12955
        if(v){
12956
            this.showAction();
12957
        }
12958
        if(a && v){
12959
            var cb = function(){
12960
                this.sync(true);
12961
                if(c){
12962
                    c();
12963
                }
12964
            }.createDelegate(this);
12965
            supr.setVisible.call(this, true, true, d, cb, e);
12966
        }else{
12967
            if(!v){
12968
                this.hideUnders(true);
12969
            }
12970
            var cb = c;
12971
            if(a){
12972
                cb = function(){
12973
                    this.hideAction();
12974
                    if(c){
12975
                        c();
12976
                    }
12977
                }.createDelegate(this);
12978
            }
12979
            supr.setVisible.call(this, v, a, d, cb, e);
12980
            if(v){
12981
                this.sync(true);
12982
            }else if(!a){
12983
                this.hideAction();
12984
            }
12985
        }
12986
    },
12987
 
12988
    storeXY : function(xy){
12989
        delete this.lastLT;
12990
        this.lastXY = xy;
12991
    },
12992
 
12993
    storeLeftTop : function(left, top){
12994
        delete this.lastXY;
12995
        this.lastLT = [left, top];
12996
    },
12997
 
12998
 
12999
    beforeFx : function(){
13000
        this.beforeAction();
13001
        return Ext.Layer.superclass.beforeFx.apply(this, arguments);
13002
    },
13003
 
13004
 
13005
    afterFx : function(){
13006
        Ext.Layer.superclass.afterFx.apply(this, arguments);
13007
        this.sync(this.isVisible());
13008
    },
13009
 
13010
 
13011
    beforeAction : function(){
13012
        if(!this.updating && this.shadow){
13013
            this.shadow.hide();
13014
        }
13015
    },
13016
 
13017
 
13018
    setLeft : function(left){
13019
        this.storeLeftTop(left, this.getTop(true));
13020
        supr.setLeft.apply(this, arguments);
13021
        this.sync();
13022
    },
13023
 
13024
    setTop : function(top){
13025
        this.storeLeftTop(this.getLeft(true), top);
13026
        supr.setTop.apply(this, arguments);
13027
        this.sync();
13028
    },
13029
 
13030
    setLeftTop : function(left, top){
13031
        this.storeLeftTop(left, top);
13032
        supr.setLeftTop.apply(this, arguments);
13033
        this.sync();
13034
    },
13035
 
13036
    setXY : function(xy, a, d, c, e){
13037
        this.fixDisplay();
13038
        this.beforeAction();
13039
        this.storeXY(xy);
13040
        var cb = this.createCB(c);
13041
        supr.setXY.call(this, xy, a, d, cb, e);
13042
        if(!a){
13043
            cb();
13044
        }
13045
    },
13046
 
13047
 
13048
    createCB : function(c){
13049
        var el = this;
13050
        return function(){
13051
            el.constrainXY();
13052
            el.sync(true);
13053
            if(c){
13054
                c();
13055
            }
13056
        };
13057
    },
13058
 
13059
 
13060
    setX : function(x, a, d, c, e){
13061
        this.setXY([x, this.getY()], a, d, c, e);
13062
    },
13063
 
13064
 
13065
    setY : function(y, a, d, c, e){
13066
        this.setXY([this.getX(), y], a, d, c, e);
13067
    },
13068
 
13069
 
13070
    setSize : function(w, h, a, d, c, e){
13071
        this.beforeAction();
13072
        var cb = this.createCB(c);
13073
        supr.setSize.call(this, w, h, a, d, cb, e);
13074
        if(!a){
13075
            cb();
13076
        }
13077
    },
13078
 
13079
 
13080
    setWidth : function(w, a, d, c, e){
13081
        this.beforeAction();
13082
        var cb = this.createCB(c);
13083
        supr.setWidth.call(this, w, a, d, cb, e);
13084
        if(!a){
13085
            cb();
13086
        }
13087
    },
13088
 
13089
 
13090
    setHeight : function(h, a, d, c, e){
13091
        this.beforeAction();
13092
        var cb = this.createCB(c);
13093
        supr.setHeight.call(this, h, a, d, cb, e);
13094
        if(!a){
13095
            cb();
13096
        }
13097
    },
13098
 
13099
 
13100
    setBounds : function(x, y, w, h, a, d, c, e){
13101
        this.beforeAction();
13102
        var cb = this.createCB(c);
13103
        if(!a){
13104
            this.storeXY([x, y]);
13105
            supr.setXY.call(this, [x, y]);
13106
            supr.setSize.call(this, w, h, a, d, cb, e);
13107
            cb();
13108
        }else{
13109
            supr.setBounds.call(this, x, y, w, h, a, d, cb, e);
13110
        }
13111
        return this;
13112
    },
13113
 
13114
 
13115
    setZIndex : function(zindex){
13116
        this.zindex = zindex;
13117
        this.setStyle("z-index", zindex + 2);
13118
        if(this.shadow){
13119
            this.shadow.setZIndex(zindex + 1);
13120
        }
13121
        if(this.shim){
13122
            this.shim.setStyle("z-index", zindex);
13123
        }
13124
    }
13125
});
13126
})();
13127
 
13128
Ext.Shadow = function(config){
13129
    Ext.apply(this, config);
13130
    if(typeof this.mode != "string"){
13131
        this.mode = this.defaultMode;
13132
    }
13133
    var o = this.offset, a = {h: 0};
13134
    var rad = Math.floor(this.offset/2);
13135
    switch(this.mode.toLowerCase()){         case "drop":
13136
            a.w = 0;
13137
            a.l = a.t = o;
13138
            a.t -= 1;
13139
            if(Ext.isIE){
13140
                a.l -= this.offset + rad;
13141
                a.t -= this.offset + rad;
13142
                a.w -= rad;
13143
                a.h -= rad;
13144
                a.t += 1;
13145
            }
13146
        break;
13147
        case "sides":
13148
            a.w = (o*2);
13149
            a.l = -o;
13150
            a.t = o-1;
13151
            if(Ext.isIE){
13152
                a.l -= (this.offset - rad);
13153
                a.t -= this.offset + rad;
13154
                a.l += 1;
13155
                a.w -= (this.offset - rad)*2;
13156
                a.w -= rad + 1;
13157
                a.h -= 1;
13158
            }
13159
        break;
13160
        case "frame":
13161
            a.w = a.h = (o*2);
13162
            a.l = a.t = -o;
13163
            a.t += 1;
13164
            a.h -= 2;
13165
            if(Ext.isIE){
13166
                a.l -= (this.offset - rad);
13167
                a.t -= (this.offset - rad);
13168
                a.l += 1;
13169
                a.w -= (this.offset + rad + 1);
13170
                a.h -= (this.offset + rad);
13171
                a.h += 1;
13172
            }
13173
        break;
13174
    };
13175
 
13176
    this.adjusts = a;
13177
};
13178
 
13179
Ext.Shadow.prototype = {
13180
 
13181
 
13182
    offset: 4,
13183
 
13184
        defaultMode: "drop",
13185
 
13186
 
13187
    show : function(target){
13188
        target = Ext.get(target);
13189
        if(!this.el){
13190
            this.el = Ext.Shadow.Pool.pull();
13191
            if(this.el.dom.nextSibling != target.dom){
13192
                this.el.insertBefore(target);
13193
            }
13194
        }
13195
        this.el.setStyle("z-index", this.zIndex || parseInt(target.getStyle("z-index"), 10)-1);
13196
        if(Ext.isIE){
13197
            this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")";
13198
        }
13199
        this.realign(
13200
            target.getLeft(true),
13201
            target.getTop(true),
13202
            target.getWidth(),
13203
            target.getHeight()
13204
        );
13205
        this.el.dom.style.display = "block";
13206
    },
13207
 
13208
 
13209
    isVisible : function(){
13210
        return this.el ? true : false;
13211
    },
13212
 
13213
 
13214
    realign : function(l, t, w, h){
13215
        if(!this.el){
13216
            return;
13217
        }
13218
        var a = this.adjusts, d = this.el.dom, s = d.style;
13219
        var iea = 0;
13220
        s.left = (l+a.l)+"px";
13221
        s.top = (t+a.t)+"px";
13222
        var sw = (w+a.w), sh = (h+a.h), sws = sw +"px", shs = sh + "px";
13223
        if(s.width != sws || s.height != shs){
13224
            s.width = sws;
13225
            s.height = shs;
13226
            if(!Ext.isIE){
13227
                var cn = d.childNodes;
13228
                var sww = Math.max(0, (sw-12))+"px";
13229
                cn[0].childNodes[1].style.width = sww;
13230
                cn[1].childNodes[1].style.width = sww;
13231
                cn[2].childNodes[1].style.width = sww;
13232
                cn[1].style.height = Math.max(0, (sh-12))+"px";
13233
            }
13234
        }
13235
    },
13236
 
13237
 
13238
    hide : function(){
13239
        if(this.el){
13240
            this.el.dom.style.display = "none";
13241
            Ext.Shadow.Pool.push(this.el);
13242
            delete this.el;
13243
        }
13244
    },
13245
 
13246
 
13247
    setZIndex : function(z){
13248
        this.zIndex = z;
13249
        if(this.el){
13250
            this.el.setStyle("z-index", z);
13251
        }
13252
    }
13253
};
13254
 
13255
Ext.Shadow.Pool = function(){
13256
    var p = [];
13257
    var markup = Ext.isIE ?
13258
                 '<div class="x-ie-shadow"></div>' :
13259
                 '<div class="x-shadow"><div class="xst"><div class="xstl"></div><div class="xstc"></div><div class="xstr"></div></div><div class="xsc"><div class="xsml"></div><div class="xsmc"></div><div class="xsmr"></div></div><div class="xsb"><div class="xsbl"></div><div class="xsbc"></div><div class="xsbr"></div></div></div>';
13260
    return {
13261
        pull : function(){
13262
            var sh = p.shift();
13263
            if(!sh){
13264
                sh = Ext.get(Ext.DomHelper.insertHtml("beforeBegin", document.body.firstChild, markup));
13265
                sh.autoBoxAdjust = false;
13266
            }
13267
            return sh;
13268
        },
13269
 
13270
        push : function(sh){
13271
            p.push(sh);
13272
        }
13273
    };
13274
}();
13275
 
13276
Ext.BoxComponent = Ext.extend(Ext.Component, {
13277
 
13278
 
13279
 
13280
 
13281
 
13282
 
13283
 
13284
 
13285
 
13286
 
13287
    initComponent : function(){
13288
        Ext.BoxComponent.superclass.initComponent.call(this);
13289
        this.addEvents(
13290
 
13291
            'resize',
13292
 
13293
            'move'
13294
        );
13295
    },
13296
 
13297
        boxReady : false,
13298
        deferHeight: false,
13299
 
13300
 
13301
    setSize : function(w, h){
13302
                if(typeof w == 'object'){
13303
            h = w.height;
13304
            w = w.width;
13305
        }
13306
                if(!this.boxReady){
13307
            this.width = w;
13308
            this.height = h;
13309
            return this;
13310
        }
13311
 
13312
                if(this.lastSize && this.lastSize.width == w && this.lastSize.height == h){
13313
            return this;
13314
        }
13315
        this.lastSize = {width: w, height: h};
13316
        var adj = this.adjustSize(w, h);
13317
        var aw = adj.width, ah = adj.height;
13318
        if(aw !== undefined || ah !== undefined){             var rz = this.getResizeEl();
13319
            if(!this.deferHeight && aw !== undefined && ah !== undefined){
13320
                rz.setSize(aw, ah);
13321
            }else if(!this.deferHeight && ah !== undefined){
13322
                rz.setHeight(ah);
13323
            }else if(aw !== undefined){
13324
                rz.setWidth(aw);
13325
            }
13326
            this.onResize(aw, ah, w, h);
13327
            this.fireEvent('resize', this, aw, ah, w, h);
13328
        }
13329
        return this;
13330
    },
13331
 
13332
 
13333
    setWidth : function(width){
13334
        return this.setSize(width);
13335
    },
13336
 
13337
 
13338
    setHeight : function(height){
13339
        return this.setSize(undefined, height);
13340
    },
13341
 
13342
 
13343
    getSize : function(){
13344
        return this.el.getSize();
13345
    },
13346
 
13347
 
13348
    getPosition : function(local){
13349
        if(local === true){
13350
            return [this.el.getLeft(true), this.el.getTop(true)];
13351
        }
13352
        return this.xy || this.el.getXY();
13353
    },
13354
 
13355
 
13356
    getBox : function(local){
13357
        var s = this.el.getSize();
13358
        if(local === true){
13359
            s.x = this.el.getLeft(true);
13360
            s.y = this.el.getTop(true);
13361
        }else{
13362
            var xy = this.xy || this.el.getXY();
13363
            s.x = xy[0];
13364
            s.y = xy[1];
13365
        }
13366
        return s;
13367
    },
13368
 
13369
 
13370
    updateBox : function(box){
13371
        this.setSize(box.width, box.height);
13372
        this.setPagePosition(box.x, box.y);
13373
        return this;
13374
    },
13375
 
13376
        getResizeEl : function(){
13377
        return this.resizeEl || this.el;
13378
    },
13379
 
13380
        getPositionEl : function(){
13381
        return this.positionEl || this.el;
13382
    },
13383
 
13384
 
13385
    setPosition : function(x, y){
13386
        if(x && typeof x[1] == 'number'){
13387
            y = x[1];
13388
            x = x[0];
13389
        }
13390
        this.x = x;
13391
        this.y = y;
13392
        if(!this.boxReady){
13393
            return this;
13394
        }
13395
        var adj = this.adjustPosition(x, y);
13396
        var ax = adj.x, ay = adj.y;
13397
 
13398
        var el = this.getPositionEl();
13399
        if(ax !== undefined || ay !== undefined){
13400
            if(ax !== undefined && ay !== undefined){
13401
                el.setLeftTop(ax, ay);
13402
            }else if(ax !== undefined){
13403
                el.setLeft(ax);
13404
            }else if(ay !== undefined){
13405
                el.setTop(ay);
13406
            }
13407
            this.onPosition(ax, ay);
13408
            this.fireEvent('move', this, ax, ay);
13409
        }
13410
        return this;
13411
    },
13412
 
13413
 
13414
    setPagePosition : function(x, y){
13415
        if(x && typeof x[1] == 'number'){
13416
            y = x[1];
13417
            x = x[0];
13418
        }
13419
        this.pageX = x;
13420
        this.pageY = y;
13421
        if(!this.boxReady){
13422
            return;
13423
        }
13424
        if(x === undefined || y === undefined){             return;
13425
        }
13426
        var p = this.el.translatePoints(x, y);
13427
        this.setPosition(p.left, p.top);
13428
        return this;
13429
    },
13430
 
13431
        onRender : function(ct, position){
13432
        Ext.BoxComponent.superclass.onRender.call(this, ct, position);
13433
        if(this.resizeEl){
13434
            this.resizeEl = Ext.get(this.resizeEl);
13435
        }
13436
        if(this.positionEl){
13437
            this.positionEl = Ext.get(this.positionEl);
13438
        }
13439
    },
13440
 
13441
        afterRender : function(){
13442
        Ext.BoxComponent.superclass.afterRender.call(this);
13443
        this.boxReady = true;
13444
        this.setSize(this.width, this.height);
13445
        if(this.x || this.y){
13446
            this.setPosition(this.x, this.y);
13447
        }else if(this.pageX || this.pageY){
13448
            this.setPagePosition(this.pageX, this.pageY);
13449
        }
13450
    },
13451
 
13452
 
13453
    syncSize : function(){
13454
        delete this.lastSize;
13455
        this.setSize(this.autoWidth ? undefined : this.el.getWidth(), this.autoHeight ? undefined : this.el.getHeight());
13456
        return this;
13457
    },
13458
 
13459
 
13460
    onResize : function(adjWidth, adjHeight, rawWidth, rawHeight){
13461
 
13462
    },
13463
 
13464
 
13465
    onPosition : function(x, y){
13466
 
13467
    },
13468
 
13469
        adjustSize : function(w, h){
13470
        if(this.autoWidth){
13471
            w = 'auto';
13472
        }
13473
        if(this.autoHeight){
13474
            h = 'auto';
13475
        }
13476
        return {width : w, height: h};
13477
    },
13478
 
13479
        adjustPosition : function(x, y){
13480
        return {x : x, y: y};
13481
    }
13482
});
13483
Ext.reg('box', Ext.BoxComponent);
13484
 
13485
Ext.SplitBar = function(dragElement, resizingElement, orientation, placement, existingProxy){
13486
 
13487
 
13488
    this.el = Ext.get(dragElement, true);
13489
    this.el.dom.unselectable = "on";
13490
 
13491
    this.resizingEl = Ext.get(resizingElement, true);
13492
 
13493
 
13494
    this.orientation = orientation || Ext.SplitBar.HORIZONTAL;
13495
 
13496
 
13497
    this.minSize = 0;
13498
 
13499
 
13500
    this.maxSize = 2000;
13501
 
13502
 
13503
    this.animate = false;
13504
 
13505
 
13506
    this.useShim = false;
13507
 
13508
 
13509
    this.shim = null;
13510
 
13511
    if(!existingProxy){
13512
 
13513
        this.proxy = Ext.SplitBar.createProxy(this.orientation);
13514
    }else{
13515
        this.proxy = Ext.get(existingProxy).dom;
13516
    }
13517
 
13518
    this.dd = new Ext.dd.DDProxy(this.el.dom.id, "XSplitBars", {dragElId : this.proxy.id});
13519
 
13520
 
13521
    this.dd.b4StartDrag = this.onStartProxyDrag.createDelegate(this);
13522
 
13523
 
13524
    this.dd.endDrag = this.onEndProxyDrag.createDelegate(this);
13525
 
13526
 
13527
    this.dragSpecs = {};
13528
 
13529
 
13530
    this.adapter = new Ext.SplitBar.BasicLayoutAdapter();
13531
    this.adapter.init(this);
13532
 
13533
    if(this.orientation == Ext.SplitBar.HORIZONTAL){
13534
 
13535
        this.placement = placement || (this.el.getX() > this.resizingEl.getX() ? Ext.SplitBar.LEFT : Ext.SplitBar.RIGHT);
13536
        this.el.addClass("x-splitbar-h");
13537
    }else{
13538
 
13539
        this.placement = placement || (this.el.getY() > this.resizingEl.getY() ? Ext.SplitBar.TOP : Ext.SplitBar.BOTTOM);
13540
        this.el.addClass("x-splitbar-v");
13541
    }
13542
 
13543
    this.addEvents(
13544
 
13545
        "resize",
13546
 
13547
        "moved",
13548
 
13549
        "beforeresize",
13550
 
13551
        "beforeapply"
13552
    );
13553
 
13554
    Ext.SplitBar.superclass.constructor.call(this);
13555
};
13556
 
13557
Ext.extend(Ext.SplitBar, Ext.util.Observable, {
13558
    onStartProxyDrag : function(x, y){
13559
        this.fireEvent("beforeresize", this);
13560
        this.overlay =  Ext.DomHelper.append(document.body,  {cls: "x-drag-overlay", html: "&#160;"}, true);
13561
        this.overlay.unselectable();
13562
        this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
13563
        this.overlay.show();
13564
        Ext.get(this.proxy).setDisplayed("block");
13565
        var size = this.adapter.getElementSize(this);
13566
        this.activeMinSize = this.getMinimumSize();;
13567
        this.activeMaxSize = this.getMaximumSize();;
13568
        var c1 = size - this.activeMinSize;
13569
        var c2 = Math.max(this.activeMaxSize - size, 0);
13570
        if(this.orientation == Ext.SplitBar.HORIZONTAL){
13571
            this.dd.resetConstraints();
13572
            this.dd.setXConstraint(
13573
                this.placement == Ext.SplitBar.LEFT ? c1 : c2,
13574
                this.placement == Ext.SplitBar.LEFT ? c2 : c1
13575
            );
13576
            this.dd.setYConstraint(0, 0);
13577
        }else{
13578
            this.dd.resetConstraints();
13579
            this.dd.setXConstraint(0, 0);
13580
            this.dd.setYConstraint(
13581
                this.placement == Ext.SplitBar.TOP ? c1 : c2,
13582
                this.placement == Ext.SplitBar.TOP ? c2 : c1
13583
            );
13584
         }
13585
        this.dragSpecs.startSize = size;
13586
        this.dragSpecs.startPoint = [x, y];
13587
        Ext.dd.DDProxy.prototype.b4StartDrag.call(this.dd, x, y);
13588
    },
13589
 
13590
 
13591
    onEndProxyDrag : function(e){
13592
        Ext.get(this.proxy).setDisplayed(false);
13593
        var endPoint = Ext.lib.Event.getXY(e);
13594
        if(this.overlay){
13595
            this.overlay.remove();
13596
            delete this.overlay;
13597
        }
13598
        var newSize;
13599
        if(this.orientation == Ext.SplitBar.HORIZONTAL){
13600
            newSize = this.dragSpecs.startSize +
13601
                (this.placement == Ext.SplitBar.LEFT ?
13602
                    endPoint[0] - this.dragSpecs.startPoint[0] :
13603
                    this.dragSpecs.startPoint[0] - endPoint[0]
13604
                );
13605
        }else{
13606
            newSize = this.dragSpecs.startSize +
13607
                (this.placement == Ext.SplitBar.TOP ?
13608
                    endPoint[1] - this.dragSpecs.startPoint[1] :
13609
                    this.dragSpecs.startPoint[1] - endPoint[1]
13610
                );
13611
        }
13612
        newSize = Math.min(Math.max(newSize, this.activeMinSize), this.activeMaxSize);
13613
        if(newSize != this.dragSpecs.startSize){
13614
            if(this.fireEvent('beforeapply', this, newSize) !== false){
13615
                this.adapter.setElementSize(this, newSize);
13616
                this.fireEvent("moved", this, newSize);
13617
                this.fireEvent("resize", this, newSize);
13618
            }
13619
        }
13620
    },
13621
 
13622
 
13623
    getAdapter : function(){
13624
        return this.adapter;
13625
    },
13626
 
13627
 
13628
    setAdapter : function(adapter){
13629
        this.adapter = adapter;
13630
        this.adapter.init(this);
13631
    },
13632
 
13633
 
13634
    getMinimumSize : function(){
13635
        return this.minSize;
13636
    },
13637
 
13638
 
13639
    setMinimumSize : function(minSize){
13640
        this.minSize = minSize;
13641
    },
13642
 
13643
 
13644
    getMaximumSize : function(){
13645
        return this.maxSize;
13646
    },
13647
 
13648
 
13649
    setMaximumSize : function(maxSize){
13650
        this.maxSize = maxSize;
13651
    },
13652
 
13653
 
13654
    setCurrentSize : function(size){
13655
        var oldAnimate = this.animate;
13656
        this.animate = false;
13657
        this.adapter.setElementSize(this, size);
13658
        this.animate = oldAnimate;
13659
    },
13660
 
13661
 
13662
    destroy : function(removeEl){
13663
        if(this.shim){
13664
            this.shim.remove();
13665
        }
13666
        this.dd.unreg();
13667
        Ext.removeNode(this.proxy);
13668
        if(removeEl){
13669
            this.el.remove();
13670
        }
13671
    }
13672
});
13673
 
13674
 
13675
Ext.SplitBar.createProxy = function(dir){
13676
    var proxy = new Ext.Element(document.createElement("div"));
13677
    proxy.unselectable();
13678
    var cls = 'x-splitbar-proxy';
13679
    proxy.addClass(cls + ' ' + (dir == Ext.SplitBar.HORIZONTAL ? cls +'-h' : cls + '-v'));
13680
    document.body.appendChild(proxy.dom);
13681
    return proxy.dom;
13682
};
13683
 
13684
 
13685
Ext.SplitBar.BasicLayoutAdapter = function(){
13686
};
13687
 
13688
Ext.SplitBar.BasicLayoutAdapter.prototype = {
13689
 
13690
    init : function(s){
13691
 
13692
    },
13693
 
13694
     getElementSize : function(s){
13695
        if(s.orientation == Ext.SplitBar.HORIZONTAL){
13696
            return s.resizingEl.getWidth();
13697
        }else{
13698
            return s.resizingEl.getHeight();
13699
        }
13700
    },
13701
 
13702
 
13703
    setElementSize : function(s, newSize, onComplete){
13704
        if(s.orientation == Ext.SplitBar.HORIZONTAL){
13705
            if(!s.animate){
13706
                s.resizingEl.setWidth(newSize);
13707
                if(onComplete){
13708
                    onComplete(s, newSize);
13709
                }
13710
            }else{
13711
                s.resizingEl.setWidth(newSize, true, .1, onComplete, 'easeOut');
13712
            }
13713
        }else{
13714
 
13715
            if(!s.animate){
13716
                s.resizingEl.setHeight(newSize);
13717
                if(onComplete){
13718
                    onComplete(s, newSize);
13719
                }
13720
            }else{
13721
                s.resizingEl.setHeight(newSize, true, .1, onComplete, 'easeOut');
13722
            }
13723
        }
13724
    }
13725
};
13726
 
13727
 
13728
Ext.SplitBar.AbsoluteLayoutAdapter = function(container){
13729
    this.basic = new Ext.SplitBar.BasicLayoutAdapter();
13730
    this.container = Ext.get(container);
13731
};
13732
 
13733
Ext.SplitBar.AbsoluteLayoutAdapter.prototype = {
13734
    init : function(s){
13735
        this.basic.init(s);
13736
    },
13737
 
13738
    getElementSize : function(s){
13739
        return this.basic.getElementSize(s);
13740
    },
13741
 
13742
    setElementSize : function(s, newSize, onComplete){
13743
        this.basic.setElementSize(s, newSize, this.moveSplitter.createDelegate(this, [s]));
13744
    },
13745
 
13746
    moveSplitter : function(s){
13747
        var yes = Ext.SplitBar;
13748
        switch(s.placement){
13749
            case yes.LEFT:
13750
                s.el.setX(s.resizingEl.getRight());
13751
                break;
13752
            case yes.RIGHT:
13753
                s.el.setStyle("right", (this.container.getWidth() - s.resizingEl.getLeft()) + "px");
13754
                break;
13755
            case yes.TOP:
13756
                s.el.setY(s.resizingEl.getBottom());
13757
                break;
13758
            case yes.BOTTOM:
13759
                s.el.setY(s.resizingEl.getTop() - s.el.getHeight());
13760
                break;
13761
        }
13762
    }
13763
};
13764
 
13765
 
13766
Ext.SplitBar.VERTICAL = 1;
13767
 
13768
 
13769
Ext.SplitBar.HORIZONTAL = 2;
13770
 
13771
 
13772
Ext.SplitBar.LEFT = 1;
13773
 
13774
 
13775
Ext.SplitBar.RIGHT = 2;
13776
 
13777
 
13778
Ext.SplitBar.TOP = 3;
13779
 
13780
 
13781
Ext.SplitBar.BOTTOM = 4;
13782
 
13783
 
13784
Ext.Container = Ext.extend(Ext.BoxComponent, {
13785
 
13786
 
13787
 
13788
 
13789
 
13790
 
13791
 
13792
 
13793
 
13794
    autoDestroy: true,
13795
 
13796
 
13797
    defaultType: 'panel',
13798
 
13799
        initComponent : function(){
13800
        Ext.Container.superclass.initComponent.call(this);
13801
 
13802
        this.addEvents(
13803
 
13804
            'afterlayout',
13805
 
13806
            'beforeadd',
13807
 
13808
            'beforeremove',
13809
 
13810
            'add',
13811
 
13812
            'remove'
13813
        );
13814
 
13815
 
13816
        var items = this.items;
13817
        if(items){
13818
            delete this.items;
13819
            if(Ext.isArray(items)){
13820
                this.add.apply(this, items);
13821
            }else{
13822
                this.add(items);
13823
            }
13824
        }
13825
    },
13826
 
13827
        initItems : function(){
13828
        if(!this.items){
13829
            this.items = new Ext.util.MixedCollection(false, this.getComponentId);
13830
            this.getLayout();         }
13831
    },
13832
 
13833
        setLayout : function(layout){
13834
        if(this.layout && this.layout != layout){
13835
            this.layout.setContainer(null);
13836
        }
13837
        this.initItems();
13838
        this.layout = layout;
13839
        layout.setContainer(this);
13840
    },
13841
 
13842
        render : function(){
13843
        Ext.Container.superclass.render.apply(this, arguments);
13844
        if(this.layout){
13845
            if(typeof this.layout == 'string'){
13846
                this.layout = new Ext.Container.LAYOUTS[this.layout.toLowerCase()](this.layoutConfig);
13847
            }
13848
            this.setLayout(this.layout);
13849
 
13850
            if(this.activeItem !== undefined){
13851
                var item = this.activeItem;
13852
                delete this.activeItem;
13853
                this.layout.setActiveItem(item);
13854
                return;
13855
            }
13856
        }
13857
        if(!this.ownerCt){
13858
            this.doLayout();
13859
        }
13860
        if(this.monitorResize === true){
13861
            Ext.EventManager.onWindowResize(this.doLayout, this, [false]);
13862
        }
13863
    },
13864
 
13865
        getLayoutTarget : function(){
13866
        return this.el;
13867
    },
13868
 
13869
        getComponentId : function(comp){
13870
        return comp.itemId || comp.id;
13871
    },
13872
 
13873
 
13874
    add : function(comp){
13875
        if(!this.items){
13876
            this.initItems();
13877
        }
13878
        var a = arguments, len = a.length;
13879
        if(len > 1){
13880
            for(var i = 0; i < len; i++) {
13881
                this.add(a[i]);
13882
            }
13883
            return;
13884
        }
13885
        var c = this.lookupComponent(this.applyDefaults(comp));
13886
        var pos = this.items.length;
13887
        if(this.fireEvent('beforeadd', this, c, pos) !== false && this.onBeforeAdd(c) !== false){
13888
            this.items.add(c);
13889
            c.ownerCt = this;
13890
            this.fireEvent('add', this, c, pos);
13891
        }
13892
        return c;
13893
    },
13894
 
13895
 
13896
    insert : function(index, comp){
13897
        if(!this.items){
13898
            this.initItems();
13899
        }
13900
        var a = arguments, len = a.length;
13901
        if(len > 2){
13902
            for(var i = len-1; i >= 1; --i) {
13903
                this.insert(index, a[i]);
13904
            }
13905
            return;
13906
        }
13907
        var c = this.lookupComponent(this.applyDefaults(comp));
13908
 
13909
        if(c.ownerCt == this && this.items.indexOf(c) < index){
13910
            --index;
13911
        }
13912
 
13913
        if(this.fireEvent('beforeadd', this, c, index) !== false && this.onBeforeAdd(c) !== false){
13914
            this.items.insert(index, c);
13915
            c.ownerCt = this;
13916
            this.fireEvent('add', this, c, index);
13917
        }
13918
        return c;
13919
    },
13920
 
13921
        applyDefaults : function(c){
13922
        if(this.defaults){
13923
            if(typeof c == 'string'){
13924
                c = Ext.ComponentMgr.get(c);
13925
                Ext.apply(c, this.defaults);
13926
            }else if(!c.events){
13927
                Ext.applyIf(c, this.defaults);
13928
            }else{
13929
                Ext.apply(c, this.defaults);
13930
            }
13931
        }
13932
        return c;
13933
    },
13934
 
13935
        onBeforeAdd : function(item){
13936
        if(item.ownerCt){
13937
            item.ownerCt.remove(item, false);
13938
        }
13939
        if(this.hideBorders === true){
13940
            item.border = (item.border === true);
13941
        }
13942
    },
13943
 
13944
 
13945
    remove : function(comp, autoDestroy){
13946
        var c = this.getComponent(comp);
13947
        if(c && this.fireEvent('beforeremove', this, c) !== false){
13948
            this.items.remove(c);
13949
            delete c.ownerCt;
13950
            if(autoDestroy === true || (autoDestroy !== false && this.autoDestroy)){
13951
                c.destroy();
13952
            }
13953
            if(this.layout && this.layout.activeItem == c){
13954
                delete this.layout.activeItem;
13955
            }
13956
            this.fireEvent('remove', this, c);
13957
        }
13958
        return c;
13959
    },
13960
 
13961
 
13962
    getComponent : function(comp){
13963
        if(typeof comp == 'object'){
13964
            return comp;
13965
        }
13966
        return this.items.get(comp);
13967
    },
13968
 
13969
        lookupComponent : function(comp){
13970
        if(typeof comp == 'string'){
13971
            return Ext.ComponentMgr.get(comp);
13972
        }else if(!comp.events){
13973
            return this.createComponent(comp);
13974
        }
13975
        return comp;
13976
    },
13977
 
13978
        createComponent : function(config){
13979
        return Ext.ComponentMgr.create(config, this.defaultType);
13980
    },
13981
 
13982
 
13983
    doLayout : function(shallow){
13984
        if(this.rendered && this.layout){
13985
            this.layout.layout();
13986
        }
13987
        if(shallow !== false && this.items){
13988
            var cs = this.items.items;
13989
            for(var i = 0, len = cs.length; i < len; i++) {
13990
                var c  = cs[i];
13991
                if(c.doLayout){
13992
                    c.doLayout();
13993
                }
13994
            }
13995
        }
13996
    },
13997
 
13998
 
13999
    getLayout : function(){
14000
        if(!this.layout){
14001
            var layout = new Ext.layout.ContainerLayout(this.layoutConfig);
14002
            this.setLayout(layout);
14003
        }
14004
        return this.layout;
14005
    },
14006
 
14007
        onDestroy : function(){
14008
        if(this.items){
14009
            var cs = this.items.items;
14010
            for(var i = 0, len = cs.length; i < len; i++) {
14011
                Ext.destroy(cs[i]);
14012
            }
14013
        }
14014
        if(this.monitorResize){
14015
            Ext.EventManager.removeResizeListener(this.doLayout, this);
14016
        }
14017
        Ext.Container.superclass.onDestroy.call(this);
14018
    },
14019
 
14020
 
14021
    bubble : function(fn, scope, args){
14022
        var p = this;
14023
        while(p){
14024
            if(fn.apply(scope || p, args || [p]) === false){
14025
                break;
14026
            }
14027
            p = p.ownerCt;
14028
        }
14029
    },
14030
 
14031
 
14032
    cascade : function(fn, scope, args){
14033
        if(fn.apply(scope || this, args || [this]) !== false){
14034
            if(this.items){
14035
                var cs = this.items.items;
14036
                for(var i = 0, len = cs.length; i < len; i++){
14037
                    if(cs[i].cascade){
14038
                        cs[i].cascade(fn, scope, args);
14039
                    }else{
14040
                        fn.apply(scope || this, args || [cs[i]]);
14041
                    }
14042
                }
14043
            }
14044
        }
14045
    },
14046
 
14047
 
14048
    findById : function(id){
14049
        var m, ct = this;
14050
        this.cascade(function(c){
14051
            if(ct != c && c.id === id){
14052
                m = c;
14053
                return false;
14054
            }
14055
        });
14056
        return m || null;
14057
    },
14058
 
14059
 
14060
    findByType : function(xtype){
14061
        return typeof xtype == 'function' ?
14062
            this.findBy(function(c){
14063
                return c.constructor === xtype;
14064
            }) :
14065
            this.findBy(function(c){
14066
                return c.constructor.xtype === xtype;
14067
            });
14068
    },
14069
 
14070
 
14071
    find : function(prop, value){
14072
        return this.findBy(function(c){
14073
            return c[prop] === value;
14074
        });
14075
    },
14076
 
14077
 
14078
    findBy : function(fn, scope){
14079
        var m = [], ct = this;
14080
        this.cascade(function(c){
14081
            if(ct != c && fn.call(scope || c, c, ct) === true){
14082
                m.push(c);
14083
            }
14084
        });
14085
        return m;
14086
    }
14087
});
14088
 
14089
Ext.Container.LAYOUTS = {};
14090
Ext.reg('container', Ext.Container);
14091
 
14092
Ext.layout.ContainerLayout = function(config){
14093
    Ext.apply(this, config);
14094
};
14095
 
14096
Ext.layout.ContainerLayout.prototype = {
14097
 
14098
 
14099
 
14100
 
14101
 
14102
        monitorResize:false,
14103
        activeItem : null,
14104
 
14105
        layout : function(){
14106
        var target = this.container.getLayoutTarget();
14107
        this.onLayout(this.container, target);
14108
        this.container.fireEvent('afterlayout', this.container, this);
14109
    },
14110
 
14111
        onLayout : function(ct, target){
14112
        this.renderAll(ct, target);
14113
    },
14114
 
14115
        isValidParent : function(c, target){
14116
		var el = c.getPositionEl ? c.getPositionEl() : c.getEl();
14117
		return el.dom.parentNode == target.dom;
14118
    },
14119
 
14120
        renderAll : function(ct, target){
14121
        var items = ct.items.items;
14122
        for(var i = 0, len = items.length; i < len; i++) {
14123
            var c = items[i];
14124
            if(c && (!c.rendered || !this.isValidParent(c, target))){
14125
                this.renderItem(c, i, target);
14126
            }
14127
        }
14128
    },
14129
 
14130
        renderItem : function(c, position, target){
14131
        if(c && !c.rendered){
14132
            c.render(target, position);
14133
            if(this.extraCls){
14134
            	var t = c.getPositionEl ? c.getPositionEl() : c;
14135
            	t.addClass(this.extraCls);
14136
            }
14137
            if (this.renderHidden && c != this.activeItem) {
14138
                c.hide();
14139
            }
14140
        }else if(c && !this.isValidParent(c, target)){
14141
            if(this.extraCls){
14142
                c.addClass(this.extraCls);
14143
            }
14144
            if(typeof position == 'number'){
14145
                position = target.dom.childNodes[position];
14146
            }
14147
            target.dom.insertBefore(c.getEl().dom, position || null);
14148
            if (this.renderHidden && c != this.activeItem) {
14149
                c.hide();
14150
            }
14151
        }
14152
    },
14153
 
14154
        onResize: function(){
14155
        if(this.container.collapsed){
14156
            return;
14157
        }
14158
        var b = this.container.bufferResize;
14159
        if(b){
14160
            if(!this.resizeTask){
14161
                this.resizeTask = new Ext.util.DelayedTask(this.layout, this);
14162
                this.resizeBuffer = typeof b == 'number' ? b : 100;
14163
            }
14164
            this.resizeTask.delay(this.resizeBuffer);
14165
        }else{
14166
            this.layout();
14167
        }
14168
    },
14169
 
14170
        setContainer : function(ct){
14171
        if(this.monitorResize && ct != this.container){
14172
            if(this.container){
14173
                this.container.un('resize', this.onResize, this);
14174
            }
14175
            if(ct){
14176
                ct.on('resize', this.onResize, this);
14177
            }
14178
        }
14179
        this.container = ct;
14180
    },
14181
 
14182
        parseMargins : function(v){
14183
        var ms = v.split(' ');
14184
        var len = ms.length;
14185
        if(len == 1){
14186
            ms[1] = ms[0];
14187
            ms[2] = ms[0];
14188
            ms[3] = ms[0];
14189
        }
14190
        if(len == 2){
14191
            ms[2] = ms[0];
14192
            ms[3] = ms[1];
14193
        }
14194
        return {
14195
            top:parseInt(ms[0], 10) || 0,
14196
            right:parseInt(ms[1], 10) || 0,
14197
            bottom:parseInt(ms[2], 10) || 0,
14198
            left:parseInt(ms[3], 10) || 0
14199
        };
14200
    }
14201
};
14202
Ext.Container.LAYOUTS['auto'] = Ext.layout.ContainerLayout;
14203
 
14204
Ext.layout.FitLayout = Ext.extend(Ext.layout.ContainerLayout, {
14205
 
14206
    monitorResize:true,
14207
 
14208
 
14209
    onLayout : function(ct, target){
14210
        Ext.layout.FitLayout.superclass.onLayout.call(this, ct, target);
14211
        if(!this.container.collapsed){
14212
            this.setItemSize(this.activeItem || ct.items.itemAt(0), target.getStyleSize());
14213
        }
14214
    },
14215
 
14216
 
14217
    setItemSize : function(item, size){
14218
        if(item && size.height > 0){
14219
            item.setSize(size);
14220
        }
14221
    }
14222
});
14223
Ext.Container.LAYOUTS['fit'] = Ext.layout.FitLayout;
14224
 
14225
Ext.layout.CardLayout = Ext.extend(Ext.layout.FitLayout, {
14226
 
14227
    deferredRender : false,
14228
 
14229
 
14230
    renderHidden : true,
14231
 
14232
 
14233
    setActiveItem : function(item){
14234
        item = this.container.getComponent(item);
14235
        if(this.activeItem != item){
14236
            if(this.activeItem){
14237
                this.activeItem.hide();
14238
            }
14239
            this.activeItem = item;
14240
            item.show();
14241
            this.layout();
14242
        }
14243
    },
14244
 
14245
 
14246
    renderAll : function(ct, target){
14247
        if(this.deferredRender){
14248
            this.renderItem(this.activeItem, undefined, target);
14249
        }else{
14250
            Ext.layout.CardLayout.superclass.renderAll.call(this, ct, target);
14251
        }
14252
    }
14253
});
14254
Ext.Container.LAYOUTS['card'] = Ext.layout.CardLayout;
14255
 
14256
Ext.layout.AnchorLayout = Ext.extend(Ext.layout.ContainerLayout, {
14257
 
14258
    monitorResize:true,
14259
 
14260
 
14261
    getAnchorViewSize : function(ct, target){
14262
        return target.dom == document.body ?
14263
                   target.getViewSize() : target.getStyleSize();
14264
    },
14265
 
14266
 
14267
    onLayout : function(ct, target){
14268
        Ext.layout.AnchorLayout.superclass.onLayout.call(this, ct, target);
14269
 
14270
        var size = this.getAnchorViewSize(ct, target);
14271
 
14272
        var w = size.width, h = size.height;
14273
 
14274
        if(w < 20 || h < 20){
14275
            return;
14276
        }
14277
 
14278
 
14279
        var aw, ah;
14280
        if(ct.anchorSize){
14281
            if(typeof ct.anchorSize == 'number'){
14282
                aw = ct.anchorSize;
14283
            }else{
14284
                aw = ct.anchorSize.width;
14285
                ah = ct.anchorSize.height;
14286
            }
14287
        }else{
14288
            aw = ct.initialConfig.width;
14289
            ah = ct.initialConfig.height;
14290
        }
14291
 
14292
        var cs = ct.items.items, len = cs.length, i, c, a, cw, ch;
14293
        for(i = 0; i < len; i++){
14294
            c = cs[i];
14295
            if(c.anchor){
14296
                a = c.anchorSpec;
14297
                if(!a){
14298
                    var vs = c.anchor.split(' ');
14299
                    c.anchorSpec = a = {
14300
                        right: this.parseAnchor(vs[0], c.initialConfig.width, aw),
14301
                        bottom: this.parseAnchor(vs[1], c.initialConfig.height, ah)
14302
                    };
14303
                }
14304
                cw = a.right ? this.adjustWidthAnchor(a.right(w), c) : undefined;
14305
                ch = a.bottom ? this.adjustHeightAnchor(a.bottom(h), c) : undefined;
14306
 
14307
                if(cw || ch){
14308
                    c.setSize(cw || undefined, ch || undefined);
14309
                }
14310
            }
14311
        }
14312
    },
14313
 
14314
 
14315
    parseAnchor : function(a, start, cstart){
14316
        if(a && a != 'none'){
14317
            var last;
14318
            if(/^(r|right|b|bottom)$/i.test(a)){
14319
                var diff = cstart - start;
14320
                return function(v){
14321
                    if(v !== last){
14322
                        last = v;
14323
                        return v - diff;
14324
                    }
14325
                }
14326
            }else if(a.indexOf('%') != -1){
14327
                var ratio = parseFloat(a.replace('%', ''))*.01;
14328
                return function(v){
14329
                    if(v !== last){
14330
                        last = v;
14331
                        return Math.floor(v*ratio);
14332
                    }
14333
                }
14334
            }else{
14335
                a = parseInt(a, 10);
14336
                if(!isNaN(a)){
14337
                    return function(v){
14338
                        if(v !== last){
14339
                            last = v;
14340
                            return v + a;
14341
                        }
14342
                    }
14343
                }
14344
            }
14345
        }
14346
        return false;
14347
    },
14348
 
14349
 
14350
    adjustWidthAnchor : function(value, comp){
14351
        return value;
14352
    },
14353
 
14354
 
14355
    adjustHeightAnchor : function(value, comp){
14356
        return value;
14357
    }
14358
 
14359
 
14360
});
14361
Ext.Container.LAYOUTS['anchor'] = Ext.layout.AnchorLayout;
14362
 
14363
Ext.layout.ColumnLayout = Ext.extend(Ext.layout.ContainerLayout, {
14364
 
14365
    monitorResize:true,
14366
 
14367
    extraCls: 'x-column',
14368
 
14369
    scrollOffset : 0,
14370
 
14371
 
14372
    isValidParent : function(c, target){
14373
        return c.getEl().dom.parentNode == this.innerCt.dom;
14374
    },
14375
 
14376
 
14377
    onLayout : function(ct, target){
14378
        var cs = ct.items.items, len = cs.length, c, i;
14379
 
14380
        if(!this.innerCt){
14381
            target.addClass('x-column-layout-ct');
14382
 
14383
 
14384
 
14385
            this.innerCt = target.createChild({cls:'x-column-inner'});
14386
            this.innerCt.createChild({cls:'x-clear'});
14387
        }
14388
        this.renderAll(ct, this.innerCt);
14389
 
14390
        var size = target.getViewSize();
14391
 
14392
        if(size.width < 1 && size.height < 1){
14393
            return;
14394
        }
14395
 
14396
        var w = size.width - target.getPadding('lr') - this.scrollOffset,
14397
            h = size.height - target.getPadding('tb'),
14398
            pw = w;
14399
 
14400
        this.innerCt.setWidth(w);
14401
 
14402
 
14403
 
14404
 
14405
        for(i = 0; i < len; i++){
14406
            c = cs[i];
14407
            if(!c.columnWidth){
14408
                pw -= (c.getSize().width + c.getEl().getMargins('lr'));
14409
            }
14410
        }
14411
 
14412
        pw = pw < 0 ? 0 : pw;
14413
 
14414
        for(i = 0; i < len; i++){
14415
            c = cs[i];
14416
            if(c.columnWidth){
14417
                c.setSize(Math.floor(c.columnWidth*pw) - c.getEl().getMargins('lr'));
14418
            }
14419
        }
14420
    }
14421
 
14422
 
14423
});
14424
 
14425
Ext.Container.LAYOUTS['column'] = Ext.layout.ColumnLayout;
14426
 
14427
Ext.layout.BorderLayout = Ext.extend(Ext.layout.ContainerLayout, {
14428
        monitorResize:true,
14429
        rendered : false,
14430
 
14431
        onLayout : function(ct, target){
14432
        var collapsed;
14433
        if(!this.rendered){
14434
            target.position();
14435
            target.addClass('x-border-layout-ct');
14436
            var items = ct.items.items;
14437
            collapsed = [];
14438
            for(var i = 0, len = items.length; i < len; i++) {
14439
                var c = items[i];
14440
                var pos = c.region;
14441
                if(c.collapsed){
14442
                    collapsed.push(c);
14443
                }
14444
                c.collapsed = false;
14445
                if(!c.rendered){
14446
                    c.cls = c.cls ? c.cls +' x-border-panel' : 'x-border-panel';
14447
                    c.render(target, i);
14448
                }
14449
                this[pos] = pos != 'center' && c.split ?
14450
                    new Ext.layout.BorderLayout.SplitRegion(this, c.initialConfig, pos) :
14451
                    new Ext.layout.BorderLayout.Region(this, c.initialConfig, pos);
14452
                this[pos].render(target, c);
14453
            }
14454
            this.rendered = true;
14455
        }
14456
 
14457
        var size = target.getViewSize();
14458
        if(size.width < 20 || size.height < 20){             if(collapsed){
14459
                this.restoreCollapsed = collapsed;
14460
            }
14461
            return;
14462
        }else if(this.restoreCollapsed){
14463
            collapsed = this.restoreCollapsed;
14464
            delete this.restoreCollapsed;
14465
        }
14466
 
14467
        var w = size.width, h = size.height;
14468
        var centerW = w, centerH = h, centerY = 0, centerX = 0;
14469
 
14470
        var n = this.north, s = this.south, west = this.west, e = this.east, c = this.center;
14471
        if(!c){
14472
            throw 'No center region defined in BorderLayout ' + ct.id;
14473
        }
14474
 
14475
        if(n && n.isVisible()){
14476
            var b = n.getSize();
14477
            var m = n.getMargins();
14478
            b.width = w - (m.left+m.right);
14479
            b.x = m.left;
14480
            b.y = m.top;
14481
            centerY = b.height + b.y + m.bottom;
14482
            centerH -= centerY;
14483
            n.applyLayout(b);
14484
        }
14485
        if(s && s.isVisible()){
14486
            var b = s.getSize();
14487
            var m = s.getMargins();
14488
            b.width = w - (m.left+m.right);
14489
            b.x = m.left;
14490
            var totalHeight = (b.height + m.top + m.bottom);
14491
            b.y = h - totalHeight + m.top;
14492
            centerH -= totalHeight;
14493
            s.applyLayout(b);
14494
        }
14495
        if(west && west.isVisible()){
14496
            var b = west.getSize();
14497
            var m = west.getMargins();
14498
            b.height = centerH - (m.top+m.bottom);
14499
            b.x = m.left;
14500
            b.y = centerY + m.top;
14501
            var totalWidth = (b.width + m.left + m.right);
14502
            centerX += totalWidth;
14503
            centerW -= totalWidth;
14504
            west.applyLayout(b);
14505
        }
14506
        if(e && e.isVisible()){
14507
            var b = e.getSize();
14508
            var m = e.getMargins();
14509
            b.height = centerH - (m.top+m.bottom);
14510
            var totalWidth = (b.width + m.left + m.right);
14511
            b.x = w - totalWidth + m.left;
14512
            b.y = centerY + m.top;
14513
            centerW -= totalWidth;
14514
            e.applyLayout(b);
14515
        }
14516
 
14517
        var m = c.getMargins();
14518
        var centerBox = {
14519
            x: centerX + m.left,
14520
            y: centerY + m.top,
14521
            width: centerW - (m.left+m.right),
14522
            height: centerH - (m.top+m.bottom)
14523
        };
14524
        c.applyLayout(centerBox);
14525
 
14526
        if(collapsed){
14527
            for(var i = 0, len = collapsed.length; i < len; i++){
14528
                collapsed[i].collapse(false);
14529
            }
14530
        }
14531
 
14532
        if(Ext.isIE && Ext.isStrict){             target.repaint();
14533
        }
14534
    }
14535
 
14536
 
14537
});
14538
 
14539
 
14540
Ext.layout.BorderLayout.Region = function(layout, config, pos){
14541
    Ext.apply(this, config);
14542
    this.layout = layout;
14543
    this.position = pos;
14544
    this.state = {};
14545
    if(typeof this.margins == 'string'){
14546
        this.margins = this.layout.parseMargins(this.margins);
14547
    }
14548
    this.margins = Ext.applyIf(this.margins || {}, this.defaultMargins);
14549
    if(this.collapsible){
14550
        if(typeof this.cmargins == 'string'){
14551
            this.cmargins = this.layout.parseMargins(this.cmargins);
14552
        }
14553
        if(this.collapseMode == 'mini' && !this.cmargins){
14554
            this.cmargins = {left:0,top:0,right:0,bottom:0};
14555
        }else{
14556
            this.cmargins = Ext.applyIf(this.cmargins || {},
14557
                pos == 'north' || pos == 'south' ? this.defaultNSCMargins : this.defaultEWCMargins);
14558
        }
14559
    }
14560
};
14561
 
14562
Ext.layout.BorderLayout.Region.prototype = {
14563
 
14564
 
14565
 
14566
 
14567
 
14568
 
14569
    collapsible : false,
14570
 
14571
    split:false,
14572
 
14573
    floatable: true,
14574
 
14575
    minWidth:50,
14576
 
14577
    minHeight:50,
14578
 
14579
        defaultMargins : {left:0,top:0,right:0,bottom:0},
14580
        defaultNSCMargins : {left:5,top:5,right:5,bottom:5},
14581
        defaultEWCMargins : {left:5,top:0,right:5,bottom:0},
14582
 
14583
 
14584
    isCollapsed : false,
14585
 
14586
 
14587
 
14588
 
14589
 
14590
        render : function(ct, p){
14591
        this.panel = p;
14592
        p.el.enableDisplayMode();
14593
        this.targetEl = ct;
14594
        this.el = p.el;
14595
 
14596
        var gs = p.getState, ps = this.position;
14597
        p.getState = function(){
14598
            return Ext.apply(gs.call(p) || {}, this.state);
14599
        }.createDelegate(this);
14600
 
14601
        if(ps != 'center'){
14602
            p.allowQueuedExpand = false;
14603
            p.on({
14604
                beforecollapse: this.beforeCollapse,
14605
                collapse: this.onCollapse,
14606
                beforeexpand: this.beforeExpand,
14607
                expand: this.onExpand,
14608
                hide: this.onHide,
14609
                show: this.onShow,
14610
                scope: this
14611
            });
14612
            if(this.collapsible){
14613
                p.collapseEl = 'el';
14614
                p.slideAnchor = this.getSlideAnchor();
14615
            }
14616
            if(p.tools && p.tools.toggle){
14617
                p.tools.toggle.addClass('x-tool-collapse-'+ps);
14618
                p.tools.toggle.addClassOnOver('x-tool-collapse-'+ps+'-over');
14619
            }
14620
        }
14621
    },
14622
 
14623
        getCollapsedEl : function(){
14624
        if(!this.collapsedEl){
14625
            if(!this.toolTemplate){
14626
                var tt = new Ext.Template(
14627
                     '<div class="x-tool x-tool-{id}">&#160;</div>'
14628
                );
14629
                tt.disableFormats = true;
14630
                tt.compile();
14631
                Ext.layout.BorderLayout.Region.prototype.toolTemplate = tt;
14632
            }
14633
            this.collapsedEl = this.targetEl.createChild({
14634
                cls: "x-layout-collapsed x-layout-collapsed-"+this.position,
14635
                id: this.panel.id + '-xcollapsed'
14636
            });
14637
            this.collapsedEl.enableDisplayMode('block');
14638
 
14639
            if(this.collapseMode == 'mini'){
14640
                this.collapsedEl.addClass('x-layout-cmini-'+this.position);
14641
                this.miniCollapsedEl = this.collapsedEl.createChild({
14642
                    cls: "x-layout-mini x-layout-mini-"+this.position, html: "&#160;"
14643
                });
14644
                this.miniCollapsedEl.addClassOnOver('x-layout-mini-over');
14645
                this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
14646
                this.collapsedEl.on('click', this.onExpandClick, this, {stopEvent:true});
14647
            }else {
14648
                var t = this.toolTemplate.append(
14649
                        this.collapsedEl.dom,
14650
                        {id:'expand-'+this.position}, true);
14651
                t.addClassOnOver('x-tool-expand-'+this.position+'-over');
14652
                t.on('click', this.onExpandClick, this, {stopEvent:true});
14653
 
14654
                if(this.floatable !== false){
14655
                   this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
14656
                   this.collapsedEl.on("click", this.collapseClick, this);
14657
                }
14658
            }
14659
        }
14660
        return this.collapsedEl;
14661
    },
14662
 
14663
        onExpandClick : function(e){
14664
        if(this.isSlid){
14665
            this.afterSlideIn();
14666
            this.panel.expand(false);
14667
        }else{
14668
            this.panel.expand();
14669
        }
14670
    },
14671
 
14672
        onCollapseClick : function(e){
14673
        this.panel.collapse();
14674
    },
14675
 
14676
        beforeCollapse : function(p, animate){
14677
        this.lastAnim = animate;
14678
        if(this.splitEl){
14679
            this.splitEl.hide();
14680
        }
14681
        this.getCollapsedEl().show();
14682
        this.panel.el.setStyle('z-index', 100);
14683
        this.isCollapsed = true;
14684
        this.layout.layout();
14685
    },
14686
 
14687
        onCollapse : function(animate){
14688
        this.panel.el.setStyle('z-index', 1);
14689
        if(this.lastAnim === false || this.panel.animCollapse === false){
14690
            this.getCollapsedEl().dom.style.visibility = 'visible';
14691
        }else{
14692
            this.getCollapsedEl().slideIn(this.panel.slideAnchor, {duration:.2});
14693
        }
14694
        this.state.collapsed = true;
14695
        this.panel.saveState();
14696
    },
14697
 
14698
        beforeExpand : function(animate){
14699
        var c = this.getCollapsedEl();
14700
        this.el.show();
14701
        if(this.position == 'east' || this.position == 'west'){
14702
            this.panel.setSize(undefined, c.getHeight());
14703
        }else{
14704
            this.panel.setSize(c.getWidth(), undefined);
14705
        }
14706
        c.hide();
14707
        c.dom.style.visibility = 'hidden';
14708
        this.panel.el.setStyle('z-index', 100);
14709
    },
14710
 
14711
        onExpand : function(){
14712
        this.isCollapsed = false;
14713
        if(this.splitEl){
14714
            this.splitEl.show();
14715
        }
14716
        this.layout.layout();
14717
        this.panel.el.setStyle('z-index', 1);
14718
        this.state.collapsed = false;
14719
        this.panel.saveState();
14720
    },
14721
 
14722
        collapseClick : function(e){
14723
        if(this.isSlid){
14724
           e.stopPropagation();
14725
           this.slideIn();
14726
        }else{
14727
           e.stopPropagation();
14728
           this.slideOut();
14729
        }
14730
    },
14731
 
14732
        onHide : function(){
14733
        if(this.isCollapsed){
14734
            this.getCollapsedEl().hide();
14735
        }else if(this.splitEl){
14736
            this.splitEl.hide();
14737
        }
14738
    },
14739
 
14740
        onShow : function(){
14741
        if(this.isCollapsed){
14742
            this.getCollapsedEl().show();
14743
        }else if(this.splitEl){
14744
            this.splitEl.show();
14745
        }
14746
    },
14747
 
14748
 
14749
    isVisible : function(){
14750
        return !this.panel.hidden;
14751
    },
14752
 
14753
 
14754
    getMargins : function(){
14755
        return this.isCollapsed && this.cmargins ? this.cmargins : this.margins;
14756
    },
14757
 
14758
 
14759
    getSize : function(){
14760
        return this.isCollapsed ? this.getCollapsedEl().getSize() : this.panel.getSize();
14761
    },
14762
 
14763
 
14764
    setPanel : function(panel){
14765
        this.panel = panel;
14766
    },
14767
 
14768
 
14769
    getMinWidth: function(){
14770
        return this.minWidth;
14771
    },
14772
 
14773
 
14774
    getMinHeight: function(){
14775
        return this.minHeight;
14776
    },
14777
 
14778
        applyLayoutCollapsed : function(box){
14779
        var ce = this.getCollapsedEl();
14780
        ce.setLeftTop(box.x, box.y);
14781
        ce.setSize(box.width, box.height);
14782
    },
14783
 
14784
        applyLayout : function(box){
14785
        if(this.isCollapsed){
14786
            this.applyLayoutCollapsed(box);
14787
        }else{
14788
            this.panel.setPosition(box.x, box.y);
14789
            this.panel.setSize(box.width, box.height);
14790
        }
14791
    },
14792
 
14793
        beforeSlide: function(){
14794
        this.panel.beforeEffect();
14795
    },
14796
 
14797
        afterSlide : function(){
14798
        this.panel.afterEffect();
14799
    },
14800
 
14801
        initAutoHide : function(){
14802
        if(this.autoHide !== false){
14803
            if(!this.autoHideHd){
14804
                var st = new Ext.util.DelayedTask(this.slideIn, this);
14805
                this.autoHideHd = {
14806
                    "mouseout": function(e){
14807
                        if(!e.within(this.el, true)){
14808
                            st.delay(500);
14809
                        }
14810
                    },
14811
                    "mouseover" : function(e){
14812
                        st.cancel();
14813
                    },
14814
                    scope : this
14815
                };
14816
            }
14817
            this.el.on(this.autoHideHd);
14818
        }
14819
    },
14820
 
14821
        clearAutoHide : function(){
14822
        if(this.autoHide !== false){
14823
            this.el.un("mouseout", this.autoHideHd.mouseout);
14824
            this.el.un("mouseover", this.autoHideHd.mouseover);
14825
        }
14826
    },
14827
 
14828
        clearMonitor : function(){
14829
        Ext.getDoc().un("click", this.slideInIf, this);
14830
    },
14831
 
14832
            slideOut : function(){
14833
        if(this.isSlid || this.el.hasActiveFx()){
14834
            return;
14835
        }
14836
        this.isSlid = true;
14837
        var ts = this.panel.tools;
14838
        if(ts && ts.toggle){
14839
            ts.toggle.hide();
14840
        }
14841
        this.el.show();
14842
        if(this.position == 'east' || this.position == 'west'){
14843
            this.panel.setSize(undefined, this.collapsedEl.getHeight());
14844
        }else{
14845
            this.panel.setSize(this.collapsedEl.getWidth(), undefined);
14846
        }
14847
        this.restoreLT = [this.el.dom.style.left, this.el.dom.style.top];
14848
        this.el.alignTo(this.collapsedEl, this.getCollapseAnchor());
14849
        this.el.setStyle("z-index", 102);
14850
        if(this.animFloat !== false){
14851
            this.beforeSlide();
14852
            this.el.slideIn(this.getSlideAnchor(), {
14853
                callback: function(){
14854
                    this.afterSlide();
14855
                    this.initAutoHide();
14856
                    Ext.getDoc().on("click", this.slideInIf, this);
14857
                },
14858
                scope: this,
14859
                block: true
14860
            });
14861
        }else{
14862
            this.initAutoHide();
14863
             Ext.getDoc().on("click", this.slideInIf, this);
14864
        }
14865
    },
14866
 
14867
        afterSlideIn : function(){
14868
        this.clearAutoHide();
14869
        this.isSlid = false;
14870
        this.clearMonitor();
14871
        this.el.setStyle("z-index", "");
14872
        this.el.dom.style.left = this.restoreLT[0];
14873
        this.el.dom.style.top = this.restoreLT[1];
14874
 
14875
        var ts = this.panel.tools;
14876
        if(ts && ts.toggle){
14877
            ts.toggle.show();
14878
        }
14879
    },
14880
 
14881
        slideIn : function(cb){
14882
        if(!this.isSlid || this.el.hasActiveFx()){
14883
            Ext.callback(cb);
14884
            return;
14885
        }
14886
        this.isSlid = false;
14887
        if(this.animFloat !== false){
14888
            this.beforeSlide();
14889
            this.el.slideOut(this.getSlideAnchor(), {
14890
                callback: function(){
14891
                    this.el.hide();
14892
                    this.afterSlide();
14893
                    this.afterSlideIn();
14894
                    Ext.callback(cb);
14895
                },
14896
                scope: this,
14897
                block: true
14898
            });
14899
        }else{
14900
            this.el.hide();
14901
            this.afterSlideIn();
14902
        }
14903
    },
14904
 
14905
        slideInIf : function(e){
14906
        if(!e.within(this.el)){
14907
            this.slideIn();
14908
        }
14909
    },
14910
 
14911
        anchors : {
14912
        "west" : "left",
14913
        "east" : "right",
14914
        "north" : "top",
14915
        "south" : "bottom"
14916
    },
14917
 
14918
        sanchors : {
14919
        "west" : "l",
14920
        "east" : "r",
14921
        "north" : "t",
14922
        "south" : "b"
14923
    },
14924
 
14925
        canchors : {
14926
        "west" : "tl-tr",
14927
        "east" : "tr-tl",
14928
        "north" : "tl-bl",
14929
        "south" : "bl-tl"
14930
    },
14931
 
14932
        getAnchor : function(){
14933
        return this.anchors[this.position];
14934
    },
14935
 
14936
        getCollapseAnchor : function(){
14937
        return this.canchors[this.position];
14938
    },
14939
 
14940
        getSlideAnchor : function(){
14941
        return this.sanchors[this.position];
14942
    },
14943
 
14944
        getAlignAdj : function(){
14945
        var cm = this.cmargins;
14946
        switch(this.position){
14947
            case "west":
14948
                return [0, 0];
14949
            break;
14950
            case "east":
14951
                return [0, 0];
14952
            break;
14953
            case "north":
14954
                return [0, 0];
14955
            break;
14956
            case "south":
14957
                return [0, 0];
14958
            break;
14959
        }
14960
    },
14961
 
14962
        getExpandAdj : function(){
14963
        var c = this.collapsedEl, cm = this.cmargins;
14964
        switch(this.position){
14965
            case "west":
14966
                return [-(cm.right+c.getWidth()+cm.left), 0];
14967
            break;
14968
            case "east":
14969
                return [cm.right+c.getWidth()+cm.left, 0];
14970
            break;
14971
            case "north":
14972
                return [0, -(cm.top+cm.bottom+c.getHeight())];
14973
            break;
14974
            case "south":
14975
                return [0, cm.top+cm.bottom+c.getHeight()];
14976
            break;
14977
        }
14978
    }
14979
};
14980
 
14981
 
14982
Ext.layout.BorderLayout.SplitRegion = function(layout, config, pos){
14983
    Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this, layout, config, pos);
14984
        this.applyLayout = this.applyFns[pos];
14985
};
14986
 
14987
Ext.extend(Ext.layout.BorderLayout.SplitRegion, Ext.layout.BorderLayout.Region, {
14988
 
14989
    splitTip : "Drag to resize.",
14990
 
14991
    collapsibleSplitTip : "Drag to resize. Double click to hide.",
14992
 
14993
    useSplitTips : false,
14994
 
14995
        splitSettings : {
14996
        north : {
14997
            orientation: Ext.SplitBar.VERTICAL,
14998
            placement: Ext.SplitBar.TOP,
14999
            maxFn : 'getVMaxSize',
15000
            minProp: 'minHeight',
15001
            maxProp: 'maxHeight'
15002
        },
15003
        south : {
15004
            orientation: Ext.SplitBar.VERTICAL,
15005
            placement: Ext.SplitBar.BOTTOM,
15006
            maxFn : 'getVMaxSize',
15007
            minProp: 'minHeight',
15008
            maxProp: 'maxHeight'
15009
        },
15010
        east : {
15011
            orientation: Ext.SplitBar.HORIZONTAL,
15012
            placement: Ext.SplitBar.RIGHT,
15013
            maxFn : 'getHMaxSize',
15014
            minProp: 'minWidth',
15015
            maxProp: 'maxWidth'
15016
        },
15017
        west : {
15018
            orientation: Ext.SplitBar.HORIZONTAL,
15019
            placement: Ext.SplitBar.LEFT,
15020
            maxFn : 'getHMaxSize',
15021
            minProp: 'minWidth',
15022
            maxProp: 'maxWidth'
15023
        }
15024
    },
15025
 
15026
        applyFns : {
15027
        west : function(box){
15028
            if(this.isCollapsed){
15029
                return this.applyLayoutCollapsed(box);
15030
            }
15031
            var sd = this.splitEl.dom, s = sd.style;
15032
            this.panel.setPosition(box.x, box.y);
15033
            var sw = sd.offsetWidth;
15034
            s.left = (box.x+box.width-sw)+'px';
15035
            s.top = (box.y)+'px';
15036
            s.height = Math.max(0, box.height)+'px';
15037
            this.panel.setSize(box.width-sw, box.height);
15038
        },
15039
        east : function(box){
15040
            if(this.isCollapsed){
15041
                return this.applyLayoutCollapsed(box);
15042
            }
15043
            var sd = this.splitEl.dom, s = sd.style;
15044
            var sw = sd.offsetWidth;
15045
            this.panel.setPosition(box.x+sw, box.y);
15046
            s.left = (box.x)+'px';
15047
            s.top = (box.y)+'px';
15048
            s.height = Math.max(0, box.height)+'px';
15049
            this.panel.setSize(box.width-sw, box.height);
15050
        },
15051
        north : function(box){
15052
            if(this.isCollapsed){
15053
                return this.applyLayoutCollapsed(box);
15054
            }
15055
            var sd = this.splitEl.dom, s = sd.style;
15056
            var sh = sd.offsetHeight;
15057
            this.panel.setPosition(box.x, box.y);
15058
            s.left = (box.x)+'px';
15059
            s.top = (box.y+box.height-sh)+'px';
15060
            s.width = Math.max(0, box.width)+'px';
15061
            this.panel.setSize(box.width, box.height-sh);
15062
        },
15063
        south : function(box){
15064
            if(this.isCollapsed){
15065
                return this.applyLayoutCollapsed(box);
15066
            }
15067
            var sd = this.splitEl.dom, s = sd.style;
15068
            var sh = sd.offsetHeight;
15069
            this.panel.setPosition(box.x, box.y+sh);
15070
            s.left = (box.x)+'px';
15071
            s.top = (box.y)+'px';
15072
            s.width = Math.max(0, box.width)+'px';
15073
            this.panel.setSize(box.width, box.height-sh);
15074
        }
15075
    },
15076
 
15077
        render : function(ct, p){
15078
        Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this, ct, p);
15079
 
15080
        var ps = this.position;
15081
 
15082
        this.splitEl = ct.createChild({
15083
            cls: "x-layout-split x-layout-split-"+ps, html: "&#160;",
15084
            id: this.panel.id + '-xsplit'
15085
        });
15086
 
15087
        if(this.collapseMode == 'mini'){
15088
            this.miniSplitEl = this.splitEl.createChild({
15089
                cls: "x-layout-mini x-layout-mini-"+ps, html: "&#160;"
15090
            });
15091
            this.miniSplitEl.addClassOnOver('x-layout-mini-over');
15092
            this.miniSplitEl.on('click', this.onCollapseClick, this, {stopEvent:true});
15093
        }
15094
 
15095
        var s = this.splitSettings[ps];
15096
 
15097
        this.split = new Ext.SplitBar(this.splitEl.dom, p.el, s.orientation);
15098
        this.split.placement = s.placement;
15099
        this.split.getMaximumSize = this[s.maxFn].createDelegate(this);
15100
        this.split.minSize = this.minSize || this[s.minProp];
15101
        this.split.on("beforeapply", this.onSplitMove, this);
15102
        this.split.useShim = this.useShim === true;
15103
        this.maxSize = this.maxSize || this[s.maxProp];
15104
 
15105
        if(p.hidden){
15106
            this.splitEl.hide();
15107
        }
15108
 
15109
        if(this.useSplitTips){
15110
            this.splitEl.dom.title = this.collapsible ? this.collapsibleSplitTip : this.splitTip;
15111
        }
15112
        if(this.collapsible){
15113
            this.splitEl.on("dblclick", this.onCollapseClick,  this);
15114
        }
15115
    },
15116
 
15117
        getSize : function(){
15118
        if(this.isCollapsed){
15119
            return this.collapsedEl.getSize();
15120
        }
15121
        var s = this.panel.getSize();
15122
        if(this.position == 'north' || this.position == 'south'){
15123
            s.height += this.splitEl.dom.offsetHeight;
15124
        }else{
15125
            s.width += this.splitEl.dom.offsetWidth;
15126
        }
15127
        return s;
15128
    },
15129
 
15130
        getHMaxSize : function(){
15131
         var cmax = this.maxSize || 10000;
15132
         var center = this.layout.center;
15133
         return Math.min(cmax, (this.el.getWidth()+center.el.getWidth())-center.getMinWidth());
15134
    },
15135
 
15136
        getVMaxSize : function(){
15137
        var cmax = this.maxSize || 10000;
15138
        var center = this.layout.center;
15139
        return Math.min(cmax, (this.el.getHeight()+center.el.getHeight())-center.getMinHeight());
15140
    },
15141
 
15142
        onSplitMove : function(split, newSize){
15143
        var s = this.panel.getSize();
15144
        this.lastSplitSize = newSize;
15145
        if(this.position == 'north' || this.position == 'south'){
15146
            this.panel.setSize(s.width, newSize);
15147
            this.state.height = newSize;
15148
        }else{
15149
            this.panel.setSize(newSize, s.height);
15150
            this.state.width = newSize;
15151
        }
15152
        this.layout.layout();
15153
        this.panel.saveState();
15154
        return false;
15155
    },
15156
 
15157
 
15158
    getSplitBar : function(){
15159
        return this.split;
15160
    }
15161
});
15162
 
15163
Ext.Container.LAYOUTS['border'] = Ext.layout.BorderLayout;
15164
 
15165
Ext.layout.FormLayout = Ext.extend(Ext.layout.AnchorLayout, {
15166
 
15167
 
15168
 
15169
    labelSeparator : ':',
15170
 
15171
        getAnchorViewSize : function(ct, target){
15172
        return ct.body.getStyleSize();
15173
    },
15174
 
15175
        setContainer : function(ct){
15176
        Ext.layout.FormLayout.superclass.setContainer.call(this, ct);
15177
 
15178
        if(ct.labelAlign){
15179
            ct.addClass('x-form-label-'+ct.labelAlign);
15180
        }
15181
 
15182
        if(ct.hideLabels){
15183
            this.labelStyle = "display:none";
15184
            this.elementStyle = "padding-left:0;";
15185
            this.labelAdjust = 0;
15186
        }else{
15187
            this.labelSeparator = ct.labelSeparator || this.labelSeparator;
15188
            ct.labelWidth = ct.labelWidth || 100;
15189
            if(typeof ct.labelWidth == 'number'){
15190
                var pad = (typeof ct.labelPad == 'number' ? ct.labelPad : 5);
15191
                this.labelAdjust = ct.labelWidth+pad;
15192
                this.labelStyle = "width:"+ct.labelWidth+"px;";
15193
                this.elementStyle = "padding-left:"+(ct.labelWidth+pad)+'px';
15194
            }
15195
            if(ct.labelAlign == 'top'){
15196
                this.labelStyle = "width:auto;";
15197
                this.labelAdjust = 0;
15198
                this.elementStyle = "padding-left:0;";
15199
            }
15200
        }
15201
 
15202
        if(!this.fieldTpl){
15203
                        var t = new Ext.Template(
15204
                '<div class="x-form-item {5}" tabIndex="-1">',
15205
                    '<label for="{0}" style="{2}" class="x-form-item-label">{1}{4}</label>',
15206
                    '<div class="x-form-element" id="x-form-el-{0}" style="{3}">',
15207
                    '</div><div class="{6}"></div>',
15208
                '</div>'
15209
            );
15210
            t.disableFormats = true;
15211
            t.compile();
15212
            Ext.layout.FormLayout.prototype.fieldTpl = t;
15213
        }
15214
    },
15215
 
15216
        renderItem : function(c, position, target){
15217
        if(c && !c.rendered && c.isFormField && c.inputType != 'hidden'){
15218
            var args = [
15219
                   c.id, c.fieldLabel,
15220
                   c.labelStyle||this.labelStyle||'',
15221
                   this.elementStyle||'',
15222
                   typeof c.labelSeparator == 'undefined' ? this.labelSeparator : c.labelSeparator,
15223
                   (c.itemCls||this.container.itemCls||'') + (c.hideLabel ? ' x-hide-label' : ''),
15224
                   c.clearCls || 'x-form-clear-left'
15225
            ];
15226
            if(typeof position == 'number'){
15227
                position = target.dom.childNodes[position] || null;
15228
            }
15229
            if(position){
15230
                this.fieldTpl.insertBefore(position, args);
15231
            }else{
15232
                this.fieldTpl.append(target, args);
15233
            }
15234
            c.render('x-form-el-'+c.id);
15235
        }else {
15236
            Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments);
15237
        }
15238
    },
15239
 
15240
        adjustWidthAnchor : function(value, comp){
15241
        return value - (comp.isFormField  ? (comp.hideLabel ? 0 : this.labelAdjust) : 0);
15242
    },
15243
 
15244
        isValidParent : function(c, target){
15245
        return true;
15246
    }
15247
 
15248
 
15249
});
15250
 
15251
Ext.Container.LAYOUTS['form'] = Ext.layout.FormLayout;
15252
 
15253
Ext.layout.Accordion = Ext.extend(Ext.layout.FitLayout, {
15254
 
15255
    fill : true,
15256
 
15257
    autoWidth : true,
15258
 
15259
    titleCollapse : true,
15260
 
15261
    hideCollapseTool : false,
15262
 
15263
    collapseFirst : false,
15264
 
15265
    animate : false,
15266
 
15267
    sequence : false,
15268
 
15269
    activeOnTop : false,
15270
 
15271
    renderItem : function(c){
15272
        if(this.animate === false){
15273
            c.animCollapse = false;
15274
        }
15275
        c.collapsible = true;
15276
        if(this.autoWidth){
15277
            c.autoWidth = true;
15278
        }
15279
        if(this.titleCollapse){
15280
            c.titleCollapse = true;
15281
        }
15282
        if(this.hideCollapseTool){
15283
            c.hideCollapseTool = true;
15284
        }
15285
        if(this.collapseFirst !== undefined){
15286
            c.collapseFirst = this.collapseFirst;
15287
        }
15288
        if(!this.activeItem && !c.collapsed){
15289
            this.activeItem = c;
15290
        }else if(this.activeItem){
15291
            c.collapsed = true;
15292
        }
15293
        Ext.layout.Accordion.superclass.renderItem.apply(this, arguments);
15294
        c.header.addClass('x-accordion-hd');
15295
        c.on('beforeexpand', this.beforeExpand, this);
15296
    },
15297
 
15298
 
15299
    beforeExpand : function(p, anim){
15300
        var ai = this.activeItem;
15301
        if(ai){
15302
            if(this.sequence){
15303
                delete this.activeItem;
15304
                ai.collapse({callback:function(){
15305
                    p.expand(anim || true);
15306
                }, scope: this});
15307
                return false;
15308
            }else{
15309
                ai.collapse(this.animate);
15310
            }
15311
        }
15312
        this.activeItem = p;
15313
        if(this.activeOnTop){
15314
            p.el.dom.parentNode.insertBefore(p.el.dom, p.el.dom.parentNode.firstChild);
15315
        }
15316
        this.layout();
15317
    },
15318
 
15319
 
15320
    setItemSize : function(item, size){
15321
        if(this.fill && item){
15322
            var items = this.container.items.items;
15323
            var hh = 0;
15324
            for(var i = 0, len = items.length; i < len; i++){
15325
                var p = items[i];
15326
                if(p != item){
15327
                    hh += (p.getSize().height - p.bwrap.getHeight());
15328
                }
15329
            }
15330
            size.height -= hh;
15331
            item.setSize(size);
15332
        }
15333
    }
15334
});
15335
Ext.Container.LAYOUTS['accordion'] = Ext.layout.Accordion;
15336
 
15337
Ext.layout.TableLayout = Ext.extend(Ext.layout.ContainerLayout, {
15338
 
15339
 
15340
 
15341
    monitorResize:false,
15342
 
15343
 
15344
    setContainer : function(ct){
15345
        Ext.layout.TableLayout.superclass.setContainer.call(this, ct);
15346
 
15347
        this.currentRow = 0;
15348
        this.currentColumn = 0;
15349
        this.cells = [];
15350
    },
15351
 
15352
 
15353
    onLayout : function(ct, target){
15354
        var cs = ct.items.items, len = cs.length, c, i;
15355
 
15356
        if(!this.table){
15357
            target.addClass('x-table-layout-ct');
15358
 
15359
            this.table = target.createChild(
15360
                {tag:'table', cls:'x-table-layout', cellspacing: 0, cn: {tag: 'tbody'}}, null, true);
15361
 
15362
            this.renderAll(ct, target);
15363
        }
15364
    },
15365
 
15366
 
15367
    getRow : function(index){
15368
        var row = this.table.tBodies[0].childNodes[index];
15369
        if(!row){
15370
            row = document.createElement('tr');
15371
            this.table.tBodies[0].appendChild(row);
15372
        }
15373
        return row;
15374
    },
15375
 
15376
 
15377
	getNextCell : function(c){
15378
		var cell = this.getNextNonSpan(this.currentColumn, this.currentRow);
15379
		var curCol = this.currentColumn = cell[0], curRow = this.currentRow = cell[1];
15380
		for(var rowIndex = curRow; rowIndex < curRow + (c.rowspan || 1); rowIndex++){
15381
			if(!this.cells[rowIndex]){
15382
				this.cells[rowIndex] = [];
15383
			}
15384
			for(var colIndex = curCol; colIndex < curCol + (c.colspan || 1); colIndex++){
15385
				this.cells[rowIndex][colIndex] = true;
15386
			}
15387
		}
15388
		var td = document.createElement('td');
15389
		if(c.cellId){
15390
			td.id = c.cellId;
15391
		}
15392
		var cls = 'x-table-layout-cell';
15393
		if(c.cellCls){
15394
			cls += ' ' + c.cellCls;
15395
		}
15396
		td.className = cls;
15397
		if(c.colspan){
15398
			td.colSpan = c.colspan;
15399
		}
15400
		if(c.rowspan){
15401
			td.rowSpan = c.rowspan;
15402
		}
15403
		this.getRow(curRow).appendChild(td);
15404
		return td;
15405
	},
15406
 
15407
 
15408
	getNextNonSpan: function(colIndex, rowIndex){
15409
		var cols = this.columns;
15410
		while((cols && colIndex >= cols) || (this.cells[rowIndex] && this.cells[rowIndex][colIndex])) {
15411
			if(cols && colIndex >= cols){
15412
				rowIndex++;
15413
				colIndex = 0;
15414
			}else{
15415
				colIndex++;
15416
			}
15417
		}
15418
		return [colIndex, rowIndex];
15419
	},
15420
 
15421
 
15422
    renderItem : function(c, position, target){
15423
        if(c && !c.rendered){
15424
            c.render(this.getNextCell(c));
15425
        }
15426
    },
15427
 
15428
 
15429
    isValidParent : function(c, target){
15430
        return true;
15431
    }
15432
 
15433
 
15434
});
15435
 
15436
Ext.Container.LAYOUTS['table'] = Ext.layout.TableLayout;
15437
 
15438
Ext.layout.AbsoluteLayout = Ext.extend(Ext.layout.AnchorLayout, {
15439
    extraCls: 'x-abs-layout-item',
15440
    isForm: false,
15441
 
15442
    setContainer : function(ct){
15443
        Ext.layout.AbsoluteLayout.superclass.setContainer.call(this, ct);
15444
        if(ct.isXType('form')){
15445
            this.isForm = true;
15446
        }
15447
    },
15448
 
15449
    onLayout : function(ct, target){
15450
        if(this.isForm){ ct.body.position(); } else { target.position(); }
15451
        Ext.layout.AbsoluteLayout.superclass.onLayout.call(this, ct, target);
15452
    },
15453
 
15454
 
15455
    getAnchorViewSize : function(ct, target){
15456
        return this.isForm ? ct.body.getStyleSize() : Ext.layout.AbsoluteLayout.superclass.getAnchorViewSize.call(this, ct, target);
15457
    },
15458
 
15459
 
15460
    isValidParent : function(c, target){
15461
        return this.isForm ? true : Ext.layout.AbsoluteLayout.superclass.isValidParent.call(this, c, target);
15462
    },
15463
 
15464
 
15465
    adjustWidthAnchor : function(value, comp){
15466
        return value ? value - comp.getPosition(true)[0] : value;
15467
    },
15468
 
15469
 
15470
    adjustHeightAnchor : function(value, comp){
15471
        return  value ? value - comp.getPosition(true)[1] : value;
15472
    }
15473
 
15474
});
15475
Ext.Container.LAYOUTS['absolute'] = Ext.layout.AbsoluteLayout;
15476
 
15477
Ext.Viewport = Ext.extend(Ext.Container, {
15478
 
15479
 
15480
 
15481
 
15482
 
15483
 
15484
 
15485
 
15486
 
15487
 
15488
 
15489
 
15490
    initComponent : function() {
15491
        Ext.Viewport.superclass.initComponent.call(this);
15492
        document.getElementsByTagName('html')[0].className += ' x-viewport';
15493
        this.el = Ext.getBody();
15494
        this.el.setHeight = Ext.emptyFn;
15495
        this.el.setWidth = Ext.emptyFn;
15496
        this.el.setSize = Ext.emptyFn;
15497
        this.el.dom.scroll = 'no';
15498
        this.allowDomMove = false;
15499
        this.autoWidth = true;
15500
        this.autoHeight = true;
15501
        Ext.EventManager.onWindowResize(this.fireResize, this);
15502
        this.renderTo = this.el;
15503
    },
15504
 
15505
    fireResize : function(w, h){
15506
        this.fireEvent('resize', this, w, h, w, h);
15507
    }
15508
});
15509
Ext.reg('viewport', Ext.Viewport);
15510
 
15511
Ext.Panel = Ext.extend(Ext.Container, {
15512
 
15513
 
15514
 
15515
 
15516
 
15517
 
15518
 
15519
 
15520
 
15521
 
15522
 
15523
 
15524
 
15525
 
15526
 
15527
 
15528
 
15529
 
15530
 
15531
 
15532
 
15533
 
15534
 
15535
 
15536
 
15537
 
15538
 
15539
 
15540
 
15541
 
15542
 
15543
 
15544
 
15545
    baseCls : 'x-panel',
15546
 
15547
    collapsedCls : 'x-panel-collapsed',
15548
 
15549
    maskDisabled: true,
15550
 
15551
    animCollapse: Ext.enableFx,
15552
 
15553
    headerAsText: true,
15554
 
15555
    buttonAlign: 'right',
15556
 
15557
    collapsed : false,
15558
 
15559
    collapseFirst: true,
15560
 
15561
    minButtonWidth:75,
15562
 
15563
    elements : 'body',
15564
 
15565
                toolTarget : 'header',
15566
    collapseEl : 'bwrap',
15567
    slideAnchor : 't',
15568
 
15569
        deferHeight: true,
15570
        expandDefaults: {
15571
        duration:.25
15572
    },
15573
        collapseDefaults: {
15574
        duration:.25
15575
    },
15576
 
15577
        initComponent : function(){
15578
        Ext.Panel.superclass.initComponent.call(this);
15579
 
15580
        this.addEvents(
15581
 
15582
            'bodyresize',
15583
 
15584
            'titlechange',
15585
 
15586
            'collapse',
15587
 
15588
            'expand',
15589
 
15590
            'beforecollapse',
15591
 
15592
            'beforeexpand',
15593
 
15594
            'beforeclose',
15595
 
15596
            'close',
15597
 
15598
            'activate',
15599
 
15600
            'deactivate'
15601
        );
15602
 
15603
                if(this.tbar){
15604
            this.elements += ',tbar';
15605
            if(typeof this.tbar == 'object'){
15606
                this.topToolbar = this.tbar;
15607
            }
15608
            delete this.tbar;
15609
        }
15610
        if(this.bbar){
15611
            this.elements += ',bbar';
15612
            if(typeof this.bbar == 'object'){
15613
                this.bottomToolbar = this.bbar;
15614
            }
15615
            delete this.bbar;
15616
        }
15617
 
15618
        if(this.header === true){
15619
            this.elements += ',header';
15620
            delete this.header;
15621
        }else if(this.title && this.header !== false){
15622
            this.elements += ',header';
15623
        }
15624
 
15625
        if(this.footer === true){
15626
            this.elements += ',footer';
15627
            delete this.footer;
15628
        }
15629
 
15630
        if(this.buttons){
15631
            var btns = this.buttons;
15632
 
15633
            this.buttons = [];
15634
            for(var i = 0, len = btns.length; i < len; i++) {
15635
                if(btns[i].render){                     this.buttons.push(btns[i]);
15636
                }else{
15637
                    this.addButton(btns[i]);
15638
                }
15639
            }
15640
        }
15641
        if(this.autoLoad){
15642
            this.on('render', this.doAutoLoad, this, {delay:10});
15643
        }
15644
    },
15645
 
15646
        createElement : function(name, pnode){
15647
        if(this[name]){
15648
            pnode.appendChild(this[name].dom);
15649
            return;
15650
        }
15651
 
15652
        if(name === 'bwrap' || this.elements.indexOf(name) != -1){
15653
            if(this[name+'Cfg']){
15654
                this[name] = Ext.fly(pnode).createChild(this[name+'Cfg']);
15655
            }else{
15656
                var el = document.createElement('div');
15657
                el.className = this[name+'Cls'];
15658
                this[name] = Ext.get(pnode.appendChild(el));
15659
            }
15660
        }
15661
    },
15662
 
15663
        onRender : function(ct, position){
15664
        Ext.Panel.superclass.onRender.call(this, ct, position);
15665
 
15666
        this.createClasses();
15667
 
15668
        if(this.el){             this.el.addClass(this.baseCls);
15669
            this.header = this.el.down('.'+this.headerCls);
15670
            this.bwrap = this.el.down('.'+this.bwrapCls);
15671
            var cp = this.bwrap ? this.bwrap : this.el;
15672
            this.tbar = cp.down('.'+this.tbarCls);
15673
            this.body = cp.down('.'+this.bodyCls);
15674
            this.bbar = cp.down('.'+this.bbarCls);
15675
            this.footer = cp.down('.'+this.footerCls);
15676
            this.fromMarkup = true;
15677
        }else{
15678
            this.el = ct.createChild({
15679
                id: this.id,
15680
                cls: this.baseCls
15681
            }, position);
15682
        }
15683
        var el = this.el, d = el.dom;
15684
 
15685
        if(this.cls){
15686
            this.el.addClass(this.cls);
15687
        }
15688
 
15689
        if(this.buttons){
15690
            this.elements += ',footer';
15691
        }
15692
 
15693
 
15694
                if(this.frame){
15695
            el.insertHtml('afterBegin', String.format(Ext.Element.boxMarkup, this.baseCls));
15696
 
15697
            this.createElement('header', d.firstChild.firstChild.firstChild);
15698
            this.createElement('bwrap', d);
15699
 
15700
                        var bw = this.bwrap.dom;
15701
            var ml = d.childNodes[1], bl = d.childNodes[2];
15702
            bw.appendChild(ml);
15703
            bw.appendChild(bl);
15704
 
15705
            var mc = bw.firstChild.firstChild.firstChild;
15706
            this.createElement('tbar', mc);
15707
            this.createElement('body', mc);
15708
            this.createElement('bbar', mc);
15709
            this.createElement('footer', bw.lastChild.firstChild.firstChild);
15710
 
15711
            if(!this.footer){
15712
                this.bwrap.dom.lastChild.className += ' x-panel-nofooter';
15713
            }
15714
        }else{
15715
            this.createElement('header', d);
15716
            this.createElement('bwrap', d);
15717
 
15718
                        var bw = this.bwrap.dom;
15719
            this.createElement('tbar', bw);
15720
            this.createElement('body', bw);
15721
            this.createElement('bbar', bw);
15722
            this.createElement('footer', bw);
15723
 
15724
            if(!this.header){
15725
                this.body.addClass(this.bodyCls + '-noheader');
15726
                if(this.tbar){
15727
                    this.tbar.addClass(this.tbarCls + '-noheader');
15728
                }
15729
            }
15730
        }
15731
 
15732
        if(this.border === false){
15733
            this.el.addClass(this.baseCls + '-noborder');
15734
            this.body.addClass(this.bodyCls + '-noborder');
15735
            if(this.header){
15736
                this.header.addClass(this.headerCls + '-noborder');
15737
            }
15738
            if(this.footer){
15739
                this.footer.addClass(this.footerCls + '-noborder');
15740
            }
15741
            if(this.tbar){
15742
                this.tbar.addClass(this.tbarCls + '-noborder');
15743
            }
15744
            if(this.bbar){
15745
                this.bbar.addClass(this.bbarCls + '-noborder');
15746
            }
15747
        }
15748
 
15749
        if(this.bodyBorder === false){
15750
           this.body.addClass(this.bodyCls + '-noborder');
15751
        }
15752
 
15753
        if(this.bodyStyle){
15754
           this.body.applyStyles(this.bodyStyle);
15755
        }
15756
 
15757
        this.bwrap.enableDisplayMode('block');
15758
 
15759
        if(this.header){
15760
            this.header.unselectable();
15761
 
15762
                        if(this.headerAsText){
15763
                this.header.dom.innerHTML =
15764
                    '<span class="' + this.headerTextCls + '">'+this.header.dom.innerHTML+'</span>';
15765
 
15766
                if(this.iconCls){
15767
                    this.setIconClass(this.iconCls);
15768
                }
15769
            }
15770
        }
15771
 
15772
        if(this.floating){
15773
            this.makeFloating(this.floating);
15774
        }
15775
 
15776
        if(this.collapsible){
15777
            this.tools = this.tools ? this.tools.slice(0) : [];
15778
            if(!this.hideCollapseTool){
15779
                this.tools[this.collapseFirst?'unshift':'push']({
15780
                    id: 'toggle',
15781
                    handler : this.toggleCollapse,
15782
                    scope: this
15783
                });
15784
            }
15785
            if(this.titleCollapse && this.header){
15786
                this.header.on('click', this.toggleCollapse, this);
15787
                this.header.setStyle('cursor', 'pointer');
15788
            }
15789
        }
15790
        if(this.tools){
15791
            var ts = this.tools;
15792
            this.tools = {};
15793
            this.addTool.apply(this, ts);
15794
        }else{
15795
            this.tools = {};
15796
        }
15797
 
15798
        if(this.buttons && this.buttons.length > 0){
15799
                        var tb = this.footer.createChild({cls:'x-panel-btns-ct', cn: {
15800
                cls:"x-panel-btns x-panel-btns-"+this.buttonAlign,
15801
                html:'<table cellspacing="0"><tbody><tr></tr></tbody></table><div class="x-clear"></div>'
15802
            }}, null, true);
15803
            var tr = tb.getElementsByTagName('tr')[0];
15804
            for(var i = 0, len = this.buttons.length; i < len; i++) {
15805
                var b = this.buttons[i];
15806
                var td = document.createElement('td');
15807
                td.className = 'x-panel-btn-td';
15808
                b.render(tr.appendChild(td));
15809
            }
15810
        }
15811
 
15812
        if(this.tbar && this.topToolbar){
15813
            if(Ext.isArray(this.topToolbar)){
15814
                this.topToolbar = new Ext.Toolbar(this.topToolbar);
15815
            }
15816
            this.topToolbar.render(this.tbar);
15817
        }
15818
        if(this.bbar && this.bottomToolbar){
15819
            if(Ext.isArray(this.bottomToolbar)){
15820
                this.bottomToolbar = new Ext.Toolbar(this.bottomToolbar);
15821
            }
15822
            this.bottomToolbar.render(this.bbar);
15823
        }
15824
    },
15825
 
15826
 
15827
    setIconClass : function(cls){
15828
        var old = this.iconCls;
15829
        this.iconCls = cls;
15830
        if(this.rendered && this.header){
15831
            if(this.frame){
15832
                this.header.addClass('x-panel-icon');
15833
                this.header.replaceClass(old, this.iconCls);
15834
            }else{
15835
                var hd = this.header.dom;
15836
                var img = hd.firstChild && String(hd.firstChild.tagName).toLowerCase() == 'img' ? hd.firstChild : null;
15837
                if(img){
15838
                    Ext.fly(img).replaceClass(old, this.iconCls);
15839
                }else{
15840
                    Ext.DomHelper.insertBefore(hd.firstChild, {
15841
                        tag:'img', src: Ext.BLANK_IMAGE_URL, cls:'x-panel-inline-icon '+this.iconCls
15842
                    });
15843
                 }
15844
            }
15845
        }
15846
    },
15847
 
15848
        makeFloating : function(cfg){
15849
        this.floating = true;
15850
        this.el = new Ext.Layer(
15851
            typeof cfg == 'object' ? cfg : {
15852
                shadow: this.shadow !== undefined ? this.shadow : 'sides',
15853
                shadowOffset: this.shadowOffset,
15854
                constrain:false,
15855
                shim: this.shim === false ? false : undefined
15856
            }, this.el
15857
        );
15858
    },
15859
 
15860
 
15861
    getTopToolbar : function(){
15862
        return this.topToolbar;
15863
    },
15864
 
15865
 
15866
    getBottomToolbar : function(){
15867
        return this.bottomToolbar;
15868
    },
15869
 
15870
 
15871
    addButton : function(config, handler, scope){
15872
        var bc = {
15873
            handler: handler,
15874
            scope: scope,
15875
            minWidth: this.minButtonWidth,
15876
            hideParent:true
15877
        };
15878
        if(typeof config == "string"){
15879
            bc.text = config;
15880
        }else{
15881
            Ext.apply(bc, config);
15882
        }
15883
        var btn = new Ext.Button(bc);
15884
        btn.ownerCt = this;
15885
        if(!this.buttons){
15886
            this.buttons = [];
15887
        }
15888
        this.buttons.push(btn);
15889
        return btn;
15890
    },
15891
 
15892
        addTool : function(){
15893
        if(!this[this.toolTarget]) {             return;
15894
        }
15895
        if(!this.toolTemplate){
15896
                        var tt = new Ext.Template(
15897
                 '<div class="x-tool x-tool-{id}">&#160;</div>'
15898
            );
15899
            tt.disableFormats = true;
15900
            tt.compile();
15901
            Ext.Panel.prototype.toolTemplate = tt;
15902
        }
15903
        for(var i = 0, a = arguments, len = a.length; i < len; i++) {
15904
            var tc = a[i], overCls = 'x-tool-'+tc.id+'-over';
15905
            var t = this.toolTemplate.insertFirst(this[this.toolTarget], tc, true);
15906
            this.tools[tc.id] = t;
15907
            t.enableDisplayMode('block');
15908
            t.on('click', this.createToolHandler(t, tc, overCls, this));
15909
            if(tc.on){
15910
                t.on(tc.on);
15911
            }
15912
            if(tc.hidden){
15913
                t.hide();
15914
            }
15915
            if(tc.qtip){
15916
                if(typeof tc.qtip == 'object'){
15917
                    Ext.QuickTips.register(Ext.apply({
15918
                          target: t.id
15919
                    }, tc.qtip));
15920
                } else {
15921
                    t.dom.qtip = tc.qtip;
15922
                }
15923
            }
15924
            t.addClassOnOver(overCls);
15925
        }
15926
    },
15927
 
15928
        onShow : function(){
15929
        if(this.floating){
15930
            return this.el.show();
15931
        }
15932
        Ext.Panel.superclass.onShow.call(this);
15933
    },
15934
 
15935
        onHide : function(){
15936
        if(this.floating){
15937
            return this.el.hide();
15938
        }
15939
        Ext.Panel.superclass.onHide.call(this);
15940
    },
15941
 
15942
        createToolHandler : function(t, tc, overCls, panel){
15943
        return function(e){
15944
            t.removeClass(overCls);
15945
            e.stopEvent();
15946
            if(tc.handler){
15947
                tc.handler.call(tc.scope || t, e, t, panel);
15948
            }
15949
        };
15950
    },
15951
 
15952
        afterRender : function(){
15953
        if(this.fromMarkup && this.height === undefined && !this.autoHeight){
15954
            this.height = this.el.getHeight();
15955
        }
15956
        if(this.floating && !this.hidden && !this.initHidden){
15957
            this.el.show();
15958
        }
15959
        if(this.title){
15960
            this.setTitle(this.title);
15961
        }
15962
		this.setAutoScroll();
15963
        if(this.html){
15964
            this.body.update(typeof this.html == 'object' ?
15965
                             Ext.DomHelper.markup(this.html) :
15966
                             this.html);
15967
            delete this.html;
15968
        }
15969
        if(this.contentEl){
15970
            var ce = Ext.getDom(this.contentEl);
15971
            Ext.fly(ce).removeClass(['x-hidden', 'x-hide-display']);
15972
            this.body.dom.appendChild(ce);
15973
        }
15974
        if(this.collapsed){
15975
            this.collapsed = false;
15976
            this.collapse(false);
15977
        }
15978
        Ext.Panel.superclass.afterRender.call(this);         this.initEvents();
15979
    },
15980
 
15981
        setAutoScroll : function(){
15982
        if(this.rendered && this.autoScroll){
15983
			this.body.setOverflow('auto');
15984
        }
15985
    },
15986
 
15987
        getKeyMap : function(){
15988
        if(!this.keyMap){
15989
            this.keyMap = new Ext.KeyMap(this.el, this.keys);
15990
        }
15991
        return this.keyMap;
15992
    },
15993
 
15994
        initEvents : function(){
15995
        if(this.keys){
15996
            this.getKeyMap();
15997
        }
15998
        if(this.draggable){
15999
            this.initDraggable();
16000
        }
16001
    },
16002
 
16003
        initDraggable : function(){
16004
        this.dd = new Ext.Panel.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable);
16005
    },
16006
 
16007
        beforeEffect : function(){
16008
        if(this.floating){
16009
            this.el.beforeAction();
16010
        }
16011
        this.el.addClass('x-panel-animated');
16012
    },
16013
 
16014
        afterEffect : function(){
16015
        this.syncShadow();
16016
        this.el.removeClass('x-panel-animated');
16017
    },
16018
 
16019
        createEffect : function(a, cb, scope){
16020
        var o = {
16021
            scope:scope,
16022
            block:true
16023
        };
16024
        if(a === true){
16025
            o.callback = cb;
16026
            return o;
16027
        }else if(!a.callback){
16028
            o.callback = cb;
16029
        }else {             o.callback = function(){
16030
                cb.call(scope);
16031
                Ext.callback(a.callback, a.scope);
16032
            };
16033
        }
16034
        return Ext.applyIf(o, a);
16035
    },
16036
 
16037
 
16038
    collapse : function(animate){
16039
        if(this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforecollapse', this, animate) === false){
16040
            return;
16041
        }
16042
        var doAnim = animate === true || (animate !== false && this.animCollapse);
16043
        this.beforeEffect();
16044
        this.onCollapse(doAnim, animate);
16045
        return this;
16046
    },
16047
 
16048
        onCollapse : function(doAnim, animArg){
16049
        if(doAnim){
16050
            this[this.collapseEl].slideOut(this.slideAnchor,
16051
                    Ext.apply(this.createEffect(animArg||true, this.afterCollapse, this),
16052
                        this.collapseDefaults));
16053
        }else{
16054
            this[this.collapseEl].hide();
16055
            this.afterCollapse();
16056
        }
16057
    },
16058
 
16059
        afterCollapse : function(){
16060
        this.collapsed = true;
16061
        this.el.addClass(this.collapsedCls);
16062
        this.afterEffect();
16063
        this.fireEvent('collapse', this);
16064
    },
16065
 
16066
 
16067
    expand : function(animate){
16068
        if(!this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforeexpand', this, animate) === false){
16069
            return;
16070
        }
16071
        var doAnim = animate === true || (animate !== false && this.animCollapse);
16072
        this.el.removeClass(this.collapsedCls);
16073
        this.beforeEffect();
16074
        this.onExpand(doAnim, animate);
16075
        return this;
16076
    },
16077
 
16078
        onExpand : function(doAnim, animArg){
16079
        if(doAnim){
16080
            this[this.collapseEl].slideIn(this.slideAnchor,
16081
                    Ext.apply(this.createEffect(animArg||true, this.afterExpand, this),
16082
                        this.expandDefaults));
16083
        }else{
16084
            this[this.collapseEl].show();
16085
            this.afterExpand();
16086
        }
16087
    },
16088
 
16089
        afterExpand : function(){
16090
        this.collapsed = false;
16091
        this.afterEffect();
16092
        this.fireEvent('expand', this);
16093
    },
16094
 
16095
 
16096
    toggleCollapse : function(animate){
16097
        this[this.collapsed ? 'expand' : 'collapse'](animate);
16098
        return this;
16099
    },
16100
 
16101
        onDisable : function(){
16102
        if(this.rendered && this.maskDisabled){
16103
            this.el.mask();
16104
        }
16105
        Ext.Panel.superclass.onDisable.call(this);
16106
    },
16107
 
16108
        onEnable : function(){
16109
        if(this.rendered && this.maskDisabled){
16110
            this.el.unmask();
16111
        }
16112
        Ext.Panel.superclass.onEnable.call(this);
16113
    },
16114
 
16115
        onResize : function(w, h){
16116
        if(w !== undefined || h !== undefined){
16117
            if(!this.collapsed){
16118
                if(typeof w == 'number'){
16119
                    this.body.setWidth(
16120
                            this.adjustBodyWidth(w - this.getFrameWidth()));
16121
                }else if(w == 'auto'){
16122
                    this.body.setWidth(w);
16123
                }
16124
 
16125
                if(typeof h == 'number'){
16126
                    this.body.setHeight(
16127
                            this.adjustBodyHeight(h - this.getFrameHeight()));
16128
                }else if(h == 'auto'){
16129
                    this.body.setHeight(h);
16130
                }
16131
            }else{
16132
                this.queuedBodySize = {width: w, height: h};
16133
                if(!this.queuedExpand && this.allowQueuedExpand !== false){
16134
                    this.queuedExpand = true;
16135
                    this.on('expand', function(){
16136
                        delete this.queuedExpand;
16137
                        this.onResize(this.queuedBodySize.width, this.queuedBodySize.height);
16138
                        this.doLayout();
16139
                    }, this, {single:true});
16140
                }
16141
            }
16142
            this.fireEvent('bodyresize', this, w, h);
16143
        }
16144
        this.syncShadow();
16145
    },
16146
 
16147
        adjustBodyHeight : function(h){
16148
        return h;
16149
    },
16150
 
16151
        adjustBodyWidth : function(w){
16152
        return w;
16153
    },
16154
 
16155
        onPosition : function(){
16156
        this.syncShadow();
16157
    },
16158
 
16159
        onDestroy : function(){
16160
        if(this.tools){
16161
            for(var k in this.tools){
16162
                Ext.destroy(this.tools[k]);
16163
            }
16164
        }
16165
        if(this.buttons){
16166
            for(var b in this.buttons){
16167
                Ext.destroy(this.buttons[b]);
16168
            }
16169
        }
16170
        Ext.destroy(
16171
            this.topToolbar,
16172
            this.bottomToolbar
16173
        );
16174
        Ext.Panel.superclass.onDestroy.call(this);
16175
    },
16176
 
16177
 
16178
    getFrameWidth : function(){
16179
        var w = this.el.getFrameWidth('lr');
16180
 
16181
        if(this.frame){
16182
            var l = this.bwrap.dom.firstChild;
16183
            w += (Ext.fly(l).getFrameWidth('l') + Ext.fly(l.firstChild).getFrameWidth('r'));
16184
            var mc = this.bwrap.dom.firstChild.firstChild.firstChild;
16185
            w += Ext.fly(mc).getFrameWidth('lr');
16186
        }
16187
        return w;
16188
    },
16189
 
16190
 
16191
    getFrameHeight : function(){
16192
        var h  = this.el.getFrameWidth('tb');
16193
        h += (this.tbar ? this.tbar.getHeight() : 0) +
16194
             (this.bbar ? this.bbar.getHeight() : 0);
16195
 
16196
        if(this.frame){
16197
            var hd = this.el.dom.firstChild;
16198
            var ft = this.bwrap.dom.lastChild;
16199
            h += (hd.offsetHeight + ft.offsetHeight);
16200
            var mc = this.bwrap.dom.firstChild.firstChild.firstChild;
16201
            h += Ext.fly(mc).getFrameWidth('tb');
16202
        }else{
16203
            h += (this.header ? this.header.getHeight() : 0) +
16204
                (this.footer ? this.footer.getHeight() : 0);
16205
        }
16206
        return h;
16207
    },
16208
 
16209
 
16210
    getInnerWidth : function(){
16211
        return this.getSize().width - this.getFrameWidth();
16212
    },
16213
 
16214
 
16215
    getInnerHeight : function(){
16216
        return this.getSize().height - this.getFrameHeight();
16217
    },
16218
 
16219
        syncShadow : function(){
16220
        if(this.floating){
16221
            this.el.sync(true);
16222
        }
16223
    },
16224
 
16225
        getLayoutTarget : function(){
16226
        return this.body;
16227
    },
16228
 
16229
 
16230
    setTitle : function(title, iconCls){
16231
        this.title = title;
16232
        if(this.header && this.headerAsText){
16233
            this.header.child('span').update(title);
16234
        }
16235
        if(iconCls){
16236
            this.setIconClass(iconCls);
16237
        }
16238
        this.fireEvent('titlechange', this, title);
16239
        return this;
16240
    },
16241
 
16242
 
16243
    getUpdater : function(){
16244
        return this.body.getUpdater();
16245
    },
16246
 
16247
 
16248
    load : function(){
16249
        var um = this.body.getUpdater();
16250
        um.update.apply(um, arguments);
16251
        return this;
16252
    },
16253
 
16254
        beforeDestroy : function(){
16255
        Ext.Element.uncache(
16256
            this.header,
16257
            this.tbar,
16258
            this.bbar,
16259
            this.footer,
16260
            this.body
16261
        );
16262
    },
16263
 
16264
        createClasses : function(){
16265
        this.headerCls = this.baseCls + '-header';
16266
        this.headerTextCls = this.baseCls + '-header-text';
16267
        this.bwrapCls = this.baseCls + '-bwrap';
16268
        this.tbarCls = this.baseCls + '-tbar';
16269
        this.bodyCls = this.baseCls + '-body';
16270
        this.bbarCls = this.baseCls + '-bbar';
16271
        this.footerCls = this.baseCls + '-footer';
16272
    },
16273
 
16274
        createGhost : function(cls, useShim, appendTo){
16275
        var el = document.createElement('div');
16276
        el.className = 'x-panel-ghost ' + (cls ? cls : '');
16277
        if(this.header){
16278
            el.appendChild(this.el.dom.firstChild.cloneNode(true));
16279
        }
16280
        Ext.fly(el.appendChild(document.createElement('ul'))).setHeight(this.bwrap.getHeight());
16281
        el.style.width = this.el.dom.offsetWidth + 'px';;
16282
        if(!appendTo){
16283
            this.container.dom.appendChild(el);
16284
        }else{
16285
            Ext.getDom(appendTo).appendChild(el);
16286
        }
16287
        if(useShim !== false && this.el.useShim !== false){
16288
            var layer = new Ext.Layer({shadow:false, useDisplay:true, constrain:false}, el);
16289
            layer.show();
16290
            return layer;
16291
        }else{
16292
            return new Ext.Element(el);
16293
        }
16294
    },
16295
 
16296
        doAutoLoad : function(){
16297
        this.body.load(
16298
            typeof this.autoLoad == 'object' ?
16299
                this.autoLoad : {url: this.autoLoad});
16300
    }
16301
 
16302
 
16303
});
16304
Ext.reg('panel', Ext.Panel);
16305
 
16306
 
16307
Ext.Window = Ext.extend(Ext.Panel, {
16308
 
16309
 
16310
 
16311
 
16312
 
16313
 
16314
 
16315
    baseCls : 'x-window',
16316
 
16317
    resizable:true,
16318
 
16319
    draggable:true,
16320
 
16321
    closable : true,
16322
 
16323
    constrain:false,
16324
 
16325
    constrainHeader:false,
16326
 
16327
    plain:false,
16328
 
16329
    minimizable : false,
16330
 
16331
    maximizable : false,
16332
 
16333
    minHeight: 100,
16334
 
16335
    minWidth: 200,
16336
 
16337
    expandOnShow: true,
16338
 
16339
    closeAction: 'close',
16340
 
16341
        collapsible:false,
16342
 
16343
        initHidden : true,
16344
 
16345
    monitorResize : true,
16346
 
16347
 
16348
    elements: 'header,body',
16349
 
16350
    frame:true,
16351
 
16352
    floating:true,
16353
 
16354
        initComponent : function(){
16355
        Ext.Window.superclass.initComponent.call(this);
16356
        this.addEvents(
16357
 
16358
 
16359
 
16360
            'resize',
16361
 
16362
            'maximize',
16363
 
16364
            'minimize',
16365
 
16366
            'restore'
16367
        );
16368
    },
16369
 
16370
        getState : function(){
16371
        return Ext.apply(Ext.Window.superclass.getState.call(this) || {}, this.getBox());
16372
    },
16373
 
16374
        onRender : function(ct, position){
16375
        Ext.Window.superclass.onRender.call(this, ct, position);
16376
 
16377
        if(this.plain){
16378
            this.el.addClass('x-window-plain');
16379
        }
16380
 
16381
                this.focusEl = this.el.createChild({
16382
                    tag: "a", href:"#", cls:"x-dlg-focus",
16383
                    tabIndex:"-1", html: "&#160;"});
16384
        this.focusEl.swallowEvent('click', true);
16385
 
16386
        this.proxy = this.el.createProxy("x-window-proxy");
16387
        this.proxy.enableDisplayMode('block');
16388
 
16389
        if(this.modal){
16390
            this.mask = this.container.createChild({cls:"ext-el-mask"}, this.el.dom);
16391
            this.mask.enableDisplayMode("block");
16392
            this.mask.hide();
16393
        }
16394
    },
16395
 
16396
        initEvents : function(){
16397
        Ext.Window.superclass.initEvents.call(this);
16398
        if(this.animateTarget){
16399
            this.setAnimateTarget(this.animateTarget);
16400
        }
16401
 
16402
        if(this.resizable){
16403
            this.resizer = new Ext.Resizable(this.el, {
16404
                minWidth: this.minWidth,
16405
                minHeight:this.minHeight,
16406
                handles: this.resizeHandles || "all",
16407
                pinned: true,
16408
                resizeElement : this.resizerAction
16409
            });
16410
            this.resizer.window = this;
16411
            this.resizer.on("beforeresize", this.beforeResize, this);
16412
        }
16413
 
16414
        if(this.draggable){
16415
            this.header.addClass("x-window-draggable");
16416
        }
16417
        this.initTools();
16418
 
16419
        this.el.on("mousedown", this.toFront, this);
16420
        this.manager = this.manager || Ext.WindowMgr;
16421
        this.manager.register(this);
16422
        this.hidden = true;
16423
        if(this.maximized){
16424
            this.maximized = false;
16425
            this.maximize();
16426
        }
16427
        if(this.closable){
16428
            var km = this.getKeyMap();
16429
            km.on(27, this.onEsc, this);
16430
            km.disable();
16431
        }
16432
    },
16433
 
16434
    initDraggable : function(){
16435
        this.dd = new Ext.Window.DD(this);
16436
    },
16437
 
16438
       onEsc : function(){
16439
        this[this.closeAction]();
16440
    },
16441
 
16442
        beforeDestroy : function(){
16443
        Ext.destroy(
16444
            this.resizer,
16445
            this.dd,
16446
            this.proxy,
16447
            this.mask
16448
        );
16449
        Ext.Window.superclass.beforeDestroy.call(this);
16450
    },
16451
 
16452
        onDestroy : function(){
16453
        if(this.manager){
16454
            this.manager.unregister(this);
16455
        }
16456
        Ext.Window.superclass.onDestroy.call(this);
16457
    },
16458
 
16459
        initTools : function(){
16460
        if(this.minimizable){
16461
            this.addTool({
16462
                id: 'minimize',
16463
                handler: this.minimize.createDelegate(this, [])
16464
            });
16465
        }
16466
        if(this.maximizable){
16467
            this.addTool({
16468
                id: 'maximize',
16469
                handler: this.maximize.createDelegate(this, [])
16470
            });
16471
            this.addTool({
16472
                id: 'restore',
16473
                handler: this.restore.createDelegate(this, []),
16474
                hidden:true
16475
            });
16476
            this.header.on('dblclick', this.toggleMaximize, this);
16477
        }
16478
        if(this.closable){
16479
            this.addTool({
16480
                id: 'close',
16481
                handler: this[this.closeAction].createDelegate(this, [])
16482
            });
16483
        }
16484
    },
16485
 
16486
        resizerAction : function(){
16487
        var box = this.proxy.getBox();
16488
        this.proxy.hide();
16489
        this.window.handleResize(box);
16490
        return box;
16491
    },
16492
 
16493
        beforeResize : function(){
16494
        this.resizer.minHeight = Math.max(this.minHeight, this.getFrameHeight() + 40);         this.resizer.minWidth = Math.max(this.minWidth, this.getFrameWidth() + 40);
16495
        this.resizeBox = this.el.getBox();
16496
    },
16497
 
16498
        updateHandles : function(){
16499
        if(Ext.isIE && this.resizer){
16500
            this.resizer.syncHandleHeight();
16501
            this.el.repaint();
16502
        }
16503
    },
16504
 
16505
        handleResize : function(box){
16506
        var rz = this.resizeBox;
16507
        if(rz.x != box.x || rz.y != box.y){
16508
            this.updateBox(box);
16509
        }else{
16510
            this.setSize(box);
16511
        }
16512
        this.focus();
16513
        this.updateHandles();
16514
        this.saveState();
16515
        this.fireEvent("resize", this, box.width, box.height);
16516
    },
16517
 
16518
 
16519
    focus : function(){
16520
        var f = this.focusEl, db = this.defaultButton, t = typeof db;
16521
        if(t != 'undefined'){
16522
            if(t == 'number'){
16523
                f = this.buttons[db];
16524
            }else if(t == 'string'){
16525
                f = Ext.getCmp(db);
16526
            }else{
16527
                f = db;
16528
            }
16529
        }
16530
        f.focus.defer(10, f);
16531
    },
16532
 
16533
 
16534
    setAnimateTarget : function(el){
16535
        el = Ext.get(el);
16536
        this.animateTarget = el;
16537
    },
16538
 
16539
        beforeShow : function(){
16540
        delete this.el.lastXY;
16541
        delete this.el.lastLT;
16542
        if(this.x === undefined || this.y === undefined){
16543
            var xy = this.el.getAlignToXY(this.container, 'c-c');
16544
            var pos = this.el.translatePoints(xy[0], xy[1]);
16545
            this.x = this.x === undefined? pos.left : this.x;
16546
            this.y = this.y === undefined? pos.top : this.y;
16547
        }
16548
        this.el.setLeftTop(this.x, this.y);
16549
 
16550
        if(this.expandOnShow){
16551
            this.expand(false);
16552
        }
16553
 
16554
        if(this.modal){
16555
            Ext.getBody().addClass("x-body-masked");
16556
            this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
16557
            this.mask.show();
16558
        }
16559
    },
16560
 
16561
 
16562
    show : function(animateTarget, cb, scope){
16563
        if(!this.rendered){
16564
            this.render(Ext.getBody());
16565
        }
16566
        if(this.hidden === false){
16567
            this.toFront();
16568
            return;
16569
        }
16570
        if(this.fireEvent("beforeshow", this) === false){
16571
            return;
16572
        }
16573
        if(cb){
16574
            this.on('show', cb, scope, {single:true});
16575
        }
16576
        this.hidden = false;
16577
        if(animateTarget !== undefined){
16578
            this.setAnimateTarget(animateTarget);
16579
        }
16580
        this.beforeShow();
16581
        if(this.animateTarget){
16582
            this.animShow();
16583
        }else{
16584
            this.afterShow();
16585
        }
16586
    },
16587
 
16588
        afterShow : function(){
16589
        this.proxy.hide();
16590
        this.el.setStyle('display', 'block');
16591
        this.el.show();
16592
        if(this.maximized){
16593
            this.fitContainer();
16594
        }
16595
        if(Ext.isMac && Ext.isGecko){         	this.cascade(this.setAutoScroll);
16596
        }
16597
 
16598
        if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
16599
            Ext.EventManager.onWindowResize(this.onWindowResize, this);
16600
        }
16601
        this.doConstrain();
16602
        if(this.layout){
16603
            this.doLayout();
16604
        }
16605
        if(this.keyMap){
16606
            this.keyMap.enable();
16607
        }
16608
        this.toFront();
16609
        this.updateHandles();
16610
        this.fireEvent("show", this);
16611
    },
16612
 
16613
        animShow : function(){
16614
        this.proxy.show();
16615
        this.proxy.setBox(this.animateTarget.getBox());
16616
        this.proxy.setOpacity(0);
16617
        var b = this.getBox(false);
16618
        b.callback = this.afterShow;
16619
        b.scope = this;
16620
        b.duration = .25;
16621
        b.easing = 'easeNone';
16622
        b.opacity = .5;
16623
        b.block = true;
16624
        this.el.setStyle('display', 'none');
16625
        this.proxy.shift(b);
16626
    },
16627
 
16628
 
16629
    hide : function(animateTarget, cb, scope){
16630
        if(this.hidden || this.fireEvent("beforehide", this) === false){
16631
            return;
16632
        }
16633
        if(cb){
16634
            this.on('hide', cb, scope, {single:true});
16635
        }
16636
        this.hidden = true;
16637
        if(animateTarget !== undefined){
16638
            this.setAnimateTarget(animateTarget);
16639
        }
16640
        if(this.animateTarget){
16641
            this.animHide();
16642
        }else{
16643
            this.el.hide();
16644
            this.afterHide();
16645
        }
16646
    },
16647
 
16648
        afterHide : function(){
16649
        this.proxy.hide();
16650
        if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
16651
            Ext.EventManager.removeResizeListener(this.onWindowResize, this);
16652
        }
16653
        if(this.modal){
16654
            this.mask.hide();
16655
            Ext.getBody().removeClass("x-body-masked");
16656
        }
16657
        if(this.keyMap){
16658
            this.keyMap.disable();
16659
        }
16660
        this.fireEvent("hide", this);
16661
    },
16662
 
16663
        animHide : function(){
16664
        this.proxy.setOpacity(.5);
16665
        this.proxy.show();
16666
        var tb = this.getBox(false);
16667
        this.proxy.setBox(tb);
16668
        this.el.hide();
16669
        var b = this.animateTarget.getBox();
16670
        b.callback = this.afterHide;
16671
        b.scope = this;
16672
        b.duration = .25;
16673
        b.easing = 'easeNone';
16674
        b.block = true;
16675
        b.opacity = 0;
16676
        this.proxy.shift(b);
16677
    },
16678
 
16679
        onWindowResize : function(){
16680
        if(this.maximized){
16681
            this.fitContainer();
16682
        }
16683
        if(this.modal){
16684
            this.mask.setSize('100%', '100%');
16685
            var force = this.mask.dom.offsetHeight;
16686
            this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
16687
        }
16688
        this.doConstrain();
16689
    },
16690
 
16691
        doConstrain : function(){
16692
        if(this.constrain || this.constrainHeader){
16693
            var offsets;
16694
            if(this.constrain){
16695
                offsets = {
16696
                    right:this.el.shadowOffset,
16697
                    left:this.el.shadowOffset,
16698
                    bottom:this.el.shadowOffset
16699
                };
16700
            }else {
16701
                var s = this.getSize();
16702
                offsets = {
16703
                    right:-(s.width - 100),
16704
                    bottom:-(s.height - 25)
16705
                };
16706
            }
16707
 
16708
            var xy = this.el.getConstrainToXY(this.container, true, offsets);
16709
            if(xy){
16710
                this.setPosition(xy[0], xy[1]);
16711
            }
16712
        }
16713
    },
16714
 
16715
        ghost : function(cls){
16716
        var ghost = this.createGhost(cls);
16717
        var box = this.getBox(true);
16718
        ghost.setLeftTop(box.x, box.y);
16719
        ghost.setWidth(box.width);
16720
        this.el.hide();
16721
        this.activeGhost = ghost;
16722
        return ghost;
16723
    },
16724
 
16725
        unghost : function(show, matchPosition){
16726
        if(show !== false){
16727
            this.el.show();
16728
            this.focus();
16729
	        if(Ext.isMac && Ext.isGecko){ 	        	this.cascade(this.setAutoScroll);
16730
	        }
16731
        }
16732
        if(matchPosition !== false){
16733
            this.setPosition(this.activeGhost.getLeft(true), this.activeGhost.getTop(true));
16734
        }
16735
        this.activeGhost.hide();
16736
        this.activeGhost.remove();
16737
        delete this.activeGhost;
16738
    },
16739
 
16740
 
16741
    minimize : function(){
16742
        this.fireEvent('minimize', this);
16743
    },
16744
 
16745
 
16746
    close : function(){
16747
        if(this.fireEvent("beforeclose", this) !== false){
16748
            this.hide(null, function(){
16749
                this.fireEvent('close', this);
16750
                this.destroy();
16751
            }, this);
16752
        }
16753
    },
16754
 
16755
 
16756
    maximize : function(){
16757
        if(!this.maximized){
16758
            this.expand(false);
16759
            this.restoreSize = this.getSize();
16760
            this.restorePos = this.getPosition(true);
16761
            this.tools.maximize.hide();
16762
            this.tools.restore.show();
16763
            this.maximized = true;
16764
            this.el.disableShadow();
16765
 
16766
            if(this.dd){
16767
                this.dd.lock();
16768
            }
16769
            if(this.collapsible){
16770
                this.tools.toggle.hide();
16771
            }
16772
            this.el.addClass('x-window-maximized');
16773
            this.container.addClass('x-window-maximized-ct');
16774
 
16775
            this.setPosition(0, 0);
16776
            this.fitContainer();
16777
            this.fireEvent('maximize', this);
16778
        }
16779
    },
16780
 
16781
 
16782
    restore : function(){
16783
        if(this.maximized){
16784
            this.el.removeClass('x-window-maximized');
16785
            this.tools.restore.hide();
16786
            this.tools.maximize.show();
16787
            this.setPosition(this.restorePos[0], this.restorePos[1]);
16788
            this.setSize(this.restoreSize.width, this.restoreSize.height);
16789
            delete this.restorePos;
16790
            delete this.restoreSize;
16791
            this.maximized = false;
16792
            this.el.enableShadow(true);
16793
 
16794
            if(this.dd){
16795
                this.dd.unlock();
16796
            }
16797
            if(this.collapsible){
16798
                this.tools.toggle.show();
16799
            }
16800
            this.container.removeClass('x-window-maximized-ct');
16801
 
16802
            this.doConstrain();
16803
            this.fireEvent('restore', this);
16804
        }
16805
    },
16806
 
16807
 
16808
    toggleMaximize : function(){
16809
        this[this.maximized ? 'restore' : 'maximize']();
16810
    },
16811
 
16812
        fitContainer : function(){
16813
        var vs = this.container.getViewSize();
16814
        this.setSize(vs.width, vs.height);
16815
    },
16816
 
16817
            setZIndex : function(index){
16818
        if(this.modal){
16819
            this.mask.setStyle("z-index", index);
16820
        }
16821
        this.el.setZIndex(++index);
16822
        index += 5;
16823
 
16824
        if(this.resizer){
16825
            this.resizer.proxy.setStyle("z-index", ++index);
16826
        }
16827
 
16828
        this.lastZIndex = index;
16829
    },
16830
 
16831
 
16832
    alignTo : function(element, position, offsets){
16833
        var xy = this.el.getAlignToXY(element, position, offsets);
16834
        this.setPagePosition(xy[0], xy[1]);
16835
        return this;
16836
    },
16837
 
16838
 
16839
    anchorTo : function(el, alignment, offsets, monitorScroll, _pname){
16840
        var action = function(){
16841
            this.alignTo(el, alignment, offsets);
16842
        };
16843
        Ext.EventManager.onWindowResize(action, this);
16844
        var tm = typeof monitorScroll;
16845
        if(tm != 'undefined'){
16846
            Ext.EventManager.on(window, 'scroll', action, this,
16847
                {buffer: tm == 'number' ? monitorScroll : 50});
16848
        }
16849
        action.call(this);
16850
        this[_pname] = action;
16851
        return this;
16852
    },
16853
 
16854
 
16855
    toFront : function(){
16856
        if(this.manager.bringToFront(this)){
16857
            this.focus();
16858
        }
16859
        return this;
16860
    },
16861
 
16862
 
16863
    setActive : function(active){
16864
        if(active){
16865
            if(!this.maximized){
16866
                this.el.enableShadow(true);
16867
            }
16868
            this.fireEvent('activate', this);
16869
        }else{
16870
            this.el.disableShadow();
16871
            this.fireEvent('deactivate', this);
16872
        }
16873
    },
16874
 
16875
 
16876
    toBack : function(){
16877
        this.manager.sendToBack(this);
16878
        return this;
16879
    },
16880
 
16881
 
16882
    center : function(){
16883
        var xy = this.el.getAlignToXY(this.container, 'c-c');
16884
        this.setPagePosition(xy[0], xy[1]);
16885
        return this;
16886
    }
16887
});
16888
Ext.reg('window', Ext.Window);
16889
 
16890
Ext.Window.DD = function(win){
16891
    this.win = win;
16892
    Ext.Window.DD.superclass.constructor.call(this, win.el.id, 'WindowDD-'+win.id);
16893
    this.setHandleElId(win.header.id);
16894
    this.scroll = false;
16895
};
16896
 
16897
Ext.extend(Ext.Window.DD, Ext.dd.DD, {
16898
    moveOnly:true,
16899
    headerOffsets:[100, 25],
16900
    startDrag : function(){
16901
        var w = this.win;
16902
        this.proxy = w.ghost();
16903
        if(w.constrain !== false){
16904
            var so = w.el.shadowOffset;
16905
            this.constrainTo(w.container, {right: so, left: so, bottom: so});
16906
        }else if(w.constrainHeader !== false){
16907
            var s = this.proxy.getSize();
16908
            this.constrainTo(w.container, {right: -(s.width-this.headerOffsets[0]), bottom: -(s.height-this.headerOffsets[1])});
16909
        }
16910
    },
16911
    b4Drag : Ext.emptyFn,
16912
 
16913
    onDrag : function(e){
16914
        this.alignElWithMouse(this.proxy, e.getPageX(), e.getPageY());
16915
    },
16916
 
16917
    endDrag : function(e){
16918
        this.win.unghost();
16919
        this.win.saveState();
16920
    }
16921
});
16922
 
16923
Ext.WindowGroup = function(){
16924
    var list = {};
16925
    var accessList = [];
16926
    var front = null;
16927
 
16928
        var sortWindows = function(d1, d2){
16929
        return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1;
16930
    };
16931
 
16932
        var orderWindows = function(){
16933
        var a = accessList, len = a.length;
16934
        if(len > 0){
16935
            a.sort(sortWindows);
16936
            var seed = a[0].manager.zseed;
16937
            for(var i = 0; i < len; i++){
16938
                var win = a[i];
16939
                if(win && !win.hidden){
16940
                    win.setZIndex(seed + (i*10));
16941
                }
16942
            }
16943
        }
16944
        activateLast();
16945
    };
16946
 
16947
        var setActiveWin = function(win){
16948
        if(win != front){
16949
            if(front){
16950
                front.setActive(false);
16951
            }
16952
            front = win;
16953
            if(win){
16954
                win.setActive(true);
16955
            }
16956
        }
16957
    };
16958
 
16959
        var activateLast = function(){
16960
        for(var i = accessList.length-1; i >=0; --i) {
16961
            if(!accessList[i].hidden){
16962
                setActiveWin(accessList[i]);
16963
                return;
16964
            }
16965
        }
16966
                setActiveWin(null);
16967
    };
16968
 
16969
    return {
16970
 
16971
        zseed : 9000,
16972
 
16973
                register : function(win){
16974
            list[win.id] = win;
16975
            accessList.push(win);
16976
            win.on('hide', activateLast);
16977
        },
16978
 
16979
                unregister : function(win){
16980
            delete list[win.id];
16981
            win.un('hide', activateLast);
16982
            accessList.remove(win);
16983
        },
16984
 
16985
 
16986
        get : function(id){
16987
            return typeof id == "object" ? id : list[id];
16988
        },
16989
 
16990
 
16991
        bringToFront : function(win){
16992
            win = this.get(win);
16993
            if(win != front){
16994
                win._lastAccess = new Date().getTime();
16995
                orderWindows();
16996
                return true;
16997
            }
16998
            return false;
16999
        },
17000
 
17001
 
17002
        sendToBack : function(win){
17003
            win = this.get(win);
17004
            win._lastAccess = -(new Date().getTime());
17005
            orderWindows();
17006
            return win;
17007
        },
17008
 
17009
 
17010
        hideAll : function(){
17011
            for(var id in list){
17012
                if(list[id] && typeof list[id] != "function" && list[id].isVisible()){
17013
                    list[id].hide();
17014
                }
17015
            }
17016
        },
17017
 
17018
 
17019
        getActive : function(){
17020
            return front;
17021
        },
17022
 
17023
 
17024
        getBy : function(fn, scope){
17025
            var r = [];
17026
            for(var i = accessList.length-1; i >=0; --i) {
17027
                var win = accessList[i];
17028
                if(fn.call(scope||win, win) !== false){
17029
                    r.push(win);
17030
                }
17031
            }
17032
            return r;
17033
        },
17034
 
17035
 
17036
        each : function(fn, scope){
17037
            for(var id in list){
17038
                if(list[id] && typeof list[id] != "function"){
17039
                    if(fn.call(scope || list[id], list[id]) === false){
17040
                        return;
17041
                    }
17042
                }
17043
            }
17044
        }
17045
    };
17046
};
17047
 
17048
 
17049
 
17050
Ext.WindowMgr = new Ext.WindowGroup();
17051
 
17052
Ext.dd.PanelProxy = function(panel, config){
17053
    this.panel = panel;
17054
    this.id = this.panel.id +'-ddproxy';
17055
    Ext.apply(this, config);
17056
};
17057
 
17058
Ext.dd.PanelProxy.prototype = {
17059
 
17060
    insertProxy : true,
17061
 
17062
 
17063
    setStatus : Ext.emptyFn,
17064
    reset : Ext.emptyFn,
17065
    update : Ext.emptyFn,
17066
    stop : Ext.emptyFn,
17067
    sync: Ext.emptyFn,
17068
 
17069
 
17070
    getEl : function(){
17071
        return this.ghost;
17072
    },
17073
 
17074
 
17075
    getGhost : function(){
17076
        return this.ghost;
17077
    },
17078
 
17079
 
17080
    getProxy : function(){
17081
        return this.proxy;
17082
    },
17083
 
17084
 
17085
    hide : function(){
17086
        if(this.ghost){
17087
            if(this.proxy){
17088
                this.proxy.remove();
17089
                delete this.proxy;
17090
            }
17091
            this.panel.el.dom.style.display = '';
17092
            this.ghost.remove();
17093
            delete this.ghost;
17094
        }
17095
    },
17096
 
17097
 
17098
    show : function(){
17099
        if(!this.ghost){
17100
            this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());
17101
            this.ghost.setXY(this.panel.el.getXY())
17102
            if(this.insertProxy){
17103
                this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});
17104
                this.proxy.setSize(this.panel.getSize());
17105
            }
17106
            this.panel.el.dom.style.display = 'none';
17107
        }
17108
    },
17109
 
17110
 
17111
    repair : function(xy, callback, scope){
17112
        this.hide();
17113
        if(typeof callback == "function"){
17114
            callback.call(scope || this);
17115
        }
17116
    },
17117
 
17118
 
17119
    moveProxy : function(parentNode, before){
17120
        if(this.proxy){
17121
            parentNode.insertBefore(this.proxy.dom, before);
17122
        }
17123
    }
17124
};
17125
 
17126
 
17127
Ext.Panel.DD = function(panel, cfg){
17128
    this.panel = panel;
17129
    this.dragData = {panel: panel};
17130
    this.proxy = new Ext.dd.PanelProxy(panel, cfg);
17131
    Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);
17132
    this.setHandleElId(panel.header.id);
17133
    panel.header.setStyle('cursor', 'move');
17134
    this.scroll = false;
17135
};
17136
 
17137
Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {
17138
    showFrame: Ext.emptyFn,
17139
    startDrag: Ext.emptyFn,
17140
    b4StartDrag: function(x, y) {
17141
        this.proxy.show();
17142
    },
17143
    b4MouseDown: function(e) {
17144
        var x = e.getPageX();
17145
        var y = e.getPageY();
17146
        this.autoOffset(x, y);
17147
    },
17148
    onInitDrag : function(x, y){
17149
        this.onStartDrag(x, y);
17150
        return true;
17151
    },
17152
    createFrame : Ext.emptyFn,
17153
    getDragEl : function(e){
17154
        return this.proxy.ghost.dom;
17155
    },
17156
    endDrag : function(e){
17157
        this.proxy.hide();
17158
        this.panel.saveState();
17159
    },
17160
 
17161
    autoOffset : function(x, y) {
17162
        x -= this.startPageX;
17163
        y -= this.startPageY;
17164
        this.setDelta(x, y);
17165
    }
17166
});
17167
 
17168
Ext.state.Provider = function(){
17169
 
17170
    this.addEvents("statechange");
17171
    this.state = {};
17172
    Ext.state.Provider.superclass.constructor.call(this);
17173
};
17174
Ext.extend(Ext.state.Provider, Ext.util.Observable, {
17175
 
17176
    get : function(name, defaultValue){
17177
        return typeof this.state[name] == "undefined" ?
17178
            defaultValue : this.state[name];
17179
    },
17180
 
17181
 
17182
    clear : function(name){
17183
        delete this.state[name];
17184
        this.fireEvent("statechange", this, name, null);
17185
    },
17186
 
17187
 
17188
    set : function(name, value){
17189
        this.state[name] = value;
17190
 
17191
        this.fireEvent("statechange", this, name, value);
17192
    },
17193
 
17194
 
17195
    decodeValue : function(cookie){
17196
        var re = /^(a|n|d|b|s|o)\:(.*)$/;
17197
        var matches = re.exec(unescape(cookie));
17198
        if(!matches || !matches[1]) return;
17199
        var type = matches[1];
17200
        var v = matches[2];
17201
        switch(type){
17202
            case "n":
17203
                return parseFloat(v);
17204
            case "d":
17205
                return new Date(Date.parse(v));
17206
            case "b":
17207
                return (v == "1");
17208
            case "a":
17209
                var all = [];
17210
                var values = v.split("^");
17211
                for(var i = 0, len = values.length; i < len; i++){
17212
                    all.push(this.decodeValue(values[i]));
17213
                }
17214
                return all;
17215
           case "o":
17216
                var all = {};
17217
                var values = v.split("^");
17218
                for(var i = 0, len = values.length; i < len; i++){
17219
                    var kv = values[i].split("=");
17220
                    all[kv[0]] = this.decodeValue(kv[1]);
17221
                }
17222
                return all;
17223
           default:
17224
                return v;
17225
        }
17226
    },
17227
 
17228
 
17229
    encodeValue : function(v){
17230
        var enc;
17231
        if(typeof v == "number"){
17232
            enc = "n:" + v;
17233
        }else if(typeof v == "boolean"){
17234
            enc = "b:" + (v ? "1" : "0");
17235
        }else if(Ext.isDate(v)){
17236
            enc = "d:" + v.toGMTString();
17237
        }else if(Ext.isArray(v)){
17238
            var flat = "";
17239
            for(var i = 0, len = v.length; i < len; i++){
17240
                flat += this.encodeValue(v[i]);
17241
                if(i != len-1) flat += "^";
17242
            }
17243
            enc = "a:" + flat;
17244
        }else if(typeof v == "object"){
17245
            var flat = "";
17246
            for(var key in v){
17247
                if(typeof v[key] != "function" && v[key] !== undefined){
17248
                    flat += key + "=" + this.encodeValue(v[key]) + "^";
17249
                }
17250
            }
17251
            enc = "o:" + flat.substring(0, flat.length-1);
17252
        }else{
17253
            enc = "s:" + v;
17254
        }
17255
        return escape(enc);
17256
    }
17257
});
17258
 
17259
 
17260
Ext.state.Manager = function(){
17261
    var provider = new Ext.state.Provider();
17262
 
17263
    return {
17264
 
17265
        setProvider : function(stateProvider){
17266
            provider = stateProvider;
17267
        },
17268
 
17269
 
17270
        get : function(key, defaultValue){
17271
            return provider.get(key, defaultValue);
17272
        },
17273
 
17274
 
17275
         set : function(key, value){
17276
            provider.set(key, value);
17277
        },
17278
 
17279
 
17280
        clear : function(key){
17281
            provider.clear(key);
17282
        },
17283
 
17284
 
17285
        getProvider : function(){
17286
            return provider;
17287
        }
17288
    };
17289
}();
17290
 
17291
 
17292
Ext.state.CookieProvider = function(config){
17293
    Ext.state.CookieProvider.superclass.constructor.call(this);
17294
    this.path = "/";
17295
    this.expires = new Date(new Date().getTime()+(1000*60*60*24*7));
17296
    this.domain = null;
17297
    this.secure = false;
17298
    Ext.apply(this, config);
17299
    this.state = this.readCookies();
17300
};
17301
 
17302
Ext.extend(Ext.state.CookieProvider, Ext.state.Provider, {
17303
 
17304
    set : function(name, value){
17305
        if(typeof value == "undefined" || value === null){
17306
            this.clear(name);
17307
            return;
17308
        }
17309
        this.setCookie(name, value);
17310
        Ext.state.CookieProvider.superclass.set.call(this, name, value);
17311
    },
17312
 
17313
 
17314
    clear : function(name){
17315
        this.clearCookie(name);
17316
        Ext.state.CookieProvider.superclass.clear.call(this, name);
17317
    },
17318
 
17319
 
17320
    readCookies : function(){
17321
        var cookies = {};
17322
        var c = document.cookie + ";";
17323
        var re = /\s?(.*?)=(.*?);/g;
17324
    	var matches;
17325
    	while((matches = re.exec(c)) != null){
17326
            var name = matches[1];
17327
            var value = matches[2];
17328
            if(name && name.substring(0,3) == "ys-"){
17329
                cookies[name.substr(3)] = this.decodeValue(value);
17330
            }
17331
        }
17332
        return cookies;
17333
    },
17334
 
17335
 
17336
    setCookie : function(name, value){
17337
        document.cookie = "ys-"+ name + "=" + this.encodeValue(value) +
17338
           ((this.expires == null) ? "" : ("; expires=" + this.expires.toGMTString())) +
17339
           ((this.path == null) ? "" : ("; path=" + this.path)) +
17340
           ((this.domain == null) ? "" : ("; domain=" + this.domain)) +
17341
           ((this.secure == true) ? "; secure" : "");
17342
    },
17343
 
17344
 
17345
    clearCookie : function(name){
17346
        document.cookie = "ys-" + name + "=null; expires=Thu, 01-Jan-70 00:00:01 GMT" +
17347
           ((this.path == null) ? "" : ("; path=" + this.path)) +
17348
           ((this.domain == null) ? "" : ("; domain=" + this.domain)) +
17349
           ((this.secure == true) ? "; secure" : "");
17350
    }
17351
});
17352
 
17353
Ext.DataView = Ext.extend(Ext.BoxComponent, {
17354
 
17355
 
17356
 
17357
 
17358
 
17359
 
17360
 
17361
 
17362
 
17363
    selectedClass : "x-view-selected",
17364
 
17365
    emptyText : "",
17366
 
17367
 
17368
    last: false,
17369
 
17370
 
17371
    initComponent : function(){
17372
        Ext.DataView.superclass.initComponent.call(this);
17373
        if(typeof this.tpl == "string"){
17374
            this.tpl = new Ext.XTemplate(this.tpl);
17375
        }
17376
 
17377
        this.addEvents(
17378
 
17379
            "beforeclick",
17380
 
17381
            "click",
17382
 
17383
            "containerclick",
17384
 
17385
            "dblclick",
17386
 
17387
            "contextmenu",
17388
 
17389
            "selectionchange",
17390
 
17391
 
17392
            "beforeselect"
17393
        );
17394
 
17395
        this.all = new Ext.CompositeElementLite();
17396
        this.selected = new Ext.CompositeElementLite();
17397
    },
17398
 
17399
 
17400
    onRender : function(){
17401
        if(!this.el){
17402
            this.el = document.createElement('div');
17403
        }
17404
        Ext.DataView.superclass.onRender.apply(this, arguments);
17405
    },
17406
 
17407
 
17408
    afterRender : function(){
17409
        Ext.DataView.superclass.afterRender.call(this);
17410
 
17411
        this.el.on({
17412
            "click": this.onClick,
17413
            "dblclick": this.onDblClick,
17414
            "contextmenu": this.onContextMenu,
17415
            scope:this
17416
        });
17417
 
17418
        if(this.overClass){
17419
            this.el.on({
17420
                "mouseover": this.onMouseOver,
17421
                "mouseout": this.onMouseOut,
17422
                scope:this
17423
            });
17424
        }
17425
 
17426
        if(this.store){
17427
            this.setStore(this.store, true);
17428
        }
17429
    },
17430
 
17431
 
17432
    refresh : function(){
17433
        this.clearSelections(false, true);
17434
        this.el.update("");
17435
        var html = [];
17436
        var records = this.store.getRange();
17437
        if(records.length < 1){
17438
            this.el.update(this.emptyText);
17439
            this.all.clear();
17440
            return;
17441
        }
17442
        this.tpl.overwrite(this.el, this.collectData(records, 0));
17443
        this.all.fill(Ext.query(this.itemSelector, this.el.dom));
17444
        this.updateIndexes(0);
17445
    },
17446
 
17447
 
17448
    prepareData : function(data){
17449
        return data;
17450
    },
17451
 
17452
 
17453
    collectData : function(records, startIndex){
17454
        var r = [];
17455
        for(var i = 0, len = records.length; i < len; i++){
17456
            r[r.length] = this.prepareData(records[i].data, startIndex+i, records[i]);
17457
        }
17458
        return r;
17459
    },
17460
 
17461
 
17462
    bufferRender : function(records){
17463
        var div = document.createElement('div');
17464
        this.tpl.overwrite(div, this.collectData(records));
17465
        return Ext.query(this.itemSelector, div);
17466
    },
17467
 
17468
 
17469
    onUpdate : function(ds, record){
17470
        var index = this.store.indexOf(record);
17471
        var sel = this.isSelected(index);
17472
        var original = this.all.elements[index];
17473
        var node = this.bufferRender([record], index)[0];
17474
 
17475
        this.all.replaceElement(index, node, true);
17476
        if(sel){
17477
            this.selected.replaceElement(original, node);
17478
            this.all.item(index).addClass(this.selectedClass);
17479
        }
17480
        this.updateIndexes(index, index);
17481
    },
17482
 
17483
 
17484
    onAdd : function(ds, records, index){
17485
        if(this.all.getCount() == 0){
17486
            this.refresh();
17487
            return;
17488
        }
17489
        var nodes = this.bufferRender(records, index), n;
17490
        if(index < this.all.getCount()){
17491
            n = this.all.item(index).insertSibling(nodes, 'before', true);
17492
            this.all.elements.splice(index, 0, n);
17493
        }else{
17494
            n = this.all.last().insertSibling(nodes, 'after', true);
17495
            this.all.elements.push(n);
17496
        }
17497
        this.updateIndexes(index);
17498
    },
17499
 
17500
 
17501
    onRemove : function(ds, record, index){
17502
        this.deselect(index);
17503
        this.all.removeElement(index, true);
17504
        this.updateIndexes(index);
17505
    },
17506
 
17507
 
17508
    refreshNode : function(index){
17509
        this.onUpdate(this.store, this.store.getAt(index));
17510
    },
17511
 
17512
 
17513
    updateIndexes : function(startIndex, endIndex){
17514
        var ns = this.all.elements;
17515
        startIndex = startIndex || 0;
17516
        endIndex = endIndex || ((endIndex === 0) ? 0 : (ns.length - 1));
17517
        for(var i = startIndex; i <= endIndex; i++){
17518
            ns[i].viewIndex = i;
17519
        }
17520
    },
17521
 
17522
 
17523
    setStore : function(store, initial){
17524
        if(!initial && this.store){
17525
            this.store.un("beforeload", this.onBeforeLoad, this);
17526
            this.store.un("datachanged", this.refresh, this);
17527
            this.store.un("add", this.onAdd, this);
17528
            this.store.un("remove", this.onRemove, this);
17529
            this.store.un("update", this.onUpdate, this);
17530
            this.store.un("clear", this.refresh, this);
17531
        }
17532
        if(store){
17533
            store = Ext.StoreMgr.lookup(store);
17534
            store.on("beforeload", this.onBeforeLoad, this);
17535
            store.on("datachanged", this.refresh, this);
17536
            store.on("add", this.onAdd, this);
17537
            store.on("remove", this.onRemove, this);
17538
            store.on("update", this.onUpdate, this);
17539
            store.on("clear", this.refresh, this);
17540
        }
17541
        this.store = store;
17542
        if(store){
17543
            this.refresh();
17544
        }
17545
    },
17546
 
17547
 
17548
    findItemFromChild : function(node){
17549
        return Ext.fly(node).findParent(this.itemSelector, this.el);
17550
    },
17551
 
17552
 
17553
    onClick : function(e){
17554
        var item = e.getTarget(this.itemSelector, this.el);
17555
        if(item){
17556
            var index = this.indexOf(item);
17557
            if(this.onItemClick(item, index, e) !== false){
17558
                this.fireEvent("click", this, index, item, e);
17559
            }
17560
        }else{
17561
            if(this.fireEvent("containerclick", this, e) !== false){
17562
                this.clearSelections();
17563
            }
17564
        }
17565
    },
17566
 
17567
 
17568
    onContextMenu : function(e){
17569
        var item = e.getTarget(this.itemSelector, this.el);
17570
        if(item){
17571
            this.fireEvent("contextmenu", this, this.indexOf(item), item, e);
17572
        }
17573
    },
17574
 
17575
 
17576
    onDblClick : function(e){
17577
        var item = e.getTarget(this.itemSelector, this.el);
17578
        if(item){
17579
            this.fireEvent("dblclick", this, this.indexOf(item), item, e);
17580
        }
17581
    },
17582
 
17583
 
17584
    onMouseOver : function(e){
17585
        var item = e.getTarget(this.itemSelector, this.el);
17586
        if(item && item !== this.lastItem){
17587
            this.lastItem = item;
17588
            Ext.fly(item).addClass(this.overClass);
17589
        }
17590
    },
17591
 
17592
 
17593
    onMouseOut : function(e){
17594
        if(this.lastItem){
17595
            if(!e.within(this.lastItem, true)){
17596
                Ext.fly(this.lastItem).removeClass(this.overClass);
17597
                delete this.lastItem;
17598
            }
17599
        }
17600
    },
17601
 
17602
 
17603
    onItemClick : function(item, index, e){
17604
        if(this.fireEvent("beforeclick", this, index, item, e) === false){
17605
            return false;
17606
        }
17607
        if(this.multiSelect){
17608
            this.doMultiSelection(item, index, e);
17609
            e.preventDefault();
17610
        }else if(this.singleSelect){
17611
            this.doSingleSelection(item, index, e);
17612
            e.preventDefault();
17613
        }
17614
        return true;
17615
    },
17616
 
17617
 
17618
    doSingleSelection : function(item, index, e){
17619
        if(e.ctrlKey && this.isSelected(index)){
17620
            this.deselect(index);
17621
        }else{
17622
            this.select(index, false);
17623
        }
17624
    },
17625
 
17626
 
17627
    doMultiSelection : function(item, index, e){
17628
        if(e.shiftKey && this.last !== false){
17629
            var last = this.last;
17630
            this.selectRange(last, index, e.ctrlKey);
17631
            this.last = last;
17632
        }else{
17633
            if((e.ctrlKey||this.simpleSelect) && this.isSelected(index)){
17634
                this.deselect(index);
17635
            }else{
17636
                this.select(index, e.ctrlKey || e.shiftKey || this.simpleSelect);
17637
            }
17638
        }
17639
    },
17640
 
17641
 
17642
    getSelectionCount : function(){
17643
        return this.selected.getCount()
17644
    },
17645
 
17646
 
17647
    getSelectedNodes : function(){
17648
        return this.selected.elements;
17649
    },
17650
 
17651
 
17652
    getSelectedIndexes : function(){
17653
        var indexes = [], s = this.selected.elements;
17654
        for(var i = 0, len = s.length; i < len; i++){
17655
            indexes.push(s[i].viewIndex);
17656
        }
17657
        return indexes;
17658
    },
17659
 
17660
 
17661
    getSelectedRecords : function(){
17662
        var r = [], s = this.selected.elements;
17663
        for(var i = 0, len = s.length; i < len; i++){
17664
            r[r.length] = this.store.getAt(s[i].viewIndex);
17665
        }
17666
        return r;
17667
    },
17668
 
17669
 
17670
    getRecords : function(nodes){
17671
        var r = [], s = nodes;
17672
        for(var i = 0, len = s.length; i < len; i++){
17673
            r[r.length] = this.store.getAt(s[i].viewIndex);
17674
        }
17675
        return r;
17676
    },
17677
 
17678
 
17679
    getRecord : function(node){
17680
        return this.store.getAt(node.viewIndex);
17681
    },
17682
 
17683
 
17684
    clearSelections : function(suppressEvent, skipUpdate){
17685
        if(this.multiSelect || this.singleSelect){
17686
            if(!skipUpdate){
17687
                this.selected.removeClass(this.selectedClass);
17688
            }
17689
            this.selected.clear();
17690
            this.last = false;
17691
            if(!suppressEvent){
17692
                this.fireEvent("selectionchange", this, this.selected.elements);
17693
            }
17694
        }
17695
    },
17696
 
17697
 
17698
    isSelected : function(node){
17699
        return this.selected.contains(this.getNode(node));
17700
    },
17701
 
17702
 
17703
    deselect : function(node){
17704
        if(this.isSelected(node)){
17705
            var node = this.getNode(node);
17706
            this.selected.removeElement(node);
17707
            if(this.last == node.viewIndex){
17708
                this.last = false;
17709
            }
17710
            Ext.fly(node).removeClass(this.selectedClass);
17711
            this.fireEvent("selectionchange", this, this.selected.elements);
17712
        }
17713
    },
17714
 
17715
 
17716
    select : function(nodeInfo, keepExisting, suppressEvent){
17717
        if(Ext.isArray(nodeInfo)){
17718
            if(!keepExisting){
17719
                this.clearSelections(true);
17720
            }
17721
            for(var i = 0, len = nodeInfo.length; i < len; i++){
17722
                this.select(nodeInfo[i], true, true);
17723
            }
17724
        } else{
17725
            var node = this.getNode(nodeInfo);
17726
            if(!keepExisting){
17727
                this.clearSelections(true);
17728
            }
17729
            if(node && !this.isSelected(node)){
17730
                if(this.fireEvent("beforeselect", this, node, this.selected.elements) !== false){
17731
                    Ext.fly(node).addClass(this.selectedClass);
17732
                    this.selected.add(node);
17733
                    this.last = node.viewIndex;
17734
                    if(!suppressEvent){
17735
                        this.fireEvent("selectionchange", this, this.selected.elements);
17736
                    }
17737
                }
17738
            }
17739
        }
17740
    },
17741
 
17742
 
17743
    selectRange : function(start, end, keepExisting){
17744
        if(!keepExisting){
17745
            this.clearSelections(true);
17746
        }
17747
        this.select(this.getNodes(start, end), true);
17748
    },
17749
 
17750
 
17751
    getNode : function(nodeInfo){
17752
        if(typeof nodeInfo == "string"){
17753
            return document.getElementById(nodeInfo);
17754
        }else if(typeof nodeInfo == "number"){
17755
            return this.all.elements[nodeInfo];
17756
        }
17757
        return nodeInfo;
17758
    },
17759
 
17760
 
17761
    getNodes : function(start, end){
17762
        var ns = this.all.elements;
17763
        start = start || 0;
17764
        end = typeof end == "undefined" ? ns.length - 1 : end;
17765
        var nodes = [], i;
17766
        if(start <= end){
17767
            for(i = start; i <= end; i++){
17768
                nodes.push(ns[i]);
17769
            }
17770
        } else{
17771
            for(i = start; i >= end; i--){
17772
                nodes.push(ns[i]);
17773
            }
17774
        }
17775
        return nodes;
17776
    },
17777
 
17778
 
17779
    indexOf : function(node){
17780
        node = this.getNode(node);
17781
        if(typeof node.viewIndex == "number"){
17782
            return node.viewIndex;
17783
        }
17784
        return this.all.indexOf(node);
17785
    },
17786
 
17787
 
17788
    onBeforeLoad : function(){
17789
        if(this.loadingText){
17790
            this.clearSelections(false, true);
17791
            this.el.update('<div class="loading-indicator">'+this.loadingText+'</div>');
17792
            this.all.clear();
17793
        }
17794
    }
17795
});
17796
 
17797
Ext.reg('dataview', Ext.DataView);
17798
 
17799
Ext.ColorPalette = function(config){
17800
    Ext.ColorPalette.superclass.constructor.call(this, config);
17801
    this.addEvents(
17802
 
17803
        'select'
17804
    );
17805
 
17806
    if(this.handler){
17807
        this.on("select", this.handler, this.scope, true);
17808
    }
17809
};
17810
Ext.extend(Ext.ColorPalette, Ext.Component, {
17811
 
17812
 
17813
    itemCls : "x-color-palette",
17814
 
17815
    value : null,
17816
    clickEvent:'click',
17817
        ctype: "Ext.ColorPalette",
17818
 
17819
 
17820
    allowReselect : false,
17821
 
17822
 
17823
    colors : [
17824
        "000000", "993300", "333300", "003300", "003366", "000080", "333399", "333333",
17825
        "800000", "FF6600", "808000", "008000", "008080", "0000FF", "666699", "808080",
17826
        "FF0000", "FF9900", "99CC00", "339966", "33CCCC", "3366FF", "800080", "969696",
17827
        "FF00FF", "FFCC00", "FFFF00", "00FF00", "00FFFF", "00CCFF", "993366", "C0C0C0",
17828
        "FF99CC", "FFCC99", "FFFF99", "CCFFCC", "CCFFFF", "99CCFF", "CC99FF", "FFFFFF"
17829
    ],
17830
 
17831
        onRender : function(container, position){
17832
        var t = this.tpl || new Ext.XTemplate(
17833
            '<tpl for="."><a href="#" class="color-{.}" hidefocus="on"><em><span style="background:#{.}" unselectable="on">&#160;</span></em></a></tpl>'
17834
        );
17835
        var el = document.createElement("div");
17836
        el.className = this.itemCls;
17837
        t.overwrite(el, this.colors);
17838
        container.dom.insertBefore(el, position);
17839
        this.el = Ext.get(el);
17840
        this.el.on(this.clickEvent, this.handleClick,  this, {delegate: "a"});
17841
        if(this.clickEvent != 'click'){
17842
            this.el.on('click', Ext.emptyFn,  this, {delegate: "a", preventDefault:true});
17843
        }
17844
    },
17845
 
17846
        afterRender : function(){
17847
        Ext.ColorPalette.superclass.afterRender.call(this);
17848
        if(this.value){
17849
            var s = this.value;
17850
            this.value = null;
17851
            this.select(s);
17852
        }
17853
    },
17854
 
17855
        handleClick : function(e, t){
17856
        e.preventDefault();
17857
        if(!this.disabled){
17858
            var c = t.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1];
17859
            this.select(c.toUpperCase());
17860
        }
17861
    },
17862
 
17863
 
17864
    select : function(color){
17865
        color = color.replace("#", "");
17866
        if(color != this.value || this.allowReselect){
17867
            var el = this.el;
17868
            if(this.value){
17869
                el.child("a.color-"+this.value).removeClass("x-color-palette-sel");
17870
            }
17871
            el.child("a.color-"+color).addClass("x-color-palette-sel");
17872
            this.value = color;
17873
            this.fireEvent("select", this, color);
17874
        }
17875
    }
17876
 
17877
 
17878
});
17879
Ext.reg('colorpalette', Ext.ColorPalette);
17880
 
17881
Ext.DatePicker = Ext.extend(Ext.Component, {
17882
 
17883
    todayText : "Today",
17884
 
17885
    okText : "&#160;OK&#160;",
17886
 
17887
    cancelText : "Cancel",
17888
 
17889
    todayTip : "{0} (Spacebar)",
17890
 
17891
    minDate : null,
17892
 
17893
    maxDate : null,
17894
 
17895
    minText : "This date is before the minimum date",
17896
 
17897
    maxText : "This date is after the maximum date",
17898
 
17899
    format : "m/d/y",
17900
 
17901
    disabledDays : null,
17902
 
17903
    disabledDaysText : "",
17904
 
17905
    disabledDatesRE : null,
17906
 
17907
    disabledDatesText : "",
17908
 
17909
    constrainToViewport : true,
17910
 
17911
    monthNames : Date.monthNames,
17912
 
17913
    dayNames : Date.dayNames,
17914
 
17915
    nextText: 'Next Month (Control+Right)',
17916
 
17917
    prevText: 'Previous Month (Control+Left)',
17918
 
17919
    monthYearText: 'Choose a month (Control+Up/Down to move years)',
17920
 
17921
    startDay : 0,
17922
 
17923
    initComponent : function(){
17924
        Ext.DatePicker.superclass.initComponent.call(this);
17925
 
17926
        this.value = this.value ?
17927
                 this.value.clearTime() : new Date().clearTime();
17928
 
17929
        this.addEvents(
17930
 
17931
            'select'
17932
        );
17933
 
17934
        if(this.handler){
17935
            this.on("select", this.handler,  this.scope || this);
17936
        }
17937
 
17938
        this.initDisabledDays();
17939
    },
17940
 
17941
 
17942
    initDisabledDays : function(){
17943
        if(!this.disabledDatesRE && this.disabledDates){
17944
            var dd = this.disabledDates;
17945
            var re = "(?:";
17946
            for(var i = 0; i < dd.length; i++){
17947
                re += dd[i];
17948
                if(i != dd.length-1) re += "|";
17949
            }
17950
            this.disabledDatesRE = new RegExp(re + ")");
17951
        }
17952
    },
17953
 
17954
 
17955
    setValue : function(value){
17956
        var old = this.value;
17957
        this.value = value.clearTime(true);
17958
        if(this.el){
17959
            this.update(this.value);
17960
        }
17961
    },
17962
 
17963
 
17964
    getValue : function(){
17965
        return this.value;
17966
    },
17967
 
17968
 
17969
    focus : function(){
17970
        if(this.el){
17971
            this.update(this.activeDate);
17972
        }
17973
    },
17974
 
17975
 
17976
    onRender : function(container, position){
17977
        var m = [
17978
             '<table cellspacing="0">',
17979
                '<tr><td class="x-date-left"><a href="#" title="', this.prevText ,'">&#160;</a></td><td class="x-date-middle" align="center"></td><td class="x-date-right"><a href="#" title="', this.nextText ,'">&#160;</a></td></tr>',
17980
                '<tr><td colspan="3"><table class="x-date-inner" cellspacing="0"><thead><tr>'];
17981
        var dn = this.dayNames;
17982
        for(var i = 0; i < 7; i++){
17983
            var d = this.startDay+i;
17984
            if(d > 6){
17985
                d = d-7;
17986
            }
17987
            m.push("<th><span>", dn[d].substr(0,1), "</span></th>");
17988
        }
17989
        m[m.length] = "</tr></thead><tbody><tr>";
17990
        for(var i = 0; i < 42; i++) {
17991
            if(i % 7 == 0 && i != 0){
17992
                m[m.length] = "</tr><tr>";
17993
            }
17994
            m[m.length] = '<td><a href="#" hidefocus="on" class="x-date-date" tabIndex="1"><em><span></span></em></a></td>';
17995
        }
17996
        m[m.length] = '</tr></tbody></table></td></tr><tr><td colspan="3" class="x-date-bottom" align="center"></td></tr></table><div class="x-date-mp"></div>';
17997
 
17998
        var el = document.createElement("div");
17999
        el.className = "x-date-picker";
18000
        el.innerHTML = m.join("");
18001
 
18002
        container.dom.insertBefore(el, position);
18003
 
18004
        this.el = Ext.get(el);
18005
        this.eventEl = Ext.get(el.firstChild);
18006
 
18007
        new Ext.util.ClickRepeater(this.el.child("td.x-date-left a"), {
18008
            handler: this.showPrevMonth,
18009
            scope: this,
18010
            preventDefault:true,
18011
            stopDefault:true
18012
        });
18013
 
18014
        new Ext.util.ClickRepeater(this.el.child("td.x-date-right a"), {
18015
            handler: this.showNextMonth,
18016
            scope: this,
18017
            preventDefault:true,
18018
            stopDefault:true
18019
        });
18020
 
18021
        this.eventEl.on("mousewheel", this.handleMouseWheel,  this);
18022
 
18023
        this.monthPicker = this.el.down('div.x-date-mp');
18024
        this.monthPicker.enableDisplayMode('block');
18025
 
18026
        var kn = new Ext.KeyNav(this.eventEl, {
18027
            "left" : function(e){
18028
                e.ctrlKey ?
18029
                    this.showPrevMonth() :
18030
                    this.update(this.activeDate.add("d", -1));
18031
            },
18032
 
18033
            "right" : function(e){
18034
                e.ctrlKey ?
18035
                    this.showNextMonth() :
18036
                    this.update(this.activeDate.add("d", 1));
18037
            },
18038
 
18039
            "up" : function(e){
18040
                e.ctrlKey ?
18041
                    this.showNextYear() :
18042
                    this.update(this.activeDate.add("d", -7));
18043
            },
18044
 
18045
            "down" : function(e){
18046
                e.ctrlKey ?
18047
                    this.showPrevYear() :
18048
                    this.update(this.activeDate.add("d", 7));
18049
            },
18050
 
18051
            "pageUp" : function(e){
18052
                this.showNextMonth();
18053
            },
18054
 
18055
            "pageDown" : function(e){
18056
                this.showPrevMonth();
18057
            },
18058
 
18059
            "enter" : function(e){
18060
                e.stopPropagation();
18061
                return true;
18062
            },
18063
 
18064
            scope : this
18065
        });
18066
 
18067
        this.eventEl.on("click", this.handleDateClick,  this, {delegate: "a.x-date-date"});
18068
 
18069
        this.eventEl.addKeyListener(Ext.EventObject.SPACE, this.selectToday,  this);
18070
 
18071
        this.el.unselectable();
18072
 
18073
        this.cells = this.el.select("table.x-date-inner tbody td");
18074
        this.textNodes = this.el.query("table.x-date-inner tbody span");
18075
 
18076
        this.mbtn = new Ext.Button({
18077
            text: "&#160;",
18078
            tooltip: this.monthYearText,
18079
            renderTo: this.el.child("td.x-date-middle", true)
18080
        });
18081
 
18082
        this.mbtn.on('click', this.showMonthPicker, this);
18083
        this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu");
18084
 
18085
 
18086
        var today = (new Date()).dateFormat(this.format);
18087
        this.todayBtn = new Ext.Button({
18088
            renderTo: this.el.child("td.x-date-bottom", true),
18089
            text: String.format(this.todayText, today),
18090
            tooltip: String.format(this.todayTip, today),
18091
            handler: this.selectToday,
18092
            scope: this
18093
        });
18094
 
18095
        if(Ext.isIE){
18096
            this.el.repaint();
18097
        }
18098
        this.update(this.value);
18099
    },
18100
 
18101
    createMonthPicker : function(){
18102
        if(!this.monthPicker.dom.firstChild){
18103
            var buf = ['<table border="0" cellspacing="0">'];
18104
            for(var i = 0; i < 6; i++){
18105
                buf.push(
18106
                    '<tr><td class="x-date-mp-month"><a href="#">', this.monthNames[i].substr(0, 3), '</a></td>',
18107
                    '<td class="x-date-mp-month x-date-mp-sep"><a href="#">', this.monthNames[i+6].substr(0, 3), '</a></td>',
18108
                    i == 0 ?
18109
                    '<td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-prev"></a></td><td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-next"></a></td></tr>' :
18110
                    '<td class="x-date-mp-year"><a href="#"></a></td><td class="x-date-mp-year"><a href="#"></a></td></tr>'
18111
                );
18112
            }
18113
            buf.push(
18114
                '<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">',
18115
                    this.okText,
18116
                    '</button><button type="button" class="x-date-mp-cancel">',
18117
                    this.cancelText,
18118
                    '</button></td></tr>',
18119
                '</table>'
18120
            );
18121
            this.monthPicker.update(buf.join(''));
18122
            this.monthPicker.on('click', this.onMonthClick, this);
18123
            this.monthPicker.on('dblclick', this.onMonthDblClick, this);
18124
 
18125
            this.mpMonths = this.monthPicker.select('td.x-date-mp-month');
18126
            this.mpYears = this.monthPicker.select('td.x-date-mp-year');
18127
 
18128
            this.mpMonths.each(function(m, a, i){
18129
                i += 1;
18130
                if((i%2) == 0){
18131
                    m.dom.xmonth = 5 + Math.round(i * .5);
18132
                }else{
18133
                    m.dom.xmonth = Math.round((i-1) * .5);
18134
                }
18135
            });
18136
        }
18137
    },
18138
 
18139
    showMonthPicker : function(){
18140
        this.createMonthPicker();
18141
        var size = this.el.getSize();
18142
        this.monthPicker.setSize(size);
18143
        this.monthPicker.child('table').setSize(size);
18144
 
18145
        this.mpSelMonth = (this.activeDate || this.value).getMonth();
18146
        this.updateMPMonth(this.mpSelMonth);
18147
        this.mpSelYear = (this.activeDate || this.value).getFullYear();
18148
        this.updateMPYear(this.mpSelYear);
18149
 
18150
        this.monthPicker.slideIn('t', {duration:.2});
18151
    },
18152
 
18153
    updateMPYear : function(y){
18154
        this.mpyear = y;
18155
        var ys = this.mpYears.elements;
18156
        for(var i = 1; i <= 10; i++){
18157
            var td = ys[i-1], y2;
18158
            if((i%2) == 0){
18159
                y2 = y + Math.round(i * .5);
18160
                td.firstChild.innerHTML = y2;
18161
                td.xyear = y2;
18162
            }else{
18163
                y2 = y - (5-Math.round(i * .5));
18164
                td.firstChild.innerHTML = y2;
18165
                td.xyear = y2;
18166
            }
18167
            this.mpYears.item(i-1)[y2 == this.mpSelYear ? 'addClass' : 'removeClass']('x-date-mp-sel');
18168
        }
18169
    },
18170
 
18171
    updateMPMonth : function(sm){
18172
        this.mpMonths.each(function(m, a, i){
18173
            m[m.dom.xmonth == sm ? 'addClass' : 'removeClass']('x-date-mp-sel');
18174
        });
18175
    },
18176
 
18177
    selectMPMonth: function(m){
18178
 
18179
    },
18180
 
18181
    onMonthClick : function(e, t){
18182
        e.stopEvent();
18183
        var el = new Ext.Element(t), pn;
18184
        if(el.is('button.x-date-mp-cancel')){
18185
            this.hideMonthPicker();
18186
        }
18187
        else if(el.is('button.x-date-mp-ok')){
18188
            this.update(new Date(this.mpSelYear, this.mpSelMonth, (this.activeDate || this.value).getDate()));
18189
            this.hideMonthPicker();
18190
        }
18191
        else if(pn = el.up('td.x-date-mp-month', 2)){
18192
            this.mpMonths.removeClass('x-date-mp-sel');
18193
            pn.addClass('x-date-mp-sel');
18194
            this.mpSelMonth = pn.dom.xmonth;
18195
        }
18196
        else if(pn = el.up('td.x-date-mp-year', 2)){
18197
            this.mpYears.removeClass('x-date-mp-sel');
18198
            pn.addClass('x-date-mp-sel');
18199
            this.mpSelYear = pn.dom.xyear;
18200
        }
18201
        else if(el.is('a.x-date-mp-prev')){
18202
            this.updateMPYear(this.mpyear-10);
18203
        }
18204
        else if(el.is('a.x-date-mp-next')){
18205
            this.updateMPYear(this.mpyear+10);
18206
        }
18207
    },
18208
 
18209
    onMonthDblClick : function(e, t){
18210
        e.stopEvent();
18211
        var el = new Ext.Element(t), pn;
18212
        if(pn = el.up('td.x-date-mp-month', 2)){
18213
            this.update(new Date(this.mpSelYear, pn.dom.xmonth, (this.activeDate || this.value).getDate()));
18214
            this.hideMonthPicker();
18215
        }
18216
        else if(pn = el.up('td.x-date-mp-year', 2)){
18217
            this.update(new Date(pn.dom.xyear, this.mpSelMonth, (this.activeDate || this.value).getDate()));
18218
            this.hideMonthPicker();
18219
        }
18220
    },
18221
 
18222
    hideMonthPicker : function(disableAnim){
18223
        if(this.monthPicker){
18224
            if(disableAnim === true){
18225
                this.monthPicker.hide();
18226
            }else{
18227
                this.monthPicker.slideOut('t', {duration:.2});
18228
            }
18229
        }
18230
    },
18231
 
18232
 
18233
    showPrevMonth : function(e){
18234
        this.update(this.activeDate.add("mo", -1));
18235
    },
18236
 
18237
 
18238
    showNextMonth : function(e){
18239
        this.update(this.activeDate.add("mo", 1));
18240
    },
18241
 
18242
 
18243
    showPrevYear : function(){
18244
        this.update(this.activeDate.add("y", -1));
18245
    },
18246
 
18247
 
18248
    showNextYear : function(){
18249
        this.update(this.activeDate.add("y", 1));
18250
    },
18251
 
18252
 
18253
    handleMouseWheel : function(e){
18254
        var delta = e.getWheelDelta();
18255
        if(delta > 0){
18256
            this.showPrevMonth();
18257
            e.stopEvent();
18258
        } else if(delta < 0){
18259
            this.showNextMonth();
18260
            e.stopEvent();
18261
        }
18262
    },
18263
 
18264
 
18265
    handleDateClick : function(e, t){
18266
        e.stopEvent();
18267
        if(t.dateValue && !Ext.fly(t.parentNode).hasClass("x-date-disabled")){
18268
            this.setValue(new Date(t.dateValue));
18269
            this.fireEvent("select", this, this.value);
18270
        }
18271
    },
18272
 
18273
 
18274
    selectToday : function(){
18275
        this.setValue(new Date().clearTime());
18276
        this.fireEvent("select", this, this.value);
18277
    },
18278
 
18279
 
18280
    update : function(date){
18281
        var vd = this.activeDate;
18282
        this.activeDate = date;
18283
        if(vd && this.el){
18284
            var t = date.getTime();
18285
            if(vd.getMonth() == date.getMonth() && vd.getFullYear() == date.getFullYear()){
18286
                this.cells.removeClass("x-date-selected");
18287
                this.cells.each(function(c){
18288
                   if(c.dom.firstChild.dateValue == t){
18289
                       c.addClass("x-date-selected");
18290
                       setTimeout(function(){
18291
                            try{c.dom.firstChild.focus();}catch(e){}
18292
                       }, 50);
18293
                       return false;
18294
                   }
18295
                });
18296
                return;
18297
            }
18298
        }
18299
        var days = date.getDaysInMonth();
18300
        var firstOfMonth = date.getFirstDateOfMonth();
18301
        var startingPos = firstOfMonth.getDay()-this.startDay;
18302
 
18303
        if(startingPos <= this.startDay){
18304
            startingPos += 7;
18305
        }
18306
 
18307
        var pm = date.add("mo", -1);
18308
        var prevStart = pm.getDaysInMonth()-startingPos;
18309
 
18310
        var cells = this.cells.elements;
18311
        var textEls = this.textNodes;
18312
        days += startingPos;
18313
 
18314
 
18315
        var day = 86400000;
18316
        var d = (new Date(pm.getFullYear(), pm.getMonth(), prevStart)).clearTime();
18317
        var today = new Date().clearTime().getTime();
18318
        var sel = date.clearTime().getTime();
18319
        var min = this.minDate ? this.minDate.clearTime() : Number.NEGATIVE_INFINITY;
18320
        var max = this.maxDate ? this.maxDate.clearTime() : Number.POSITIVE_INFINITY;
18321
        var ddMatch = this.disabledDatesRE;
18322
        var ddText = this.disabledDatesText;
18323
        var ddays = this.disabledDays ? this.disabledDays.join("") : false;
18324
        var ddaysText = this.disabledDaysText;
18325
        var format = this.format;
18326
 
18327
        var setCellClass = function(cal, cell){
18328
            cell.title = "";
18329
            var t = d.getTime();
18330
            cell.firstChild.dateValue = t;
18331
            if(t == today){
18332
                cell.className += " x-date-today";
18333
                cell.title = cal.todayText;
18334
            }
18335
            if(t == sel){
18336
                cell.className += " x-date-selected";
18337
                setTimeout(function(){
18338
                    try{cell.firstChild.focus();}catch(e){}
18339
                }, 50);
18340
            }
18341
 
18342
            if(t < min) {
18343
                cell.className = " x-date-disabled";
18344
                cell.title = cal.minText;
18345
                return;
18346
            }
18347
            if(t > max) {
18348
                cell.className = " x-date-disabled";
18349
                cell.title = cal.maxText;
18350
                return;
18351
            }
18352
            if(ddays){
18353
                if(ddays.indexOf(d.getDay()) != -1){
18354
                    cell.title = ddaysText;
18355
                    cell.className = " x-date-disabled";
18356
                }
18357
            }
18358
            if(ddMatch && format){
18359
                var fvalue = d.dateFormat(format);
18360
                if(ddMatch.test(fvalue)){
18361
                    cell.title = ddText.replace("%0", fvalue);
18362
                    cell.className = " x-date-disabled";
18363
                }
18364
            }
18365
        };
18366
 
18367
        var i = 0;
18368
        for(; i < startingPos; i++) {
18369
            textEls[i].innerHTML = (++prevStart);
18370
            d.setDate(d.getDate()+1);
18371
            cells[i].className = "x-date-prevday";
18372
            setCellClass(this, cells[i]);
18373
        }
18374
        for(; i < days; i++){
18375
            intDay = i - startingPos + 1;
18376
            textEls[i].innerHTML = (intDay);
18377
            d.setDate(d.getDate()+1);
18378
            cells[i].className = "x-date-active";
18379
            setCellClass(this, cells[i]);
18380
        }
18381
        var extraDays = 0;
18382
        for(; i < 42; i++) {
18383
             textEls[i].innerHTML = (++extraDays);
18384
             d.setDate(d.getDate()+1);
18385
             cells[i].className = "x-date-nextday";
18386
             setCellClass(this, cells[i]);
18387
        }
18388
 
18389
        this.mbtn.setText(this.monthNames[date.getMonth()] + " " + date.getFullYear());
18390
 
18391
        if(!this.internalRender){
18392
            var main = this.el.dom.firstChild;
18393
            var w = main.offsetWidth;
18394
            this.el.setWidth(w + this.el.getBorderWidth("lr"));
18395
            Ext.fly(main).setWidth(w);
18396
            this.internalRender = true;
18397
 
18398
 
18399
 
18400
            if(Ext.isOpera && !this.secondPass){
18401
                main.rows[0].cells[1].style.width = (w - (main.rows[0].cells[0].offsetWidth+main.rows[0].cells[2].offsetWidth)) + "px";
18402
                this.secondPass = true;
18403
                this.update.defer(10, this, [date]);
18404
            }
18405
        }
18406
    },
18407
 
18408
 
18409
    beforeDestroy : function() {
18410
        this.mbtn.destroy();
18411
        this.todayBtn.destroy();
18412
    }
18413
 
18414
 
18415
});
18416
Ext.reg('datepicker', Ext.DatePicker);
18417
 
18418
Ext.TabPanel = Ext.extend(Ext.Panel,  {
18419
 
18420
 
18421
    monitorResize : true,
18422
 
18423
    deferredRender : true,
18424
 
18425
    tabWidth: 120,
18426
 
18427
    minTabWidth: 30,
18428
 
18429
    resizeTabs:false,
18430
 
18431
    enableTabScroll: false,
18432
 
18433
    scrollIncrement : 0,
18434
 
18435
    scrollRepeatInterval : 400,
18436
 
18437
    scrollDuration : .35,
18438
 
18439
    animScroll : true,
18440
 
18441
    tabPosition: 'top',
18442
 
18443
    baseCls: 'x-tab-panel',
18444
 
18445
    autoTabs : false,
18446
 
18447
    autoTabSelector:'div.x-tab',
18448
 
18449
    activeTab : null,
18450
 
18451
    tabMargin : 2,
18452
 
18453
    plain: false,
18454
 
18455
    wheelIncrement : 20,
18456
 
18457
 
18458
    idDelimiter : '__',
18459
 
18460
        itemCls : 'x-tab-item',
18461
 
18462
        elements: 'body',
18463
    headerAsText: false,
18464
    frame: false,
18465
    hideBorders:true,
18466
 
18467
        initComponent : function(){
18468
        this.frame = false;
18469
        Ext.TabPanel.superclass.initComponent.call(this);
18470
        this.addEvents(
18471
 
18472
            'beforetabchange',
18473
 
18474
            'tabchange',
18475
 
18476
            'contextmenu'
18477
        );
18478
        this.setLayout(new Ext.layout.CardLayout({
18479
            deferredRender: this.deferredRender
18480
        }));
18481
        if(this.tabPosition == 'top'){
18482
            this.elements += ',header';
18483
            this.stripTarget = 'header';
18484
        }else {
18485
            this.elements += ',footer';
18486
            this.stripTarget = 'footer';
18487
        }
18488
        if(!this.stack){
18489
            this.stack = Ext.TabPanel.AccessStack();
18490
        }
18491
        this.initItems();
18492
    },
18493
 
18494
        render : function(){
18495
        Ext.TabPanel.superclass.render.apply(this, arguments);
18496
        if(this.activeTab !== undefined){
18497
            var item = this.activeTab;
18498
            delete this.activeTab;
18499
            this.setActiveTab(item);
18500
        }
18501
    },
18502
 
18503
        onRender : function(ct, position){
18504
        Ext.TabPanel.superclass.onRender.call(this, ct, position);
18505
 
18506
        if(this.plain){
18507
            var pos = this.tabPosition == 'top' ? 'header' : 'footer';
18508
            this[pos].addClass('x-tab-panel-'+pos+'-plain');
18509
        }
18510
 
18511
        var st = this[this.stripTarget];
18512
 
18513
        this.stripWrap = st.createChild({cls:'x-tab-strip-wrap', cn:{
18514
            tag:'ul', cls:'x-tab-strip x-tab-strip-'+this.tabPosition}});
18515
        this.stripSpacer = st.createChild({cls:'x-tab-strip-spacer'});
18516
        this.strip = new Ext.Element(this.stripWrap.dom.firstChild);
18517
 
18518
        this.edge = this.strip.createChild({tag:'li', cls:'x-tab-edge'});
18519
        this.strip.createChild({cls:'x-clear'});
18520
 
18521
        this.body.addClass('x-tab-panel-body-'+this.tabPosition);
18522
 
18523
        if(!this.itemTpl){
18524
            var tt = new Ext.Template(
18525
                 '<li class="{cls}" id="{id}"><a class="x-tab-strip-close" onclick="return false;"></a>',
18526
                 '<a class="x-tab-right" href="#" onclick="return false;"><em class="x-tab-left">',
18527
                 '<span class="x-tab-strip-inner"><span class="x-tab-strip-text {iconCls}">{text}</span></span>',
18528
                 '</em></a></li>'
18529
            );
18530
            tt.disableFormats = true;
18531
            tt.compile();
18532
            Ext.TabPanel.prototype.itemTpl = tt;
18533
        }
18534
 
18535
        this.items.each(this.initTab, this);
18536
    },
18537
 
18538
        afterRender : function(){
18539
        Ext.TabPanel.superclass.afterRender.call(this);
18540
        if(this.autoTabs){
18541
            this.readTabs(false);
18542
        }
18543
    },
18544
 
18545
        initEvents : function(){
18546
        Ext.TabPanel.superclass.initEvents.call(this);
18547
        this.on('add', this.onAdd, this);
18548
        this.on('remove', this.onRemove, this);
18549
 
18550
        this.strip.on('mousedown', this.onStripMouseDown, this);
18551
        this.strip.on('click', this.onStripClick, this);
18552
        this.strip.on('contextmenu', this.onStripContextMenu, this);
18553
        if(this.enableTabScroll){
18554
            this.strip.on('mousewheel', this.onWheel, this);
18555
        }
18556
    },
18557
 
18558
        findTargets : function(e){
18559
        var item = null;
18560
        var itemEl = e.getTarget('li', this.strip);
18561
        if(itemEl){
18562
            item = this.getComponent(itemEl.id.split(this.idDelimiter)[1]);
18563
            if(item.disabled){
18564
                return {
18565
                    close : null,
18566
                    item : null,
18567
                    el : null
18568
                };
18569
            }
18570
        }
18571
        return {
18572
            close : e.getTarget('.x-tab-strip-close', this.strip),
18573
            item : item,
18574
            el : itemEl
18575
        };
18576
    },
18577
 
18578
        onStripMouseDown : function(e){
18579
        e.preventDefault();
18580
        if(e.button != 0){
18581
            return;
18582
        }
18583
        var t = this.findTargets(e);
18584
        if(t.close){
18585
            this.remove(t.item);
18586
            return;
18587
        }
18588
        if(t.item && t.item != this.activeTab){
18589
            this.setActiveTab(t.item);
18590
        }
18591
    },
18592
 
18593
        onStripClick : function(e){
18594
        var t = this.findTargets(e);
18595
        if(!t.close && t.item && t.item != this.activeTab){
18596
            this.setActiveTab(t.item);
18597
        }
18598
    },
18599
 
18600
        onStripContextMenu : function(e){
18601
        e.preventDefault();
18602
        var t = this.findTargets(e);
18603
        if(t.item){
18604
            this.fireEvent('contextmenu', this, t.item, e);
18605
        }
18606
    },
18607
 
18608
 
18609
    readTabs : function(removeExisting){
18610
        if(removeExisting === true){
18611
            this.items.each(function(item){
18612
                this.remove(item);
18613
            }, this);
18614
        }
18615
        var tabs = this.el.query(this.autoTabSelector);
18616
        for(var i = 0, len = tabs.length; i < len; i++){
18617
            var tab = tabs[i];
18618
            var title = tab.getAttribute('title');
18619
            tab.removeAttribute('title');
18620
            this.add({
18621
                title: title,
18622
                el: tab
18623
            });
18624
        }
18625
    },
18626
 
18627
        initTab : function(item, index){
18628
        var before = this.strip.dom.childNodes[index];
18629
        var cls = item.closable ? 'x-tab-strip-closable' : '';
18630
        if(item.disabled){
18631
            cls += ' x-item-disabled';
18632
        }
18633
        if(item.iconCls){
18634
            cls += ' x-tab-with-icon';
18635
        }
18636
        if(item.tabCls){
18637
            cls += ' ' + item.tabCls;
18638
        }
18639
 
18640
        var p = {
18641
            id: this.id + this.idDelimiter + item.getItemId(),
18642
            text: item.title,
18643
            cls: cls,
18644
            iconCls: item.iconCls || ''
18645
        };
18646
        var el = before ?
18647
                 this.itemTpl.insertBefore(before, p) :
18648
                 this.itemTpl.append(this.strip, p);
18649
 
18650
        Ext.fly(el).addClassOnOver('x-tab-strip-over');
18651
 
18652
        if(item.tabTip){
18653
            Ext.fly(el).child('span.x-tab-strip-text', true).qtip = item.tabTip;
18654
        }
18655
        item.on('disable', this.onItemDisabled, this);
18656
        item.on('enable', this.onItemEnabled, this);
18657
        item.on('titlechange', this.onItemTitleChanged, this);
18658
        item.on('beforeshow', this.onBeforeShowItem, this);
18659
    },
18660
 
18661
        onAdd : function(tp, item, index){
18662
        this.initTab(item, index);
18663
        if(this.items.getCount() == 1){
18664
            this.syncSize();
18665
        }
18666
        this.delegateUpdates();
18667
    },
18668
 
18669
        onBeforeAdd : function(item){
18670
        var existing = item.events ? (this.items.containsKey(item.getItemId()) ? item : null) : this.items.get(item);
18671
        if(existing){
18672
            this.setActiveTab(item);
18673
            return false;
18674
        }
18675
        Ext.TabPanel.superclass.onBeforeAdd.apply(this, arguments);
18676
        var es = item.elements;
18677
        item.elements = es ? es.replace(',header', '') : es;
18678
        item.border = (item.border === true);
18679
    },
18680
 
18681
        onRemove : function(tp, item){
18682
        Ext.removeNode(this.getTabEl(item));
18683
        this.stack.remove(item);
18684
        if(item == this.activeTab){
18685
            var next = this.stack.next();
18686
            if(next){
18687
                this.setActiveTab(next);
18688
            }else{
18689
                this.setActiveTab(0);
18690
            }
18691
        }
18692
        this.delegateUpdates();
18693
    },
18694
 
18695
        onBeforeShowItem : function(item){
18696
        if(item != this.activeTab){
18697
            this.setActiveTab(item);
18698
            return false;
18699
        }
18700
    },
18701
 
18702
        onItemDisabled : function(item){
18703
        var el = this.getTabEl(item);
18704
        if(el){
18705
            Ext.fly(el).addClass('x-item-disabled');
18706
        }
18707
        this.stack.remove(item);
18708
    },
18709
 
18710
        onItemEnabled : function(item){
18711
        var el = this.getTabEl(item);
18712
        if(el){
18713
            Ext.fly(el).removeClass('x-item-disabled');
18714
        }
18715
    },
18716
 
18717
        onItemTitleChanged : function(item){
18718
        var el = this.getTabEl(item);
18719
        if(el){
18720
            Ext.fly(el).child('span.x-tab-strip-text', true).innerHTML = item.title;
18721
        }
18722
    },
18723
 
18724
 
18725
    getTabEl : function(item){
18726
        var itemId = (typeof item === 'number')?this.items.items[item].getItemId() : item.getItemId();
18727
        return document.getElementById(this.id+this.idDelimiter+itemId);
18728
    },
18729
 
18730
        onResize : function(){
18731
        Ext.TabPanel.superclass.onResize.apply(this, arguments);
18732
        this.delegateUpdates();
18733
    },
18734
 
18735
 
18736
    beginUpdate : function(){
18737
        this.suspendUpdates = true;
18738
    },
18739
 
18740
 
18741
    endUpdate : function(){
18742
        this.suspendUpdates = false;
18743
        this.delegateUpdates();
18744
    },
18745
 
18746
 
18747
    hideTabStripItem : function(item){
18748
        item = this.getComponent(item);
18749
        var el = this.getTabEl(item);
18750
        if(el){
18751
            el.style.display = 'none';
18752
            this.delegateUpdates();
18753
        }
18754
    },
18755
 
18756
 
18757
    unhideTabStripItem : function(item){
18758
        item = this.getComponent(item);
18759
        var el = this.getTabEl(item);
18760
        if(el){
18761
            el.style.display = '';
18762
            this.delegateUpdates();
18763
        }
18764
    },
18765
 
18766
        delegateUpdates : function(){
18767
        if(this.suspendUpdates){
18768
            return;
18769
        }
18770
        if(this.resizeTabs && this.rendered){
18771
            this.autoSizeTabs();
18772
        }
18773
        if(this.enableTabScroll && this.rendered){
18774
            this.autoScrollTabs();
18775
        }
18776
    },
18777
 
18778
        autoSizeTabs : function(){
18779
        var count = this.items.length;
18780
        var ce = this.tabPosition != 'bottom' ? 'header' : 'footer';
18781
        var ow = this[ce].dom.offsetWidth;
18782
        var aw = this[ce].dom.clientWidth;
18783
 
18784
        if(!this.resizeTabs || count < 1 || !aw){             return;
18785
        }
18786
 
18787
        var each = Math.max(Math.min(Math.floor((aw-4) / count) - this.tabMargin, this.tabWidth), this.minTabWidth);         this.lastTabWidth = each;
18788
        var lis = this.stripWrap.dom.getElementsByTagName('li');
18789
        for(var i = 0, len = lis.length-1; i < len; i++) {             var li = lis[i];
18790
            var inner = li.childNodes[1].firstChild.firstChild;
18791
            var tw = li.offsetWidth;
18792
            var iw = inner.offsetWidth;
18793
            inner.style.width = (each - (tw-iw)) + 'px';
18794
        }
18795
    },
18796
 
18797
        adjustBodyWidth : function(w){
18798
        if(this.header){
18799
            this.header.setWidth(w);
18800
        }
18801
        if(this.footer){
18802
            this.footer.setWidth(w);
18803
        }
18804
        return w;
18805
    },
18806
 
18807
 
18808
    setActiveTab : function(item){
18809
        item = this.getComponent(item);
18810
        if(!item || this.fireEvent('beforetabchange', this, item, this.activeTab) === false){
18811
            return;
18812
        }
18813
        if(!this.rendered){
18814
            this.activeTab = item;
18815
            return;
18816
        }
18817
        if(this.activeTab != item){
18818
            if(this.activeTab){
18819
                var oldEl = this.getTabEl(this.activeTab);
18820
                if(oldEl){
18821
                    Ext.fly(oldEl).removeClass('x-tab-strip-active');
18822
                }
18823
                this.activeTab.fireEvent('deactivate', this.activeTab);
18824
            }
18825
            var el = this.getTabEl(item);
18826
            Ext.fly(el).addClass('x-tab-strip-active');
18827
            this.activeTab = item;
18828
            this.stack.add(item);
18829
 
18830
            this.layout.setActiveItem(item);
18831
            if(this.layoutOnTabChange && item.doLayout){
18832
                item.doLayout();
18833
            }
18834
            if(this.scrolling){
18835
                this.scrollToTab(item, this.animScroll);
18836
            }
18837
 
18838
            item.fireEvent('activate', item);
18839
            this.fireEvent('tabchange', this, item);
18840
        }
18841
    },
18842
 
18843
 
18844
    getActiveTab : function(){
18845
        return this.activeTab || null;
18846
    },
18847
 
18848
 
18849
    getItem : function(item){
18850
        return this.getComponent(item);
18851
    },
18852
 
18853
        autoScrollTabs : function(){
18854
        var count = this.items.length;
18855
        var ow = this.header.dom.offsetWidth;
18856
        var tw = this.header.dom.clientWidth;
18857
 
18858
        var wrap = this.stripWrap;
18859
        var wd = wrap.dom;
18860
        var cw = wd.offsetWidth;
18861
        var pos = this.getScrollPos();
18862
        var l = this.edge.getOffsetsTo(this.stripWrap)[0] + pos;
18863
 
18864
        if(!this.enableTabScroll || count < 1 || cw < 20){             return;
18865
        }
18866
        if(l <= tw){
18867
            wd.scrollLeft = 0;
18868
            wrap.setWidth(tw);
18869
            if(this.scrolling){
18870
                this.scrolling = false;
18871
                this.header.removeClass('x-tab-scrolling');
18872
                this.scrollLeft.hide();
18873
                this.scrollRight.hide();
18874
                if(Ext.isAir){
18875
                    wd.style.marginLeft = '';
18876
                    wd.style.marginRight = '';
18877
                }
18878
            }
18879
        }else{
18880
            if(!this.scrolling){
18881
                this.header.addClass('x-tab-scrolling');
18882
                if(Ext.isAir){
18883
                    wd.style.marginLeft = '18px';
18884
                    wd.style.marginRight = '18px';
18885
                }
18886
            }
18887
            tw -= wrap.getMargins('lr');
18888
            wrap.setWidth(tw > 20 ? tw : 20);
18889
            if(!this.scrolling){
18890
                if(!this.scrollLeft){
18891
                    this.createScrollers();
18892
                }else{
18893
                    this.scrollLeft.show();
18894
                    this.scrollRight.show();
18895
                }
18896
            }
18897
            this.scrolling = true;
18898
            if(pos > (l-tw)){                 wd.scrollLeft = l-tw;
18899
            }else{                 this.scrollToTab(this.activeTab, false);
18900
            }
18901
            this.updateScrollButtons();
18902
        }
18903
    },
18904
 
18905
        createScrollers : function(){
18906
        var h = this.stripWrap.dom.offsetHeight;
18907
 
18908
                var sl = this.header.insertFirst({
18909
            cls:'x-tab-scroller-left'
18910
        });
18911
        sl.setHeight(h);
18912
        sl.addClassOnOver('x-tab-scroller-left-over');
18913
        this.leftRepeater = new Ext.util.ClickRepeater(sl, {
18914
            interval : this.scrollRepeatInterval,
18915
            handler: this.onScrollLeft,
18916
            scope: this
18917
        });
18918
        this.scrollLeft = sl;
18919
 
18920
                var sr = this.header.insertFirst({
18921
            cls:'x-tab-scroller-right'
18922
        });
18923
        sr.setHeight(h);
18924
        sr.addClassOnOver('x-tab-scroller-right-over');
18925
        this.rightRepeater = new Ext.util.ClickRepeater(sr, {
18926
            interval : this.scrollRepeatInterval,
18927
            handler: this.onScrollRight,
18928
            scope: this
18929
        });
18930
        this.scrollRight = sr;
18931
    },
18932
 
18933
        getScrollWidth : function(){
18934
        return this.edge.getOffsetsTo(this.stripWrap)[0] + this.getScrollPos();
18935
    },
18936
 
18937
        getScrollPos : function(){
18938
        return parseInt(this.stripWrap.dom.scrollLeft, 10) || 0;
18939
    },
18940
 
18941
        getScrollArea : function(){
18942
        return parseInt(this.stripWrap.dom.clientWidth, 10) || 0;
18943
    },
18944
 
18945
        getScrollAnim : function(){
18946
        return {duration:this.scrollDuration, callback: this.updateScrollButtons, scope: this};
18947
    },
18948
 
18949
        getScrollIncrement : function(){
18950
        return this.scrollIncrement || (this.resizeTabs ? this.lastTabWidth+2 : 100);
18951
    },
18952
 
18953
 
18954
 
18955
    scrollToTab : function(item, animate){
18956
        if(!item){ return; }
18957
        var el = this.getTabEl(item);
18958
        var pos = this.getScrollPos(), area = this.getScrollArea();
18959
        var left = Ext.fly(el).getOffsetsTo(this.stripWrap)[0] + pos;
18960
        var right = left + el.offsetWidth;
18961
        if(left < pos){
18962
            this.scrollTo(left, animate);
18963
        }else if(right > (pos + area)){
18964
            this.scrollTo(right - area, animate);
18965
        }
18966
    },
18967
 
18968
        scrollTo : function(pos, animate){
18969
        this.stripWrap.scrollTo('left', pos, animate ? this.getScrollAnim() : false);
18970
        if(!animate){
18971
            this.updateScrollButtons();
18972
        }
18973
    },
18974
 
18975
    onWheel : function(e){
18976
        var d = e.getWheelDelta()*this.wheelIncrement*-1;
18977
        e.stopEvent();
18978
 
18979
        var pos = this.getScrollPos();
18980
        var newpos = pos + d;
18981
        var sw = this.getScrollWidth()-this.getScrollArea();
18982
 
18983
        var s = Math.max(0, Math.min(sw, newpos));
18984
        if(s != pos){
18985
            this.scrollTo(s, false);
18986
        }
18987
    },
18988
 
18989
        onScrollRight : function(){
18990
        var sw = this.getScrollWidth()-this.getScrollArea();
18991
        var pos = this.getScrollPos();
18992
        var s = Math.min(sw, pos + this.getScrollIncrement());
18993
        if(s != pos){
18994
            this.scrollTo(s, this.animScroll);
18995
        }
18996
    },
18997
 
18998
        onScrollLeft : function(){
18999
        var pos = this.getScrollPos();
19000
        var s = Math.max(0, pos - this.getScrollIncrement());
19001
        if(s != pos){
19002
            this.scrollTo(s, this.animScroll);
19003
        }
19004
    },
19005
 
19006
        updateScrollButtons : function(){
19007
        var pos = this.getScrollPos();
19008
        this.scrollLeft[pos == 0 ? 'addClass' : 'removeClass']('x-tab-scroller-left-disabled');
19009
        this.scrollRight[pos >= (this.getScrollWidth()-this.getScrollArea()) ? 'addClass' : 'removeClass']('x-tab-scroller-right-disabled');
19010
    }
19011
 
19012
 
19013
 
19014
 
19015
 
19016
 
19017
 
19018
 
19019
 
19020
 
19021
 
19022
});
19023
Ext.reg('tabpanel', Ext.TabPanel);
19024
 
19025
 
19026
Ext.TabPanel.prototype.activate = Ext.TabPanel.prototype.setActiveTab;
19027
 
19028
Ext.TabPanel.AccessStack = function(){
19029
    var items = [];
19030
    return {
19031
        add : function(item){
19032
            items.push(item);
19033
            if(items.length > 10){
19034
                items.shift();
19035
            }
19036
        },
19037
 
19038
        remove : function(item){
19039
            var s = [];
19040
            for(var i = 0, len = items.length; i < len; i++) {
19041
                if(items[i] != item){
19042
                    s.push(items[i]);
19043
                }
19044
            }
19045
            items = s;
19046
        },
19047
 
19048
        next : function(){
19049
            return items.pop();
19050
        }
19051
    };
19052
};
19053
 
19054
 
19055
 
19056
 
19057
Ext.Button = Ext.extend(Ext.Component, {
19058
 
19059
    hidden : false,
19060
 
19061
    disabled : false,
19062
 
19063
    pressed : false,
19064
 
19065
 
19066
 
19067
 
19068
 
19069
    enableToggle: false,
19070
 
19071
 
19072
    menuAlign : "tl-bl?",
19073
 
19074
 
19075
 
19076
    type : 'button',
19077
 
19078
        menuClassTarget: 'tr',
19079
 
19080
 
19081
    clickEvent : 'click',
19082
 
19083
 
19084
    handleMouseEvents : true,
19085
 
19086
 
19087
    tooltipType : 'qtip',
19088
 
19089
    buttonSelector : "button:first",
19090
 
19091
 
19092
 
19093
 
19094
    initComponent : function(){
19095
        Ext.Button.superclass.initComponent.call(this);
19096
 
19097
        this.addEvents(
19098
 
19099
            "click",
19100
 
19101
            "toggle",
19102
 
19103
            'mouseover',
19104
 
19105
            'mouseout',
19106
 
19107
            'menushow',
19108
 
19109
            'menuhide',
19110
 
19111
            'menutriggerover',
19112
 
19113
            'menutriggerout'
19114
        );
19115
        if(this.menu){
19116
            this.menu = Ext.menu.MenuMgr.get(this.menu);
19117
        }
19118
        if(typeof this.toggleGroup === 'string'){
19119
            this.enableToggle = true;
19120
        }
19121
    },
19122
 
19123
        onRender : function(ct, position){
19124
        if(!this.template){
19125
            if(!Ext.Button.buttonTemplate){
19126
                                Ext.Button.buttonTemplate = new Ext.Template(
19127
                    '<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>',
19128
                    '<td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><em unselectable="on"><button class="x-btn-text" type="{1}">{0}</button></em></td><td class="x-btn-right"><i>&#160;</i></td>',
19129
                    "</tr></tbody></table>");
19130
            }
19131
            this.template = Ext.Button.buttonTemplate;
19132
        }
19133
        var btn, targs = [this.text || '&#160;', this.type];
19134
 
19135
        if(position){
19136
            btn = this.template.insertBefore(position, targs, true);
19137
        }else{
19138
            btn = this.template.append(ct, targs, true);
19139
        }
19140
        var btnEl = btn.child(this.buttonSelector);
19141
        btnEl.on('focus', this.onFocus, this);
19142
        btnEl.on('blur', this.onBlur, this);
19143
 
19144
        this.initButtonEl(btn, btnEl);
19145
 
19146
        if(this.menu){
19147
            this.el.child(this.menuClassTarget).addClass("x-btn-with-menu");
19148
        }
19149
        Ext.ButtonToggleMgr.register(this);
19150
    },
19151
 
19152
        initButtonEl : function(btn, btnEl){
19153
 
19154
        this.el = btn;
19155
        btn.addClass("x-btn");
19156
 
19157
        if(this.icon){
19158
            btnEl.setStyle('background-image', 'url(' +this.icon +')');
19159
        }
19160
        if(this.iconCls){
19161
            btnEl.addClass(this.iconCls);
19162
            if(!this.cls){
19163
                btn.addClass(this.text ? 'x-btn-text-icon' : 'x-btn-icon');
19164
            }
19165
        }
19166
        if(this.tabIndex !== undefined){
19167
            btnEl.dom.tabIndex = this.tabIndex;
19168
        }
19169
        if(this.tooltip){
19170
            if(typeof this.tooltip == 'object'){
19171
                Ext.QuickTips.register(Ext.apply({
19172
                      target: btnEl.id
19173
                }, this.tooltip));
19174
            } else {
19175
                btnEl.dom[this.tooltipType] = this.tooltip;
19176
            }
19177
        }
19178
 
19179
        if(this.pressed){
19180
            this.el.addClass("x-btn-pressed");
19181
        }
19182
 
19183
        if(this.handleMouseEvents){
19184
            btn.on("mouseover", this.onMouseOver, this);
19185
                                    btn.on("mousedown", this.onMouseDown, this);
19186
        }
19187
 
19188
        if(this.menu){
19189
            this.menu.on("show", this.onMenuShow, this);
19190
            this.menu.on("hide", this.onMenuHide, this);
19191
        }
19192
 
19193
        if(this.id){
19194
            this.el.dom.id = this.el.id = this.id;
19195
        }
19196
 
19197
        if(this.repeat){
19198
            var repeater = new Ext.util.ClickRepeater(btn,
19199
                typeof this.repeat == "object" ? this.repeat : {}
19200
            );
19201
            repeater.on("click", this.onClick,  this);
19202
        }
19203
 
19204
        btn.on(this.clickEvent, this.onClick, this);
19205
    },
19206
 
19207
        afterRender : function(){
19208
        Ext.Button.superclass.afterRender.call(this);
19209
        if(Ext.isIE6){
19210
            this.autoWidth.defer(1, this);
19211
        }else{
19212
            this.autoWidth();
19213
        }
19214
    },
19215
 
19216
 
19217
    setIconClass : function(cls){
19218
        if(this.el){
19219
            this.el.child(this.buttonSelector).replaceClass(this.iconCls, cls);
19220
        }
19221
        this.iconCls = cls;
19222
    },
19223
 
19224
        beforeDestroy: function(){
19225
    	if(this.rendered){
19226
	        var btn = this.el.child(this.buttonSelector);
19227
	        if(btn){
19228
	            btn.removeAllListeners();
19229
	        }
19230
	    }
19231
        if(this.menu){
19232
            Ext.destroy(this.menu);
19233
        }
19234
    },
19235
 
19236
        onDestroy : function(){
19237
        if(this.rendered){
19238
            Ext.ButtonToggleMgr.unregister(this);
19239
        }
19240
    },
19241
 
19242
        autoWidth : function(){
19243
        if(this.el){
19244
            this.el.setWidth("auto");
19245
            if(Ext.isIE7 && Ext.isStrict){
19246
                var ib = this.el.child(this.buttonSelector);
19247
                if(ib && ib.getWidth() > 20){
19248
                    ib.clip();
19249
                    ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr'));
19250
                }
19251
            }
19252
            if(this.minWidth){
19253
                if(this.el.getWidth() < this.minWidth){
19254
                    this.el.setWidth(this.minWidth);
19255
                }
19256
            }
19257
        }
19258
    },
19259
 
19260
 
19261
    setHandler : function(handler, scope){
19262
        this.handler = handler;
19263
        this.scope = scope;
19264
    },
19265
 
19266
 
19267
    setText : function(text){
19268
        this.text = text;
19269
        if(this.el){
19270
            this.el.child("td.x-btn-center " + this.buttonSelector).update(text);
19271
        }
19272
        this.autoWidth();
19273
    },
19274
 
19275
 
19276
    getText : function(){
19277
        return this.text;
19278
    },
19279
 
19280
 
19281
    toggle : function(state){
19282
        state = state === undefined ? !this.pressed : state;
19283
        if(state != this.pressed){
19284
            if(state){
19285
                this.el.addClass("x-btn-pressed");
19286
                this.pressed = true;
19287
                this.fireEvent("toggle", this, true);
19288
            }else{
19289
                this.el.removeClass("x-btn-pressed");
19290
                this.pressed = false;
19291
                this.fireEvent("toggle", this, false);
19292
            }
19293
            if(this.toggleHandler){
19294
                this.toggleHandler.call(this.scope || this, this, state);
19295
            }
19296
        }
19297
    },
19298
 
19299
 
19300
    focus : function(){
19301
        this.el.child(this.buttonSelector).focus();
19302
    },
19303
 
19304
        onDisable : function(){
19305
        if(this.el){
19306
            if(!Ext.isIE6 || !this.text){
19307
                this.el.addClass(this.disabledClass);
19308
            }
19309
            this.el.dom.disabled = true;
19310
        }
19311
        this.disabled = true;
19312
    },
19313
 
19314
        onEnable : function(){
19315
        if(this.el){
19316
            if(!Ext.isIE6 || !this.text){
19317
                this.el.removeClass(this.disabledClass);
19318
            }
19319
            this.el.dom.disabled = false;
19320
        }
19321
        this.disabled = false;
19322
    },
19323
 
19324
 
19325
    showMenu : function(){
19326
        if(this.menu){
19327
            this.menu.show(this.el, this.menuAlign);
19328
        }
19329
        return this;
19330
    },
19331
 
19332
 
19333
    hideMenu : function(){
19334
        if(this.menu){
19335
            this.menu.hide();
19336
        }
19337
        return this;
19338
    },
19339
 
19340
 
19341
    hasVisibleMenu : function(){
19342
        return this.menu && this.menu.isVisible();
19343
    },
19344
 
19345
        onClick : function(e){
19346
        if(e){
19347
            e.preventDefault();
19348
        }
19349
        if(e.button != 0){
19350
            return;
19351
        }
19352
        if(!this.disabled){
19353
            if(this.enableToggle && (this.allowDepress !== false || !this.pressed)){
19354
                this.toggle();
19355
            }
19356
            if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){
19357
                this.showMenu();
19358
            }
19359
            this.fireEvent("click", this, e);
19360
            if(this.handler){
19361
                                this.handler.call(this.scope || this, this, e);
19362
            }
19363
        }
19364
    },
19365
 
19366
        isMenuTriggerOver : function(e, internal){
19367
        return this.menu && !internal;
19368
    },
19369
 
19370
        isMenuTriggerOut : function(e, internal){
19371
        return this.menu && !internal;
19372
    },
19373
 
19374
        onMouseOver : function(e){
19375
        if(!this.disabled){
19376
            var internal = e.within(this.el,  true);
19377
            if(!internal){
19378
                this.el.addClass("x-btn-over");
19379
                Ext.getDoc().on('mouseover', this.monitorMouseOver, this);
19380
                this.fireEvent('mouseover', this, e);
19381
            }
19382
            if(this.isMenuTriggerOver(e, internal)){
19383
                this.fireEvent('menutriggerover', this, this.menu, e);
19384
            }
19385
        }
19386
    },
19387
 
19388
        monitorMouseOver : function(e){
19389
        if(e.target != this.el.dom && !e.within(this.el)){
19390
            Ext.getDoc().un('mouseover', this.monitorMouseOver, this);
19391
            this.onMouseOut(e);
19392
        }
19393
    },
19394
 
19395
        onMouseOut : function(e){
19396
        var internal = e.within(this.el) && e.target != this.el.dom;
19397
        this.el.removeClass("x-btn-over");
19398
        this.fireEvent('mouseout', this, e);
19399
        if(this.isMenuTriggerOut(e, internal)){
19400
            this.fireEvent('menutriggerout', this, this.menu, e);
19401
        }
19402
    },
19403
        onFocus : function(e){
19404
        if(!this.disabled){
19405
            this.el.addClass("x-btn-focus");
19406
        }
19407
    },
19408
        onBlur : function(e){
19409
        this.el.removeClass("x-btn-focus");
19410
    },
19411
 
19412
        getClickEl : function(e, isUp){
19413
       return this.el;
19414
    },
19415
 
19416
        onMouseDown : function(e){
19417
        if(!this.disabled && e.button == 0){
19418
            this.getClickEl(e).addClass("x-btn-click");
19419
            Ext.getDoc().on('mouseup', this.onMouseUp, this);
19420
        }
19421
    },
19422
        onMouseUp : function(e){
19423
        if(e.button == 0){
19424
            this.getClickEl(e, true).removeClass("x-btn-click");
19425
            Ext.getDoc().un('mouseup', this.onMouseUp, this);
19426
        }
19427
    },
19428
        onMenuShow : function(e){
19429
        this.ignoreNextClick = 0;
19430
        this.el.addClass("x-btn-menu-active");
19431
        this.fireEvent('menushow', this, this.menu);
19432
    },
19433
        onMenuHide : function(e){
19434
        this.el.removeClass("x-btn-menu-active");
19435
        this.ignoreNextClick = this.restoreClick.defer(250, this);
19436
        this.fireEvent('menuhide', this, this.menu);
19437
    },
19438
 
19439
        restoreClick : function(){
19440
        this.ignoreNextClick = 0;
19441
    }
19442
 
19443
 
19444
 
19445
 
19446
});
19447
Ext.reg('button', Ext.Button);
19448
 
19449
Ext.ButtonToggleMgr = function(){
19450
   var groups = {};
19451
 
19452
   function toggleGroup(btn, state){
19453
       if(state){
19454
           var g = groups[btn.toggleGroup];
19455
           for(var i = 0, l = g.length; i < l; i++){
19456
               if(g[i] != btn){
19457
                   g[i].toggle(false);
19458
               }
19459
           }
19460
       }
19461
   }
19462
 
19463
   return {
19464
       register : function(btn){
19465
           if(!btn.toggleGroup){
19466
               return;
19467
           }
19468
           var g = groups[btn.toggleGroup];
19469
           if(!g){
19470
               g = groups[btn.toggleGroup] = [];
19471
           }
19472
           g.push(btn);
19473
           btn.on("toggle", toggleGroup);
19474
       },
19475
 
19476
       unregister : function(btn){
19477
           if(!btn.toggleGroup){
19478
               return;
19479
           }
19480
           var g = groups[btn.toggleGroup];
19481
           if(g){
19482
               g.remove(btn);
19483
               btn.un("toggle", toggleGroup);
19484
           }
19485
       }
19486
   };
19487
}();
19488
 
19489
Ext.SplitButton = Ext.extend(Ext.Button, {
19490
 
19491
    arrowSelector : 'button:last',
19492
 
19493
 
19494
    initComponent : function(){
19495
        Ext.SplitButton.superclass.initComponent.call(this);
19496
 
19497
        this.addEvents("arrowclick");
19498
    },
19499
 
19500
 
19501
    onRender : function(ct, position){
19502
 
19503
        var tpl = new Ext.Template(
19504
            '<table cellspacing="0" class="x-btn-menu-wrap x-btn"><tr><td>',
19505
            '<table cellspacing="0" class="x-btn-wrap x-btn-menu-text-wrap"><tbody>',
19506
            '<tr><td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><button class="x-btn-text" type="{1}">{0}</button></td></tr>',
19507
            "</tbody></table></td><td>",
19508
            '<table cellspacing="0" class="x-btn-wrap x-btn-menu-arrow-wrap"><tbody>',
19509
            '<tr><td class="x-btn-center"><button class="x-btn-menu-arrow-el" type="button">&#160;</button></td><td class="x-btn-right"><i>&#160;</i></td></tr>',
19510
            "</tbody></table></td></tr></table>"
19511
        );
19512
        var btn, targs = [this.text || '&#160;', this.type];
19513
        if(position){
19514
            btn = tpl.insertBefore(position, targs, true);
19515
        }else{
19516
            btn = tpl.append(ct, targs, true);
19517
        }
19518
        var btnEl = btn.child(this.buttonSelector);
19519
 
19520
        this.initButtonEl(btn, btnEl);
19521
        this.arrowBtnTable = btn.child("table:last");
19522
        if(this.arrowTooltip){
19523
            btn.child(this.arrowSelector).dom[this.tooltipType] = this.arrowTooltip;
19524
        }
19525
    },
19526
 
19527
 
19528
    autoWidth : function(){
19529
        if(this.el){
19530
            var tbl = this.el.child("table:first");
19531
            var tbl2 = this.el.child("table:last");
19532
            this.el.setWidth("auto");
19533
            tbl.setWidth("auto");
19534
            if(Ext.isIE7 && Ext.isStrict){
19535
                var ib = this.el.child(this.buttonSelector);
19536
                if(ib && ib.getWidth() > 20){
19537
                    ib.clip();
19538
                    ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr'));
19539
                }
19540
            }
19541
            if(this.minWidth){
19542
                if((tbl.getWidth()+tbl2.getWidth()) < this.minWidth){
19543
                    tbl.setWidth(this.minWidth-tbl2.getWidth());
19544
                }
19545
            }
19546
            this.el.setWidth(tbl.getWidth()+tbl2.getWidth());
19547
        }
19548
    },
19549
 
19550
 
19551
    setArrowHandler : function(handler, scope){
19552
        this.arrowHandler = handler;
19553
        this.scope = scope;
19554
    },
19555
 
19556
 
19557
    onClick : function(e){
19558
        e.preventDefault();
19559
        if(!this.disabled){
19560
            if(e.getTarget(".x-btn-menu-arrow-wrap")){
19561
                if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){
19562
                    this.showMenu();
19563
                }
19564
                this.fireEvent("arrowclick", this, e);
19565
                if(this.arrowHandler){
19566
                    this.arrowHandler.call(this.scope || this, this, e);
19567
                }
19568
            }else{
19569
                if(this.enableToggle){
19570
                    this.toggle();
19571
                }
19572
                this.fireEvent("click", this, e);
19573
                if(this.handler){
19574
                    this.handler.call(this.scope || this, this, e);
19575
                }
19576
            }
19577
        }
19578
    },
19579
 
19580
 
19581
    getClickEl : function(e, isUp){
19582
        if(!isUp){
19583
            return (this.lastClickEl = e.getTarget("table", 10, true));
19584
        }
19585
        return this.lastClickEl;
19586
    },
19587
 
19588
 
19589
    onDisable : function(){
19590
        if(this.el){
19591
            if(!Ext.isIE6){
19592
                this.el.addClass("x-item-disabled");
19593
            }
19594
            this.el.child(this.buttonSelector).dom.disabled = true;
19595
            this.el.child(this.arrowSelector).dom.disabled = true;
19596
        }
19597
        this.disabled = true;
19598
    },
19599
 
19600
 
19601
    onEnable : function(){
19602
        if(this.el){
19603
            if(!Ext.isIE6){
19604
                this.el.removeClass("x-item-disabled");
19605
            }
19606
            this.el.child(this.buttonSelector).dom.disabled = false;
19607
            this.el.child(this.arrowSelector).dom.disabled = false;
19608
        }
19609
        this.disabled = false;
19610
    },
19611
 
19612
 
19613
    isMenuTriggerOver : function(e){
19614
        return this.menu && e.within(this.arrowBtnTable) && !e.within(this.arrowBtnTable, true);
19615
    },
19616
 
19617
 
19618
    isMenuTriggerOut : function(e, internal){
19619
        return this.menu && !e.within(this.arrowBtnTable);
19620
    },
19621
 
19622
 
19623
    onDestroy : function(){
19624
        Ext.destroy(this.arrowBtnTable);
19625
        Ext.SplitButton.superclass.onDestroy.call(this);
19626
    }
19627
});
19628
 
19629
 
19630
Ext.MenuButton = Ext.SplitButton;
19631
 
19632
 
19633
Ext.reg('splitbutton', Ext.SplitButton);
19634
 
19635
Ext.CycleButton = Ext.extend(Ext.SplitButton, {
19636
 
19637
 
19638
 
19639
 
19640
 
19641
 
19642
 
19643
    getItemText : function(item){
19644
        if(item && this.showText === true){
19645
            var text = '';
19646
            if(this.prependText){
19647
                text += this.prependText;
19648
            }
19649
            text += item.text;
19650
            return text;
19651
        }
19652
        return undefined;
19653
    },
19654
 
19655
 
19656
    setActiveItem : function(item, suppressEvent){
19657
        if(typeof item != 'object'){
19658
            item = this.menu.items.get(item);
19659
        }
19660
        if(item){
19661
            if(!this.rendered){
19662
                this.text = this.getItemText(item);
19663
                this.iconCls = item.iconCls;
19664
            }else{
19665
                var t = this.getItemText(item);
19666
                if(t){
19667
                    this.setText(t);
19668
                }
19669
                this.setIconClass(item.iconCls);
19670
            }
19671
            this.activeItem = item;
19672
            if(!item.checked){
19673
                item.setChecked(true, true);
19674
            }
19675
            if(this.forceIcon){
19676
                this.setIconClass(this.forceIcon);
19677
            }
19678
            if(!suppressEvent){
19679
                this.fireEvent('change', this, item);
19680
            }
19681
        }
19682
    },
19683
 
19684
 
19685
    getActiveItem : function(){
19686
        return this.activeItem;
19687
    },
19688
 
19689
 
19690
    initComponent : function(){
19691
        this.addEvents(
19692
 
19693
            "change"
19694
        );
19695
 
19696
        if(this.changeHandler){
19697
            this.on('change', this.changeHandler, this.scope||this);
19698
            delete this.changeHandler;
19699
        }
19700
 
19701
        this.itemCount = this.items.length;
19702
 
19703
        this.menu = {cls:'x-cycle-menu', items:[]};
19704
        var checked;
19705
        for(var i = 0, len = this.itemCount; i < len; i++){
19706
            var item = this.items[i];
19707
            item.group = item.group || this.id;
19708
            item.itemIndex = i;
19709
            item.checkHandler = this.checkHandler;
19710
            item.scope = this;
19711
            item.checked = item.checked || false;
19712
            this.menu.items.push(item);
19713
            if(item.checked){
19714
                checked = item;
19715
            }
19716
        }
19717
        this.setActiveItem(checked, true);
19718
        Ext.CycleButton.superclass.initComponent.call(this);
19719
 
19720
        this.on('click', this.toggleSelected, this);
19721
    },
19722
 
19723
 
19724
    checkHandler : function(item, pressed){
19725
        if(pressed){
19726
            this.setActiveItem(item);
19727
        }
19728
    },
19729
 
19730
 
19731
    toggleSelected : function(){
19732
        this.menu.render();
19733
 
19734
		var nextIdx, checkItem;
19735
		for (var i = 1; i < this.itemCount; i++) {
19736
			nextIdx = (this.activeItem.itemIndex + i) % this.itemCount;
19737
 
19738
			checkItem = this.menu.items.itemAt(nextIdx);
19739
 
19740
			if (!checkItem.disabled) {
19741
				checkItem.setChecked(true);
19742
				break;
19743
			}
19744
		}
19745
    }
19746
});
19747
Ext.reg('cycle', Ext.CycleButton);
19748
 
19749
 Ext.Toolbar = function(config){
19750
    if(Ext.isArray(config)){
19751
        config = {buttons:config};
19752
    }
19753
    Ext.Toolbar.superclass.constructor.call(this, config);
19754
};
19755
 
19756
(function(){
19757
 
19758
var T = Ext.Toolbar;
19759
 
19760
Ext.extend(T, Ext.BoxComponent, {
19761
 
19762
    trackMenus : true,
19763
 
19764
 
19765
    initComponent : function(){
19766
        T.superclass.initComponent.call(this);
19767
 
19768
        if(this.items){
19769
            this.buttons = this.items;
19770
        }
19771
 
19772
        this.items = new Ext.util.MixedCollection(false, function(o){
19773
            return o.itemId || o.id || Ext.id();
19774
        });
19775
    },
19776
 
19777
 
19778
    autoCreate: {
19779
        cls:'x-toolbar x-small-editor',
19780
        html:'<table cellspacing="0"><tr></tr></table>'
19781
    },
19782
 
19783
 
19784
    onRender : function(ct, position){
19785
        this.el = ct.createChild(Ext.apply({ id: this.id },this.autoCreate), position);
19786
        this.tr = this.el.child("tr", true);
19787
    },
19788
 
19789
 
19790
    afterRender : function(){
19791
        T.superclass.afterRender.call(this);
19792
        if(this.buttons){
19793
            this.add.apply(this, this.buttons);
19794
            delete this.buttons;
19795
        }
19796
    },
19797
 
19798
 
19799
    add : function(){
19800
        var a = arguments, l = a.length;
19801
        for(var i = 0; i < l; i++){
19802
            var el = a[i];
19803
            if(el.isFormField){
19804
                this.addField(el);
19805
            }else if(el.render){
19806
                this.addItem(el);
19807
            }else if(typeof el == "string"){
19808
                if(el == "separator" || el == "-"){
19809
                    this.addSeparator();
19810
                }else if(el == " "){
19811
                    this.addSpacer();
19812
                }else if(el == "->"){
19813
                    this.addFill();
19814
                }else{
19815
                    this.addText(el);
19816
                }
19817
            }else if(el.tagName){
19818
                this.addElement(el);
19819
            }else if(typeof el == "object"){
19820
                if(el.xtype){
19821
                    this.addField(Ext.ComponentMgr.create(el, 'button'));
19822
                }else{
19823
                    this.addButton(el);
19824
                }
19825
            }
19826
        }
19827
    },
19828
 
19829
 
19830
    addSeparator : function(){
19831
        return this.addItem(new T.Separator());
19832
    },
19833
 
19834
 
19835
    addSpacer : function(){
19836
        return this.addItem(new T.Spacer());
19837
    },
19838
 
19839
 
19840
    addFill : function(){
19841
        return this.addItem(new T.Fill());
19842
    },
19843
 
19844
 
19845
    addElement : function(el){
19846
        return this.addItem(new T.Item(el));
19847
    },
19848
 
19849
 
19850
    addItem : function(item){
19851
        var td = this.nextBlock();
19852
        this.initMenuTracking(item);
19853
        item.render(td);
19854
        this.items.add(item);
19855
        return item;
19856
    },
19857
 
19858
 
19859
    addButton : function(config){
19860
        if(Ext.isArray(config)){
19861
            var buttons = [];
19862
            for(var i = 0, len = config.length; i < len; i++) {
19863
                buttons.push(this.addButton(config[i]));
19864
            }
19865
            return buttons;
19866
        }
19867
        var b = config;
19868
        if(!(config instanceof T.Button)){
19869
            b = config.split ?
19870
                new T.SplitButton(config) :
19871
                new T.Button(config);
19872
        }
19873
        var td = this.nextBlock();
19874
        this.initMenuTracking(b);
19875
        b.render(td);
19876
        this.items.add(b);
19877
        return b;
19878
    },
19879
 
19880
 
19881
    initMenuTracking : function(item){
19882
        if(this.trackMenus && item.menu){
19883
            item.on({
19884
                'menutriggerover' : this.onButtonTriggerOver,
19885
                'menushow' : this.onButtonMenuShow,
19886
                'menuhide' : this.onButtonMenuHide,
19887
                scope: this
19888
            })
19889
        }
19890
    },
19891
 
19892
 
19893
    addText : function(text){
19894
        return this.addItem(new T.TextItem(text));
19895
    },
19896
 
19897
 
19898
    insertButton : function(index, item){
19899
        if(Ext.isArray(item)){
19900
            var buttons = [];
19901
            for(var i = 0, len = item.length; i < len; i++) {
19902
               buttons.push(this.insertButton(index + i, item[i]));
19903
            }
19904
            return buttons;
19905
        }
19906
        if (!(item instanceof T.Button)){
19907
           item = new T.Button(item);
19908
        }
19909
        var td = document.createElement("td");
19910
        this.tr.insertBefore(td, this.tr.childNodes[index]);
19911
        this.initMenuTracking(item);
19912
        item.render(td);
19913
        this.items.insert(index, item);
19914
        return item;
19915
    },
19916
 
19917
 
19918
    addDom : function(config, returnEl){
19919
        var td = this.nextBlock();
19920
        Ext.DomHelper.overwrite(td, config);
19921
        var ti = new T.Item(td.firstChild);
19922
        ti.render(td);
19923
        this.items.add(ti);
19924
        return ti;
19925
    },
19926
 
19927
 
19928
    addField : function(field){
19929
        var td = this.nextBlock();
19930
        field.render(td);
19931
        var ti = new T.Item(td.firstChild);
19932
        ti.render(td);
19933
        this.items.add(ti);
19934
        return ti;
19935
    },
19936
 
19937
 
19938
    nextBlock : function(){
19939
        var td = document.createElement("td");
19940
        this.tr.appendChild(td);
19941
        return td;
19942
    },
19943
 
19944
 
19945
    onDestroy : function(){
19946
        Ext.Toolbar.superclass.onDestroy.call(this);
19947
        if(this.rendered){
19948
            if(this.items){
19949
                Ext.destroy.apply(Ext, this.items.items);
19950
            }
19951
            Ext.Element.uncache(this.tr);
19952
        }
19953
    },
19954
 
19955
 
19956
    onDisable : function(){
19957
        this.items.each(function(item){
19958
             if(item.disable){
19959
                 item.disable();
19960
             }
19961
        });
19962
    },
19963
 
19964
 
19965
    onEnable : function(){
19966
        this.items.each(function(item){
19967
             if(item.enable){
19968
                 item.enable();
19969
             }
19970
        });
19971
    },
19972
 
19973
 
19974
    onButtonTriggerOver : function(btn){
19975
        if(this.activeMenuBtn && this.activeMenuBtn != btn){
19976
            this.activeMenuBtn.hideMenu();
19977
            btn.showMenu();
19978
            this.activeMenuBtn = btn;
19979
        }
19980
    },
19981
 
19982
 
19983
    onButtonMenuShow : function(btn){
19984
        this.activeMenuBtn = btn;
19985
    },
19986
 
19987
 
19988
    onButtonMenuHide : function(btn){
19989
        delete this.activeMenuBtn;
19990
    }
19991
 
19992
 
19993
});
19994
Ext.reg('toolbar', Ext.Toolbar);
19995
 
19996
 
19997
T.Item = function(el){
19998
    this.el = Ext.getDom(el);
19999
    this.id = Ext.id(this.el);
20000
    this.hidden = false;
20001
};
20002
 
20003
T.Item.prototype = {
20004
 
20005
 
20006
    getEl : function(){
20007
       return this.el;
20008
    },
20009
 
20010
 
20011
    render : function(td){
20012
        this.td = td;
20013
        td.appendChild(this.el);
20014
    },
20015
 
20016
 
20017
    destroy : function(){
20018
        if(this.td && this.td.parentNode){
20019
            this.td.parentNode.removeChild(this.td);
20020
        }
20021
    },
20022
 
20023
 
20024
    show: function(){
20025
        this.hidden = false;
20026
        this.td.style.display = "";
20027
    },
20028
 
20029
 
20030
    hide: function(){
20031
        this.hidden = true;
20032
        this.td.style.display = "none";
20033
    },
20034
 
20035
 
20036
    setVisible: function(visible){
20037
        if(visible) {
20038
            this.show();
20039
        }else{
20040
            this.hide();
20041
        }
20042
    },
20043
 
20044
 
20045
    focus : function(){
20046
        Ext.fly(this.el).focus();
20047
    },
20048
 
20049
 
20050
    disable : function(){
20051
        Ext.fly(this.td).addClass("x-item-disabled");
20052
        this.disabled = true;
20053
        this.el.disabled = true;
20054
    },
20055
 
20056
 
20057
    enable : function(){
20058
        Ext.fly(this.td).removeClass("x-item-disabled");
20059
        this.disabled = false;
20060
        this.el.disabled = false;
20061
    }
20062
};
20063
Ext.reg('tbitem', T.Item);
20064
 
20065
 
20066
 
20067
T.Separator = function(){
20068
    var s = document.createElement("span");
20069
    s.className = "ytb-sep";
20070
    T.Separator.superclass.constructor.call(this, s);
20071
};
20072
Ext.extend(T.Separator, T.Item, {
20073
    enable:Ext.emptyFn,
20074
    disable:Ext.emptyFn,
20075
    focus:Ext.emptyFn
20076
});
20077
Ext.reg('tbseparator', T.Separator);
20078
 
20079
 
20080
T.Spacer = function(){
20081
    var s = document.createElement("div");
20082
    s.className = "ytb-spacer";
20083
    T.Spacer.superclass.constructor.call(this, s);
20084
};
20085
Ext.extend(T.Spacer, T.Item, {
20086
    enable:Ext.emptyFn,
20087
    disable:Ext.emptyFn,
20088
    focus:Ext.emptyFn
20089
});
20090
 
20091
Ext.reg('tbspacer', T.Spacer);
20092
 
20093
 
20094
T.Fill = Ext.extend(T.Spacer, {
20095
 
20096
    render : function(td){
20097
        td.style.width = '100%';
20098
        T.Fill.superclass.render.call(this, td);
20099
    }
20100
});
20101
Ext.reg('tbfill', T.Fill);
20102
 
20103
 
20104
T.TextItem = function(t){
20105
    var s = document.createElement("span");
20106
    s.className = "ytb-text";
20107
    s.innerHTML = t.text ? t.text : t;
20108
    T.TextItem.superclass.constructor.call(this, s);
20109
};
20110
Ext.extend(T.TextItem, T.Item, {
20111
    enable:Ext.emptyFn,
20112
    disable:Ext.emptyFn,
20113
    focus:Ext.emptyFn
20114
});
20115
Ext.reg('tbtext', T.TextItem);
20116
 
20117
 
20118
 
20119
T.Button = Ext.extend(Ext.Button, {
20120
    hideParent : true,
20121
 
20122
    onDestroy : function(){
20123
        T.Button.superclass.onDestroy.call(this);
20124
        if(this.container){
20125
            this.container.remove();
20126
        }
20127
    }
20128
});
20129
Ext.reg('tbbutton', T.Button);
20130
 
20131
 
20132
T.SplitButton = Ext.extend(Ext.SplitButton, {
20133
    hideParent : true,
20134
 
20135
    onDestroy : function(){
20136
        T.SplitButton.superclass.onDestroy.call(this);
20137
        if(this.container){
20138
            this.container.remove();
20139
        }
20140
    }
20141
});
20142
 
20143
Ext.reg('tbsplit', T.SplitButton);
20144
 
20145
T.MenuButton = T.SplitButton;
20146
 
20147
})();
20148
 
20149
 
20150
Ext.PagingToolbar = Ext.extend(Ext.Toolbar, {
20151
 
20152
 
20153
 
20154
    pageSize: 20,
20155
 
20156
    displayMsg : 'Displaying {0} - {1} of {2}',
20157
 
20158
    emptyMsg : 'No data to display',
20159
 
20160
    beforePageText : "Page",
20161
 
20162
    afterPageText : "of {0}",
20163
 
20164
    firstText : "First Page",
20165
 
20166
    prevText : "Previous Page",
20167
 
20168
    nextText : "Next Page",
20169
 
20170
    lastText : "Last Page",
20171
 
20172
    refreshText : "Refresh",
20173
 
20174
 
20175
    paramNames : {start: 'start', limit: 'limit'},
20176
 
20177
    initComponent : function(){
20178
        Ext.PagingToolbar.superclass.initComponent.call(this);
20179
        this.cursor = 0;
20180
        this.bind(this.store);
20181
    },
20182
 
20183
        onRender : function(ct, position){
20184
        Ext.PagingToolbar.superclass.onRender.call(this, ct, position);
20185
        this.first = this.addButton({
20186
            tooltip: this.firstText,
20187
            iconCls: "x-tbar-page-first",
20188
            disabled: true,
20189
            handler: this.onClick.createDelegate(this, ["first"])
20190
        });
20191
        this.prev = this.addButton({
20192
            tooltip: this.prevText,
20193
            iconCls: "x-tbar-page-prev",
20194
            disabled: true,
20195
            handler: this.onClick.createDelegate(this, ["prev"])
20196
        });
20197
        this.addSeparator();
20198
        this.add(this.beforePageText);
20199
        this.field = Ext.get(this.addDom({
20200
           tag: "input",
20201
           type: "text",
20202
           size: "3",
20203
           value: "1",
20204
           cls: "x-tbar-page-number"
20205
        }).el);
20206
        this.field.on("keydown", this.onPagingKeydown, this);
20207
        this.field.on("focus", function(){this.dom.select();});
20208
        this.afterTextEl = this.addText(String.format(this.afterPageText, 1));
20209
        this.field.setHeight(18);
20210
        this.addSeparator();
20211
        this.next = this.addButton({
20212
            tooltip: this.nextText,
20213
            iconCls: "x-tbar-page-next",
20214
            disabled: true,
20215
            handler: this.onClick.createDelegate(this, ["next"])
20216
        });
20217
        this.last = this.addButton({
20218
            tooltip: this.lastText,
20219
            iconCls: "x-tbar-page-last",
20220
            disabled: true,
20221
            handler: this.onClick.createDelegate(this, ["last"])
20222
        });
20223
        this.addSeparator();
20224
        this.loading = this.addButton({
20225
            tooltip: this.refreshText,
20226
            iconCls: "x-tbar-loading",
20227
            handler: this.onClick.createDelegate(this, ["refresh"])
20228
        });
20229
 
20230
        if(this.displayInfo){
20231
            this.displayEl = Ext.fly(this.el.dom).createChild({cls:'x-paging-info'});
20232
        }
20233
        if(this.dsLoaded){
20234
            this.onLoad.apply(this, this.dsLoaded);
20235
        }
20236
    },
20237
 
20238
        updateInfo : function(){
20239
        if(this.displayEl){
20240
            var count = this.store.getCount();
20241
            var msg = count == 0 ?
20242
                this.emptyMsg :
20243
                String.format(
20244
                    this.displayMsg,
20245
                    this.cursor+1, this.cursor+count, this.store.getTotalCount()
20246
                );
20247
            this.displayEl.update(msg);
20248
        }
20249
    },
20250
 
20251
        onLoad : function(store, r, o){
20252
        if(!this.rendered){
20253
            this.dsLoaded = [store, r, o];
20254
            return;
20255
        }
20256
       this.cursor = o.params ? o.params[this.paramNames.start] : 0;
20257
       var d = this.getPageData(), ap = d.activePage, ps = d.pages;
20258
 
20259
       this.afterTextEl.el.innerHTML = String.format(this.afterPageText, d.pages);
20260
       this.field.dom.value = ap;
20261
       this.first.setDisabled(ap == 1);
20262
       this.prev.setDisabled(ap == 1);
20263
       this.next.setDisabled(ap == ps);
20264
       this.last.setDisabled(ap == ps);
20265
       this.loading.enable();
20266
       this.updateInfo();
20267
    },
20268
 
20269
        getPageData : function(){
20270
        var total = this.store.getTotalCount();
20271
        return {
20272
            total : total,
20273
            activePage : Math.ceil((this.cursor+this.pageSize)/this.pageSize),
20274
            pages :  total < this.pageSize ? 1 : Math.ceil(total/this.pageSize)
20275
        };
20276
    },
20277
 
20278
        onLoadError : function(){
20279
        if(!this.rendered){
20280
            return;
20281
        }
20282
        this.loading.enable();
20283
    },
20284
 
20285
    readPage : function(d){
20286
        var v = this.field.dom.value, pageNum;
20287
        if (!v || isNaN(pageNum = parseInt(v, 10))) {
20288
            this.field.dom.value = d.activePage;
20289
            return false;
20290
        }
20291
        return pageNum;
20292
    },
20293
 
20294
        onPagingKeydown : function(e){
20295
        var k = e.getKey(), d = this.getPageData(), pageNum;
20296
        if (k == e.RETURN) {
20297
            e.stopEvent();
20298
            if(pageNum = this.readPage(d)){
20299
                pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1;
20300
                this.doLoad(pageNum * this.pageSize);
20301
            }
20302
        }else if (k == e.HOME || k == e.END){
20303
            e.stopEvent();
20304
            pageNum = k == e.HOME ? 1 : d.pages;
20305
            this.field.dom.value = pageNum;
20306
        }else if (k == e.UP || k == e.PAGEUP || k == e.DOWN || k == e.PAGEDOWN){
20307
            e.stopEvent();
20308
            if(pageNum = this.readPage(d)){
20309
                var increment = e.shiftKey ? 10 : 1;
20310
                if(k == e.DOWN || k == e.PAGEDOWN){
20311
                    increment *= -1;
20312
                }
20313
                pageNum += increment;
20314
                if(pageNum >= 1 & pageNum <= d.pages){
20315
                    this.field.dom.value = pageNum;
20316
                }
20317
            }
20318
        }
20319
    },
20320
 
20321
        beforeLoad : function(){
20322
        if(this.rendered && this.loading){
20323
            this.loading.disable();
20324
        }
20325
    },
20326
 
20327
    doLoad : function(start){
20328
        var o = {}, pn = this.paramNames;
20329
        o[pn.start] = start;
20330
        o[pn.limit] = this.pageSize;
20331
        this.store.load({params:o});
20332
    },
20333
 
20334
        onClick : function(which){
20335
        var store = this.store;
20336
        switch(which){
20337
            case "first":
20338
                this.doLoad(0);
20339
            break;
20340
            case "prev":
20341
                this.doLoad(Math.max(0, this.cursor-this.pageSize));
20342
            break;
20343
            case "next":
20344
                this.doLoad(this.cursor+this.pageSize);
20345
            break;
20346
            case "last":
20347
                var total = store.getTotalCount();
20348
                var extra = total % this.pageSize;
20349
                var lastStart = extra ? (total - extra) : total-this.pageSize;
20350
                this.doLoad(lastStart);
20351
            break;
20352
            case "refresh":
20353
                this.doLoad(this.cursor);
20354
            break;
20355
        }
20356
    },
20357
 
20358
 
20359
    unbind : function(store){
20360
        store = Ext.StoreMgr.lookup(store);
20361
        store.un("beforeload", this.beforeLoad, this);
20362
        store.un("load", this.onLoad, this);
20363
        store.un("loadexception", this.onLoadError, this);
20364
        this.store = undefined;
20365
    },
20366
 
20367
 
20368
    bind : function(store){
20369
        store = Ext.StoreMgr.lookup(store);
20370
        store.on("beforeload", this.beforeLoad, this);
20371
        store.on("load", this.onLoad, this);
20372
        store.on("loadexception", this.onLoadError, this);
20373
        this.store = store;
20374
    }
20375
});
20376
Ext.reg('paging', Ext.PagingToolbar);
20377
 
20378
Ext.Resizable = function(el, config){
20379
    this.el = Ext.get(el);
20380
 
20381
    if(config && config.wrap){
20382
        config.resizeChild = this.el;
20383
        this.el = this.el.wrap(typeof config.wrap == "object" ? config.wrap : {cls:"xresizable-wrap"});
20384
        this.el.id = this.el.dom.id = config.resizeChild.id + "-rzwrap";
20385
        this.el.setStyle("overflow", "hidden");
20386
        this.el.setPositioning(config.resizeChild.getPositioning());
20387
        config.resizeChild.clearPositioning();
20388
        if(!config.width || !config.height){
20389
            var csize = config.resizeChild.getSize();
20390
            this.el.setSize(csize.width, csize.height);
20391
        }
20392
        if(config.pinned && !config.adjustments){
20393
            config.adjustments = "auto";
20394
        }
20395
    }
20396
 
20397
    this.proxy = this.el.createProxy({tag: "div", cls: "x-resizable-proxy", id: this.el.id + "-rzproxy"});
20398
    this.proxy.unselectable();
20399
    this.proxy.enableDisplayMode('block');
20400
 
20401
    Ext.apply(this, config);
20402
 
20403
    if(this.pinned){
20404
        this.disableTrackOver = true;
20405
        this.el.addClass("x-resizable-pinned");
20406
    }
20407
 
20408
    var position = this.el.getStyle("position");
20409
    if(position != "absolute" && position != "fixed"){
20410
        this.el.setStyle("position", "relative");
20411
    }
20412
    if(!this.handles){
20413
        this.handles = 's,e,se';
20414
        if(this.multiDirectional){
20415
            this.handles += ',n,w';
20416
        }
20417
    }
20418
    if(this.handles == "all"){
20419
        this.handles = "n s e w ne nw se sw";
20420
    }
20421
    var hs = this.handles.split(/\s*?[,;]\s*?| /);
20422
    var ps = Ext.Resizable.positions;
20423
    for(var i = 0, len = hs.length; i < len; i++){
20424
        if(hs[i] && ps[hs[i]]){
20425
            var pos = ps[hs[i]];
20426
            this[pos] = new Ext.Resizable.Handle(this, pos, this.disableTrackOver, this.transparent);
20427
        }
20428
    }
20429
 
20430
    this.corner = this.southeast;
20431
 
20432
    if(this.handles.indexOf("n") != -1 || this.handles.indexOf("w") != -1){
20433
        this.updateBox = true;
20434
    }
20435
 
20436
    this.activeHandle = null;
20437
 
20438
    if(this.resizeChild){
20439
        if(typeof this.resizeChild == "boolean"){
20440
            this.resizeChild = Ext.get(this.el.dom.firstChild, true);
20441
        }else{
20442
            this.resizeChild = Ext.get(this.resizeChild, true);
20443
        }
20444
    }
20445
 
20446
    if(this.adjustments == "auto"){
20447
        var rc = this.resizeChild;
20448
        var hw = this.west, he = this.east, hn = this.north, hs = this.south;
20449
        if(rc && (hw || hn)){
20450
            rc.position("relative");
20451
            rc.setLeft(hw ? hw.el.getWidth() : 0);
20452
            rc.setTop(hn ? hn.el.getHeight() : 0);
20453
        }
20454
        this.adjustments = [
20455
            (he ? -he.el.getWidth() : 0) + (hw ? -hw.el.getWidth() : 0),
20456
            (hn ? -hn.el.getHeight() : 0) + (hs ? -hs.el.getHeight() : 0) -1
20457
        ];
20458
    }
20459
 
20460
    if(this.draggable){
20461
        this.dd = this.dynamic ?
20462
            this.el.initDD(null) : this.el.initDDProxy(null, {dragElId: this.proxy.id});
20463
        this.dd.setHandleElId(this.resizeChild ? this.resizeChild.id : this.el.id);
20464
    }
20465
 
20466
 
20467
    this.addEvents(
20468
        "beforeresize",
20469
        "resize"
20470
    );
20471
 
20472
    if(this.width !== null && this.height !== null){
20473
        this.resizeTo(this.width, this.height);
20474
    }else{
20475
        this.updateChildSize();
20476
    }
20477
    if(Ext.isIE){
20478
        this.el.dom.style.zoom = 1;
20479
    }
20480
    Ext.Resizable.superclass.constructor.call(this);
20481
};
20482
 
20483
Ext.extend(Ext.Resizable, Ext.util.Observable, {
20484
        resizeChild : false,
20485
        adjustments : [0, 0],
20486
        minWidth : 5,
20487
        minHeight : 5,
20488
        maxWidth : 10000,
20489
        maxHeight : 10000,
20490
        enabled : true,
20491
        animate : false,
20492
        duration : .35,
20493
        dynamic : false,
20494
        handles : false,
20495
        multiDirectional : false,
20496
        disableTrackOver : false,
20497
        easing : 'easeOutStrong',
20498
        widthIncrement : 0,
20499
        heightIncrement : 0,
20500
        pinned : false,
20501
        width : null,
20502
        height : null,
20503
        preserveRatio : false,
20504
        transparent: false,
20505
        minX: 0,
20506
        minY: 0,
20507
        draggable: false,
20508
 
20509
 
20510
 
20511
 
20512
 
20513
 
20514
 
20515
 
20516
    resizeTo : function(width, height){
20517
        this.el.setSize(width, height);
20518
        this.updateChildSize();
20519
        this.fireEvent("resize", this, width, height, null);
20520
    },
20521
 
20522
 
20523
    startSizing : function(e, handle){
20524
        this.fireEvent("beforeresize", this, e);
20525
        if(this.enabled){
20526
 
20527
            if(!this.overlay){
20528
                this.overlay = this.el.createProxy({tag: "div", cls: "x-resizable-overlay", html: "&#160;"}, Ext.getBody());
20529
                this.overlay.unselectable();
20530
                this.overlay.enableDisplayMode("block");
20531
                this.overlay.on("mousemove", this.onMouseMove, this);
20532
                this.overlay.on("mouseup", this.onMouseUp, this);
20533
            }
20534
            this.overlay.setStyle("cursor", handle.el.getStyle("cursor"));
20535
 
20536
            this.resizing = true;
20537
            this.startBox = this.el.getBox();
20538
            this.startPoint = e.getXY();
20539
            this.offsets = [(this.startBox.x + this.startBox.width) - this.startPoint[0],
20540
                            (this.startBox.y + this.startBox.height) - this.startPoint[1]];
20541
 
20542
            this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
20543
            this.overlay.show();
20544
 
20545
            if(this.constrainTo) {
20546
                var ct = Ext.get(this.constrainTo);
20547
                this.resizeRegion = ct.getRegion().adjust(
20548
                    ct.getFrameWidth('t'),
20549
                    ct.getFrameWidth('l'),
20550
                    -ct.getFrameWidth('b'),
20551
                    -ct.getFrameWidth('r')
20552
                );
20553
            }
20554
 
20555
            this.proxy.setStyle('visibility', 'hidden');
20556
            this.proxy.show();
20557
            this.proxy.setBox(this.startBox);
20558
            if(!this.dynamic){
20559
                this.proxy.setStyle('visibility', 'visible');
20560
            }
20561
        }
20562
    },
20563
 
20564
 
20565
    onMouseDown : function(handle, e){
20566
        if(this.enabled){
20567
            e.stopEvent();
20568
            this.activeHandle = handle;
20569
            this.startSizing(e, handle);
20570
        }
20571
    },
20572
 
20573
 
20574
    onMouseUp : function(e){
20575
        var size = this.resizeElement();
20576
        this.resizing = false;
20577
        this.handleOut();
20578
        this.overlay.hide();
20579
        this.proxy.hide();
20580
        this.fireEvent("resize", this, size.width, size.height, e);
20581
    },
20582
 
20583
 
20584
    updateChildSize : function(){
20585
        if(this.resizeChild){
20586
            var el = this.el;
20587
            var child = this.resizeChild;
20588
            var adj = this.adjustments;
20589
            if(el.dom.offsetWidth){
20590
                var b = el.getSize(true);
20591
                child.setSize(b.width+adj[0], b.height+adj[1]);
20592
            }
20593
 
20594
 
20595
 
20596
 
20597
            if(Ext.isIE){
20598
                setTimeout(function(){
20599
                    if(el.dom.offsetWidth){
20600
                        var b = el.getSize(true);
20601
                        child.setSize(b.width+adj[0], b.height+adj[1]);
20602
                    }
20603
                }, 10);
20604
            }
20605
        }
20606
    },
20607
 
20608
 
20609
    snap : function(value, inc, min){
20610
        if(!inc || !value) return value;
20611
        var newValue = value;
20612
        var m = value % inc;
20613
        if(m > 0){
20614
            if(m > (inc/2)){
20615
                newValue = value + (inc-m);
20616
            }else{
20617
                newValue = value - m;
20618
            }
20619
        }
20620
        return Math.max(min, newValue);
20621
    },
20622
 
20623
 
20624
    resizeElement : function(){
20625
        var box = this.proxy.getBox();
20626
        if(this.updateBox){
20627
            this.el.setBox(box, false, this.animate, this.duration, null, this.easing);
20628
        }else{
20629
            this.el.setSize(box.width, box.height, this.animate, this.duration, null, this.easing);
20630
        }
20631
        this.updateChildSize();
20632
        if(!this.dynamic){
20633
            this.proxy.hide();
20634
        }
20635
        return box;
20636
    },
20637
 
20638
 
20639
    constrain : function(v, diff, m, mx){
20640
        if(v - diff < m){
20641
            diff = v - m;
20642
        }else if(v - diff > mx){
20643
            diff = mx - v;
20644
        }
20645
        return diff;
20646
    },
20647
 
20648
 
20649
    onMouseMove : function(e){
20650
        if(this.enabled){
20651
            try{
20652
 
20653
            if(this.resizeRegion && !this.resizeRegion.contains(e.getPoint())) {
20654
            	return;
20655
            }
20656
 
20657
 
20658
            var curSize = this.curSize || this.startBox;
20659
            var x = this.startBox.x, y = this.startBox.y;
20660
            var ox = x, oy = y;
20661
            var w = curSize.width, h = curSize.height;
20662
            var ow = w, oh = h;
20663
            var mw = this.minWidth, mh = this.minHeight;
20664
            var mxw = this.maxWidth, mxh = this.maxHeight;
20665
            var wi = this.widthIncrement;
20666
            var hi = this.heightIncrement;
20667
 
20668
            var eventXY = e.getXY();
20669
            var diffX = -(this.startPoint[0] - Math.max(this.minX, eventXY[0]));
20670
            var diffY = -(this.startPoint[1] - Math.max(this.minY, eventXY[1]));
20671
 
20672
            var pos = this.activeHandle.position;
20673
 
20674
            switch(pos){
20675
                case "east":
20676
                    w += diffX;
20677
                    w = Math.min(Math.max(mw, w), mxw);
20678
                    break;
20679
                case "south":
20680
                    h += diffY;
20681
                    h = Math.min(Math.max(mh, h), mxh);
20682
                    break;
20683
                case "southeast":
20684
                    w += diffX;
20685
                    h += diffY;
20686
                    w = Math.min(Math.max(mw, w), mxw);
20687
                    h = Math.min(Math.max(mh, h), mxh);
20688
                    break;
20689
                case "north":
20690
                    diffY = this.constrain(h, diffY, mh, mxh);
20691
                    y += diffY;
20692
                    h -= diffY;
20693
                    break;
20694
                case "west":
20695
                    diffX = this.constrain(w, diffX, mw, mxw);
20696
                    x += diffX;
20697
                    w -= diffX;
20698
                    break;
20699
                case "northeast":
20700
                    w += diffX;
20701
                    w = Math.min(Math.max(mw, w), mxw);
20702
                    diffY = this.constrain(h, diffY, mh, mxh);
20703
                    y += diffY;
20704
                    h -= diffY;
20705
                    break;
20706
                case "northwest":
20707
                    diffX = this.constrain(w, diffX, mw, mxw);
20708
                    diffY = this.constrain(h, diffY, mh, mxh);
20709
                    y += diffY;
20710
                    h -= diffY;
20711
                    x += diffX;
20712
                    w -= diffX;
20713
                    break;
20714
               case "southwest":
20715
                    diffX = this.constrain(w, diffX, mw, mxw);
20716
                    h += diffY;
20717
                    h = Math.min(Math.max(mh, h), mxh);
20718
                    x += diffX;
20719
                    w -= diffX;
20720
                    break;
20721
            }
20722
 
20723
            var sw = this.snap(w, wi, mw);
20724
            var sh = this.snap(h, hi, mh);
20725
            if(sw != w || sh != h){
20726
                switch(pos){
20727
                    case "northeast":
20728
                        y -= sh - h;
20729
                    break;
20730
                    case "north":
20731
                        y -= sh - h;
20732
                        break;
20733
                    case "southwest":
20734
                        x -= sw - w;
20735
                    break;
20736
                    case "west":
20737
                        x -= sw - w;
20738
                        break;
20739
                    case "northwest":
20740
                        x -= sw - w;
20741
                        y -= sh - h;
20742
                    break;
20743
                }
20744
                w = sw;
20745
                h = sh;
20746
            }
20747
 
20748
            if(this.preserveRatio){
20749
                switch(pos){
20750
                    case "southeast":
20751
                    case "east":
20752
                        h = oh * (w/ow);
20753
                        h = Math.min(Math.max(mh, h), mxh);
20754
                        w = ow * (h/oh);
20755
                       break;
20756
                    case "south":
20757
                        w = ow * (h/oh);
20758
                        w = Math.min(Math.max(mw, w), mxw);
20759
                        h = oh * (w/ow);
20760
                        break;
20761
                    case "northeast":
20762
                        w = ow * (h/oh);
20763
                        w = Math.min(Math.max(mw, w), mxw);
20764
                        h = oh * (w/ow);
20765
                    break;
20766
                    case "north":
20767
                        var tw = w;
20768
                        w = ow * (h/oh);
20769
                        w = Math.min(Math.max(mw, w), mxw);
20770
                        h = oh * (w/ow);
20771
                        x += (tw - w) / 2;
20772
                        break;
20773
                    case "southwest":
20774
                        h = oh * (w/ow);
20775
                        h = Math.min(Math.max(mh, h), mxh);
20776
                        var tw = w;
20777
                        w = ow * (h/oh);
20778
                        x += tw - w;
20779
                        break;
20780
                    case "west":
20781
                        var th = h;
20782
                        h = oh * (w/ow);
20783
                        h = Math.min(Math.max(mh, h), mxh);
20784
                        y += (th - h) / 2;
20785
                        var tw = w;
20786
                        w = ow * (h/oh);
20787
                        x += tw - w;
20788
                       break;
20789
                    case "northwest":
20790
                        var tw = w;
20791
                        var th = h;
20792
                        h = oh * (w/ow);
20793
                        h = Math.min(Math.max(mh, h), mxh);
20794
                        w = ow * (h/oh);
20795
                        y += th - h;
20796
                         x += tw - w;
20797
                       break;
20798
 
20799
                }
20800
            }
20801
            this.proxy.setBounds(x, y, w, h);
20802
            if(this.dynamic){
20803
                this.resizeElement();
20804
            }
20805
            }catch(e){}
20806
        }
20807
    },
20808
 
20809
 
20810
    handleOver : function(){
20811
        if(this.enabled){
20812
            this.el.addClass("x-resizable-over");
20813
        }
20814
    },
20815
 
20816
 
20817
    handleOut : function(){
20818
        if(!this.resizing){
20819
            this.el.removeClass("x-resizable-over");
20820
        }
20821
    },
20822
 
20823
 
20824
    getEl : function(){
20825
        return this.el;
20826
    },
20827
 
20828
 
20829
    getResizeChild : function(){
20830
        return this.resizeChild;
20831
    },
20832
 
20833
 
20834
    destroy : function(removeEl){
20835
        this.proxy.remove();
20836
        if(this.overlay){
20837
            this.overlay.removeAllListeners();
20838
            this.overlay.remove();
20839
        }
20840
        var ps = Ext.Resizable.positions;
20841
        for(var k in ps){
20842
            if(typeof ps[k] != "function" && this[ps[k]]){
20843
                var h = this[ps[k]];
20844
                h.el.removeAllListeners();
20845
                h.el.remove();
20846
            }
20847
        }
20848
        if(removeEl){
20849
            this.el.update("");
20850
            this.el.remove();
20851
        }
20852
    },
20853
 
20854
    syncHandleHeight : function(){
20855
        var h = this.el.getHeight(true);
20856
        if(this.west){
20857
            this.west.el.setHeight(h);
20858
        }
20859
        if(this.east){
20860
            this.east.el.setHeight(h);
20861
        }
20862
    }
20863
});
20864
 
20865
 
20866
 
20867
Ext.Resizable.positions = {
20868
    n: "north", s: "south", e: "east", w: "west", se: "southeast", sw: "southwest", nw: "northwest", ne: "northeast"
20869
};
20870
 
20871
 
20872
Ext.Resizable.Handle = function(rz, pos, disableTrackOver, transparent){
20873
    if(!this.tpl){
20874
 
20875
        var tpl = Ext.DomHelper.createTemplate(
20876
            {tag: "div", cls: "x-resizable-handle x-resizable-handle-{0}"}
20877
        );
20878
        tpl.compile();
20879
        Ext.Resizable.Handle.prototype.tpl = tpl;
20880
    }
20881
    this.position = pos;
20882
    this.rz = rz;
20883
    this.el = this.tpl.append(rz.el.dom, [this.position], true);
20884
    this.el.unselectable();
20885
    if(transparent){
20886
        this.el.setOpacity(0);
20887
    }
20888
    this.el.on("mousedown", this.onMouseDown, this);
20889
    if(!disableTrackOver){
20890
        this.el.on("mouseover", this.onMouseOver, this);
20891
        this.el.on("mouseout", this.onMouseOut, this);
20892
    }
20893
};
20894
 
20895
 
20896
Ext.Resizable.Handle.prototype = {
20897
    afterResize : function(rz){
20898
 
20899
    },
20900
 
20901
    onMouseDown : function(e){
20902
        this.rz.onMouseDown(this, e);
20903
    },
20904
 
20905
    onMouseOver : function(e){
20906
        this.rz.handleOver(this, e);
20907
    },
20908
 
20909
    onMouseOut : function(e){
20910
        this.rz.handleOut(this, e);
20911
    }
20912
};
20913
 
20914
 
20915
 
20916
 
20917
 
20918
Ext.Editor = function(field, config){
20919
    this.field = field;
20920
    Ext.Editor.superclass.constructor.call(this, config);
20921
};
20922
 
20923
Ext.extend(Ext.Editor, Ext.Component, {
20924
 
20925
 
20926
 
20927
 
20928
 
20929
    value : "",
20930
 
20931
    alignment: "c-c?",
20932
 
20933
    shadow : "frame",
20934
 
20935
    constrain : false,
20936
 
20937
    swallowKeys : true,
20938
 
20939
    completeOnEnter : false,
20940
 
20941
    cancelOnEsc : false,
20942
 
20943
    updateEl : false,
20944
 
20945
    initComponent : function(){
20946
        Ext.Editor.superclass.initComponent.call(this);
20947
        this.addEvents(
20948
 
20949
            "beforestartedit",
20950
 
20951
            "startedit",
20952
 
20953
            "beforecomplete",
20954
 
20955
            "complete",
20956
 
20957
            "specialkey"
20958
        );
20959
    },
20960
 
20961
        onRender : function(ct, position){
20962
        this.el = new Ext.Layer({
20963
            shadow: this.shadow,
20964
            cls: "x-editor",
20965
            parentEl : ct,
20966
            shim : this.shim,
20967
            shadowOffset:4,
20968
            id: this.id,
20969
            constrain: this.constrain
20970
        });
20971
        this.el.setStyle("overflow", Ext.isGecko ? "auto" : "hidden");
20972
        if(this.field.msgTarget != 'title'){
20973
            this.field.msgTarget = 'qtip';
20974
        }
20975
        this.field.inEditor = true;
20976
        this.field.render(this.el);
20977
        if(Ext.isGecko){
20978
            this.field.el.dom.setAttribute('autocomplete', 'off');
20979
        }
20980
        this.field.on("specialkey", this.onSpecialKey, this);
20981
        if(this.swallowKeys){
20982
            this.field.el.swallowEvent(['keydown','keypress']);
20983
        }
20984
        this.field.show();
20985
        this.field.on("blur", this.onBlur, this);
20986
        if(this.field.grow){
20987
            this.field.on("autosize", this.el.sync,  this.el, {delay:1});
20988
        }
20989
    },
20990
 
20991
    onSpecialKey : function(field, e){
20992
        if(this.completeOnEnter && e.getKey() == e.ENTER){
20993
            e.stopEvent();
20994
            this.completeEdit();
20995
        }else if(this.cancelOnEsc && e.getKey() == e.ESC){
20996
            this.cancelEdit();
20997
        }else{
20998
            this.fireEvent('specialkey', field, e);
20999
        }
21000
    },
21001
 
21002
 
21003
    startEdit : function(el, value){
21004
        if(this.editing){
21005
            this.completeEdit();
21006
        }
21007
        this.boundEl = Ext.get(el);
21008
        var v = value !== undefined ? value : this.boundEl.dom.innerHTML;
21009
        if(!this.rendered){
21010
            this.render(this.parentEl || document.body);
21011
        }
21012
        if(this.fireEvent("beforestartedit", this, this.boundEl, v) === false){
21013
            return;
21014
        }
21015
        this.startValue = v;
21016
        this.field.setValue(v);
21017
        this.doAutoSize();
21018
        this.el.alignTo(this.boundEl, this.alignment);
21019
        this.editing = true;
21020
        this.show();
21021
    },
21022
 
21023
        doAutoSize : function(){
21024
        if(this.autoSize){
21025
            var sz = this.boundEl.getSize();
21026
            switch(this.autoSize){
21027
                case "width":
21028
                    this.setSize(sz.width,  "");
21029
                break;
21030
                case "height":
21031
                    this.setSize("",  sz.height);
21032
                break;
21033
                default:
21034
                    this.setSize(sz.width,  sz.height);
21035
            }
21036
        }
21037
    },
21038
 
21039
 
21040
    setSize : function(w, h){
21041
        delete this.field.lastSize;
21042
        this.field.setSize(w, h);
21043
        if(this.el){
21044
            this.el.sync();
21045
        }
21046
    },
21047
 
21048
 
21049
    realign : function(){
21050
        this.el.alignTo(this.boundEl, this.alignment);
21051
    },
21052
 
21053
 
21054
    completeEdit : function(remainVisible){
21055
        if(!this.editing){
21056
            return;
21057
        }
21058
        var v = this.getValue();
21059
        if(this.revertInvalid !== false && !this.field.isValid()){
21060
            v = this.startValue;
21061
            this.cancelEdit(true);
21062
        }
21063
        if(String(v) === String(this.startValue) && this.ignoreNoChange){
21064
            this.editing = false;
21065
            this.hide();
21066
            return;
21067
        }
21068
        if(this.fireEvent("beforecomplete", this, v, this.startValue) !== false){
21069
            this.editing = false;
21070
            if(this.updateEl && this.boundEl){
21071
                this.boundEl.update(v);
21072
            }
21073
            if(remainVisible !== true){
21074
                this.hide();
21075
            }
21076
            this.fireEvent("complete", this, v, this.startValue);
21077
        }
21078
    },
21079
 
21080
        onShow : function(){
21081
        this.el.show();
21082
        if(this.hideEl !== false){
21083
            this.boundEl.hide();
21084
        }
21085
        this.field.show();
21086
        if(Ext.isIE && !this.fixIEFocus){             this.fixIEFocus = true;
21087
            this.deferredFocus.defer(50, this);
21088
        }else{
21089
            this.field.focus();
21090
        }
21091
        this.fireEvent("startedit", this.boundEl, this.startValue);
21092
    },
21093
 
21094
    deferredFocus : function(){
21095
        if(this.editing){
21096
            this.field.focus();
21097
        }
21098
    },
21099
 
21100
 
21101
    cancelEdit : function(remainVisible){
21102
        if(this.editing){
21103
            this.setValue(this.startValue);
21104
            if(remainVisible !== true){
21105
                this.hide();
21106
            }
21107
        }
21108
    },
21109
 
21110
        onBlur : function(){
21111
        if(this.allowBlur !== true && this.editing){
21112
            this.completeEdit();
21113
        }
21114
    },
21115
 
21116
        onHide : function(){
21117
        if(this.editing){
21118
            this.completeEdit();
21119
            return;
21120
        }
21121
        this.field.blur();
21122
        if(this.field.collapse){
21123
            this.field.collapse();
21124
        }
21125
        this.el.hide();
21126
        if(this.hideEl !== false){
21127
            this.boundEl.show();
21128
        }
21129
    },
21130
 
21131
 
21132
    setValue : function(v){
21133
        this.field.setValue(v);
21134
    },
21135
 
21136
 
21137
    getValue : function(){
21138
        return this.field.getValue();
21139
    },
21140
 
21141
    beforeDestroy : function(){
21142
        this.field.destroy();
21143
        this.field = null;
21144
    }
21145
});
21146
Ext.reg('editor', Ext.Editor);
21147
 
21148
Ext.MessageBox = function(){
21149
    var dlg, opt, mask, waitTimer;
21150
    var bodyEl, msgEl, textboxEl, textareaEl, progressBar, pp, iconEl, spacerEl;
21151
    var buttons, activeTextEl, bwidth, iconCls = '';
21152
 
21153
 
21154
    var handleButton = function(button){
21155
        dlg.hide();
21156
        Ext.callback(opt.fn, opt.scope||window, [button, activeTextEl.dom.value], 1);
21157
    };
21158
 
21159
 
21160
    var handleHide = function(){
21161
        if(opt && opt.cls){
21162
            dlg.el.removeClass(opt.cls);
21163
        }
21164
        progressBar.reset();
21165
    };
21166
 
21167
 
21168
    var handleEsc = function(d, k, e){
21169
        if(opt && opt.closable !== false){
21170
            dlg.hide();
21171
        }
21172
        if(e){
21173
            e.stopEvent();
21174
        }
21175
    };
21176
 
21177
 
21178
    var updateButtons = function(b){
21179
        var width = 0;
21180
        if(!b){
21181
            buttons["ok"].hide();
21182
            buttons["cancel"].hide();
21183
            buttons["yes"].hide();
21184
            buttons["no"].hide();
21185
            return width;
21186
        }
21187
        dlg.footer.dom.style.display = '';
21188
        for(var k in buttons){
21189
            if(typeof buttons[k] != "function"){
21190
                if(b[k]){
21191
                    buttons[k].show();
21192
                    buttons[k].setText(typeof b[k] == "string" ? b[k] : Ext.MessageBox.buttonText[k]);
21193
                    width += buttons[k].el.getWidth()+15;
21194
                }else{
21195
                    buttons[k].hide();
21196
                }
21197
            }
21198
        }
21199
        return width;
21200
    };
21201
 
21202
    return {
21203
 
21204
        getDialog : function(titleText){
21205
           if(!dlg){
21206
                dlg = new Ext.Window({
21207
                    autoCreate : true,
21208
                    title:titleText,
21209
                    resizable:false,
21210
                    constrain:true,
21211
                    constrainHeader:true,
21212
                    minimizable : false,
21213
                    maximizable : false,
21214
                    stateful: false,
21215
                    modal: true,
21216
                    shim:true,
21217
                    buttonAlign:"center",
21218
                    width:400,
21219
                    height:100,
21220
                    minHeight: 80,
21221
                    plain:true,
21222
                    footer:true,
21223
                    closable:true,
21224
                    close : function(){
21225
                        if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){
21226
                            handleButton("no");
21227
                        }else{
21228
                            handleButton("cancel");
21229
                        }
21230
                    }
21231
                });
21232
                buttons = {};
21233
                var bt = this.buttonText;
21234
 
21235
                buttons["ok"] = dlg.addButton(bt["ok"], handleButton.createCallback("ok"));
21236
                buttons["yes"] = dlg.addButton(bt["yes"], handleButton.createCallback("yes"));
21237
                buttons["no"] = dlg.addButton(bt["no"], handleButton.createCallback("no"));
21238
                buttons["cancel"] = dlg.addButton(bt["cancel"], handleButton.createCallback("cancel"));
21239
                buttons["ok"].hideMode = buttons["yes"].hideMode = buttons["no"].hideMode = buttons["cancel"].hideMode = 'offsets';
21240
                dlg.render(document.body);
21241
                dlg.getEl().addClass('x-window-dlg');
21242
                mask = dlg.mask;
21243
                bodyEl = dlg.body.createChild({
21244
                    html:'<div class="ext-mb-icon"></div><div class="ext-mb-content"><span class="ext-mb-text"></span><br /><input type="text" class="ext-mb-input" /><textarea class="ext-mb-textarea"></textarea></div>'
21245
                });
21246
                iconEl = Ext.get(bodyEl.dom.firstChild);
21247
                var contentEl = bodyEl.dom.childNodes[1];
21248
                msgEl = Ext.get(contentEl.firstChild);
21249
                textboxEl = Ext.get(contentEl.childNodes[2]);
21250
                textboxEl.enableDisplayMode();
21251
                textboxEl.addKeyListener([10,13], function(){
21252
                    if(dlg.isVisible() && opt && opt.buttons){
21253
                        if(opt.buttons.ok){
21254
                            handleButton("ok");
21255
                        }else if(opt.buttons.yes){
21256
                            handleButton("yes");
21257
                        }
21258
                    }
21259
                });
21260
                textareaEl = Ext.get(contentEl.childNodes[3]);
21261
                textareaEl.enableDisplayMode();
21262
                progressBar = new Ext.ProgressBar({
21263
                    renderTo:bodyEl
21264
                });
21265
               bodyEl.createChild({cls:'x-clear'});
21266
            }
21267
            return dlg;
21268
        },
21269
 
21270
 
21271
        updateText : function(text){
21272
            if(!dlg.isVisible() && !opt.width){
21273
                dlg.setSize(this.maxWidth, 100);
21274
            }
21275
            msgEl.update(text || '&#160;');
21276
 
21277
            var iw = iconCls != '' ? (iconEl.getWidth() + iconEl.getMargins('lr')) : 0;
21278
            var mw = msgEl.getWidth() + msgEl.getMargins('lr');
21279
            var fw = dlg.getFrameWidth('lr');
21280
            var bw = dlg.body.getFrameWidth('lr');
21281
            if (Ext.isIE && iw > 0){
21282
 
21283
 
21284
                iw += 3;
21285
            }
21286
            var w = Math.max(Math.min(opt.width || iw+mw+fw+bw, this.maxWidth),
21287
                        Math.max(opt.minWidth || this.minWidth, bwidth || 0));
21288
 
21289
            if(opt.prompt === true){
21290
                activeTextEl.setWidth(w-iw-fw-bw);
21291
            }
21292
            if(opt.progress === true || opt.wait === true){
21293
                progressBar.setSize(w-iw-fw-bw);
21294
            }
21295
            dlg.setSize(w, 'auto').center();
21296
            return this;
21297
        },
21298
 
21299
 
21300
        updateProgress : function(value, progressText, msg){
21301
            progressBar.updateProgress(value, progressText);
21302
            if(msg){
21303
                this.updateText(msg);
21304
            }
21305
            return this;
21306
        },
21307
 
21308
 
21309
        isVisible : function(){
21310
            return dlg && dlg.isVisible();
21311
        },
21312
 
21313
 
21314
        hide : function(){
21315
            if(this.isVisible()){
21316
                dlg.hide();
21317
                handleHide();
21318
            }
21319
            return this;
21320
        },
21321
 
21322
 
21323
        show : function(options){
21324
            if(this.isVisible()){
21325
                this.hide();
21326
            }
21327
            opt = options;
21328
            var d = this.getDialog(opt.title || "&#160;");
21329
 
21330
            d.setTitle(opt.title || "&#160;");
21331
            var allowClose = (opt.closable !== false && opt.progress !== true && opt.wait !== true);
21332
            d.tools.close.setDisplayed(allowClose);
21333
            activeTextEl = textboxEl;
21334
            opt.prompt = opt.prompt || (opt.multiline ? true : false);
21335
            if(opt.prompt){
21336
                if(opt.multiline){
21337
                    textboxEl.hide();
21338
                    textareaEl.show();
21339
                    textareaEl.setHeight(typeof opt.multiline == "number" ?
21340
                        opt.multiline : this.defaultTextHeight);
21341
                    activeTextEl = textareaEl;
21342
                }else{
21343
                    textboxEl.show();
21344
                    textareaEl.hide();
21345
                }
21346
            }else{
21347
                textboxEl.hide();
21348
                textareaEl.hide();
21349
            }
21350
            activeTextEl.dom.value = opt.value || "";
21351
            if(opt.prompt){
21352
                d.focusEl = activeTextEl;
21353
            }else{
21354
                var bs = opt.buttons;
21355
                var db = null;
21356
                if(bs && bs.ok){
21357
                    db = buttons["ok"];
21358
                }else if(bs && bs.yes){
21359
                    db = buttons["yes"];
21360
                }
21361
                if (db){
21362
                    d.focusEl = db;
21363
                }
21364
            }
21365
            this.setIcon(opt.icon);
21366
            bwidth = updateButtons(opt.buttons);
21367
            progressBar.setVisible(opt.progress === true || opt.wait === true);
21368
            this.updateProgress(0, opt.progressText);
21369
            this.updateText(opt.msg);
21370
            if(opt.cls){
21371
                d.el.addClass(opt.cls);
21372
            }
21373
            d.proxyDrag = opt.proxyDrag === true;
21374
            d.modal = opt.modal !== false;
21375
            d.mask = opt.modal !== false ? mask : false;
21376
            if(!d.isVisible()){
21377
 
21378
                document.body.appendChild(dlg.el.dom);
21379
                d.setAnimateTarget(opt.animEl);
21380
                d.show(opt.animEl);
21381
            }
21382
 
21383
 
21384
            d.on('show', function(){
21385
                if(allowClose === true){
21386
                    d.keyMap.enable();
21387
                }else{
21388
                    d.keyMap.disable();
21389
                }
21390
            }, this, {single:true});
21391
 
21392
            if(opt.wait === true){
21393
                progressBar.wait(opt.waitConfig);
21394
            }
21395
            return this;
21396
        },
21397
 
21398
 
21399
        setIcon : function(icon){
21400
            if(icon && icon != ''){
21401
                iconEl.removeClass('x-hidden');
21402
                iconEl.replaceClass(iconCls, icon);
21403
                iconCls = icon;
21404
            }else{
21405
                iconEl.replaceClass(iconCls, 'x-hidden');
21406
                iconCls = '';
21407
            }
21408
            return this;
21409
        },
21410
 
21411
 
21412
        progress : function(title, msg, progressText){
21413
            this.show({
21414
                title : title,
21415
                msg : msg,
21416
                buttons: false,
21417
                progress:true,
21418
                closable:false,
21419
                minWidth: this.minProgressWidth,
21420
                progressText: progressText
21421
            });
21422
            return this;
21423
        },
21424
 
21425
 
21426
        wait : function(msg, title, config){
21427
            this.show({
21428
                title : title,
21429
                msg : msg,
21430
                buttons: false,
21431
                closable:false,
21432
                wait:true,
21433
                modal:true,
21434
                minWidth: this.minProgressWidth,
21435
                waitConfig: config
21436
            });
21437
            return this;
21438
        },
21439
 
21440
 
21441
        alert : function(title, msg, fn, scope){
21442
            this.show({
21443
                title : title,
21444
                msg : msg,
21445
                buttons: this.OK,
21446
                fn: fn,
21447
                scope : scope
21448
            });
21449
            return this;
21450
        },
21451
 
21452
 
21453
        confirm : function(title, msg, fn, scope){
21454
            this.show({
21455
                title : title,
21456
                msg : msg,
21457
                buttons: this.YESNO,
21458
                fn: fn,
21459
                scope : scope,
21460
                icon: this.QUESTION
21461
            });
21462
            return this;
21463
        },
21464
 
21465
 
21466
        prompt : function(title, msg, fn, scope, multiline){
21467
            this.show({
21468
                title : title,
21469
                msg : msg,
21470
                buttons: this.OKCANCEL,
21471
                fn: fn,
21472
                minWidth:250,
21473
                scope : scope,
21474
                prompt:true,
21475
                multiline: multiline
21476
            });
21477
            return this;
21478
        },
21479
 
21480
 
21481
        OK : {ok:true},
21482
 
21483
        CANCEL : {cancel:true},
21484
 
21485
        OKCANCEL : {ok:true, cancel:true},
21486
 
21487
        YESNO : {yes:true, no:true},
21488
 
21489
        YESNOCANCEL : {yes:true, no:true, cancel:true},
21490
 
21491
        INFO : 'ext-mb-info',
21492
 
21493
        WARNING : 'ext-mb-warning',
21494
 
21495
        QUESTION : 'ext-mb-question',
21496
 
21497
        ERROR : 'ext-mb-error',
21498
 
21499
 
21500
        defaultTextHeight : 75,
21501
 
21502
        maxWidth : 600,
21503
 
21504
        minWidth : 100,
21505
 
21506
        minProgressWidth : 250,
21507
 
21508
        buttonText : {
21509
            ok : "OK",
21510
            cancel : "Cancel",
21511
            yes : "Yes",
21512
            no : "No"
21513
        }
21514
    };
21515
}();
21516
 
21517
 
21518
Ext.Msg = Ext.MessageBox;
21519
 
21520
Ext.Tip = Ext.extend(Ext.Panel, {
21521
 
21522
 
21523
 
21524
    minWidth : 40,
21525
 
21526
    maxWidth : 300,
21527
 
21528
    shadow : "sides",
21529
 
21530
    defaultAlign : "tl-bl?",
21531
    autoRender: true,
21532
    quickShowInterval : 250,
21533
 
21534
 
21535
    frame:true,
21536
    hidden:true,
21537
    baseCls: 'x-tip',
21538
    floating:{shadow:true,shim:true,useDisplay:true,constrain:false},
21539
    autoHeight:true,
21540
 
21541
 
21542
    initComponent : function(){
21543
        Ext.Tip.superclass.initComponent.call(this);
21544
        if(this.closable && !this.title){
21545
            this.elements += ',header';
21546
        }
21547
    },
21548
 
21549
 
21550
    afterRender : function(){
21551
        Ext.Tip.superclass.afterRender.call(this);
21552
        if(this.closable){
21553
            this.addTool({
21554
                id: 'close',
21555
                handler: this.hide,
21556
                scope: this
21557
            });
21558
        }
21559
    },
21560
 
21561
 
21562
    showAt : function(xy){
21563
        Ext.Tip.superclass.show.call(this);
21564
        if(this.measureWidth !== false && (!this.initialConfig || typeof this.initialConfig.width != 'number')){
21565
            var bw = this.body.getTextWidth();
21566
            if(this.title){
21567
                bw = Math.max(bw, this.header.child('span').getTextWidth(this.title));
21568
            }
21569
            bw += this.getFrameWidth() + (this.closable ? 20 : 0) + this.body.getPadding("lr");
21570
            this.setWidth(bw.constrain(this.minWidth, this.maxWidth));
21571
        }
21572
        if(this.constrainPosition){
21573
            xy = this.el.adjustForConstraints(xy);
21574
        }
21575
        this.setPagePosition(xy[0], xy[1]);
21576
    },
21577
 
21578
 
21579
    showBy : function(el, pos){
21580
        if(!this.rendered){
21581
            this.render(Ext.getBody());
21582
        }
21583
        this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign));
21584
    },
21585
 
21586
    initDraggable : function(){
21587
        this.dd = new Ext.Tip.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable);
21588
        this.header.addClass('x-tip-draggable');
21589
    }
21590
});
21591
 
21592
 
21593
Ext.Tip.DD = function(tip, config){
21594
    Ext.apply(this, config);
21595
    this.tip = tip;
21596
    Ext.Tip.DD.superclass.constructor.call(this, tip.el.id, 'WindowDD-'+tip.id);
21597
    this.setHandleElId(tip.header.id);
21598
    this.scroll = false;
21599
};
21600
 
21601
Ext.extend(Ext.Tip.DD, Ext.dd.DD, {
21602
    moveOnly:true,
21603
    scroll:false,
21604
    headerOffsets:[100, 25],
21605
    startDrag : function(){
21606
        this.tip.el.disableShadow();
21607
    },
21608
    endDrag : function(e){
21609
        this.tip.el.enableShadow(true);
21610
    }
21611
});
21612
 
21613
Ext.ToolTip = Ext.extend(Ext.Tip, {
21614
 
21615
 
21616
 
21617
    showDelay: 500,
21618
 
21619
    hideDelay: 200,
21620
 
21621
    dismissDelay: 5000,
21622
 
21623
    mouseOffset: [15,18],
21624
 
21625
    trackMouse : false,
21626
    constrainPosition: true,
21627
 
21628
 
21629
    initComponent: function(){
21630
        Ext.ToolTip.superclass.initComponent.call(this);
21631
        this.lastActive = new Date();
21632
        this.initTarget();
21633
    },
21634
 
21635
 
21636
    initTarget : function(){
21637
        if(this.target){
21638
            this.target = Ext.get(this.target);
21639
            this.target.on('mouseover', this.onTargetOver, this);
21640
            this.target.on('mouseout', this.onTargetOut, this);
21641
            this.target.on('mousemove', this.onMouseMove, this);
21642
        }
21643
    },
21644
 
21645
 
21646
    onMouseMove : function(e){
21647
        this.targetXY = e.getXY();
21648
        if(!this.hidden && this.trackMouse){
21649
            this.setPagePosition(this.getTargetXY());
21650
        }
21651
    },
21652
 
21653
 
21654
    getTargetXY : function(){
21655
        return [this.targetXY[0]+this.mouseOffset[0], this.targetXY[1]+this.mouseOffset[1]];
21656
    },
21657
 
21658
 
21659
    onTargetOver : function(e){
21660
        if(this.disabled || e.within(this.target.dom, true)){
21661
            return;
21662
        }
21663
        this.clearTimer('hide');
21664
        this.targetXY = e.getXY();
21665
        this.delayShow();
21666
    },
21667
 
21668
 
21669
    delayShow : function(){
21670
        if(this.hidden && !this.showTimer){
21671
            if(this.lastActive.getElapsed() < this.quickShowInterval){
21672
                this.show();
21673
            }else{
21674
                this.showTimer = this.show.defer(this.showDelay, this);
21675
            }
21676
        }else if(!this.hidden && this.autoHide !== false){
21677
            this.show();
21678
        }
21679
    },
21680
 
21681
 
21682
    onTargetOut : function(e){
21683
        if(this.disabled || e.within(this.target.dom, true)){
21684
            return;
21685
        }
21686
        this.clearTimer('show');
21687
        if(this.autoHide !== false){
21688
            this.delayHide();
21689
        }
21690
    },
21691
 
21692
 
21693
    delayHide : function(){
21694
        if(!this.hidden && !this.hideTimer){
21695
            this.hideTimer = this.hide.defer(this.hideDelay, this);
21696
        }
21697
    },
21698
 
21699
 
21700
    hide: function(){
21701
        this.clearTimer('dismiss');
21702
        this.lastActive = new Date();
21703
        Ext.ToolTip.superclass.hide.call(this);
21704
    },
21705
 
21706
 
21707
    show : function(){
21708
        this.showAt(this.getTargetXY());
21709
    },
21710
 
21711
 
21712
    showAt : function(xy){
21713
        this.lastActive = new Date();
21714
        this.clearTimers();
21715
        Ext.ToolTip.superclass.showAt.call(this, xy);
21716
        if(this.dismissDelay && this.autoHide !== false){
21717
            this.dismissTimer = this.hide.defer(this.dismissDelay, this);
21718
        }
21719
    },
21720
 
21721
 
21722
    clearTimer : function(name){
21723
        name = name + 'Timer';
21724
        clearTimeout(this[name]);
21725
        delete this[name];
21726
    },
21727
 
21728
 
21729
    clearTimers : function(){
21730
        this.clearTimer('show');
21731
        this.clearTimer('dismiss');
21732
        this.clearTimer('hide');
21733
    },
21734
 
21735
 
21736
    onShow : function(){
21737
        Ext.ToolTip.superclass.onShow.call(this);
21738
        Ext.getDoc().on('mousedown', this.onDocMouseDown, this);
21739
    },
21740
 
21741
 
21742
    onHide : function(){
21743
        Ext.ToolTip.superclass.onHide.call(this);
21744
        Ext.getDoc().un('mousedown', this.onDocMouseDown, this);
21745
    },
21746
 
21747
 
21748
    onDocMouseDown : function(e){
21749
        if(this.autoHide !== false && !e.within(this.el.dom)){
21750
            this.disable();
21751
            this.enable.defer(100, this);
21752
        }
21753
    },
21754
 
21755
 
21756
    onDisable : function(){
21757
        this.clearTimers();
21758
        this.hide();
21759
    },
21760
 
21761
 
21762
    adjustPosition : function(x, y){
21763
 
21764
        var ay = this.targetXY[1], h = this.getSize().height;
21765
        if(this.constrainPosition && y <= ay && (y+h) >= ay){
21766
            y = ay-h-5;
21767
        }
21768
        return {x : x, y: y};
21769
    },
21770
 
21771
 
21772
    onDestroy : function(){
21773
        Ext.ToolTip.superclass.onDestroy.call(this);
21774
        if(this.target){
21775
            this.target.un('mouseover', this.onTargetOver, this);
21776
            this.target.un('mouseout', this.onTargetOut, this);
21777
            this.target.un('mousemove', this.onMouseMove, this);
21778
        }
21779
    }
21780
});
21781
 
21782
Ext.QuickTip = Ext.extend(Ext.ToolTip, {
21783
 
21784
 
21785
    interceptTitles : false,
21786
 
21787
 
21788
    tagConfig : {
21789
        namespace : "ext",
21790
        attribute : "qtip",
21791
        width : "qwidth",
21792
        target : "target",
21793
        title : "qtitle",
21794
        hide : "hide",
21795
        cls : "qclass",
21796
        align : "qalign"
21797
    },
21798
 
21799
 
21800
    initComponent : function(){
21801
        this.target = this.target || Ext.getDoc();
21802
        this.targets = this.targets || {};
21803
        Ext.QuickTip.superclass.initComponent.call(this);
21804
    },
21805
 
21806
 
21807
    register : function(config){
21808
        var cs = Ext.isArray(config) ? config : arguments;
21809
        for(var i = 0, len = cs.length; i < len; i++){
21810
            var c = cs[i];
21811
            var target = c.target;
21812
            if(target){
21813
                if(Ext.isArray(target)){
21814
                    for(var j = 0, jlen = target.length; j < jlen; j++){
21815
                        this.targets[Ext.id(target[j])] = c;
21816
                    }
21817
                } else{
21818
                    this.targets[Ext.id(target)] = c;
21819
                }
21820
            }
21821
        }
21822
    },
21823
 
21824
 
21825
    unregister : function(el){
21826
        delete this.targets[Ext.id(el)];
21827
    },
21828
 
21829
 
21830
    onTargetOver : function(e){
21831
        if(this.disabled){
21832
            return;
21833
        }
21834
        this.targetXY = e.getXY();
21835
        var t = e.getTarget();
21836
        if(!t || t.nodeType !== 1 || t == document || t == document.body){
21837
            return;
21838
        }
21839
        if(this.activeTarget && t == this.activeTarget.el){
21840
            this.clearTimer('hide');
21841
            this.show();
21842
            return;
21843
        }
21844
        if(t && this.targets[t.id]){
21845
            this.activeTarget = this.targets[t.id];
21846
            this.activeTarget.el = t;
21847
            this.delayShow();
21848
            return;
21849
        }
21850
        var ttp, et = Ext.fly(t), cfg = this.tagConfig;
21851
        var ns = cfg.namespace;
21852
        if(this.interceptTitles && t.title){
21853
            ttp = t.title;
21854
            t.qtip = ttp;
21855
            t.removeAttribute("title");
21856
            e.preventDefault();
21857
        } else{
21858
            ttp = t.qtip || et.getAttributeNS(ns, cfg.attribute);
21859
        }
21860
        if(ttp){
21861
            var autoHide = et.getAttributeNS(ns, cfg.hide);
21862
            this.activeTarget = {
21863
                el: t,
21864
                text: ttp,
21865
                width: et.getAttributeNS(ns, cfg.width),
21866
                autoHide: autoHide != "user" && autoHide !== 'false',
21867
                title: et.getAttributeNS(ns, cfg.title),
21868
                cls: et.getAttributeNS(ns, cfg.cls),
21869
                align: et.getAttributeNS(ns, cfg.align)
21870
            };
21871
            this.delayShow();
21872
        }
21873
    },
21874
 
21875
 
21876
    onTargetOut : function(e){
21877
        this.clearTimer('show');
21878
        if(this.autoHide !== false){
21879
            this.delayHide();
21880
        }
21881
    },
21882
 
21883
 
21884
    showAt : function(xy){
21885
        var t = this.activeTarget;
21886
        if(t){
21887
            if(!this.rendered){
21888
                this.render(Ext.getBody());
21889
                this.activeTarget = t;
21890
            }
21891
            if(t.width){
21892
                this.setWidth(t.width);
21893
                this.body.setWidth(this.adjustBodyWidth(t.width - this.getFrameWidth()));
21894
                this.measureWidth = false;
21895
            } else{
21896
                this.measureWidth = true;
21897
            }
21898
            this.setTitle(t.title || '');
21899
            this.body.update(t.text);
21900
            this.autoHide = t.autoHide;
21901
            this.dismissDelay = t.dismissDelay || this.dismissDelay;
21902
            if(this.lastCls){
21903
                this.el.removeClass(this.lastCls);
21904
                delete this.lastCls;
21905
            }
21906
            if(t.cls){
21907
                this.el.addClass(t.cls);
21908
                this.lastCls = t.cls;
21909
            }
21910
            if(t.align){
21911
                xy = this.el.getAlignToXY(t.el, t.align);
21912
                this.constrainPosition = false;
21913
            } else{
21914
                this.constrainPosition = true;
21915
            }
21916
        }
21917
        Ext.QuickTip.superclass.showAt.call(this, xy);
21918
    },
21919
 
21920
 
21921
    hide: function(){
21922
        delete this.activeTarget;
21923
        Ext.QuickTip.superclass.hide.call(this);
21924
    }
21925
});
21926
 
21927
Ext.QuickTips = function(){
21928
    var tip, locks = [];
21929
    return {
21930
 
21931
        init : function(){
21932
            if(!tip){
21933
                tip = new Ext.QuickTip({elements:'header,body'});
21934
            }
21935
        },
21936
 
21937
 
21938
        enable : function(){
21939
            if(tip){
21940
                locks.pop();
21941
                if(locks.length < 1){
21942
                    tip.enable();
21943
                }
21944
            }
21945
        },
21946
 
21947
 
21948
        disable : function(){
21949
            if(tip){
21950
                tip.disable();
21951
            }
21952
            locks.push(1);
21953
        },
21954
 
21955
 
21956
        isEnabled : function(){
21957
            return tip && !tip.disabled;
21958
        },
21959
 
21960
 
21961
        getQuickTip : function(){
21962
            return tip;
21963
        },
21964
 
21965
 
21966
        register : function(){
21967
            tip.register.apply(tip, arguments);
21968
        },
21969
 
21970
 
21971
        unregister : function(){
21972
            tip.unregister.apply(tip, arguments);
21973
        },
21974
 
21975
 
21976
        tips :function(){
21977
            tip.register.apply(tip, arguments);
21978
        }
21979
    }
21980
}();
21981
 
21982
Ext.tree.TreePanel = Ext.extend(Ext.Panel, {
21983
    rootVisible : true,
21984
    animate: Ext.enableFx,
21985
    lines : true,
21986
    enableDD : false,
21987
    hlDrop : Ext.enableFx,
21988
    pathSeparator: "/",
21989
 
21990
    initComponent : function(){
21991
        Ext.tree.TreePanel.superclass.initComponent.call(this);
21992
 
21993
        if(!this.eventModel){
21994
            this.eventModel = new Ext.tree.TreeEventModel(this);
21995
        }
21996
 
21997
        this.nodeHash = {};
21998
 
21999
 
22000
        if(this.root){
22001
           this.setRootNode(this.root);
22002
        }
22003
 
22004
        this.addEvents(
22005
 
22006
 
22007
           "append",
22008
 
22009
           "remove",
22010
 
22011
           "movenode",
22012
 
22013
           "insert",
22014
 
22015
           "beforeappend",
22016
 
22017
           "beforeremove",
22018
 
22019
           "beforemovenode",
22020
 
22021
            "beforeinsert",
22022
 
22023
 
22024
            "beforeload",
22025
 
22026
            "load",
22027
 
22028
            "textchange",
22029
 
22030
            "beforeexpandnode",
22031
 
22032
            "beforecollapsenode",
22033
 
22034
            "expandnode",
22035
 
22036
            "disabledchange",
22037
 
22038
            "collapsenode",
22039
 
22040
            "beforeclick",
22041
 
22042
            "click",
22043
 
22044
            "checkchange",
22045
 
22046
            "dblclick",
22047
 
22048
            "contextmenu",
22049
 
22050
            "beforechildrenrendered",
22051
 
22052
            "startdrag",
22053
 
22054
            "enddrag",
22055
 
22056
            "dragdrop",
22057
 
22058
            "beforenodedrop",
22059
 
22060
            "nodedrop",
22061
 
22062
            "nodedragover"
22063
        );
22064
        if(this.singleExpand){
22065
            this.on("beforeexpandnode", this.restrictExpand, this);
22066
        }
22067
    },
22068
 
22069
 
22070
    proxyNodeEvent : function(ename, a1, a2, a3, a4, a5, a6){
22071
        if(ename == 'collapse' || ename == 'expand' || ename == 'beforecollapse' || ename == 'beforeexpand' || ename == 'move' || ename == 'beforemove'){
22072
            ename = ename+'node';
22073
        }
22074
 
22075
        return this.fireEvent(ename, a1, a2, a3, a4, a5, a6);
22076
    },
22077
 
22078
 
22079
 
22080
    getRootNode : function(){
22081
        return this.root;
22082
    },
22083
 
22084
 
22085
    setRootNode : function(node){
22086
        this.root = node;
22087
        node.ownerTree = this;
22088
        node.isRoot = true;
22089
        this.registerNode(node);
22090
        if(!this.rootVisible){
22091
        	var uiP = node.attributes.uiProvider;
22092
        	node.ui = uiP ? new uiP(node) : new Ext.tree.RootTreeNodeUI(node);
22093
        }
22094
        return node;
22095
    },
22096
 
22097
 
22098
    getNodeById : function(id){
22099
        return this.nodeHash[id];
22100
    },
22101
 
22102
 
22103
    registerNode : function(node){
22104
        this.nodeHash[node.id] = node;
22105
    },
22106
 
22107
 
22108
    unregisterNode : function(node){
22109
        delete this.nodeHash[node.id];
22110
    },
22111
 
22112
 
22113
    toString : function(){
22114
        return "[Tree"+(this.id?" "+this.id:"")+"]";
22115
    },
22116
 
22117
 
22118
    restrictExpand : function(node){
22119
        var p = node.parentNode;
22120
        if(p){
22121
            if(p.expandedChild && p.expandedChild.parentNode == p){
22122
                p.expandedChild.collapse();
22123
            }
22124
            p.expandedChild = node;
22125
        }
22126
    },
22127
 
22128
 
22129
    getChecked : function(a, startNode){
22130
        startNode = startNode || this.root;
22131
        var r = [];
22132
        var f = function(){
22133
            if(this.attributes.checked){
22134
                r.push(!a ? this : (a == 'id' ? this.id : this.attributes[a]));
22135
            }
22136
        }
22137
        startNode.cascade(f);
22138
        return r;
22139
    },
22140
 
22141
 
22142
    getEl : function(){
22143
        return this.el;
22144
    },
22145
 
22146
 
22147
    getLoader : function(){
22148
        return this.loader;
22149
    },
22150
 
22151
 
22152
    expandAll : function(){
22153
        this.root.expand(true);
22154
    },
22155
 
22156
 
22157
    collapseAll : function(){
22158
        this.root.collapse(true);
22159
    },
22160
 
22161
 
22162
    getSelectionModel : function(){
22163
        if(!this.selModel){
22164
            this.selModel = new Ext.tree.DefaultSelectionModel();
22165
        }
22166
        return this.selModel;
22167
    },
22168
 
22169
 
22170
    expandPath : function(path, attr, callback){
22171
        attr = attr || "id";
22172
        var keys = path.split(this.pathSeparator);
22173
        var curNode = this.root;
22174
        if(curNode.attributes[attr] != keys[1]){
22175
            if(callback){
22176
                callback(false, null);
22177
            }
22178
            return;
22179
        }
22180
        var index = 1;
22181
        var f = function(){
22182
            if(++index == keys.length){
22183
                if(callback){
22184
                    callback(true, curNode);
22185
                }
22186
                return;
22187
            }
22188
            var c = curNode.findChild(attr, keys[index]);
22189
            if(!c){
22190
                if(callback){
22191
                    callback(false, curNode);
22192
                }
22193
                return;
22194
            }
22195
            curNode = c;
22196
            c.expand(false, false, f);
22197
        };
22198
        curNode.expand(false, false, f);
22199
    },
22200
 
22201
 
22202
    selectPath : function(path, attr, callback){
22203
        attr = attr || "id";
22204
        var keys = path.split(this.pathSeparator);
22205
        var v = keys.pop();
22206
        if(keys.length > 0){
22207
            var f = function(success, node){
22208
                if(success && node){
22209
                    var n = node.findChild(attr, v);
22210
                    if(n){
22211
                        n.select();
22212
                        if(callback){
22213
                            callback(true, n);
22214
                        }
22215
                    }else if(callback){
22216
                        callback(false, n);
22217
                    }
22218
                }else{
22219
                    if(callback){
22220
                        callback(false, n);
22221
                    }
22222
                }
22223
            };
22224
            this.expandPath(keys.join(this.pathSeparator), attr, f);
22225
        }else{
22226
            this.root.select();
22227
            if(callback){
22228
                callback(true, this.root);
22229
            }
22230
        }
22231
    },
22232
 
22233
 
22234
    getTreeEl : function(){
22235
        return this.body;
22236
    },
22237
 
22238
 
22239
    onRender : function(ct, position){
22240
        Ext.tree.TreePanel.superclass.onRender.call(this, ct, position);
22241
        this.el.addClass('x-tree');
22242
        this.innerCt = this.body.createChild({tag:"ul",
22243
               cls:"x-tree-root-ct " +
22244
               (this.useArrows ? 'x-tree-arrows' : this.lines ? "x-tree-lines" : "x-tree-no-lines")});
22245
    },
22246
 
22247
 
22248
    initEvents : function(){
22249
        Ext.tree.TreePanel.superclass.initEvents.call(this);
22250
 
22251
        if(this.containerScroll){
22252
            Ext.dd.ScrollManager.register(this.body);
22253
        }
22254
        if((this.enableDD || this.enableDrop) && !this.dropZone){
22255
 
22256
             this.dropZone = new Ext.tree.TreeDropZone(this, this.dropConfig || {
22257
               ddGroup: this.ddGroup || "TreeDD", appendOnly: this.ddAppendOnly === true
22258
           });
22259
        }
22260
        if((this.enableDD || this.enableDrag) && !this.dragZone){
22261
 
22262
            this.dragZone = new Ext.tree.TreeDragZone(this, this.dragConfig || {
22263
               ddGroup: this.ddGroup || "TreeDD",
22264
               scroll: this.ddScroll
22265
           });
22266
        }
22267
        this.getSelectionModel().init(this);
22268
    },
22269
 
22270
 
22271
    afterRender : function(){
22272
        Ext.tree.TreePanel.superclass.afterRender.call(this);
22273
        this.root.render();
22274
        if(!this.rootVisible){
22275
            this.root.renderChildren();
22276
        }
22277
    },
22278
 
22279
    onDestroy : function(){
22280
        if(this.rendered){
22281
            this.body.removeAllListeners();
22282
            Ext.dd.ScrollManager.unregister(this.body);
22283
            if(this.dropZone){
22284
                this.dropZone.unreg();
22285
            }
22286
            if(this.dragZone){
22287
               this.dragZone.unreg();
22288
            }
22289
        }
22290
        this.root.destroy();
22291
        this.nodeHash = null;
22292
        Ext.tree.TreePanel.superclass.onDestroy.call(this);
22293
    }
22294
 
22295
 
22296
 
22297
 
22298
 
22299
 
22300
 
22301
 
22302
 
22303
 
22304
 
22305
 
22306
 
22307
 
22308
 
22309
 
22310
 
22311
 
22312
 
22313
 
22314
 
22315
 
22316
 
22317
 
22318
 
22319
 
22320
 
22321
 
22322
 
22323
 
22324
 
22325
 
22326
 
22327
 
22328
 
22329
 
22330
 
22331
 
22332
 
22333
 
22334
 
22335
 
22336
 
22337
 
22338
 
22339
 
22340
 
22341
});
22342
Ext.reg('treepanel', Ext.tree.TreePanel);
22343
Ext.tree.TreeEventModel = function(tree){
22344
    this.tree = tree;
22345
    this.tree.on('render', this.initEvents, this);
22346
}
22347
 
22348
Ext.tree.TreeEventModel.prototype = {
22349
    initEvents : function(){
22350
        var el = this.tree.getTreeEl();
22351
        el.on('click', this.delegateClick, this);
22352
        if(this.tree.trackMouseOver !== false){
22353
            el.on('mouseover', this.delegateOver, this);
22354
            el.on('mouseout', this.delegateOut, this);
22355
        }
22356
        el.on('dblclick', this.delegateDblClick, this);
22357
        el.on('contextmenu', this.delegateContextMenu, this);
22358
    },
22359
 
22360
    getNode : function(e){
22361
        var t;
22362
        if(t = e.getTarget('.x-tree-node-el', 10)){
22363
            var id = Ext.fly(t, '_treeEvents').getAttributeNS('ext', 'tree-node-id');
22364
            if(id){
22365
                return this.tree.getNodeById(id);
22366
            }
22367
        }
22368
        return null;
22369
    },
22370
 
22371
    getNodeTarget : function(e){
22372
        var t = e.getTarget('.x-tree-node-icon', 1);
22373
        if(!t){
22374
            t = e.getTarget('.x-tree-node-el', 6);
22375
        }
22376
        return t;
22377
    },
22378
 
22379
    delegateOut : function(e, t){
22380
        if(!this.beforeEvent(e)){
22381
            return;
22382
        }
22383
        if(e.getTarget('.x-tree-ec-icon', 1)){
22384
            var n = this.getNode(e);
22385
            this.onIconOut(e, n);
22386
            if(n == this.lastEcOver){
22387
                delete this.lastEcOver;
22388
            }
22389
        }
22390
        if((t = this.getNodeTarget(e)) && !e.within(t, true)){
22391
            this.onNodeOut(e, this.getNode(e));
22392
        }
22393
    },
22394
 
22395
    delegateOver : function(e, t){
22396
        if(!this.beforeEvent(e)){
22397
            return;
22398
        }
22399
        if(this.lastEcOver){
22400
            this.onIconOut(e, this.lastEcOver);
22401
            delete this.lastEcOver;
22402
        }
22403
        if(e.getTarget('.x-tree-ec-icon', 1)){
22404
            this.lastEcOver = this.getNode(e);
22405
            this.onIconOver(e, this.lastEcOver);
22406
        }
22407
        if(t = this.getNodeTarget(e)){
22408
            this.onNodeOver(e, this.getNode(e));
22409
        }
22410
    },
22411
 
22412
    delegateClick : function(e, t){
22413
        if(!this.beforeEvent(e)){
22414
            return;
22415
        }
22416
 
22417
        if(e.getTarget('input[type=checkbox]', 1)){
22418
            this.onCheckboxClick(e, this.getNode(e));
22419
        }
22420
        else if(e.getTarget('.x-tree-ec-icon', 1)){
22421
            this.onIconClick(e, this.getNode(e));
22422
        }
22423
        else if(this.getNodeTarget(e)){
22424
            this.onNodeClick(e, this.getNode(e));
22425
        }
22426
    },
22427
 
22428
    delegateDblClick : function(e, t){
22429
        if(this.beforeEvent(e) && this.getNodeTarget(e)){
22430
            this.onNodeDblClick(e, this.getNode(e));
22431
        }
22432
    },
22433
 
22434
    delegateContextMenu : function(e, t){
22435
        if(this.beforeEvent(e) && this.getNodeTarget(e)){
22436
            this.onNodeContextMenu(e, this.getNode(e));
22437
        }
22438
    },
22439
 
22440
    onNodeClick : function(e, node){
22441
        node.ui.onClick(e);
22442
    },
22443
 
22444
    onNodeOver : function(e, node){
22445
        node.ui.onOver(e);
22446
    },
22447
 
22448
    onNodeOut : function(e, node){
22449
        node.ui.onOut(e);
22450
    },
22451
 
22452
    onIconOver : function(e, node){
22453
        node.ui.addClass('x-tree-ec-over');
22454
    },
22455
 
22456
    onIconOut : function(e, node){
22457
        node.ui.removeClass('x-tree-ec-over');
22458
    },
22459
 
22460
    onIconClick : function(e, node){
22461
        node.ui.ecClick(e);
22462
    },
22463
 
22464
    onCheckboxClick : function(e, node){
22465
        node.ui.onCheckChange(e);
22466
    },
22467
 
22468
    onNodeDblClick : function(e, node){
22469
        node.ui.onDblClick(e);
22470
    },
22471
 
22472
    onNodeContextMenu : function(e, node){
22473
        node.ui.onContextMenu(e);
22474
    },
22475
 
22476
    beforeEvent : function(e){
22477
        if(this.disabled){
22478
            e.stopEvent();
22479
            return false;
22480
        }
22481
        return true;
22482
    },
22483
 
22484
    disable: function(){
22485
        this.disabled = true;
22486
    },
22487
 
22488
    enable: function(){
22489
        this.disabled = false;
22490
    }
22491
};
22492
 
22493
Ext.tree.DefaultSelectionModel = function(config){
22494
   this.selNode = null;
22495
 
22496
   this.addEvents(
22497
 
22498
       "selectionchange",
22499
 
22500
 
22501
       "beforeselect"
22502
   );
22503
 
22504
    Ext.apply(this, config);
22505
    Ext.tree.DefaultSelectionModel.superclass.constructor.call(this);
22506
};
22507
 
22508
Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {
22509
    init : function(tree){
22510
        this.tree = tree;
22511
        tree.getTreeEl().on("keydown", this.onKeyDown, this);
22512
        tree.on("click", this.onNodeClick, this);
22513
    },
22514
 
22515
    onNodeClick : function(node, e){
22516
        this.select(node);
22517
    },
22518
 
22519
 
22520
    select : function(node){
22521
        var last = this.selNode;
22522
        if(last != node && this.fireEvent('beforeselect', this, node, last) !== false){
22523
            if(last){
22524
                last.ui.onSelectedChange(false);
22525
            }
22526
            this.selNode = node;
22527
            node.ui.onSelectedChange(true);
22528
            this.fireEvent("selectionchange", this, node, last);
22529
        }
22530
        return node;
22531
    },
22532
 
22533
 
22534
    unselect : function(node){
22535
        if(this.selNode == node){
22536
            this.clearSelections();
22537
        }
22538
    },
22539
 
22540
 
22541
    clearSelections : function(){
22542
        var n = this.selNode;
22543
        if(n){
22544
            n.ui.onSelectedChange(false);
22545
            this.selNode = null;
22546
            this.fireEvent("selectionchange", this, null);
22547
        }
22548
        return n;
22549
    },
22550
 
22551
 
22552
    getSelectedNode : function(){
22553
        return this.selNode;
22554
    },
22555
 
22556
 
22557
    isSelected : function(node){
22558
        return this.selNode == node;
22559
    },
22560
 
22561
 
22562
    selectPrevious : function(){
22563
        var s = this.selNode || this.lastSelNode;
22564
        if(!s){
22565
            return null;
22566
        }
22567
        var ps = s.previousSibling;
22568
        if(ps){
22569
            if(!ps.isExpanded() || ps.childNodes.length < 1){
22570
                return this.select(ps);
22571
            } else{
22572
                var lc = ps.lastChild;
22573
                while(lc && lc.isExpanded() && lc.childNodes.length > 0){
22574
                    lc = lc.lastChild;
22575
                }
22576
                return this.select(lc);
22577
            }
22578
        } else if(s.parentNode && (this.tree.rootVisible || !s.parentNode.isRoot)){
22579
            return this.select(s.parentNode);
22580
        }
22581
        return null;
22582
    },
22583
 
22584
 
22585
    selectNext : function(){
22586
        var s = this.selNode || this.lastSelNode;
22587
        if(!s){
22588
            return null;
22589
        }
22590
        if(s.firstChild && s.isExpanded()){
22591
             return this.select(s.firstChild);
22592
         }else if(s.nextSibling){
22593
             return this.select(s.nextSibling);
22594
         }else if(s.parentNode){
22595
            var newS = null;
22596
            s.parentNode.bubble(function(){
22597
                if(this.nextSibling){
22598
                    newS = this.getOwnerTree().selModel.select(this.nextSibling);
22599
                    return false;
22600
                }
22601
            });
22602
            return newS;
22603
         }
22604
        return null;
22605
    },
22606
 
22607
    onKeyDown : function(e){
22608
        var s = this.selNode || this.lastSelNode;
22609
 
22610
        var sm = this;
22611
        if(!s){
22612
            return;
22613
        }
22614
        var k = e.getKey();
22615
        switch(k){
22616
             case e.DOWN:
22617
                 e.stopEvent();
22618
                 this.selectNext();
22619
             break;
22620
             case e.UP:
22621
                 e.stopEvent();
22622
                 this.selectPrevious();
22623
             break;
22624
             case e.RIGHT:
22625
                 e.preventDefault();
22626
                 if(s.hasChildNodes()){
22627
                     if(!s.isExpanded()){
22628
                         s.expand();
22629
                     }else if(s.firstChild){
22630
                         this.select(s.firstChild, e);
22631
                     }
22632
                 }
22633
             break;
22634
             case e.LEFT:
22635
                 e.preventDefault();
22636
                 if(s.hasChildNodes() && s.isExpanded()){
22637
                     s.collapse();
22638
                 }else if(s.parentNode && (this.tree.rootVisible || s.parentNode != this.tree.getRootNode())){
22639
                     this.select(s.parentNode, e);
22640
                 }
22641
             break;
22642
        };
22643
    }
22644
});
22645
 
22646
 
22647
Ext.tree.MultiSelectionModel = function(config){
22648
   this.selNodes = [];
22649
   this.selMap = {};
22650
   this.addEvents(
22651
 
22652
       "selectionchange"
22653
   );
22654
    Ext.apply(this, config);
22655
    Ext.tree.MultiSelectionModel.superclass.constructor.call(this);
22656
};
22657
 
22658
Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {
22659
    init : function(tree){
22660
        this.tree = tree;
22661
        tree.getTreeEl().on("keydown", this.onKeyDown, this);
22662
        tree.on("click", this.onNodeClick, this);
22663
    },
22664
 
22665
    onNodeClick : function(node, e){
22666
        this.select(node, e, e.ctrlKey);
22667
    },
22668
 
22669
 
22670
    select : function(node, e, keepExisting){
22671
        if(keepExisting !== true){
22672
            this.clearSelections(true);
22673
        }
22674
        if(this.isSelected(node)){
22675
            this.lastSelNode = node;
22676
            return node;
22677
        }
22678
        this.selNodes.push(node);
22679
        this.selMap[node.id] = node;
22680
        this.lastSelNode = node;
22681
        node.ui.onSelectedChange(true);
22682
        this.fireEvent("selectionchange", this, this.selNodes);
22683
        return node;
22684
    },
22685
 
22686
 
22687
    unselect : function(node){
22688
        if(this.selMap[node.id]){
22689
            node.ui.onSelectedChange(false);
22690
            var sn = this.selNodes;
22691
            var index = sn.indexOf(node);
22692
            if(index != -1){
22693
                this.selNodes.splice(index, 1);
22694
            }
22695
            delete this.selMap[node.id];
22696
            this.fireEvent("selectionchange", this, this.selNodes);
22697
        }
22698
    },
22699
 
22700
 
22701
    clearSelections : function(suppressEvent){
22702
        var sn = this.selNodes;
22703
        if(sn.length > 0){
22704
            for(var i = 0, len = sn.length; i < len; i++){
22705
                sn[i].ui.onSelectedChange(false);
22706
            }
22707
            this.selNodes = [];
22708
            this.selMap = {};
22709
            if(suppressEvent !== true){
22710
                this.fireEvent("selectionchange", this, this.selNodes);
22711
            }
22712
        }
22713
    },
22714
 
22715
 
22716
    isSelected : function(node){
22717
        return this.selMap[node.id] ? true : false;
22718
    },
22719
 
22720
 
22721
    getSelectedNodes : function(){
22722
        return this.selNodes;
22723
    },
22724
 
22725
    onKeyDown : Ext.tree.DefaultSelectionModel.prototype.onKeyDown,
22726
 
22727
    selectNext : Ext.tree.DefaultSelectionModel.prototype.selectNext,
22728
 
22729
    selectPrevious : Ext.tree.DefaultSelectionModel.prototype.selectPrevious
22730
});
22731
 
22732
Ext.tree.TreeNode = function(attributes){
22733
    attributes = attributes || {};
22734
    if(typeof attributes == "string"){
22735
        attributes = {text: attributes};
22736
    }
22737
    this.childrenRendered = false;
22738
    this.rendered = false;
22739
    Ext.tree.TreeNode.superclass.constructor.call(this, attributes);
22740
    this.expanded = attributes.expanded === true;
22741
    this.isTarget = attributes.isTarget !== false;
22742
    this.draggable = attributes.draggable !== false && attributes.allowDrag !== false;
22743
    this.allowChildren = attributes.allowChildren !== false && attributes.allowDrop !== false;
22744
 
22745
 
22746
    this.text = attributes.text;
22747
 
22748
    this.disabled = attributes.disabled === true;
22749
 
22750
    this.addEvents(
22751
 
22752
        "textchange",
22753
 
22754
        "beforeexpand",
22755
 
22756
        "beforecollapse",
22757
 
22758
        "expand",
22759
 
22760
        "disabledchange",
22761
 
22762
        "collapse",
22763
 
22764
        "beforeclick",
22765
 
22766
        "click",
22767
 
22768
        "checkchange",
22769
 
22770
        "dblclick",
22771
 
22772
        "contextmenu",
22773
 
22774
        "beforechildrenrendered"
22775
    );
22776
 
22777
    var uiClass = this.attributes.uiProvider || this.defaultUI || Ext.tree.TreeNodeUI;
22778
 
22779
 
22780
    this.ui = new uiClass(this);
22781
};
22782
Ext.extend(Ext.tree.TreeNode, Ext.data.Node, {
22783
    preventHScroll: true,
22784
 
22785
    isExpanded : function(){
22786
        return this.expanded;
22787
    },
22788
 
22789
 
22790
    getUI : function(){
22791
        return this.ui;
22792
    },
22793
 
22794
 
22795
    setFirstChild : function(node){
22796
        var of = this.firstChild;
22797
        Ext.tree.TreeNode.superclass.setFirstChild.call(this, node);
22798
        if(this.childrenRendered && of && node != of){
22799
            of.renderIndent(true, true);
22800
        }
22801
        if(this.rendered){
22802
            this.renderIndent(true, true);
22803
        }
22804
    },
22805
 
22806
 
22807
    setLastChild : function(node){
22808
        var ol = this.lastChild;
22809
        Ext.tree.TreeNode.superclass.setLastChild.call(this, node);
22810
        if(this.childrenRendered && ol && node != ol){
22811
            ol.renderIndent(true, true);
22812
        }
22813
        if(this.rendered){
22814
            this.renderIndent(true, true);
22815
        }
22816
    },
22817
 
22818
 
22819
 
22820
    appendChild : function(){
22821
        var node = Ext.tree.TreeNode.superclass.appendChild.apply(this, arguments);
22822
        if(node && this.childrenRendered){
22823
            node.render();
22824
        }
22825
        this.ui.updateExpandIcon();
22826
        return node;
22827
    },
22828
 
22829
 
22830
    removeChild : function(node){
22831
        this.ownerTree.getSelectionModel().unselect(node);
22832
        Ext.tree.TreeNode.superclass.removeChild.apply(this, arguments);
22833
 
22834
        if(this.childrenRendered){
22835
            node.ui.remove();
22836
        }
22837
        if(this.childNodes.length < 1){
22838
            this.collapse(false, false);
22839
        }else{
22840
            this.ui.updateExpandIcon();
22841
        }
22842
        if(!this.firstChild && !this.isHiddenRoot()) {
22843
            this.childrenRendered = false;
22844
        }
22845
        return node;
22846
    },
22847
 
22848
 
22849
    insertBefore : function(node, refNode){
22850
        var newNode = Ext.tree.TreeNode.superclass.insertBefore.apply(this, arguments);
22851
        if(newNode && refNode && this.childrenRendered){
22852
            node.render();
22853
        }
22854
        this.ui.updateExpandIcon();
22855
        return newNode;
22856
    },
22857
 
22858
 
22859
    setText : function(text){
22860
        var oldText = this.text;
22861
        this.text = text;
22862
        this.attributes.text = text;
22863
        if(this.rendered){
22864
            this.ui.onTextChange(this, text, oldText);
22865
        }
22866
        this.fireEvent("textchange", this, text, oldText);
22867
    },
22868
 
22869
 
22870
    select : function(){
22871
        this.getOwnerTree().getSelectionModel().select(this);
22872
    },
22873
 
22874
 
22875
    unselect : function(){
22876
        this.getOwnerTree().getSelectionModel().unselect(this);
22877
    },
22878
 
22879
 
22880
    isSelected : function(){
22881
        return this.getOwnerTree().getSelectionModel().isSelected(this);
22882
    },
22883
 
22884
 
22885
    expand : function(deep, anim, callback){
22886
        if(!this.expanded){
22887
            if(this.fireEvent("beforeexpand", this, deep, anim) === false){
22888
                return;
22889
            }
22890
            if(!this.childrenRendered){
22891
                this.renderChildren();
22892
            }
22893
            this.expanded = true;
22894
            if(!this.isHiddenRoot() && (this.getOwnerTree().animate && anim !== false) || anim){
22895
                this.ui.animExpand(function(){
22896
                    this.fireEvent("expand", this);
22897
                    if(typeof callback == "function"){
22898
                        callback(this);
22899
                    }
22900
                    if(deep === true){
22901
                        this.expandChildNodes(true);
22902
                    }
22903
                }.createDelegate(this));
22904
                return;
22905
            }else{
22906
                this.ui.expand();
22907
                this.fireEvent("expand", this);
22908
                if(typeof callback == "function"){
22909
                    callback(this);
22910
                }
22911
            }
22912
        }else{
22913
           if(typeof callback == "function"){
22914
               callback(this);
22915
           }
22916
        }
22917
        if(deep === true){
22918
            this.expandChildNodes(true);
22919
        }
22920
    },
22921
 
22922
    isHiddenRoot : function(){
22923
        return this.isRoot && !this.getOwnerTree().rootVisible;
22924
    },
22925
 
22926
 
22927
    collapse : function(deep, anim){
22928
        if(this.expanded && !this.isHiddenRoot()){
22929
            if(this.fireEvent("beforecollapse", this, deep, anim) === false){
22930
                return;
22931
            }
22932
            this.expanded = false;
22933
            if((this.getOwnerTree().animate && anim !== false) || anim){
22934
                this.ui.animCollapse(function(){
22935
                    this.fireEvent("collapse", this);
22936
                    if(deep === true){
22937
                        this.collapseChildNodes(true);
22938
                    }
22939
                }.createDelegate(this));
22940
                return;
22941
            }else{
22942
                this.ui.collapse();
22943
                this.fireEvent("collapse", this);
22944
            }
22945
        }
22946
        if(deep === true){
22947
            var cs = this.childNodes;
22948
            for(var i = 0, len = cs.length; i < len; i++) {
22949
            	cs[i].collapse(true, false);
22950
            }
22951
        }
22952
    },
22953
 
22954
 
22955
    delayedExpand : function(delay){
22956
        if(!this.expandProcId){
22957
            this.expandProcId = this.expand.defer(delay, this);
22958
        }
22959
    },
22960
 
22961
 
22962
    cancelExpand : function(){
22963
        if(this.expandProcId){
22964
            clearTimeout(this.expandProcId);
22965
        }
22966
        this.expandProcId = false;
22967
    },
22968
 
22969
 
22970
    toggle : function(){
22971
        if(this.expanded){
22972
            this.collapse();
22973
        }else{
22974
            this.expand();
22975
        }
22976
    },
22977
 
22978
 
22979
    ensureVisible : function(callback){
22980
        var tree = this.getOwnerTree();
22981
        tree.expandPath(this.parentNode.getPath(), false, function(){
22982
            var node = tree.getNodeById(this.id);
22983
            tree.getTreeEl().scrollChildIntoView(node.ui.anchor);
22984
            Ext.callback(callback);
22985
        }.createDelegate(this));
22986
    },
22987
 
22988
 
22989
    expandChildNodes : function(deep){
22990
        var cs = this.childNodes;
22991
        for(var i = 0, len = cs.length; i < len; i++) {
22992
        	cs[i].expand(deep);
22993
        }
22994
    },
22995
 
22996
 
22997
    collapseChildNodes : function(deep){
22998
        var cs = this.childNodes;
22999
        for(var i = 0, len = cs.length; i < len; i++) {
23000
        	cs[i].collapse(deep);
23001
        }
23002
    },
23003
 
23004
 
23005
    disable : function(){
23006
        this.disabled = true;
23007
        this.unselect();
23008
        if(this.rendered && this.ui.onDisableChange){
23009
            this.ui.onDisableChange(this, true);
23010
        }
23011
        this.fireEvent("disabledchange", this, true);
23012
    },
23013
 
23014
 
23015
    enable : function(){
23016
        this.disabled = false;
23017
        if(this.rendered && this.ui.onDisableChange){
23018
            this.ui.onDisableChange(this, false);
23019
        }
23020
        this.fireEvent("disabledchange", this, false);
23021
    },
23022
 
23023
 
23024
    renderChildren : function(suppressEvent){
23025
        if(suppressEvent !== false){
23026
            this.fireEvent("beforechildrenrendered", this);
23027
        }
23028
        var cs = this.childNodes;
23029
        for(var i = 0, len = cs.length; i < len; i++){
23030
            cs[i].render(true);
23031
        }
23032
        this.childrenRendered = true;
23033
    },
23034
 
23035
 
23036
    sort : function(fn, scope){
23037
        Ext.tree.TreeNode.superclass.sort.apply(this, arguments);
23038
        if(this.childrenRendered){
23039
            var cs = this.childNodes;
23040
            for(var i = 0, len = cs.length; i < len; i++){
23041
                cs[i].render(true);
23042
            }
23043
        }
23044
    },
23045
 
23046
 
23047
    render : function(bulkRender){
23048
        this.ui.render(bulkRender);
23049
        if(!this.rendered){
23050
 
23051
            this.getOwnerTree().registerNode(this);
23052
            this.rendered = true;
23053
            if(this.expanded){
23054
                this.expanded = false;
23055
                this.expand(false, false);
23056
            }
23057
        }
23058
    },
23059
 
23060
 
23061
    renderIndent : function(deep, refresh){
23062
        if(refresh){
23063
            this.ui.childIndent = null;
23064
        }
23065
        this.ui.renderIndent();
23066
        if(deep === true && this.childrenRendered){
23067
            var cs = this.childNodes;
23068
            for(var i = 0, len = cs.length; i < len; i++){
23069
                cs[i].renderIndent(true, refresh);
23070
            }
23071
        }
23072
    },
23073
 
23074
    beginUpdate : function(){
23075
        this.childrenRendered = false;
23076
    },
23077
 
23078
    endUpdate : function(){
23079
        if(this.expanded){
23080
            this.renderChildren();
23081
        }
23082
    },
23083
 
23084
    destroy : function(){
23085
        for(var i = 0,l = this.childNodes.length; i < l; i++){
23086
            this.childNodes[i].destroy();
23087
        }
23088
        this.childNodes = null;
23089
        if(this.ui.destroy){
23090
            this.ui.destroy();
23091
        }
23092
    }
23093
});
23094
 
23095
 Ext.tree.AsyncTreeNode = function(config){
23096
    this.loaded = false;
23097
    this.loading = false;
23098
    Ext.tree.AsyncTreeNode.superclass.constructor.apply(this, arguments);
23099
 
23100
    this.addEvents('beforeload', 'load');
23101
 
23102
 
23103
};
23104
Ext.extend(Ext.tree.AsyncTreeNode, Ext.tree.TreeNode, {
23105
    expand : function(deep, anim, callback){
23106
        if(this.loading){
23107
            var timer;
23108
            var f = function(){
23109
                if(!this.loading){
23110
                    clearInterval(timer);
23111
                    this.expand(deep, anim, callback);
23112
                }
23113
            }.createDelegate(this);
23114
            timer = setInterval(f, 200);
23115
            return;
23116
        }
23117
        if(!this.loaded){
23118
            if(this.fireEvent("beforeload", this) === false){
23119
                return;
23120
            }
23121
            this.loading = true;
23122
            this.ui.beforeLoad(this);
23123
            var loader = this.loader || this.attributes.loader || this.getOwnerTree().getLoader();
23124
            if(loader){
23125
                loader.load(this, this.loadComplete.createDelegate(this, [deep, anim, callback]));
23126
                return;
23127
            }
23128
        }
23129
        Ext.tree.AsyncTreeNode.superclass.expand.call(this, deep, anim, callback);
23130
    },
23131
 
23132
 
23133
    isLoading : function(){
23134
        return this.loading;
23135
    },
23136
 
23137
    loadComplete : function(deep, anim, callback){
23138
        this.loading = false;
23139
        this.loaded = true;
23140
        this.ui.afterLoad(this);
23141
        this.fireEvent("load", this);
23142
        this.expand(deep, anim, callback);
23143
    },
23144
 
23145
 
23146
    isLoaded : function(){
23147
        return this.loaded;
23148
    },
23149
 
23150
    hasChildNodes : function(){
23151
        if(!this.isLeaf() && !this.loaded){
23152
            return true;
23153
        }else{
23154
            return Ext.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);
23155
        }
23156
    },
23157
 
23158
 
23159
    reload : function(callback){
23160
        this.collapse(false, false);
23161
        while(this.firstChild){
23162
            this.removeChild(this.firstChild);
23163
        }
23164
        this.childrenRendered = false;
23165
        this.loaded = false;
23166
        if(this.isHiddenRoot()){
23167
            this.expanded = false;
23168
        }
23169
        this.expand(false, false, callback);
23170
    }
23171
});
23172
 
23173
Ext.tree.TreeNodeUI = function(node){
23174
    this.node = node;
23175
    this.rendered = false;
23176
    this.animating = false;
23177
    this.wasLeaf = true;
23178
    this.ecc = 'x-tree-ec-icon x-tree-elbow';
23179
    this.emptyIcon = Ext.BLANK_IMAGE_URL;
23180
};
23181
 
23182
Ext.tree.TreeNodeUI.prototype = {
23183
 
23184
    removeChild : function(node){
23185
        if(this.rendered){
23186
            this.ctNode.removeChild(node.ui.getEl());
23187
        }
23188
    },
23189
 
23190
 
23191
    beforeLoad : function(){
23192
         this.addClass("x-tree-node-loading");
23193
    },
23194
 
23195
 
23196
    afterLoad : function(){
23197
         this.removeClass("x-tree-node-loading");
23198
    },
23199
 
23200
 
23201
    onTextChange : function(node, text, oldText){
23202
        if(this.rendered){
23203
            this.textNode.innerHTML = text;
23204
        }
23205
    },
23206
 
23207
 
23208
    onDisableChange : function(node, state){
23209
        this.disabled = state;
23210
		if (this.checkbox) {
23211
			this.checkbox.disabled = state;
23212
		}
23213
        if(state){
23214
            this.addClass("x-tree-node-disabled");
23215
        }else{
23216
            this.removeClass("x-tree-node-disabled");
23217
        }
23218
    },
23219
 
23220
 
23221
    onSelectedChange : function(state){
23222
        if(state){
23223
            this.focus();
23224
            this.addClass("x-tree-selected");
23225
        }else{
23226
 
23227
            this.removeClass("x-tree-selected");
23228
        }
23229
    },
23230
 
23231
 
23232
    onMove : function(tree, node, oldParent, newParent, index, refNode){
23233
        this.childIndent = null;
23234
        if(this.rendered){
23235
            var targetNode = newParent.ui.getContainer();
23236
            if(!targetNode){
23237
                this.holder = document.createElement("div");
23238
                this.holder.appendChild(this.wrap);
23239
                return;
23240
            }
23241
            var insertBefore = refNode ? refNode.ui.getEl() : null;
23242
            if(insertBefore){
23243
                targetNode.insertBefore(this.wrap, insertBefore);
23244
            }else{
23245
                targetNode.appendChild(this.wrap);
23246
            }
23247
            this.node.renderIndent(true);
23248
        }
23249
    },
23250
 
23251
 
23252
    addClass : function(cls){
23253
        if(this.elNode){
23254
            Ext.fly(this.elNode).addClass(cls);
23255
        }
23256
    },
23257
 
23258
 
23259
    removeClass : function(cls){
23260
        if(this.elNode){
23261
            Ext.fly(this.elNode).removeClass(cls);
23262
        }
23263
    },
23264
 
23265
 
23266
    remove : function(){
23267
        if(this.rendered){
23268
            this.holder = document.createElement("div");
23269
            this.holder.appendChild(this.wrap);
23270
        }
23271
    },
23272
 
23273
 
23274
    fireEvent : function(){
23275
        return this.node.fireEvent.apply(this.node, arguments);
23276
    },
23277
 
23278
 
23279
    initEvents : function(){
23280
        this.node.on("move", this.onMove, this);
23281
 
23282
        if(this.node.disabled){
23283
            this.addClass("x-tree-node-disabled");
23284
			if (this.checkbox) {
23285
				this.checkbox.disabled = true;
23286
			}
23287
        }
23288
        if(this.node.hidden){
23289
            this.hide();
23290
        }
23291
        var ot = this.node.getOwnerTree();
23292
        var dd = ot.enableDD || ot.enableDrag || ot.enableDrop;
23293
        if(dd && (!this.node.isRoot || ot.rootVisible)){
23294
            Ext.dd.Registry.register(this.elNode, {
23295
                node: this.node,
23296
                handles: this.getDDHandles(),
23297
                isHandle: false
23298
            });
23299
        }
23300
    },
23301
 
23302
 
23303
    getDDHandles : function(){
23304
        return [this.iconNode, this.textNode, this.elNode];
23305
    },
23306
 
23307
 
23308
    hide : function(){
23309
        this.node.hidden = true;
23310
        if(this.wrap){
23311
            this.wrap.style.display = "none";
23312
        }
23313
    },
23314
 
23315
 
23316
    show : function(){
23317
        this.node.hidden = false;
23318
        if(this.wrap){
23319
            this.wrap.style.display = "";
23320
        }
23321
    },
23322
 
23323
 
23324
    onContextMenu : function(e){
23325
        if (this.node.hasListener("contextmenu") || this.node.getOwnerTree().hasListener("contextmenu")) {
23326
            e.preventDefault();
23327
            this.focus();
23328
            this.fireEvent("contextmenu", this.node, e);
23329
        }
23330
    },
23331
 
23332
 
23333
    onClick : function(e){
23334
        if(this.dropping){
23335
            e.stopEvent();
23336
            return;
23337
        }
23338
        if(this.fireEvent("beforeclick", this.node, e) !== false){
23339
            var a = e.getTarget('a');
23340
            if(!this.disabled && this.node.attributes.href && a){
23341
                this.fireEvent("click", this.node, e);
23342
                return;
23343
            }else if(a && e.ctrlKey){
23344
                e.stopEvent();
23345
            }
23346
            e.preventDefault();
23347
            if(this.disabled){
23348
                return;
23349
            }
23350
 
23351
            if(this.node.attributes.singleClickExpand && !this.animating && this.node.hasChildNodes()){
23352
                this.node.toggle();
23353
            }
23354
 
23355
            this.fireEvent("click", this.node, e);
23356
        }else{
23357
            e.stopEvent();
23358
        }
23359
    },
23360
 
23361
 
23362
    onDblClick : function(e){
23363
        e.preventDefault();
23364
        if(this.disabled){
23365
            return;
23366
        }
23367
        if(this.checkbox){
23368
            this.toggleCheck();
23369
        }
23370
        if(!this.animating && this.node.hasChildNodes()){
23371
            this.node.toggle();
23372
        }
23373
        this.fireEvent("dblclick", this.node, e);
23374
    },
23375
 
23376
    onOver : function(e){
23377
        this.addClass('x-tree-node-over');
23378
    },
23379
 
23380
    onOut : function(e){
23381
        this.removeClass('x-tree-node-over');
23382
    },
23383
 
23384
 
23385
    onCheckChange : function(){
23386
        var checked = this.checkbox.checked;
23387
        this.node.attributes.checked = checked;
23388
        this.fireEvent('checkchange', this.node, checked);
23389
    },
23390
 
23391
 
23392
    ecClick : function(e){
23393
        if(!this.animating && (this.node.hasChildNodes() || this.node.attributes.expandable)){
23394
            this.node.toggle();
23395
        }
23396
    },
23397
 
23398
 
23399
    startDrop : function(){
23400
        this.dropping = true;
23401
    },
23402
 
23403
 
23404
    endDrop : function(){
23405
       setTimeout(function(){
23406
           this.dropping = false;
23407
       }.createDelegate(this), 50);
23408
    },
23409
 
23410
 
23411
    expand : function(){
23412
        this.updateExpandIcon();
23413
        this.ctNode.style.display = "";
23414
    },
23415
 
23416
 
23417
    focus : function(){
23418
        if(!this.node.preventHScroll){
23419
            try{this.anchor.focus();
23420
            }catch(e){}
23421
        }else if(!Ext.isIE){
23422
            try{
23423
                var noscroll = this.node.getOwnerTree().getTreeEl().dom;
23424
                var l = noscroll.scrollLeft;
23425
                this.anchor.focus();
23426
                noscroll.scrollLeft = l;
23427
            }catch(e){}
23428
        }
23429
    },
23430
 
23431
 
23432
    toggleCheck : function(value){
23433
        var cb = this.checkbox;
23434
        if(cb){
23435
            cb.checked = (value === undefined ? !cb.checked : value);
23436
        }
23437
    },
23438
 
23439
 
23440
    blur : function(){
23441
        try{
23442
            this.anchor.blur();
23443
        }catch(e){}
23444
    },
23445
 
23446
 
23447
    animExpand : function(callback){
23448
        var ct = Ext.get(this.ctNode);
23449
        ct.stopFx();
23450
        if(!this.node.hasChildNodes()){
23451
            this.updateExpandIcon();
23452
            this.ctNode.style.display = "";
23453
            Ext.callback(callback);
23454
            return;
23455
        }
23456
        this.animating = true;
23457
        this.updateExpandIcon();
23458
 
23459
        ct.slideIn('t', {
23460
           callback : function(){
23461
               this.animating = false;
23462
               Ext.callback(callback);
23463
            },
23464
            scope: this,
23465
            duration: this.node.ownerTree.duration || .25
23466
        });
23467
    },
23468
 
23469
 
23470
    highlight : function(){
23471
        var tree = this.node.getOwnerTree();
23472
        Ext.fly(this.wrap).highlight(
23473
            tree.hlColor || "C3DAF9",
23474
            {endColor: tree.hlBaseColor}
23475
        );
23476
    },
23477
 
23478
 
23479
    collapse : function(){
23480
        this.updateExpandIcon();
23481
        this.ctNode.style.display = "none";
23482
    },
23483
 
23484
 
23485
    animCollapse : function(callback){
23486
        var ct = Ext.get(this.ctNode);
23487
        ct.enableDisplayMode('block');
23488
        ct.stopFx();
23489
 
23490
        this.animating = true;
23491
        this.updateExpandIcon();
23492
 
23493
        ct.slideOut('t', {
23494
            callback : function(){
23495
               this.animating = false;
23496
               Ext.callback(callback);
23497
            },
23498
            scope: this,
23499
            duration: this.node.ownerTree.duration || .25
23500
        });
23501
    },
23502
 
23503
 
23504
    getContainer : function(){
23505
        return this.ctNode;
23506
    },
23507
 
23508
 
23509
    getEl : function(){
23510
        return this.wrap;
23511
    },
23512
 
23513
 
23514
    appendDDGhost : function(ghostNode){
23515
        ghostNode.appendChild(this.elNode.cloneNode(true));
23516
    },
23517
 
23518
 
23519
    getDDRepairXY : function(){
23520
        return Ext.lib.Dom.getXY(this.iconNode);
23521
    },
23522
 
23523
 
23524
    onRender : function(){
23525
        this.render();
23526
    },
23527
 
23528
 
23529
    render : function(bulkRender){
23530
        var n = this.node, a = n.attributes;
23531
        var targetNode = n.parentNode ?
23532
              n.parentNode.ui.getContainer() : n.ownerTree.innerCt.dom;
23533
 
23534
        if(!this.rendered){
23535
            this.rendered = true;
23536
 
23537
            this.renderElements(n, a, targetNode, bulkRender);
23538
 
23539
            if(a.qtip){
23540
               if(this.textNode.setAttributeNS){
23541
                   this.textNode.setAttributeNS("ext", "qtip", a.qtip);
23542
                   if(a.qtipTitle){
23543
                       this.textNode.setAttributeNS("ext", "qtitle", a.qtipTitle);
23544
                   }
23545
               }else{
23546
                   this.textNode.setAttribute("ext:qtip", a.qtip);
23547
                   if(a.qtipTitle){
23548
                       this.textNode.setAttribute("ext:qtitle", a.qtipTitle);
23549
                   }
23550
               }
23551
            }else if(a.qtipCfg){
23552
                a.qtipCfg.target = Ext.id(this.textNode);
23553
                Ext.QuickTips.register(a.qtipCfg);
23554
            }
23555
            this.initEvents();
23556
            if(!this.node.expanded){
23557
                this.updateExpandIcon(true);
23558
            }
23559
        }else{
23560
            if(bulkRender === true) {
23561
                targetNode.appendChild(this.wrap);
23562
            }
23563
        }
23564
    },
23565
 
23566
 
23567
    renderElements : function(n, a, targetNode, bulkRender){
23568
 
23569
        this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
23570
 
23571
        var cb = typeof a.checked == 'boolean';
23572
 
23573
        var href = a.href ? a.href : Ext.isGecko ? "" : "#";
23574
        var buf = ['<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ', a.cls,'" unselectable="on">',
23575
            '<span class="x-tree-node-indent">',this.indentMarkup,"</span>",
23576
            '<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow" />',
23577
            '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " "+a.iconCls : ""),'" unselectable="on" />',
23578
            cb ? ('<input class="x-tree-node-cb" type="checkbox" ' + (a.checked ? 'checked="checked" />' : '/>')) : '',
23579
            '<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ',
23580
             a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '><span unselectable="on">',n.text,"</span></a></div>",
23581
            '<ul class="x-tree-node-ct" style="display:none;"></ul>',
23582
            "</li>"].join('');
23583
 
23584
        var nel;
23585
        if(bulkRender !== true && n.nextSibling && (nel = n.nextSibling.ui.getEl())){
23586
            this.wrap = Ext.DomHelper.insertHtml("beforeBegin", nel, buf);
23587
        }else{
23588
            this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf);
23589
        }
23590
 
23591
        this.elNode = this.wrap.childNodes[0];
23592
        this.ctNode = this.wrap.childNodes[1];
23593
        var cs = this.elNode.childNodes;
23594
        this.indentNode = cs[0];
23595
        this.ecNode = cs[1];
23596
        this.iconNode = cs[2];
23597
        var index = 3;
23598
        if(cb){
23599
            this.checkbox = cs[3];
23600
            index++;
23601
        }
23602
        this.anchor = cs[index];
23603
        this.textNode = cs[index].firstChild;
23604
    },
23605
 
23606
 
23607
    getAnchor : function(){
23608
        return this.anchor;
23609
    },
23610
 
23611
 
23612
    getTextEl : function(){
23613
        return this.textNode;
23614
    },
23615
 
23616
 
23617
    getIconEl : function(){
23618
        return this.iconNode;
23619
    },
23620
 
23621
 
23622
    isChecked : function(){
23623
        return this.checkbox ? this.checkbox.checked : false;
23624
    },
23625
 
23626
 
23627
    updateExpandIcon : function(){
23628
        if(this.rendered){
23629
            var n = this.node, c1, c2;
23630
            var cls = n.isLast() ? "x-tree-elbow-end" : "x-tree-elbow";
23631
            var hasChild = n.hasChildNodes();
23632
            if(hasChild || n.attributes.expandable){
23633
                if(n.expanded){
23634
                    cls += "-minus";
23635
                    c1 = "x-tree-node-collapsed";
23636
                    c2 = "x-tree-node-expanded";
23637
                }else{
23638
                    cls += "-plus";
23639
                    c1 = "x-tree-node-expanded";
23640
                    c2 = "x-tree-node-collapsed";
23641
                }
23642
                if(this.wasLeaf){
23643
                    this.removeClass("x-tree-node-leaf");
23644
                    this.wasLeaf = false;
23645
                }
23646
                if(this.c1 != c1 || this.c2 != c2){
23647
                    Ext.fly(this.elNode).replaceClass(c1, c2);
23648
                    this.c1 = c1; this.c2 = c2;
23649
                }
23650
            }else{
23651
                if(!this.wasLeaf){
23652
                    Ext.fly(this.elNode).replaceClass("x-tree-node-expanded", "x-tree-node-leaf");
23653
                    delete this.c1;
23654
                    delete this.c2;
23655
                    this.wasLeaf = true;
23656
                }
23657
            }
23658
            var ecc = "x-tree-ec-icon "+cls;
23659
            if(this.ecc != ecc){
23660
                this.ecNode.className = ecc;
23661
                this.ecc = ecc;
23662
            }
23663
        }
23664
    },
23665
 
23666
 
23667
    getChildIndent : function(){
23668
        if(!this.childIndent){
23669
            var buf = [];
23670
            var p = this.node;
23671
            while(p){
23672
                if(!p.isRoot || (p.isRoot && p.ownerTree.rootVisible)){
23673
                    if(!p.isLast()) {
23674
                        buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-elbow-line" />');
23675
                    } else {
23676
                        buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-icon" />');
23677
                    }
23678
                }
23679
                p = p.parentNode;
23680
            }
23681
            this.childIndent = buf.join("");
23682
        }
23683
        return this.childIndent;
23684
    },
23685
 
23686
 
23687
    renderIndent : function(){
23688
        if(this.rendered){
23689
            var indent = "";
23690
            var p = this.node.parentNode;
23691
            if(p){
23692
                indent = p.ui.getChildIndent();
23693
            }
23694
            if(this.indentMarkup != indent){
23695
                this.indentNode.innerHTML = indent;
23696
                this.indentMarkup = indent;
23697
            }
23698
            this.updateExpandIcon();
23699
        }
23700
    },
23701
 
23702
    destroy : function(){
23703
        if(this.elNode){
23704
            Ext.dd.Registry.unregister(this.elNode.id);
23705
        }
23706
        delete this.elNode;
23707
        delete this.ctNode;
23708
        delete this.indentNode;
23709
        delete this.ecNode;
23710
        delete this.iconNode;
23711
        delete this.checkbox;
23712
        delete this.anchor;
23713
        delete this.textNode;
23714
        Ext.removeNode(this.ctNode);
23715
    }
23716
};
23717
 
23718
 
23719
Ext.tree.RootTreeNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
23720
 
23721
    render : function(){
23722
        if(!this.rendered){
23723
            var targetNode = this.node.ownerTree.innerCt.dom;
23724
            this.node.expanded = true;
23725
            targetNode.innerHTML = '<div class="x-tree-root-node"></div>';
23726
            this.wrap = this.ctNode = targetNode.firstChild;
23727
        }
23728
    },
23729
    collapse : Ext.emptyFn,
23730
    expand : Ext.emptyFn
23731
});
23732
 
23733
Ext.tree.TreeLoader = function(config){
23734
    this.baseParams = {};
23735
    this.requestMethod = "POST";
23736
    Ext.apply(this, config);
23737
 
23738
    this.addEvents(
23739
 
23740
        "beforeload",
23741
 
23742
        "load",
23743
 
23744
        "loadexception"
23745
    );
23746
 
23747
    Ext.tree.TreeLoader.superclass.constructor.call(this);
23748
};
23749
 
23750
Ext.extend(Ext.tree.TreeLoader, Ext.util.Observable, {
23751
 
23752
 
23753
 
23754
 
23755
 
23756
 
23757
 
23758
    uiProviders : {},
23759
 
23760
 
23761
    clearOnLoad : true,
23762
 
23763
 
23764
    load : function(node, callback){
23765
        if(this.clearOnLoad){
23766
            while(node.firstChild){
23767
                node.removeChild(node.firstChild);
23768
            }
23769
        }
23770
        if(this.doPreload(node)){
23771
            if(typeof callback == "function"){
23772
                callback();
23773
            }
23774
        }else if(this.dataUrl||this.url){
23775
            this.requestData(node, callback);
23776
        }
23777
    },
23778
 
23779
    doPreload : function(node){
23780
        if(node.attributes.children){
23781
            if(node.childNodes.length < 1){
23782
                var cs = node.attributes.children;
23783
                node.beginUpdate();
23784
                for(var i = 0, len = cs.length; i < len; i++){
23785
                    var cn = node.appendChild(this.createNode(cs[i]));
23786
                    if(this.preloadChildren){
23787
                        this.doPreload(cn);
23788
                    }
23789
                }
23790
                node.endUpdate();
23791
            }
23792
            return true;
23793
        }else {
23794
            return false;
23795
        }
23796
    },
23797
 
23798
    getParams: function(node){
23799
        var buf = [], bp = this.baseParams;
23800
        for(var key in bp){
23801
            if(typeof bp[key] != "function"){
23802
                buf.push(encodeURIComponent(key), "=", encodeURIComponent(bp[key]), "&");
23803
            }
23804
        }
23805
        buf.push("node=", encodeURIComponent(node.id));
23806
        return buf.join("");
23807
    },
23808
 
23809
    requestData : function(node, callback){
23810
        if(this.fireEvent("beforeload", this, node, callback) !== false){
23811
            this.transId = Ext.Ajax.request({
23812
                method:this.requestMethod,
23813
                url: this.dataUrl||this.url,
23814
                success: this.handleResponse,
23815
                failure: this.handleFailure,
23816
                scope: this,
23817
                argument: {callback: callback, node: node},
23818
                params: this.getParams(node)
23819
            });
23820
        }else{
23821
 
23822
 
23823
            if(typeof callback == "function"){
23824
                callback();
23825
            }
23826
        }
23827
    },
23828
 
23829
    isLoading : function(){
23830
        return this.transId ? true : false;
23831
    },
23832
 
23833
    abort : function(){
23834
        if(this.isLoading()){
23835
            Ext.Ajax.abort(this.transId);
23836
        }
23837
    },
23838
 
23839
 
23840
    createNode : function(attr){
23841
 
23842
        if(this.baseAttrs){
23843
            Ext.applyIf(attr, this.baseAttrs);
23844
        }
23845
        if(this.applyLoader !== false){
23846
            attr.loader = this;
23847
        }
23848
        if(typeof attr.uiProvider == 'string'){
23849
           attr.uiProvider = this.uiProviders[attr.uiProvider] || eval(attr.uiProvider);
23850
        }
23851
        return(attr.leaf ?
23852
                        new Ext.tree.TreeNode(attr) :
23853
                        new Ext.tree.AsyncTreeNode(attr));
23854
    },
23855
 
23856
    processResponse : function(response, node, callback){
23857
        var json = response.responseText;
23858
        try {
23859
            var o = eval("("+json+")");
23860
            node.beginUpdate();
23861
            for(var i = 0, len = o.length; i < len; i++){
23862
                var n = this.createNode(o[i]);
23863
                if(n){
23864
                    node.appendChild(n);
23865
                }
23866
            }
23867
            node.endUpdate();
23868
            if(typeof callback == "function"){
23869
                callback(this, node);
23870
            }
23871
        }catch(e){
23872
            this.handleFailure(response);
23873
        }
23874
    },
23875
 
23876
    handleResponse : function(response){
23877
        this.transId = false;
23878
        var a = response.argument;
23879
        this.processResponse(response, a.node, a.callback);
23880
        this.fireEvent("load", this, a.node, response);
23881
    },
23882
 
23883
    handleFailure : function(response){
23884
        this.transId = false;
23885
        var a = response.argument;
23886
        this.fireEvent("loadexception", this, a.node, response);
23887
        if(typeof a.callback == "function"){
23888
            a.callback(this, a.node);
23889
        }
23890
    }
23891
});
23892
 
23893
Ext.tree.TreeFilter = function(tree, config){
23894
    this.tree = tree;
23895
    this.filtered = {};
23896
    Ext.apply(this, config);
23897
};
23898
 
23899
Ext.tree.TreeFilter.prototype = {
23900
    clearBlank:false,
23901
    reverse:false,
23902
    autoClear:false,
23903
    remove:false,
23904
 
23905
 
23906
    filter : function(value, attr, startNode){
23907
        attr = attr || "text";
23908
        var f;
23909
        if(typeof value == "string"){
23910
            var vlen = value.length;
23911
 
23912
            if(vlen == 0 && this.clearBlank){
23913
                this.clear();
23914
                return;
23915
            }
23916
            value = value.toLowerCase();
23917
            f = function(n){
23918
                return n.attributes[attr].substr(0, vlen).toLowerCase() == value;
23919
            };
23920
        }else if(value.exec){
23921
            f = function(n){
23922
                return value.test(n.attributes[attr]);
23923
            };
23924
        }else{
23925
            throw 'Illegal filter type, must be string or regex';
23926
        }
23927
        this.filterBy(f, null, startNode);
23928
	},
23929
 
23930
 
23931
    filterBy : function(fn, scope, startNode){
23932
        startNode = startNode || this.tree.root;
23933
        if(this.autoClear){
23934
            this.clear();
23935
        }
23936
        var af = this.filtered, rv = this.reverse;
23937
        var f = function(n){
23938
            if(n == startNode){
23939
                return true;
23940
            }
23941
            if(af[n.id]){
23942
                return false;
23943
            }
23944
            var m = fn.call(scope || n, n);
23945
            if(!m || rv){
23946
                af[n.id] = n;
23947
                n.ui.hide();
23948
                return false;
23949
            }
23950
            return true;
23951
        };
23952
        startNode.cascade(f);
23953
        if(this.remove){
23954
           for(var id in af){
23955
               if(typeof id != "function"){
23956
                   var n = af[id];
23957
                   if(n && n.parentNode){
23958
                       n.parentNode.removeChild(n);
23959
                   }
23960
               }
23961
           }
23962
        }
23963
    },
23964
 
23965
 
23966
    clear : function(){
23967
        var t = this.tree;
23968
        var af = this.filtered;
23969
        for(var id in af){
23970
            if(typeof id != "function"){
23971
                var n = af[id];
23972
                if(n){
23973
                    n.ui.show();
23974
                }
23975
            }
23976
        }
23977
        this.filtered = {};
23978
    }
23979
};
23980
 
23981
 
23982
Ext.tree.TreeSorter = function(tree, config){
23983
    Ext.apply(this, config);
23984
    tree.on("beforechildrenrendered", this.doSort, this);
23985
    tree.on("append", this.updateSort, this);
23986
    tree.on("insert", this.updateSort, this);
23987
    tree.on("textchange", this.updateSortParent, this);
23988
 
23989
    var dsc = this.dir && this.dir.toLowerCase() == "desc";
23990
    var p = this.property || "text";
23991
    var sortType = this.sortType;
23992
    var fs = this.folderSort;
23993
    var cs = this.caseSensitive === true;
23994
    var leafAttr = this.leafAttr || 'leaf';
23995
 
23996
    this.sortFn = function(n1, n2){
23997
        if(fs){
23998
            if(n1.attributes[leafAttr] && !n2.attributes[leafAttr]){
23999
                return 1;
24000
            }
24001
            if(!n1.attributes[leafAttr] && n2.attributes[leafAttr]){
24002
                return -1;
24003
            }
24004
        }
24005
    	var v1 = sortType ? sortType(n1) : (cs ? n1.attributes[p] : n1.attributes[p].toUpperCase());
24006
    	var v2 = sortType ? sortType(n2) : (cs ? n2.attributes[p] : n2.attributes[p].toUpperCase());
24007
    	if(v1 < v2){
24008
			return dsc ? +1 : -1;
24009
		}else if(v1 > v2){
24010
			return dsc ? -1 : +1;
24011
        }else{
24012
	    	return 0;
24013
        }
24014
    };
24015
};
24016
 
24017
Ext.tree.TreeSorter.prototype = {
24018
    doSort : function(node){
24019
        node.sort(this.sortFn);
24020
    },
24021
 
24022
    compareNodes : function(n1, n2){
24023
        return (n1.text.toUpperCase() > n2.text.toUpperCase() ? 1 : -1);
24024
    },
24025
 
24026
    updateSort : function(tree, node){
24027
        if(node.childrenRendered){
24028
            this.doSort.defer(1, this, [node]);
24029
        }
24030
    },
24031
 
24032
    updateSortParent : function(node){
24033
		var p = node.parentNode;
24034
		if(p && p.childrenRendered){
24035
            this.doSort.defer(1, this, [p]);
24036
        }
24037
    }
24038
};
24039
 
24040
if(Ext.dd.DropZone){
24041
 
24042
Ext.tree.TreeDropZone = function(tree, config){
24043
 
24044
    this.allowParentInsert = false;
24045
 
24046
    this.allowContainerDrop = false;
24047
 
24048
    this.appendOnly = false;
24049
    Ext.tree.TreeDropZone.superclass.constructor.call(this, tree.innerCt, config);
24050
 
24051
    this.tree = tree;
24052
 
24053
    this.dragOverData = {};
24054
 
24055
    this.lastInsertClass = "x-tree-no-status";
24056
};
24057
 
24058
Ext.extend(Ext.tree.TreeDropZone, Ext.dd.DropZone, {
24059
 
24060
    ddGroup : "TreeDD",
24061
 
24062
 
24063
    expandDelay : 1000,
24064
 
24065
 
24066
    expandNode : function(node){
24067
        if(node.hasChildNodes() && !node.isExpanded()){
24068
            node.expand(false, null, this.triggerCacheRefresh.createDelegate(this));
24069
        }
24070
    },
24071
 
24072
 
24073
    queueExpand : function(node){
24074
        this.expandProcId = this.expandNode.defer(this.expandDelay, this, [node]);
24075
    },
24076
 
24077
 
24078
    cancelExpand : function(){
24079
        if(this.expandProcId){
24080
            clearTimeout(this.expandProcId);
24081
            this.expandProcId = false;
24082
        }
24083
    },
24084
 
24085
 
24086
    isValidDropPoint : function(n, pt, dd, e, data){
24087
        if(!n || !data){ return false; }
24088
        var targetNode = n.node;
24089
        var dropNode = data.node;
24090
 
24091
        if(!(targetNode && targetNode.isTarget && pt)){
24092
            return false;
24093
        }
24094
        if(pt == "append" && targetNode.allowChildren === false){
24095
            return false;
24096
        }
24097
        if((pt == "above" || pt == "below") && (targetNode.parentNode && targetNode.parentNode.allowChildren === false)){
24098
            return false;
24099
        }
24100
        if(dropNode && (targetNode == dropNode || dropNode.contains(targetNode))){
24101
            return false;
24102
        }
24103
 
24104
        var overEvent = this.dragOverData;
24105
        overEvent.tree = this.tree;
24106
        overEvent.target = targetNode;
24107
        overEvent.data = data;
24108
        overEvent.point = pt;
24109
        overEvent.source = dd;
24110
        overEvent.rawEvent = e;
24111
        overEvent.dropNode = dropNode;
24112
        overEvent.cancel = false;
24113
        var result = this.tree.fireEvent("nodedragover", overEvent);
24114
        return overEvent.cancel === false && result !== false;
24115
    },
24116
 
24117
 
24118
    getDropPoint : function(e, n, dd){
24119
        var tn = n.node;
24120
        if(tn.isRoot){
24121
            return tn.allowChildren !== false ? "append" : false;
24122
        }
24123
        var dragEl = n.ddel;
24124
        var t = Ext.lib.Dom.getY(dragEl), b = t + dragEl.offsetHeight;
24125
        var y = Ext.lib.Event.getPageY(e);
24126
        var noAppend = tn.allowChildren === false || tn.isLeaf();
24127
        if(this.appendOnly || tn.parentNode.allowChildren === false){
24128
            return noAppend ? false : "append";
24129
        }
24130
        var noBelow = false;
24131
        if(!this.allowParentInsert){
24132
            noBelow = tn.hasChildNodes() && tn.isExpanded();
24133
        }
24134
        var q = (b - t) / (noAppend ? 2 : 3);
24135
        if(y >= t && y < (t + q)){
24136
            return "above";
24137
        }else if(!noBelow && (noAppend || y >= b-q && y <= b)){
24138
            return "below";
24139
        }else{
24140
            return "append";
24141
        }
24142
    },
24143
 
24144
 
24145
    onNodeEnter : function(n, dd, e, data){
24146
        this.cancelExpand();
24147
    },
24148
 
24149
 
24150
    onNodeOver : function(n, dd, e, data){
24151
        var pt = this.getDropPoint(e, n, dd);
24152
        var node = n.node;
24153
 
24154
 
24155
        if(!this.expandProcId && pt == "append" && node.hasChildNodes() && !n.node.isExpanded()){
24156
            this.queueExpand(node);
24157
        }else if(pt != "append"){
24158
            this.cancelExpand();
24159
        }
24160
 
24161
 
24162
        var returnCls = this.dropNotAllowed;
24163
        if(this.isValidDropPoint(n, pt, dd, e, data)){
24164
           if(pt){
24165
               var el = n.ddel;
24166
               var cls;
24167
               if(pt == "above"){
24168
                   returnCls = n.node.isFirst() ? "x-tree-drop-ok-above" : "x-tree-drop-ok-between";
24169
                   cls = "x-tree-drag-insert-above";
24170
               }else if(pt == "below"){
24171
                   returnCls = n.node.isLast() ? "x-tree-drop-ok-below" : "x-tree-drop-ok-between";
24172
                   cls = "x-tree-drag-insert-below";
24173
               }else{
24174
                   returnCls = "x-tree-drop-ok-append";
24175
                   cls = "x-tree-drag-append";
24176
               }
24177
               if(this.lastInsertClass != cls){
24178
                   Ext.fly(el).replaceClass(this.lastInsertClass, cls);
24179
                   this.lastInsertClass = cls;
24180
               }
24181
           }
24182
       }
24183
       return returnCls;
24184
    },
24185
 
24186
 
24187
    onNodeOut : function(n, dd, e, data){
24188
        this.cancelExpand();
24189
        this.removeDropIndicators(n);
24190
    },
24191
 
24192
 
24193
    onNodeDrop : function(n, dd, e, data){
24194
        var point = this.getDropPoint(e, n, dd);
24195
        var targetNode = n.node;
24196
        targetNode.ui.startDrop();
24197
        if(!this.isValidDropPoint(n, point, dd, e, data)){
24198
            targetNode.ui.endDrop();
24199
            return false;
24200
        }
24201
 
24202
        var dropNode = data.node || (dd.getTreeNode ? dd.getTreeNode(data, targetNode, point, e) : null);
24203
        var dropEvent = {
24204
            tree : this.tree,
24205
            target: targetNode,
24206
            data: data,
24207
            point: point,
24208
            source: dd,
24209
            rawEvent: e,
24210
            dropNode: dropNode,
24211
            cancel: !dropNode,
24212
            dropStatus: false
24213
        };
24214
        var retval = this.tree.fireEvent("beforenodedrop", dropEvent);
24215
        if(retval === false || dropEvent.cancel === true || !dropEvent.dropNode){
24216
            targetNode.ui.endDrop();
24217
            return dropEvent.dropStatus;
24218
        }
24219
 
24220
        targetNode = dropEvent.target;
24221
        if(point == "append" && !targetNode.isExpanded()){
24222
            targetNode.expand(false, null, function(){
24223
                this.completeDrop(dropEvent);
24224
            }.createDelegate(this));
24225
        }else{
24226
            this.completeDrop(dropEvent);
24227
        }
24228
        return true;
24229
    },
24230
 
24231
 
24232
    completeDrop : function(de){
24233
        var ns = de.dropNode, p = de.point, t = de.target;
24234
        if(!Ext.isArray(ns)){
24235
            ns = [ns];
24236
        }
24237
        var n;
24238
        for(var i = 0, len = ns.length; i < len; i++){
24239
            n = ns[i];
24240
            if(p == "above"){
24241
                t.parentNode.insertBefore(n, t);
24242
            }else if(p == "below"){
24243
                t.parentNode.insertBefore(n, t.nextSibling);
24244
            }else{
24245
                t.appendChild(n);
24246
            }
24247
        }
24248
        n.ui.focus();
24249
        if(this.tree.hlDrop){
24250
            n.ui.highlight();
24251
        }
24252
        t.ui.endDrop();
24253
        this.tree.fireEvent("nodedrop", de);
24254
    },
24255
 
24256
 
24257
    afterNodeMoved : function(dd, data, e, targetNode, dropNode){
24258
        if(this.tree.hlDrop){
24259
            dropNode.ui.focus();
24260
            dropNode.ui.highlight();
24261
        }
24262
        this.tree.fireEvent("nodedrop", this.tree, targetNode, data, dd, e);
24263
    },
24264
 
24265
 
24266
    getTree : function(){
24267
        return this.tree;
24268
    },
24269
 
24270
 
24271
    removeDropIndicators : function(n){
24272
        if(n && n.ddel){
24273
            var el = n.ddel;
24274
            Ext.fly(el).removeClass([
24275
                    "x-tree-drag-insert-above",
24276
                    "x-tree-drag-insert-below",
24277
                    "x-tree-drag-append"]);
24278
            this.lastInsertClass = "_noclass";
24279
        }
24280
    },
24281
 
24282
 
24283
    beforeDragDrop : function(target, e, id){
24284
        this.cancelExpand();
24285
        return true;
24286
    },
24287
 
24288
 
24289
    afterRepair : function(data){
24290
        if(data && Ext.enableFx){
24291
            data.node.ui.highlight();
24292
        }
24293
        this.hideProxy();
24294
    }
24295
});
24296
 
24297
}
24298
 
24299
if(Ext.dd.DragZone){
24300
Ext.tree.TreeDragZone = function(tree, config){
24301
    Ext.tree.TreeDragZone.superclass.constructor.call(this, tree.getTreeEl(), config);
24302
 
24303
    this.tree = tree;
24304
};
24305
 
24306
Ext.extend(Ext.tree.TreeDragZone, Ext.dd.DragZone, {
24307
 
24308
    ddGroup : "TreeDD",
24309
 
24310
 
24311
    onBeforeDrag : function(data, e){
24312
        var n = data.node;
24313
        return n && n.draggable && !n.disabled;
24314
    },
24315
 
24316
 
24317
    onInitDrag : function(e){
24318
        var data = this.dragData;
24319
        this.tree.getSelectionModel().select(data.node);
24320
        this.tree.eventModel.disable();
24321
        this.proxy.update("");
24322
        data.node.ui.appendDDGhost(this.proxy.ghost.dom);
24323
        this.tree.fireEvent("startdrag", this.tree, data.node, e);
24324
    },
24325
 
24326
 
24327
    getRepairXY : function(e, data){
24328
        return data.node.ui.getDDRepairXY();
24329
    },
24330
 
24331
 
24332
    onEndDrag : function(data, e){
24333
        this.tree.eventModel.enable.defer(100, this.tree.eventModel);
24334
        this.tree.fireEvent("enddrag", this.tree, data.node, e);
24335
    },
24336
 
24337
 
24338
    onValidDrop : function(dd, e, id){
24339
        this.tree.fireEvent("dragdrop", this.tree, this.dragData.node, dd, e);
24340
        this.hideProxy();
24341
    },
24342
 
24343
 
24344
    beforeInvalidDrop : function(e, id){
24345
 
24346
        var sm = this.tree.getSelectionModel();
24347
        sm.clearSelections();
24348
        sm.select(this.dragData.node);
24349
    }
24350
});
24351
}
24352
 
24353
Ext.tree.TreeEditor = function(tree, config){
24354
    config = config || {};
24355
    var field = config.events ? config : new Ext.form.TextField(config);
24356
    Ext.tree.TreeEditor.superclass.constructor.call(this, field);
24357
 
24358
    this.tree = tree;
24359
 
24360
    if(!tree.rendered){
24361
        tree.on('render', this.initEditor, this);
24362
    }else{
24363
        this.initEditor(tree);
24364
    }
24365
};
24366
 
24367
Ext.extend(Ext.tree.TreeEditor, Ext.Editor, {
24368
 
24369
    alignment: "l-l",
24370
        autoSize: false,
24371
 
24372
    hideEl : false,
24373
 
24374
    cls: "x-small-editor x-tree-editor",
24375
 
24376
    shim:false,
24377
        shadow:"frame",
24378
 
24379
    maxWidth: 250,
24380
 
24381
    editDelay : 350,
24382
 
24383
    initEditor : function(tree){
24384
        tree.on('beforeclick', this.beforeNodeClick, this);
24385
        tree.on('dblclick', this.onNodeDblClick, this);
24386
        this.on('complete', this.updateNode, this);
24387
        this.on('beforestartedit', this.fitToTree, this);
24388
        this.on('startedit', this.bindScroll, this, {delay:10});
24389
        this.on('specialkey', this.onSpecialKey, this);
24390
    },
24391
 
24392
        fitToTree : function(ed, el){
24393
        var td = this.tree.getTreeEl().dom, nd = el.dom;
24394
        if(td.scrollLeft >  nd.offsetLeft){             td.scrollLeft = nd.offsetLeft;
24395
        }
24396
        var w = Math.min(
24397
                this.maxWidth,
24398
                (td.clientWidth > 20 ? td.clientWidth : td.offsetWidth) - Math.max(0, nd.offsetLeft-td.scrollLeft) - 5);
24399
        this.setSize(w, '');
24400
    },
24401
 
24402
        triggerEdit : function(node, defer){
24403
        this.completeEdit();
24404
		if(node.attributes.editable !== false){
24405
			this.editNode = node;
24406
            this.autoEditTimer = this.startEdit.defer(this.editDelay, this, [node.ui.textNode, node.text]);
24407
            return false;
24408
        }
24409
    },
24410
 
24411
        bindScroll : function(){
24412
        this.tree.getTreeEl().on('scroll', this.cancelEdit, this);
24413
    },
24414
 
24415
        beforeNodeClick : function(node, e){
24416
        clearTimeout(this.autoEditTimer);
24417
        if(this.tree.getSelectionModel().isSelected(node)){
24418
            e.stopEvent();
24419
            return this.triggerEdit(node);
24420
        }
24421
    },
24422
 
24423
    onNodeDblClick : function(node, e){
24424
        clearTimeout(this.autoEditTimer);
24425
    },
24426
 
24427
        updateNode : function(ed, value){
24428
        this.tree.getTreeEl().un('scroll', this.cancelEdit, this);
24429
        this.editNode.setText(value);
24430
    },
24431
 
24432
        onHide : function(){
24433
        Ext.tree.TreeEditor.superclass.onHide.call(this);
24434
        if(this.editNode){
24435
            this.editNode.ui.focus.defer(50, this.editNode.ui);
24436
        }
24437
    },
24438
 
24439
        onSpecialKey : function(field, e){
24440
        var k = e.getKey();
24441
        if(k == e.ESC){
24442
            e.stopEvent();
24443
            this.cancelEdit();
24444
        }else if(k == e.ENTER && !e.hasModifier()){
24445
            e.stopEvent();
24446
            this.completeEdit();
24447
        }
24448
    }
24449
});
24450
 
24451
Ext.menu.Menu = function(config){
24452
    if(Ext.isArray(config)){
24453
        config = {items:config};
24454
    }
24455
    Ext.apply(this, config);
24456
    this.id = this.id || Ext.id();
24457
    this.addEvents(
24458
 
24459
        'beforeshow',
24460
 
24461
        'beforehide',
24462
 
24463
        'show',
24464
 
24465
        'hide',
24466
 
24467
        'click',
24468
 
24469
        'mouseover',
24470
 
24471
        'mouseout',
24472
 
24473
        'itemclick'
24474
    );
24475
    Ext.menu.MenuMgr.register(this);
24476
    Ext.menu.Menu.superclass.constructor.call(this);
24477
    var mis = this.items;
24478
 
24479
 
24480
    this.items = new Ext.util.MixedCollection();
24481
    if(mis){
24482
        this.add.apply(this, mis);
24483
    }
24484
};
24485
 
24486
Ext.extend(Ext.menu.Menu, Ext.util.Observable, {
24487
 
24488
 
24489
 
24490
    minWidth : 120,
24491
 
24492
    shadow : "sides",
24493
 
24494
    subMenuAlign : "tl-tr?",
24495
 
24496
    defaultAlign : "tl-bl?",
24497
 
24498
    allowOtherMenus : false,
24499
 
24500
    hidden:true,
24501
 
24502
    createEl : function(){
24503
        return new Ext.Layer({
24504
            cls: "x-menu",
24505
            shadow:this.shadow,
24506
            constrain: false,
24507
            parentEl: this.parentEl || document.body,
24508
            zindex:15000
24509
        });
24510
    },
24511
 
24512
        render : function(){
24513
        if(this.el){
24514
            return;
24515
        }
24516
        var el = this.el = this.createEl();
24517
 
24518
        if(!this.keyNav){
24519
            this.keyNav = new Ext.menu.MenuNav(this);
24520
        }
24521
        if(this.plain){
24522
            el.addClass("x-menu-plain");
24523
        }
24524
        if(this.cls){
24525
            el.addClass(this.cls);
24526
        }
24527
                this.focusEl = el.createChild({
24528
            tag: "a", cls: "x-menu-focus", href: "#", onclick: "return false;", tabIndex:"-1"
24529
        });
24530
        var ul = el.createChild({tag: "ul", cls: "x-menu-list"});
24531
        ul.on("click", this.onClick, this);
24532
        ul.on("mouseover", this.onMouseOver, this);
24533
        ul.on("mouseout", this.onMouseOut, this);
24534
        this.items.each(function(item){
24535
            var li = document.createElement("li");
24536
            li.className = "x-menu-list-item";
24537
            ul.dom.appendChild(li);
24538
            item.render(li, this);
24539
        }, this);
24540
        this.ul = ul;
24541
        this.autoWidth();
24542
    },
24543
 
24544
        autoWidth : function(){
24545
        var el = this.el, ul = this.ul;
24546
        if(!el){
24547
            return;
24548
        }
24549
        var w = this.width;
24550
        if(w){
24551
            el.setWidth(w);
24552
        }else if(Ext.isIE){
24553
            el.setWidth(this.minWidth);
24554
            var t = el.dom.offsetWidth;             el.setWidth(ul.getWidth()+el.getFrameWidth("lr"));
24555
        }
24556
    },
24557
 
24558
        delayAutoWidth : function(){
24559
        if(this.el){
24560
            if(!this.awTask){
24561
                this.awTask = new Ext.util.DelayedTask(this.autoWidth, this);
24562
            }
24563
            this.awTask.delay(20);
24564
        }
24565
    },
24566
 
24567
        findTargetItem : function(e){
24568
        var t = e.getTarget(".x-menu-list-item", this.ul,  true);
24569
        if(t && t.menuItemId){
24570
            return this.items.get(t.menuItemId);
24571
        }
24572
    },
24573
 
24574
        onClick : function(e){
24575
        var t;
24576
        if(t = this.findTargetItem(e)){
24577
            t.onClick(e);
24578
            this.fireEvent("click", this, t, e);
24579
        }
24580
    },
24581
 
24582
        setActiveItem : function(item, autoExpand){
24583
        if(item != this.activeItem){
24584
            if(this.activeItem){
24585
                this.activeItem.deactivate();
24586
            }
24587
            this.activeItem = item;
24588
            item.activate(autoExpand);
24589
        }else if(autoExpand){
24590
            item.expandMenu();
24591
        }
24592
    },
24593
 
24594
        tryActivate : function(start, step){
24595
        var items = this.items;
24596
        for(var i = start, len = items.length; i >= 0 && i < len; i+= step){
24597
            var item = items.get(i);
24598
            if(!item.disabled && item.canActivate){
24599
                this.setActiveItem(item, false);
24600
                return item;
24601
            }
24602
        }
24603
        return false;
24604
    },
24605
 
24606
        onMouseOver : function(e){
24607
        var t;
24608
        if(t = this.findTargetItem(e)){
24609
            if(t.canActivate && !t.disabled){
24610
                this.setActiveItem(t, true);
24611
            }
24612
        }
24613
        this.fireEvent("mouseover", this, e, t);
24614
    },
24615
 
24616
        onMouseOut : function(e){
24617
        var t;
24618
        if(t = this.findTargetItem(e)){
24619
            if(t == this.activeItem && t.shouldDeactivate(e)){
24620
                this.activeItem.deactivate();
24621
                delete this.activeItem;
24622
            }
24623
        }
24624
        this.fireEvent("mouseout", this, e, t);
24625
    },
24626
 
24627
 
24628
    isVisible : function(){
24629
        return this.el && !this.hidden;
24630
    },
24631
 
24632
 
24633
    show : function(el, pos, parentMenu){
24634
        this.parentMenu = parentMenu;
24635
        if(!this.el){
24636
            this.render();
24637
        }
24638
        this.fireEvent("beforeshow", this);
24639
        this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign), parentMenu, false);
24640
    },
24641
 
24642
 
24643
    showAt : function(xy, parentMenu, _e){
24644
        this.parentMenu = parentMenu;
24645
        if(!this.el){
24646
            this.render();
24647
        }
24648
        if(_e !== false){
24649
            this.fireEvent("beforeshow", this);
24650
            xy = this.el.adjustForConstraints(xy);
24651
        }
24652
        this.el.setXY(xy);
24653
        this.el.show();
24654
        this.hidden = false;
24655
        this.focus();
24656
        this.fireEvent("show", this);
24657
    },
24658
 
24659
 
24660
 
24661
    focus : function(){
24662
        if(!this.hidden){
24663
            this.doFocus.defer(50, this);
24664
        }
24665
    },
24666
 
24667
    doFocus : function(){
24668
        if(!this.hidden){
24669
            this.focusEl.focus();
24670
        }
24671
    },
24672
 
24673
 
24674
    hide : function(deep){
24675
        if(this.el && this.isVisible()){
24676
            this.fireEvent("beforehide", this);
24677
            if(this.activeItem){
24678
                this.activeItem.deactivate();
24679
                this.activeItem = null;
24680
            }
24681
            this.el.hide();
24682
            this.hidden = true;
24683
            this.fireEvent("hide", this);
24684
        }
24685
        if(deep === true && this.parentMenu){
24686
            this.parentMenu.hide(true);
24687
        }
24688
    },
24689
 
24690
 
24691
    add : function(){
24692
        var a = arguments, l = a.length, item;
24693
        for(var i = 0; i < l; i++){
24694
            var el = a[i];
24695
            if(el.render){                 item = this.addItem(el);
24696
            }else if(typeof el == "string"){                 if(el == "separator" || el == "-"){
24697
                    item = this.addSeparator();
24698
                }else{
24699
                    item = this.addText(el);
24700
                }
24701
            }else if(el.tagName || el.el){                 item = this.addElement(el);
24702
            }else if(typeof el == "object"){                 Ext.applyIf(el, this.defaults);
24703
                item = this.addMenuItem(el);
24704
            }
24705
        }
24706
        return item;
24707
    },
24708
 
24709
 
24710
    getEl : function(){
24711
        if(!this.el){
24712
            this.render();
24713
        }
24714
        return this.el;
24715
    },
24716
 
24717
 
24718
    addSeparator : function(){
24719
        return this.addItem(new Ext.menu.Separator());
24720
    },
24721
 
24722
 
24723
    addElement : function(el){
24724
        return this.addItem(new Ext.menu.BaseItem(el));
24725
    },
24726
 
24727
 
24728
    addItem : function(item){
24729
        this.items.add(item);
24730
        if(this.ul){
24731
            var li = document.createElement("li");
24732
            li.className = "x-menu-list-item";
24733
            this.ul.dom.appendChild(li);
24734
            item.render(li, this);
24735
            this.delayAutoWidth();
24736
        }
24737
        return item;
24738
    },
24739
 
24740
 
24741
    addMenuItem : function(config){
24742
        if(!(config instanceof Ext.menu.Item)){
24743
            if(typeof config.checked == "boolean"){                 config = new Ext.menu.CheckItem(config);
24744
            }else{
24745
                config = new Ext.menu.Item(config);
24746
            }
24747
        }
24748
        return this.addItem(config);
24749
    },
24750
 
24751
 
24752
    addText : function(text){
24753
        return this.addItem(new Ext.menu.TextItem(text));
24754
    },
24755
 
24756
 
24757
    insert : function(index, item){
24758
        this.items.insert(index, item);
24759
        if(this.ul){
24760
            var li = document.createElement("li");
24761
            li.className = "x-menu-list-item";
24762
            this.ul.dom.insertBefore(li, this.ul.dom.childNodes[index]);
24763
            item.render(li, this);
24764
            this.delayAutoWidth();
24765
        }
24766
        return item;
24767
    },
24768
 
24769
 
24770
    remove : function(item){
24771
        this.items.removeKey(item.id);
24772
        item.destroy();
24773
    },
24774
 
24775
 
24776
    removeAll : function(){
24777
        var f;
24778
        while(f = this.items.first()){
24779
            this.remove(f);
24780
        }
24781
    },
24782
 
24783
 
24784
    destroy : function(){
24785
        this.beforeDestroy();
24786
        Ext.menu.MenuMgr.unregister(this);
24787
        if (this.keyNav) {
24788
        	this.keyNav.disable();
24789
        }
24790
        this.removeAll();
24791
        if (this.ul) {
24792
        	this.ul.removeAllListeners();
24793
        }
24794
        if (this.el) {
24795
        	this.el.destroy();
24796
        }
24797
    },
24798
 
24799
	    beforeDestroy : Ext.emptyFn
24800
 
24801
});
24802
 
24803
Ext.menu.MenuNav = function(menu){
24804
    Ext.menu.MenuNav.superclass.constructor.call(this, menu.el);
24805
    this.scope = this.menu = menu;
24806
};
24807
 
24808
Ext.extend(Ext.menu.MenuNav, Ext.KeyNav, {
24809
    doRelay : function(e, h){
24810
        var k = e.getKey();
24811
        if(!this.menu.activeItem && e.isNavKeyPress() && k != e.SPACE && k != e.RETURN){
24812
            this.menu.tryActivate(0, 1);
24813
            return false;
24814
        }
24815
        return h.call(this.scope || this, e, this.menu);
24816
    },
24817
 
24818
    up : function(e, m){
24819
        if(!m.tryActivate(m.items.indexOf(m.activeItem)-1, -1)){
24820
            m.tryActivate(m.items.length-1, -1);
24821
        }
24822
    },
24823
 
24824
    down : function(e, m){
24825
        if(!m.tryActivate(m.items.indexOf(m.activeItem)+1, 1)){
24826
            m.tryActivate(0, 1);
24827
        }
24828
    },
24829
 
24830
    right : function(e, m){
24831
        if(m.activeItem){
24832
            m.activeItem.expandMenu(true);
24833
        }
24834
    },
24835
 
24836
    left : function(e, m){
24837
        m.hide();
24838
        if(m.parentMenu && m.parentMenu.activeItem){
24839
            m.parentMenu.activeItem.activate();
24840
        }
24841
    },
24842
 
24843
    enter : function(e, m){
24844
        if(m.activeItem){
24845
            e.stopPropagation();
24846
            m.activeItem.onClick(e);
24847
            m.fireEvent("click", this, m.activeItem);
24848
            return true;
24849
        }
24850
    }
24851
});
24852
 
24853
Ext.menu.MenuMgr = function(){
24854
   var menus, active, groups = {}, attached = false, lastShow = new Date();
24855
 
24856
      function init(){
24857
       menus = {};
24858
       active = new Ext.util.MixedCollection();
24859
       Ext.getDoc().addKeyListener(27, function(){
24860
           if(active.length > 0){
24861
               hideAll();
24862
           }
24863
       });
24864
   }
24865
 
24866
      function hideAll(){
24867
       if(active && active.length > 0){
24868
           var c = active.clone();
24869
           c.each(function(m){
24870
               m.hide();
24871
           });
24872
       }
24873
   }
24874
 
24875
      function onHide(m){
24876
       active.remove(m);
24877
       if(active.length < 1){
24878
           Ext.getDoc().un("mousedown", onMouseDown);
24879
           attached = false;
24880
       }
24881
   }
24882
 
24883
      function onShow(m){
24884
       var last = active.last();
24885
       lastShow = new Date();
24886
       active.add(m);
24887
       if(!attached){
24888
           Ext.getDoc().on("mousedown", onMouseDown);
24889
           attached = true;
24890
       }
24891
       if(m.parentMenu){
24892
          m.getEl().setZIndex(parseInt(m.parentMenu.getEl().getStyle("z-index"), 10) + 3);
24893
          m.parentMenu.activeChild = m;
24894
       }else if(last && last.isVisible()){
24895
          m.getEl().setZIndex(parseInt(last.getEl().getStyle("z-index"), 10) + 3);
24896
       }
24897
   }
24898
 
24899
      function onBeforeHide(m){
24900
       if(m.activeChild){
24901
           m.activeChild.hide();
24902
       }
24903
       if(m.autoHideTimer){
24904
           clearTimeout(m.autoHideTimer);
24905
           delete m.autoHideTimer;
24906
       }
24907
   }
24908
 
24909
      function onBeforeShow(m){
24910
       var pm = m.parentMenu;
24911
       if(!pm && !m.allowOtherMenus){
24912
           hideAll();
24913
       }else if(pm && pm.activeChild){
24914
           pm.activeChild.hide();
24915
       }
24916
   }
24917
 
24918
      function onMouseDown(e){
24919
       if(lastShow.getElapsed() > 50 && active.length > 0 && !e.getTarget(".x-menu")){
24920
           hideAll();
24921
       }
24922
   }
24923
 
24924
      function onBeforeCheck(mi, state){
24925
       if(state){
24926
           var g = groups[mi.group];
24927
           for(var i = 0, l = g.length; i < l; i++){
24928
               if(g[i] != mi){
24929
                   g[i].setChecked(false);
24930
               }
24931
           }
24932
       }
24933
   }
24934
 
24935
   return {
24936
 
24937
 
24938
       hideAll : function(){
24939
            hideAll();
24940
       },
24941
 
24942
              register : function(menu){
24943
           if(!menus){
24944
               init();
24945
           }
24946
           menus[menu.id] = menu;
24947
           menu.on("beforehide", onBeforeHide);
24948
           menu.on("hide", onHide);
24949
           menu.on("beforeshow", onBeforeShow);
24950
           menu.on("show", onShow);
24951
           var g = menu.group;
24952
           if(g && menu.events["checkchange"]){
24953
               if(!groups[g]){
24954
                   groups[g] = [];
24955
               }
24956
               groups[g].push(menu);
24957
               menu.on("checkchange", onCheck);
24958
           }
24959
       },
24960
 
24961
 
24962
       get : function(menu){
24963
           if(typeof menu == "string"){                if(!menus){                     return null;
24964
               }
24965
               return menus[menu];
24966
           }else if(menu.events){                 return menu;
24967
           }else if(typeof menu.length == 'number'){                return new Ext.menu.Menu({items:menu});
24968
           }else{                return new Ext.menu.Menu(menu);
24969
           }
24970
       },
24971
 
24972
              unregister : function(menu){
24973
           delete menus[menu.id];
24974
           menu.un("beforehide", onBeforeHide);
24975
           menu.un("hide", onHide);
24976
           menu.un("beforeshow", onBeforeShow);
24977
           menu.un("show", onShow);
24978
           var g = menu.group;
24979
           if(g && menu.events["checkchange"]){
24980
               groups[g].remove(menu);
24981
               menu.un("checkchange", onCheck);
24982
           }
24983
       },
24984
 
24985
              registerCheckable : function(menuItem){
24986
           var g = menuItem.group;
24987
           if(g){
24988
               if(!groups[g]){
24989
                   groups[g] = [];
24990
               }
24991
               groups[g].push(menuItem);
24992
               menuItem.on("beforecheckchange", onBeforeCheck);
24993
           }
24994
       },
24995
 
24996
              unregisterCheckable : function(menuItem){
24997
           var g = menuItem.group;
24998
           if(g){
24999
               groups[g].remove(menuItem);
25000
               menuItem.un("beforecheckchange", onBeforeCheck);
25001
           }
25002
       },
25003
 
25004
       getCheckedItem : function(groupId){
25005
           var g = groups[groupId];
25006
           if(g){
25007
               for(var i = 0, l = g.length; i < l; i++){
25008
                   if(g[i].checked){
25009
                       return g[i];
25010
                   }
25011
               }
25012
           }
25013
           return null;
25014
       },
25015
 
25016
       setCheckedItem : function(groupId, itemId){
25017
           var g = groups[groupId];
25018
           if(g){
25019
               for(var i = 0, l = g.length; i < l; i++){
25020
                   if(g[i].id == itemId){
25021
                       g[i].setChecked(true);
25022
                   }
25023
               }
25024
           }
25025
           return null;
25026
       }
25027
   };
25028
}();
25029
 
25030
 
25031
Ext.menu.BaseItem = function(config){
25032
    Ext.menu.BaseItem.superclass.constructor.call(this, config);
25033
 
25034
    this.addEvents(
25035
 
25036
        'click',
25037
 
25038
        'activate',
25039
 
25040
        'deactivate'
25041
    );
25042
 
25043
    if(this.handler){
25044
        this.on("click", this.handler, this.scope);
25045
    }
25046
};
25047
 
25048
Ext.extend(Ext.menu.BaseItem, Ext.Component, {
25049
 
25050
 
25051
 
25052
    canActivate : false,
25053
 
25054
    activeClass : "x-menu-item-active",
25055
 
25056
    hideOnClick : true,
25057
 
25058
    hideDelay : 100,
25059
 
25060
        ctype: "Ext.menu.BaseItem",
25061
 
25062
        actionMode : "container",
25063
 
25064
        render : function(container, parentMenu){
25065
        this.parentMenu = parentMenu;
25066
        Ext.menu.BaseItem.superclass.render.call(this, container);
25067
        this.container.menuItemId = this.id;
25068
    },
25069
 
25070
        onRender : function(container, position){
25071
        this.el = Ext.get(this.el);
25072
        container.dom.appendChild(this.el.dom);
25073
    },
25074
 
25075
 
25076
    setHandler : function(handler, scope){
25077
        if(this.handler){
25078
            this.un("click", this.handler, this.scope);
25079
        }
25080
        this.on("click", this.handler = handler, this.scope = scope);
25081
    },
25082
 
25083
        onClick : function(e){
25084
        if(!this.disabled && this.fireEvent("click", this, e) !== false
25085
                && this.parentMenu.fireEvent("itemclick", this, e) !== false){
25086
            this.handleClick(e);
25087
        }else{
25088
            e.stopEvent();
25089
        }
25090
    },
25091
 
25092
        activate : function(){
25093
        if(this.disabled){
25094
            return false;
25095
        }
25096
        var li = this.container;
25097
        li.addClass(this.activeClass);
25098
        this.region = li.getRegion().adjust(2, 2, -2, -2);
25099
        this.fireEvent("activate", this);
25100
        return true;
25101
    },
25102
 
25103
        deactivate : function(){
25104
        this.container.removeClass(this.activeClass);
25105
        this.fireEvent("deactivate", this);
25106
    },
25107
 
25108
        shouldDeactivate : function(e){
25109
        return !this.region || !this.region.contains(e.getPoint());
25110
    },
25111
 
25112
        handleClick : function(e){
25113
        if(this.hideOnClick){
25114
            this.parentMenu.hide.defer(this.hideDelay, this.parentMenu, [true]);
25115
        }
25116
    },
25117
 
25118
        expandMenu : function(autoActivate){
25119
            },
25120
 
25121
        hideMenu : function(){
25122
            }
25123
});
25124
 
25125
Ext.menu.TextItem = function(text){
25126
    this.text = text;
25127
    Ext.menu.TextItem.superclass.constructor.call(this);
25128
};
25129
 
25130
Ext.extend(Ext.menu.TextItem, Ext.menu.BaseItem, {
25131
 
25132
 
25133
    hideOnClick : false,
25134
 
25135
    itemCls : "x-menu-text",
25136
 
25137
        onRender : function(){
25138
        var s = document.createElement("span");
25139
        s.className = this.itemCls;
25140
        s.innerHTML = this.text;
25141
        this.el = s;
25142
        Ext.menu.TextItem.superclass.onRender.apply(this, arguments);
25143
    }
25144
});
25145
 
25146
Ext.menu.Separator = function(config){
25147
    Ext.menu.Separator.superclass.constructor.call(this, config);
25148
};
25149
 
25150
Ext.extend(Ext.menu.Separator, Ext.menu.BaseItem, {
25151
 
25152
    itemCls : "x-menu-sep",
25153
 
25154
    hideOnClick : false,
25155
 
25156
        onRender : function(li){
25157
        var s = document.createElement("span");
25158
        s.className = this.itemCls;
25159
        s.innerHTML = "&#160;";
25160
        this.el = s;
25161
        li.addClass("x-menu-sep-li");
25162
        Ext.menu.Separator.superclass.onRender.apply(this, arguments);
25163
    }
25164
});
25165
 
25166
Ext.menu.Item = function(config){
25167
    Ext.menu.Item.superclass.constructor.call(this, config);
25168
    if(this.menu){
25169
        this.menu = Ext.menu.MenuMgr.get(this.menu);
25170
    }
25171
};
25172
Ext.extend(Ext.menu.Item, Ext.menu.BaseItem, {
25173
 
25174
 
25175
 
25176
 
25177
 
25178
 
25179
    itemCls : "x-menu-item",
25180
 
25181
    canActivate : true,
25182
 
25183
    showDelay: 200,
25184
        hideDelay: 200,
25185
 
25186
        ctype: "Ext.menu.Item",
25187
 
25188
        onRender : function(container, position){
25189
        var el = document.createElement("a");
25190
        el.hideFocus = true;
25191
        el.unselectable = "on";
25192
        el.href = this.href || "#";
25193
        if(this.hrefTarget){
25194
            el.target = this.hrefTarget;
25195
        }
25196
        el.className = this.itemCls + (this.menu ?  " x-menu-item-arrow" : "") + (this.cls ?  " " + this.cls : "");
25197
        el.innerHTML = String.format(
25198
                '<img src="{0}" class="x-menu-item-icon {2}" />{1}',
25199
                this.icon || Ext.BLANK_IMAGE_URL, this.itemText||this.text, this.iconCls || '');
25200
        this.el = el;
25201
        Ext.menu.Item.superclass.onRender.call(this, container, position);
25202
    },
25203
 
25204
 
25205
    setText : function(text){
25206
        this.text = text;
25207
        if(this.rendered){
25208
            this.el.update(String.format(
25209
                '<img src="{0}" class="x-menu-item-icon {2}">{1}',
25210
                this.icon || Ext.BLANK_IMAGE_URL, this.text, this.iconCls || ''));
25211
            this.parentMenu.autoWidth();
25212
        }
25213
    },
25214
 
25215
 
25216
    setIconClass : function(cls){
25217
        var oldCls = this.iconCls;
25218
        this.iconCls = cls;
25219
        if(this.rendered){
25220
            this.el.child('img.x-menu-item-icon').replaceClass(oldCls, this.iconCls);
25221
        }
25222
    },
25223
 
25224
        handleClick : function(e){
25225
        if(!this.href){             e.stopEvent();
25226
        }
25227
        Ext.menu.Item.superclass.handleClick.apply(this, arguments);
25228
    },
25229
 
25230
        activate : function(autoExpand){
25231
        if(Ext.menu.Item.superclass.activate.apply(this, arguments)){
25232
            this.focus();
25233
            if(autoExpand){
25234
                this.expandMenu();
25235
            }
25236
        }
25237
        return true;
25238
    },
25239
 
25240
        shouldDeactivate : function(e){
25241
        if(Ext.menu.Item.superclass.shouldDeactivate.call(this, e)){
25242
            if(this.menu && this.menu.isVisible()){
25243
                return !this.menu.getEl().getRegion().contains(e.getPoint());
25244
            }
25245
            return true;
25246
        }
25247
        return false;
25248
    },
25249
 
25250
        deactivate : function(){
25251
        Ext.menu.Item.superclass.deactivate.apply(this, arguments);
25252
        this.hideMenu();
25253
    },
25254
 
25255
        expandMenu : function(autoActivate){
25256
        if(!this.disabled && this.menu){
25257
            clearTimeout(this.hideTimer);
25258
            delete this.hideTimer;
25259
            if(!this.menu.isVisible() && !this.showTimer){
25260
                this.showTimer = this.deferExpand.defer(this.showDelay, this, [autoActivate]);
25261
            }else if (this.menu.isVisible() && autoActivate){
25262
                this.menu.tryActivate(0, 1);
25263
            }
25264
        }
25265
    },
25266
 
25267
        deferExpand : function(autoActivate){
25268
        delete this.showTimer;
25269
        this.menu.show(this.container, this.parentMenu.subMenuAlign || "tl-tr?", this.parentMenu);
25270
        if(autoActivate){
25271
            this.menu.tryActivate(0, 1);
25272
        }
25273
    },
25274
 
25275
        hideMenu : function(){
25276
        clearTimeout(this.showTimer);
25277
        delete this.showTimer;
25278
        if(!this.hideTimer && this.menu && this.menu.isVisible()){
25279
            this.hideTimer = this.deferHide.defer(this.hideDelay, this);
25280
        }
25281
    },
25282
 
25283
        deferHide : function(){
25284
        delete this.hideTimer;
25285
        this.menu.hide();
25286
    }
25287
});
25288
 
25289
Ext.menu.CheckItem = function(config){
25290
    Ext.menu.CheckItem.superclass.constructor.call(this, config);
25291
    this.addEvents(
25292
 
25293
        "beforecheckchange" ,
25294
 
25295
        "checkchange"
25296
    );
25297
 
25298
    if(this.checkHandler){
25299
        this.on('checkchange', this.checkHandler, this.scope);
25300
    }
25301
    Ext.menu.MenuMgr.registerCheckable(this);
25302
};
25303
Ext.extend(Ext.menu.CheckItem, Ext.menu.Item, {
25304
 
25305
 
25306
    itemCls : "x-menu-item x-menu-check-item",
25307
 
25308
    groupClass : "x-menu-group-item",
25309
 
25310
 
25311
    checked: false,
25312
 
25313
        ctype: "Ext.menu.CheckItem",
25314
 
25315
        onRender : function(c){
25316
        Ext.menu.CheckItem.superclass.onRender.apply(this, arguments);
25317
        if(this.group){
25318
            this.el.addClass(this.groupClass);
25319
        }
25320
        if(this.checked){
25321
            this.checked = false;
25322
            this.setChecked(true, true);
25323
        }
25324
    },
25325
 
25326
        destroy : function(){
25327
        Ext.menu.MenuMgr.unregisterCheckable(this);
25328
        Ext.menu.CheckItem.superclass.destroy.apply(this, arguments);
25329
    },
25330
 
25331
 
25332
    setChecked : function(state, suppressEvent){
25333
        if(this.checked != state && this.fireEvent("beforecheckchange", this, state) !== false){
25334
            if(this.container){
25335
                this.container[state ? "addClass" : "removeClass"]("x-menu-item-checked");
25336
            }
25337
            this.checked = state;
25338
            if(suppressEvent !== true){
25339
                this.fireEvent("checkchange", this, state);
25340
            }
25341
        }
25342
    },
25343
 
25344
        handleClick : function(e){
25345
       if(!this.disabled && !(this.checked && this.group)){           this.setChecked(!this.checked);
25346
       }
25347
       Ext.menu.CheckItem.superclass.handleClick.apply(this, arguments);
25348
    }
25349
});
25350
 
25351
Ext.menu.Adapter = function(component, config){
25352
    Ext.menu.Adapter.superclass.constructor.call(this, config);
25353
    this.component = component;
25354
};
25355
Ext.extend(Ext.menu.Adapter, Ext.menu.BaseItem, {
25356
        canActivate : true,
25357
 
25358
        onRender : function(container, position){
25359
        this.component.render(container);
25360
        this.el = this.component.getEl();
25361
    },
25362
 
25363
        activate : function(){
25364
        if(this.disabled){
25365
            return false;
25366
        }
25367
        this.component.focus();
25368
        this.fireEvent("activate", this);
25369
        return true;
25370
    },
25371
 
25372
        deactivate : function(){
25373
        this.fireEvent("deactivate", this);
25374
    },
25375
 
25376
        disable : function(){
25377
        this.component.disable();
25378
        Ext.menu.Adapter.superclass.disable.call(this);
25379
    },
25380
 
25381
        enable : function(){
25382
        this.component.enable();
25383
        Ext.menu.Adapter.superclass.enable.call(this);
25384
    }
25385
});
25386
 
25387
Ext.menu.DateItem = function(config){
25388
    Ext.menu.DateItem.superclass.constructor.call(this, new Ext.DatePicker(config), config);
25389
 
25390
    this.picker = this.component;
25391
    this.addEvents('select');
25392
 
25393
    this.picker.on("render", function(picker){
25394
        picker.getEl().swallowEvent("click");
25395
        picker.container.addClass("x-menu-date-item");
25396
    });
25397
 
25398
    this.picker.on("select", this.onSelect, this);
25399
};
25400
 
25401
Ext.extend(Ext.menu.DateItem, Ext.menu.Adapter, {
25402
        onSelect : function(picker, date){
25403
        this.fireEvent("select", this, date, picker);
25404
        Ext.menu.DateItem.superclass.handleClick.call(this);
25405
    }
25406
});
25407
 
25408
Ext.menu.ColorItem = function(config){
25409
    Ext.menu.ColorItem.superclass.constructor.call(this, new Ext.ColorPalette(config), config);
25410
 
25411
    this.palette = this.component;
25412
    this.relayEvents(this.palette, ["select"]);
25413
    if(this.selectHandler){
25414
        this.on('select', this.selectHandler, this.scope);
25415
    }
25416
};
25417
Ext.extend(Ext.menu.ColorItem, Ext.menu.Adapter);
25418
 
25419
Ext.menu.DateMenu = function(config){
25420
    Ext.menu.DateMenu.superclass.constructor.call(this, config);
25421
    this.plain = true;
25422
    var di = new Ext.menu.DateItem(config);
25423
    this.add(di);
25424
 
25425
    this.picker = di.picker;
25426
 
25427
    this.relayEvents(di, ["select"]);
25428
 
25429
    this.on('beforeshow', function(){
25430
        if(this.picker){
25431
            this.picker.hideMonthPicker(true);
25432
        }
25433
    }, this);
25434
};
25435
Ext.extend(Ext.menu.DateMenu, Ext.menu.Menu, {
25436
    cls:'x-date-menu',
25437
 
25438
        beforeDestroy : function() {
25439
        this.picker.destroy();
25440
    }
25441
});
25442
 
25443
Ext.menu.ColorMenu = function(config){
25444
    Ext.menu.ColorMenu.superclass.constructor.call(this, config);
25445
    this.plain = true;
25446
    var ci = new Ext.menu.ColorItem(config);
25447
    this.add(ci);
25448
 
25449
    this.palette = ci.palette;
25450
 
25451
    this.relayEvents(ci, ["select"]);
25452
};
25453
Ext.extend(Ext.menu.ColorMenu, Ext.menu.Menu);
25454
 
25455
Ext.form.Field = Ext.extend(Ext.BoxComponent,  {
25456
 
25457
 
25458
 
25459
 
25460
 
25461
 
25462
 
25463
 
25464
    invalidClass : "x-form-invalid",
25465
 
25466
    invalidText : "The value in this field is invalid",
25467
 
25468
    focusClass : "x-form-focus",
25469
 
25470
    validationEvent : "keyup",
25471
 
25472
    validateOnBlur : true,
25473
 
25474
    validationDelay : 250,
25475
 
25476
    defaultAutoCreate : {tag: "input", type: "text", size: "20", autocomplete: "off"},
25477
 
25478
    fieldClass : "x-form-field",
25479
 
25480
    msgTarget : 'qtip',
25481
 
25482
    msgFx : 'normal',
25483
 
25484
 
25485
    readOnly : false,
25486
 
25487
 
25488
    disabled : false,
25489
 
25490
 
25491
 
25492
 
25493
 
25494
        isFormField : true,
25495
 
25496
        hasFocus : false,
25497
 
25498
 
25499
 
25500
 
25501
 
25502
 
25503
		initComponent : function(){
25504
        Ext.form.Field.superclass.initComponent.call(this);
25505
        this.addEvents(
25506
 
25507
            'focus',
25508
 
25509
            'blur',
25510
 
25511
            'specialkey',
25512
 
25513
            'change',
25514
 
25515
            'invalid',
25516
 
25517
            'valid'
25518
        );
25519
    },
25520
 
25521
 
25522
    getName: function(){
25523
         return this.rendered && this.el.dom.name ? this.el.dom.name : (this.hiddenName || '');
25524
    },
25525
 
25526
        onRender : function(ct, position){
25527
        Ext.form.Field.superclass.onRender.call(this, ct, position);
25528
        if(!this.el){
25529
            var cfg = this.getAutoCreate();
25530
            if(!cfg.name){
25531
                cfg.name = this.name || this.id;
25532
            }
25533
            if(this.inputType){
25534
                cfg.type = this.inputType;
25535
            }
25536
            this.el = ct.createChild(cfg, position);
25537
        }
25538
        var type = this.el.dom.type;
25539
        if(type){
25540
            if(type == 'password'){
25541
                type = 'text';
25542
            }
25543
            this.el.addClass('x-form-'+type);
25544
        }
25545
        if(this.readOnly){
25546
            this.el.dom.readOnly = true;
25547
        }
25548
        if(this.tabIndex !== undefined){
25549
            this.el.dom.setAttribute('tabIndex', this.tabIndex);
25550
        }
25551
 
25552
        this.el.addClass([this.fieldClass, this.cls]);
25553
        this.initValue();
25554
    },
25555
 
25556
        initValue : function(){
25557
        if(this.value !== undefined){
25558
            this.setValue(this.value);
25559
        }else if(this.el.dom.value.length > 0){
25560
            this.setValue(this.el.dom.value);
25561
        }
25562
    },
25563
 
25564
 
25565
    isDirty : function() {
25566
        if(this.disabled) {
25567
            return false;
25568
        }
25569
        return String(this.getValue()) !== String(this.originalValue);
25570
    },
25571
 
25572
        afterRender : function(){
25573
        Ext.form.Field.superclass.afterRender.call(this);
25574
        this.initEvents();
25575
    },
25576
 
25577
        fireKey : function(e){
25578
        if(e.isSpecialKey()){
25579
            this.fireEvent("specialkey", this, e);
25580
        }
25581
    },
25582
 
25583
 
25584
    reset : function(){
25585
        this.setValue(this.originalValue);
25586
        this.clearInvalid();
25587
    },
25588
 
25589
        initEvents : function(){
25590
        this.el.on(Ext.isIE ? "keydown" : "keypress", this.fireKey,  this);
25591
        this.el.on("focus", this.onFocus,  this);
25592
        this.el.on("blur", this.onBlur,  this);
25593
 
25594
                this.originalValue = this.getValue();
25595
    },
25596
 
25597
        onFocus : function(){
25598
        if(!Ext.isOpera && this.focusClass){             this.el.addClass(this.focusClass);
25599
        }
25600
        if(!this.hasFocus){
25601
            this.hasFocus = true;
25602
            this.startValue = this.getValue();
25603
            this.fireEvent("focus", this);
25604
        }
25605
    },
25606
 
25607
    beforeBlur : Ext.emptyFn,
25608
 
25609
        onBlur : function(){
25610
        this.beforeBlur();
25611
        if(!Ext.isOpera && this.focusClass){             this.el.removeClass(this.focusClass);
25612
        }
25613
        this.hasFocus = false;
25614
        if(this.validationEvent !== false && this.validateOnBlur && this.validationEvent != "blur"){
25615
            this.validate();
25616
        }
25617
        var v = this.getValue();
25618
        if(String(v) !== String(this.startValue)){
25619
            this.fireEvent('change', this, v, this.startValue);
25620
        }
25621
        this.fireEvent("blur", this);
25622
    },
25623
 
25624
 
25625
    isValid : function(preventMark){
25626
        if(this.disabled){
25627
            return true;
25628
        }
25629
        var restore = this.preventMark;
25630
        this.preventMark = preventMark === true;
25631
        var v = this.validateValue(this.processValue(this.getRawValue()));
25632
        this.preventMark = restore;
25633
        return v;
25634
    },
25635
 
25636
 
25637
    validate : function(){
25638
        if(this.disabled || this.validateValue(this.processValue(this.getRawValue()))){
25639
            this.clearInvalid();
25640
            return true;
25641
        }
25642
        return false;
25643
    },
25644
 
25645
    processValue : function(value){
25646
        return value;
25647
    },
25648
 
25649
            validateValue : function(value){
25650
        return true;
25651
    },
25652
 
25653
 
25654
    markInvalid : function(msg){
25655
        if(!this.rendered || this.preventMark){             return;
25656
        }
25657
        this.el.addClass(this.invalidClass);
25658
        msg = msg || this.invalidText;
25659
        switch(this.msgTarget){
25660
            case 'qtip':
25661
                this.el.dom.qtip = msg;
25662
                this.el.dom.qclass = 'x-form-invalid-tip';
25663
                if(Ext.QuickTips){                     Ext.QuickTips.enable();
25664
                }
25665
                break;
25666
            case 'title':
25667
                this.el.dom.title = msg;
25668
                break;
25669
            case 'under':
25670
                if(!this.errorEl){
25671
                    var elp = this.el.findParent('.x-form-element', 5, true);
25672
                    this.errorEl = elp.createChild({cls:'x-form-invalid-msg'});
25673
                    this.errorEl.setWidth(elp.getWidth(true)-20);
25674
                }
25675
                this.errorEl.update(msg);
25676
                Ext.form.Field.msgFx[this.msgFx].show(this.errorEl, this);
25677
                break;
25678
            case 'side':
25679
                if(!this.errorIcon){
25680
                    var elp = this.el.findParent('.x-form-element', 5, true);
25681
                    this.errorIcon = elp.createChild({cls:'x-form-invalid-icon'});
25682
                }
25683
                this.alignErrorIcon();
25684
                this.errorIcon.dom.qtip = msg;
25685
                this.errorIcon.dom.qclass = 'x-form-invalid-tip';
25686
                this.errorIcon.show();
25687
                this.on('resize', this.alignErrorIcon, this);
25688
                break;
25689
            default:
25690
                var t = Ext.getDom(this.msgTarget);
25691
                t.innerHTML = msg;
25692
                t.style.display = this.msgDisplay;
25693
                break;
25694
        }
25695
        this.fireEvent('invalid', this, msg);
25696
    },
25697
 
25698
        alignErrorIcon : function(){
25699
        this.errorIcon.alignTo(this.el, 'tl-tr', [2, 0]);
25700
    },
25701
 
25702
 
25703
    clearInvalid : function(){
25704
        if(!this.rendered || this.preventMark){             return;
25705
        }
25706
        this.el.removeClass(this.invalidClass);
25707
        switch(this.msgTarget){
25708
            case 'qtip':
25709
                this.el.dom.qtip = '';
25710
                break;
25711
            case 'title':
25712
                this.el.dom.title = '';
25713
                break;
25714
            case 'under':
25715
                if(this.errorEl){
25716
                    Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl, this);
25717
                }
25718
                break;
25719
            case 'side':
25720
                if(this.errorIcon){
25721
                    this.errorIcon.dom.qtip = '';
25722
                    this.errorIcon.hide();
25723
                    this.un('resize', this.alignErrorIcon, this);
25724
                }
25725
                break;
25726
            default:
25727
                var t = Ext.getDom(this.msgTarget);
25728
                t.innerHTML = '';
25729
                t.style.display = 'none';
25730
                break;
25731
        }
25732
        this.fireEvent('valid', this);
25733
    },
25734
 
25735
 
25736
    getRawValue : function(){
25737
        var v = this.rendered ? this.el.getValue() : Ext.value(this.value, '');
25738
        if(v === this.emptyText){
25739
            v = '';
25740
        }
25741
        return v;
25742
    },
25743
 
25744
 
25745
    getValue : function(){
25746
        if(!this.rendered) {
25747
            return this.value;
25748
        }
25749
        var v = this.el.getValue();
25750
        if(v === this.emptyText || v === undefined){
25751
            v = '';
25752
        }
25753
        return v;
25754
    },
25755
 
25756
 
25757
    setRawValue : function(v){
25758
        return this.el.dom.value = (v === null || v === undefined ? '' : v);
25759
    },
25760
 
25761
 
25762
    setValue : function(v){
25763
        this.value = v;
25764
        if(this.rendered){
25765
            this.el.dom.value = (v === null || v === undefined ? '' : v);
25766
            this.validate();
25767
        }
25768
    },
25769
 
25770
    adjustSize : function(w, h){
25771
        var s = Ext.form.Field.superclass.adjustSize.call(this, w, h);
25772
        s.width = this.adjustWidth(this.el.dom.tagName, s.width);
25773
        return s;
25774
    },
25775
 
25776
    adjustWidth : function(tag, w){
25777
        tag = tag.toLowerCase();
25778
        if(typeof w == 'number' && !Ext.isSafari){
25779
            if(Ext.isIE && (tag == 'input' || tag == 'textarea')){
25780
                if(tag == 'input' && !Ext.isStrict){
25781
                    return this.inEditor ? w : w - 3;
25782
                }
25783
                if(tag == 'input' && Ext.isStrict){
25784
                    return w - (Ext.isIE6 ? 4 : 1);
25785
                }
25786
                if(tag = 'textarea' && Ext.isStrict){
25787
                    return w-2;
25788
                }
25789
            }else if(Ext.isOpera && Ext.isStrict){
25790
                if(tag == 'input'){
25791
                    return w + 2;
25792
                }
25793
                if(tag = 'textarea'){
25794
                    return w-2;
25795
                }
25796
            }
25797
        }
25798
        return w;
25799
    }
25800
 
25801
 
25802
 
25803
 
25804
 
25805
});
25806
 
25807
 
25808
Ext.form.Field.msgFx = {
25809
    normal : {
25810
        show: function(msgEl, f){
25811
            msgEl.setDisplayed('block');
25812
        },
25813
 
25814
        hide : function(msgEl, f){
25815
            msgEl.setDisplayed(false).update('');
25816
        }
25817
    },
25818
 
25819
    slide : {
25820
        show: function(msgEl, f){
25821
            msgEl.slideIn('t', {stopFx:true});
25822
        },
25823
 
25824
        hide : function(msgEl, f){
25825
            msgEl.slideOut('t', {stopFx:true,useDisplay:true});
25826
        }
25827
    },
25828
 
25829
    slideRight : {
25830
        show: function(msgEl, f){
25831
            msgEl.fixDisplay();
25832
            msgEl.alignTo(f.el, 'tl-tr');
25833
            msgEl.slideIn('l', {stopFx:true});
25834
        },
25835
 
25836
        hide : function(msgEl, f){
25837
            msgEl.slideOut('l', {stopFx:true,useDisplay:true});
25838
        }
25839
    }
25840
};
25841
Ext.reg('field', Ext.form.Field);
25842
 
25843
 
25844
Ext.form.TextField = Ext.extend(Ext.form.Field,  {
25845
 
25846
 
25847
    grow : false,
25848
 
25849
    growMin : 30,
25850
 
25851
    growMax : 800,
25852
 
25853
    vtype : null,
25854
 
25855
    maskRe : null,
25856
 
25857
    disableKeyFilter : false,
25858
 
25859
    allowBlank : true,
25860
 
25861
    minLength : 0,
25862
 
25863
    maxLength : Number.MAX_VALUE,
25864
 
25865
    minLengthText : "The minimum length for this field is {0}",
25866
 
25867
    maxLengthText : "The maximum length for this field is {0}",
25868
 
25869
    selectOnFocus : false,
25870
 
25871
    blankText : "This field is required",
25872
 
25873
    validator : null,
25874
 
25875
    regex : null,
25876
 
25877
    regexText : "",
25878
 
25879
    emptyText : null,
25880
 
25881
    emptyClass : 'x-form-empty-field',
25882
 
25883
    initComponent : function(){
25884
        Ext.form.TextField.superclass.initComponent.call(this);
25885
        this.addEvents(
25886
 
25887
            'autosize'
25888
        );
25889
    },
25890
 
25891
        initEvents : function(){
25892
        Ext.form.TextField.superclass.initEvents.call(this);
25893
        if(this.validationEvent == 'keyup'){
25894
            this.validationTask = new Ext.util.DelayedTask(this.validate, this);
25895
            this.el.on('keyup', this.filterValidation, this);
25896
        }
25897
        else if(this.validationEvent !== false){
25898
            this.el.on(this.validationEvent, this.validate, this, {buffer: this.validationDelay});
25899
        }
25900
        if(this.selectOnFocus || this.emptyText){
25901
            this.on("focus", this.preFocus, this);
25902
            if(this.emptyText){
25903
                this.on('blur', this.postBlur, this);
25904
                this.applyEmptyText();
25905
            }
25906
        }
25907
        if(this.maskRe || (this.vtype && this.disableKeyFilter !== true && (this.maskRe = Ext.form.VTypes[this.vtype+'Mask']))){
25908
            this.el.on("keypress", this.filterKeys, this);
25909
        }
25910
        if(this.grow){
25911
            this.el.on("keyup", this.onKeyUp,  this, {buffer:50});
25912
            this.el.on("click", this.autoSize,  this);
25913
        }
25914
    },
25915
 
25916
    processValue : function(value){
25917
        if(this.stripCharsRe){
25918
            var newValue = value.replace(this.stripCharsRe, '');
25919
            if(newValue !== value){
25920
                this.setRawValue(newValue);
25921
                return newValue;
25922
            }
25923
        }
25924
        return value;
25925
    },
25926
 
25927
    filterValidation : function(e){
25928
        if(!e.isNavKeyPress()){
25929
            this.validationTask.delay(this.validationDelay);
25930
        }
25931
    },
25932
 
25933
        onKeyUp : function(e){
25934
        if(!e.isNavKeyPress()){
25935
            this.autoSize();
25936
        }
25937
    },
25938
 
25939
 
25940
    reset : function(){
25941
        Ext.form.TextField.superclass.reset.call(this);
25942
        this.applyEmptyText();
25943
    },
25944
 
25945
    applyEmptyText : function(){
25946
        if(this.rendered && this.emptyText && this.getRawValue().length < 1){
25947
            this.setRawValue(this.emptyText);
25948
            this.el.addClass(this.emptyClass);
25949
        }
25950
    },
25951
 
25952
        preFocus : function(){
25953
        if(this.emptyText){
25954
            if(this.el.dom.value == this.emptyText){
25955
                this.setRawValue('');
25956
            }
25957
            this.el.removeClass(this.emptyClass);
25958
        }
25959
        if(this.selectOnFocus){
25960
            this.el.dom.select();
25961
        }
25962
    },
25963
 
25964
        postBlur : function(){
25965
        this.applyEmptyText();
25966
    },
25967
 
25968
        filterKeys : function(e){
25969
        var k = e.getKey();
25970
        if(!Ext.isIE && (e.isNavKeyPress() || k == e.BACKSPACE || (k == e.DELETE && e.button == -1))){
25971
            return;
25972
        }
25973
        var c = e.getCharCode(), cc = String.fromCharCode(c);
25974
        if(Ext.isIE && (e.isSpecialKey() || !cc)){
25975
            return;
25976
        }
25977
        if(!this.maskRe.test(cc)){
25978
            e.stopEvent();
25979
        }
25980
    },
25981
 
25982
    setValue : function(v){
25983
        if(this.emptyText && this.el && v !== undefined && v !== null && v !== ''){
25984
            this.el.removeClass(this.emptyClass);
25985
        }
25986
        Ext.form.TextField.superclass.setValue.apply(this, arguments);
25987
        this.applyEmptyText();
25988
        this.autoSize();
25989
    },
25990
 
25991
 
25992
    validateValue : function(value){
25993
        if(value.length < 1 || value === this.emptyText){              if(this.allowBlank){
25994
                 this.clearInvalid();
25995
                 return true;
25996
             }else{
25997
                 this.markInvalid(this.blankText);
25998
                 return false;
25999
             }
26000
        }
26001
        if(value.length < this.minLength){
26002
            this.markInvalid(String.format(this.minLengthText, this.minLength));
26003
            return false;
26004
        }
26005
        if(value.length > this.maxLength){
26006
            this.markInvalid(String.format(this.maxLengthText, this.maxLength));
26007
            return false;
26008
        }
26009
        if(this.vtype){
26010
            var vt = Ext.form.VTypes;
26011
            if(!vt[this.vtype](value, this)){
26012
                this.markInvalid(this.vtypeText || vt[this.vtype +'Text']);
26013
                return false;
26014
            }
26015
        }
26016
        if(typeof this.validator == "function"){
26017
            var msg = this.validator(value);
26018
            if(msg !== true){
26019
                this.markInvalid(msg);
26020
                return false;
26021
            }
26022
        }
26023
        if(this.regex && !this.regex.test(value)){
26024
            this.markInvalid(this.regexText);
26025
            return false;
26026
        }
26027
        return true;
26028
    },
26029
 
26030
 
26031
    selectText : function(start, end){
26032
        var v = this.getRawValue();
26033
        if(v.length > 0){
26034
            start = start === undefined ? 0 : start;
26035
            end = end === undefined ? v.length : end;
26036
            var d = this.el.dom;
26037
            if(d.setSelectionRange){
26038
                d.setSelectionRange(start, end);
26039
            }else if(d.createTextRange){
26040
                var range = d.createTextRange();
26041
                range.moveStart("character", start);
26042
                range.moveEnd("character", end-v.length);
26043
                range.select();
26044
            }
26045
        }
26046
    },
26047
 
26048
 
26049
    autoSize : function(){
26050
        if(!this.grow || !this.rendered){
26051
            return;
26052
        }
26053
        if(!this.metrics){
26054
            this.metrics = Ext.util.TextMetrics.createInstance(this.el);
26055
        }
26056
        var el = this.el;
26057
        var v = el.dom.value;
26058
        var d = document.createElement('div');
26059
        d.appendChild(document.createTextNode(v));
26060
        v = d.innerHTML;
26061
        d = null;
26062
        v += "&#160;";
26063
        var w = Math.min(this.growMax, Math.max(this.metrics.getWidth(v) +  10, this.growMin));
26064
        this.el.setWidth(w);
26065
        this.fireEvent("autosize", this, w);
26066
    }
26067
});
26068
Ext.reg('textfield', Ext.form.TextField);
26069
 
26070
 
26071
Ext.form.TriggerField = Ext.extend(Ext.form.TextField,  {
26072
 
26073
 
26074
    defaultAutoCreate : {tag: "input", type: "text", size: "16", autocomplete: "off"},
26075
 
26076
    hideTrigger:false,
26077
 
26078
 
26079
    autoSize: Ext.emptyFn,
26080
        monitorTab : true,
26081
        deferHeight : true,
26082
        mimicing : false,
26083
 
26084
        onResize : function(w, h){
26085
        Ext.form.TriggerField.superclass.onResize.call(this, w, h);
26086
        if(typeof w == 'number'){
26087
            this.el.setWidth(this.adjustWidth('input', w - this.trigger.getWidth()));
26088
        }
26089
        this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());
26090
    },
26091
 
26092
        adjustSize : Ext.BoxComponent.prototype.adjustSize,
26093
 
26094
        getResizeEl : function(){
26095
        return this.wrap;
26096
    },
26097
 
26098
        getPositionEl : function(){
26099
        return this.wrap;
26100
    },
26101
 
26102
        alignErrorIcon : function(){
26103
        this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]);
26104
    },
26105
 
26106
        onRender : function(ct, position){
26107
        Ext.form.TriggerField.superclass.onRender.call(this, ct, position);
26108
        this.wrap = this.el.wrap({cls: "x-form-field-wrap"});
26109
        this.trigger = this.wrap.createChild(this.triggerConfig ||
26110
                {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.triggerClass});
26111
        if(this.hideTrigger){
26112
            this.trigger.setDisplayed(false);
26113
        }
26114
        this.initTrigger();
26115
        if(!this.width){
26116
            this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());
26117
        }
26118
    },
26119
 
26120
        initTrigger : function(){
26121
        this.trigger.on("click", this.onTriggerClick, this, {preventDefault:true});
26122
        this.trigger.addClassOnOver('x-form-trigger-over');
26123
        this.trigger.addClassOnClick('x-form-trigger-click');
26124
    },
26125
 
26126
        onDestroy : function(){
26127
        if(this.trigger){
26128
            this.trigger.removeAllListeners();
26129
            this.trigger.remove();
26130
        }
26131
        if(this.wrap){
26132
            this.wrap.remove();
26133
        }
26134
        Ext.form.TriggerField.superclass.onDestroy.call(this);
26135
    },
26136
 
26137
        onFocus : function(){
26138
        Ext.form.TriggerField.superclass.onFocus.call(this);
26139
        if(!this.mimicing){
26140
            this.wrap.addClass('x-trigger-wrap-focus');
26141
            this.mimicing = true;
26142
            Ext.get(Ext.isIE ? document.body : document).on("mousedown", this.mimicBlur, this, {delay: 10});
26143
            if(this.monitorTab){
26144
                this.el.on("keydown", this.checkTab, this);
26145
            }
26146
        }
26147
    },
26148
 
26149
        checkTab : function(e){
26150
        if(e.getKey() == e.TAB){
26151
            this.triggerBlur();
26152
        }
26153
    },
26154
 
26155
        onBlur : function(){
26156
            },
26157
 
26158
        mimicBlur : function(e){
26159
        if(!this.wrap.contains(e.target) && this.validateBlur(e)){
26160
            this.triggerBlur();
26161
        }
26162
    },
26163
 
26164
        triggerBlur : function(){
26165
        this.mimicing = false;
26166
        Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur);
26167
        if(this.monitorTab){
26168
            this.el.un("keydown", this.checkTab, this);
26169
        }
26170
        this.beforeBlur();
26171
        this.wrap.removeClass('x-trigger-wrap-focus');
26172
        Ext.form.TriggerField.superclass.onBlur.call(this);
26173
    },
26174
 
26175
    beforeBlur : Ext.emptyFn,
26176
 
26177
            validateBlur : function(e){
26178
        return true;
26179
    },
26180
 
26181
        onDisable : function(){
26182
        Ext.form.TriggerField.superclass.onDisable.call(this);
26183
        if(this.wrap){
26184
            this.wrap.addClass('x-item-disabled');
26185
        }
26186
    },
26187
 
26188
        onEnable : function(){
26189
        Ext.form.TriggerField.superclass.onEnable.call(this);
26190
        if(this.wrap){
26191
            this.wrap.removeClass('x-item-disabled');
26192
        }
26193
    },
26194
 
26195
 
26196
        onShow : function(){
26197
        if(this.wrap){
26198
            this.wrap.dom.style.display = '';
26199
            this.wrap.dom.style.visibility = 'visible';
26200
        }
26201
    },
26202
 
26203
        onHide : function(){
26204
        this.wrap.dom.style.display = 'none';
26205
    },
26206
 
26207
 
26208
    onTriggerClick : Ext.emptyFn
26209
 
26210
 
26211
 
26212
 
26213
});
26214
 
26215
Ext.form.TwinTriggerField = Ext.extend(Ext.form.TriggerField, {
26216
    initComponent : function(){
26217
        Ext.form.TwinTriggerField.superclass.initComponent.call(this);
26218
 
26219
        this.triggerConfig = {
26220
            tag:'span', cls:'x-form-twin-triggers', cn:[
26221
            {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger1Class},
26222
            {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger2Class}
26223
        ]};
26224
    },
26225
 
26226
    getTrigger : function(index){
26227
        return this.triggers[index];
26228
    },
26229
 
26230
    initTrigger : function(){
26231
        var ts = this.trigger.select('.x-form-trigger', true);
26232
        this.wrap.setStyle('overflow', 'hidden');
26233
        var triggerField = this;
26234
        ts.each(function(t, all, index){
26235
            t.hide = function(){
26236
                var w = triggerField.wrap.getWidth();
26237
                this.dom.style.display = 'none';
26238
                triggerField.el.setWidth(w-triggerField.trigger.getWidth());
26239
            };
26240
            t.show = function(){
26241
                var w = triggerField.wrap.getWidth();
26242
                this.dom.style.display = '';
26243
                triggerField.el.setWidth(w-triggerField.trigger.getWidth());
26244
            };
26245
            var triggerIndex = 'Trigger'+(index+1);
26246
 
26247
            if(this['hide'+triggerIndex]){
26248
                t.dom.style.display = 'none';
26249
            }
26250
            t.on("click", this['on'+triggerIndex+'Click'], this, {preventDefault:true});
26251
            t.addClassOnOver('x-form-trigger-over');
26252
            t.addClassOnClick('x-form-trigger-click');
26253
        }, this);
26254
        this.triggers = ts.elements;
26255
    },
26256
 
26257
    onTrigger1Click : Ext.emptyFn,
26258
    onTrigger2Click : Ext.emptyFn
26259
});
26260
Ext.reg('trigger', Ext.form.TriggerField);
26261
 
26262
Ext.form.TextArea = Ext.extend(Ext.form.TextField,  {
26263
 
26264
    growMin : 60,
26265
 
26266
    growMax: 1000,
26267
    growAppend : '&#160;\n&#160;',
26268
    growPad : 0,
26269
 
26270
    enterIsSpecial : false,
26271
 
26272
 
26273
    preventScrollbars: false,
26274
 
26275
 
26276
        onRender : function(ct, position){
26277
        if(!this.el){
26278
            this.defaultAutoCreate = {
26279
                tag: "textarea",
26280
                style:"width:100px;height:60px;",
26281
                autocomplete: "off"
26282
            };
26283
        }
26284
        Ext.form.TextArea.superclass.onRender.call(this, ct, position);
26285
        if(this.grow){
26286
            this.textSizeEl = Ext.DomHelper.append(document.body, {
26287
                tag: "pre", cls: "x-form-grow-sizer"
26288
            });
26289
            if(this.preventScrollbars){
26290
                this.el.setStyle("overflow", "hidden");
26291
            }
26292
            this.el.setHeight(this.growMin);
26293
        }
26294
    },
26295
 
26296
    onDestroy : function(){
26297
        if(this.textSizeEl){
26298
            Ext.removeNode(this.textSizeEl);
26299
        }
26300
        Ext.form.TextArea.superclass.onDestroy.call(this);
26301
    },
26302
 
26303
    fireKey : function(e){
26304
        if(e.isSpecialKey() && (this.enterIsSpecial || (e.getKey() != e.ENTER || e.hasModifier()))){
26305
            this.fireEvent("specialkey", this, e);
26306
        }
26307
    },
26308
 
26309
        onKeyUp : function(e){
26310
        if(!e.isNavKeyPress() || e.getKey() == e.ENTER){
26311
            this.autoSize();
26312
        }
26313
    },
26314
 
26315
 
26316
    autoSize : function(){
26317
        if(!this.grow || !this.textSizeEl){
26318
            return;
26319
        }
26320
        var el = this.el;
26321
        var v = el.dom.value;
26322
        var ts = this.textSizeEl;
26323
        ts.innerHTML = '';
26324
        ts.appendChild(document.createTextNode(v));
26325
        v = ts.innerHTML;
26326
 
26327
        Ext.fly(ts).setWidth(this.el.getWidth());
26328
        if(v.length < 1){
26329
            v = "&#160;&#160;";
26330
        }else{
26331
            if(Ext.isIE){
26332
                v = v.replace(/\n/g, '<p>&#160;</p>');
26333
            }
26334
            v += this.growAppend;
26335
        }
26336
        ts.innerHTML = v;
26337
        var h = Math.min(this.growMax, Math.max(ts.offsetHeight, this.growMin)+this.growPad);
26338
        if(h != this.lastHeight){
26339
            this.lastHeight = h;
26340
            this.el.setHeight(h);
26341
            this.fireEvent("autosize", this, h);
26342
        }
26343
    }
26344
});
26345
Ext.reg('textarea', Ext.form.TextArea);
26346
 
26347
Ext.form.NumberField = Ext.extend(Ext.form.TextField,  {
26348
 
26349
    fieldClass: "x-form-field x-form-num-field",
26350
 
26351
    allowDecimals : true,
26352
 
26353
    decimalSeparator : ".",
26354
 
26355
    decimalPrecision : 2,
26356
 
26357
    allowNegative : true,
26358
 
26359
    minValue : Number.NEGATIVE_INFINITY,
26360
 
26361
    maxValue : Number.MAX_VALUE,
26362
 
26363
    minText : "The minimum value for this field is {0}",
26364
 
26365
    maxText : "The maximum value for this field is {0}",
26366
 
26367
    nanText : "{0} is not a valid number",
26368
 
26369
    baseChars : "0123456789",
26370
 
26371
        initEvents : function(){
26372
        Ext.form.NumberField.superclass.initEvents.call(this);
26373
        var allowed = this.baseChars+'';
26374
        if(this.allowDecimals){
26375
            allowed += this.decimalSeparator;
26376
        }
26377
        if(this.allowNegative){
26378
            allowed += "-";
26379
        }
26380
        this.stripCharsRe = new RegExp('[^'+allowed+']', 'gi');
26381
        var keyPress = function(e){
26382
            var k = e.getKey();
26383
            if(!Ext.isIE && (e.isSpecialKey() || k == e.BACKSPACE || k == e.DELETE)){
26384
                return;
26385
            }
26386
            var c = e.getCharCode();
26387
            if(allowed.indexOf(String.fromCharCode(c)) === -1){
26388
                e.stopEvent();
26389
            }
26390
        };
26391
        this.el.on("keypress", keyPress, this);
26392
    },
26393
 
26394
        validateValue : function(value){
26395
        if(!Ext.form.NumberField.superclass.validateValue.call(this, value)){
26396
            return false;
26397
        }
26398
        if(value.length < 1){              return true;
26399
        }
26400
        value = String(value).replace(this.decimalSeparator, ".");
26401
        if(isNaN(value)){
26402
            this.markInvalid(String.format(this.nanText, value));
26403
            return false;
26404
        }
26405
        var num = this.parseValue(value);
26406
        if(num < this.minValue){
26407
            this.markInvalid(String.format(this.minText, this.minValue));
26408
            return false;
26409
        }
26410
        if(num > this.maxValue){
26411
            this.markInvalid(String.format(this.maxText, this.maxValue));
26412
            return false;
26413
        }
26414
        return true;
26415
    },
26416
 
26417
    getValue : function(){
26418
        return this.fixPrecision(this.parseValue(Ext.form.NumberField.superclass.getValue.call(this)));
26419
    },
26420
 
26421
    setValue : function(v){
26422
    	v = parseFloat(v);
26423
    	v = isNaN(v) ? '' : String(v).replace(".", this.decimalSeparator);
26424
        Ext.form.NumberField.superclass.setValue.call(this, v);
26425
    },
26426
 
26427
        parseValue : function(value){
26428
        value = parseFloat(String(value).replace(this.decimalSeparator, "."));
26429
        return isNaN(value) ? '' : value;
26430
    },
26431
 
26432
        fixPrecision : function(value){
26433
        var nan = isNaN(value);
26434
        if(!this.allowDecimals || this.decimalPrecision == -1 || nan || !value){
26435
           return nan ? '' : value;
26436
        }
26437
        return parseFloat(parseFloat(value).toFixed(this.decimalPrecision));
26438
    },
26439
 
26440
    beforeBlur : function(){
26441
        var v = this.parseValue(this.getRawValue());
26442
        if(v){
26443
            this.setValue(this.fixPrecision(v));
26444
        }
26445
    }
26446
});
26447
Ext.reg('numberfield', Ext.form.NumberField);
26448
 
26449
Ext.form.DateField = Ext.extend(Ext.form.TriggerField,  {
26450
 
26451
    format : "m/d/y",
26452
 
26453
    altFormats : "m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d",
26454
 
26455
    disabledDays : null,
26456
 
26457
    disabledDaysText : "Disabled",
26458
 
26459
    disabledDates : null,
26460
 
26461
    disabledDatesText : "Disabled",
26462
 
26463
    minValue : null,
26464
 
26465
    maxValue : null,
26466
 
26467
    minText : "The date in this field must be equal to or after {0}",
26468
 
26469
    maxText : "The date in this field must be equal to or before {0}",
26470
 
26471
    invalidText : "{0} is not a valid date - it must be in the format {1}",
26472
 
26473
    triggerClass : 'x-form-date-trigger',
26474
 
26475
 
26476
        defaultAutoCreate : {tag: "input", type: "text", size: "10", autocomplete: "off"},
26477
 
26478
    initComponent : function(){
26479
        Ext.form.DateField.superclass.initComponent.call(this);
26480
        if(typeof this.minValue == "string"){
26481
            this.minValue = this.parseDate(this.minValue);
26482
        }
26483
        if(typeof this.maxValue == "string"){
26484
            this.maxValue = this.parseDate(this.maxValue);
26485
        }
26486
        this.ddMatch = null;
26487
        if(this.disabledDates){
26488
            var dd = this.disabledDates;
26489
            var re = "(?:";
26490
            for(var i = 0; i < dd.length; i++){
26491
                re += dd[i];
26492
                if(i != dd.length-1) re += "|";
26493
            }
26494
            this.ddMatch = new RegExp(re + ")");
26495
        }
26496
    },
26497
 
26498
        validateValue : function(value){
26499
        value = this.formatDate(value);
26500
        if(!Ext.form.DateField.superclass.validateValue.call(this, value)){
26501
            return false;
26502
        }
26503
        if(value.length < 1){              return true;
26504
        }
26505
        var svalue = value;
26506
        value = this.parseDate(value);
26507
        if(!value){
26508
            this.markInvalid(String.format(this.invalidText, svalue, this.format));
26509
            return false;
26510
        }
26511
        var time = value.getTime();
26512
        if(this.minValue && time < this.minValue.getTime()){
26513
            this.markInvalid(String.format(this.minText, this.formatDate(this.minValue)));
26514
            return false;
26515
        }
26516
        if(this.maxValue && time > this.maxValue.getTime()){
26517
            this.markInvalid(String.format(this.maxText, this.formatDate(this.maxValue)));
26518
            return false;
26519
        }
26520
        if(this.disabledDays){
26521
            var day = value.getDay();
26522
            for(var i = 0; i < this.disabledDays.length; i++) {
26523
            	if(day === this.disabledDays[i]){
26524
            	    this.markInvalid(this.disabledDaysText);
26525
                    return false;
26526
            	}
26527
            }
26528
        }
26529
        var fvalue = this.formatDate(value);
26530
        if(this.ddMatch && this.ddMatch.test(fvalue)){
26531
            this.markInvalid(String.format(this.disabledDatesText, fvalue));
26532
            return false;
26533
        }
26534
        return true;
26535
    },
26536
 
26537
            validateBlur : function(){
26538
        return !this.menu || !this.menu.isVisible();
26539
    },
26540
 
26541
 
26542
    getValue : function(){
26543
        return this.parseDate(Ext.form.DateField.superclass.getValue.call(this)) || "";
26544
    },
26545
 
26546
 
26547
    setValue : function(date){
26548
        Ext.form.DateField.superclass.setValue.call(this, this.formatDate(this.parseDate(date)));
26549
    },
26550
 
26551
        parseDate : function(value){
26552
        if(!value || Ext.isDate(value)){
26553
            return value;
26554
        }
26555
        var v = Date.parseDate(value, this.format);
26556
        if(!v && this.altFormats){
26557
            if(!this.altFormatsArray){
26558
                this.altFormatsArray = this.altFormats.split("|");
26559
            }
26560
            for(var i = 0, len = this.altFormatsArray.length; i < len && !v; i++){
26561
                v = Date.parseDate(value, this.altFormatsArray[i]);
26562
            }
26563
        }
26564
        return v;
26565
    },
26566
 
26567
        onDestroy : function(){
26568
        if(this.menu) {
26569
            this.menu.destroy();
26570
        }
26571
        if(this.wrap){
26572
            this.wrap.remove();
26573
        }
26574
        Ext.form.DateField.superclass.onDestroy.call(this);
26575
    },
26576
 
26577
        formatDate : function(date){
26578
        return Ext.isDate(date) ? date.dateFormat(this.format) : date;
26579
    },
26580
 
26581
        menuListeners : {
26582
        select: function(m, d){
26583
            this.setValue(d);
26584
        },
26585
        show : function(){             this.onFocus();
26586
        },
26587
        hide : function(){
26588
            this.focus.defer(10, this);
26589
            var ml = this.menuListeners;
26590
            this.menu.un("select", ml.select,  this);
26591
            this.menu.un("show", ml.show,  this);
26592
            this.menu.un("hide", ml.hide,  this);
26593
        }
26594
    },
26595
 
26596
            onTriggerClick : function(){
26597
        if(this.disabled){
26598
            return;
26599
        }
26600
        if(this.menu == null){
26601
            this.menu = new Ext.menu.DateMenu();
26602
        }
26603
        Ext.apply(this.menu.picker,  {
26604
            minDate : this.minValue,
26605
            maxDate : this.maxValue,
26606
            disabledDatesRE : this.ddMatch,
26607
            disabledDatesText : this.disabledDatesText,
26608
            disabledDays : this.disabledDays,
26609
            disabledDaysText : this.disabledDaysText,
26610
            format : this.format,
26611
            minText : String.format(this.minText, this.formatDate(this.minValue)),
26612
            maxText : String.format(this.maxText, this.formatDate(this.maxValue))
26613
        });
26614
        this.menu.on(Ext.apply({}, this.menuListeners, {
26615
            scope:this
26616
        }));
26617
        this.menu.picker.setValue(this.getValue() || new Date());
26618
        this.menu.show(this.el, "tl-bl?");
26619
    },
26620
 
26621
    beforeBlur : function(){
26622
        var v = this.parseDate(this.getRawValue());
26623
        if(v){
26624
            this.setValue(v);
26625
        }
26626
    }
26627
 
26628
 
26629
 
26630
 
26631
 
26632
});
26633
Ext.reg('datefield', Ext.form.DateField);
26634
 
26635
Ext.form.ComboBox = Ext.extend(Ext.form.TriggerField, {
26636
 
26637
 
26638
 
26639
 
26640
 
26641
 
26642
        defaultAutoCreate : {tag: "input", type: "text", size: "24", autocomplete: "off"},
26643
 
26644
 
26645
 
26646
 
26647
 
26648
 
26649
    listClass: '',
26650
 
26651
    selectedClass: 'x-combo-selected',
26652
 
26653
    triggerClass : 'x-form-arrow-trigger',
26654
 
26655
    shadow:'sides',
26656
 
26657
    listAlign: 'tl-bl?',
26658
 
26659
    maxHeight: 300,
26660
 
26661
    minHeight: 90,
26662
 
26663
    triggerAction: 'query',
26664
 
26665
    minChars : 4,
26666
 
26667
    typeAhead: false,
26668
 
26669
    queryDelay: 500,
26670
 
26671
    pageSize: 0,
26672
 
26673
    selectOnFocus:false,
26674
 
26675
    queryParam: 'query',
26676
 
26677
    loadingText: 'Loading...',
26678
 
26679
    resizable: false,
26680
 
26681
    handleHeight : 8,
26682
 
26683
    editable: true,
26684
 
26685
    allQuery: '',
26686
 
26687
    mode: 'remote',
26688
 
26689
    minListWidth : 70,
26690
 
26691
    forceSelection:false,
26692
 
26693
    typeAheadDelay : 250,
26694
 
26695
 
26696
 
26697
    lazyInit : true,
26698
 
26699
    initComponent : function(){
26700
        Ext.form.ComboBox.superclass.initComponent.call(this);
26701
        this.addEvents(
26702
 
26703
            'expand',
26704
 
26705
            'collapse',
26706
 
26707
            'beforeselect',
26708
 
26709
            'select',
26710
 
26711
            'beforequery'
26712
        );
26713
        if(this.transform){
26714
            this.allowDomMove = false;
26715
            var s = Ext.getDom(this.transform);
26716
            if(!this.hiddenName){
26717
                this.hiddenName = s.name;
26718
            }
26719
            if(!this.store){
26720
                this.mode = 'local';
26721
                var d = [], opts = s.options;
26722
                for(var i = 0, len = opts.length;i < len; i++){
26723
                    var o = opts[i];
26724
                    var value = (Ext.isIE ? o.getAttributeNode('value').specified : o.hasAttribute('value')) ? o.value : o.text;
26725
                    if(o.selected) {
26726
                        this.value = value;
26727
                    }
26728
                    d.push([value, o.text]);
26729
                }
26730
                this.store = new Ext.data.SimpleStore({
26731
                    'id': 0,
26732
                    fields: ['value', 'text'],
26733
                    data : d
26734
                });
26735
                this.valueField = 'value';
26736
                this.displayField = 'text';
26737
            }
26738
            s.name = Ext.id();             if(!this.lazyRender){
26739
                this.target = true;
26740
                this.el = Ext.DomHelper.insertBefore(s, this.autoCreate || this.defaultAutoCreate);
26741
                Ext.removeNode(s);                 this.render(this.el.parentNode);
26742
            }else{
26743
                Ext.removeNode(s);             }
26744
 
26745
        }
26746
        this.selectedIndex = -1;
26747
        if(this.mode == 'local'){
26748
            if(this.initialConfig.queryDelay === undefined){
26749
                this.queryDelay = 10;
26750
            }
26751
            if(this.initialConfig.minChars === undefined){
26752
                this.minChars = 0;
26753
            }
26754
        }
26755
    },
26756
 
26757
        onRender : function(ct, position){
26758
        Ext.form.ComboBox.superclass.onRender.call(this, ct, position);
26759
        if(this.hiddenName){
26760
            this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName, id: (this.hiddenId||this.hiddenName)},
26761
                    'before', true);
26762
            this.hiddenField.value =
26763
                this.hiddenValue !== undefined ? this.hiddenValue :
26764
                this.value !== undefined ? this.value : '';
26765
 
26766
                        this.el.dom.removeAttribute('name');
26767
        }
26768
        if(Ext.isGecko){
26769
            this.el.dom.setAttribute('autocomplete', 'off');
26770
        }
26771
 
26772
        if(!this.lazyInit){
26773
            this.initList();
26774
        }else{
26775
            this.on('focus', this.initList, this, {single: true});
26776
        }
26777
 
26778
        if(!this.editable){
26779
            this.editable = true;
26780
            this.setEditable(false);
26781
        }
26782
    },
26783
 
26784
    initList : function(){
26785
        if(!this.list){
26786
            var cls = 'x-combo-list';
26787
 
26788
            this.list = new Ext.Layer({
26789
                shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false
26790
            });
26791
 
26792
            var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth);
26793
            this.list.setWidth(lw);
26794
            this.list.swallowEvent('mousewheel');
26795
            this.assetHeight = 0;
26796
 
26797
            if(this.title){
26798
                this.header = this.list.createChild({cls:cls+'-hd', html: this.title});
26799
                this.assetHeight += this.header.getHeight();
26800
            }
26801
 
26802
            this.innerList = this.list.createChild({cls:cls+'-inner'});
26803
            this.innerList.on('mouseover', this.onViewOver, this);
26804
            this.innerList.on('mousemove', this.onViewMove, this);
26805
            this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));
26806
 
26807
            if(this.pageSize){
26808
                this.footer = this.list.createChild({cls:cls+'-ft'});
26809
                this.pageTb = new Ext.PagingToolbar({
26810
                    store:this.store,
26811
                    pageSize: this.pageSize,
26812
                    renderTo:this.footer
26813
                });
26814
                this.assetHeight += this.footer.getHeight();
26815
            }
26816
 
26817
            if(!this.tpl){
26818
 
26819
                this.tpl = '<tpl for="."><div class="'+cls+'-item">{' + this.displayField + '}</div></tpl>';
26820
            }
26821
 
26822
 
26823
            this.view = new Ext.DataView({
26824
                applyTo: this.innerList,
26825
                tpl: this.tpl,
26826
                singleSelect: true,
26827
                selectedClass: this.selectedClass,
26828
                itemSelector: this.itemSelector || '.' + cls + '-item'
26829
            });
26830
 
26831
            this.view.on('click', this.onViewClick, this);
26832
 
26833
            this.bindStore(this.store, true);
26834
 
26835
            if(this.resizable){
26836
                this.resizer = new Ext.Resizable(this.list,  {
26837
                   pinned:true, handles:'se'
26838
                });
26839
                this.resizer.on('resize', function(r, w, h){
26840
                    this.maxHeight = h-this.handleHeight-this.list.getFrameWidth('tb')-this.assetHeight;
26841
                    this.listWidth = w;
26842
                    this.innerList.setWidth(w - this.list.getFrameWidth('lr'));
26843
                    this.restrictHeight();
26844
                }, this);
26845
                this[this.pageSize?'footer':'innerList'].setStyle('margin-bottom', this.handleHeight+'px');
26846
            }
26847
        }
26848
    },
26849
 
26850
 
26851
        bindStore : function(store, initial){
26852
        if(this.store && !initial){
26853
            this.store.un('beforeload', this.onBeforeLoad, this);
26854
            this.store.un('load', this.onLoad, this);
26855
            this.store.un('loadexception', this.collapse, this);
26856
            if(!store){
26857
                this.store = null;
26858
                if(this.view){
26859
                    this.view.setStore(null);
26860
                }
26861
            }
26862
        }
26863
        if(store){
26864
            this.store = Ext.StoreMgr.lookup(store);
26865
 
26866
            this.store.on('beforeload', this.onBeforeLoad, this);
26867
            this.store.on('load', this.onLoad, this);
26868
            this.store.on('loadexception', this.collapse, this);
26869
 
26870
            if(this.view){
26871
                this.view.setStore(store);
26872
            }
26873
        }
26874
    },
26875
 
26876
        initEvents : function(){
26877
        Ext.form.ComboBox.superclass.initEvents.call(this);
26878
 
26879
        this.keyNav = new Ext.KeyNav(this.el, {
26880
            "up" : function(e){
26881
                this.inKeyMode = true;
26882
                this.selectPrev();
26883
            },
26884
 
26885
            "down" : function(e){
26886
                if(!this.isExpanded()){
26887
                    this.onTriggerClick();
26888
                }else{
26889
                    this.inKeyMode = true;
26890
                    this.selectNext();
26891
                }
26892
            },
26893
 
26894
            "enter" : function(e){
26895
                this.onViewClick();
26896
                this.delayedCheck = true;
26897
				this.unsetDelayCheck.defer(10, this);
26898
            },
26899
 
26900
            "esc" : function(e){
26901
                this.collapse();
26902
            },
26903
 
26904
            "tab" : function(e){
26905
                this.onViewClick(false);
26906
                return true;
26907
            },
26908
 
26909
            scope : this,
26910
 
26911
            doRelay : function(foo, bar, hname){
26912
                if(hname == 'down' || this.scope.isExpanded()){
26913
                   return Ext.KeyNav.prototype.doRelay.apply(this, arguments);
26914
                }
26915
                return true;
26916
            },
26917
 
26918
            forceKeyDown : true
26919
        });
26920
        this.queryDelay = Math.max(this.queryDelay || 10,
26921
                this.mode == 'local' ? 10 : 250);
26922
        this.dqTask = new Ext.util.DelayedTask(this.initQuery, this);
26923
        if(this.typeAhead){
26924
            this.taTask = new Ext.util.DelayedTask(this.onTypeAhead, this);
26925
        }
26926
        if(this.editable !== false){
26927
            this.el.on("keyup", this.onKeyUp, this);
26928
        }
26929
        if(this.forceSelection){
26930
            this.on('blur', this.doForce, this);
26931
        }
26932
    },
26933
 
26934
    onDestroy : function(){
26935
        if(this.view){
26936
            this.view.el.removeAllListeners();
26937
            this.view.el.remove();
26938
            this.view.purgeListeners();
26939
        }
26940
        if(this.list){
26941
            this.list.destroy();
26942
        }
26943
        this.bindStore(null);
26944
        Ext.form.ComboBox.superclass.onDestroy.call(this);
26945
    },
26946
 
26947
	unsetDelayCheck : function(){
26948
		delete this.delayedCheck;
26949
	},
26950
        fireKey : function(e){
26951
        if(e.isNavKeyPress() && !this.isExpanded() && !this.delayedCheck){
26952
            this.fireEvent("specialkey", this, e);
26953
        }
26954
    },
26955
 
26956
        onResize: function(w, h){
26957
        Ext.form.ComboBox.superclass.onResize.apply(this, arguments);
26958
        if(this.list && this.listWidth === undefined){
26959
            var lw = Math.max(w, this.minListWidth);
26960
            this.list.setWidth(lw);
26961
            this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));
26962
        }
26963
    },
26964
 
26965
        onEnable: function(){
26966
        Ext.form.ComboBox.superclass.onEnable.apply(this, arguments);
26967
        if(this.hiddenField){
26968
            this.hiddenField.disabled = false;
26969
        }
26970
    },
26971
 
26972
        onDisable: function(){
26973
        Ext.form.ComboBox.superclass.onDisable.apply(this, arguments);
26974
        if(this.hiddenField){
26975
            this.hiddenField.disabled = true;
26976
        }
26977
    },
26978
 
26979
 
26980
    setEditable : function(value){
26981
        if(value == this.editable){
26982
            return;
26983
        }
26984
        this.editable = value;
26985
        if(!value){
26986
            this.el.dom.setAttribute('readOnly', true);
26987
            this.el.on('mousedown', this.onTriggerClick,  this);
26988
            this.el.addClass('x-combo-noedit');
26989
        }else{
26990
            this.el.dom.setAttribute('readOnly', false);
26991
            this.el.un('mousedown', this.onTriggerClick,  this);
26992
            this.el.removeClass('x-combo-noedit');
26993
        }
26994
    },
26995
 
26996
        onBeforeLoad : function(){
26997
        if(!this.hasFocus){
26998
            return;
26999
        }
27000
        this.innerList.update(this.loadingText ?
27001
               '<div class="loading-indicator">'+this.loadingText+'</div>' : '');
27002
        this.restrictHeight();
27003
        this.selectedIndex = -1;
27004
    },
27005
 
27006
        onLoad : function(){
27007
        if(!this.hasFocus){
27008
            return;
27009
        }
27010
        if(this.store.getCount() > 0){
27011
            this.expand();
27012
            this.restrictHeight();
27013
            if(this.lastQuery == this.allQuery){
27014
                if(this.editable){
27015
                    this.el.dom.select();
27016
                }
27017
                if(!this.selectByValue(this.value, true)){
27018
                    this.select(0, true);
27019
                }
27020
            }else{
27021
                this.selectNext();
27022
                if(this.typeAhead && this.lastKey != Ext.EventObject.BACKSPACE && this.lastKey != Ext.EventObject.DELETE){
27023
                    this.taTask.delay(this.typeAheadDelay);
27024
                }
27025
            }
27026
        }else{
27027
            this.onEmptyResults();
27028
        }
27029
            },
27030
 
27031
        onTypeAhead : function(){
27032
        if(this.store.getCount() > 0){
27033
            var r = this.store.getAt(0);
27034
            var newValue = r.data[this.displayField];
27035
            var len = newValue.length;
27036
            var selStart = this.getRawValue().length;
27037
            if(selStart != len){
27038
                this.setRawValue(newValue);
27039
                this.selectText(selStart, newValue.length);
27040
            }
27041
        }
27042
    },
27043
 
27044
        onSelect : function(record, index){
27045
        if(this.fireEvent('beforeselect', this, record, index) !== false){
27046
            this.setValue(record.data[this.valueField || this.displayField]);
27047
            this.collapse();
27048
            this.fireEvent('select', this, record, index);
27049
        }
27050
    },
27051
 
27052
 
27053
    getValue : function(){
27054
        if(this.valueField){
27055
            return typeof this.value != 'undefined' ? this.value : '';
27056
        }else{
27057
            return Ext.form.ComboBox.superclass.getValue.call(this);
27058
        }
27059
    },
27060
 
27061
 
27062
    clearValue : function(){
27063
        if(this.hiddenField){
27064
            this.hiddenField.value = '';
27065
        }
27066
        this.setRawValue('');
27067
        this.lastSelectionText = '';
27068
        this.applyEmptyText();
27069
        this.value = '';
27070
    },
27071
 
27072
 
27073
    setValue : function(v){
27074
        var text = v;
27075
        if(this.valueField){
27076
            var r = this.findRecord(this.valueField, v);
27077
            if(r){
27078
                text = r.data[this.displayField];
27079
            }else if(this.valueNotFoundText !== undefined){
27080
                text = this.valueNotFoundText;
27081
            }
27082
        }
27083
        this.lastSelectionText = text;
27084
        if(this.hiddenField){
27085
            this.hiddenField.value = v;
27086
        }
27087
        Ext.form.ComboBox.superclass.setValue.call(this, text);
27088
        this.value = v;
27089
    },
27090
 
27091
        findRecord : function(prop, value){
27092
        var record;
27093
        if(this.store.getCount() > 0){
27094
            this.store.each(function(r){
27095
                if(r.data[prop] == value){
27096
                    record = r;
27097
                    return false;
27098
                }
27099
            });
27100
        }
27101
        return record;
27102
    },
27103
 
27104
        onViewMove : function(e, t){
27105
        this.inKeyMode = false;
27106
    },
27107
 
27108
        onViewOver : function(e, t){
27109
        if(this.inKeyMode){             return;
27110
        }
27111
        var item = this.view.findItemFromChild(t);
27112
        if(item){
27113
            var index = this.view.indexOf(item);
27114
            this.select(index, false);
27115
        }
27116
    },
27117
 
27118
        onViewClick : function(doFocus){
27119
        var index = this.view.getSelectedIndexes()[0];
27120
        var r = this.store.getAt(index);
27121
        if(r){
27122
            this.onSelect(r, index);
27123
        }
27124
        if(doFocus !== false){
27125
            this.el.focus();
27126
        }
27127
    },
27128
 
27129
    	restrictHeight : function(){
27130
        this.innerList.dom.style.height = '';
27131
        var inner = this.innerList.dom;
27132
        var pad = this.list.getFrameWidth('tb')+(this.resizable?this.handleHeight:0)+this.assetHeight;
27133
        var h = Math.max(inner.clientHeight, inner.offsetHeight, inner.scrollHeight);
27134
        var ha = this.getPosition()[1]-Ext.getBody().getScroll().top;
27135
        var hb = Ext.lib.Dom.getViewHeight()-ha-this.getSize().height;
27136
        var space = Math.max(ha, hb, this.minHeight || 0)-this.list.shadow.offset-pad-2;
27137
        h = Math.min(h, space, this.maxHeight);
27138
 
27139
        this.innerList.setHeight(h);
27140
        this.list.beginUpdate();
27141
        this.list.setHeight(h+pad);
27142
        this.list.alignTo(this.el, this.listAlign);
27143
        this.list.endUpdate();
27144
    },
27145
 
27146
        onEmptyResults : function(){
27147
        this.collapse();
27148
    },
27149
 
27150
 
27151
    isExpanded : function(){
27152
        return this.list && this.list.isVisible();
27153
    },
27154
 
27155
 
27156
    selectByValue : function(v, scrollIntoView){
27157
        if(v !== undefined && v !== null){
27158
            var r = this.findRecord(this.valueField || this.displayField, v);
27159
            if(r){
27160
                this.select(this.store.indexOf(r), scrollIntoView);
27161
                return true;
27162
            }
27163
        }
27164
        return false;
27165
    },
27166
 
27167
 
27168
    select : function(index, scrollIntoView){
27169
        this.selectedIndex = index;
27170
        this.view.select(index);
27171
        if(scrollIntoView !== false){
27172
            var el = this.view.getNode(index);
27173
            if(el){
27174
                this.innerList.scrollChildIntoView(el, false);
27175
            }
27176
        }
27177
    },
27178
 
27179
        selectNext : function(){
27180
        var ct = this.store.getCount();
27181
        if(ct > 0){
27182
            if(this.selectedIndex == -1){
27183
                this.select(0);
27184
            }else if(this.selectedIndex < ct-1){
27185
                this.select(this.selectedIndex+1);
27186
            }
27187
        }
27188
    },
27189
 
27190
        selectPrev : function(){
27191
        var ct = this.store.getCount();
27192
        if(ct > 0){
27193
            if(this.selectedIndex == -1){
27194
                this.select(0);
27195
            }else if(this.selectedIndex != 0){
27196
                this.select(this.selectedIndex-1);
27197
            }
27198
        }
27199
    },
27200
 
27201
        onKeyUp : function(e){
27202
        if(this.editable !== false && !e.isSpecialKey()){
27203
            this.lastKey = e.getKey();
27204
            this.dqTask.delay(this.queryDelay);
27205
        }
27206
    },
27207
 
27208
        validateBlur : function(){
27209
        return !this.list || !this.list.isVisible();
27210
    },
27211
 
27212
        initQuery : function(){
27213
        this.doQuery(this.getRawValue());
27214
    },
27215
 
27216
        doForce : function(){
27217
        if(this.el.dom.value.length > 0){
27218
            this.el.dom.value =
27219
                this.lastSelectionText === undefined ? '' : this.lastSelectionText;
27220
            this.applyEmptyText();
27221
        }
27222
    },
27223
 
27224
 
27225
    doQuery : function(q, forceAll){
27226
        if(q === undefined || q === null){
27227
            q = '';
27228
        }
27229
        var qe = {
27230
            query: q,
27231
            forceAll: forceAll,
27232
            combo: this,
27233
            cancel:false
27234
        };
27235
        if(this.fireEvent('beforequery', qe)===false || qe.cancel){
27236
            return false;
27237
        }
27238
        q = qe.query;
27239
        forceAll = qe.forceAll;
27240
        if(forceAll === true || (q.length >= this.minChars)){
27241
            if(this.lastQuery !== q){
27242
                this.lastQuery = q;
27243
                if(this.mode == 'local'){
27244
                    this.selectedIndex = -1;
27245
                    if(forceAll){
27246
                        this.store.clearFilter();
27247
                    }else{
27248
                        this.store.filter(this.displayField, q);
27249
                    }
27250
                    this.onLoad();
27251
                }else{
27252
                    this.store.baseParams[this.queryParam] = q;
27253
                    this.store.load({
27254
                        params: this.getParams(q)
27255
                    });
27256
                    this.expand();
27257
                }
27258
            }else{
27259
                this.selectedIndex = -1;
27260
                this.onLoad();
27261
            }
27262
        }
27263
    },
27264
 
27265
        getParams : function(q){
27266
        var p = {};
27267
                if(this.pageSize){
27268
            p.start = 0;
27269
            p.limit = this.pageSize;
27270
        }
27271
        return p;
27272
    },
27273
 
27274
 
27275
    collapse : function(){
27276
        if(!this.isExpanded()){
27277
            return;
27278
        }
27279
        this.list.hide();
27280
        Ext.getDoc().un('mousewheel', this.collapseIf, this);
27281
        Ext.getDoc().un('mousedown', this.collapseIf, this);
27282
        this.fireEvent('collapse', this);
27283
    },
27284
 
27285
        collapseIf : function(e){
27286
        if(!e.within(this.wrap) && !e.within(this.list)){
27287
            this.collapse();
27288
        }
27289
    },
27290
 
27291
 
27292
    expand : function(){
27293
        if(this.isExpanded() || !this.hasFocus){
27294
            return;
27295
        }
27296
        this.list.alignTo(this.wrap, this.listAlign);
27297
        this.list.show();
27298
        this.innerList.setOverflow('auto');         Ext.getDoc().on('mousewheel', this.collapseIf, this);
27299
        Ext.getDoc().on('mousedown', this.collapseIf, this);
27300
        this.fireEvent('expand', this);
27301
    },
27302
 
27303
            onTriggerClick : function(){
27304
        if(this.disabled){
27305
            return;
27306
        }
27307
        if(this.isExpanded()){
27308
            this.collapse();
27309
            this.el.focus();
27310
        }else {
27311
            this.onFocus({});
27312
            if(this.triggerAction == 'all') {
27313
                this.doQuery(this.allQuery, true);
27314
            } else {
27315
                this.doQuery(this.getRawValue());
27316
            }
27317
            this.el.focus();
27318
        }
27319
    }
27320
 
27321
 
27322
 
27323
 
27324
 
27325
 
27326
});
27327
Ext.reg('combo', Ext.form.ComboBox);
27328
 
27329
Ext.form.Checkbox = Ext.extend(Ext.form.Field,  {
27330
 
27331
    focusClass : undefined,
27332
 
27333
    fieldClass: "x-form-field",
27334
 
27335
    checked: false,
27336
 
27337
    defaultAutoCreate : { tag: "input", type: 'checkbox', autocomplete: "off"},
27338
 
27339
 
27340
 
27341
	    initComponent : function(){
27342
        Ext.form.Checkbox.superclass.initComponent.call(this);
27343
        this.addEvents(
27344
 
27345
            'check'
27346
        );
27347
    },
27348
 
27349
        onResize : function(){
27350
        Ext.form.Checkbox.superclass.onResize.apply(this, arguments);
27351
        if(!this.boxLabel){
27352
            this.el.alignTo(this.wrap, 'c-c');
27353
        }
27354
    },
27355
 
27356
        initEvents : function(){
27357
        Ext.form.Checkbox.superclass.initEvents.call(this);
27358
        this.el.on("click", this.onClick,  this);
27359
        this.el.on("change", this.onClick,  this);
27360
    },
27361
 
27362
	    getResizeEl : function(){
27363
        return this.wrap;
27364
    },
27365
 
27366
        getPositionEl : function(){
27367
        return this.wrap;
27368
    },
27369
 
27370
 
27371
    markInvalid : Ext.emptyFn,
27372
 
27373
    clearInvalid : Ext.emptyFn,
27374
 
27375
        onRender : function(ct, position){
27376
        Ext.form.Checkbox.superclass.onRender.call(this, ct, position);
27377
        if(this.inputValue !== undefined){
27378
            this.el.dom.value = this.inputValue;
27379
        }
27380
        this.wrap = this.el.wrap({cls: "x-form-check-wrap"});
27381
        if(this.boxLabel){
27382
            this.wrap.createChild({tag: 'label', htmlFor: this.el.id, cls: 'x-form-cb-label', html: this.boxLabel});
27383
        }
27384
        if(this.checked){
27385
            this.setValue(true);
27386
        }else{
27387
            this.checked = this.el.dom.checked;
27388
        }
27389
    },
27390
 
27391
        onDestroy : function(){
27392
        if(this.wrap){
27393
            this.wrap.remove();
27394
        }
27395
        Ext.form.Checkbox.superclass.onDestroy.call(this);
27396
    },
27397
 
27398
        initValue : Ext.emptyFn,
27399
 
27400
 
27401
    getValue : function(){
27402
        if(this.rendered){
27403
            return this.el.dom.checked;
27404
        }
27405
        return false;
27406
    },
27407
 
27408
	    onClick : function(){
27409
        if(this.el.dom.checked != this.checked){
27410
            this.setValue(this.el.dom.checked);
27411
        }
27412
    },
27413
 
27414
 
27415
    setValue : function(v){
27416
        this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
27417
        if(this.el && this.el.dom){
27418
            this.el.dom.checked = this.checked;
27419
            this.el.dom.defaultChecked = this.checked;
27420
        }
27421
        this.fireEvent("check", this, this.checked);
27422
    }
27423
});
27424
Ext.reg('checkbox', Ext.form.Checkbox);
27425
 
27426
Ext.form.Radio = Ext.extend(Ext.form.Checkbox, {
27427
    inputType: 'radio',
27428
 
27429
 
27430
    markInvalid : Ext.emptyFn,
27431
 
27432
    clearInvalid : Ext.emptyFn,
27433
 
27434
 
27435
    getGroupValue : function(){
27436
    	var p = this.el.up('form') || Ext.getBody();
27437
        var c = p.child('input[name='+this.el.dom.name+']:checked', true);
27438
        return c ? c.value : null;
27439
    },
27440
 
27441
        onClick : function(){
27442
    	if(this.el.dom.checked != this.checked){
27443
    		var p = this.el.up('form') || Ext.getBody();
27444
			var els = p.select('input[name='+this.el.dom.name+']');
27445
			els.each(function(el){
27446
				if(el.dom.id == this.id){
27447
					this.setValue(true);
27448
				}else{
27449
					Ext.getCmp(el.dom.id).setValue(false);
27450
				}
27451
			}, this);
27452
		}
27453
    },
27454
 
27455
 
27456
    setValue : function(v){
27457
    	if (typeof v == 'boolean') {
27458
            Ext.form.Radio.superclass.setValue.call(this, v);
27459
        } else {
27460
            var r = this.el.up('form').child('input[name='+this.el.dom.name+'][value='+v+']', true);
27461
            if (r){
27462
                r.checked = true;
27463
            };
27464
        }
27465
    }
27466
});
27467
Ext.reg('radio', Ext.form.Radio);
27468
 
27469
Ext.form.Hidden = Ext.extend(Ext.form.Field, {
27470
 
27471
    inputType : 'hidden',
27472
 
27473
 
27474
    onRender : function(){
27475
        Ext.form.Hidden.superclass.onRender.apply(this, arguments);
27476
    },
27477
 
27478
 
27479
    initEvents : function(){
27480
        this.originalValue = this.getValue();
27481
    },
27482
 
27483
 
27484
    setSize : Ext.emptyFn,
27485
    setWidth : Ext.emptyFn,
27486
    setHeight : Ext.emptyFn,
27487
    setPosition : Ext.emptyFn,
27488
    setPagePosition : Ext.emptyFn,
27489
    markInvalid : Ext.emptyFn,
27490
    clearInvalid : Ext.emptyFn
27491
});
27492
Ext.reg('hidden', Ext.form.Hidden);
27493
 
27494
Ext.form.BasicForm = function(el, config){
27495
    Ext.apply(this, config);
27496
 
27497
    this.items = new Ext.util.MixedCollection(false, function(o){
27498
        return o.id || (o.id = Ext.id());
27499
    });
27500
    this.addEvents(
27501
 
27502
        'beforeaction',
27503
 
27504
        'actionfailed',
27505
 
27506
        'actioncomplete'
27507
    );
27508
 
27509
    if(el){
27510
        this.initEl(el);
27511
    }
27512
    Ext.form.BasicForm.superclass.constructor.call(this);
27513
};
27514
 
27515
Ext.extend(Ext.form.BasicForm, Ext.util.Observable, {
27516
 
27517
 
27518
 
27519
 
27520
 
27521
 
27522
 
27523
    timeout: 30,
27524
 
27525
        activeAction : null,
27526
 
27527
 
27528
    trackResetOnLoad : false,
27529
 
27530
 
27531
 
27532
 
27533
        initEl : function(el){
27534
        this.el = Ext.get(el);
27535
        this.id = this.el.id || Ext.id();
27536
        if(!this.standardSubmit){
27537
            this.el.on('submit', this.onSubmit, this);
27538
        }
27539
        this.el.addClass('x-form');
27540
    },
27541
 
27542
 
27543
    getEl: function(){
27544
        return this.el;
27545
    },
27546
 
27547
        onSubmit : function(e){
27548
        e.stopEvent();
27549
    },
27550
 
27551
    	destroy: function() {
27552
        this.items.each(function(f){
27553
            Ext.destroy(f);
27554
        });
27555
        if(this.el){
27556
			this.el.removeAllListeners();
27557
			this.el.remove();
27558
        }
27559
		this.purgeListeners();
27560
	},
27561
 
27562
 
27563
    isValid : function(){
27564
        var valid = true;
27565
        this.items.each(function(f){
27566
           if(!f.validate()){
27567
               valid = false;
27568
           }
27569
        });
27570
        return valid;
27571
    },
27572
 
27573
 
27574
    isDirty : function(){
27575
        var dirty = false;
27576
        this.items.each(function(f){
27577
           if(f.isDirty()){
27578
               dirty = true;
27579
               return false;
27580
           }
27581
        });
27582
        return dirty;
27583
    },
27584
 
27585
 
27586
    doAction : function(action, options){
27587
        if(typeof action == 'string'){
27588
            action = new Ext.form.Action.ACTION_TYPES[action](this, options);
27589
        }
27590
        if(this.fireEvent('beforeaction', this, action) !== false){
27591
            this.beforeAction(action);
27592
            action.run.defer(100, action);
27593
        }
27594
        return this;
27595
    },
27596
 
27597
 
27598
    submit : function(options){
27599
        if(this.standardSubmit){
27600
            var v = this.isValid();
27601
            if(v){
27602
                this.el.dom.submit();
27603
            }
27604
            return v;
27605
        }
27606
        this.doAction('submit', options);
27607
        return this;
27608
    },
27609
 
27610
 
27611
    load : function(options){
27612
        this.doAction('load', options);
27613
        return this;
27614
    },
27615
 
27616
 
27617
    updateRecord : function(record){
27618
        record.beginEdit();
27619
        var fs = record.fields;
27620
        fs.each(function(f){
27621
            var field = this.findField(f.name);
27622
            if(field){
27623
                record.set(f.name, field.getValue());
27624
            }
27625
        }, this);
27626
        record.endEdit();
27627
        return this;
27628
    },
27629
 
27630
 
27631
    loadRecord : function(record){
27632
        this.setValues(record.data);
27633
        return this;
27634
    },
27635
 
27636
        beforeAction : function(action){
27637
        var o = action.options;
27638
        if(o.waitMsg){
27639
            if(this.waitMsgTarget === true){
27640
                this.el.mask(o.waitMsg, 'x-mask-loading');
27641
            }else if(this.waitMsgTarget){
27642
                this.waitMsgTarget = Ext.get(this.waitMsgTarget);
27643
                this.waitMsgTarget.mask(o.waitMsg, 'x-mask-loading');
27644
            }else{
27645
                Ext.MessageBox.wait(o.waitMsg, o.waitTitle || this.waitTitle || 'Please Wait...');
27646
            }
27647
        }
27648
    },
27649
 
27650
        afterAction : function(action, success){
27651
        this.activeAction = null;
27652
        var o = action.options;
27653
        if(o.waitMsg){
27654
            if(this.waitMsgTarget === true){
27655
                this.el.unmask();
27656
            }else if(this.waitMsgTarget){
27657
                this.waitMsgTarget.unmask();
27658
            }else{
27659
                Ext.MessageBox.updateProgress(1);
27660
                Ext.MessageBox.hide();
27661
            }
27662
        }
27663
        if(success){
27664
            if(o.reset){
27665
                this.reset();
27666
            }
27667
            Ext.callback(o.success, o.scope, [this, action]);
27668
            this.fireEvent('actioncomplete', this, action);
27669
        }else{
27670
            Ext.callback(o.failure, o.scope, [this, action]);
27671
            this.fireEvent('actionfailed', this, action);
27672
        }
27673
    },
27674
 
27675
 
27676
    findField : function(id){
27677
        var field = this.items.get(id);
27678
        if(!field){
27679
            this.items.each(function(f){
27680
                if(f.isFormField && (f.dataIndex == id || f.id == id || f.getName() == id)){
27681
                    field = f;
27682
                    return false;
27683
                }
27684
            });
27685
        }
27686
        return field || null;
27687
    },
27688
 
27689
 
27690
 
27691
    markInvalid : function(errors){
27692
        if(Ext.isArray(errors)){
27693
            for(var i = 0, len = errors.length; i < len; i++){
27694
                var fieldError = errors[i];
27695
                var f = this.findField(fieldError.id);
27696
                if(f){
27697
                    f.markInvalid(fieldError.msg);
27698
                }
27699
            }
27700
        }else{
27701
            var field, id;
27702
            for(id in errors){
27703
                if(typeof errors[id] != 'function' && (field = this.findField(id))){
27704
                    field.markInvalid(errors[id]);
27705
                }
27706
            }
27707
        }
27708
        return this;
27709
    },
27710
 
27711
 
27712
    setValues : function(values){
27713
        if(Ext.isArray(values)){             for(var i = 0, len = values.length; i < len; i++){
27714
                var v = values[i];
27715
                var f = this.findField(v.id);
27716
                if(f){
27717
                    f.setValue(v.value);
27718
                    if(this.trackResetOnLoad){
27719
                        f.originalValue = f.getValue();
27720
                    }
27721
                }
27722
            }
27723
        }else{             var field, id;
27724
            for(id in values){
27725
                if(typeof values[id] != 'function' && (field = this.findField(id))){
27726
                    field.setValue(values[id]);
27727
                    if(this.trackResetOnLoad){
27728
                        field.originalValue = field.getValue();
27729
                    }
27730
                }
27731
            }
27732
        }
27733
        return this;
27734
    },
27735
 
27736
 
27737
    getValues : function(asString){
27738
        var fs = Ext.lib.Ajax.serializeForm(this.el.dom);
27739
        if(asString === true){
27740
            return fs;
27741
        }
27742
        return Ext.urlDecode(fs);
27743
    },
27744
 
27745
 
27746
    clearInvalid : function(){
27747
        this.items.each(function(f){
27748
           f.clearInvalid();
27749
        });
27750
        return this;
27751
    },
27752
 
27753
 
27754
    reset : function(){
27755
        this.items.each(function(f){
27756
            f.reset();
27757
        });
27758
        return this;
27759
    },
27760
 
27761
 
27762
    add : function(){
27763
        this.items.addAll(Array.prototype.slice.call(arguments, 0));
27764
        return this;
27765
    },
27766
 
27767
 
27768
 
27769
    remove : function(field){
27770
        this.items.remove(field);
27771
        return this;
27772
    },
27773
 
27774
 
27775
    render : function(){
27776
        this.items.each(function(f){
27777
            if(f.isFormField && !f.rendered && document.getElementById(f.id)){                 f.applyToMarkup(f.id);
27778
            }
27779
        });
27780
        return this;
27781
    },
27782
 
27783
 
27784
    applyToFields : function(o){
27785
        this.items.each(function(f){
27786
           Ext.apply(f, o);
27787
        });
27788
        return this;
27789
    },
27790
 
27791
 
27792
    applyIfToFields : function(o){
27793
        this.items.each(function(f){
27794
           Ext.applyIf(f, o);
27795
        });
27796
        return this;
27797
    }
27798
});
27799
 
27800
Ext.BasicForm = Ext.form.BasicForm;
27801
 
27802
Ext.FormPanel = Ext.extend(Ext.Panel, {
27803
 
27804
 
27805
 
27806
 
27807
    buttonAlign:'center',
27808
 
27809
 
27810
    minButtonWidth:75,
27811
 
27812
 
27813
    labelAlign:'left',
27814
 
27815
 
27816
    monitorValid : false,
27817
 
27818
 
27819
    monitorPoll : 200,
27820
 
27821
 
27822
    layout: 'form',
27823
 
27824
        initComponent :function(){
27825
        this.form = this.createForm();
27826
 
27827
        Ext.FormPanel.superclass.initComponent.call(this);
27828
 
27829
        this.addEvents(
27830
 
27831
            'clientvalidation'
27832
        );
27833
 
27834
        this.relayEvents(this.form, ['beforeaction', 'actionfailed', 'actioncomplete']);
27835
    },
27836
 
27837
        createForm: function(){
27838
        delete this.initialConfig.listeners;
27839
        return new Ext.form.BasicForm(null, this.initialConfig);
27840
    },
27841
 
27842
        initFields : function(){
27843
        var f = this.form;
27844
        var formPanel = this;
27845
        var fn = function(c){
27846
            if(c.doLayout && c != formPanel){
27847
                Ext.applyIf(c, {
27848
                    labelAlign: c.ownerCt.labelAlign,
27849
                    labelWidth: c.ownerCt.labelWidth,
27850
                    itemCls: c.ownerCt.itemCls
27851
                });
27852
                if(c.items){
27853
                    c.items.each(fn);
27854
                }
27855
            }else if(c.isFormField){
27856
                f.add(c);
27857
            }
27858
        }
27859
        this.items.each(fn);
27860
    },
27861
 
27862
        getLayoutTarget : function(){
27863
        return this.form.el;
27864
    },
27865
 
27866
 
27867
    getForm : function(){
27868
        return this.form;
27869
    },
27870
 
27871
        onRender : function(ct, position){
27872
        this.initFields();
27873
 
27874
        Ext.FormPanel.superclass.onRender.call(this, ct, position);
27875
        var o = {
27876
            tag: 'form',
27877
            method : this.method || 'POST',
27878
            id : this.formId || Ext.id()
27879
        };
27880
        if(this.fileUpload) {
27881
            o.enctype = 'multipart/form-data';
27882
        }
27883
        this.form.initEl(this.body.createChild(o));
27884
    },
27885
 
27886
        beforeDestroy: function(){
27887
        Ext.FormPanel.superclass.beforeDestroy.call(this);
27888
        Ext.destroy(this.form);
27889
    },
27890
 
27891
        initEvents : function(){
27892
        Ext.FormPanel.superclass.initEvents.call(this);
27893
		this.items.on('remove', this.onRemove, this);
27894
		this.items.on('add', this.onAdd, this);
27895
        if(this.monitorValid){             this.startMonitoring();
27896
        }
27897
    },
27898
 
27899
    	onAdd : function(ct, c) {
27900
		if (c.isFormField) {
27901
			this.form.add(c);
27902
		}
27903
	},
27904
 
27905
		onRemove : function(c) {
27906
		if (c.isFormField) {
27907
			Ext.destroy(c.container.up('.x-form-item'));
27908
			this.form.remove(c);
27909
		}
27910
	},
27911
 
27912
 
27913
    startMonitoring : function(){
27914
        if(!this.bound){
27915
            this.bound = true;
27916
            Ext.TaskMgr.start({
27917
                run : this.bindHandler,
27918
                interval : this.monitorPoll || 200,
27919
                scope: this
27920
            });
27921
        }
27922
    },
27923
 
27924
 
27925
    stopMonitoring : function(){
27926
        this.bound = false;
27927
    },
27928
 
27929
 
27930
    load : function(){
27931
        this.form.load.apply(this.form, arguments);
27932
    },
27933
 
27934
        onDisable : function(){
27935
        Ext.FormPanel.superclass.onDisable.call(this);
27936
        if(this.form){
27937
            this.form.items.each(function(){
27938
                 this.disable();
27939
            });
27940
        }
27941
    },
27942
 
27943
        onEnable : function(){
27944
        Ext.FormPanel.superclass.onEnable.call(this);
27945
        if(this.form){
27946
            this.form.items.each(function(){
27947
                 this.enable();
27948
            });
27949
        }
27950
    },
27951
 
27952
        bindHandler : function(){
27953
        if(!this.bound){
27954
            return false;         }
27955
        var valid = true;
27956
        this.form.items.each(function(f){
27957
            if(!f.isValid(true)){
27958
                valid = false;
27959
                return false;
27960
            }
27961
        });
27962
        if(this.buttons){
27963
            for(var i = 0, len = this.buttons.length; i < len; i++){
27964
                var btn = this.buttons[i];
27965
                if(btn.formBind === true && btn.disabled === valid){
27966
                    btn.setDisabled(!valid);
27967
                }
27968
            }
27969
        }
27970
        this.fireEvent('clientvalidation', this, valid);
27971
    }
27972
});
27973
Ext.reg('form', Ext.FormPanel);
27974
 
27975
Ext.form.FormPanel = Ext.FormPanel;
27976
 
27977
 
27978
 
27979
Ext.form.FieldSet = Ext.extend(Ext.Panel, {
27980
 
27981
 
27982
 
27983
 
27984
 
27985
    baseCls:'x-fieldset',
27986
 
27987
    layout: 'form',
27988
 
27989
 
27990
    onRender : function(ct, position){
27991
        if(!this.el){
27992
            this.el = document.createElement('fieldset');
27993
            this.el.id = this.id;
27994
            if (this.title || this.header || this.checkboxToggle) {
27995
                this.el.appendChild(document.createElement('legend')).className = 'x-fieldset-header';
27996
            }
27997
        }
27998
 
27999
        Ext.form.FieldSet.superclass.onRender.call(this, ct, position);
28000
 
28001
        if(this.checkboxToggle){
28002
            var o = typeof this.checkboxToggle == 'object' ?
28003
                    this.checkboxToggle :
28004
                    {tag: 'input', type: 'checkbox', name: this.checkboxName || this.id+'-checkbox'};
28005
            this.checkbox = this.header.insertFirst(o);
28006
            this.checkbox.dom.checked = !this.collapsed;
28007
            this.checkbox.on('click', this.onCheckClick, this);
28008
        }
28009
    },
28010
 
28011
 
28012
    onCollapse : function(doAnim, animArg){
28013
        if(this.checkbox){
28014
            this.checkbox.dom.checked = false;
28015
        }
28016
        this.afterCollapse();
28017
 
28018
    },
28019
 
28020
 
28021
    onExpand : function(doAnim, animArg){
28022
        if(this.checkbox){
28023
            this.checkbox.dom.checked = true;
28024
        }
28025
        this.afterExpand();
28026
    },
28027
 
28028
 
28029
    onCheckClick : function(){
28030
        this[this.checkbox.dom.checked ? 'expand' : 'collapse']();
28031
    }
28032
 
28033
 
28034
 
28035
 
28036
 
28037
 
28038
 
28039
 
28040
 
28041
 
28042
 
28043
 
28044
 
28045
 
28046
 
28047
 
28048
 
28049
 
28050
 
28051
 
28052
 
28053
 
28054
 
28055
 
28056
 
28057
 
28058
 
28059
 
28060
 
28061
 
28062
 
28063
 
28064
 
28065
 
28066
 
28067
 
28068
 
28069
 
28070
});
28071
Ext.reg('fieldset', Ext.form.FieldSet);
28072
 
28073
 
28074
 
28075
 
28076
Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, {
28077
 
28078
    enableFormat : true,
28079
 
28080
    enableFontSize : true,
28081
 
28082
    enableColors : true,
28083
 
28084
    enableAlignments : true,
28085
 
28086
    enableLists : true,
28087
 
28088
    enableSourceEdit : true,
28089
 
28090
    enableLinks : true,
28091
 
28092
    enableFont : true,
28093
 
28094
    createLinkText : 'Please enter the URL for the link:',
28095
 
28096
    defaultLinkValue : 'http:/'+'/',
28097
 
28098
    fontFamilies : [
28099
        'Arial',
28100
        'Courier New',
28101
        'Tahoma',
28102
        'Times New Roman',
28103
        'Verdana'
28104
    ],
28105
    defaultFont: 'tahoma',
28106
 
28107
 
28108
    validationEvent : false,
28109
    deferHeight: true,
28110
    initialized : false,
28111
    activated : false,
28112
    sourceEditMode : false,
28113
    onFocus : Ext.emptyFn,
28114
    iframePad:3,
28115
    hideMode:'offsets',
28116
    defaultAutoCreate : {
28117
        tag: "textarea",
28118
        style:"width:500px;height:300px;",
28119
        autocomplete: "off"
28120
    },
28121
 
28122
 
28123
    initComponent : function(){
28124
        this.addEvents(
28125
 
28126
            'initialize',
28127
 
28128
            'activate',
28129
 
28130
            'beforesync',
28131
 
28132
            'beforepush',
28133
 
28134
            'sync',
28135
 
28136
            'push',
28137
 
28138
            'editmodechange'
28139
        )
28140
    },
28141
 
28142
    createFontOptions : function(){
28143
        var buf = [], fs = this.fontFamilies, ff, lc;
28144
        for(var i = 0, len = fs.length; i< len; i++){
28145
            ff = fs[i];
28146
            lc = ff.toLowerCase();
28147
            buf.push(
28148
                '<option value="',lc,'" style="font-family:',ff,';"',
28149
                    (this.defaultFont == lc ? ' selected="true">' : '>'),
28150
                    ff,
28151
                '</option>'
28152
            );
28153
        }
28154
        return buf.join('');
28155
    },
28156
 
28157
    createToolbar : function(editor){
28158
 
28159
        function btn(id, toggle, handler){
28160
            return {
28161
                itemId : id,
28162
                cls : 'x-btn-icon x-edit-'+id,
28163
                enableToggle:toggle !== false,
28164
                scope: editor,
28165
                handler:handler||editor.relayBtnCmd,
28166
                clickEvent:'mousedown',
28167
                tooltip: editor.buttonTips[id] || undefined,
28168
                tabIndex:-1
28169
            };
28170
        }
28171
 
28172
 
28173
        var tb = new Ext.Toolbar({
28174
            renderTo:this.wrap.dom.firstChild
28175
        });
28176
 
28177
 
28178
        tb.el.on('click', function(e){
28179
            e.preventDefault();
28180
        });
28181
 
28182
        if(this.enableFont && !Ext.isSafari){
28183
            this.fontSelect = tb.el.createChild({
28184
                tag:'select',
28185
                cls:'x-font-select',
28186
                html: this.createFontOptions()
28187
            });
28188
            this.fontSelect.on('change', function(){
28189
                var font = this.fontSelect.dom.value;
28190
                this.relayCmd('fontname', font);
28191
                this.deferFocus();
28192
            }, this);
28193
            tb.add(
28194
                this.fontSelect.dom,
28195
                '-'
28196
            );
28197
        };
28198
 
28199
        if(this.enableFormat){
28200
            tb.add(
28201
                btn('bold'),
28202
                btn('italic'),
28203
                btn('underline')
28204
            );
28205
        };
28206
 
28207
        if(this.enableFontSize){
28208
            tb.add(
28209
                '-',
28210
                btn('increasefontsize', false, this.adjustFont),
28211
                btn('decreasefontsize', false, this.adjustFont)
28212
            );
28213
        };
28214
 
28215
        if(this.enableColors){
28216
            tb.add(
28217
                '-', {
28218
                    itemId:'forecolor',
28219
                    cls:'x-btn-icon x-edit-forecolor',
28220
                    clickEvent:'mousedown',
28221
                    tooltip: editor.buttonTips['forecolor'] || undefined,
28222
                    tabIndex:-1,
28223
                    menu : new Ext.menu.ColorMenu({
28224
                        allowReselect: true,
28225
                        focus: Ext.emptyFn,
28226
                        value:'000000',
28227
                        plain:true,
28228
                        selectHandler: function(cp, color){
28229
                            this.execCmd('forecolor', Ext.isSafari || Ext.isIE ? '#'+color : color);
28230
                            this.deferFocus();
28231
                        },
28232
                        scope: this,
28233
                        clickEvent:'mousedown'
28234
                    })
28235
                }, {
28236
                    itemId:'backcolor',
28237
                    cls:'x-btn-icon x-edit-backcolor',
28238
                    clickEvent:'mousedown',
28239
                    tooltip: editor.buttonTips['backcolor'] || undefined,
28240
                    tabIndex:-1,
28241
                    menu : new Ext.menu.ColorMenu({
28242
                        focus: Ext.emptyFn,
28243
                        value:'FFFFFF',
28244
                        plain:true,
28245
                        allowReselect: true,
28246
                        selectHandler: function(cp, color){
28247
                            if(Ext.isGecko){
28248
                                this.execCmd('useCSS', false);
28249
                                this.execCmd('hilitecolor', color);
28250
                                this.execCmd('useCSS', true);
28251
                                this.deferFocus();
28252
                            }else{
28253
                                this.execCmd(Ext.isOpera ? 'hilitecolor' : 'backcolor', Ext.isSafari || Ext.isIE ? '#'+color : color);
28254
                                this.deferFocus();
28255
                            }
28256
                        },
28257
                        scope:this,
28258
                        clickEvent:'mousedown'
28259
                    })
28260
                }
28261
            );
28262
        };
28263
 
28264
        if(this.enableAlignments){
28265
            tb.add(
28266
                '-',
28267
                btn('justifyleft'),
28268
                btn('justifycenter'),
28269
                btn('justifyright')
28270
            );
28271
        };
28272
 
28273
        if(!Ext.isSafari){
28274
            if(this.enableLinks){
28275
                tb.add(
28276
                    '-',
28277
                    btn('createlink', false, this.createLink)
28278
                );
28279
            };
28280
 
28281
            if(this.enableLists){
28282
                tb.add(
28283
                    '-',
28284
                    btn('insertorderedlist'),
28285
                    btn('insertunorderedlist')
28286
                );
28287
            }
28288
            if(this.enableSourceEdit){
28289
                tb.add(
28290
                    '-',
28291
                    btn('sourceedit', true, function(btn){
28292
                        this.toggleSourceEdit(btn.pressed);
28293
                    })
28294
                );
28295
            }
28296
        }
28297
 
28298
        this.tb = tb;
28299
    },
28300
 
28301
 
28302
    getDocMarkup : function(){
28303
        return '<html><head><style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style></head><body></body></html>';
28304
    },
28305
 
28306
    getEditorBody : function(){
28307
        return this.doc.body || this.doc.documentElement;
28308
    },
28309
 
28310
 
28311
    onRender : function(ct, position){
28312
        Ext.form.HtmlEditor.superclass.onRender.call(this, ct, position);
28313
        this.el.dom.style.border = '0 none';
28314
        this.el.dom.setAttribute('tabIndex', -1);
28315
        this.el.addClass('x-hidden');
28316
        if(Ext.isIE){
28317
            this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;')
28318
        }
28319
        this.wrap = this.el.wrap({
28320
            cls:'x-html-editor-wrap', cn:{cls:'x-html-editor-tb'}
28321
        });
28322
 
28323
        this.createToolbar(this);
28324
 
28325
        this.tb.items.each(function(item){
28326
           if(item.itemId != 'sourceedit'){
28327
                item.disable();
28328
            }
28329
        });
28330
 
28331
        var iframe = document.createElement('iframe');
28332
        iframe.name = Ext.id();
28333
        iframe.frameBorder = 'no';
28334
 
28335
        iframe.src=(Ext.SSL_SECURE_URL || "javascript:false");
28336
 
28337
        this.wrap.dom.appendChild(iframe);
28338
 
28339
        this.iframe = iframe;
28340
 
28341
        if(Ext.isIE){
28342
            iframe.contentWindow.document.designMode = 'on';
28343
            this.doc = iframe.contentWindow.document;
28344
            this.win = iframe.contentWindow;
28345
        } else {
28346
            this.doc = (iframe.contentDocument || window.frames[iframe.name].document);
28347
            this.win = window.frames[iframe.name];
28348
            this.doc.designMode = 'on';
28349
        }
28350
        this.doc.open();
28351
        this.doc.write(this.getDocMarkup())
28352
        this.doc.close();
28353
 
28354
        var task = {
28355
            run : function(){
28356
                if(this.doc.body || this.doc.readyState == 'complete'){
28357
                    Ext.TaskMgr.stop(task);
28358
                    this.doc.designMode="on";
28359
                    this.initEditor.defer(10, this);
28360
                }
28361
            },
28362
            interval : 10,
28363
            duration:10000,
28364
            scope: this
28365
        };
28366
        Ext.TaskMgr.start(task);
28367
 
28368
        if(!this.width){
28369
            this.setSize(this.el.getSize());
28370
        }
28371
    },
28372
 
28373
 
28374
    onResize : function(w, h){
28375
        Ext.form.HtmlEditor.superclass.onResize.apply(this, arguments);
28376
        if(this.el && this.iframe){
28377
            if(typeof w == 'number'){
28378
                var aw = w - this.wrap.getFrameWidth('lr');
28379
                this.el.setWidth(this.adjustWidth('textarea', aw));
28380
                this.iframe.style.width = aw + 'px';
28381
            }
28382
            if(typeof h == 'number'){
28383
                var ah = h - this.wrap.getFrameWidth('tb') - this.tb.el.getHeight();
28384
                this.el.setHeight(this.adjustWidth('textarea', ah));
28385
                this.iframe.style.height = ah + 'px';
28386
                if(this.doc){
28387
                    this.getEditorBody().style.height = (ah - (this.iframePad*2)) + 'px';
28388
                }
28389
            }
28390
        }
28391
    },
28392
 
28393
 
28394
    toggleSourceEdit : function(sourceEditMode){
28395
        if(sourceEditMode === undefined){
28396
            sourceEditMode = !this.sourceEditMode;
28397
        }
28398
        this.sourceEditMode = sourceEditMode === true;
28399
        var btn = this.tb.items.get('sourceedit');
28400
        if(btn.pressed !== this.sourceEditMode){
28401
            btn.toggle(this.sourceEditMode);
28402
            return;
28403
        }
28404
        if(this.sourceEditMode){
28405
            this.tb.items.each(function(item){
28406
                if(item.itemId != 'sourceedit'){
28407
                    item.disable();
28408
                }
28409
            });
28410
            this.syncValue();
28411
            this.iframe.className = 'x-hidden';
28412
            this.el.removeClass('x-hidden');
28413
            this.el.dom.removeAttribute('tabIndex');
28414
            this.el.focus();
28415
        }else{
28416
            if(this.initialized){
28417
                this.tb.items.each(function(item){
28418
                    item.enable();
28419
                });
28420
            }
28421
            this.pushValue();
28422
            this.iframe.className = '';
28423
            this.el.addClass('x-hidden');
28424
            this.el.dom.setAttribute('tabIndex', -1);
28425
            this.deferFocus();
28426
        }
28427
        var lastSize = this.lastSize;
28428
        if(lastSize){
28429
            delete this.lastSize;
28430
            this.setSize(lastSize);
28431
        }
28432
        this.fireEvent('editmodechange', this, this.sourceEditMode);
28433
    },
28434
 
28435
 
28436
    createLink : function(){
28437
        var url = prompt(this.createLinkText, this.defaultLinkValue);
28438
        if(url && url != 'http:/'+'/'){
28439
            this.relayCmd('createlink', url);
28440
        }
28441
    },
28442
 
28443
 
28444
    adjustSize : Ext.BoxComponent.prototype.adjustSize,
28445
 
28446
 
28447
    getResizeEl : function(){
28448
        return this.wrap;
28449
    },
28450
 
28451
 
28452
    getPositionEl : function(){
28453
        return this.wrap;
28454
    },
28455
 
28456
 
28457
    initEvents : function(){
28458
        this.originalValue = this.getValue();
28459
    },
28460
 
28461
 
28462
    markInvalid : Ext.emptyFn,
28463
 
28464
    clearInvalid : Ext.emptyFn,
28465
 
28466
    setValue : function(v){
28467
        Ext.form.HtmlEditor.superclass.setValue.call(this, v);
28468
        this.pushValue();
28469
    },
28470
 
28471
 
28472
    cleanHtml : function(html){
28473
        html = String(html);
28474
        if(html.length > 5){
28475
            if(Ext.isSafari){
28476
                html = html.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi, '');
28477
            }
28478
        }
28479
        if(html == '&nbsp;'){
28480
            html = '';
28481
        }
28482
        return html;
28483
    },
28484
 
28485
 
28486
    syncValue : function(){
28487
        if(this.initialized){
28488
            var bd = this.getEditorBody();
28489
            var html = bd.innerHTML;
28490
            if(Ext.isSafari){
28491
                var bs = bd.getAttribute('style');
28492
                var m = bs.match(/text-align:(.*?);/i);
28493
                if(m && m[1]){
28494
                    html = '<div style="'+m[0]+'">' + html + '</div>';
28495
                }
28496
            }
28497
            html = this.cleanHtml(html);
28498
            if(this.fireEvent('beforesync', this, html) !== false){
28499
                this.el.dom.value = html;
28500
                this.fireEvent('sync', this, html);
28501
            }
28502
        }
28503
    },
28504
 
28505
 
28506
    pushValue : function(){
28507
        if(this.initialized){
28508
            var v = this.el.dom.value;
28509
            if(!this.activated && v.length < 1){
28510
                v = '&nbsp;';
28511
            }
28512
            if(this.fireEvent('beforepush', this, v) !== false){
28513
                this.getEditorBody().innerHTML = v;
28514
                this.fireEvent('push', this, v);
28515
            }
28516
        }
28517
    },
28518
 
28519
 
28520
    deferFocus : function(){
28521
        this.focus.defer(10, this);
28522
    },
28523
 
28524
 
28525
    focus : function(){
28526
        if(this.win && !this.sourceEditMode){
28527
            this.win.focus();
28528
        }else{
28529
            this.el.focus();
28530
        }
28531
    },
28532
 
28533
 
28534
    initEditor : function(){
28535
        var dbody = this.getEditorBody();
28536
        var ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat');
28537
        ss['background-attachment'] = 'fixed';
28538
        dbody.bgProperties = 'fixed';
28539
        Ext.DomHelper.applyStyles(dbody, ss);
28540
        Ext.EventManager.on(this.doc, {
28541
            'mousedown': this.onEditorEvent,
28542
            'dblclick': this.onEditorEvent,
28543
            'click': this.onEditorEvent,
28544
            'keyup': this.onEditorEvent,
28545
            buffer:100,
28546
            scope: this
28547
        });
28548
        if(Ext.isGecko){
28549
            Ext.EventManager.on(this.doc, 'keypress', this.applyCommand, this);
28550
        }
28551
        if(Ext.isIE || Ext.isSafari || Ext.isOpera){
28552
            Ext.EventManager.on(this.doc, 'keydown', this.fixKeys, this);
28553
        }
28554
        this.initialized = true;
28555
 
28556
        this.fireEvent('initialize', this);
28557
        this.pushValue();
28558
    },
28559
 
28560
 
28561
    onDestroy : function(){
28562
        if(this.rendered){
28563
            this.tb.items.each(function(item){
28564
                if(item.menu){
28565
                    item.menu.removeAll();
28566
                    if(item.menu.el){
28567
                        item.menu.el.destroy();
28568
                    }
28569
                }
28570
                item.destroy();
28571
            });
28572
            this.wrap.dom.innerHTML = '';
28573
            this.wrap.remove();
28574
        }
28575
    },
28576
 
28577
 
28578
    onFirstFocus : function(){
28579
        this.activated = true;
28580
        this.tb.items.each(function(item){
28581
           item.enable();
28582
        });
28583
        if(Ext.isGecko){
28584
            this.win.focus();
28585
            var s = this.win.getSelection();
28586
            if(!s.focusNode || s.focusNode.nodeType != 3){
28587
                var r = s.getRangeAt(0);
28588
                r.selectNodeContents(this.getEditorBody());
28589
                r.collapse(true);
28590
                this.deferFocus();
28591
            }
28592
            try{
28593
                this.execCmd('useCSS', true);
28594
                this.execCmd('styleWithCSS', false);
28595
            }catch(e){}
28596
        }
28597
        this.fireEvent('activate', this);
28598
    },
28599
 
28600
 
28601
    adjustFont: function(btn){
28602
        var adjust = btn.itemId == 'increasefontsize' ? 1 : -1;
28603
 
28604
        var v = parseInt(this.doc.queryCommandValue('FontSize') || 2, 10);
28605
        if(Ext.isSafari3 || Ext.isAir){
28606
 
28607
 
28608
            if(v <= 10){
28609
                v = 1 + adjust;
28610
            }else if(v <= 13){
28611
                v = 2 + adjust;
28612
            }else if(v <= 16){
28613
                v = 3 + adjust;
28614
            }else if(v <= 18){
28615
                v = 4 + adjust;
28616
            }else if(v <= 24){
28617
                v = 5 + adjust;
28618
            }else {
28619
                v = 6 + adjust;
28620
            }
28621
            v = v.constrain(1, 6);
28622
        }else{
28623
            if(Ext.isSafari){
28624
                adjust *= 2;
28625
            }
28626
            v = Math.max(1, v+adjust) + (Ext.isSafari ? 'px' : 0);
28627
        }
28628
        this.execCmd('FontSize', v);
28629
    },
28630
 
28631
    onEditorEvent : function(e){
28632
        this.updateToolbar();
28633
    },
28634
 
28635
 
28636
 
28637
    updateToolbar: function(){
28638
 
28639
        if(!this.activated){
28640
            this.onFirstFocus();
28641
            return;
28642
        }
28643
 
28644
        var btns = this.tb.items.map, doc = this.doc;
28645
 
28646
        if(this.enableFont && !Ext.isSafari){
28647
            var name = (this.doc.queryCommandValue('FontName')||this.defaultFont).toLowerCase();
28648
            if(name != this.fontSelect.dom.value){
28649
                this.fontSelect.dom.value = name;
28650
            }
28651
        }
28652
        if(this.enableFormat){
28653
            btns.bold.toggle(doc.queryCommandState('bold'));
28654
            btns.italic.toggle(doc.queryCommandState('italic'));
28655
            btns.underline.toggle(doc.queryCommandState('underline'));
28656
        }
28657
        if(this.enableAlignments){
28658
            btns.justifyleft.toggle(doc.queryCommandState('justifyleft'));
28659
            btns.justifycenter.toggle(doc.queryCommandState('justifycenter'));
28660
            btns.justifyright.toggle(doc.queryCommandState('justifyright'));
28661
        }
28662
        if(!Ext.isSafari && this.enableLists){
28663
            btns.insertorderedlist.toggle(doc.queryCommandState('insertorderedlist'));
28664
            btns.insertunorderedlist.toggle(doc.queryCommandState('insertunorderedlist'));
28665
        }
28666
 
28667
        Ext.menu.MenuMgr.hideAll();
28668
 
28669
        this.syncValue();
28670
    },
28671
 
28672
 
28673
    relayBtnCmd : function(btn){
28674
        this.relayCmd(btn.itemId);
28675
    },
28676
 
28677
 
28678
    relayCmd : function(cmd, value){
28679
        this.win.focus();
28680
        this.execCmd(cmd, value);
28681
        this.updateToolbar();
28682
        this.deferFocus();
28683
    },
28684
 
28685
 
28686
    execCmd : function(cmd, value){
28687
        this.doc.execCommand(cmd, false, value === undefined ? null : value);
28688
        this.syncValue();
28689
    },
28690
 
28691
 
28692
    applyCommand : function(e){
28693
        if(e.ctrlKey){
28694
            var c = e.getCharCode(), cmd;
28695
            if(c > 0){
28696
                c = String.fromCharCode(c);
28697
                switch(c){
28698
                    case 'b':
28699
                        cmd = 'bold';
28700
                    break;
28701
                    case 'i':
28702
                        cmd = 'italic';
28703
                    break;
28704
                    case 'u':
28705
                        cmd = 'underline';
28706
                    break;
28707
                }
28708
                if(cmd){
28709
                    this.win.focus();
28710
                    this.execCmd(cmd);
28711
                    this.deferFocus();
28712
                    e.preventDefault();
28713
                }
28714
            }
28715
        }
28716
    },
28717
 
28718
 
28719
    insertAtCursor : function(text){
28720
        if(!this.activated){
28721
            return;
28722
        }
28723
        if(Ext.isIE){
28724
            this.win.focus();
28725
            var r = this.doc.selection.createRange();
28726
            if(r){
28727
                r.collapse(true);
28728
                r.pasteHTML(text);
28729
                this.syncValue();
28730
                this.deferFocus();
28731
            }
28732
        }else if(Ext.isGecko || Ext.isOpera){
28733
            this.win.focus();
28734
            this.execCmd('InsertHTML', text);
28735
            this.deferFocus();
28736
        }else if(Ext.isSafari){
28737
            this.execCmd('InsertText', text);
28738
            this.deferFocus();
28739
        }
28740
    },
28741
 
28742
 
28743
    fixKeys : function(){
28744
        if(Ext.isIE){
28745
            return function(e){
28746
                var k = e.getKey(), r;
28747
                if(k == e.TAB){
28748
                    e.stopEvent();
28749
                    r = this.doc.selection.createRange();
28750
                    if(r){
28751
                        r.collapse(true);
28752
                        r.pasteHTML('&nbsp;&nbsp;&nbsp;&nbsp;');
28753
                        this.deferFocus();
28754
                    }
28755
                }else if(k == e.ENTER){
28756
                    r = this.doc.selection.createRange();
28757
                    if(r){
28758
                        var target = r.parentElement();
28759
                        if(!target || target.tagName.toLowerCase() != 'li'){
28760
                            e.stopEvent();
28761
                            r.pasteHTML('<br />');
28762
                            r.collapse(false);
28763
                            r.select();
28764
                        }
28765
                    }
28766
                }
28767
            };
28768
        }else if(Ext.isOpera){
28769
            return function(e){
28770
                var k = e.getKey();
28771
                if(k == e.TAB){
28772
                    e.stopEvent();
28773
                    this.win.focus();
28774
                    this.execCmd('InsertHTML','&nbsp;&nbsp;&nbsp;&nbsp;');
28775
                    this.deferFocus();
28776
                }
28777
            };
28778
        }else if(Ext.isSafari){
28779
            return function(e){
28780
                var k = e.getKey();
28781
                if(k == e.TAB){
28782
                    e.stopEvent();
28783
                    this.execCmd('InsertText','\t');
28784
                    this.deferFocus();
28785
                }
28786
             };
28787
        }
28788
    }(),
28789
 
28790
 
28791
    getToolbar : function(){
28792
        return this.tb;
28793
    },
28794
 
28795
 
28796
    buttonTips : {
28797
        bold : {
28798
            title: 'Bold (Ctrl+B)',
28799
            text: 'Make the selected text bold.',
28800
            cls: 'x-html-editor-tip'
28801
        },
28802
        italic : {
28803
            title: 'Italic (Ctrl+I)',
28804
            text: 'Make the selected text italic.',
28805
            cls: 'x-html-editor-tip'
28806
        },
28807
        underline : {
28808
            title: 'Underline (Ctrl+U)',
28809
            text: 'Underline the selected text.',
28810
            cls: 'x-html-editor-tip'
28811
        },
28812
        increasefontsize : {
28813
            title: 'Grow Text',
28814
            text: 'Increase the font size.',
28815
            cls: 'x-html-editor-tip'
28816
        },
28817
        decreasefontsize : {
28818
            title: 'Shrink Text',
28819
            text: 'Decrease the font size.',
28820
            cls: 'x-html-editor-tip'
28821
        },
28822
        backcolor : {
28823
            title: 'Text Highlight Color',
28824
            text: 'Change the background color of the selected text.',
28825
            cls: 'x-html-editor-tip'
28826
        },
28827
        forecolor : {
28828
            title: 'Font Color',
28829
            text: 'Change the color of the selected text.',
28830
            cls: 'x-html-editor-tip'
28831
        },
28832
        justifyleft : {
28833
            title: 'Align Text Left',
28834
            text: 'Align text to the left.',
28835
            cls: 'x-html-editor-tip'
28836
        },
28837
        justifycenter : {
28838
            title: 'Center Text',
28839
            text: 'Center text in the editor.',
28840
            cls: 'x-html-editor-tip'
28841
        },
28842
        justifyright : {
28843
            title: 'Align Text Right',
28844
            text: 'Align text to the right.',
28845
            cls: 'x-html-editor-tip'
28846
        },
28847
        insertunorderedlist : {
28848
            title: 'Bullet List',
28849
            text: 'Start a bulleted list.',
28850
            cls: 'x-html-editor-tip'
28851
        },
28852
        insertorderedlist : {
28853
            title: 'Numbered List',
28854
            text: 'Start a numbered list.',
28855
            cls: 'x-html-editor-tip'
28856
        },
28857
        createlink : {
28858
            title: 'Hyperlink',
28859
            text: 'Make the selected text a hyperlink.',
28860
            cls: 'x-html-editor-tip'
28861
        },
28862
        sourceedit : {
28863
            title: 'Source Edit',
28864
            text: 'Switch to source editing mode.',
28865
            cls: 'x-html-editor-tip'
28866
        }
28867
    }
28868
 
28869
 
28870
 
28871
 
28872
 
28873
 
28874
 
28875
 
28876
 
28877
 
28878
 
28879
 
28880
 
28881
 
28882
 
28883
 
28884
 
28885
 
28886
 
28887
 
28888
 
28889
 
28890
 
28891
 
28892
 
28893
 
28894
 
28895
 
28896
 
28897
 
28898
 
28899
 
28900
 
28901
 
28902
});
28903
Ext.reg('htmleditor', Ext.form.HtmlEditor);
28904
 
28905
Ext.form.TimeField = Ext.extend(Ext.form.ComboBox, {
28906
 
28907
    minValue : null,
28908
 
28909
    maxValue : null,
28910
 
28911
    minText : "The time in this field must be equal to or after {0}",
28912
 
28913
    maxText : "The time in this field must be equal to or before {0}",
28914
 
28915
    invalidText : "{0} is not a valid time",
28916
 
28917
    format : "g:i A",
28918
 
28919
    altFormats : "g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H",
28920
 
28921
    increment: 15,
28922
 
28923
 
28924
    mode: 'local',
28925
 
28926
    triggerAction: 'all',
28927
 
28928
    typeAhead: false,
28929
 
28930
 
28931
    initComponent : function(){
28932
        Ext.form.TimeField.superclass.initComponent.call(this);
28933
 
28934
        if(typeof this.minValue == "string"){
28935
            this.minValue = this.parseDate(this.minValue);
28936
        }
28937
        if(typeof this.maxValue == "string"){
28938
            this.maxValue = this.parseDate(this.maxValue);
28939
        }
28940
 
28941
        if(!this.store){
28942
            var min = this.parseDate(this.minValue);
28943
            if(!min){
28944
                min = new Date().clearTime();
28945
            }
28946
            var max = this.parseDate(this.maxValue);
28947
            if(!max){
28948
                max = new Date().clearTime().add('mi', (24 * 60) - 1);
28949
            }
28950
            var times = [];
28951
            while(min <= max){
28952
                times.push([min.dateFormat(this.format)]);
28953
                min = min.add('mi', this.increment);
28954
            }
28955
            this.store = new Ext.data.SimpleStore({
28956
                fields: ['text'],
28957
                data : times
28958
            });
28959
            this.displayField = 'text';
28960
        }
28961
    },
28962
 
28963
 
28964
    getValue : function(){
28965
        var v = Ext.form.TimeField.superclass.getValue.call(this);
28966
        return this.formatDate(this.parseDate(v)) || '';
28967
    },
28968
 
28969
 
28970
    setValue : function(value){
28971
        Ext.form.TimeField.superclass.setValue.call(this, this.formatDate(this.parseDate(value)));
28972
    },
28973
 
28974
 
28975
    validateValue : Ext.form.DateField.prototype.validateValue,
28976
    parseDate : Ext.form.DateField.prototype.parseDate,
28977
    formatDate : Ext.form.DateField.prototype.formatDate,
28978
 
28979
 
28980
    beforeBlur : function(){
28981
        var v = this.parseDate(this.getRawValue());
28982
        if(v){
28983
            this.setValue(v.dateFormat(this.format));
28984
        }
28985
    }
28986
 
28987
 
28988
 
28989
 
28990
 
28991
});
28992
Ext.reg('timefield', Ext.form.TimeField);
28993
Ext.form.Label = Ext.extend(Ext.BoxComponent, {
28994
    onRender : function(ct, position){
28995
        if(!this.el){
28996
            this.el = document.createElement('label');
28997
            this.el.innerHTML = this.text ? Ext.util.Format.htmlEncode(this.text) : (this.html || '');
28998
            if(this.forId){
28999
                this.el.setAttribute('htmlFor', this.forId);
29000
            }
29001
        }
29002
        Ext.form.Label.superclass.onRender.call(this, ct, position);
29003
    }
29004
});
29005
 
29006
Ext.reg('label', Ext.form.Label);
29007
 
29008
Ext.form.Action = function(form, options){
29009
    this.form = form;
29010
    this.options = options || {};
29011
};
29012
 
29013
 
29014
Ext.form.Action.CLIENT_INVALID = 'client';
29015
 
29016
Ext.form.Action.SERVER_INVALID = 'server';
29017
 
29018
Ext.form.Action.CONNECT_FAILURE = 'connect';
29019
 
29020
Ext.form.Action.LOAD_FAILURE = 'load';
29021
 
29022
Ext.form.Action.prototype = {
29023
 
29024
 
29025
 
29026
 
29027
 
29028
 
29029
 
29030
 
29031
 
29032
 
29033
    type : 'default',
29034
 
29035
 
29036
        run : function(options){
29037
 
29038
    },
29039
 
29040
        success : function(response){
29041
 
29042
    },
29043
 
29044
        handleResponse : function(response){
29045
 
29046
    },
29047
 
29048
        failure : function(response){
29049
        this.response = response;
29050
        this.failureType = Ext.form.Action.CONNECT_FAILURE;
29051
        this.form.afterAction(this, false);
29052
    },
29053
 
29054
        processResponse : function(response){
29055
        this.response = response;
29056
        if(!response.responseText){
29057
            return true;
29058
        }
29059
        this.result = this.handleResponse(response);
29060
        return this.result;
29061
    },
29062
 
29063
        getUrl : function(appendParams){
29064
        var url = this.options.url || this.form.url || this.form.el.dom.action;
29065
        if(appendParams){
29066
            var p = this.getParams();
29067
            if(p){
29068
                url += (url.indexOf('?') != -1 ? '&' : '?') + p;
29069
            }
29070
        }
29071
        return url;
29072
    },
29073
 
29074
        getMethod : function(){
29075
        return (this.options.method || this.form.method || this.form.el.dom.method || 'POST').toUpperCase();
29076
    },
29077
 
29078
        getParams : function(){
29079
        var bp = this.form.baseParams;
29080
        var p = this.options.params;
29081
        if(p){
29082
            if(typeof p == "object"){
29083
                p = Ext.urlEncode(Ext.applyIf(p, bp));
29084
            }else if(typeof p == 'string' && bp){
29085
                p += '&' + Ext.urlEncode(bp);
29086
            }
29087
        }else if(bp){
29088
            p = Ext.urlEncode(bp);
29089
        }
29090
        return p;
29091
    },
29092
 
29093
        createCallback : function(opts){
29094
		var opts = opts || {};
29095
        return {
29096
            success: this.success,
29097
            failure: this.failure,
29098
            scope: this,
29099
            timeout: (opts.timeout*1000) || (this.form.timeout*1000),
29100
            upload: this.form.fileUpload ? this.success : undefined
29101
        };
29102
    }
29103
};
29104
 
29105
 
29106
Ext.form.Action.Submit = function(form, options){
29107
    Ext.form.Action.Submit.superclass.constructor.call(this, form, options);
29108
};
29109
 
29110
Ext.extend(Ext.form.Action.Submit, Ext.form.Action, {
29111
 
29112
    type : 'submit',
29113
 
29114
        run : function(){
29115
        var o = this.options;
29116
        var method = this.getMethod();
29117
        var isPost = method == 'POST';
29118
        if(o.clientValidation === false || this.form.isValid()){
29119
            Ext.Ajax.request(Ext.apply(this.createCallback(o), {
29120
                form:this.form.el.dom,
29121
                url:this.getUrl(!isPost),
29122
                method: method,
29123
                params:isPost ? this.getParams() : null,
29124
                isUpload: this.form.fileUpload
29125
            }));
29126
 
29127
        }else if (o.clientValidation !== false){             this.failureType = Ext.form.Action.CLIENT_INVALID;
29128
            this.form.afterAction(this, false);
29129
        }
29130
    },
29131
 
29132
        success : function(response){
29133
        var result = this.processResponse(response);
29134
        if(result === true || result.success){
29135
            this.form.afterAction(this, true);
29136
            return;
29137
        }
29138
        if(result.errors){
29139
            this.form.markInvalid(result.errors);
29140
            this.failureType = Ext.form.Action.SERVER_INVALID;
29141
        }
29142
        this.form.afterAction(this, false);
29143
    },
29144
 
29145
        handleResponse : function(response){
29146
        if(this.form.errorReader){
29147
            var rs = this.form.errorReader.read(response);
29148
            var errors = [];
29149
            if(rs.records){
29150
                for(var i = 0, len = rs.records.length; i < len; i++) {
29151
                    var r = rs.records[i];
29152
                    errors[i] = r.data;
29153
                }
29154
            }
29155
            if(errors.length < 1){
29156
                errors = null;
29157
            }
29158
            return {
29159
                success : rs.success,
29160
                errors : errors
29161
            };
29162
        }
29163
        return Ext.decode(response.responseText);
29164
    }
29165
});
29166
 
29167
 
29168
 
29169
Ext.form.Action.Load = function(form, options){
29170
    Ext.form.Action.Load.superclass.constructor.call(this, form, options);
29171
    this.reader = this.form.reader;
29172
};
29173
 
29174
Ext.extend(Ext.form.Action.Load, Ext.form.Action, {
29175
        type : 'load',
29176
 
29177
        run : function(){
29178
        Ext.Ajax.request(Ext.apply(
29179
                this.createCallback(this.options), {
29180
                    method:this.getMethod(),
29181
                    url:this.getUrl(false),
29182
                    params:this.getParams()
29183
        }));
29184
    },
29185
 
29186
        success : function(response){
29187
        var result = this.processResponse(response);
29188
        if(result === true || !result.success || !result.data){
29189
            this.failureType = Ext.form.Action.LOAD_FAILURE;
29190
            this.form.afterAction(this, false);
29191
            return;
29192
        }
29193
        this.form.clearInvalid();
29194
        this.form.setValues(result.data);
29195
        this.form.afterAction(this, true);
29196
    },
29197
 
29198
        handleResponse : function(response){
29199
        if(this.form.reader){
29200
            var rs = this.form.reader.read(response);
29201
            var data = rs.records && rs.records[0] ? rs.records[0].data : null;
29202
            return {
29203
                success : rs.success,
29204
                data : data
29205
            };
29206
        }
29207
        return Ext.decode(response.responseText);
29208
    }
29209
});
29210
 
29211
Ext.form.Action.ACTION_TYPES = {
29212
    'load' : Ext.form.Action.Load,
29213
    'submit' : Ext.form.Action.Submit
29214
};
29215
 
29216
 
29217
Ext.form.VTypes = function(){
29218
        var alpha = /^[a-zA-Z_]+$/;
29219
    var alphanum = /^[a-zA-Z0-9_]+$/;
29220
    var email = /^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/;
29221
    var url = /(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
29222
 
29223
        return {
29224
 
29225
        'email' : function(v){
29226
            return email.test(v);
29227
        },
29228
 
29229
        'emailText' : 'This field should be an e-mail address in the format "user@domain.com"',
29230
 
29231
        'emailMask' : /[a-z0-9_\.\-@]/i,
29232
 
29233
 
29234
        'url' : function(v){
29235
            return url.test(v);
29236
        },
29237
 
29238
        'urlText' : 'This field should be a URL in the format "http:/'+'/www.domain.com"',
29239
 
29240
 
29241
        'alpha' : function(v){
29242
            return alpha.test(v);
29243
        },
29244
 
29245
        'alphaText' : 'This field should only contain letters and _',
29246
 
29247
        'alphaMask' : /[a-z_]/i,
29248
 
29249
 
29250
        'alphanum' : function(v){
29251
            return alphanum.test(v);
29252
        },
29253
 
29254
        'alphanumText' : 'This field should only contain letters, numbers and _',
29255
 
29256
        'alphanumMask' : /[a-z0-9_]/i
29257
    };
29258
}();
29259
 
29260
Ext.grid.GridPanel = Ext.extend(Ext.Panel, {
29261
 
29262
 
29263
 
29264
 
29265
 
29266
 
29267
 
29268
 
29269
 
29270
 
29271
 
29272
 
29273
 
29274
 
29275
    ddText : "{0} selected row{1}",
29276
 
29277
    minColumnWidth : 25,
29278
 
29279
    trackMouseOver : true,
29280
 
29281
    enableDragDrop : false,
29282
 
29283
    enableColumnMove : true,
29284
 
29285
    enableColumnHide : true,
29286
 
29287
    enableHdMenu : true,
29288
 
29289
    stripeRows : false,
29290
 
29291
    autoExpandColumn : false,
29292
 
29293
    autoExpandMin : 50,
29294
 
29295
    autoExpandMax : 1000,
29296
 
29297
    view : null,
29298
 
29299
    loadMask : false,
29300
 
29301
 
29302
    rendered : false,
29303
 
29304
    viewReady: false,
29305
 
29306
    stateEvents: ["columnmove", "columnresize", "sortchange"],
29307
 
29308
 
29309
    initComponent : function(){
29310
        Ext.grid.GridPanel.superclass.initComponent.call(this);
29311
 
29312
 
29313
 
29314
        this.autoScroll = false;
29315
        this.autoWidth = false;
29316
 
29317
        if(Ext.isArray(this.columns)){
29318
            this.colModel = new Ext.grid.ColumnModel(this.columns);
29319
            delete this.columns;
29320
        }
29321
 
29322
 
29323
        if(this.ds){
29324
            this.store = this.ds;
29325
            delete this.ds;
29326
        }
29327
        if(this.cm){
29328
            this.colModel = this.cm;
29329
            delete this.cm;
29330
        }
29331
        if(this.sm){
29332
            this.selModel = this.sm;
29333
            delete this.sm;
29334
        }
29335
        this.store = Ext.StoreMgr.lookup(this.store);
29336
 
29337
        this.addEvents(
29338
 
29339
 
29340
            "click",
29341
 
29342
            "dblclick",
29343
 
29344
            "contextmenu",
29345
 
29346
            "mousedown",
29347
 
29348
            "mouseup",
29349
 
29350
            "mouseover",
29351
 
29352
            "mouseout",
29353
 
29354
            "keypress",
29355
 
29356
            "keydown",
29357
 
29358
 
29359
 
29360
            "cellmousedown",
29361
 
29362
            "rowmousedown",
29363
 
29364
            "headermousedown",
29365
 
29366
 
29367
            "cellclick",
29368
 
29369
            "celldblclick",
29370
 
29371
            "rowclick",
29372
 
29373
            "rowdblclick",
29374
 
29375
            "headerclick",
29376
 
29377
            "headerdblclick",
29378
 
29379
            "rowcontextmenu",
29380
 
29381
            "cellcontextmenu",
29382
 
29383
            "headercontextmenu",
29384
 
29385
            "bodyscroll",
29386
 
29387
            "columnresize",
29388
 
29389
            "columnmove",
29390
 
29391
            "sortchange"
29392
        );
29393
    },
29394
 
29395
 
29396
    onRender : function(ct, position){
29397
        Ext.grid.GridPanel.superclass.onRender.apply(this, arguments);
29398
 
29399
        var c = this.body;
29400
 
29401
        this.el.addClass('x-grid-panel');
29402
 
29403
        var view = this.getView();
29404
        view.init(this);
29405
 
29406
        c.on("mousedown", this.onMouseDown, this);
29407
        c.on("click", this.onClick, this);
29408
        c.on("dblclick", this.onDblClick, this);
29409
        c.on("contextmenu", this.onContextMenu, this);
29410
        c.on("keydown", this.onKeyDown, this);
29411
 
29412
        this.relayEvents(c, ["mousedown","mouseup","mouseover","mouseout","keypress"]);
29413
 
29414
        this.getSelectionModel().init(this);
29415
        this.view.render();
29416
    },
29417
 
29418
 
29419
    initEvents : function(){
29420
        Ext.grid.GridPanel.superclass.initEvents.call(this);
29421
 
29422
        if(this.loadMask){
29423
            this.loadMask = new Ext.LoadMask(this.bwrap,
29424
                    Ext.apply({store:this.store}, this.loadMask));
29425
        }
29426
    },
29427
 
29428
    initStateEvents : function(){
29429
        Ext.grid.GridPanel.superclass.initStateEvents.call(this);
29430
        this.colModel.on('hiddenchange', this.saveState, this, {delay: 100});
29431
    },
29432
 
29433
    applyState : function(state){
29434
        var cm = this.colModel;
29435
        var cs = state.columns;
29436
        if(cs){
29437
            for(var i = 0, len = cs.length; i < len; i++){
29438
                var s = cs[i];
29439
                var c = cm.getColumnById(s.id);
29440
                if(c){
29441
                    c.hidden = s.hidden;
29442
                    c.width = s.width;
29443
                    var oldIndex = cm.getIndexById(s.id);
29444
                    if(oldIndex != i){
29445
                        cm.moveColumn(oldIndex, i);
29446
                    }
29447
                }
29448
            }
29449
        }
29450
        if(state.sort){
29451
            this.store[this.store.remoteSort ? 'setDefaultSort' : 'sort'](state.sort.field, state.sort.direction);
29452
        }
29453
    },
29454
 
29455
    getState : function(){
29456
        var o = {columns: []};
29457
        for(var i = 0, c; c = this.colModel.config[i]; i++){
29458
            o.columns[i] = {
29459
                id: c.id,
29460
                width: c.width
29461
            };
29462
            if(c.hidden){
29463
                o.columns[i].hidden = true;
29464
            }
29465
        }
29466
        var ss = this.store.getSortState();
29467
        if(ss){
29468
            o.sort = ss;
29469
        }
29470
        return o;
29471
    },
29472
 
29473
 
29474
    afterRender : function(){
29475
        Ext.grid.GridPanel.superclass.afterRender.call(this);
29476
        this.view.layout();
29477
        this.viewReady = true;
29478
    },
29479
 
29480
 
29481
    reconfigure : function(store, colModel){
29482
        if(this.loadMask){
29483
            this.loadMask.destroy();
29484
            this.loadMask = new Ext.LoadMask(this.bwrap,
29485
                    Ext.apply({store:store}, this.initialConfig.loadMask));
29486
        }
29487
        this.view.bind(store, colModel);
29488
        this.store = store;
29489
        this.colModel = colModel;
29490
        if(this.rendered){
29491
            this.view.refresh(true);
29492
        }
29493
    },
29494
 
29495
 
29496
    onKeyDown : function(e){
29497
        this.fireEvent("keydown", e);
29498
    },
29499
 
29500
 
29501
    onDestroy : function(){
29502
        if(this.rendered){
29503
            if(this.loadMask){
29504
                this.loadMask.destroy();
29505
            }
29506
            var c = this.body;
29507
            c.removeAllListeners();
29508
            this.view.destroy();
29509
            c.update("");
29510
        }
29511
        this.colModel.purgeListeners();
29512
        Ext.grid.GridPanel.superclass.onDestroy.call(this);
29513
    },
29514
 
29515
 
29516
    processEvent : function(name, e){
29517
        this.fireEvent(name, e);
29518
        var t = e.getTarget();
29519
        var v = this.view;
29520
        var header = v.findHeaderIndex(t);
29521
        if(header !== false){
29522
            this.fireEvent("header" + name, this, header, e);
29523
        }else{
29524
            var row = v.findRowIndex(t);
29525
            var cell = v.findCellIndex(t);
29526
            if(row !== false){
29527
                this.fireEvent("row" + name, this, row, e);
29528
                if(cell !== false){
29529
                    this.fireEvent("cell" + name, this, row, cell, e);
29530
                }
29531
            }
29532
        }
29533
    },
29534
 
29535
 
29536
    onClick : function(e){
29537
        this.processEvent("click", e);
29538
    },
29539
 
29540
 
29541
    onMouseDown : function(e){
29542
        this.processEvent("mousedown", e);
29543
    },
29544
 
29545
 
29546
    onContextMenu : function(e, t){
29547
        this.processEvent("contextmenu", e);
29548
    },
29549
 
29550
 
29551
    onDblClick : function(e){
29552
        this.processEvent("dblclick", e);
29553
    },
29554
 
29555
 
29556
    walkCells : function(row, col, step, fn, scope){
29557
        var cm = this.colModel, clen = cm.getColumnCount();
29558
        var ds = this.store, rlen = ds.getCount(), first = true;
29559
        if(step < 0){
29560
            if(col < 0){
29561
                row--;
29562
                first = false;
29563
            }
29564
            while(row >= 0){
29565
                if(!first){
29566
                    col = clen-1;
29567
                }
29568
                first = false;
29569
                while(col >= 0){
29570
                    if(fn.call(scope || this, row, col, cm) === true){
29571
                        return [row, col];
29572
                    }
29573
                    col--;
29574
                }
29575
                row--;
29576
            }
29577
        } else {
29578
            if(col >= clen){
29579
                row++;
29580
                first = false;
29581
            }
29582
            while(row < rlen){
29583
                if(!first){
29584
                    col = 0;
29585
                }
29586
                first = false;
29587
                while(col < clen){
29588
                    if(fn.call(scope || this, row, col, cm) === true){
29589
                        return [row, col];
29590
                    }
29591
                    col++;
29592
                }
29593
                row++;
29594
            }
29595
        }
29596
        return null;
29597
    },
29598
 
29599
 
29600
    getSelections : function(){
29601
        return this.selModel.getSelections();
29602
    },
29603
 
29604
 
29605
    onResize : function(){
29606
        Ext.grid.GridPanel.superclass.onResize.apply(this, arguments);
29607
        if(this.viewReady){
29608
            this.view.layout();
29609
        }
29610
    },
29611
 
29612
 
29613
    getGridEl : function(){
29614
        return this.body;
29615
    },
29616
 
29617
 
29618
    stopEditing : function(){},
29619
 
29620
 
29621
    getSelectionModel : function(){
29622
        if(!this.selModel){
29623
            this.selModel = new Ext.grid.RowSelectionModel(
29624
                    this.disableSelection ? {selectRow: Ext.emptyFn} : null);
29625
        }
29626
        return this.selModel;
29627
    },
29628
 
29629
 
29630
    getStore : function(){
29631
        return this.store;
29632
    },
29633
 
29634
 
29635
    getColumnModel : function(){
29636
        return this.colModel;
29637
    },
29638
 
29639
 
29640
    getView : function(){
29641
        if(!this.view){
29642
            this.view = new Ext.grid.GridView(this.viewConfig);
29643
        }
29644
        return this.view;
29645
    },
29646
 
29647
    getDragDropText : function(){
29648
        var count = this.selModel.getCount();
29649
        return String.format(this.ddText, count, count == 1 ? '' : 's');
29650
    }
29651
 
29652
 
29653
 
29654
 
29655
 
29656
 
29657
 
29658
 
29659
 
29660
 
29661
 
29662
 
29663
 
29664
 
29665
 
29666
 
29667
 
29668
 
29669
 
29670
 
29671
 
29672
 
29673
 
29674
 
29675
 
29676
 
29677
 
29678
 
29679
 
29680
 
29681
 
29682
 
29683
 
29684
 
29685
 
29686
 
29687
 
29688
 
29689
 
29690
 
29691
 
29692
 
29693
 
29694
 
29695
 
29696
 
29697
 
29698
 
29699
 
29700
 
29701
});
29702
Ext.reg('grid', Ext.grid.GridPanel);
29703
 
29704
Ext.grid.GridView = function(config){
29705
    Ext.apply(this, config);
29706
        this.addEvents(
29707
 
29708
      "beforerowremoved",
29709
 
29710
      "beforerowsinserted",
29711
 
29712
      "beforerefresh",
29713
 
29714
      "rowremoved",
29715
 
29716
      "rowsinserted",
29717
 
29718
      "rowupdated",
29719
 
29720
      "refresh"
29721
  );
29722
    Ext.grid.GridView.superclass.constructor.call(this);
29723
};
29724
 
29725
Ext.extend(Ext.grid.GridView, Ext.util.Observable, {
29726
 
29727
 
29728
 
29729
 
29730
    scrollOffset: 19,
29731
 
29732
    autoFill: false,
29733
 
29734
    forceFit: false,
29735
 
29736
    sortClasses : ["sort-asc", "sort-desc"],
29737
 
29738
    sortAscText : "Sort Ascending",
29739
 
29740
    sortDescText : "Sort Descending",
29741
 
29742
    columnsText : "Columns",
29743
 
29744
        borderWidth: 2,
29745
 
29746
 
29747
 
29748
        initTemplates : function(){
29749
        var ts = this.templates || {};
29750
        if(!ts.master){
29751
            ts.master = new Ext.Template(
29752
                    '<div class="x-grid3" hidefocus="true">',
29753
                        '<div class="x-grid3-viewport">',
29754
                            '<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset">{header}</div></div><div class="x-clear"></div></div>',
29755
                            '<div class="x-grid3-scroller"><div class="x-grid3-body">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',
29756
                        "</div>",
29757
                        '<div class="x-grid3-resize-marker">&#160;</div>',
29758
                        '<div class="x-grid3-resize-proxy">&#160;</div>',
29759
                    "</div>"
29760
                    );
29761
        }
29762
 
29763
        if(!ts.header){
29764
            ts.header = new Ext.Template(
29765
                    '<table border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
29766
                    '<thead><tr class="x-grid3-hd-row">{cells}</tr></thead>',
29767
                    "</table>"
29768
                    );
29769
        }
29770
 
29771
        if(!ts.hcell){
29772
            ts.hcell = new Ext.Template(
29773
                    '<td class="x-grid3-hd x-grid3-cell x-grid3-td-{id}" style="{style}"><div {tooltip} {attr} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">', this.grid.enableHdMenu ? '<a class="x-grid3-hd-btn" href="#"></a>' : '',
29774
                    '{value}<img class="x-grid3-sort-icon" src="', Ext.BLANK_IMAGE_URL, '" />',
29775
                    "</div></td>"
29776
                    );
29777
        }
29778
 
29779
        if(!ts.body){
29780
            ts.body = new Ext.Template('{rows}');
29781
        }
29782
 
29783
        if(!ts.row){
29784
            ts.row = new Ext.Template(
29785
                    '<div class="x-grid3-row {alt}" style="{tstyle}"><table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
29786
                    '<tbody><tr>{cells}</tr>',
29787
                    (this.enableRowBody ? '<tr class="x-grid3-row-body-tr" style="{bodyStyle}"><td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on"><div class="x-grid3-row-body">{body}</div></td></tr>' : ''),
29788
                    '</tbody></table></div>'
29789
                    );
29790
        }
29791
 
29792
        if(!ts.cell){
29793
            ts.cell = new Ext.Template(
29794
                    '<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}" tabIndex="0" {cellAttr}>',
29795
                    '<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on" {attr}>{value}</div>',
29796
                    "</td>"
29797
                    );
29798
        }
29799
 
29800
        for(var k in ts){
29801
            var t = ts[k];
29802
            if(t && typeof t.compile == 'function' && !t.compiled){
29803
                t.disableFormats = true;
29804
                t.compile();
29805
            }
29806
        }
29807
 
29808
        this.templates = ts;
29809
 
29810
        this.tdClass = 'x-grid3-cell';
29811
        this.cellSelector = 'td.x-grid3-cell';
29812
        this.hdCls = 'x-grid3-hd';
29813
        this.rowSelector = 'div.x-grid3-row';
29814
        this.colRe = new RegExp("x-grid3-td-([^\\s]+)", "");
29815
    },
29816
 
29817
        fly : function(el){
29818
        if(!this._flyweight){
29819
            this._flyweight = new Ext.Element.Flyweight(document.body);
29820
        }
29821
        this._flyweight.dom = el;
29822
        return this._flyweight;
29823
    },
29824
 
29825
        getEditorParent : function(ed){
29826
        return this.scroller.dom;
29827
    },
29828
 
29829
        initElements : function(){
29830
        var E = Ext.Element;
29831
 
29832
        var el = this.grid.getGridEl().dom.firstChild;
29833
        var cs = el.childNodes;
29834
 
29835
        this.el = new E(el);
29836
 
29837
        this.mainWrap = new E(cs[0]);
29838
        this.mainHd = new E(this.mainWrap.dom.firstChild);
29839
 
29840
        if(this.grid.hideHeaders){
29841
            this.mainHd.setDisplayed(false);
29842
        }
29843
 
29844
        this.innerHd = this.mainHd.dom.firstChild;
29845
        this.scroller = new E(this.mainWrap.dom.childNodes[1]);
29846
        if(this.forceFit){
29847
            this.scroller.setStyle('overflow-x', 'hidden');
29848
        }
29849
        this.mainBody = new E(this.scroller.dom.firstChild);
29850
 
29851
        this.focusEl = new E(this.scroller.dom.childNodes[1]);
29852
        this.focusEl.swallowEvent("click", true);
29853
 
29854
        this.resizeMarker = new E(cs[1]);
29855
        this.resizeProxy = new E(cs[2]);
29856
    },
29857
 
29858
        getRows : function(){
29859
        return this.hasRows() ? this.mainBody.dom.childNodes : [];
29860
    },
29861
 
29862
 
29863
        findCell : function(el){
29864
        if(!el){
29865
            return false;
29866
        }
29867
        return this.fly(el).findParent(this.cellSelector, 3);
29868
    },
29869
 
29870
        findCellIndex : function(el, requiredCls){
29871
        var cell = this.findCell(el);
29872
        if(cell && (!requiredCls || this.fly(cell).hasClass(requiredCls))){
29873
            return this.getCellIndex(cell);
29874
        }
29875
        return false;
29876
    },
29877
 
29878
        getCellIndex : function(el){
29879
        if(el){
29880
            var m = el.className.match(this.colRe);
29881
            if(m && m[1]){
29882
                return this.cm.getIndexById(m[1]);
29883
            }
29884
        }
29885
        return false;
29886
    },
29887
 
29888
        findHeaderCell : function(el){
29889
        var cell = this.findCell(el);
29890
        return cell && this.fly(cell).hasClass(this.hdCls) ? cell : null;
29891
    },
29892
 
29893
        findHeaderIndex : function(el){
29894
        return this.findCellIndex(el, this.hdCls);
29895
    },
29896
 
29897
        findRow : function(el){
29898
        if(!el){
29899
            return false;
29900
        }
29901
        return this.fly(el).findParent(this.rowSelector, 10);
29902
    },
29903
 
29904
        findRowIndex : function(el){
29905
        var r = this.findRow(el);
29906
        return r ? r.rowIndex : false;
29907
    },
29908
 
29909
 
29910
 
29911
    getRow : function(row){
29912
        return this.getRows()[row];
29913
    },
29914
 
29915
 
29916
    getCell : function(row, col){
29917
        return this.getRow(row).getElementsByTagName('td')[col];
29918
    },
29919
 
29920
 
29921
    getHeaderCell : function(index){
29922
      return this.mainHd.dom.getElementsByTagName('td')[index];
29923
    },
29924
 
29925
 
29926
        addRowClass : function(row, cls){
29927
        var r = this.getRow(row);
29928
        if(r){
29929
            this.fly(r).addClass(cls);
29930
        }
29931
    },
29932
 
29933
        removeRowClass : function(row, cls){
29934
        var r = this.getRow(row);
29935
        if(r){
29936
            this.fly(r).removeClass(cls);
29937
        }
29938
    },
29939
 
29940
        removeRow : function(row){
29941
        Ext.removeNode(this.getRow(row));
29942
    },
29943
 
29944
        removeRows : function(firstRow, lastRow){
29945
        var bd = this.mainBody.dom;
29946
        for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){
29947
            Ext.removeNode(bd.childNodes[firstRow]);
29948
        }
29949
    },
29950
 
29951
 
29952
        getScrollState : function(){
29953
        var sb = this.scroller.dom;
29954
        return {left: sb.scrollLeft, top: sb.scrollTop};
29955
    },
29956
 
29957
        restoreScroll : function(state){
29958
        var sb = this.scroller.dom;
29959
        sb.scrollLeft = state.left;
29960
        sb.scrollTop = state.top;
29961
    },
29962
 
29963
 
29964
    scrollToTop : function(){
29965
        this.scroller.dom.scrollTop = 0;
29966
        this.scroller.dom.scrollLeft = 0;
29967
    },
29968
 
29969
        syncScroll : function(){
29970
      this.syncHeaderScroll();
29971
      var mb = this.scroller.dom;
29972
        this.grid.fireEvent("bodyscroll", mb.scrollLeft, mb.scrollTop);
29973
    },
29974
 
29975
        syncHeaderScroll : function(){
29976
        var mb = this.scroller.dom;
29977
        this.innerHd.scrollLeft = mb.scrollLeft;
29978
        this.innerHd.scrollLeft = mb.scrollLeft;     },
29979
 
29980
        updateSortIcon : function(col, dir){
29981
        var sc = this.sortClasses;
29982
        var hds = this.mainHd.select('td').removeClass(sc);
29983
        hds.item(col).addClass(sc[dir == "DESC" ? 1 : 0]);
29984
    },
29985
 
29986
        updateAllColumnWidths : function(){
29987
        var tw = this.getTotalWidth();
29988
        var clen = this.cm.getColumnCount();
29989
        var ws = [];
29990
        for(var i = 0; i < clen; i++){
29991
            ws[i] = this.getColumnWidth(i);
29992
        }
29993
 
29994
        this.innerHd.firstChild.firstChild.style.width = tw;
29995
 
29996
        for(var i = 0; i < clen; i++){
29997
            var hd = this.getHeaderCell(i);
29998
            hd.style.width = ws[i];
29999
        }
30000
 
30001
        var ns = this.getRows();
30002
        for(var i = 0, len = ns.length; i < len; i++){
30003
            ns[i].style.width = tw;
30004
            ns[i].firstChild.style.width = tw;
30005
            var row = ns[i].firstChild.rows[0];
30006
            for(var j = 0; j < clen; j++){
30007
                row.childNodes[j].style.width = ws[j];
30008
            }
30009
        }
30010
 
30011
        this.onAllColumnWidthsUpdated(ws, tw);
30012
    },
30013
 
30014
        updateColumnWidth : function(col, width){
30015
        var w = this.getColumnWidth(col);
30016
        var tw = this.getTotalWidth();
30017
 
30018
        this.innerHd.firstChild.firstChild.style.width = tw;
30019
        var hd = this.getHeaderCell(col);
30020
        hd.style.width = w;
30021
 
30022
        var ns = this.getRows();
30023
        for(var i = 0, len = ns.length; i < len; i++){
30024
            ns[i].style.width = tw;
30025
            ns[i].firstChild.style.width = tw;
30026
            ns[i].firstChild.rows[0].childNodes[col].style.width = w;
30027
        }
30028
 
30029
        this.onColumnWidthUpdated(col, w, tw);
30030
    },
30031
 
30032
        updateColumnHidden : function(col, hidden){
30033
        var tw = this.getTotalWidth();
30034
 
30035
        this.innerHd.firstChild.firstChild.style.width = tw;
30036
 
30037
        var display = hidden ? 'none' : '';
30038
 
30039
        var hd = this.getHeaderCell(col);
30040
        hd.style.display = display;
30041
 
30042
        var ns = this.getRows();
30043
        for(var i = 0, len = ns.length; i < len; i++){
30044
            ns[i].style.width = tw;
30045
            ns[i].firstChild.style.width = tw;
30046
            ns[i].firstChild.rows[0].childNodes[col].style.display = display;
30047
        }
30048
 
30049
        this.onColumnHiddenUpdated(col, hidden, tw);
30050
 
30051
        delete this.lastViewWidth;         this.layout();
30052
    },
30053
 
30054
        doRender : function(cs, rs, ds, startRow, colCount, stripe){
30055
        var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1;
30056
        var tstyle = 'width:'+this.getTotalWidth()+';';
30057
                var buf = [], cb, c, p = {}, rp = {tstyle: tstyle}, r;
30058
        for(var j = 0, len = rs.length; j < len; j++){
30059
            r = rs[j]; cb = [];
30060
            var rowIndex = (j+startRow);
30061
            for(var i = 0; i < colCount; i++){
30062
                c = cs[i];
30063
                p.id = c.id;
30064
                p.css = i == 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '');
30065
                p.attr = p.cellAttr = "";
30066
                p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds);
30067
                p.style = c.style;
30068
                if(p.value == undefined || p.value === "") p.value = "&#160;";
30069
                if(r.dirty && typeof r.modified[c.name] !== 'undefined'){
30070
                    p.css += ' x-grid3-dirty-cell';
30071
                }
30072
                cb[cb.length] = ct.apply(p);
30073
            }
30074
            var alt = [];
30075
            if(stripe && ((rowIndex+1) % 2 == 0)){
30076
                alt[0] = "x-grid3-row-alt";
30077
            }
30078
            if(r.dirty){
30079
                alt[1] = " x-grid3-dirty-row";
30080
            }
30081
            rp.cols = colCount;
30082
            if(this.getRowClass){
30083
                alt[2] = this.getRowClass(r, rowIndex, rp, ds);
30084
            }
30085
            rp.alt = alt.join(" ");
30086
            rp.cells = cb.join("");
30087
            buf[buf.length] =  rt.apply(rp);
30088
        }
30089
        return buf.join("");
30090
    },
30091
 
30092
        processRows : function(startRow, skipStripe){
30093
        if(this.ds.getCount() < 1){
30094
            return;
30095
        }
30096
        skipStripe = skipStripe || !this.grid.stripeRows;
30097
        startRow = startRow || 0;
30098
        var rows = this.getRows();
30099
        var cls = ' x-grid3-row-alt ';
30100
        for(var i = startRow, len = rows.length; i < len; i++){
30101
            var row = rows[i];
30102
            row.rowIndex = i;
30103
            if(!skipStripe){
30104
                var isAlt = ((i+1) % 2 == 0);
30105
                var hasAlt = (' '+row.className + ' ').indexOf(cls) != -1;
30106
                if(isAlt == hasAlt){
30107
                    continue;
30108
                }
30109
                if(isAlt){
30110
                    row.className += " x-grid3-row-alt";
30111
                }else{
30112
                    row.className = row.className.replace("x-grid3-row-alt", "");
30113
                }
30114
            }
30115
        }
30116
    },
30117
 
30118
        renderUI : function(){
30119
 
30120
        var header = this.renderHeaders();
30121
        var body = this.templates.body.apply({rows:''});
30122
 
30123
 
30124
        var html = this.templates.master.apply({
30125
            body: body,
30126
            header: header
30127
        });
30128
 
30129
        var g = this.grid;
30130
 
30131
        g.getGridEl().dom.innerHTML = html;
30132
 
30133
        this.initElements();
30134
 
30135
 
30136
        this.mainBody.dom.innerHTML = this.renderRows();
30137
        this.processRows(0, true);
30138
 
30139
 
30140
                Ext.fly(this.innerHd).on("click", this.handleHdDown, this);
30141
        this.mainHd.on("mouseover", this.handleHdOver, this);
30142
        this.mainHd.on("mouseout", this.handleHdOut, this);
30143
        this.mainHd.on("mousemove", this.handleHdMove, this);
30144
 
30145
        this.scroller.on('scroll', this.syncScroll,  this);
30146
        if(g.enableColumnResize !== false){
30147
            this.splitone = new Ext.grid.GridView.SplitDragZone(g, this.mainHd.dom);
30148
        }
30149
 
30150
        if(g.enableColumnMove){
30151
            this.columnDrag = new Ext.grid.GridView.ColumnDragZone(g, this.innerHd);
30152
            this.columnDrop = new Ext.grid.HeaderDropZone(g, this.mainHd.dom);
30153
        }
30154
 
30155
        if(g.enableHdMenu !== false){
30156
            if(g.enableColumnHide !== false){
30157
                this.colMenu = new Ext.menu.Menu({id:g.id + "-hcols-menu"});
30158
                this.colMenu.on("beforeshow", this.beforeColMenuShow, this);
30159
                this.colMenu.on("itemclick", this.handleHdMenuClick, this);
30160
            }
30161
            this.hmenu = new Ext.menu.Menu({id: g.id + "-hctx"});
30162
            this.hmenu.add(
30163
                {id:"asc", text: this.sortAscText, cls: "xg-hmenu-sort-asc"},
30164
                {id:"desc", text: this.sortDescText, cls: "xg-hmenu-sort-desc"}
30165
            );
30166
            if(g.enableColumnHide !== false){
30167
                this.hmenu.add('-',
30168
                    {id:"columns", text: this.columnsText, menu: this.colMenu, iconCls: 'x-cols-icon'}
30169
                );
30170
            }
30171
            this.hmenu.on("itemclick", this.handleHdMenuClick, this);
30172
 
30173
                    }
30174
 
30175
        if(g.enableDragDrop || g.enableDrag){
30176
            var dd = new Ext.grid.GridDragZone(g, {
30177
                ddGroup : g.ddGroup || 'GridDD'
30178
            });
30179
        }
30180
 
30181
        this.updateHeaderSortState();
30182
 
30183
    },
30184
 
30185
        layout : function(){
30186
        if(!this.mainBody){
30187
            return;         }
30188
        var g = this.grid;
30189
        var c = g.getGridEl(), cm = this.cm,
30190
                expandCol = g.autoExpandColumn,
30191
                gv = this;
30192
 
30193
        var csize = c.getSize(true);
30194
        var vw = csize.width;
30195
 
30196
        if(vw < 20 || csize.height < 20){             return;
30197
        }
30198
 
30199
        if(g.autoHeight){
30200
            this.scroller.dom.style.overflow = 'visible';
30201
        }else{
30202
            this.el.setSize(csize.width, csize.height);
30203
 
30204
            var hdHeight = this.mainHd.getHeight();
30205
            var vh = csize.height - (hdHeight);
30206
 
30207
            this.scroller.setSize(vw, vh);
30208
            if(this.innerHd){
30209
                this.innerHd.style.width = (vw)+'px';
30210
            }
30211
        }
30212
        if(this.forceFit){
30213
            if(this.lastViewWidth != vw){
30214
                this.fitColumns(false, false);
30215
                this.lastViewWidth = vw;
30216
            }
30217
        }else {
30218
            this.autoExpand();
30219
            this.syncHeaderScroll();
30220
        }
30221
        this.onLayout(vw, vh);
30222
    },
30223
 
30224
            onLayout : function(vw, vh){
30225
            },
30226
 
30227
    onColumnWidthUpdated : function(col, w, tw){
30228
            },
30229
 
30230
    onAllColumnWidthsUpdated : function(ws, tw){
30231
            },
30232
 
30233
    onColumnHiddenUpdated : function(col, hidden, tw){
30234
            },
30235
 
30236
    updateColumnText : function(col, text){
30237
            },
30238
 
30239
    afterMove : function(colIndex){
30240
            },
30241
 
30242
 
30243
        init: function(grid){
30244
        this.grid = grid;
30245
 
30246
        this.initTemplates();
30247
        this.initData(grid.store, grid.colModel);
30248
        this.initUI(grid);
30249
    },
30250
 
30251
        getColumnId : function(index){
30252
      return this.cm.getColumnId(index);
30253
    },
30254
 
30255
        renderHeaders : function(){
30256
        var cm = this.cm, ts = this.templates;
30257
        var ct = ts.hcell;
30258
 
30259
        var cb = [], sb = [], p = {};
30260
 
30261
        for(var i = 0, len = cm.getColumnCount(); i < len; i++){
30262
            p.id = cm.getColumnId(i);
30263
            p.value = cm.getColumnHeader(i) || "";
30264
            p.style = this.getColumnStyle(i, true);
30265
            p.tooltip = this.getColumnTooltip(i);
30266
            if(cm.config[i].align == 'right'){
30267
                p.istyle = 'padding-right:16px';
30268
            } else {
30269
                delete p.istyle;
30270
            }
30271
            cb[cb.length] = ct.apply(p);
30272
        }
30273
        return ts.header.apply({cells: cb.join(""), tstyle:'width:'+this.getTotalWidth()+';'});
30274
    },
30275
 
30276
        getColumnTooltip : function(i){
30277
        var tt = this.cm.getColumnTooltip(i);
30278
        if(tt){
30279
            if(Ext.QuickTips.isEnabled()){
30280
                return 'ext:qtip="'+tt+'"';
30281
            }else{
30282
                return 'title="'+tt+'"';
30283
            }
30284
        }
30285
        return "";
30286
    },
30287
 
30288
        beforeUpdate : function(){
30289
        this.grid.stopEditing(true);
30290
    },
30291
 
30292
        updateHeaders : function(){
30293
        this.innerHd.firstChild.innerHTML = this.renderHeaders();
30294
    },
30295
 
30296
 
30297
    focusRow : function(row){
30298
        this.focusCell(row, 0, false);
30299
    },
30300
 
30301
 
30302
    focusCell : function(row, col, hscroll){
30303
        var xy = this.ensureVisible(row, col, hscroll);
30304
        this.focusEl.setXY(xy);
30305
        if(Ext.isGecko){
30306
            this.focusEl.focus();
30307
        }else{
30308
            this.focusEl.focus.defer(1, this.focusEl);
30309
        }
30310
    },
30311
 
30312
        ensureVisible : function(row, col, hscroll){
30313
        if(typeof row != "number"){
30314
            row = row.rowIndex;
30315
        }
30316
        if(!this.ds){
30317
            return;
30318
        }
30319
        if(row < 0 || row >= this.ds.getCount()){
30320
            return;
30321
        }
30322
        col = (col !== undefined ? col : 0);
30323
 
30324
        var rowEl = this.getRow(row), cellEl;
30325
        if(!(hscroll === false && col === 0)){
30326
            while(this.cm.isHidden(col)){
30327
                col++;
30328
            }
30329
            cellEl = this.getCell(row, col);
30330
        }
30331
        if(!rowEl){
30332
            return;
30333
        }
30334
 
30335
        var c = this.scroller.dom;
30336
 
30337
        var ctop = 0;
30338
        var p = rowEl, stop = this.el.dom;
30339
        while(p && p != stop){
30340
            ctop += p.offsetTop;
30341
            p = p.offsetParent;
30342
        }
30343
        ctop -= this.mainHd.dom.offsetHeight;
30344
 
30345
        var cbot = ctop + rowEl.offsetHeight;
30346
 
30347
        var ch = c.clientHeight;
30348
        var stop = parseInt(c.scrollTop, 10);
30349
        var sbot = stop + ch;
30350
 
30351
        if(ctop < stop){
30352
          c.scrollTop = ctop;
30353
        }else if(cbot > sbot){
30354
            c.scrollTop = cbot-ch;
30355
        }
30356
 
30357
        if(hscroll !== false){
30358
            var cleft = parseInt(cellEl.offsetLeft, 10);
30359
            var cright = cleft + cellEl.offsetWidth;
30360
 
30361
            var sleft = parseInt(c.scrollLeft, 10);
30362
            var sright = sleft + c.clientWidth;
30363
            if(cleft < sleft){
30364
                c.scrollLeft = cleft;
30365
            }else if(cright > sright){
30366
                c.scrollLeft = cright-c.clientWidth;
30367
            }
30368
        }
30369
        return cellEl ? Ext.fly(cellEl).getXY() : [c.scrollLeft, Ext.fly(rowEl).getY()];
30370
    },
30371
 
30372
        insertRows : function(dm, firstRow, lastRow, isUpdate){
30373
        if(!isUpdate && firstRow === 0 && lastRow == dm.getCount()-1){
30374
            this.refresh();
30375
        }else{
30376
            if(!isUpdate){
30377
                this.fireEvent("beforerowsinserted", this, firstRow, lastRow);
30378
            }
30379
            var html = this.renderRows(firstRow, lastRow);
30380
            var before = this.getRow(firstRow);
30381
            if(before){
30382
                Ext.DomHelper.insertHtml('beforeBegin', before, html);
30383
            }else{
30384
                Ext.DomHelper.insertHtml('beforeEnd', this.mainBody.dom, html);
30385
            }
30386
            if(!isUpdate){
30387
                this.fireEvent("rowsinserted", this, firstRow, lastRow);
30388
                this.processRows(firstRow);
30389
            }
30390
        }
30391
    },
30392
 
30393
        deleteRows : function(dm, firstRow, lastRow){
30394
        if(dm.getRowCount()<1){
30395
            this.refresh();
30396
        }else{
30397
            this.fireEvent("beforerowsdeleted", this, firstRow, lastRow);
30398
 
30399
            this.removeRows(firstRow, lastRow);
30400
 
30401
            this.processRows(firstRow);
30402
            this.fireEvent("rowsdeleted", this, firstRow, lastRow);
30403
        }
30404
    },
30405
 
30406
        getColumnStyle : function(col, isHeader){
30407
        var style = !isHeader ? (this.cm.config[col].css || '') : '';
30408
        style += 'width:'+this.getColumnWidth(col)+';';
30409
        if(this.cm.isHidden(col)){
30410
            style += 'display:none;';
30411
        }
30412
        var align = this.cm.config[col].align;
30413
        if(align){
30414
            style += 'text-align:'+align+';';
30415
        }
30416
        return style;
30417
    },
30418
 
30419
        getColumnWidth : function(col){
30420
        var w = this.cm.getColumnWidth(col);
30421
        if(typeof w == 'number'){
30422
            return (Ext.isBorderBox ? w : (w-this.borderWidth > 0 ? w-this.borderWidth:0)) + 'px';
30423
        }
30424
        return w;
30425
    },
30426
 
30427
        getTotalWidth : function(){
30428
        return this.cm.getTotalWidth()+'px';
30429
    },
30430
 
30431
        fitColumns : function(preventRefresh, onlyExpand, omitColumn){
30432
        var cm = this.cm, leftOver, dist, i;
30433
        var tw = cm.getTotalWidth(false);
30434
        var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset;
30435
 
30436
        if(aw < 20){             return;
30437
        }
30438
        var extra = aw - tw;
30439
 
30440
        if(extra === 0){
30441
            return false;
30442
        }
30443
 
30444
        var vc = cm.getColumnCount(true);
30445
        var ac = vc-(typeof omitColumn == 'number' ? 1 : 0);
30446
        if(ac === 0){
30447
            ac = 1;
30448
            omitColumn = undefined;
30449
        }
30450
        var colCount = cm.getColumnCount();
30451
        var cols = [];
30452
        var extraCol = 0;
30453
        var width = 0;
30454
        var w;
30455
        for (i = 0; i < colCount; i++){
30456
            if(!cm.isHidden(i) && !cm.isFixed(i) && i !== omitColumn){
30457
                w = cm.getColumnWidth(i);
30458
                cols.push(i);
30459
                extraCol = i;
30460
                cols.push(w);
30461
                width += w;
30462
            }
30463
        }
30464
        var frac = (aw - cm.getTotalWidth())/width;
30465
        while (cols.length){
30466
            w = cols.pop();
30467
            i = cols.pop();
30468
            cm.setColumnWidth(i, Math.max(this.grid.minColumnWidth, Math.floor(w + w*frac)), true);
30469
        }
30470
 
30471
        if((tw = cm.getTotalWidth(false)) > aw){
30472
            var adjustCol = ac != vc ? omitColumn : extraCol;
30473
             cm.setColumnWidth(adjustCol, Math.max(1,
30474
                     cm.getColumnWidth(adjustCol)- (tw-aw)), true);
30475
        }
30476
 
30477
        if(preventRefresh !== true){
30478
            this.updateAllColumnWidths();
30479
        }
30480
 
30481
 
30482
        return true;
30483
    },
30484
 
30485
        autoExpand : function(preventUpdate){
30486
        var g = this.grid, cm = this.cm;
30487
        if(!this.userResized && g.autoExpandColumn){
30488
            var tw = cm.getTotalWidth(false);
30489
            var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset;
30490
            if(tw != aw){
30491
                var ci = cm.getIndexById(g.autoExpandColumn);
30492
                var currentWidth = cm.getColumnWidth(ci);
30493
                var cw = Math.min(Math.max(((aw-tw)+currentWidth), g.autoExpandMin), g.autoExpandMax);
30494
                if(cw != currentWidth){
30495
                    cm.setColumnWidth(ci, cw, true);
30496
                    if(preventUpdate !== true){
30497
                        this.updateColumnWidth(ci, cw);
30498
                    }
30499
                }
30500
            }
30501
        }
30502
    },
30503
 
30504
        getColumnData : function(){
30505
                var cs = [], cm = this.cm, colCount = cm.getColumnCount();
30506
        for(var i = 0; i < colCount; i++){
30507
            var name = cm.getDataIndex(i);
30508
            cs[i] = {
30509
                name : (typeof name == 'undefined' ? this.ds.fields.get(i).name : name),
30510
                renderer : cm.getRenderer(i),
30511
                id : cm.getColumnId(i),
30512
                style : this.getColumnStyle(i)
30513
            };
30514
        }
30515
        return cs;
30516
    },
30517
 
30518
        renderRows : function(startRow, endRow){
30519
                var g = this.grid, cm = g.colModel, ds = g.store, stripe = g.stripeRows;
30520
        var colCount = cm.getColumnCount();
30521
 
30522
        if(ds.getCount() < 1){
30523
            return "";
30524
        }
30525
 
30526
        var cs = this.getColumnData();
30527
 
30528
        startRow = startRow || 0;
30529
        endRow = typeof endRow == "undefined"? ds.getCount()-1 : endRow;
30530
 
30531
                var rs = ds.getRange(startRow, endRow);
30532
 
30533
        return this.doRender(cs, rs, ds, startRow, colCount, stripe);
30534
    },
30535
 
30536
        renderBody : function(){
30537
        var markup = this.renderRows();
30538
        return this.templates.body.apply({rows: markup});
30539
    },
30540
 
30541
        refreshRow : function(record){
30542
        var ds = this.ds, index;
30543
        if(typeof record == 'number'){
30544
            index = record;
30545
            record = ds.getAt(index);
30546
        }else{
30547
            index = ds.indexOf(record);
30548
        }
30549
        var cls = [];
30550
        this.insertRows(ds, index, index, true);
30551
        this.getRow(index).rowIndex = index;
30552
        this.onRemove(ds, record, index+1, true);
30553
        this.fireEvent("rowupdated", this, index, record);
30554
    },
30555
 
30556
 
30557
    refresh : function(headersToo){
30558
        this.fireEvent("beforerefresh", this);
30559
        this.grid.stopEditing(true);
30560
 
30561
        var result = this.renderBody();
30562
        this.mainBody.update(result);
30563
 
30564
        if(headersToo === true){
30565
            this.updateHeaders();
30566
            this.updateHeaderSortState();
30567
        }
30568
        this.processRows(0, true);
30569
        this.layout();
30570
        this.applyEmptyText();
30571
        this.fireEvent("refresh", this);
30572
    },
30573
 
30574
        applyEmptyText : function(){
30575
        if(this.emptyText && !this.hasRows()){
30576
            this.mainBody.update('<div class="x-grid-empty">' + this.emptyText + '</div>');
30577
        }
30578
    },
30579
 
30580
        updateHeaderSortState : function(){
30581
        var state = this.ds.getSortState();
30582
        if(!state){
30583
            return;
30584
        }
30585
        if(!this.sortState || (this.sortState.field != state.field || this.sortState.direction != state.direction)){
30586
            this.grid.fireEvent('sortchange', this.grid, state);
30587
        }
30588
        this.sortState = state;
30589
        var sortColumn = this.cm.findColumnIndex(state.field);
30590
        if(sortColumn != -1){
30591
            var sortDir = state.direction;
30592
            this.updateSortIcon(sortColumn, sortDir);
30593
        }
30594
    },
30595
 
30596
        destroy : function(){
30597
        if(this.colMenu){
30598
            this.colMenu.removeAll();
30599
            Ext.menu.MenuMgr.unregister(this.colMenu);
30600
            this.colMenu.getEl().remove();
30601
            delete this.colMenu;
30602
        }
30603
        if(this.hmenu){
30604
            this.hmenu.removeAll();
30605
            Ext.menu.MenuMgr.unregister(this.hmenu);
30606
            this.hmenu.getEl().remove();
30607
            delete this.hmenu;
30608
        }
30609
        if(this.grid.enableColumnMove){
30610
            var dds = Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];
30611
            if(dds){
30612
                for(var dd in dds){
30613
                    if(!dds[dd].config.isTarget && dds[dd].dragElId){
30614
                        var elid = dds[dd].dragElId;
30615
                        dds[dd].unreg();
30616
                        Ext.get(elid).remove();
30617
                    } else if(dds[dd].config.isTarget){
30618
                        dds[dd].proxyTop.remove();
30619
                        dds[dd].proxyBottom.remove();
30620
                        dds[dd].unreg();
30621
                    }
30622
                    if(Ext.dd.DDM.locationCache[dd]){
30623
                        delete Ext.dd.DDM.locationCache[dd];
30624
                    }
30625
                }
30626
                delete Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];
30627
            }
30628
        }
30629
 
30630
        Ext.destroy(this.resizeMarker, this.resizeProxy);
30631
 
30632
        this.initData(null, null);
30633
        Ext.EventManager.removeResizeListener(this.onWindowResize, this);
30634
    },
30635
 
30636
        onDenyColumnHide : function(){
30637
 
30638
    },
30639
 
30640
        render : function(){
30641
 
30642
        var cm = this.cm;
30643
        var colCount = cm.getColumnCount();
30644
 
30645
        if(this.autoFill){
30646
            this.fitColumns(true, true);
30647
        }else if(this.forceFit){
30648
            this.fitColumns(true, false);
30649
        }else if(this.grid.autoExpandColumn){
30650
            this.autoExpand(true);
30651
        }
30652
 
30653
        this.renderUI();
30654
    },
30655
 
30656
 
30657
        initData : function(ds, cm){
30658
        if(this.ds){
30659
            this.ds.un("load", this.onLoad, this);
30660
            this.ds.un("datachanged", this.onDataChange, this);
30661
            this.ds.un("add", this.onAdd, this);
30662
            this.ds.un("remove", this.onRemove, this);
30663
            this.ds.un("update", this.onUpdate, this);
30664
            this.ds.un("clear", this.onClear, this);
30665
        }
30666
        if(ds){
30667
            ds.on("load", this.onLoad, this);
30668
            ds.on("datachanged", this.onDataChange, this);
30669
            ds.on("add", this.onAdd, this);
30670
            ds.on("remove", this.onRemove, this);
30671
            ds.on("update", this.onUpdate, this);
30672
            ds.on("clear", this.onClear, this);
30673
        }
30674
        this.ds = ds;
30675
 
30676
        if(this.cm){
30677
            this.cm.un("configchange", this.onColConfigChange, this);
30678
            this.cm.un("widthchange", this.onColWidthChange, this);
30679
            this.cm.un("headerchange", this.onHeaderChange, this);
30680
            this.cm.un("hiddenchange", this.onHiddenChange, this);
30681
            this.cm.un("columnmoved", this.onColumnMove, this);
30682
            this.cm.un("columnlockchange", this.onColumnLock, this);
30683
        }
30684
        if(cm){
30685
            cm.on("configchange", this.onColConfigChange, this);
30686
            cm.on("widthchange", this.onColWidthChange, this);
30687
            cm.on("headerchange", this.onHeaderChange, this);
30688
            cm.on("hiddenchange", this.onHiddenChange, this);
30689
            cm.on("columnmoved", this.onColumnMove, this);
30690
            cm.on("columnlockchange", this.onColumnLock, this);
30691
        }
30692
        this.cm = cm;
30693
    },
30694
 
30695
        onDataChange : function(){
30696
        this.refresh();
30697
        this.updateHeaderSortState();
30698
    },
30699
 
30700
        onClear : function(){
30701
        this.refresh();
30702
    },
30703
 
30704
        onUpdate : function(ds, record){
30705
        this.refreshRow(record);
30706
    },
30707
 
30708
        onAdd : function(ds, records, index){
30709
        this.insertRows(ds, index, index + (records.length-1));
30710
    },
30711
 
30712
        onRemove : function(ds, record, index, isUpdate){
30713
        if(isUpdate !== true){
30714
            this.fireEvent("beforerowremoved", this, index, record);
30715
        }
30716
        this.removeRow(index);
30717
        if(isUpdate !== true){
30718
            this.processRows(index);
30719
            this.applyEmptyText();
30720
            this.fireEvent("rowremoved", this, index, record);
30721
        }
30722
    },
30723
 
30724
        onLoad : function(){
30725
        this.scrollToTop();
30726
    },
30727
 
30728
        onColWidthChange : function(cm, col, width){
30729
        this.updateColumnWidth(col, width);
30730
    },
30731
 
30732
        onHeaderChange : function(cm, col, text){
30733
        this.updateHeaders();
30734
    },
30735
 
30736
        onHiddenChange : function(cm, col, hidden){
30737
        this.updateColumnHidden(col, hidden);
30738
    },
30739
 
30740
        onColumnMove : function(cm, oldIndex, newIndex){
30741
        this.indexMap = null;
30742
        var s = this.getScrollState();
30743
        this.refresh(true);
30744
        this.restoreScroll(s);
30745
        this.afterMove(newIndex);
30746
    },
30747
 
30748
        onColConfigChange : function(){
30749
        delete this.lastViewWidth;
30750
        this.indexMap = null;
30751
        this.refresh(true);
30752
    },
30753
 
30754
 
30755
        initUI : function(grid){
30756
        grid.on("headerclick", this.onHeaderClick, this);
30757
 
30758
        if(grid.trackMouseOver){
30759
            grid.on("mouseover", this.onRowOver, this);
30760
          grid.on("mouseout", this.onRowOut, this);
30761
      }
30762
    },
30763
 
30764
        initEvents : function(){
30765
 
30766
    },
30767
 
30768
        onHeaderClick : function(g, index){
30769
        if(this.headersDisabled || !this.cm.isSortable(index)){
30770
            return;
30771
        }
30772
        g.stopEditing(true);
30773
        g.store.sort(this.cm.getDataIndex(index));
30774
    },
30775
 
30776
        onRowOver : function(e, t){
30777
        var row;
30778
        if((row = this.findRowIndex(t)) !== false){
30779
            this.addRowClass(row, "x-grid3-row-over");
30780
        }
30781
    },
30782
 
30783
        onRowOut : function(e, t){
30784
        var row;
30785
        if((row = this.findRowIndex(t)) !== false && row !== this.findRowIndex(e.getRelatedTarget())){
30786
            this.removeRowClass(row, "x-grid3-row-over");
30787
        }
30788
    },
30789
 
30790
        handleWheel : function(e){
30791
        e.stopPropagation();
30792
    },
30793
 
30794
        onRowSelect : function(row){
30795
        this.addRowClass(row, "x-grid3-row-selected");
30796
    },
30797
 
30798
        onRowDeselect : function(row){
30799
        this.removeRowClass(row, "x-grid3-row-selected");
30800
    },
30801
 
30802
        onCellSelect : function(row, col){
30803
        var cell = this.getCell(row, col);
30804
        if(cell){
30805
            this.fly(cell).addClass("x-grid3-cell-selected");
30806
        }
30807
    },
30808
 
30809
        onCellDeselect : function(row, col){
30810
        var cell = this.getCell(row, col);
30811
        if(cell){
30812
            this.fly(cell).removeClass("x-grid3-cell-selected");
30813
        }
30814
    },
30815
 
30816
        onColumnSplitterMoved : function(i, w){
30817
        this.userResized = true;
30818
        var cm = this.grid.colModel;
30819
        cm.setColumnWidth(i, w, true);
30820
 
30821
        if(this.forceFit){
30822
            this.fitColumns(true, false, i);
30823
            this.updateAllColumnWidths();
30824
        }else{
30825
            this.updateColumnWidth(i, w);
30826
        }
30827
 
30828
        this.grid.fireEvent("columnresize", i, w);
30829
    },
30830
 
30831
        handleHdMenuClick : function(item){
30832
        var index = this.hdCtxIndex;
30833
        var cm = this.cm, ds = this.ds;
30834
        switch(item.id){
30835
            case "asc":
30836
                ds.sort(cm.getDataIndex(index), "ASC");
30837
                break;
30838
            case "desc":
30839
                ds.sort(cm.getDataIndex(index), "DESC");
30840
                break;
30841
            default:
30842
                index = cm.getIndexById(item.id.substr(4));
30843
                if(index != -1){
30844
                    if(item.checked && cm.getColumnsBy(this.isHideableColumn, this).length <= 1){
30845
                        this.onDenyColumnHide();
30846
                        return false;
30847
                    }
30848
                    cm.setHidden(index, item.checked);
30849
                }
30850
        }
30851
        return true;
30852
    },
30853
 
30854
        isHideableColumn : function(c){
30855
        return !c.hidden && !c.fixed;
30856
    },
30857
 
30858
        beforeColMenuShow : function(){
30859
        var cm = this.cm,  colCount = cm.getColumnCount();
30860
        this.colMenu.removeAll();
30861
        for(var i = 0; i < colCount; i++){
30862
            if(cm.config[i].fixed !== true && cm.config[i].hideable !== false){
30863
                this.colMenu.add(new Ext.menu.CheckItem({
30864
                    id: "col-"+cm.getColumnId(i),
30865
                    text: cm.getColumnHeader(i),
30866
                    checked: !cm.isHidden(i),
30867
                    hideOnClick:false,
30868
                    disabled: cm.config[i].hideable === false
30869
                }));
30870
            }
30871
        }
30872
    },
30873
 
30874
        handleHdDown : function(e, t){
30875
        if(Ext.fly(t).hasClass('x-grid3-hd-btn')){
30876
            e.stopEvent();
30877
            var hd = this.findHeaderCell(t);
30878
            Ext.fly(hd).addClass('x-grid3-hd-menu-open');
30879
            var index = this.getCellIndex(hd);
30880
            this.hdCtxIndex = index;
30881
            var ms = this.hmenu.items, cm = this.cm;
30882
            ms.get("asc").setDisabled(!cm.isSortable(index));
30883
            ms.get("desc").setDisabled(!cm.isSortable(index));
30884
            this.hmenu.on("hide", function(){
30885
                Ext.fly(hd).removeClass('x-grid3-hd-menu-open');
30886
            }, this, {single:true});
30887
            this.hmenu.show(t, "tl-bl?");
30888
        }
30889
    },
30890
 
30891
        handleHdOver : function(e, t){
30892
        var hd = this.findHeaderCell(t);
30893
        if(hd && !this.headersDisabled){
30894
            this.activeHd = hd;
30895
            this.activeHdIndex = this.getCellIndex(hd);
30896
            var fly = this.fly(hd);
30897
            this.activeHdRegion = fly.getRegion();
30898
            if(!this.cm.isMenuDisabled(this.activeHdIndex)){
30899
                fly.addClass("x-grid3-hd-over");
30900
                this.activeHdBtn = fly.child('.x-grid3-hd-btn');
30901
                if(this.activeHdBtn){
30902
                    this.activeHdBtn.dom.style.height = (hd.firstChild.offsetHeight-1)+'px';
30903
                }
30904
            }
30905
        }
30906
    },
30907
 
30908
        handleHdMove : function(e, t){
30909
        if(this.activeHd && !this.headersDisabled){
30910
            var hw = this.splitHandleWidth || 5;
30911
            var r = this.activeHdRegion;
30912
            var x = e.getPageX();
30913
            var ss = this.activeHd.style;
30914
            if(x - r.left <= hw && this.cm.isResizable(this.activeHdIndex-1)){
30915
                ss.cursor = Ext.isAir ? 'move' : Ext.isSafari ? 'e-resize' : 'col-resize';             }else if(r.right - x <= (!this.activeHdBtn ? hw : 2) && this.cm.isResizable(this.activeHdIndex)){
30916
                ss.cursor = Ext.isAir ? 'move' : Ext.isSafari ? 'w-resize' : 'col-resize';
30917
            }else{
30918
                ss.cursor = '';
30919
            }
30920
        }
30921
    },
30922
 
30923
        handleHdOut : function(e, t){
30924
        var hd = this.findHeaderCell(t);
30925
        if(hd && (!Ext.isIE || !e.within(hd, true))){
30926
            this.activeHd = null;
30927
            this.fly(hd).removeClass("x-grid3-hd-over");
30928
            hd.style.cursor = '';
30929
        }
30930
    },
30931
 
30932
        hasRows : function(){
30933
        var fc = this.mainBody.dom.firstChild;
30934
        return fc && fc.className != 'x-grid-empty';
30935
    },
30936
 
30937
        bind : function(d, c){
30938
        this.initData(d, c);
30939
    }
30940
});
30941
 
30942
 
30943
Ext.grid.GridView.SplitDragZone = function(grid, hd){
30944
    this.grid = grid;
30945
    this.view = grid.getView();
30946
    this.marker = this.view.resizeMarker;
30947
    this.proxy = this.view.resizeProxy;
30948
    Ext.grid.GridView.SplitDragZone.superclass.constructor.call(this, hd,
30949
        "gridSplitters" + this.grid.getGridEl().id, {
30950
        dragElId : Ext.id(this.proxy.dom), resizeFrame:false
30951
    });
30952
    this.scroll = false;
30953
    this.hw = this.view.splitHandleWidth || 5;
30954
};
30955
Ext.extend(Ext.grid.GridView.SplitDragZone, Ext.dd.DDProxy, {
30956
 
30957
    b4StartDrag : function(x, y){
30958
        this.view.headersDisabled = true;
30959
        var h = this.view.mainWrap.getHeight();
30960
        this.marker.setHeight(h);
30961
        this.marker.show();
30962
        this.marker.alignTo(this.view.getHeaderCell(this.cellIndex), 'tl-tl', [-2, 0]);
30963
        this.proxy.setHeight(h);
30964
        var w = this.cm.getColumnWidth(this.cellIndex);
30965
        var minw = Math.max(w-this.grid.minColumnWidth, 0);
30966
        this.resetConstraints();
30967
        this.setXConstraint(minw, 1000);
30968
        this.setYConstraint(0, 0);
30969
        this.minX = x - minw;
30970
        this.maxX = x + 1000;
30971
        this.startPos = x;
30972
        Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
30973
    },
30974
 
30975
 
30976
    handleMouseDown : function(e){
30977
        var t = this.view.findHeaderCell(e.getTarget());
30978
        if(t){
30979
            var xy = this.view.fly(t).getXY(), x = xy[0], y = xy[1];
30980
            var exy = e.getXY(), ex = exy[0], ey = exy[1];
30981
            var w = t.offsetWidth, adjust = false;
30982
            if((ex - x) <= this.hw){
30983
                adjust = -1;
30984
            }else if((x+w) - ex <= this.hw){
30985
                adjust = 0;
30986
            }
30987
            if(adjust !== false){
30988
                this.cm = this.grid.colModel;
30989
                var ci = this.view.getCellIndex(t);
30990
                if(adjust == -1){
30991
                  if (ci + adjust < 0) {
30992
                    return;
30993
                  }
30994
                    while(this.cm.isHidden(ci+adjust)){
30995
                        --adjust;
30996
                        if(ci+adjust < 0){
30997
                            return;
30998
                        }
30999
                    }
31000
                }
31001
                this.cellIndex = ci+adjust;
31002
                this.split = t.dom;
31003
                if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){
31004
                    Ext.grid.GridView.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
31005
                }
31006
            }else if(this.view.columnDrag){
31007
                this.view.columnDrag.callHandleMouseDown(e);
31008
            }
31009
        }
31010
    },
31011
 
31012
    endDrag : function(e){
31013
        this.marker.hide();
31014
        var v = this.view;
31015
        var endX = Math.max(this.minX, e.getPageX());
31016
        var diff = endX - this.startPos;
31017
        v.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
31018
        setTimeout(function(){
31019
            v.headersDisabled = false;
31020
        }, 50);
31021
    },
31022
 
31023
    autoOffset : function(){
31024
        this.setDelta(0,0);
31025
    }
31026
});
31027
 
31028
 
31029
Ext.grid.GroupingView = Ext.extend(Ext.grid.GridView, {
31030
 
31031
    hideGroupedColumn:false,
31032
 
31033
    showGroupName:true,
31034
 
31035
    startCollapsed:false,
31036
 
31037
    enableGrouping:true,
31038
 
31039
    enableGroupingMenu:true,
31040
 
31041
    enableNoGroups:true,
31042
 
31043
    emptyGroupText : '(None)',
31044
 
31045
    ignoreAdd: false,
31046
 
31047
    groupTextTpl : '{text}',
31048
 
31049
 
31050
 
31051
 
31052
    gidSeed : 1000,
31053
 
31054
 
31055
    initTemplates : function(){
31056
        Ext.grid.GroupingView.superclass.initTemplates.call(this);
31057
        this.state = {};
31058
 
31059
        var sm = this.grid.getSelectionModel();
31060
        sm.on(sm.selectRow ? 'beforerowselect' : 'beforecellselect',
31061
                this.onBeforeRowSelect, this);
31062
 
31063
        if(!this.startGroup){
31064
            this.startGroup = new Ext.XTemplate(
31065
                '<div id="{groupId}" class="x-grid-group {cls}">',
31066
                    '<div id="{groupId}-hd" class="x-grid-group-hd" style="{style}"><div>', this.groupTextTpl ,'</div></div>',
31067
                    '<div id="{groupId}-bd" class="x-grid-group-body">'
31068
            );
31069
        }
31070
        this.startGroup.compile();
31071
        this.endGroup = '</div></div>';
31072
    },
31073
 
31074
 
31075
    findGroup : function(el){
31076
        return Ext.fly(el).up('.x-grid-group', this.mainBody.dom);
31077
    },
31078
 
31079
 
31080
    getGroups : function(){
31081
        return this.hasRows() ? this.mainBody.dom.childNodes : [];
31082
    },
31083
 
31084
 
31085
    onAdd : function(){
31086
        if(this.enableGrouping && !this.ignoreAdd){
31087
            var ss = this.getScrollState();
31088
            this.refresh();
31089
            this.restoreScroll(ss);
31090
        }else if(!this.enableGrouping){
31091
            Ext.grid.GroupingView.superclass.onAdd.apply(this, arguments);
31092
        }
31093
    },
31094
 
31095
 
31096
    onRemove : function(ds, record, index, isUpdate){
31097
        Ext.grid.GroupingView.superclass.onRemove.apply(this, arguments);
31098
        var g = document.getElementById(record._groupId);
31099
        if(g && g.childNodes[1].childNodes.length < 1){
31100
            Ext.removeNode(g);
31101
        }
31102
        this.applyEmptyText();
31103
    },
31104
 
31105
 
31106
    refreshRow : function(record){
31107
        if(this.ds.getCount()==1){
31108
            this.refresh();
31109
        }else{
31110
            this.isUpdating = true;
31111
            Ext.grid.GroupingView.superclass.refreshRow.apply(this, arguments);
31112
            this.isUpdating = false;
31113
        }
31114
    },
31115
 
31116
 
31117
    beforeMenuShow : function(){
31118
        var field = this.getGroupField();
31119
        var g = this.hmenu.items.get('groupBy');
31120
        if(g){
31121
            g.setDisabled(this.cm.config[this.hdCtxIndex].groupable === false);
31122
        }
31123
        var s = this.hmenu.items.get('showGroups');
31124
        if(s){
31125
            if (!!field){
31126
                s.setDisabled(this.cm.config[this.hdCtxIndex].groupable === false)
31127
            }
31128
            s.setChecked(!!field);
31129
        }
31130
    },
31131
 
31132
 
31133
    renderUI : function(){
31134
        Ext.grid.GroupingView.superclass.renderUI.call(this);
31135
        this.mainBody.on('mousedown', this.interceptMouse, this);
31136
 
31137
        if(this.enableGroupingMenu && this.hmenu){
31138
            this.hmenu.add('-',{
31139
                id:'groupBy',
31140
                text: this.groupByText,
31141
                handler: this.onGroupByClick,
31142
                scope: this,
31143
                iconCls:'x-group-by-icon'
31144
            });
31145
            if(this.enableNoGroups){
31146
                this.hmenu.add({
31147
                    id:'showGroups',
31148
                    text: this.showGroupsText,
31149
                    checked: true,
31150
                    checkHandler: this.onShowGroupsClick,
31151
                    scope: this
31152
                });
31153
            }
31154
            this.hmenu.on('beforeshow', this.beforeMenuShow, this);
31155
        }
31156
    },
31157
 
31158
 
31159
    onGroupByClick : function(){
31160
        this.grid.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex));
31161
        this.beforeMenuShow();
31162
    },
31163
 
31164
 
31165
    onShowGroupsClick : function(mi, checked){
31166
        if(checked){
31167
            this.onGroupByClick();
31168
        }else{
31169
            this.grid.store.clearGrouping();
31170
        }
31171
    },
31172
 
31173
 
31174
    toggleGroup : function(group, expanded){
31175
        this.grid.stopEditing(true);
31176
        group = Ext.getDom(group);
31177
        var gel = Ext.fly(group);
31178
        expanded = expanded !== undefined ?
31179
                expanded : gel.hasClass('x-grid-group-collapsed');
31180
 
31181
        this.state[gel.dom.id] = expanded;
31182
        gel[expanded ? 'removeClass' : 'addClass']('x-grid-group-collapsed');
31183
    },
31184
 
31185
 
31186
    toggleAllGroups : function(expanded){
31187
        var groups = this.getGroups();
31188
        for(var i = 0, len = groups.length; i < len; i++){
31189
            this.toggleGroup(groups[i], expanded);
31190
        }
31191
    },
31192
 
31193
 
31194
    expandAllGroups : function(){
31195
        this.toggleAllGroups(true);
31196
    },
31197
 
31198
 
31199
    collapseAllGroups : function(){
31200
        this.toggleAllGroups(false);
31201
    },
31202
 
31203
 
31204
    interceptMouse : function(e){
31205
        var hd = e.getTarget('.x-grid-group-hd', this.mainBody);
31206
        if(hd){
31207
            e.stopEvent();
31208
            this.toggleGroup(hd.parentNode);
31209
        }
31210
    },
31211
 
31212
 
31213
    getGroup : function(v, r, groupRenderer, rowIndex, colIndex, ds){
31214
        var g = groupRenderer ? groupRenderer(v, {}, r, rowIndex, colIndex, ds) : String(v);
31215
        if(g === ''){
31216
            g = this.cm.config[colIndex].emptyGroupText || this.emptyGroupText;
31217
        }
31218
        return g;
31219
    },
31220
 
31221
 
31222
    getGroupField : function(){
31223
        return this.grid.store.getGroupState();
31224
    },
31225
 
31226
 
31227
    renderRows : function(){
31228
        var groupField = this.getGroupField();
31229
        var eg = !!groupField;
31230
 
31231
        if(this.hideGroupedColumn) {
31232
            var colIndex = this.cm.findColumnIndex(groupField);
31233
            if(!eg && this.lastGroupField !== undefined) {
31234
                this.mainBody.update('');
31235
                this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField), false);
31236
                delete this.lastGroupField;
31237
            }else if (eg && this.lastGroupField === undefined) {
31238
                this.lastGroupField = groupField;
31239
                this.cm.setHidden(colIndex, true);
31240
            }else if (eg && this.lastGroupField !== undefined && groupField !== this.lastGroupField) {
31241
                this.mainBody.update('');
31242
                var oldIndex = this.cm.findColumnIndex(this.lastGroupField);
31243
                this.cm.setHidden(oldIndex, false);
31244
                this.lastGroupField = groupField;
31245
                this.cm.setHidden(colIndex, true);
31246
            }
31247
        }
31248
        return Ext.grid.GroupingView.superclass.renderRows.apply(
31249
                    this, arguments);
31250
    },
31251
 
31252
 
31253
    doRender : function(cs, rs, ds, startRow, colCount, stripe){
31254
        if(rs.length < 1){
31255
            return '';
31256
        }
31257
        var groupField = this.getGroupField();
31258
        var colIndex = this.cm.findColumnIndex(groupField);
31259
 
31260
        this.enableGrouping = !!groupField;
31261
 
31262
        if(!this.enableGrouping || this.isUpdating){
31263
            return Ext.grid.GroupingView.superclass.doRender.apply(
31264
                    this, arguments);
31265
        }
31266
        var gstyle = 'width:'+this.getTotalWidth()+';';
31267
 
31268
        var gidPrefix = this.grid.getGridEl().id;
31269
        var cfg = this.cm.config[colIndex];
31270
        var groupRenderer = cfg.groupRenderer || cfg.renderer;
31271
        var prefix = this.showGroupName ?
31272
                     (cfg.groupName || cfg.header)+': ' : '';
31273
 
31274
        var groups = [], curGroup, i, len, gid;
31275
        for(i = 0, len = rs.length; i < len; i++){
31276
            var rowIndex = startRow + i;
31277
            var r = rs[i],
31278
                gvalue = r.data[groupField],
31279
                g = this.getGroup(gvalue, r, groupRenderer, rowIndex, colIndex, ds);
31280
            if(!curGroup || curGroup.group != g){
31281
                gid = gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(g);
31282
 
31283
 
31284
				var isCollapsed  = typeof this.state[gid] !== 'undefined' ? !this.state[gid] : this.startCollapsed;
31285
				var gcls = isCollapsed ? 'x-grid-group-collapsed' : '';
31286
                curGroup = {
31287
                    group: g,
31288
                    gvalue: gvalue,
31289
                    text: prefix + g,
31290
                    groupId: gid,
31291
                    startRow: rowIndex,
31292
                    rs: [r],
31293
                    cls: gcls,
31294
                    style: gstyle
31295
                };
31296
                groups.push(curGroup);
31297
            }else{
31298
                curGroup.rs.push(r);
31299
            }
31300
            r._groupId = gid;
31301
        }
31302
 
31303
        var buf = [];
31304
        for(i = 0, len = groups.length; i < len; i++){
31305
            var g = groups[i];
31306
            this.doGroupStart(buf, g, cs, ds, colCount);
31307
            buf[buf.length] = Ext.grid.GroupingView.superclass.doRender.call(
31308
                    this, cs, g.rs, ds, g.startRow, colCount, stripe);
31309
 
31310
            this.doGroupEnd(buf, g, cs, ds, colCount);
31311
        }
31312
        return buf.join('');
31313
    },
31314
 
31315
 
31316
    getGroupId : function(value){
31317
        var gidPrefix = this.grid.getGridEl().id;
31318
        var groupField = this.getGroupField();
31319
        var colIndex = this.cm.findColumnIndex(groupField);
31320
        var cfg = this.cm.config[colIndex];
31321
        var groupRenderer = cfg.groupRenderer || cfg.renderer;
31322
        var gtext = this.getGroup(value, {data:{}}, groupRenderer, 0, colIndex, this.ds);
31323
        return gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(value);
31324
    },
31325
 
31326
 
31327
    doGroupStart : function(buf, g, cs, ds, colCount){
31328
        buf[buf.length] = this.startGroup.apply(g);
31329
    },
31330
 
31331
 
31332
    doGroupEnd : function(buf, g, cs, ds, colCount){
31333
        buf[buf.length] = this.endGroup;
31334
    },
31335
 
31336
 
31337
    getRows : function(){
31338
        if(!this.enableGrouping){
31339
            return Ext.grid.GroupingView.superclass.getRows.call(this);
31340
        }
31341
        var r = [];
31342
        var g, gs = this.getGroups();
31343
        for(var i = 0, len = gs.length; i < len; i++){
31344
            g = gs[i].childNodes[1].childNodes;
31345
            for(var j = 0, jlen = g.length; j < jlen; j++){
31346
                r[r.length] = g[j];
31347
            }
31348
        }
31349
        return r;
31350
    },
31351
 
31352
 
31353
    updateGroupWidths : function(){
31354
        if(!this.enableGrouping || !this.hasRows()){
31355
            return;
31356
        }
31357
        var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.scrollOffset) +'px';
31358
        var gs = this.getGroups();
31359
        for(var i = 0, len = gs.length; i < len; i++){
31360
            gs[i].firstChild.style.width = tw;
31361
        }
31362
    },
31363
 
31364
 
31365
    onColumnWidthUpdated : function(col, w, tw){
31366
        this.updateGroupWidths();
31367
    },
31368
 
31369
 
31370
    onAllColumnWidthsUpdated : function(ws, tw){
31371
        this.updateGroupWidths();
31372
    },
31373
 
31374
 
31375
    onColumnHiddenUpdated : function(col, hidden, tw){
31376
        this.updateGroupWidths();
31377
    },
31378
 
31379
 
31380
    onLayout : function(){
31381
        this.updateGroupWidths();
31382
    },
31383
 
31384
 
31385
    onBeforeRowSelect : function(sm, rowIndex){
31386
        if(!this.enableGrouping){
31387
            return;
31388
        }
31389
        var row = this.getRow(rowIndex);
31390
        if(row && !row.offsetParent){
31391
            var g = this.findGroup(row);
31392
            this.toggleGroup(g, true);
31393
        }
31394
    },
31395
 
31396
 
31397
    groupByText: 'Group By This Field',
31398
 
31399
    showGroupsText: 'Show in Groups'
31400
});
31401
 
31402
Ext.grid.GroupingView.GROUP_ID = 1000;
31403
 
31404
 
31405
Ext.grid.HeaderDragZone = function(grid, hd, hd2){
31406
    this.grid = grid;
31407
    this.view = grid.getView();
31408
    this.ddGroup = "gridHeader" + this.grid.getGridEl().id;
31409
    Ext.grid.HeaderDragZone.superclass.constructor.call(this, hd);
31410
    if(hd2){
31411
        this.setHandleElId(Ext.id(hd));
31412
        this.setOuterHandleElId(Ext.id(hd2));
31413
    }
31414
    this.scroll = false;
31415
};
31416
Ext.extend(Ext.grid.HeaderDragZone, Ext.dd.DragZone, {
31417
    maxDragWidth: 120,
31418
    getDragData : function(e){
31419
        var t = Ext.lib.Event.getTarget(e);
31420
        var h = this.view.findHeaderCell(t);
31421
        if(h){
31422
            return {ddel: h.firstChild, header:h};
31423
        }
31424
        return false;
31425
    },
31426
 
31427
    onInitDrag : function(e){
31428
        this.view.headersDisabled = true;
31429
        var clone = this.dragData.ddel.cloneNode(true);
31430
        clone.id = Ext.id();
31431
        clone.style.width = Math.min(this.dragData.header.offsetWidth,this.maxDragWidth) + "px";
31432
        this.proxy.update(clone);
31433
        return true;
31434
    },
31435
 
31436
    afterValidDrop : function(){
31437
        var v = this.view;
31438
        setTimeout(function(){
31439
            v.headersDisabled = false;
31440
        }, 50);
31441
    },
31442
 
31443
    afterInvalidDrop : function(){
31444
        var v = this.view;
31445
        setTimeout(function(){
31446
            v.headersDisabled = false;
31447
        }, 50);
31448
    }
31449
});
31450
 
31451
 
31452
 
31453
Ext.grid.HeaderDropZone = function(grid, hd, hd2){
31454
    this.grid = grid;
31455
    this.view = grid.getView();
31456
 
31457
    this.proxyTop = Ext.DomHelper.append(document.body, {
31458
        cls:"col-move-top", html:"&#160;"
31459
    }, true);
31460
    this.proxyBottom = Ext.DomHelper.append(document.body, {
31461
        cls:"col-move-bottom", html:"&#160;"
31462
    }, true);
31463
    this.proxyTop.hide = this.proxyBottom.hide = function(){
31464
        this.setLeftTop(-100,-100);
31465
        this.setStyle("visibility", "hidden");
31466
    };
31467
    this.ddGroup = "gridHeader" + this.grid.getGridEl().id;
31468
 
31469
 
31470
    Ext.grid.HeaderDropZone.superclass.constructor.call(this, grid.getGridEl().dom);
31471
};
31472
Ext.extend(Ext.grid.HeaderDropZone, Ext.dd.DropZone, {
31473
    proxyOffsets : [-4, -9],
31474
    fly: Ext.Element.fly,
31475
 
31476
    getTargetFromEvent : function(e){
31477
        var t = Ext.lib.Event.getTarget(e);
31478
        var cindex = this.view.findCellIndex(t);
31479
        if(cindex !== false){
31480
            return this.view.getHeaderCell(cindex);
31481
        }
31482
    },
31483
 
31484
    nextVisible : function(h){
31485
        var v = this.view, cm = this.grid.colModel;
31486
        h = h.nextSibling;
31487
        while(h){
31488
            if(!cm.isHidden(v.getCellIndex(h))){
31489
                return h;
31490
            }
31491
            h = h.nextSibling;
31492
        }
31493
        return null;
31494
    },
31495
 
31496
    prevVisible : function(h){
31497
        var v = this.view, cm = this.grid.colModel;
31498
        h = h.prevSibling;
31499
        while(h){
31500
            if(!cm.isHidden(v.getCellIndex(h))){
31501
                return h;
31502
            }
31503
            h = h.prevSibling;
31504
        }
31505
        return null;
31506
    },
31507
 
31508
    positionIndicator : function(h, n, e){
31509
        var x = Ext.lib.Event.getPageX(e);
31510
        var r = Ext.lib.Dom.getRegion(n.firstChild);
31511
        var px, pt, py = r.top + this.proxyOffsets[1];
31512
        if((r.right - x) <= (r.right-r.left)/2){
31513
            px = r.right+this.view.borderWidth;
31514
            pt = "after";
31515
        }else{
31516
            px = r.left;
31517
            pt = "before";
31518
        }
31519
        var oldIndex = this.view.getCellIndex(h);
31520
        var newIndex = this.view.getCellIndex(n);
31521
 
31522
        if(this.grid.colModel.isFixed(newIndex)){
31523
            return false;
31524
        }
31525
 
31526
        var locked = this.grid.colModel.isLocked(newIndex);
31527
 
31528
        if(pt == "after"){
31529
            newIndex++;
31530
        }
31531
        if(oldIndex < newIndex){
31532
            newIndex--;
31533
        }
31534
        if(oldIndex == newIndex && (locked == this.grid.colModel.isLocked(oldIndex))){
31535
            return false;
31536
        }
31537
        px +=  this.proxyOffsets[0];
31538
        this.proxyTop.setLeftTop(px, py);
31539
        this.proxyTop.show();
31540
        if(!this.bottomOffset){
31541
            this.bottomOffset = this.view.mainHd.getHeight();
31542
        }
31543
        this.proxyBottom.setLeftTop(px, py+this.proxyTop.dom.offsetHeight+this.bottomOffset);
31544
        this.proxyBottom.show();
31545
        return pt;
31546
    },
31547
 
31548
    onNodeEnter : function(n, dd, e, data){
31549
        if(data.header != n){
31550
            this.positionIndicator(data.header, n, e);
31551
        }
31552
    },
31553
 
31554
    onNodeOver : function(n, dd, e, data){
31555
        var result = false;
31556
        if(data.header != n){
31557
            result = this.positionIndicator(data.header, n, e);
31558
        }
31559
        if(!result){
31560
            this.proxyTop.hide();
31561
            this.proxyBottom.hide();
31562
        }
31563
        return result ? this.dropAllowed : this.dropNotAllowed;
31564
    },
31565
 
31566
    onNodeOut : function(n, dd, e, data){
31567
        this.proxyTop.hide();
31568
        this.proxyBottom.hide();
31569
    },
31570
 
31571
    onNodeDrop : function(n, dd, e, data){
31572
        var h = data.header;
31573
        if(h != n){
31574
            var cm = this.grid.colModel;
31575
            var x = Ext.lib.Event.getPageX(e);
31576
            var r = Ext.lib.Dom.getRegion(n.firstChild);
31577
            var pt = (r.right - x) <= ((r.right-r.left)/2) ? "after" : "before";
31578
            var oldIndex = this.view.getCellIndex(h);
31579
            var newIndex = this.view.getCellIndex(n);
31580
            var locked = cm.isLocked(newIndex);
31581
            if(pt == "after"){
31582
                newIndex++;
31583
            }
31584
            if(oldIndex < newIndex){
31585
                newIndex--;
31586
            }
31587
            if(oldIndex == newIndex && (locked == cm.isLocked(oldIndex))){
31588
                return false;
31589
            }
31590
            cm.setLocked(oldIndex, locked, true);
31591
            cm.moveColumn(oldIndex, newIndex);
31592
            this.grid.fireEvent("columnmove", oldIndex, newIndex);
31593
            return true;
31594
        }
31595
        return false;
31596
    }
31597
});
31598
 
31599
 
31600
Ext.grid.GridView.ColumnDragZone = function(grid, hd){
31601
    Ext.grid.GridView.ColumnDragZone.superclass.constructor.call(this, grid, hd, null);
31602
    this.proxy.el.addClass('x-grid3-col-dd');
31603
};
31604
 
31605
Ext.extend(Ext.grid.GridView.ColumnDragZone, Ext.grid.HeaderDragZone, {
31606
    handleMouseDown : function(e){
31607
 
31608
    },
31609
 
31610
    callHandleMouseDown : function(e){
31611
        Ext.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this, e);
31612
    }
31613
});
31614
Ext.grid.SplitDragZone = function(grid, hd, hd2){
31615
    this.grid = grid;
31616
    this.view = grid.getView();
31617
    this.proxy = this.view.resizeProxy;
31618
    Ext.grid.SplitDragZone.superclass.constructor.call(this, hd,
31619
        "gridSplitters" + this.grid.getGridEl().id, {
31620
        dragElId : Ext.id(this.proxy.dom), resizeFrame:false
31621
    });
31622
    this.setHandleElId(Ext.id(hd));
31623
    this.setOuterHandleElId(Ext.id(hd2));
31624
    this.scroll = false;
31625
};
31626
Ext.extend(Ext.grid.SplitDragZone, Ext.dd.DDProxy, {
31627
    fly: Ext.Element.fly,
31628
 
31629
    b4StartDrag : function(x, y){
31630
        this.view.headersDisabled = true;
31631
        this.proxy.setHeight(this.view.mainWrap.getHeight());
31632
        var w = this.cm.getColumnWidth(this.cellIndex);
31633
        var minw = Math.max(w-this.grid.minColumnWidth, 0);
31634
        this.resetConstraints();
31635
        this.setXConstraint(minw, 1000);
31636
        this.setYConstraint(0, 0);
31637
        this.minX = x - minw;
31638
        this.maxX = x + 1000;
31639
        this.startPos = x;
31640
        Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
31641
    },
31642
 
31643
 
31644
    handleMouseDown : function(e){
31645
        ev = Ext.EventObject.setEvent(e);
31646
        var t = this.fly(ev.getTarget());
31647
        if(t.hasClass("x-grid-split")){
31648
            this.cellIndex = this.view.getCellIndex(t.dom);
31649
            this.split = t.dom;
31650
            this.cm = this.grid.colModel;
31651
            if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){
31652
                Ext.grid.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
31653
            }
31654
        }
31655
    },
31656
 
31657
    endDrag : function(e){
31658
        this.view.headersDisabled = false;
31659
        var endX = Math.max(this.minX, Ext.lib.Event.getPageX(e));
31660
        var diff = endX - this.startPos;
31661
        this.view.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
31662
    },
31663
 
31664
    autoOffset : function(){
31665
        this.setDelta(0,0);
31666
    }
31667
});
31668
Ext.grid.GridDragZone = function(grid, config){
31669
    this.view = grid.getView();
31670
    Ext.grid.GridDragZone.superclass.constructor.call(this, this.view.mainBody.dom, config);
31671
    if(this.view.lockedBody){
31672
        this.setHandleElId(Ext.id(this.view.mainBody.dom));
31673
        this.setOuterHandleElId(Ext.id(this.view.lockedBody.dom));
31674
    }
31675
    this.scroll = false;
31676
    this.grid = grid;
31677
    this.ddel = document.createElement('div');
31678
    this.ddel.className = 'x-grid-dd-wrap';
31679
};
31680
 
31681
Ext.extend(Ext.grid.GridDragZone, Ext.dd.DragZone, {
31682
    ddGroup : "GridDD",
31683
 
31684
    getDragData : function(e){
31685
        var t = Ext.lib.Event.getTarget(e);
31686
        var rowIndex = this.view.findRowIndex(t);
31687
        if(rowIndex !== false){
31688
            var sm = this.grid.selModel;
31689
            if(!sm.isSelected(rowIndex) || e.hasModifier()){
31690
                sm.handleMouseDown(this.grid, rowIndex, e);
31691
            }
31692
            return {grid: this.grid, ddel: this.ddel, rowIndex: rowIndex, selections:sm.getSelections()};
31693
        }
31694
        return false;
31695
    },
31696
 
31697
    onInitDrag : function(e){
31698
        var data = this.dragData;
31699
        this.ddel.innerHTML = this.grid.getDragDropText();
31700
        this.proxy.update(this.ddel);
31701
            },
31702
 
31703
    afterRepair : function(){
31704
        this.dragging = false;
31705
    },
31706
 
31707
    getRepairXY : function(e, data){
31708
        return false;
31709
    },
31710
 
31711
    onEndDrag : function(data, e){
31712
            },
31713
 
31714
    onValidDrop : function(dd, e, id){
31715
                this.hideProxy();
31716
    },
31717
 
31718
    beforeInvalidDrop : function(e, id){
31719
 
31720
    }
31721
});
31722
 
31723
 
31724
Ext.grid.ColumnModel = function(config){
31725
 
31726
    this.defaultWidth = 100;
31727
 
31728
 
31729
    this.defaultSortable = false;
31730
 
31731
 
31732
    if(config.columns){
31733
        Ext.apply(this, config);
31734
        this.setConfig(config.columns, true);
31735
    }else{
31736
        this.setConfig(config, true);
31737
    }
31738
    this.addEvents(
31739
 
31740
	    "widthchange",
31741
 
31742
	    "headerchange",
31743
 
31744
	    "hiddenchange",
31745
 
31746
        "columnmoved",
31747
 
31748
        "columnlockchange",
31749
 
31750
        "configchange"
31751
    );
31752
    Ext.grid.ColumnModel.superclass.constructor.call(this);
31753
};
31754
Ext.extend(Ext.grid.ColumnModel, Ext.util.Observable, {
31755
 
31756
 
31757
 
31758
 
31759
 
31760
 
31761
 
31762
 
31763
 
31764
 
31765
 
31766
 
31767
 
31768
 
31769
 
31770
 
31771
 
31772
    getColumnId : function(index){
31773
        return this.config[index].id;
31774
    },
31775
 
31776
 
31777
    setConfig : function(config, initial){
31778
        if(!initial){
31779
            delete this.totalWidth;
31780
            for(var i = 0, len = this.config.length; i < len; i++){
31781
                var c = this.config[i];
31782
                if(c.editor){
31783
                    c.editor.destroy();
31784
                }
31785
            }
31786
        }
31787
        this.config = config;
31788
        this.lookup = {};
31789
 
31790
        for(var i = 0, len = config.length; i < len; i++){
31791
            var c = config[i];
31792
            if(typeof c.renderer == "string"){
31793
                c.renderer = Ext.util.Format[c.renderer];
31794
            }
31795
            if(typeof c.id == "undefined"){
31796
                c.id = i;
31797
            }
31798
            if(c.editor && c.editor.isFormField){
31799
                c.editor = new Ext.grid.GridEditor(c.editor);
31800
            }
31801
            this.lookup[c.id] = c;
31802
        }
31803
        if(!initial){
31804
            this.fireEvent('configchange', this);
31805
        }
31806
    },
31807
 
31808
 
31809
    getColumnById : function(id){
31810
        return this.lookup[id];
31811
    },
31812
 
31813
 
31814
    getIndexById : function(id){
31815
        for(var i = 0, len = this.config.length; i < len; i++){
31816
            if(this.config[i].id == id){
31817
                return i;
31818
            }
31819
        }
31820
        return -1;
31821
    },
31822
 
31823
 
31824
    moveColumn : function(oldIndex, newIndex){
31825
        var c = this.config[oldIndex];
31826
        this.config.splice(oldIndex, 1);
31827
        this.config.splice(newIndex, 0, c);
31828
        this.dataMap = null;
31829
        this.fireEvent("columnmoved", this, oldIndex, newIndex);
31830
    },
31831
 
31832
 
31833
    isLocked : function(colIndex){
31834
        return this.config[colIndex].locked === true;
31835
    },
31836
 
31837
 
31838
    setLocked : function(colIndex, value, suppressEvent){
31839
        if(this.isLocked(colIndex) == value){
31840
            return;
31841
        }
31842
        this.config[colIndex].locked = value;
31843
        if(!suppressEvent){
31844
            this.fireEvent("columnlockchange", this, colIndex, value);
31845
        }
31846
    },
31847
 
31848
 
31849
    getTotalLockedWidth : function(){
31850
        var totalWidth = 0;
31851
        for(var i = 0; i < this.config.length; i++){
31852
            if(this.isLocked(i) && !this.isHidden(i)){
31853
                this.totalWidth += this.getColumnWidth(i);
31854
            }
31855
        }
31856
        return totalWidth;
31857
    },
31858
 
31859
 
31860
    getLockedCount : function(){
31861
        for(var i = 0, len = this.config.length; i < len; i++){
31862
            if(!this.isLocked(i)){
31863
                return i;
31864
            }
31865
        }
31866
    },
31867
 
31868
 
31869
    getColumnCount : function(visibleOnly){
31870
        if(visibleOnly === true){
31871
            var c = 0;
31872
            for(var i = 0, len = this.config.length; i < len; i++){
31873
                if(!this.isHidden(i)){
31874
                    c++;
31875
                }
31876
            }
31877
            return c;
31878
        }
31879
        return this.config.length;
31880
    },
31881
 
31882
 
31883
    getColumnsBy : function(fn, scope){
31884
        var r = [];
31885
        for(var i = 0, len = this.config.length; i < len; i++){
31886
            var c = this.config[i];
31887
            if(fn.call(scope||this, c, i) === true){
31888
                r[r.length] = c;
31889
            }
31890
        }
31891
        return r;
31892
    },
31893
 
31894
 
31895
    isSortable : function(col){
31896
        if(typeof this.config[col].sortable == "undefined"){
31897
            return this.defaultSortable;
31898
        }
31899
        return this.config[col].sortable;
31900
    },
31901
 
31902
 
31903
    isMenuDisabled : function(col){
31904
        return !!this.config[col].menuDisabled;
31905
    },
31906
 
31907
 
31908
    getRenderer : function(col){
31909
        if(!this.config[col].renderer){
31910
            return Ext.grid.ColumnModel.defaultRenderer;
31911
        }
31912
        return this.config[col].renderer;
31913
    },
31914
 
31915
 
31916
    setRenderer : function(col, fn){
31917
        this.config[col].renderer = fn;
31918
    },
31919
 
31920
 
31921
    getColumnWidth : function(col){
31922
        return this.config[col].width || this.defaultWidth;
31923
    },
31924
 
31925
 
31926
    setColumnWidth : function(col, width, suppressEvent){
31927
        this.config[col].width = width;
31928
        this.totalWidth = null;
31929
        if(!suppressEvent){
31930
             this.fireEvent("widthchange", this, col, width);
31931
        }
31932
    },
31933
 
31934
 
31935
    getTotalWidth : function(includeHidden){
31936
        if(!this.totalWidth){
31937
            this.totalWidth = 0;
31938
            for(var i = 0, len = this.config.length; i < len; i++){
31939
                if(includeHidden || !this.isHidden(i)){
31940
                    this.totalWidth += this.getColumnWidth(i);
31941
                }
31942
            }
31943
        }
31944
        return this.totalWidth;
31945
    },
31946
 
31947
 
31948
    getColumnHeader : function(col){
31949
        return this.config[col].header;
31950
    },
31951
 
31952
 
31953
    setColumnHeader : function(col, header){
31954
        this.config[col].header = header;
31955
        this.fireEvent("headerchange", this, col, header);
31956
    },
31957
 
31958
 
31959
    getColumnTooltip : function(col){
31960
            return this.config[col].tooltip;
31961
    },
31962
 
31963
    setColumnTooltip : function(col, tooltip){
31964
            this.config[col].tooltip = tooltip;
31965
    },
31966
 
31967
 
31968
    getDataIndex : function(col){
31969
        return this.config[col].dataIndex;
31970
    },
31971
 
31972
 
31973
    setDataIndex : function(col, dataIndex){
31974
        this.config[col].dataIndex = dataIndex;
31975
    },
31976
 
31977
    findColumnIndex : function(dataIndex){
31978
        var c = this.config;
31979
        for(var i = 0, len = c.length; i < len; i++){
31980
            if(c[i].dataIndex == dataIndex){
31981
                return i;
31982
            }
31983
        }
31984
        return -1;
31985
    },
31986
 
31987
 
31988
    isCellEditable : function(colIndex, rowIndex){
31989
        return (this.config[colIndex].editable || (typeof this.config[colIndex].editable == "undefined" && this.config[colIndex].editor)) ? true : false;
31990
    },
31991
 
31992
 
31993
    getCellEditor : function(colIndex, rowIndex){
31994
        return this.config[colIndex].editor;
31995
    },
31996
 
31997
 
31998
    setEditable : function(col, editable){
31999
        this.config[col].editable = editable;
32000
    },
32001
 
32002
 
32003
 
32004
    isHidden : function(colIndex){
32005
        return this.config[colIndex].hidden;
32006
    },
32007
 
32008
 
32009
 
32010
    isFixed : function(colIndex){
32011
        return this.config[colIndex].fixed;
32012
    },
32013
 
32014
 
32015
    isResizable : function(colIndex){
32016
        return colIndex >= 0 && this.config[colIndex].resizable !== false && this.config[colIndex].fixed !== true;
32017
    },
32018
 
32019
    setHidden : function(colIndex, hidden){
32020
        var c = this.config[colIndex];
32021
        if(c.hidden !== hidden){
32022
            c.hidden = hidden;
32023
            this.totalWidth = null;
32024
            this.fireEvent("hiddenchange", this, colIndex, hidden);
32025
        }
32026
    },
32027
 
32028
 
32029
    setEditor : function(col, editor){
32030
        this.config[col].editor = editor;
32031
    }
32032
});
32033
 
32034
 
32035
Ext.grid.ColumnModel.defaultRenderer = function(value){
32036
	if(typeof value == "string" && value.length < 1){
32037
	    return "&#160;";
32038
	}
32039
	return value;
32040
};
32041
 
32042
 
32043
Ext.grid.DefaultColumnModel = Ext.grid.ColumnModel;
32044
 
32045
 
32046
Ext.grid.AbstractSelectionModel = function(){
32047
    this.locked = false;
32048
    Ext.grid.AbstractSelectionModel.superclass.constructor.call(this);
32049
};
32050
 
32051
Ext.extend(Ext.grid.AbstractSelectionModel, Ext.util.Observable,  {
32052
 
32053
    init : function(grid){
32054
        this.grid = grid;
32055
        this.initEvents();
32056
    },
32057
 
32058
 
32059
    lock : function(){
32060
        this.locked = true;
32061
    },
32062
 
32063
 
32064
    unlock : function(){
32065
        this.locked = false;
32066
    },
32067
 
32068
 
32069
    isLocked : function(){
32070
        return this.locked;
32071
    }
32072
});
32073
 
32074
Ext.grid.RowSelectionModel = function(config){
32075
    Ext.apply(this, config);
32076
    this.selections = new Ext.util.MixedCollection(false, function(o){
32077
        return o.id;
32078
    });
32079
 
32080
    this.last = false;
32081
    this.lastActive = false;
32082
 
32083
    this.addEvents(
32084
 
32085
	    "selectionchange",
32086
 
32087
	    "beforerowselect",
32088
 
32089
	    "rowselect",
32090
 
32091
	    "rowdeselect"
32092
    );
32093
 
32094
    Ext.grid.RowSelectionModel.superclass.constructor.call(this);
32095
};
32096
 
32097
Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
32098
 
32099
    singleSelect : false,
32100
 
32101
 
32102
        initEvents : function(){
32103
 
32104
        if(!this.grid.enableDragDrop && !this.grid.enableDrag){
32105
            this.grid.on("rowmousedown", this.handleMouseDown, this);
32106
        }else{             this.grid.on("rowclick", function(grid, rowIndex, e) {
32107
                if(e.button === 0 && !e.shiftKey && !e.ctrlKey) {
32108
                    this.selectRow(rowIndex, false);
32109
                    grid.view.focusRow(rowIndex);
32110
                }
32111
            }, this);
32112
        }
32113
 
32114
        this.rowNav = new Ext.KeyNav(this.grid.getGridEl(), {
32115
            "up" : function(e){
32116
                if(!e.shiftKey){
32117
                    this.selectPrevious(e.shiftKey);
32118
                }else if(this.last !== false && this.lastActive !== false){
32119
                    var last = this.last;
32120
                    this.selectRange(this.last,  this.lastActive-1);
32121
                    this.grid.getView().focusRow(this.lastActive);
32122
                    if(last !== false){
32123
                        this.last = last;
32124
                    }
32125
                }else{
32126
                    this.selectFirstRow();
32127
                }
32128
            },
32129
            "down" : function(e){
32130
                if(!e.shiftKey){
32131
                    this.selectNext(e.shiftKey);
32132
                }else if(this.last !== false && this.lastActive !== false){
32133
                    var last = this.last;
32134
                    this.selectRange(this.last,  this.lastActive+1);
32135
                    this.grid.getView().focusRow(this.lastActive);
32136
                    if(last !== false){
32137
                        this.last = last;
32138
                    }
32139
                }else{
32140
                    this.selectFirstRow();
32141
                }
32142
            },
32143
            scope: this
32144
        });
32145
 
32146
        var view = this.grid.view;
32147
        view.on("refresh", this.onRefresh, this);
32148
        view.on("rowupdated", this.onRowUpdated, this);
32149
        view.on("rowremoved", this.onRemove, this);
32150
    },
32151
 
32152
        onRefresh : function(){
32153
        var ds = this.grid.store, index;
32154
        var s = this.getSelections();
32155
        this.clearSelections(true);
32156
        for(var i = 0, len = s.length; i < len; i++){
32157
            var r = s[i];
32158
            if((index = ds.indexOfId(r.id)) != -1){
32159
                this.selectRow(index, true);
32160
            }
32161
        }
32162
        if(s.length != this.selections.getCount()){
32163
            this.fireEvent("selectionchange", this);
32164
        }
32165
    },
32166
 
32167
        onRemove : function(v, index, r){
32168
        if(this.selections.remove(r) !== false){
32169
            this.fireEvent('selectionchange', this);
32170
        }
32171
    },
32172
 
32173
        onRowUpdated : function(v, index, r){
32174
        if(this.isSelected(r)){
32175
            v.onRowSelect(index);
32176
        }
32177
    },
32178
 
32179
 
32180
    selectRecords : function(records, keepExisting){
32181
        if(!keepExisting){
32182
            this.clearSelections();
32183
        }
32184
        var ds = this.grid.store;
32185
        for(var i = 0, len = records.length; i < len; i++){
32186
            this.selectRow(ds.indexOf(records[i]), true);
32187
        }
32188
    },
32189
 
32190
 
32191
    getCount : function(){
32192
        return this.selections.length;
32193
    },
32194
 
32195
 
32196
    selectFirstRow : function(){
32197
        this.selectRow(0);
32198
    },
32199
 
32200
 
32201
    selectLastRow : function(keepExisting){
32202
        this.selectRow(this.grid.store.getCount() - 1, keepExisting);
32203
    },
32204
 
32205
 
32206
    selectNext : function(keepExisting){
32207
        if(this.hasNext()){
32208
            this.selectRow(this.last+1, keepExisting);
32209
            this.grid.getView().focusRow(this.last);
32210
			return true;
32211
        }
32212
		return false;
32213
    },
32214
 
32215
 
32216
    selectPrevious : function(keepExisting){
32217
        if(this.hasPrevious()){
32218
            this.selectRow(this.last-1, keepExisting);
32219
            this.grid.getView().focusRow(this.last);
32220
			return true;
32221
        }
32222
		return false;
32223
    },
32224
 
32225
 
32226
    hasNext : function(){
32227
        return this.last !== false && (this.last+1) < this.grid.store.getCount();
32228
    },
32229
 
32230
 
32231
    hasPrevious : function(){
32232
        return !!this.last;
32233
    },
32234
 
32235
 
32236
 
32237
    getSelections : function(){
32238
        return [].concat(this.selections.items);
32239
    },
32240
 
32241
 
32242
    getSelected : function(){
32243
        return this.selections.itemAt(0);
32244
    },
32245
 
32246
 
32247
    each : function(fn, scope){
32248
        var s = this.getSelections();
32249
        for(var i = 0, len = s.length; i < len; i++){
32250
            if(fn.call(scope || this, s[i], i) === false){
32251
                return false;
32252
            }
32253
        }
32254
        return true;
32255
    },
32256
 
32257
 
32258
    clearSelections : function(fast){
32259
        if(this.locked) return;
32260
        if(fast !== true){
32261
            var ds = this.grid.store;
32262
            var s = this.selections;
32263
            s.each(function(r){
32264
                this.deselectRow(ds.indexOfId(r.id));
32265
            }, this);
32266
            s.clear();
32267
        }else{
32268
            this.selections.clear();
32269
        }
32270
        this.last = false;
32271
    },
32272
 
32273
 
32274
 
32275
    selectAll : function(){
32276
        if(this.locked) return;
32277
        this.selections.clear();
32278
        for(var i = 0, len = this.grid.store.getCount(); i < len; i++){
32279
            this.selectRow(i, true);
32280
        }
32281
    },
32282
 
32283
 
32284
    hasSelection : function(){
32285
        return this.selections.length > 0;
32286
    },
32287
 
32288
 
32289
    isSelected : function(index){
32290
        var r = typeof index == "number" ? this.grid.store.getAt(index) : index;
32291
        return (r && this.selections.key(r.id) ? true : false);
32292
    },
32293
 
32294
 
32295
    isIdSelected : function(id){
32296
        return (this.selections.key(id) ? true : false);
32297
    },
32298
 
32299
        handleMouseDown : function(g, rowIndex, e){
32300
        if(e.button !== 0 || this.isLocked()){
32301
            return;
32302
        };
32303
        var view = this.grid.getView();
32304
        if(e.shiftKey && this.last !== false){
32305
            var last = this.last;
32306
            this.selectRange(last, rowIndex, e.ctrlKey);
32307
            this.last = last;             view.focusRow(rowIndex);
32308
        }else{
32309
            var isSelected = this.isSelected(rowIndex);
32310
            if(e.ctrlKey && isSelected){
32311
                this.deselectRow(rowIndex);
32312
            }else if(!isSelected || this.getCount() > 1){
32313
                this.selectRow(rowIndex, e.ctrlKey || e.shiftKey);
32314
                view.focusRow(rowIndex);
32315
            }
32316
        }
32317
    },
32318
 
32319
 
32320
    selectRows : function(rows, keepExisting){
32321
        if(!keepExisting){
32322
            this.clearSelections();
32323
        }
32324
        for(var i = 0, len = rows.length; i < len; i++){
32325
            this.selectRow(rows[i], true);
32326
        }
32327
    },
32328
 
32329
 
32330
    selectRange : function(startRow, endRow, keepExisting){
32331
        if(this.locked) return;
32332
        if(!keepExisting){
32333
            this.clearSelections();
32334
        }
32335
        if(startRow <= endRow){
32336
            for(var i = startRow; i <= endRow; i++){
32337
                this.selectRow(i, true);
32338
            }
32339
        }else{
32340
            for(var i = startRow; i >= endRow; i--){
32341
                this.selectRow(i, true);
32342
            }
32343
        }
32344
    },
32345
 
32346
 
32347
    deselectRange : function(startRow, endRow, preventViewNotify){
32348
        if(this.locked) return;
32349
        for(var i = startRow; i <= endRow; i++){
32350
            this.deselectRow(i, preventViewNotify);
32351
        }
32352
    },
32353
 
32354
 
32355
    selectRow : function(index, keepExisting, preventViewNotify){
32356
        if(this.locked || (index < 0 || index >= this.grid.store.getCount())) return;
32357
        var r = this.grid.store.getAt(index);
32358
        if(r && this.fireEvent("beforerowselect", this, index, keepExisting, r) !== false){
32359
            if(!keepExisting || this.singleSelect){
32360
                this.clearSelections();
32361
            }
32362
            this.selections.add(r);
32363
            this.last = this.lastActive = index;
32364
            if(!preventViewNotify){
32365
                this.grid.getView().onRowSelect(index);
32366
            }
32367
            this.fireEvent("rowselect", this, index, r);
32368
            this.fireEvent("selectionchange", this);
32369
        }
32370
    },
32371
 
32372
 
32373
    deselectRow : function(index, preventViewNotify){
32374
        if(this.locked) return;
32375
        if(this.last == index){
32376
            this.last = false;
32377
        }
32378
        if(this.lastActive == index){
32379
            this.lastActive = false;
32380
        }
32381
        var r = this.grid.store.getAt(index);
32382
        if(r){
32383
            this.selections.remove(r);
32384
            if(!preventViewNotify){
32385
                this.grid.getView().onRowDeselect(index);
32386
            }
32387
            this.fireEvent("rowdeselect", this, index, r);
32388
            this.fireEvent("selectionchange", this);
32389
        }
32390
    },
32391
 
32392
        restoreLast : function(){
32393
        if(this._last){
32394
            this.last = this._last;
32395
        }
32396
    },
32397
 
32398
        acceptsNav : function(row, col, cm){
32399
        return !cm.isHidden(col) && cm.isCellEditable(col, row);
32400
    },
32401
 
32402
        onEditorKey : function(field, e){
32403
        var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;
32404
        var shift = e.shiftKey;
32405
        if(k == e.TAB){
32406
            e.stopEvent();
32407
            ed.completeEdit();
32408
            if(shift){
32409
                newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this);
32410
            }else{
32411
                newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);
32412
            }
32413
        }else if(k == e.ENTER){
32414
            e.stopEvent();
32415
            ed.completeEdit();
32416
			if(this.moveEditorOnEnter !== false){
32417
				if(shift){
32418
					newCell = g.walkCells(ed.row - 1, ed.col, -1, this.acceptsNav, this);
32419
				}else{
32420
					newCell = g.walkCells(ed.row + 1, ed.col, 1, this.acceptsNav, this);
32421
				}
32422
			}
32423
        }else if(k == e.ESC){
32424
            ed.cancelEdit();
32425
        }
32426
        if(newCell){
32427
            g.startEditing(newCell[0], newCell[1]);
32428
        }
32429
    }
32430
});
32431
 
32432
Ext.grid.CellSelectionModel = function(config){
32433
    Ext.apply(this, config);
32434
 
32435
    this.selection = null;
32436
 
32437
    this.addEvents(
32438
 
32439
	    "beforecellselect",
32440
 
32441
	    "cellselect",
32442
 
32443
	    "selectionchange"
32444
    );
32445
 
32446
    Ext.grid.CellSelectionModel.superclass.constructor.call(this);
32447
};
32448
 
32449
Ext.extend(Ext.grid.CellSelectionModel, Ext.grid.AbstractSelectionModel,  {
32450
 
32451
 
32452
    initEvents : function(){
32453
        this.grid.on("cellmousedown", this.handleMouseDown, this);
32454
        this.grid.getGridEl().on(Ext.isIE ? "keydown" : "keypress", this.handleKeyDown, this);
32455
        var view = this.grid.view;
32456
        view.on("refresh", this.onViewChange, this);
32457
        view.on("rowupdated", this.onRowUpdated, this);
32458
        view.on("beforerowremoved", this.clearSelections, this);
32459
        view.on("beforerowsinserted", this.clearSelections, this);
32460
        if(this.grid.isEditor){
32461
            this.grid.on("beforeedit", this.beforeEdit,  this);
32462
        }
32463
    },
32464
 
32465
	    beforeEdit : function(e){
32466
        this.select(e.row, e.column, false, true, e.record);
32467
    },
32468
 
32469
	    onRowUpdated : function(v, index, r){
32470
        if(this.selection && this.selection.record == r){
32471
            v.onCellSelect(index, this.selection.cell[1]);
32472
        }
32473
    },
32474
 
32475
	    onViewChange : function(){
32476
        this.clearSelections(true);
32477
    },
32478
 
32479
 
32480
    getSelectedCell : function(){
32481
        return this.selection ? this.selection.cell : null;
32482
    },
32483
 
32484
 
32485
    clearSelections : function(preventNotify){
32486
        var s = this.selection;
32487
        if(s){
32488
            if(preventNotify !== true){
32489
                this.grid.view.onCellDeselect(s.cell[0], s.cell[1]);
32490
            }
32491
            this.selection = null;
32492
            this.fireEvent("selectionchange", this, null);
32493
        }
32494
    },
32495
 
32496
 
32497
    hasSelection : function(){
32498
        return this.selection ? true : false;
32499
    },
32500
 
32501
 
32502
    handleMouseDown : function(g, row, cell, e){
32503
        if(e.button !== 0 || this.isLocked()){
32504
            return;
32505
        };
32506
        this.select(row, cell);
32507
    },
32508
 
32509
 
32510
    select : function(rowIndex, colIndex, preventViewNotify, preventFocus,  r){
32511
        if(this.fireEvent("beforecellselect", this, rowIndex, colIndex) !== false){
32512
            this.clearSelections();
32513
            r = r || this.grid.store.getAt(rowIndex);
32514
            this.selection = {
32515
                record : r,
32516
                cell : [rowIndex, colIndex]
32517
            };
32518
            if(!preventViewNotify){
32519
                var v = this.grid.getView();
32520
                v.onCellSelect(rowIndex, colIndex);
32521
                if(preventFocus !== true){
32522
                    v.focusCell(rowIndex, colIndex);
32523
                }
32524
            }
32525
            this.fireEvent("cellselect", this, rowIndex, colIndex);
32526
            this.fireEvent("selectionchange", this, this.selection);
32527
        }
32528
    },
32529
 
32530
	    isSelectable : function(rowIndex, colIndex, cm){
32531
        return !cm.isHidden(colIndex);
32532
    },
32533
 
32534
 
32535
    handleKeyDown : function(e){
32536
        if(!e.isNavKeyPress()){
32537
            return;
32538
        }
32539
        var g = this.grid, s = this.selection;
32540
        if(!s){
32541
            e.stopEvent();
32542
            var cell = g.walkCells(0, 0, 1, this.isSelectable,  this);
32543
            if(cell){
32544
                this.select(cell[0], cell[1]);
32545
            }
32546
            return;
32547
        }
32548
        var sm = this;
32549
        var walk = function(row, col, step){
32550
            return g.walkCells(row, col, step, sm.isSelectable,  sm);
32551
        };
32552
        var k = e.getKey(), r = s.cell[0], c = s.cell[1];
32553
        var newCell;
32554
 
32555
        switch(k){
32556
             case e.TAB:
32557
                 if(e.shiftKey){
32558
                     newCell = walk(r, c-1, -1);
32559
                 }else{
32560
                     newCell = walk(r, c+1, 1);
32561
                 }
32562
             break;
32563
             case e.DOWN:
32564
                 newCell = walk(r+1, c, 1);
32565
             break;
32566
             case e.UP:
32567
                 newCell = walk(r-1, c, -1);
32568
             break;
32569
             case e.RIGHT:
32570
                 newCell = walk(r, c+1, 1);
32571
             break;
32572
             case e.LEFT:
32573
                 newCell = walk(r, c-1, -1);
32574
             break;
32575
             case e.ENTER:
32576
                 if(g.isEditor && !g.editing){
32577
                    g.startEditing(r, c);
32578
                    e.stopEvent();
32579
                    return;
32580
                }
32581
             break;
32582
        };
32583
        if(newCell){
32584
            this.select(newCell[0], newCell[1]);
32585
            e.stopEvent();
32586
        }
32587
    },
32588
 
32589
    acceptsNav : function(row, col, cm){
32590
        return !cm.isHidden(col) && cm.isCellEditable(col, row);
32591
    },
32592
 
32593
    onEditorKey : function(field, e){
32594
        var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;
32595
        if(k == e.TAB){
32596
            if(e.shiftKey){
32597
                newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this);
32598
            }else{
32599
                newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);
32600
            }
32601
            e.stopEvent();
32602
        }else if(k == e.ENTER){
32603
            ed.completeEdit();
32604
            e.stopEvent();
32605
        }else if(k == e.ESC){
32606
        	e.stopEvent();
32607
            ed.cancelEdit();
32608
        }
32609
        if(newCell){
32610
            g.startEditing(newCell[0], newCell[1]);
32611
        }
32612
    }
32613
});
32614
 
32615
Ext.grid.EditorGridPanel = Ext.extend(Ext.grid.GridPanel, {
32616
 
32617
    clicksToEdit: 2,
32618
 
32619
 
32620
    isEditor : true,
32621
 
32622
    detectEdit: false,
32623
 
32624
 
32625
	autoEncode : false,
32626
 
32627
 
32628
 
32629
    trackMouseOver: false,
32630
 
32631
 
32632
    initComponent : function(){
32633
        Ext.grid.EditorGridPanel.superclass.initComponent.call(this);
32634
 
32635
        if(!this.selModel){
32636
            this.selModel = new Ext.grid.CellSelectionModel();
32637
        }
32638
 
32639
        this.activeEditor = null;
32640
 
32641
	    this.addEvents(
32642
 
32643
            "beforeedit",
32644
 
32645
            "afteredit",
32646
 
32647
            "validateedit"
32648
        );
32649
    },
32650
 
32651
 
32652
    initEvents : function(){
32653
        Ext.grid.EditorGridPanel.superclass.initEvents.call(this);
32654
 
32655
        this.on("bodyscroll", this.stopEditing, this, [true]);
32656
 
32657
        if(this.clicksToEdit == 1){
32658
            this.on("cellclick", this.onCellDblClick, this);
32659
        }else {
32660
            if(this.clicksToEdit == 'auto' && this.view.mainBody){
32661
                this.view.mainBody.on("mousedown", this.onAutoEditClick, this);
32662
            }
32663
            this.on("celldblclick", this.onCellDblClick, this);
32664
        }
32665
        this.getGridEl().addClass("xedit-grid");
32666
    },
32667
 
32668
 
32669
    onCellDblClick : function(g, row, col){
32670
        this.startEditing(row, col);
32671
    },
32672
 
32673
 
32674
    onAutoEditClick : function(e, t){
32675
        if(e.button !== 0){
32676
            return;
32677
        }
32678
        var row = this.view.findRowIndex(t);
32679
        var col = this.view.findCellIndex(t);
32680
        if(row !== false && col !== false){
32681
            this.stopEditing();
32682
            if(this.selModel.getSelectedCell){
32683
                var sc = this.selModel.getSelectedCell();
32684
                if(sc && sc.cell[0] === row && sc.cell[1] === col){
32685
                    this.startEditing(row, col);
32686
                }
32687
            }else{
32688
                if(this.selModel.isSelected(row)){
32689
                    this.startEditing(row, col);
32690
                }
32691
            }
32692
        }
32693
    },
32694
 
32695
 
32696
    onEditComplete : function(ed, value, startValue){
32697
        this.editing = false;
32698
        this.activeEditor = null;
32699
        ed.un("specialkey", this.selModel.onEditorKey, this.selModel);
32700
		var r = ed.record;
32701
        var field = this.colModel.getDataIndex(ed.col);
32702
        value = this.postEditValue(value, startValue, r, field);
32703
        if(String(value) !== String(startValue)){
32704
            var e = {
32705
                grid: this,
32706
                record: r,
32707
                field: field,
32708
                originalValue: startValue,
32709
                value: value,
32710
                row: ed.row,
32711
                column: ed.col,
32712
                cancel:false
32713
            };
32714
            if(this.fireEvent("validateedit", e) !== false && !e.cancel){
32715
                r.set(field, e.value);
32716
                delete e.cancel;
32717
                this.fireEvent("afteredit", e);
32718
            }
32719
        }
32720
        this.view.focusCell(ed.row, ed.col);
32721
    },
32722
 
32723
 
32724
    startEditing : function(row, col){
32725
        this.stopEditing();
32726
        if(this.colModel.isCellEditable(col, row)){
32727
            this.view.ensureVisible(row, col, true);
32728
            var r = this.store.getAt(row);
32729
            var field = this.colModel.getDataIndex(col);
32730
            var e = {
32731
                grid: this,
32732
                record: r,
32733
                field: field,
32734
                value: r.data[field],
32735
                row: row,
32736
                column: col,
32737
                cancel:false
32738
            };
32739
            if(this.fireEvent("beforeedit", e) !== false && !e.cancel){
32740
                this.editing = true;
32741
                var ed = this.colModel.getCellEditor(col, row);
32742
                if(!ed.rendered){
32743
                    ed.render(this.view.getEditorParent(ed));
32744
                }
32745
                (function(){
32746
                    ed.row = row;
32747
                    ed.col = col;
32748
                    ed.record = r;
32749
                    ed.on("complete", this.onEditComplete, this, {single: true});
32750
                    ed.on("specialkey", this.selModel.onEditorKey, this.selModel);
32751
                    this.activeEditor = ed;
32752
                    var v = this.preEditValue(r, field);
32753
                    ed.startEdit(this.view.getCell(row, col), v);
32754
                }).defer(50, this);
32755
            }
32756
        }
32757
    },
32758
 
32759
	preEditValue : function(r, field){
32760
		return this.autoEncode && typeof value == 'string' ? Ext.util.Format.htmlDecode(r.data[field]) : r.data[field];
32761
	},
32762
 
32763
	postEditValue : function(value, originalValue, r, field){
32764
		return this.autoEncode && typeof value == 'string' ? Ext.util.Format.htmlEncode(value) : value;
32765
	},
32766
 
32767
 
32768
    stopEditing : function(cancel){
32769
        if(this.activeEditor){
32770
            this.activeEditor[cancel === true ? 'cancelEdit' : 'completeEdit']();
32771
        }
32772
        this.activeEditor = null;
32773
    }
32774
});
32775
Ext.reg('editorgrid', Ext.grid.EditorGridPanel);
32776
Ext.grid.GridEditor = function(field, config){
32777
    Ext.grid.GridEditor.superclass.constructor.call(this, field, config);
32778
    field.monitorTab = false;
32779
};
32780
 
32781
Ext.extend(Ext.grid.GridEditor, Ext.Editor, {
32782
    alignment: "tl-tl",
32783
    autoSize: "width",
32784
    hideEl : false,
32785
    cls: "x-small-editor x-grid-editor",
32786
    shim:false,
32787
    shadow:false
32788
});
32789
 
32790
Ext.grid.PropertyRecord = Ext.data.Record.create([
32791
    {name:'name',type:'string'}, 'value'
32792
]);
32793
 
32794
 
32795
Ext.grid.PropertyStore = function(grid, source){
32796
    this.grid = grid;
32797
    this.store = new Ext.data.Store({
32798
        recordType : Ext.grid.PropertyRecord
32799
    });
32800
    this.store.on('update', this.onUpdate,  this);
32801
    if(source){
32802
        this.setSource(source);
32803
    }
32804
    Ext.grid.PropertyStore.superclass.constructor.call(this);
32805
};
32806
Ext.extend(Ext.grid.PropertyStore, Ext.util.Observable, {
32807
        setSource : function(o){
32808
        this.source = o;
32809
        this.store.removeAll();
32810
        var data = [];
32811
        for(var k in o){
32812
            if(this.isEditableValue(o[k])){
32813
                data.push(new Ext.grid.PropertyRecord({name: k, value: o[k]}, k));
32814
            }
32815
        }
32816
        this.store.loadRecords({records: data}, {}, true);
32817
    },
32818
 
32819
        onUpdate : function(ds, record, type){
32820
        if(type == Ext.data.Record.EDIT){
32821
            var v = record.data['value'];
32822
            var oldValue = record.modified['value'];
32823
            if(this.grid.fireEvent('beforepropertychange', this.source, record.id, v, oldValue) !== false){
32824
                this.source[record.id] = v;
32825
                record.commit();
32826
                this.grid.fireEvent('propertychange', this.source, record.id, v, oldValue);
32827
            }else{
32828
                record.reject();
32829
            }
32830
        }
32831
    },
32832
 
32833
        getProperty : function(row){
32834
       return this.store.getAt(row);
32835
    },
32836
 
32837
        isEditableValue: function(val){
32838
        if(Ext.isDate(val)){
32839
            return true;
32840
        }else if(typeof val == 'object' || typeof val == 'function'){
32841
            return false;
32842
        }
32843
        return true;
32844
    },
32845
 
32846
        setValue : function(prop, value){
32847
        this.source[prop] = value;
32848
        this.store.getById(prop).set('value', value);
32849
    },
32850
 
32851
        getSource : function(){
32852
        return this.source;
32853
    }
32854
});
32855
 
32856
 
32857
Ext.grid.PropertyColumnModel = function(grid, store){
32858
    this.grid = grid;
32859
    var g = Ext.grid;
32860
    g.PropertyColumnModel.superclass.constructor.call(this, [
32861
        {header: this.nameText, width:50, sortable: true, dataIndex:'name', id: 'name', menuDisabled:true},
32862
        {header: this.valueText, width:50, resizable:false, dataIndex: 'value', id: 'value', menuDisabled:true}
32863
    ]);
32864
    this.store = store;
32865
    this.bselect = Ext.DomHelper.append(document.body, {
32866
        tag: 'select', cls: 'x-grid-editor x-hide-display', children: [
32867
            {tag: 'option', value: 'true', html: 'true'},
32868
            {tag: 'option', value: 'false', html: 'false'}
32869
        ]
32870
    });
32871
    var f = Ext.form;
32872
 
32873
    var bfield = new f.Field({
32874
        el:this.bselect,
32875
        bselect : this.bselect,
32876
        autoShow: true,
32877
        getValue : function(){
32878
            return this.bselect.value == 'true';
32879
        }
32880
    });
32881
    this.editors = {
32882
        'date' : new g.GridEditor(new f.DateField({selectOnFocus:true})),
32883
        'string' : new g.GridEditor(new f.TextField({selectOnFocus:true})),
32884
        'number' : new g.GridEditor(new f.NumberField({selectOnFocus:true, style:'text-align:left;'})),
32885
        'boolean' : new g.GridEditor(bfield)
32886
    };
32887
    this.renderCellDelegate = this.renderCell.createDelegate(this);
32888
    this.renderPropDelegate = this.renderProp.createDelegate(this);
32889
};
32890
 
32891
Ext.extend(Ext.grid.PropertyColumnModel, Ext.grid.ColumnModel, {
32892
        nameText : 'Name',
32893
    valueText : 'Value',
32894
    dateFormat : 'm/j/Y',
32895
 
32896
        renderDate : function(dateVal){
32897
        return dateVal.dateFormat(this.dateFormat);
32898
    },
32899
 
32900
        renderBool : function(bVal){
32901
        return bVal ? 'true' : 'false';
32902
    },
32903
 
32904
        isCellEditable : function(colIndex, rowIndex){
32905
        return colIndex == 1;
32906
    },
32907
 
32908
        getRenderer : function(col){
32909
        return col == 1 ?
32910
            this.renderCellDelegate : this.renderPropDelegate;
32911
    },
32912
 
32913
        renderProp : function(v){
32914
        return this.getPropertyName(v);
32915
    },
32916
 
32917
        renderCell : function(val){
32918
        var rv = val;
32919
        if(Ext.isDate(val)){
32920
            rv = this.renderDate(val);
32921
        }else if(typeof val == 'boolean'){
32922
            rv = this.renderBool(val);
32923
        }
32924
        return Ext.util.Format.htmlEncode(rv);
32925
    },
32926
 
32927
        getPropertyName : function(name){
32928
        var pn = this.grid.propertyNames;
32929
        return pn && pn[name] ? pn[name] : name;
32930
    },
32931
 
32932
        getCellEditor : function(colIndex, rowIndex){
32933
        var p = this.store.getProperty(rowIndex);
32934
        var n = p.data['name'], val = p.data['value'];
32935
        if(this.grid.customEditors[n]){
32936
            return this.grid.customEditors[n];
32937
        }
32938
        if(Ext.isDate(val)){
32939
            return this.editors['date'];
32940
        }else if(typeof val == 'number'){
32941
            return this.editors['number'];
32942
        }else if(typeof val == 'boolean'){
32943
            return this.editors['boolean'];
32944
        }else{
32945
            return this.editors['string'];
32946
        }
32947
    }
32948
});
32949
 
32950
 
32951
Ext.grid.PropertyGrid = Ext.extend(Ext.grid.EditorGridPanel, {
32952
 
32953
 
32954
 
32955
        enableColumnMove:false,
32956
    stripeRows:false,
32957
    trackMouseOver: false,
32958
    clicksToEdit:1,
32959
    enableHdMenu : false,
32960
    viewConfig : {
32961
        forceFit:true
32962
    },
32963
 
32964
        initComponent : function(){
32965
        this.customEditors = this.customEditors || {};
32966
        this.lastEditRow = null;
32967
        var store = new Ext.grid.PropertyStore(this);
32968
        this.propStore = store;
32969
        var cm = new Ext.grid.PropertyColumnModel(this, store);
32970
        store.store.sort('name', 'ASC');
32971
        this.addEvents(
32972
 
32973
            'beforepropertychange',
32974
 
32975
            'propertychange'
32976
        );
32977
        this.cm = cm;
32978
        this.ds = store.store;
32979
        Ext.grid.PropertyGrid.superclass.initComponent.call(this);
32980
 
32981
        this.selModel.on('beforecellselect', function(sm, rowIndex, colIndex){
32982
            if(colIndex === 0){
32983
                this.startEditing.defer(200, this, [rowIndex, 1]);
32984
                return false;
32985
            }
32986
        }, this);
32987
    },
32988
 
32989
        onRender : function(){
32990
        Ext.grid.PropertyGrid.superclass.onRender.apply(this, arguments);
32991
 
32992
        this.getGridEl().addClass('x-props-grid');
32993
    },
32994
 
32995
        afterRender: function(){
32996
        Ext.grid.PropertyGrid.superclass.afterRender.apply(this, arguments);
32997
        if(this.source){
32998
            this.setSource(this.source);
32999
        }
33000
    },
33001
 
33002
 
33003
    setSource : function(source){
33004
        this.propStore.setSource(source);
33005
    },
33006
 
33007
 
33008
    getSource : function(){
33009
        return this.propStore.getSource();
33010
    }
33011
});
33012
 
33013
Ext.grid.RowNumberer = function(config){
33014
    Ext.apply(this, config);
33015
    if(this.rowspan){
33016
        this.renderer = this.renderer.createDelegate(this);
33017
    }
33018
};
33019
 
33020
Ext.grid.RowNumberer.prototype = {
33021
 
33022
    header: "",
33023
 
33024
    width: 23,
33025
 
33026
    sortable: false,
33027
 
33028
 
33029
    fixed:true,
33030
    menuDisabled:true,
33031
    dataIndex: '',
33032
    id: 'numberer',
33033
    rowspan: undefined,
33034
 
33035
 
33036
    renderer : function(v, p, record, rowIndex){
33037
        if(this.rowspan){
33038
            p.cellAttr = 'rowspan="'+this.rowspan+'"';
33039
        }
33040
        return rowIndex+1;
33041
    }
33042
};
33043
 
33044
Ext.grid.CheckboxSelectionModel = Ext.extend(Ext.grid.RowSelectionModel, {
33045
 
33046
    header: '<div class="x-grid3-hd-checker">&#160;</div>',
33047
 
33048
    width: 20,
33049
 
33050
    sortable: false,
33051
 
33052
 
33053
    menuDisabled:true,
33054
    fixed:true,
33055
    dataIndex: '',
33056
    id: 'checker',
33057
 
33058
 
33059
    initEvents : function(){
33060
        Ext.grid.CheckboxSelectionModel.superclass.initEvents.call(this);
33061
        this.grid.on('render', function(){
33062
            var view = this.grid.getView();
33063
            view.mainBody.on('mousedown', this.onMouseDown, this);
33064
            Ext.fly(view.innerHd).on('mousedown', this.onHdMouseDown, this);
33065
 
33066
        }, this);
33067
    },
33068
 
33069
 
33070
    onMouseDown : function(e, t){
33071
        if(e.button === 0 && t.className == 'x-grid3-row-checker'){
33072
            e.stopEvent();
33073
            var row = e.getTarget('.x-grid3-row');
33074
            if(row){
33075
                var index = row.rowIndex;
33076
                if(this.isSelected(index)){
33077
                    this.deselectRow(index);
33078
                }else{
33079
                    this.selectRow(index, true);
33080
                }
33081
            }
33082
        }
33083
    },
33084
 
33085
 
33086
    onHdMouseDown : function(e, t){
33087
        if(t.className == 'x-grid3-hd-checker'){
33088
            e.stopEvent();
33089
            var hd = Ext.fly(t.parentNode);
33090
            var isChecked = hd.hasClass('x-grid3-hd-checker-on');
33091
            if(isChecked){
33092
                hd.removeClass('x-grid3-hd-checker-on');
33093
                this.clearSelections();
33094
            }else{
33095
                hd.addClass('x-grid3-hd-checker-on');
33096
                this.selectAll();
33097
            }
33098
        }
33099
    },
33100
 
33101
 
33102
    renderer : function(v, p, record){
33103
        return '<div class="x-grid3-row-checker">&#160;</div>';
33104
    }
33105
});
33106
 
33107
Ext.LoadMask = function(el, config){
33108
    this.el = Ext.get(el);
33109
    Ext.apply(this, config);
33110
    if(this.store){
33111
        this.store.on('beforeload', this.onBeforeLoad, this);
33112
        this.store.on('load', this.onLoad, this);
33113
        this.store.on('loadexception', this.onLoad, this);
33114
        this.removeMask = Ext.value(this.removeMask, false);
33115
    }else{
33116
        var um = this.el.getUpdater();
33117
        um.showLoadIndicator = false;         um.on('beforeupdate', this.onBeforeLoad, this);
33118
        um.on('update', this.onLoad, this);
33119
        um.on('failure', this.onLoad, this);
33120
        this.removeMask = Ext.value(this.removeMask, true);
33121
    }
33122
};
33123
 
33124
Ext.LoadMask.prototype = {
33125
 
33126
 
33127
 
33128
    msg : 'Loading...',
33129
 
33130
    msgCls : 'x-mask-loading',
33131
 
33132
 
33133
    disabled: false,
33134
 
33135
 
33136
    disable : function(){
33137
       this.disabled = true;
33138
    },
33139
 
33140
 
33141
    enable : function(){
33142
        this.disabled = false;
33143
    },
33144
 
33145
        onLoad : function(){
33146
        this.el.unmask(this.removeMask);
33147
    },
33148
 
33149
        onBeforeLoad : function(){
33150
        if(!this.disabled){
33151
            this.el.mask(this.msg, this.msgCls);
33152
        }
33153
    },
33154
 
33155
 
33156
    show: function(){
33157
        this.onBeforeLoad();
33158
    },
33159
 
33160
 
33161
    hide: function(){
33162
        this.onLoad();
33163
    },
33164
 
33165
        destroy : function(){
33166
        if(this.store){
33167
            this.store.un('beforeload', this.onBeforeLoad, this);
33168
            this.store.un('load', this.onLoad, this);
33169
            this.store.un('loadexception', this.onLoad, this);
33170
        }else{
33171
            var um = this.el.getUpdater();
33172
            um.un('beforeupdate', this.onBeforeLoad, this);
33173
            um.un('update', this.onLoad, this);
33174
            um.un('failure', this.onLoad, this);
33175
        }
33176
    }
33177
};
33178
 
33179
Ext.ProgressBar = Ext.extend(Ext.BoxComponent, {
33180
 
33181
    baseCls : 'x-progress',
33182
 
33183
 
33184
    waitTimer : null,
33185
 
33186
 
33187
    initComponent : function(){
33188
        Ext.ProgressBar.superclass.initComponent.call(this);
33189
        this.addEvents(
33190
 
33191
            "update"
33192
        );
33193
    },
33194
 
33195
 
33196
    onRender : function(ct, position){
33197
        Ext.ProgressBar.superclass.onRender.call(this, ct, position);
33198
 
33199
        var tpl = new Ext.Template(
33200
            '<div class="{cls}-wrap">',
33201
                '<div class="{cls}-inner">',
33202
                    '<div class="{cls}-bar">',
33203
                        '<div class="{cls}-text">',
33204
                            '<div>&#160;</div>',
33205
                        '</div>',
33206
                    '</div>',
33207
                    '<div class="{cls}-text {cls}-text-back">',
33208
                        '<div>&#160;</div>',
33209
                    '</div>',
33210
                '</div>',
33211
            '</div>'
33212
        );
33213
 
33214
        if(position){
33215
            this.el = tpl.insertBefore(position, {cls: this.baseCls}, true);
33216
        }else{
33217
            this.el = tpl.append(ct, {cls: this.baseCls}, true);
33218
        }
33219
        if(this.id){
33220
            this.el.dom.id = this.id;
33221
        }
33222
        var inner = this.el.dom.firstChild;
33223
        this.progressBar = Ext.get(inner.firstChild);
33224
 
33225
        if(this.textEl){
33226
 
33227
            this.textEl = Ext.get(this.textEl);
33228
            delete this.textTopEl;
33229
        }else{
33230
 
33231
            this.textTopEl = Ext.get(this.progressBar.dom.firstChild);
33232
            var textBackEl = Ext.get(inner.childNodes[1]);
33233
            this.textTopEl.setStyle("z-index", 99).addClass('x-hidden');
33234
            this.textEl = new Ext.CompositeElement([this.textTopEl.dom.firstChild, textBackEl.dom.firstChild]);
33235
            this.textEl.setWidth(inner.offsetWidth);
33236
        }
33237
        if(this.value){
33238
            this.updateProgress(this.value, this.text);
33239
        }else{
33240
            this.updateText(this.text);
33241
        }
33242
        this.setSize(this.width || 'auto', 'auto');
33243
        this.progressBar.setHeight(inner.offsetHeight);
33244
    },
33245
 
33246
 
33247
    updateProgress : function(value, text){
33248
        this.value = value || 0;
33249
        if(text){
33250
            this.updateText(text);
33251
        }
33252
        var w = Math.floor(value*this.el.dom.firstChild.offsetWidth);
33253
        this.progressBar.setWidth(w);
33254
        if(this.textTopEl){
33255
 
33256
            this.textTopEl.removeClass('x-hidden').setWidth(w);
33257
        }
33258
        this.fireEvent('update', this, value, text);
33259
        return this;
33260
    },
33261
 
33262
 
33263
    wait : function(o){
33264
        if(!this.waitTimer){
33265
            var scope = this;
33266
            o = o || {};
33267
            this.waitTimer = Ext.TaskMgr.start({
33268
                run: function(i){
33269
                    var inc = o.increment || 10;
33270
                    this.updateProgress(((((i+inc)%inc)+1)*(100/inc))*.01);
33271
                },
33272
                interval: o.interval || 1000,
33273
                duration: o.duration,
33274
                onStop: function(){
33275
                    if(o.fn){
33276
                        o.fn.apply(o.scope || this);
33277
                    }
33278
                    this.reset();
33279
                },
33280
                scope: scope
33281
            });
33282
        }
33283
        return this;
33284
    },
33285
 
33286
 
33287
    isWaiting : function(){
33288
        return this.waitTimer != null;
33289
    },
33290
 
33291
 
33292
    updateText : function(text){
33293
        this.text = text || '&#160;';
33294
        this.textEl.update(this.text);
33295
        return this;
33296
    },
33297
 
33298
 
33299
    setSize : function(w, h){
33300
        Ext.ProgressBar.superclass.setSize.call(this, w, h);
33301
        if(this.textTopEl){
33302
            var inner = this.el.dom.firstChild;
33303
            this.textEl.setSize(inner.offsetWidth, inner.offsetHeight);
33304
        }
33305
        return this;
33306
    },
33307
 
33308
 
33309
    reset : function(hide){
33310
        this.updateProgress(0);
33311
        if(this.textTopEl){
33312
            this.textTopEl.addClass('x-hidden');
33313
        }
33314
        if(this.waitTimer){
33315
            this.waitTimer.onStop = null;
33316
            Ext.TaskMgr.stop(this.waitTimer);
33317
            this.waitTimer = null;
33318
        }
33319
        if(hide === true){
33320
            this.hide();
33321
        }
33322
        return this;
33323
    }
33324
});
33325
Ext.reg('progress', Ext.ProgressBar);
33326
Ext.debug = {};
33327
 
33328
(function(){
33329
 
33330
var cp;
33331
 
33332
function createConsole(){
33333
 
33334
    var scriptPanel = new Ext.debug.ScriptsPanel();
33335
    var logView = new Ext.debug.LogPanel();
33336
    var tree = new Ext.debug.DomTree();
33337
 
33338
    var tabs = new Ext.TabPanel({
33339
        activeTab: 0,
33340
        border: false,
33341
        tabPosition: 'bottom',
33342
        items: [{
33343
            title: 'Debug Console',
33344
            layout:'border',
33345
            items: [logView, scriptPanel]
33346
        },{
33347
            title: 'DOM Inspector',
33348
            layout:'border',
33349
            items: [tree]
33350
        }]
33351
    });
33352
 
33353
    cp = new Ext.Panel({
33354
        id: 'x-debug-browser',
33355
        title: 'Console',
33356
        collapsible: true,
33357
        animCollapse: false,
33358
        style: 'position:absolute;left:0;bottom:0;',
33359
        height:200,
33360
        logView: logView,
33361
        layout: 'fit',
33362
 
33363
        tools:[{
33364
            id: 'close',
33365
            handler: function(){
33366
                cp.destroy();
33367
                cp = null;
33368
                Ext.EventManager.removeResizeListener(handleResize);
33369
            }
33370
        }],
33371
 
33372
        items: tabs
33373
    });
33374
 
33375
    cp.render(document.body);
33376
 
33377
    cp.resizer = new Ext.Resizable(cp.el, {
33378
        minHeight:50,
33379
        handles: "n",
33380
        pinned: true,
33381
        transparent:true,
33382
        resizeElement : function(){
33383
            var box = this.proxy.getBox();
33384
            this.proxy.hide();
33385
            cp.setHeight(box.height);
33386
            return box;
33387
        }
33388
    });
33389
 
33390
    function handleResize(){
33391
        cp.setWidth(Ext.getBody().getViewSize().width);
33392
    }
33393
    Ext.EventManager.onWindowResize(handleResize);
33394
 
33395
    handleResize();
33396
}
33397
 
33398
 
33399
Ext.apply(Ext, {
33400
    log : function(){
33401
        if(!cp){
33402
            createConsole();
33403
        }
33404
        cp.logView.log.apply(cp.logView, arguments);
33405
    },
33406
 
33407
    logf : function(format, arg1, arg2, etc){
33408
        Ext.log(String.format.apply(String, arguments));
33409
    },
33410
 
33411
    dump : function(o){
33412
        if(typeof o == 'string' || typeof o == 'number' || typeof o == 'undefined' || Ext.isDate(o)){
33413
            Ext.log(o);
33414
        }else if(!o){
33415
            Ext.log("null");
33416
        }else if(typeof o != "object"){
33417
            Ext.log('Unknown return type');
33418
        }else if(Ext.isArray(o)){
33419
            Ext.log('['+o.join(',')+']');
33420
        }else{
33421
            var b = ["{\n"];
33422
            for(var key in o){
33423
                var to = typeof o[key];
33424
                if(to != "function" && to != "object"){
33425
                    b.push(String.format("  {0}: {1},\n", key, o[key]));
33426
                }
33427
            }
33428
            var s = b.join("");
33429
            if(s.length > 3){
33430
                s = s.substr(0, s.length-2);
33431
            }
33432
            Ext.log(s + "\n}");
33433
        }
33434
    },
33435
 
33436
    _timers : {},
33437
 
33438
    time : function(name){
33439
        name = name || "def";
33440
        Ext._timers[name] = new Date().getTime();
33441
    },
33442
 
33443
    timeEnd : function(name, printResults){
33444
        var t = new Date().getTime();
33445
        name = name || "def";
33446
        var v = String.format("{0} ms", t-Ext._timers[name]);
33447
        Ext._timers[name] = new Date().getTime();
33448
        if(printResults !== false){
33449
            Ext.log('Timer ' + (name == "def" ? v : name + ": " + v));
33450
        }
33451
        return v;
33452
    }
33453
});
33454
 
33455
})();
33456
 
33457
 
33458
Ext.debug.ScriptsPanel = Ext.extend(Ext.Panel, {
33459
    id:'x-debug-scripts',
33460
    region: 'east',
33461
    minWidth: 200,
33462
    split: true,
33463
    width: 350,
33464
    border: false,
33465
    layout:'anchor',
33466
    style:'border-width:0 0 0 1px;',
33467
 
33468
    initComponent : function(){
33469
 
33470
        this.scriptField = new Ext.form.TextArea({
33471
            anchor: '100% -26',
33472
            style:'border-width:0;'
33473
        });
33474
 
33475
        this.trapBox = new Ext.form.Checkbox({
33476
            id: 'console-trap',
33477
            boxLabel: 'Trap Errors',
33478
            checked: true
33479
        });
33480
 
33481
        this.toolbar = new Ext.Toolbar([{
33482
                text: 'Run',
33483
                scope: this,
33484
                handler: this.evalScript
33485
            },{
33486
                text: 'Clear',
33487
                scope: this,
33488
                handler: this.clear
33489
            },
33490
            '->',
33491
            this.trapBox,
33492
            ' ', ' '
33493
        ]);
33494
 
33495
        this.items = [this.toolbar, this.scriptField];
33496
 
33497
        Ext.debug.ScriptsPanel.superclass.initComponent.call(this);
33498
    },
33499
 
33500
    evalScript : function(){
33501
        var s = this.scriptField.getValue();
33502
        if(this.trapBox.getValue()){
33503
            try{
33504
                var rt = eval(s);
33505
                Ext.dump(rt === undefined? '(no return)' : rt);
33506
            }catch(e){
33507
                Ext.log(e.message || e.descript);
33508
            }
33509
        }else{
33510
            var rt = eval(s);
33511
            Ext.dump(rt === undefined? '(no return)' : rt);
33512
        }
33513
    },
33514
 
33515
    clear : function(){
33516
        this.scriptField.setValue('');
33517
        this.scriptField.focus();
33518
    }
33519
 
33520
});
33521
 
33522
Ext.debug.LogPanel = Ext.extend(Ext.Panel, {
33523
    autoScroll: true,
33524
    region: 'center',
33525
    border: false,
33526
    style:'border-width:0 1px 0 0',
33527
 
33528
    log : function(){
33529
        var markup = [  '<div style="padding:5px !important;border-bottom:1px solid #ccc;">',
33530
                    Ext.util.Format.htmlEncode(Array.prototype.join.call(arguments, ', ')).replace(/\n/g, '<br />').replace(/\s/g, '&#160;'),
33531
                    '</div>'].join('');
33532
 
33533
        this.body.insertHtml('beforeend', markup);
33534
        this.body.scrollTo('top', 100000);
33535
    },
33536
 
33537
    clear : function(){
33538
        this.body.update('');
33539
        this.body.dom.scrollTop = 0;
33540
    }
33541
});
33542
 
33543
Ext.debug.DomTree = Ext.extend(Ext.tree.TreePanel, {
33544
    enableDD:false ,
33545
    lines:false,
33546
    rootVisible:false,
33547
    animate:false,
33548
    hlColor:'ffff9c',
33549
    autoScroll: true,
33550
    region:'center',
33551
    border:false,
33552
 
33553
    initComponent : function(){
33554
 
33555
 
33556
        Ext.debug.DomTree.superclass.initComponent.call(this);
33557
 
33558
                var styles = false, hnode;
33559
        var nonSpace = /^\s*$/;
33560
        var html = Ext.util.Format.htmlEncode;
33561
        var ellipsis = Ext.util.Format.ellipsis;
33562
        var styleRe = /\s?([a-z\-]*)\:([^;]*)(?:[;\s\n\r]*)/gi;
33563
 
33564
        function findNode(n){
33565
            if(!n || n.nodeType != 1 || n == document.body || n == document){
33566
                return false;
33567
            }
33568
            var pn = [n], p = n;
33569
            while((p = p.parentNode) && p.nodeType == 1 && p.tagName.toUpperCase() != 'HTML'){
33570
                pn.unshift(p);
33571
            }
33572
            var cn = hnode;
33573
            for(var i = 0, len = pn.length; i < len; i++){
33574
                cn.expand();
33575
                cn = cn.findChild('htmlNode', pn[i]);
33576
                if(!cn){                     return false;
33577
                }
33578
            }
33579
            cn.select();
33580
            var a = cn.ui.anchor;
33581
            treeEl.dom.scrollTop = Math.max(0 ,a.offsetTop-10);
33582
                        cn.highlight();
33583
            return true;
33584
        }
33585
 
33586
        function nodeTitle(n){
33587
            var s = n.tagName;
33588
            if(n.id){
33589
                s += '#'+n.id;
33590
            }else if(n.className){
33591
                s += '.'+n.className;
33592
            }
33593
            return s;
33594
        }
33595
 
33596
        function onNodeSelect(t, n, last){
33597
            return;
33598
            if(last && last.unframe){
33599
                last.unframe();
33600
            }
33601
            var props = {};
33602
            if(n && n.htmlNode){
33603
                if(frameEl.pressed){
33604
                    n.frame();
33605
                }
33606
                if(inspecting){
33607
                    return;
33608
                }
33609
                addStyle.enable();
33610
                reload.setDisabled(n.leaf);
33611
                var dom = n.htmlNode;
33612
                stylePanel.setTitle(nodeTitle(dom));
33613
                if(styles && !showAll.pressed){
33614
                    var s = dom.style ? dom.style.cssText : '';
33615
                    if(s){
33616
                        var m;
33617
                        while ((m = styleRe.exec(s)) != null){
33618
                            props[m[1].toLowerCase()] = m[2];
33619
                        }
33620
                    }
33621
                }else if(styles){
33622
                    var cl = Ext.debug.cssList;
33623
                    var s = dom.style, fly = Ext.fly(dom);
33624
                    if(s){
33625
                        for(var i = 0, len = cl.length; i<len; i++){
33626
                            var st = cl[i];
33627
                            var v = s[st] || fly.getStyle(st);
33628
                            if(v != undefined && v !== null && v !== ''){
33629
                                props[st] = v;
33630
                            }
33631
                        }
33632
                    }
33633
                }else{
33634
                    for(var a in dom){
33635
                        var v = dom[a];
33636
                        if((isNaN(a+10)) && v != undefined && v !== null && v !== '' && !(Ext.isGecko && a[0] == a[0].toUpperCase())){
33637
                            props[a] = v;
33638
                        }
33639
                    }
33640
                }
33641
            }else{
33642
                if(inspecting){
33643
                    return;
33644
                }
33645
                addStyle.disable();
33646
                reload.disabled();
33647
            }
33648
            stylesGrid.setSource(props);
33649
            stylesGrid.treeNode = n;
33650
            stylesGrid.view.fitColumns();
33651
        }
33652
 
33653
        this.loader = new Ext.tree.TreeLoader();
33654
        this.loader.load = function(n, cb){
33655
            var isBody = n.htmlNode == document.body;
33656
            var cn = n.htmlNode.childNodes;
33657
            for(var i = 0, c; c = cn[i]; i++){
33658
                if(isBody && c.id == 'x-debug-browser'){
33659
                    continue;
33660
                }
33661
                if(c.nodeType == 1){
33662
                    n.appendChild(new Ext.debug.HtmlNode(c));
33663
                }else if(c.nodeType == 3 && !nonSpace.test(c.nodeValue)){
33664
                    n.appendChild(new Ext.tree.TreeNode({
33665
                        text:'<em>' + ellipsis(html(String(c.nodeValue)), 35) + '</em>',
33666
                        cls: 'x-tree-noicon'
33667
                    }));
33668
                }
33669
            }
33670
            cb();
33671
        };
33672
 
33673
 
33674
        this.root = this.setRootNode(new Ext.tree.TreeNode('Ext'));
33675
 
33676
        hnode = this.root.appendChild(new Ext.debug.HtmlNode(
33677
                document.getElementsByTagName('html')[0]
33678
        ));
33679
 
33680
    }
33681
});
33682
 
33683
 
33684
Ext.debug.HtmlNode = function(){
33685
    var html = Ext.util.Format.htmlEncode;
33686
    var ellipsis = Ext.util.Format.ellipsis;
33687
    var nonSpace = /^\s*$/;
33688
 
33689
    var attrs = [
33690
        {n: 'id', v: 'id'},
33691
        {n: 'className', v: 'class'},
33692
        {n: 'name', v: 'name'},
33693
        {n: 'type', v: 'type'},
33694
        {n: 'src', v: 'src'},
33695
        {n: 'href', v: 'href'}
33696
    ];
33697
 
33698
    function hasChild(n){
33699
        for(var i = 0, c; c = n.childNodes[i]; i++){
33700
            if(c.nodeType == 1){
33701
                return true;
33702
            }
33703
        }
33704
        return false;
33705
    }
33706
 
33707
    function renderNode(n, leaf){
33708
        var tag = n.tagName.toLowerCase();
33709
        var s = '&lt;' + tag;
33710
        for(var i = 0, len = attrs.length; i < len; i++){
33711
            var a = attrs[i];
33712
            var v = n[a.n];
33713
            if(v && !nonSpace.test(v)){
33714
                s += ' ' + a.v + '=&quot;<i>' + html(v) +'</i>&quot;';
33715
            }
33716
        }
33717
        var style = n.style ? n.style.cssText : '';
33718
        if(style){
33719
            s += ' style=&quot;<i>' + html(style.toLowerCase()) +'</i>&quot;';
33720
        }
33721
        if(leaf && n.childNodes.length > 0){
33722
            s+='&gt;<em>' + ellipsis(html(String(n.innerHTML)), 35) + '</em>&lt;/'+tag+'&gt;';
33723
        }else if(leaf){
33724
            s += ' /&gt;';
33725
        }else{
33726
            s += '&gt;';
33727
        }
33728
        return s;
33729
    }
33730
 
33731
    var HtmlNode = function(n){
33732
        var leaf = !hasChild(n);
33733
        this.htmlNode = n;
33734
        this.tagName = n.tagName.toLowerCase();
33735
        var attr = {
33736
            text : renderNode(n, leaf),
33737
            leaf : leaf,
33738
            cls: 'x-tree-noicon'
33739
        };
33740
        HtmlNode.superclass.constructor.call(this, attr);
33741
        this.attributes.htmlNode = n;         if(!leaf){
33742
            this.on('expand', this.onExpand,  this);
33743
            this.on('collapse', this.onCollapse,  this);
33744
        }
33745
    };
33746
 
33747
 
33748
    Ext.extend(HtmlNode, Ext.tree.AsyncTreeNode, {
33749
        cls: 'x-tree-noicon',
33750
        preventHScroll: true,
33751
        refresh : function(highlight){
33752
            var leaf = !hasChild(this.htmlNode);
33753
            this.setText(renderNode(this.htmlNode, leaf));
33754
            if(highlight){
33755
                Ext.fly(this.ui.textNode).highlight();
33756
            }
33757
        },
33758
 
33759
        onExpand : function(){
33760
            if(!this.closeNode && this.parentNode){
33761
                this.closeNode = this.parentNode.insertBefore(new Ext.tree.TreeNode({
33762
                    text:'&lt;/' + this.tagName + '&gt;',
33763
                    cls: 'x-tree-noicon'
33764
                }), this.nextSibling);
33765
            }else if(this.closeNode){
33766
                this.closeNode.ui.show();
33767
            }
33768
        },
33769
 
33770
        onCollapse : function(){
33771
            if(this.closeNode){
33772
                this.closeNode.ui.hide();
33773
            }
33774
        },
33775
 
33776
        render : function(bulkRender){
33777
            HtmlNode.superclass.render.call(this, bulkRender);
33778
        },
33779
 
33780
        highlightNode : function(){
33781
                    },
33782
 
33783
        highlight : function(){
33784
                    },
33785
 
33786
        frame : function(){
33787
            this.htmlNode.style.border = '1px solid #0000ff';
33788
                    },
33789
 
33790
        unframe : function(){
33791
                        this.htmlNode.style.border = '';
33792
        }
33793
    });
33794
 
33795
    return HtmlNode;
33796
}();
33797
 
33798
 
33799