-
-
-Ext.ns("Ext.grid", "Ext.list", "Ext.dd", "Ext.tree", "Ext.form", "Ext.menu",
- "Ext.state", "Ext.layout", "Ext.app", "Ext.ux", "Ext.chart", "Ext.direct");
-
-
-Ext.apply(Ext, function(){
- var E = Ext,
- idSeed = 0,
- scrollWidth = null;
-
- return {
-
- emptyFn : function(){},
-
-
- BLANK_IMAGE_URL : Ext.isIE6 || Ext.isIE7 || Ext.isAir ?
- 'http:/' + '/www.extjs.com/s.gif' :
- 'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
-
- extendX : function(supr, fn){
- return Ext.extend(supr, fn(supr.prototype));
- },
-
-
- getDoc : function(){
- return Ext.get(document);
- },
-
-
- num : function(v, defaultValue){
- v = Number(Ext.isEmpty(v) || Ext.isArray(v) || typeof v == 'boolean' || (typeof v == 'string' && v.trim().length == 0) ? NaN : v);
- return isNaN(v) ? defaultValue : v;
- },
-
-
- value : function(v, defaultValue, allowBlank){
- return Ext.isEmpty(v, allowBlank) ? defaultValue : v;
- },
-
-
- escapeRe : function(s) {
- return s.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1");
- },
-
- sequence : function(o, name, fn, scope){
- o[name] = o[name].createSequence(fn, scope);
- },
-
-
- addBehaviors : function(o){
- if(!Ext.isReady){
- Ext.onReady(function(){
- Ext.addBehaviors(o);
- });
- } else {
- var cache = {},
- parts,
- b,
- s;
- for (b in o) {
- if ((parts = b.split('@'))[1]) {
- s = parts[0];
- if(!cache[s]){
- cache[s] = Ext.select(s);
- }
- cache[s].on(parts[1], o[b]);
- }
- }
- cache = null;
- }
- },
-
-
- getScrollBarWidth: function(force){
- if(!Ext.isReady){
- return 0;
- }
-
- if(force === true || scrollWidth === null){
-
- var div = Ext.getBody().createChild('<div class="x-hide-offsets" style="width:100px;height:50px;overflow:hidden;"><div style="height:200px;"></div></div>'),
- child = div.child('div', true);
- var w1 = child.offsetWidth;
- div.setStyle('overflow', (Ext.isWebKit || Ext.isGecko) ? 'auto' : 'scroll');
- var w2 = child.offsetWidth;
- div.remove();
-
- scrollWidth = w1 - w2 + 2;
- }
- return scrollWidth;
- },
-
-
-
- combine : function(){
- var as = arguments, l = as.length, r = [];
- for(var i = 0; i < l; i++){
- var a = as[i];
- if(Ext.isArray(a)){
- r = r.concat(a);
- }else if(a.length !== undefined && !a.substr){
- r = r.concat(Array.prototype.slice.call(a, 0));
- }else{
- r.push(a);
- }
- }
- return r;
- },
-
-
- copyTo : function(dest, source, names){
- if(typeof names == 'string'){
- names = names.split(/[,;\s]/);
- }
- Ext.each(names, function(name){
- if(source.hasOwnProperty(name)){
- dest[name] = source[name];
- }
- }, this);
- return dest;
- },
-
-
- destroy : function(){
- Ext.each(arguments, function(arg){
- if(arg){
- if(Ext.isArray(arg)){
- this.destroy.apply(this, arg);
- }else if(typeof arg.destroy == 'function'){
- arg.destroy();
- }else if(arg.dom){
- arg.remove();
- }
- }
- }, this);
- },
-
-
- destroyMembers : function(o, arg1, arg2, etc){
- for(var i = 1, a = arguments, len = a.length; i < len; i++) {
- Ext.destroy(o[a[i]]);
- delete o[a[i]];
- }
- },
-
-
- clean : function(arr){
- var ret = [];
- Ext.each(arr, function(v){
- if(!!v){
- ret.push(v);
- }
- });
- return ret;
- },
-
-
- unique : function(arr){
- var ret = [],
- collect = {};
-
- Ext.each(arr, function(v) {
- if(!collect[v]){
- ret.push(v);
- }
- collect[v] = true;
- });
- return ret;
- },
-
-
- flatten : function(arr){
- var worker = [];
- function rFlatten(a) {
- Ext.each(a, function(v) {
- if(Ext.isArray(v)){
- rFlatten(v);
- }else{
- worker.push(v);
- }
- });
- return worker;
- }
- return rFlatten(arr);
- },
-
-
- min : function(arr, comp){
- var ret = arr[0];
- comp = comp || function(a,b){ return a < b ? -1 : 1; };
- Ext.each(arr, function(v) {
- ret = comp(ret, v) == -1 ? ret : v;
- });
- return ret;
- },
-
-
- max : function(arr, comp){
- var ret = arr[0];
- comp = comp || function(a,b){ return a > b ? 1 : -1; };
- Ext.each(arr, function(v) {
- ret = comp(ret, v) == 1 ? ret : v;
- });
- return ret;
- },
-
-
- mean : function(arr){
- return arr.length > 0 ? Ext.sum(arr) / arr.length : undefined;
- },
-
-
- sum : function(arr){
- var ret = 0;
- Ext.each(arr, function(v) {
- ret += v;
- });
- return ret;
- },
-
-
- partition : function(arr, truth){
- var ret = [[],[]];
- Ext.each(arr, function(v, i, a) {
- ret[ (truth && truth(v, i, a)) || (!truth && v) ? 0 : 1].push(v);
- });
- return ret;
- },
-
-
- invoke : function(arr, methodName){
- var ret = [],
- args = Array.prototype.slice.call(arguments, 2);
- Ext.each(arr, function(v,i) {
- if (v && typeof v[methodName] == 'function') {
- ret.push(v[methodName].apply(v, args));
- } else {
- ret.push(undefined);
- }
- });
- return ret;
- },
-
-
- pluck : function(arr, prop){
- var ret = [];
- Ext.each(arr, function(v) {
- ret.push( v[prop] );
- });
- return ret;
- },
-
-
- zip : function(){
- var parts = Ext.partition(arguments, function( val ){ return typeof val != 'function'; }),
- arrs = parts[0],
- fn = parts[1][0],
- len = Ext.max(Ext.pluck(arrs, "length")),
- ret = [];
-
- for (var i = 0; i < len; i++) {
- ret[i] = [];
- if(fn){
- ret[i] = fn.apply(fn, Ext.pluck(arrs, i));
- }else{
- for (var j = 0, aLen = arrs.length; j < aLen; j++){
- ret[i].push( arrs[j][i] );
- }
- }
- }
- return ret;
- },
-
-
- getCmp : function(id){
- return Ext.ComponentMgr.get(id);
- },
-
-
- useShims: E.isIE6 || (E.isMac && E.isGecko2),
-
-
-
- type : function(o){
- if(o === undefined || o === null){
- return false;
- }
- if(o.htmlElement){
- return 'element';
- }
- var t = typeof o;
- if(t == 'object' && o.nodeName) {
- switch(o.nodeType) {
- case 1: return 'element';
- case 3: return (/\S/).test(o.nodeValue) ? 'textnode' : 'whitespace';
- }
- }
- if(t == 'object' || t == 'function') {
- switch(o.constructor) {
- case Array: return 'array';
- case RegExp: return 'regexp';
- case Date: return 'date';
- }
- if(typeof o.length == 'number' && typeof o.item == 'function') {
- return 'nodelist';
- }
- }
- return t;
- },
-
- intercept : function(o, name, fn, scope){
- o[name] = o[name].createInterceptor(fn, scope);
- },
-
-
- callback : function(cb, scope, args, delay){
- if(typeof cb == 'function'){
- if(delay){
- cb.defer(delay, scope, args || []);
- }else{
- cb.apply(scope, args || []);
- }
- }
- }
- };
-}());
-
-
-Ext.apply(Function.prototype, {
-
- createSequence : function(fcn, scope){
- var method = this;
- return (typeof fcn != 'function') ?
- this :
- function(){
- var retval = method.apply(this || window, arguments);
- fcn.apply(scope || this || window, arguments);
- return retval;
- };
- }
-});
-
-
-
-Ext.applyIf(String, {
-
-
- escape : function(string) {
- return string.replace(/('|\\)/g, "\\$1");
- },
-
-
- leftPad : function (val, size, ch) {
- var result = String(val);
- if(!ch) {
- ch = " ";
- }
- while (result.length < size) {
- result = ch + result;
- }
- return result;
- }
-});
-
-
-String.prototype.toggle = function(value, other){
- return this == value ? other : value;
-};
-
-
-String.prototype.trim = function(){
- var re = /^\s+|\s+$/g;
- return function(){ return this.replace(re, ""); };
-}();
-
-
-
-Date.prototype.getElapsed = function(date) {
- return Math.abs((date || new Date()).getTime()-this.getTime());
-};
-
-
-
-Ext.applyIf(Number.prototype, {
-
- constrain : function(min, max){
- return Math.min(Math.max(this, min), max);
- }