source: trunk/web/addons/job_monarch/lib/extjs/air/src/ext-air-adapter.js @ 619

Last change on this file since 619 was 619, checked in by ramonb, 15 years ago

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 26.3 KB
Line 
1/*
2 * Ext JS Library 0.30
3 * Copyright(c) 2006-2009, Ext JS, LLC.
4 * licensing@extjs.com
5 *
6 * http://extjs.com/license
7 */
8
9/*
10 * This file corrects air eval issues and other issues found in the AIR application sandbox
11 */
12Ext.namespace('Ext.air', 'Ext.sql');
13
14Ext.Template.prototype.compile = function() {
15        var fm = Ext.util.Format;
16        var useF = this.disableFormats !== true;
17        //
18        var prevOffset = 0;
19        var arr = [];
20        var tpl = this;
21        var fn = function(m, name, format, args, offset, s){
22                if (prevOffset != offset) {
23                        var action = {type: 1, value: s.substr(prevOffset, offset - prevOffset)};
24                        arr.push(action);
25                }
26                prevOffset = offset + m.length;
27                if(format && useF){
28                                if (args) {
29                                        var re = /^\s*['"](.*)["']\s*$/;
30                                        args = args.split(/,(?=(?:[^"]*"[^"]*")*(?![^"]*"))/);
31                                        for(var i = 0, len = args.length; i < len; i++){
32                                                args[i] = args[i].replace(re, "$1");
33                                        }
34                                        args = [''].concat(args);
35                                } else {
36                                                args = [''];
37                                }
38                        if(format.substr(0, 5) != "this."){
39                                var action = {type: 3, value:name, format: fm[format], args: args, scope: fm};
40                                arr.push(action);                                       
41                        }else{
42                                var action = {type: 3, value:name, format:tpl[format.substr(5)], args:args, scope: tpl};
43                                arr.push(action);                                       
44                        }
45                }else{
46                        var action  = {type: 2, value: name};
47                        arr.push(action);                               
48                }
49                return m;
50        };
51       
52        var s = this.html.replace(this.re, fn);
53        if (prevOffset != (s.length - 1)) {
54                var action = {type: 1, value: s.substr(prevOffset, s.length - prevOffset)};
55                arr.push(action);
56        }
57
58        this.compiled = function(values) {
59                function applyValues(el) {
60                        switch (el.type) {
61                                        case 1:
62                                                        return el.value;
63                                        case 2:
64                                                        return (values[el.value] ? values[el.value] : '');
65                                        default:
66                                                        el.args[0] = values[el.value];
67                                                        return el.format.apply(el.scope, el.args);
68                        }
69                }       
70                return arr.map(applyValues).join('');
71        }
72        return this;
73};
74
75Ext.Template.prototype.call = function(fnName, value, allValues){
76    return this[fnName](value, allValues);
77}
78
79
80Ext.DomQuery = function(){
81    var cache = {}, simpleCache = {}, valueCache = {};
82    var nonSpace = /\S/;
83    var trimRe = /^\s+|\s+$/g;
84    var tplRe = /\{(\d+)\}/g;
85    var modeRe = /^(\s?[\/>+~]\s?|\s|$)/;
86    var tagTokenRe = /^(#)?([\w-\*]+)/;
87    var nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/;
88
89    function child(p, index){
90        var i = 0;
91        var n = p.firstChild;
92        while(n){
93            if(n.nodeType == 1){
94               if(++i == index){
95                   return n;
96               }
97            }
98            n = n.nextSibling;
99        }
100        return null;
101    };
102
103    function next(n){
104        while((n = n.nextSibling) && n.nodeType != 1);
105        return n;
106    };
107
108    function prev(n){
109        while((n = n.previousSibling) && n.nodeType != 1);
110        return n;
111    };
112
113    function children(d){
114        var n = d.firstChild, ni = -1;
115            while(n){
116                var nx = n.nextSibling;
117                if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
118                    d.removeChild(n);
119                }else{
120                    n.nodeIndex = ++ni;
121                }
122                n = nx;
123            }
124            return this;
125        };
126
127    function byClassName(c, a, v){
128        if(!v){
129            return c;
130        }
131        var r = [], ri = -1, cn;
132        for(var i = 0, ci; ci = c[i]; i++){
133            if((' '+ci.className+' ').indexOf(v) != -1){
134                r[++ri] = ci;
135            }
136        }
137        return r;
138    };
139
140    function attrValue(n, attr){
141        if(!n.tagName && typeof n.length != "undefined"){
142            n = n[0];
143        }
144        if(!n){
145            return null;
146        }
147        if(attr == "for"){
148            return n.htmlFor;
149        }
150        if(attr == "class" || attr == "className"){
151            return n.className;
152        }
153        return n.getAttribute(attr) || n[attr];
154
155    };
156
157    function getNodes(ns, mode, tagName){
158        var result = [], ri = -1, cs;
159        if(!ns){
160            return result;
161        }
162        tagName = tagName || "*";
163        if(typeof ns.getElementsByTagName != "undefined"){
164            ns = [ns];
165        }
166        if(!mode){
167            for(var i = 0, ni; ni = ns[i]; i++){
168                cs = ni.getElementsByTagName(tagName);
169                for(var j = 0, ci; ci = cs[j]; j++){
170                    result[++ri] = ci;
171                }
172            }
173        }else if(mode == "/" || mode == ">"){
174            var utag = tagName.toUpperCase();
175            for(var i = 0, ni, cn; ni = ns[i]; i++){
176                cn = ni.children || ni.childNodes;
177                for(var j = 0, cj; cj = cn[j]; j++){
178                    if(cj.nodeName == utag || cj.nodeName == tagName  || tagName == '*'){
179                        result[++ri] = cj;
180                    }
181                }
182            }
183        }else if(mode == "+"){
184            var utag = tagName.toUpperCase();
185            for(var i = 0, n; n = ns[i]; i++){
186                while((n = n.nextSibling) && n.nodeType != 1);
187                if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
188                    result[++ri] = n;
189                }
190            }
191        }else if(mode == "~"){
192            for(var i = 0, n; n = ns[i]; i++){
193                while((n = n.nextSibling) && (n.nodeType != 1 || (tagName == '*' || n.tagName.toLowerCase()!=tagName)));
194                if(n){
195                    result[++ri] = n;
196                }
197            }
198        }
199        return result;
200    };
201
202    function concat(a, b){
203        if(b.slice){
204            return a.concat(b);
205        }
206        for(var i = 0, l = b.length; i < l; i++){
207            a[a.length] = b[i];
208        }
209        return a;
210    }
211
212    function byTag(cs, tagName){
213        if(cs.tagName || cs == document){
214            cs = [cs];
215        }
216        if(!tagName){
217            return cs;
218        }
219        var r = [], ri = -1;
220        tagName = tagName.toLowerCase();
221        for(var i = 0, ci; ci = cs[i]; i++){
222            if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){
223                r[++ri] = ci;
224            }
225        }
226        return r;
227    };
228
229    function byId(cs, attr, id){
230        if(cs.tagName || cs == document){
231            cs = [cs];
232        }
233        if(!id){
234            return cs;
235        }
236        var r = [], ri = -1;
237        for(var i = 0,ci; ci = cs[i]; i++){
238            if(ci && ci.id == id){
239                r[++ri] = ci;
240                return r;
241            }
242        }
243        return r;
244    };
245
246    function byAttribute(cs, attr, value, op, custom){
247        var r = [], ri = -1, st = custom=="{";
248        var f = Ext.DomQuery.operators[op];
249        for(var i = 0, ci; ci = cs[i]; i++){
250            var a;
251            if(st){
252                a = Ext.DomQuery.getStyle(ci, attr);
253            }
254            else if(attr == "class" || attr == "className"){
255                a = ci.className;
256            }else if(attr == "for"){
257                a = ci.htmlFor;
258            }else if(attr == "href"){
259                a = ci.getAttribute("href", 2);
260            }else{
261                a = ci.getAttribute(attr);
262            }
263            if((f && f(a, value)) || (!f && a)){
264                r[++ri] = ci;
265            }
266        }
267        return r;
268    };
269
270    function byPseudo(cs, name, value){
271        return Ext.DomQuery.pseudos[name](cs, value);
272    };
273
274 
275    // this eval is stop the compressor from
276    // renaming the variable to something shorter
277    eval("var batch = 30803;");
278
279    var key = 30803;
280
281    function nodup(cs){
282        if(!cs){
283            return [];
284        }
285        var len = cs.length, c, i, r = cs, cj, ri = -1;
286        if(!len || typeof cs.nodeType != "undefined" || len == 1){
287            return cs;
288        }
289        var d = ++key;
290        cs[0]._nodup = d;
291        for(i = 1; c = cs[i]; i++){
292            if(c._nodup != d){
293                c._nodup = d;
294            }else{
295                r = [];
296                for(var j = 0; j < i; j++){
297                    r[++ri] = cs[j];
298                }
299                for(j = i+1; cj = cs[j]; j++){
300                    if(cj._nodup != d){
301                        cj._nodup = d;
302                        r[++ri] = cj;
303                    }
304                }
305                return r;
306            }
307        }
308        return r;
309    }
310
311    function quickDiff(c1, c2){
312        var len1 = c1.length;
313        if(!len1){
314            return c2;
315        }
316        var d = ++key;
317        for(var i = 0; i < len1; i++){
318            c1[i]._qdiff = d;
319        }
320        var r = [];
321        for(var i = 0, len = c2.length; i < len; i++){
322            if(c2[i]._qdiff != d){
323                r[r.length] = c2[i];
324            }
325        }
326        return r;
327    }
328
329    function quickId(ns, mode, root, id){
330        if(ns == root){
331           var d = root.ownerDocument || root;
332           return d.getElementById(id);
333        }
334        ns = getNodes(ns, mode, "*");
335            return byId(ns, null, id);
336    }
337
338       function search(path, root, type) {
339                    type = type || "select";
340            //
341            var n = root || document;
342            //
343            var q = path, mode, lq;
344            var tk = Ext.DomQuery.matchers;
345            var tklen = tk.length;
346            var mm;
347
348            var lmode = q.match(modeRe);
349            if(lmode && lmode[1]){
350                mode=lmode[1].replace(trimRe, "");
351                q = q.replace(lmode[1], "");
352            }
353            while(path.substr(0, 1)=="/"){
354                path = path.substr(1);
355            }
356            while(q && lq != q){
357                lq = q;
358                var tm = q.match(tagTokenRe);
359                if(type == "select"){
360                    if(tm){
361                        if(tm[1] == "#"){
362                            n = quickId(n, mode, root, tm[2]);
363                        }else{
364                            n = getNodes(n, mode, tm[2]);
365                        }
366                        q = q.replace(tm[0], "");
367                    }else if(q.substr(0, 1) != '@'){
368                        n = getNodes(n, mode, "*");
369                    }
370                }else{
371                    if(tm){
372                        if(tm[1] == "#"){
373                            n = byId(n, null, tm[2]);
374                        }else{
375                            n = byTag(n, tm[2]);
376                        }
377                        q = q.replace(tm[0], "");
378                    }
379                }
380                while(!(mm = q.match(modeRe))){
381                    var matched = false;
382                    for(var j = 0; j < tklen; j++){
383                        var t = tk[j];
384                        var m = q.match(t.re);
385                        if(m){
386                            switch(j) {
387                                case 0:
388                                    n = byClassName(n, null, " " + m[1] +" ");
389                                    break;
390                                case 1:
391                                    n = byPseudo(n, m[1], m[2]);
392                                    break;
393                                case 2:
394                                    n = byAttribute(n, m[2], m[4], m[3], m[1]);
395                                    break;
396                                case 3:
397                                    n = byId(n, null, m[1]);
398                                    break;
399                                case 4:
400                                    return {firstChild:{nodeValue:attrValue(n, m[1])}};
401                                   
402                            }
403                            q = q.replace(m[0], "");
404                            matched = true;
405                            break;
406                        }
407                    }
408
409                    if(!matched){
410                        throw 'Error parsing selector, parsing failed at "' + q + '"';
411                    }
412                }
413                if(mm[1]){
414                    mode=mm[1].replace(trimRe, "");
415                    q = q.replace(mm[1], "");
416                }
417            }
418            return nodup(n);
419        }               
420
421     return {
422        getStyle : function(el, name){
423             return Ext.fly(el).getStyle(name);
424        },
425               
426                compile: function(path, type) {
427                        return function(root) {
428                                        return search(path, root, type);
429                        }
430                },
431
432        /**
433         * Selects a group of elements.
434         * @param {String} selector The selector/xpath query (can be a comma separated list of selectors)
435         * @param {Node} root (optional) The start of the query (defaults to document).
436         * @return {Array}
437         */
438        select : function(path, root, type){
439            if(!root || root == document){
440                root = document;
441            }
442            if(typeof root == "string"){
443                root = document.getElementById(root);
444            }
445            var paths = path.split(",");
446            var results = [];
447            for(var i = 0, len = paths.length; i < len; i++){
448                var p = paths[i].replace(trimRe, "");
449                if(!cache[p]){
450                    cache[p] = Ext.DomQuery.compile(p);
451                    if(!cache[p]){
452                        throw p + " is not a valid selector";
453                    }
454                }
455                var result = cache[p](root);
456                if(result && result != document){
457                    results = results.concat(result);
458                }
459            }
460            if(paths.length > 1){
461                return nodup(results);
462            }
463            return results;
464        },
465
466        /**
467         * Selects a single element.
468         * @param {String} selector The selector/xpath query
469         * @param {Node} root (optional) The start of the query (defaults to document).
470         * @return {Element}
471         */
472        selectNode : function(path, root){
473            return Ext.DomQuery.select(path, root)[0];
474        },
475
476        /**
477         * Selects the value of a node, optionally replacing null with the defaultValue.
478         * @param {String} selector The selector/xpath query
479         * @param {Node} root (optional) The start of the query (defaults to document).
480         * @param {String} defaultValue
481         */
482        selectValue : function(path, root, defaultValue){
483            path = path.replace(trimRe, "");
484            if(!valueCache[path]){
485                valueCache[path] = Ext.DomQuery.compile(path, "select");
486            }
487            var n = valueCache[path](root);
488            n = n[0] ? n[0] : n;
489            var v = (n && n.firstChild ? n.firstChild.nodeValue : null);
490            return ((v === null||v === undefined||v==='') ? defaultValue : v);
491        },
492
493        /**
494         * Selects the value of a node, parsing integers and floats.
495         * @param {String} selector The selector/xpath query
496         * @param {Node} root (optional) The start of the query (defaults to document).
497         * @param {Number} defaultValue
498         * @return {Number}
499         */
500        selectNumber : function(path, root, defaultValue){
501            var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
502            return parseFloat(v);
503        },
504
505        /**
506         * Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)
507         * @param {String/HTMLElement/Array} el An element id, element or array of elements
508         * @param {String} selector The simple selector to test
509         * @return {Boolean}
510         */
511        is : function(el, ss){
512            if(typeof el == "string"){
513                el = document.getElementById(el);
514            }
515            var isArray = Ext.isArray(el);
516            var result = Ext.DomQuery.filter(isArray ? el : [el], ss);
517            return isArray ? (result.length == el.length) : (result.length > 0);
518        },
519
520        /**
521         * Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)
522         * @param {Array} el An array of elements to filter
523         * @param {String} selector The simple selector to test
524         * @param {Boolean} nonMatches If true, it returns the elements that DON'T match
525         * the selector instead of the ones that match
526         * @return {Array}
527         */
528        filter : function(els, ss, nonMatches){
529            ss = ss.replace(trimRe, "");
530            if(!simpleCache[ss]){
531                simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
532            }
533            var result = simpleCache[ss](els);
534            return nonMatches ? quickDiff(result, els) : result;
535        },
536
537        /**
538         * Collection of matching regular expressions and code snippets.
539         */
540        matchers : [{
541                re: /^\.([\w-]+)/,
542                select: 'n = byClassName(n, null, " {1} ");'
543            }, {
544                re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
545                select: 'n = byPseudo(n, "{1}", "{2}");'
546            },{
547                re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
548                select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
549            }, {
550                re: /^#([\w-]+)/,
551                select: 'n = byId(n, null, "{1}");'
552            },{
553                re: /^@([\w-]+)/,
554                select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
555            }
556        ],
557
558        /**
559         * Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.
560         * New operators can be added as long as the match the format <i>c</i>= where <i>c</i> is any character other than space, &gt; &lt;.
561         */
562        operators : {
563            "=" : function(a, v){
564                return a == v;
565            },
566            "!=" : function(a, v){
567                return a != v;
568            },
569            "^=" : function(a, v){
570                return a && a.substr(0, v.length) == v;
571            },
572            "$=" : function(a, v){
573                return a && a.substr(a.length-v.length) == v;
574            },
575            "*=" : function(a, v){
576                return a && a.indexOf(v) !== -1;
577            },
578            "%=" : function(a, v){
579                return (a % v) == 0;
580            },
581            "|=" : function(a, v){
582                return a && (a == v || a.substr(0, v.length+1) == v+'-');
583            },
584            "~=" : function(a, v){
585                return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
586            }
587        },
588
589        /**
590         * Collection of "pseudo class" processors. Each processor is passed the current nodeset (array)
591         * and the argument (if any) supplied in the selector.
592         */
593        pseudos : {
594            "first-child" : function(c){
595                var r = [], ri = -1, n;
596                for(var i = 0, ci; ci = n = c[i]; i++){
597                    while((n = n.previousSibling) && n.nodeType != 1);
598                    if(!n){
599                        r[++ri] = ci;
600                    }
601                }
602                return r;
603            },
604
605            "last-child" : function(c){
606                var r = [], ri = -1, n;
607                for(var i = 0, ci; ci = n = c[i]; i++){
608                    while((n = n.nextSibling) && n.nodeType != 1);
609                    if(!n){
610                        r[++ri] = ci;
611                    }
612                }
613                return r;
614            },
615
616            "nth-child" : function(c, a) {
617                var r = [], ri = -1;
618                var m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a);
619                var f = (m[1] || 1) - 0, l = m[2] - 0;
620                for(var i = 0, n; n = c[i]; i++){
621                    var pn = n.parentNode;
622                    if (batch != pn._batch) {
623                        var j = 0;
624                        for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
625                            if(cn.nodeType == 1){
626                               cn.nodeIndex = ++j;
627                            }
628                        }
629                        pn._batch = batch;
630                    }
631                    if (f == 1) {
632                        if (l == 0 || n.nodeIndex == l){
633                            r[++ri] = n;
634                        }
635                    } else if ((n.nodeIndex + l) % f == 0){
636                        r[++ri] = n;
637                    }
638                }
639
640                return r;
641            },
642
643            "only-child" : function(c){
644                var r = [], ri = -1;;
645                for(var i = 0, ci; ci = c[i]; i++){
646                    if(!prev(ci) && !next(ci)){
647                        r[++ri] = ci;
648                    }
649                }
650                return r;
651            },
652
653            "empty" : function(c){
654                var r = [], ri = -1;
655                for(var i = 0, ci; ci = c[i]; i++){
656                    var cns = ci.childNodes, j = 0, cn, empty = true;
657                    while(cn = cns[j]){
658                        ++j;
659                        if(cn.nodeType == 1 || cn.nodeType == 3){
660                            empty = false;
661                            break;
662                        }
663                    }
664                    if(empty){
665                        r[++ri] = ci;
666                    }
667                }
668                return r;
669            },
670
671            "contains" : function(c, v){
672                var r = [], ri = -1;
673                for(var i = 0, ci; ci = c[i]; i++){
674                    if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
675                        r[++ri] = ci;
676                    }
677                }
678                return r;
679            },
680
681            "nodeValue" : function(c, v){
682                var r = [], ri = -1;
683                for(var i = 0, ci; ci = c[i]; i++){
684                    if(ci.firstChild && ci.firstChild.nodeValue == v){
685                        r[++ri] = ci;
686                    }
687                }
688                return r;
689            },
690
691            "checked" : function(c){
692                var r = [], ri = -1;
693                for(var i = 0, ci; ci = c[i]; i++){
694                    if(ci.checked == true){
695                        r[++ri] = ci;
696                    }
697                }
698                return r;
699            },
700
701            "not" : function(c, ss){
702                return Ext.DomQuery.filter(c, ss, true);
703            },
704
705            "any" : function(c, selectors){
706                var ss = selectors.split('|');
707                var r = [], ri = -1, s;
708                for(var i = 0, ci; ci = c[i]; i++){
709                    for(var j = 0; s = ss[j]; j++){
710                        if(Ext.DomQuery.is(ci, s)){
711                            r[++ri] = ci;
712                            break;
713                        }
714                    }
715                }
716                return r;
717            },
718
719            "odd" : function(c){
720                return this["nth-child"](c, "odd");
721            },
722
723            "even" : function(c){
724                return this["nth-child"](c, "even");
725            },
726
727            "nth" : function(c, a){
728                return c[a-1] || [];
729            },
730
731            "first" : function(c){
732                return c[0] || [];
733            },
734
735            "last" : function(c){
736                return c[c.length-1] || [];
737            },
738
739            "has" : function(c, ss){
740                var s = Ext.DomQuery.select;
741                var r = [], ri = -1;
742                for(var i = 0, ci; ci = c[i]; i++){
743                    if(s(ss, ci).length > 0){
744                        r[++ri] = ci;
745                    }
746                }
747                return r;
748            },
749
750            "next" : function(c, ss){
751                var is = Ext.DomQuery.is;
752                var r = [], ri = -1;
753                for(var i = 0, ci; ci = c[i]; i++){
754                    var n = next(ci);
755                    if(n && is(n, ss)){
756                        r[++ri] = ci;
757                    }
758                }
759                return r;
760            },
761
762            "prev" : function(c, ss){
763                var is = Ext.DomQuery.is;
764                var r = [], ri = -1;
765                for(var i = 0, ci; ci = c[i]; i++){
766                    var n = prev(ci);
767                    if(n && is(n, ss)){
768                        r[++ri] = ci;
769                    }
770                }
771                return r;
772            }
773        }
774    };
775}();
776
777Ext.query = Ext.DomQuery.select;
778
779Date.precompileFormats = function(s){
780        var formats = s.split('|');
781        for(var i = 0, len = formats.length;i < len;i++){
782                Date.createNewFormat(formats[i]);
783                Date.createParser(formats[i]);
784        }
785}
786
787Date.precompileFormats("D n/j/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|YmdHis|F d, Y|l, F d, Y|H:i:s|g:i A|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|m/d/y|m/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d|Y-m-d H:i:s|d/m/y|d/m/Y|d-m-y|d-m-Y|d/m|d-m|dm|dmy|dmY|Y-m-d|l|D m/d|D m/d/Y|m/d/Y");
788
789// precompile instead of lazy init
790Ext.ColorPalette.prototype.tpl = new Ext.XTemplate(
791    '<tpl for="."><a href="#" class="color-{.}" hidefocus="on"><em><span style="background:#{.}" unselectable="on">&#160;</span></em></a></tpl>'
792);
793
794
795// Unique task ids, if the time isn't unique enough, the addition
796// of random chars should be
797Ext.uniqueId = function(){
798        var t = String(new Date().getTime()).substr(4);
799        var s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
800        for(var i = 0; i < 4; i++){
801                t += s.charAt(Math.floor(Math.random()*26));
802        }
803        return t;
804};
805
806Ext.data.JsonReader.override({
807    getJsonAccessor: function(){
808        var re = /[\[\.]/;
809        return function(expr) {
810            try {
811                if (re.test(expr)) {
812                        var arr = expr.split('.');
813                        var ln = arr.length;
814                        return function(obj) {                         
815                                var l = obj;
816                                for (var i = 0; i < ln; i++) {
817                                        l = l[arr[i]];
818                                }
819                                return l;                               
820                        };
821                } else {
822                        return function(obj){
823                                return obj[expr];
824                        };
825                }
826            } catch(e){
827                Ext.air.dir(e);
828            }
829            return Ext.emptyFn;
830        };
831    }()
832});
833
834
Note: See TracBrowser for help on using the repository browser.