X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/530ef4b6c5b943cfa68b779d11cf7de29aa878bf..f562e4c6e5fac7bcb445985b99acbea4d706e6f0:/ext-all-debug.js?ds=sidebyside
diff --git a/ext-all-debug.js b/ext-all-debug.js
index 3befa7e7..8fc6dc00 100644
--- a/ext-all-debug.js
+++ b/ext-all-debug.js
@@ -1,11082 +1,56235 @@
+/*
+This file is part of Ext JS 4
-Ext.DomHelper = function(){
- var tempTableEl = null,
- emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i,
- tableRe = /^table|tbody|tr|td$/i,
- confRe = /tag|children|cn|html$/i,
- tableElRe = /td|tr|tbody/i,
- cssRe = /([a-z0-9-]+)\s*:\s*([^;\s]+(?:\s*[^;\s]+)*);?/gi,
- endRe = /end/i,
- pub,
-
- afterbegin = 'afterbegin',
- afterend = 'afterend',
- beforebegin = 'beforebegin',
- beforeend = 'beforeend',
- ts = '
',
- tbs = ts+'',
- tbe = ''+te,
- trs = tbs + '',
- tre = '
'+tbe;
+Copyright (c) 2011 Sencha Inc
-
- function doInsert(el, o, returnElement, pos, sibling, append){
- var newNode = pub.insertHtml(pos, Ext.getDom(el), createHtml(o));
- return returnElement ? Ext.get(newNode, true) : newNode;
- }
+Contact: http://www.sencha.com/contact
-
- function createHtml(o){
- var b = '',
- attr,
- val,
- key,
- keyVal,
- cn;
+GNU General Public License Usage
+This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
- if(typeof o == "string"){
- b = o;
- } else if (Ext.isArray(o)) {
- for (var i=0; i < o.length; i++) {
- if(o[i]) {
- b += createHtml(o[i]);
- }
- };
- } else {
- b += '<' + (o.tag = o.tag || 'div');
- for (attr in o) {
- val = o[attr];
- if(!confRe.test(attr)){
- if (typeof val == "object") {
- b += ' ' + attr + '="';
- for (key in val) {
- b += key + ':' + val[key] + ';';
- };
- b += '"';
- }else{
- b += ' ' + ({cls : 'class', htmlFor : 'for'}[attr] || attr) + '="' + val + '"';
- }
- }
- };
-
- if (emptyTags.test(o.tag)) {
- b += '/>';
- } else {
- b += '>';
- if ((cn = o.children || o.cn)) {
- b += createHtml(cn);
- } else if(o.html){
- b += o.html;
- }
- b += '' + o.tag + '>';
- }
- }
- return b;
+If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
+
+*/
+
+
+(function() {
+ var global = this,
+ objectPrototype = Object.prototype,
+ toString = objectPrototype.toString,
+ enumerables = true,
+ enumerablesTest = { toString: 1 },
+ i;
+
+ if (typeof Ext === 'undefined') {
+ global.Ext = {};
}
- function ieTable(depth, s, h, e){
- tempTableEl.innerHTML = [s, h, e].join('');
- var i = -1,
- el = tempTableEl,
- ns;
- while(++i < depth){
- el = el.firstChild;
- }
+ Ext.global = global;
- if(ns = el.nextSibling){
- var df = document.createDocumentFragment();
- while(el){
- ns = el.nextSibling;
- df.appendChild(el);
- el = ns;
- }
- el = df;
- }
- return el;
+ for (i in enumerablesTest) {
+ enumerables = null;
}
-
- function insertIntoTable(tag, where, el, html) {
- var node,
- before;
+ if (enumerables) {
+ enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable',
+ 'toLocaleString', 'toString', 'constructor'];
+ }
- tempTableEl = tempTableEl || document.createElement('div');
+
+ Ext.enumerables = enumerables;
- if(tag == 'td' && (where == afterbegin || where == beforeend) ||
- !tableElRe.test(tag) && (where == beforebegin || where == afterend)) {
- return;
+
+ Ext.apply = function(object, config, defaults) {
+ if (defaults) {
+ Ext.apply(object, defaults);
}
- before = where == beforebegin ? el :
- where == afterend ? el.nextSibling :
- where == afterbegin ? el.firstChild : null;
- if (where == beforebegin || where == afterend) {
- el = el.parentNode;
- }
+ if (object && config && typeof config === 'object') {
+ var i, j, k;
- if (tag == 'td' || (tag == 'tr' && (where == beforeend || where == afterbegin))) {
- node = ieTable(4, trs, html, tre);
- } else if ((tag == 'tbody' && (where == beforeend || where == afterbegin)) ||
- (tag == 'tr' && (where == beforebegin || where == afterend))) {
- node = ieTable(3, tbs, html, tbe);
- } else {
- node = ieTable(2, ts, html, te);
+ for (i in config) {
+ object[i] = config[i];
+ }
+
+ if (enumerables) {
+ for (j = enumerables.length; j--;) {
+ k = enumerables[j];
+ if (config.hasOwnProperty(k)) {
+ object[k] = config[k];
+ }
+ }
+ }
}
- el.insertBefore(node, before);
- return node;
- }
+ return object;
+ };
- pub = {
+ Ext.buildSettings = Ext.apply({
+ baseCSSPrefix: 'x-',
+ scopeResetCSS: false
+ }, Ext.buildSettings || {});
+
+ Ext.apply(Ext, {
- markup : function(o){
- return createHtml(o);
- },
+ emptyFn: function() {},
+
+ baseCSSPrefix: Ext.buildSettings.baseCSSPrefix,
- applyStyles : function(el, styles){
- if(styles){
- var i = 0,
- len,
- style,
- matches;
+ applyIf: function(object, config) {
+ var property;
- el = Ext.fly(el);
- if(typeof styles == "function"){
- styles = styles.call();
- }
- if(typeof styles == "string"){
- while((matches = cssRe.exec(styles))){
- el.setStyle(matches[1], matches[2]);
+ if (object) {
+ for (property in config) {
+ if (object[property] === undefined) {
+ object[property] = config[property];
}
- }else if (typeof styles == "object"){
- el.setStyle(styles);
}
}
+
+ return object;
},
- insertHtml : function(where, el, html){
- var hash = {},
- hashVal,
- setStart,
- range,
- frag,
- rangeEl,
- rs;
+ iterate: function(object, fn, scope) {
+ if (Ext.isEmpty(object)) {
+ return;
+ }
- where = where.toLowerCase();
+ if (scope === undefined) {
+ scope = object;
+ }
+
+ if (Ext.isIterable(object)) {
+ Ext.Array.each.call(Ext.Array, object, fn, scope);
+ }
+ else {
+ Ext.Object.each.call(Ext.Object, object, fn, scope);
+ }
+ }
+ });
+
+ Ext.apply(Ext, {
+
+
+ extend: function() {
- hash[beforebegin] = ['BeforeBegin', 'previousSibling'];
- hash[afterend] = ['AfterEnd', 'nextSibling'];
+ var objectConstructor = objectPrototype.constructor,
+ inlineOverrides = function(o) {
+ for (var m in o) {
+ if (!o.hasOwnProperty(m)) {
+ continue;
+ }
+ this[m] = o[m];
+ }
+ };
- if (el.insertAdjacentHTML) {
- if(tableRe.test(el.tagName) && (rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html))){
- return rs;
+ return function(subclass, superclass, overrides) {
+
+ if (Ext.isObject(superclass)) {
+ overrides = superclass;
+ superclass = subclass;
+ subclass = overrides.constructor !== objectConstructor ? overrides.constructor : function() {
+ superclass.apply(this, arguments);
+ };
}
+
+
- hash[afterbegin] = ['AfterBegin', 'firstChild'];
- hash[beforeend] = ['BeforeEnd', 'lastChild'];
- if ((hashVal = hash[where])) {
- el.insertAdjacentHTML(hashVal[0], html);
- return el[hashVal[1]];
+ var F = function() {},
+ subclassProto, superclassProto = superclass.prototype;
+
+ F.prototype = superclassProto;
+ subclassProto = subclass.prototype = new F();
+ subclassProto.constructor = subclass;
+ subclass.superclass = superclassProto;
+
+ if (superclassProto.constructor === objectConstructor) {
+ superclassProto.constructor = superclass;
}
- } else {
- range = el.ownerDocument.createRange();
- setStart = 'setStart' + (endRe.test(where) ? 'After' : 'Before');
- if (hash[where]) {
- range[setStart](el);
- frag = range.createContextualFragment(html);
- el.parentNode.insertBefore(frag, where == beforebegin ? el : el.nextSibling);
- return el[(where == beforebegin ? 'previous' : 'next') + 'Sibling'];
- } else {
- rangeEl = (where == afterbegin ? 'first' : 'last') + 'Child';
- if (el.firstChild) {
- range[setStart](el[rangeEl]);
- frag = range.createContextualFragment(html);
- if(where == afterbegin){
- el.insertBefore(frag, el.firstChild);
- }else{
- el.appendChild(frag);
- }
- } else {
- el.innerHTML = html;
+
+ subclass.override = function(overrides) {
+ Ext.override(subclass, overrides);
+ };
+
+ subclassProto.override = inlineOverrides;
+ subclassProto.proto = subclassProto;
+
+ subclass.override(overrides);
+ subclass.extend = function(o) {
+ return Ext.extend(subclass, o);
+ };
+
+ return subclass;
+ };
+ }(),
+
+
+ override: function(cls, overrides) {
+ if (cls.prototype.$className) {
+ return cls.override(overrides);
+ }
+ else {
+ Ext.apply(cls.prototype, overrides);
+ }
+ }
+ });
+
+
+ Ext.apply(Ext, {
+
+
+ valueFrom: function(value, defaultValue, allowBlank){
+ return Ext.isEmpty(value, allowBlank) ? defaultValue : value;
+ },
+
+
+ typeOf: function(value) {
+ if (value === null) {
+ return 'null';
+ }
+
+ var type = typeof value;
+
+ if (type === 'undefined' || type === 'string' || type === 'number' || type === 'boolean') {
+ return type;
+ }
+
+ var typeToString = toString.call(value);
+
+ switch(typeToString) {
+ case '[object Array]':
+ return 'array';
+ case '[object Date]':
+ return 'date';
+ case '[object Boolean]':
+ return 'boolean';
+ case '[object Number]':
+ return 'number';
+ case '[object RegExp]':
+ return 'regexp';
+ }
+
+ if (type === 'function') {
+ return 'function';
+ }
+
+ if (type === 'object') {
+ if (value.nodeType !== undefined) {
+ if (value.nodeType === 3) {
+ return (/\S/).test(value.nodeValue) ? 'textnode' : 'whitespace';
+ }
+ else {
+ return 'element';
}
- return el[rangeEl];
}
+
+ return 'object';
}
- throw 'Illegal insertion point -> "' + where + '"';
+
},
- insertBefore : function(el, o, returnElement){
- return doInsert(el, o, returnElement, beforebegin);
+ isEmpty: function(value, allowEmptyString) {
+ return (value === null) || (value === undefined) || (!allowEmptyString ? value === '' : false) || (Ext.isArray(value) && value.length === 0);
},
- insertAfter : function(el, o, returnElement){
- return doInsert(el, o, returnElement, afterend, 'nextSibling');
+ isArray: ('isArray' in Array) ? Array.isArray : function(value) {
+ return toString.call(value) === '[object Array]';
},
- insertFirst : function(el, o, returnElement){
- return doInsert(el, o, returnElement, afterbegin, 'firstChild');
+ isDate: function(value) {
+ return toString.call(value) === '[object Date]';
},
- append : function(el, o, returnElement){
- return doInsert(el, o, returnElement, beforeend, '', true);
+ isObject: (toString.call(null) === '[object Object]') ?
+ function(value) {
+
+ return value !== null && value !== undefined && toString.call(value) === '[object Object]' && value.ownerDocument === undefined;
+ } :
+ function(value) {
+ return toString.call(value) === '[object Object]';
},
- overwrite : function(el, o, returnElement){
- el = Ext.getDom(el);
- el.innerHTML = createHtml(o);
- return returnElement ? Ext.get(el.firstChild) : el.firstChild;
+ isPrimitive: function(value) {
+ var type = typeof value;
+
+ return type === 'string' || type === 'number' || type === 'boolean';
},
- createHtml : createHtml
- };
- return pub;
-}();
+
+ isFunction:
+
+
+ (typeof document !== 'undefined' && typeof document.getElementsByTagName('body') === 'function') ? function(value) {
+ return toString.call(value) === '[object Function]';
+ } : function(value) {
+ return typeof value === 'function';
+ },
-Ext.apply(Ext.DomHelper,
-function(){
- var pub,
- afterbegin = 'afterbegin',
- afterend = 'afterend',
- beforebegin = 'beforebegin',
- beforeend = 'beforeend',
- confRe = /tag|children|cn|html$/i;
+
+ isNumber: function(value) {
+ return typeof value === 'number' && isFinite(value);
+ },
-
- function doInsert(el, o, returnElement, pos, sibling, append){
- el = Ext.getDom(el);
- var newNode;
- if (pub.useDom) {
- newNode = createDom(o, null);
- if (append) {
- el.appendChild(newNode);
- } else {
- (sibling == 'firstChild' ? el : el.parentNode).insertBefore(newNode, el[sibling] || el);
- }
- } else {
- newNode = Ext.DomHelper.insertHtml(pos, el, Ext.DomHelper.createHtml(o));
+
+ isNumeric: function(value) {
+ return !isNaN(parseFloat(value)) && isFinite(value);
+ },
+
+
+ isString: function(value) {
+ return typeof value === 'string';
+ },
+
+
+ isBoolean: function(value) {
+ return typeof value === 'boolean';
+ },
+
+
+ isElement: function(value) {
+ return value ? value.nodeType === 1 : false;
+ },
+
+
+ isTextNode: function(value) {
+ return value ? value.nodeName === "#text" : false;
+ },
+
+
+ isDefined: function(value) {
+ return typeof value !== 'undefined';
+ },
+
+
+ isIterable: function(value) {
+ return (value && typeof value !== 'string') ? value.length !== undefined : false;
}
- return returnElement ? Ext.get(newNode, true) : newNode;
- }
+ });
-
-
- function createDom(o, parentNode){
- var el,
- doc = document,
- useSet,
- attr,
- val,
- cn;
+ Ext.apply(Ext, {
- if (Ext.isArray(o)) {
- el = doc.createDocumentFragment();
- for (var i = 0, l = o.length; i < l; i++) {
- createDom(o[i], el);
+
+ clone: function(item) {
+ if (item === null || item === undefined) {
+ return item;
}
- } else if (typeof o == 'string') {
- el = doc.createTextNode(o);
- } else {
- el = doc.createElement( o.tag || 'div' );
- useSet = !!el.setAttribute;
- for (var attr in o) {
- if(!confRe.test(attr)){
- val = o[attr];
- if(attr == 'cls'){
- el.className = val;
- }else{
- if(useSet){
- el.setAttribute(attr, val);
- }else{
- el[attr] = val;
- }
+
+
+
+
+ if (item.nodeType && item.cloneNode) {
+ return item.cloneNode(true);
+ }
+
+ var type = toString.call(item);
+
+
+ if (type === '[object Date]') {
+ return new Date(item.getTime());
+ }
+
+ var i, j, k, clone, key;
+
+
+ if (type === '[object Array]') {
+ i = item.length;
+
+ clone = [];
+
+ while (i--) {
+ clone[i] = Ext.clone(item[i]);
+ }
+ }
+
+ else if (type === '[object Object]' && item.constructor === Object) {
+ clone = {};
+
+ for (key in item) {
+ clone[key] = Ext.clone(item[key]);
+ }
+
+ if (enumerables) {
+ for (j = enumerables.length; j--;) {
+ k = enumerables[j];
+ clone[k] = item[k];
}
}
}
- Ext.DomHelper.applyStyles(el, o.style);
- if ((cn = o.children || o.cn)) {
- createDom(cn, el);
- } else if (o.html) {
- el.innerHTML = o.html;
+ return clone || item;
+ },
+
+
+ getUniqueGlobalNamespace: function() {
+ var uniqueGlobalNamespace = this.uniqueGlobalNamespace;
+
+ if (uniqueGlobalNamespace === undefined) {
+ var i = 0;
+
+ do {
+ uniqueGlobalNamespace = 'ExtBox' + (++i);
+ } while (Ext.global[uniqueGlobalNamespace] !== undefined);
+
+ Ext.global[uniqueGlobalNamespace] = Ext;
+ this.uniqueGlobalNamespace = uniqueGlobalNamespace;
}
+
+ return uniqueGlobalNamespace;
+ },
+
+
+ functionFactory: function() {
+ var args = Array.prototype.slice.call(arguments);
+
+ if (args.length > 0) {
+ args[args.length - 1] = 'var Ext=window.' + this.getUniqueGlobalNamespace() + ';' +
+ args[args.length - 1];
+ }
+
+ return Function.prototype.constructor.apply(Function.prototype, args);
}
- if(parentNode){
- parentNode.appendChild(el);
- }
- return el;
- }
+ });
+
+
+ Ext.type = Ext.typeOf;
+
+})();
+
+
+(function() {
+
+
+var version = '4.0.7', Version;
+ Ext.Version = Version = Ext.extend(Object, {
- pub = {
- createTemplate : function(o){
- var html = Ext.DomHelper.createHtml(o);
- return new Ext.Template(html);
+ constructor: function(version) {
+ var parts, releaseStartIndex;
+
+ if (version instanceof Version) {
+ return version;
+ }
+
+ this.version = this.shortVersion = String(version).toLowerCase().replace(/_/g, '.').replace(/[\-+]/g, '');
+
+ releaseStartIndex = this.version.search(/([^\d\.])/);
+
+ if (releaseStartIndex !== -1) {
+ this.release = this.version.substr(releaseStartIndex, version.length);
+ this.shortVersion = this.version.substr(0, releaseStartIndex);
+ }
+
+ this.shortVersion = this.shortVersion.replace(/[^\d]/g, '');
+
+ parts = this.version.split('.');
+
+ this.major = parseInt(parts.shift() || 0, 10);
+ this.minor = parseInt(parts.shift() || 0, 10);
+ this.patch = parseInt(parts.shift() || 0, 10);
+ this.build = parseInt(parts.shift() || 0, 10);
+
+ return this;
},
- useDom : false,
+ toString: function() {
+ return this.version;
+ },
- insertBefore : function(el, o, returnElement){
- return doInsert(el, o, returnElement, beforebegin);
+ valueOf: function() {
+ return this.version;
},
- insertAfter : function(el, o, returnElement){
- return doInsert(el, o, returnElement, afterend, 'nextSibling');
+ getMajor: function() {
+ return this.major || 0;
},
- insertFirst : function(el, o, returnElement){
- return doInsert(el, o, returnElement, afterbegin, 'firstChild');
+ getMinor: function() {
+ return this.minor || 0;
},
- append: function(el, o, returnElement){
- return doInsert(el, o, returnElement, beforeend, '', true);
+ getPatch: function() {
+ return this.patch || 0;
},
- createDom: createDom
- };
- return pub;
-}());
+ getBuild: function() {
+ return this.build || 0;
+ },
-Ext.Template = function(html){
- var me = this,
- a = arguments,
- buf = [],
- v;
-
- if (Ext.isArray(html)) {
- html = html.join("");
- } else if (a.length > 1) {
- for(var i = 0, len = a.length; i < len; i++){
- v = a[i];
- if(typeof v == 'object'){
- Ext.apply(me, v);
- } else {
- buf.push(v);
+
+ getRelease: function() {
+ return this.release || '';
+ },
+
+
+ isGreaterThan: function(target) {
+ return Version.compare(this.version, target) === 1;
+ },
+
+
+ isLessThan: function(target) {
+ return Version.compare(this.version, target) === -1;
+ },
+
+
+ equals: function(target) {
+ return Version.compare(this.version, target) === 0;
+ },
+
+
+ match: function(target) {
+ target = String(target);
+ return this.version.substr(0, target.length) === target;
+ },
+
+
+ toArray: function() {
+ return [this.getMajor(), this.getMinor(), this.getPatch(), this.getBuild(), this.getRelease()];
+ },
+
+
+ getShortVersion: function() {
+ return this.shortVersion;
+ }
+ });
+
+ Ext.apply(Version, {
+
+ releaseValueMap: {
+ 'dev': -6,
+ 'alpha': -5,
+ 'a': -5,
+ 'beta': -4,
+ 'b': -4,
+ 'rc': -3,
+ '#': -2,
+ 'p': -1,
+ 'pl': -1
+ },
+
+
+ getComponentValue: function(value) {
+ return !value ? 0 : (isNaN(value) ? this.releaseValueMap[value] || value : parseInt(value, 10));
+ },
+
+
+ compare: function(current, target) {
+ var currentValue, targetValue, i;
+
+ current = new Version(current).toArray();
+ target = new Version(target).toArray();
+
+ for (i = 0; i < Math.max(current.length, target.length); i++) {
+ currentValue = this.getComponentValue(current[i]);
+ targetValue = this.getComponentValue(target[i]);
+
+ if (currentValue < targetValue) {
+ return -1;
+ } else if (currentValue > targetValue) {
+ return 1;
+ }
+ }
+
+ return 0;
+ }
+ });
+
+ Ext.apply(Ext, {
+
+ versions: {},
+
+
+ lastRegisteredVersion: null,
+
+
+ setVersion: function(packageName, version) {
+ Ext.versions[packageName] = new Version(version);
+ Ext.lastRegisteredVersion = Ext.versions[packageName];
+
+ return this;
+ },
+
+
+ getVersion: function(packageName) {
+ if (packageName === undefined) {
+ return Ext.lastRegisteredVersion;
+ }
+
+ return Ext.versions[packageName];
+ },
+
+
+ deprecate: function(packageName, since, closure, scope) {
+ if (Version.compare(Ext.getVersion(packageName), since) < 1) {
+ closure.call(scope);
}
+ }
+ });
+
+ Ext.setVersion('core', version);
+
+})();
+
+
+
+Ext.String = {
+ trimRegex: /^[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000]+|[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000]+$/g,
+ escapeRe: /('|\\)/g,
+ formatRe: /\{(\d+)\}/g,
+ escapeRegexRe: /([-.*+?^${}()|[\]\/\\])/g,
+
+ /**
+ * Convert certain characters (&, <, >, and ") to their HTML character equivalents for literal display in web pages.
+ * @param {String} value The string to encode
+ * @return {String} The encoded text
+ * @method
+ */
+ htmlEncode: (function() {
+ var entities = {
+ '&': '&',
+ '>': '>',
+ '<': '<',
+ '"': '"'
+ }, keys = [], p, regex;
+
+ for (p in entities) {
+ keys.push(p);
+ }
+
+ regex = new RegExp('(' + keys.join('|') + ')', 'g');
+
+ return function(value) {
+ return (!value) ? value : String(value).replace(regex, function(match, capture) {
+ return entities[capture];
+ });
};
- html = buf.join('');
- }
+ })(),
-
- me.html = html;
-
- if (me.compiled) {
- me.compile();
- }
-};
-Ext.Template.prototype = {
-
- re : /\{([\w-]+)\}/g,
-
+ /**
+ * Convert certain characters (&, <, >, and ") from their HTML character equivalents.
+ * @param {String} value The string to decode
+ * @return {String} The decoded text
+ * @method
+ */
+ htmlDecode: (function() {
+ var entities = {
+ '&': '&',
+ '>': '>',
+ '<': '<',
+ '"': '"'
+ }, keys = [], p, regex;
+
+ for (p in entities) {
+ keys.push(p);
+ }
+
+ regex = new RegExp('(' + keys.join('|') + '|[0-9]{1,5};' + ')', 'g');
+
+ return function(value) {
+ return (!value) ? value : String(value).replace(regex, function(match, capture) {
+ if (capture in entities) {
+ return entities[capture];
+ } else {
+ return String.fromCharCode(parseInt(capture.substr(2), 10));
+ }
+ });
+ };
+ })(),
- applyTemplate : function(values){
- var me = this;
+ urlAppend : function(url, string) {
+ if (!Ext.isEmpty(string)) {
+ return url + (url.indexOf('?') === -1 ? '?' : '&') + string;
+ }
- return me.compiled ?
- me.compiled(values) :
- me.html.replace(me.re, function(m, name){
- return values[name] !== undefined ? values[name] : "";
- });
+ return url;
},
- set : function(html, compile){
- var me = this;
- me.html = html;
- me.compiled = null;
- return compile ? me.compile() : me;
+ trim: function(string) {
+ return string.replace(Ext.String.trimRegex, "");
},
- compile : function(){
- var me = this,
- sep = Ext.isGecko ? "+" : ",";
+ capitalize: function(string) {
+ return string.charAt(0).toUpperCase() + string.substr(1);
+ },
- function fn(m, name){
- name = "values['" + name + "']";
- return "'"+ sep + '(' + name + " == undefined ? '' : " + name + ')' + sep + "'";
+
+ ellipsis: function(value, len, word) {
+ if (value && value.length > len) {
+ if (word) {
+ var vs = value.substr(0, len - 2),
+ index = Math.max(vs.lastIndexOf(' '), vs.lastIndexOf('.'), vs.lastIndexOf('!'), vs.lastIndexOf('?'));
+ if (index !== -1 && index >= (len - 15)) {
+ return vs.substr(0, index) + "...";
+ }
+ }
+ return value.substr(0, len - 3) + "...";
}
+ return value;
+ },
- eval("this.compiled = function(values){ return " + (Ext.isGecko ? "'" : "['") +
- me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
- (Ext.isGecko ? "';};" : "'].join('');};"));
- return me;
+
+ escapeRegex: function(string) {
+ return string.replace(Ext.String.escapeRegexRe, "\\$1");
},
- insertFirst: function(el, values, returnElement){
- return this.doInsert('afterBegin', el, values, returnElement);
+ escape: function(string) {
+ return string.replace(Ext.String.escapeRe, "\\$1");
},
- insertBefore: function(el, values, returnElement){
- return this.doInsert('beforeBegin', el, values, returnElement);
+ toggle: function(string, value, other) {
+ return string === value ? other : value;
},
- insertAfter : function(el, values, returnElement){
- return this.doInsert('afterEnd', el, values, returnElement);
+ leftPad: function(string, size, character) {
+ var result = String(string);
+ character = character || " ";
+ while (result.length < size) {
+ result = character + result;
+ }
+ return result;
},
- append : function(el, values, returnElement){
- return this.doInsert('beforeEnd', el, values, returnElement);
- },
-
- doInsert : function(where, el, values, returnEl){
- el = Ext.getDom(el);
- var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values));
- return returnEl ? Ext.get(newNode, true) : newNode;
+ format: function(format) {
+ var args = Ext.Array.toArray(arguments, 1);
+ return format.replace(Ext.String.formatRe, function(m, i) {
+ return args[i];
+ });
},
- overwrite : function(el, values, returnElement){
- el = Ext.getDom(el);
- el.innerHTML = this.applyTemplate(values);
- return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
+ repeat: function(pattern, count, sep) {
+ for (var buf = [], i = count; i--; ) {
+ buf.push(pattern);
+ }
+ return buf.join(sep || '');
}
};
-Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
-Ext.Template.from = function(el, config){
- el = Ext.getDom(el);
- return new Ext.Template(el.value || el.innerHTML, config || '');
-};
+(function() {
-Ext.apply(Ext.Template.prototype, {
-
- disableFormats : false,
-
+var isToFixedBroken = (0.9).toFixed() !== '1';
+Ext.Number = {
- re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
- argsRe : /^\s*['"](.*)["']\s*$/,
- compileARe : /\\/g,
- compileBRe : /(\r\n|\n)/g,
- compileCRe : /'/g,
-
- /**
- * Returns an HTML fragment of this template with the specified values applied.
- * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
- * @return {String} The HTML fragment
- * @hide repeat doc
- */
- applyTemplate : function(values){
- var me = this,
- useF = me.disableFormats !== true,
- fm = Ext.util.Format,
- tpl = me;
+ constrain: function(number, min, max) {
+ number = parseFloat(number);
- if(me.compiled){
- return me.compiled(values);
+ if (!isNaN(min)) {
+ number = Math.max(number, min);
}
- function fn(m, name, format, args){
- if (format && useF) {
- if (format.substr(0, 5) == "this.") {
- return tpl.call(format.substr(5), values[name], values);
- } else {
- if (args) {
- // quoted values are required for strings in compiled templates,
- // but for non compiled we need to strip them
- // quoted reversed for jsmin
- var re = me.argsRe;
- args = args.split(',');
- for(var i = 0, len = args.length; i < len; i++){
- args[i] = args[i].replace(re, "$1");
- }
- args = [values[name]].concat(args);
- } else {
- args = [values[name]];
- }
- return fm[format].apply(fm, args);
- }
- } else {
- return values[name] !== undefined ? values[name] : "";
- }
+ if (!isNaN(max)) {
+ number = Math.min(number, max);
}
- return me.html.replace(me.re, fn);
+ return number;
},
- /**
- * Compiles the template into an internal function, eliminating the RegEx overhead.
- * @return {Ext.Template} this
- * @hide repeat doc
- */
- compile : function(){
- var me = this,
- fm = Ext.util.Format,
- useF = me.disableFormats !== true,
- sep = Ext.isGecko ? "+" : ",",
- body;
+
+ snap : function(value, increment, minValue, maxValue) {
+ var newValue = value,
+ m;
- function fn(m, name, format, args){
- if(format && useF){
- args = args ? ',' + args : "";
- if(format.substr(0, 5) != "this."){
- format = "fm." + format + '(';
- }else{
- format = 'this.call("'+ format.substr(5) + '", ';
- args = ", values";
- }
- }else{
- args= ''; format = "(values['" + name + "'] == undefined ? '' : ";
- }
- return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";
+ if (!(increment && value)) {
+ return value;
}
-
- // branched to use + in gecko and [].join() in others
- if(Ext.isGecko){
- body = "this.compiled = function(values){ return '" +
- me.html.replace(me.compileARe, '\\\\').replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn) +
- "';};";
- }else{
- body = ["this.compiled = function(values){ return ['"];
- body.push(me.html.replace(me.compileARe, '\\\\').replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn));
- body.push("'].join('');};");
- body = body.join('');
+ m = value % increment;
+ if (m !== 0) {
+ newValue -= m;
+ if (m * 2 >= increment) {
+ newValue += increment;
+ } else if (m * 2 < -increment) {
+ newValue -= increment;
+ }
}
- eval(body);
- return me;
+ return Ext.Number.constrain(newValue, minValue, maxValue);
},
- // private function used to call members
- call : function(fnName, value, allValues){
- return this[fnName](value, allValues);
- }
-});
-Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
-/*
- * This is code is also distributed under MIT license for use
- * with jQuery and prototype JavaScript libraries.
- */
-/**
- * @class Ext.DomQuery
-Provides high performance selector/xpath processing by compiling queries into reusable functions. New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in).
-
-DomQuery supports most of the CSS3 selectors spec, along with some custom selectors and basic XPath.
-
-
-All selectors, attribute filters and pseudos below can be combined infinitely in any order. For example "div.foo:nth-child(odd)[@foo=bar].bar:first" would be a perfectly valid selector. Node filters are processed in the order in which they appear, which allows you to optimize your queries for your document structure.
-
-Element Selectors:
-
- - * any element
- - E an element with the tag E
- - E F All descendent elements of E that have the tag F
- - E > F or E/F all direct children elements of E that have the tag F
- - E + F all elements with the tag F that are immediately preceded by an element with the tag E
- - E ~ F all elements with the tag F that are preceded by a sibling element with the tag E
-
-Attribute Selectors:
-The use of @ and quotes are optional. For example, div[@foo='bar'] is also a valid attribute selector.
-
- - E[foo] has an attribute "foo"
- - E[foo=bar] has an attribute "foo" that equals "bar"
- - E[foo^=bar] has an attribute "foo" that starts with "bar"
- - E[foo$=bar] has an attribute "foo" that ends with "bar"
- - E[foo*=bar] has an attribute "foo" that contains the substring "bar"
- - E[foo%=2] has an attribute "foo" that is evenly divisible by 2
- - E[foo!=bar] has an attribute "foo" that does not equal "bar"
-
-Pseudo Classes:
-
- - E:first-child E is the first child of its parent
- - E:last-child E is the last child of its parent
- - E:nth-child(n) E is the nth child of its parent (1 based as per the spec)
- - E:nth-child(odd) E is an odd child of its parent
- - E:nth-child(even) E is an even child of its parent
- - E:only-child E is the only child of its parent
- - E:checked E is an element that is has a checked attribute that is true (e.g. a radio or checkbox)
- - E:first the first E in the resultset
- - E:last the last E in the resultset
- - E:nth(n) the nth E in the resultset (1 based)
- - E:odd shortcut for :nth-child(odd)
- - E:even shortcut for :nth-child(even)
- - E:contains(foo) E's innerHTML contains the substring "foo"
- - E:nodeValue(foo) E contains a textNode with a nodeValue that equals "foo"
- - E:not(S) an E element that does not match simple selector S
- - E:has(S) an E element that has a descendent that matches simple selector S
- - E:next(S) an E element whose next sibling matches simple selector S
- - E:prev(S) an E element whose previous sibling matches simple selector S
- - E:any(S1|S2|S2) an E element which matches any of the simple selectors S1, S2 or S3
-
-CSS Value Selectors:
-
- - E{display=none} css value "display" that equals "none"
- - E{display^=none} css value "display" that starts with "none"
- - E{display$=none} css value "display" that ends with "none"
- - E{display*=none} css value "display" that contains the substring "none"
- - E{display%=2} css value "display" that is evenly divisible by 2
- - E{display!=none} css value "display" that does not equal "none"
-
- * @singleton
- */
-Ext.DomQuery = function(){
- var cache = {},
- simpleCache = {},
- valueCache = {},
- nonSpace = /\S/,
- trimRe = /^\s+|\s+$/g,
- tplRe = /\{(\d+)\}/g,
- modeRe = /^(\s?[\/>+~]\s?|\s|$)/,
- tagTokenRe = /^(#)?([\w-\*]+)/,
- nthRe = /(\d*)n\+?(\d*)/,
- nthRe2 = /\D/,
-
-
-
- isIE = window.ActiveXObject ? true : false,
- key = 30803;
-
-
- eval("var batch = 30803;");
+ toFixed: function(value, precision) {
+ if (isToFixedBroken) {
+ precision = precision || 0;
+ var pow = Math.pow(10, precision);
+ return (Math.round(value * pow) / pow).toFixed(precision);
+ }
+
+ return value.toFixed(precision);
+ },
-
- function child(parent, index){
- var i = 0,
- n = parent.firstChild;
- while(n){
- if(n.nodeType == 1){
- if(++i == index){
- return n;
- }
- }
- n = n.nextSibling;
+ from: function(value, defaultValue) {
+ if (isFinite(value)) {
+ value = parseFloat(value);
}
- return null;
- }
-
- function next(n){
- while((n = n.nextSibling) && n.nodeType != 1);
- return n;
+ return !isNaN(value) ? value : defaultValue;
}
+};
-
- function prev(n){
- while((n = n.previousSibling) && n.nodeType != 1);
- return n;
- }
+})();
-
-
- function children(parent){
- var n = parent.firstChild,
- nodeIndex = -1,
- nextNode;
- while(n){
- nextNode = n.nextSibling;
-
- if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
- parent.removeChild(n);
- }else{
-
- n.nodeIndex = ++nodeIndex;
- }
- n = nextNode;
- }
- return this;
- }
+Ext.num = function() {
+ return Ext.Number.from.apply(this, arguments);
+};
-
-
- function byClassName(nodeSet, cls){
- if(!cls){
- return nodeSet;
- }
- var result = [], ri = -1;
- for(var i = 0, ci; ci = nodeSet[i]; i++){
- if((' '+ci.className+' ').indexOf(cls) != -1){
- result[++ri] = ci;
+(function() {
+
+ var arrayPrototype = Array.prototype,
+ slice = arrayPrototype.slice,
+ supportsSplice = function () {
+ var array = [],
+ lengthBefore,
+ j = 20;
+
+ if (!array.splice) {
+ return false;
}
- }
- return result;
- };
- function attrValue(n, attr){
-
- if(!n.tagName && typeof n.length != "undefined"){
- n = n[0];
- }
- if(!n){
- return null;
- }
+
+
- if(attr == "for"){
- return n.htmlFor;
- }
- if(attr == "class" || attr == "className"){
- return n.className;
- }
- return n.getAttribute(attr) || n[attr];
+ while (j--) {
+ array.push("A");
+ }
- };
+ array.splice(15, 0, "F", "F", "F", "F", "F","F","F","F","F","F","F","F","F","F","F","F","F","F","F","F","F");
+ lengthBefore = array.length;
+ array.splice(13, 0, "XXX");
-
-
-
- function getNodes(ns, mode, tagName){
- var result = [], ri = -1, cs;
- if(!ns){
- return result;
- }
- tagName = tagName || "*";
-
- if(typeof ns.getElementsByTagName != "undefined"){
- ns = [ns];
- }
-
-
-
- if(!mode){
- for(var i = 0, ni; ni = ns[i]; i++){
- cs = ni.getElementsByTagName(tagName);
- for(var j = 0, ci; ci = cs[j]; j++){
- result[++ri] = ci;
- }
- }
-
-
- } else if(mode == "/" || mode == ">"){
- var utag = tagName.toUpperCase();
- for(var i = 0, ni, cn; ni = ns[i]; i++){
- cn = ni.childNodes;
- for(var j = 0, cj; cj = cn[j]; j++){
- if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
- result[++ri] = cj;
- }
- }
- }
-
-
- }else if(mode == "+"){
- var utag = tagName.toUpperCase();
- for(var i = 0, n; n = ns[i]; i++){
- while((n = n.nextSibling) && n.nodeType != 1);
- if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
- result[++ri] = n;
- }
- }
-
-
- }else if(mode == "~"){
- var utag = tagName.toUpperCase();
- for(var i = 0, n; n = ns[i]; i++){
- while((n = n.nextSibling)){
- if (n.nodeName == utag || n.nodeName == tagName || tagName == '*'){
- result[++ri] = n;
- }
- }
+ if (lengthBefore+1 != array.length) {
+ return false;
}
- }
- return result;
- }
+
- function concat(a, b){
- if(b.slice){
- return a.concat(b);
- }
- for(var i = 0, l = b.length; i < l; i++){
- a[a.length] = b[i];
- }
- return a;
- }
+ return true;
+ }(),
+ supportsForEach = 'forEach' in arrayPrototype,
+ supportsMap = 'map' in arrayPrototype,
+ supportsIndexOf = 'indexOf' in arrayPrototype,
+ supportsEvery = 'every' in arrayPrototype,
+ supportsSome = 'some' in arrayPrototype,
+ supportsFilter = 'filter' in arrayPrototype,
+ supportsSort = function() {
+ var a = [1,2,3,4,5].sort(function(){ return 0; });
+ return a[0] === 1 && a[1] === 2 && a[2] === 3 && a[3] === 4 && a[4] === 5;
+ }(),
+ supportsSliceOnNodeList = true,
+ ExtArray;
- function byTag(cs, tagName){
- if(cs.tagName || cs == document){
- cs = [cs];
- }
- if(!tagName){
- return cs;
- }
- var result = [], ri = -1;
- tagName = tagName.toLowerCase();
- for(var i = 0, ci; ci = cs[i]; i++){
- if(ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName){
- result[++ri] = ci;
- }
+ try {
+
+ if (typeof document !== 'undefined') {
+ slice.call(document.getElementsByTagName('body'));
}
- return result;
+ } catch (e) {
+ supportsSliceOnNodeList = false;
}
- function byId(cs, id){
- if(cs.tagName || cs == document){
- cs = [cs];
- }
- if(!id){
- return cs;
- }
- var result = [], ri = -1;
- for(var i = 0, ci; ci = cs[i]; i++){
- if(ci && ci.id == id){
- result[++ri] = ci;
- return result;
- }
- }
- return result;
+ function fixArrayIndex (array, index) {
+ return (index < 0) ? Math.max(0, array.length + index)
+ : Math.min(array.length, index);
}
-
- function byAttribute(cs, attr, value, op, custom){
- var result = [],
- ri = -1,
- useGetStyle = custom == "{",
- fn = Ext.DomQuery.operators[op],
- a,
- innerHTML;
- for(var i = 0, ci; ci = cs[i]; i++){
-
- if(ci.nodeType != 1){
- continue;
+ function replaceSim (array, index, removeCount, insert) {
+ var add = insert ? insert.length : 0,
+ length = array.length,
+ pos = fixArrayIndex(array, index);
+
+
+ if (pos === length) {
+ if (add) {
+ array.push.apply(array, insert);
}
-
- innerHTML = ci.innerHTML;
-
- if(innerHTML !== null && innerHTML !== undefined){
- if(useGetStyle){
- a = Ext.DomQuery.getStyle(ci, attr);
- } else if (attr == "class" || attr == "className"){
- a = ci.className;
- } else if (attr == "for"){
- a = ci.htmlFor;
- } else if (attr == "href"){
-
-
- a = ci.getAttribute("href", 2);
- } else{
- a = ci.getAttribute(attr);
+ } else {
+ var remove = Math.min(removeCount, length - pos),
+ tailOldPos = pos + remove,
+ tailNewPos = tailOldPos + add - remove,
+ tailCount = length - tailOldPos,
+ lengthAfterRemove = length - remove,
+ i;
+
+ if (tailNewPos < tailOldPos) {
+ for (i = 0; i < tailCount; ++i) {
+ array[tailNewPos+i] = array[tailOldPos+i];
+ }
+ } else if (tailNewPos > tailOldPos) {
+ for (i = tailCount; i--; ) {
+ array[tailNewPos+i] = array[tailOldPos+i];
+ }
+ }
+
+ if (add && pos === lengthAfterRemove) {
+ array.length = lengthAfterRemove;
+ array.push.apply(array, insert);
+ } else {
+ array.length = lengthAfterRemove + add;
+ for (i = 0; i < add; ++i) {
+ array[pos+i] = insert[i];
}
- }else{
- a = ci.getAttribute(attr);
- }
- if((fn && fn(a, value)) || (!fn && a)){
- result[++ri] = ci;
}
}
- return result;
- }
- function byPseudo(cs, name, value){
- return Ext.DomQuery.pseudos[name](cs, value);
+ return array;
}
- function nodupIEXml(cs){
- var d = ++key,
- r;
- cs[0].setAttribute("_nodup", d);
- r = [cs[0]];
- for(var i = 1, len = cs.length; i < len; i++){
- var c = cs[i];
- if(!c.getAttribute("_nodup") != d){
- c.setAttribute("_nodup", d);
- r[r.length] = c;
+ function replaceNative (array, index, removeCount, insert) {
+ if (insert && insert.length) {
+ if (index < array.length) {
+ array.splice.apply(array, [index, removeCount].concat(insert));
+ } else {
+ array.push.apply(array, insert);
}
+ } else {
+ array.splice(index, removeCount);
}
- for(var i = 0, len = cs.length; i < len; i++){
- cs[i].removeAttribute("_nodup");
- }
- return r;
+ return array;
}
- function nodup(cs){
- if(!cs){
- return [];
- }
- var len = cs.length, c, i, r = cs, cj, ri = -1;
- if(!len || typeof cs.nodeType != "undefined" || len == 1){
- return cs;
- }
- if(isIE && typeof cs[0].selectSingleNode != "undefined"){
- return nodupIEXml(cs);
- }
- var d = ++key;
- cs[0]._nodup = d;
- for(i = 1; c = cs[i]; i++){
- if(c._nodup != d){
- c._nodup = d;
- }else{
- r = [];
- for(var j = 0; j < i; j++){
- r[++ri] = cs[j];
- }
- for(j = i+1; cj = cs[j]; j++){
- if(cj._nodup != d){
- cj._nodup = d;
- r[++ri] = cj;
- }
- }
- return r;
- }
- }
- return r;
+ function eraseSim (array, index, removeCount) {
+ return replaceSim(array, index, removeCount);
}
- function quickDiffIEXml(c1, c2){
- var d = ++key,
- r = [];
- for(var i = 0, len = c1.length; i < len; i++){
- c1[i].setAttribute("_qdiff", d);
- }
- for(var i = 0, len = c2.length; i < len; i++){
- if(c2[i].getAttribute("_qdiff") != d){
- r[r.length] = c2[i];
- }
- }
- for(var i = 0, len = c1.length; i < len; i++){
- c1[i].removeAttribute("_qdiff");
- }
- return r;
+ function eraseNative (array, index, removeCount) {
+ array.splice(index, removeCount);
+ return array;
}
- function quickDiff(c1, c2){
- var len1 = c1.length,
- d = ++key,
- r = [];
- if(!len1){
- return c2;
- }
- if(isIE && typeof c1[0].selectSingleNode != "undefined"){
- return quickDiffIEXml(c1, c2);
- }
- for(var i = 0; i < len1; i++){
- c1[i]._qdiff = d;
- }
- for(var i = 0, len = c2.length; i < len; i++){
- if(c2[i]._qdiff != d){
- r[r.length] = c2[i];
- }
+ function spliceSim (array, index, removeCount) {
+ var pos = fixArrayIndex(array, index),
+ removed = array.slice(index, fixArrayIndex(array, pos+removeCount));
+
+ if (arguments.length < 4) {
+ replaceSim(array, pos, removeCount);
+ } else {
+ replaceSim(array, pos, removeCount, slice.call(arguments, 3));
}
- return r;
+
+ return removed;
}
- function quickId(ns, mode, root, id){
- if(ns == root){
- var d = root.ownerDocument || root;
- return d.getElementById(id);
- }
- ns = getNodes(ns, mode, "*");
- return byId(ns, id);
+ function spliceNative (array) {
+ return array.splice.apply(array, slice.call(arguments, 1));
}
- return {
- getStyle : function(el, name){
- return Ext.fly(el).getStyle(name);
- },
+ var erase = supportsSplice ? eraseNative : eraseSim,
+ replace = supportsSplice ? replaceNative : replaceSim,
+ splice = supportsSplice ? spliceNative : spliceSim;
+
+
+
+ ExtArray = Ext.Array = {
- compile : function(path, type){
- type = type || "select";
+ each: function(array, fn, scope, reverse) {
+ array = ExtArray.from(array);
-
- var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"],
- mode,
- lastPath,
- matchers = Ext.DomQuery.matchers,
- matchersLn = matchers.length,
- modeMatch,
-
- lmode = path.match(modeRe);
-
- if(lmode && lmode[1]){
- fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
- path = path.replace(lmode[1], "");
- }
-
-
- while(path.substr(0, 1)=="/"){
- path = path.substr(1);
- }
+ var i,
+ ln = array.length;
- while(path && lastPath != path){
- lastPath = path;
- var tokenMatch = path.match(tagTokenRe);
- if(type == "select"){
- if(tokenMatch){
-
- if(tokenMatch[1] == "#"){
- fn[fn.length] = 'n = quickId(n, mode, root, "'+tokenMatch[2]+'");';
- }else{
- fn[fn.length] = 'n = getNodes(n, mode, "'+tokenMatch[2]+'");';
- }
- path = path.replace(tokenMatch[0], "");
- }else if(path.substr(0, 1) != '@'){
- fn[fn.length] = 'n = getNodes(n, mode, "*");';
- }
-
- }else{
- if(tokenMatch){
- if(tokenMatch[1] == "#"){
- fn[fn.length] = 'n = byId(n, "'+tokenMatch[2]+'");';
- }else{
- fn[fn.length] = 'n = byTag(n, "'+tokenMatch[2]+'");';
- }
- path = path.replace(tokenMatch[0], "");
+ if (reverse !== true) {
+ for (i = 0; i < ln; i++) {
+ if (fn.call(scope || array[i], array[i], i, array) === false) {
+ return i;
}
}
- while(!(modeMatch = path.match(modeRe))){
- var matched = false;
- for(var j = 0; j < matchersLn; j++){
- var t = matchers[j];
- var m = path.match(t.re);
- if(m){
- fn[fn.length] = t.select.replace(tplRe, function(x, i){
- return m[i];
- });
- path = path.replace(m[0], "");
- matched = true;
- break;
- }
- }
-
- if(!matched){
- throw 'Error parsing selector, parsing failed at "' + path + '"';
+ }
+ else {
+ for (i = ln - 1; i > -1; i--) {
+ if (fn.call(scope || array[i], array[i], i, array) === false) {
+ return i;
}
}
- if(modeMatch[1]){
- fn[fn.length] = 'mode="'+modeMatch[1].replace(trimRe, "")+'";';
- path = path.replace(modeMatch[1], "");
- }
}
-
- fn[fn.length] = "return nodup(n);\n}";
-
-
- eval(fn.join(""));
- return f;
+
+ return true;
},
- jsSelect: function(path, root, type){
-
- root = root || document;
-
- if(typeof root == "string"){
- root = document.getElementById(root);
- }
- var paths = path.split(","),
- results = [];
-
-
- for(var i = 0, len = paths.length; i < len; i++){
- var subPath = paths[i].replace(trimRe, "");
-
- if(!cache[subPath]){
- cache[subPath] = Ext.DomQuery.compile(subPath);
- if(!cache[subPath]){
- throw subPath + " is not a valid selector";
- }
- }
- var result = cache[subPath](root);
- if(result && result != document){
- results = results.concat(result);
- }
+ forEach: function(array, fn, scope) {
+ if (supportsForEach) {
+ return array.forEach(fn, scope);
}
-
-
-
- if(paths.length > 1){
- return nodup(results);
+
+ var i = 0,
+ ln = array.length;
+
+ for (; i < ln; i++) {
+ fn.call(scope, array[i], i, array);
}
- return results;
},
- isXml: function(el) {
- var docEl = (el ? el.ownerDocument || el : 0).documentElement;
- return docEl ? docEl.nodeName !== "HTML" : false;
- },
- select : document.querySelectorAll ? function(path, root, type) {
- root = root || document;
- if (!Ext.DomQuery.isXml(root)) {
- try {
- var cs = root.querySelectorAll(path);
- return Ext.toArray(cs);
- }
- catch (ex) {}
- }
- return Ext.DomQuery.jsSelect.call(this, path, root, type);
- } : function(path, root, type) {
- return Ext.DomQuery.jsSelect.call(this, path, root, type);
- },
- selectNode : function(path, root){
- return Ext.DomQuery.select(path, root)[0];
+ indexOf: function(array, item, from) {
+ if (supportsIndexOf) {
+ return array.indexOf(item, from);
+ }
+
+ var i, length = array.length;
+
+ for (i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++) {
+ if (array[i] === item) {
+ return i;
+ }
+ }
+
+ return -1;
},
- selectValue : function(path, root, defaultValue){
- path = path.replace(trimRe, "");
- if(!valueCache[path]){
- valueCache[path] = Ext.DomQuery.compile(path, "select");
+ contains: function(array, item) {
+ if (supportsIndexOf) {
+ return array.indexOf(item) !== -1;
}
- var n = valueCache[path](root), v;
- n = n[0] ? n[0] : n;
-
-
-
-
-
- if (typeof n.normalize == 'function') n.normalize();
-
- v = (n && n.firstChild ? n.firstChild.nodeValue : null);
- return ((v === null||v === undefined||v==='') ? defaultValue : v);
+
+ var i, ln;
+
+ for (i = 0, ln = array.length; i < ln; i++) {
+ if (array[i] === item) {
+ return true;
+ }
+ }
+
+ return false;
},
- selectNumber : function(path, root, defaultValue){
- var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
- return parseFloat(v);
+ toArray: function(iterable, start, end){
+ if (!iterable || !iterable.length) {
+ return [];
+ }
+
+ if (typeof iterable === 'string') {
+ iterable = iterable.split('');
+ }
+
+ if (supportsSliceOnNodeList) {
+ return slice.call(iterable, start || 0, end || iterable.length);
+ }
+
+ var array = [],
+ i;
+
+ start = start || 0;
+ end = end ? ((end < 0) ? iterable.length + end : end) : iterable.length;
+
+ for (i = start; i < end; i++) {
+ array.push(iterable[i]);
+ }
+
+ return array;
},
- is : function(el, ss){
- if(typeof el == "string"){
- el = document.getElementById(el);
+ pluck: function(array, propertyName) {
+ var ret = [],
+ i, ln, item;
+
+ for (i = 0, ln = array.length; i < ln; i++) {
+ item = array[i];
+
+ ret.push(item[propertyName]);
}
- var isArray = Ext.isArray(el),
- result = Ext.DomQuery.filter(isArray ? el : [el], ss);
- return isArray ? (result.length == el.length) : (result.length > 0);
+
+ return ret;
},
- filter : function(els, ss, nonMatches){
- ss = ss.replace(trimRe, "");
- if(!simpleCache[ss]){
- simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
+ map: function(array, fn, scope) {
+ if (supportsMap) {
+ return array.map(fn, scope);
}
- var result = simpleCache[ss](els);
- return nonMatches ? quickDiff(result, els) : result;
+
+ var results = [],
+ i = 0,
+ len = array.length;
+
+ for (; i < len; i++) {
+ results[i] = fn.call(scope, array[i], i, array);
+ }
+
+ return results;
},
- matchers : [{
- re: /^\.([\w-]+)/,
- select: 'n = byClassName(n, " {1} ");'
- }, {
- re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
- select: 'n = byPseudo(n, "{1}", "{2}");'
- },{
- re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
- select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
- }, {
- re: /^#([\w-]+)/,
- select: 'n = byId(n, "{1}");'
- },{
- re: /^@([\w-]+)/,
- select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
+ every: function(array, fn, scope) {
+ if (supportsEvery) {
+ return array.every(fn, scope);
}
- ],
-
- operators : {
- "=" : function(a, v){
- return a == v;
- },
- "!=" : function(a, v){
- return a != v;
- },
- "^=" : function(a, v){
- return a && a.substr(0, v.length) == v;
- },
- "$=" : function(a, v){
- return a && a.substr(a.length-v.length) == v;
- },
- "*=" : function(a, v){
- return a && a.indexOf(v) !== -1;
- },
- "%=" : function(a, v){
- return (a % v) == 0;
- },
- "|=" : function(a, v){
- return a && (a == v || a.substr(0, v.length+1) == v+'-');
- },
- "~=" : function(a, v){
- return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
+ var i = 0,
+ ln = array.length;
+
+ for (; i < ln; ++i) {
+ if (!fn.call(scope, array[i], i, array)) {
+ return false;
+ }
}
+
+ return true;
},
- pseudos : {
- "first-child" : function(c){
- var r = [], ri = -1, n;
- for(var i = 0, ci; ci = n = c[i]; i++){
- while((n = n.previousSibling) && n.nodeType != 1);
- if(!n){
- r[++ri] = ci;
- }
+ some: function(array, fn, scope) {
+ if (supportsSome) {
+ return array.some(fn, scope);
+ }
+
+ var i = 0,
+ ln = array.length;
+
+ for (; i < ln; ++i) {
+ if (fn.call(scope, array[i], i, array)) {
+ return true;
}
- return r;
- },
+ }
- "last-child" : function(c){
- var r = [], ri = -1, n;
- for(var i = 0, ci; ci = n = c[i]; i++){
- while((n = n.nextSibling) && n.nodeType != 1);
- if(!n){
- r[++ri] = ci;
- }
+ return false;
+ },
+
+
+ clean: function(array) {
+ var results = [],
+ i = 0,
+ ln = array.length,
+ item;
+
+ for (; i < ln; i++) {
+ item = array[i];
+
+ if (!Ext.isEmpty(item)) {
+ results.push(item);
}
- return r;
- },
+ }
- "nth-child" : function(c, a) {
- var r = [], ri = -1,
- m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),
- f = (m[1] || 1) - 0, l = m[2] - 0;
- for(var i = 0, n; n = c[i]; i++){
- var pn = n.parentNode;
- if (batch != pn._batch) {
- var j = 0;
- for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
- if(cn.nodeType == 1){
- cn.nodeIndex = ++j;
- }
- }
- pn._batch = batch;
- }
- if (f == 1) {
- if (l == 0 || n.nodeIndex == l){
- r[++ri] = n;
- }
- } else if ((n.nodeIndex + l) % f == 0){
- r[++ri] = n;
- }
+ return results;
+ },
+
+
+ unique: function(array) {
+ var clone = [],
+ i = 0,
+ ln = array.length,
+ item;
+
+ for (; i < ln; i++) {
+ item = array[i];
+
+ if (ExtArray.indexOf(clone, item) === -1) {
+ clone.push(item);
}
+ }
- return r;
- },
+ return clone;
+ },
- "only-child" : function(c){
- var r = [], ri = -1;;
- for(var i = 0, ci; ci = c[i]; i++){
- if(!prev(ci) && !next(ci)){
- r[++ri] = ci;
- }
+
+ filter: function(array, fn, scope) {
+ if (supportsFilter) {
+ return array.filter(fn, scope);
+ }
+
+ var results = [],
+ i = 0,
+ ln = array.length;
+
+ for (; i < ln; i++) {
+ if (fn.call(scope, array[i], i, array)) {
+ results.push(array[i]);
}
- return r;
- },
+ }
- "empty" : function(c){
- var r = [], ri = -1;
- for(var i = 0, ci; ci = c[i]; i++){
- var cns = ci.childNodes, j = 0, cn, empty = true;
- while(cn = cns[j]){
- ++j;
- if(cn.nodeType == 1 || cn.nodeType == 3){
- empty = false;
+ return results;
+ },
+
+
+ from: function(value, newReference) {
+ if (value === undefined || value === null) {
+ return [];
+ }
+
+ if (Ext.isArray(value)) {
+ return (newReference) ? slice.call(value) : value;
+ }
+
+ if (value && value.length !== undefined && typeof value !== 'string') {
+ return Ext.toArray(value);
+ }
+
+ return [value];
+ },
+
+
+ remove: function(array, item) {
+ var index = ExtArray.indexOf(array, item);
+
+ if (index !== -1) {
+ erase(array, index, 1);
+ }
+
+ return array;
+ },
+
+
+ include: function(array, item) {
+ if (!ExtArray.contains(array, item)) {
+ array.push(item);
+ }
+ },
+
+
+ clone: function(array) {
+ return slice.call(array);
+ },
+
+
+ merge: function() {
+ var args = slice.call(arguments),
+ array = [],
+ i, ln;
+
+ for (i = 0, ln = args.length; i < ln; i++) {
+ array = array.concat(args[i]);
+ }
+
+ return ExtArray.unique(array);
+ },
+
+
+ intersect: function() {
+ var intersect = [],
+ arrays = slice.call(arguments),
+ i, j, k, minArray, array, x, y, ln, arraysLn, arrayLn;
+
+ if (!arrays.length) {
+ return intersect;
+ }
+
+
+ for (i = x = 0,ln = arrays.length; i < ln,array = arrays[i]; i++) {
+ if (!minArray || array.length < minArray.length) {
+ minArray = array;
+ x = i;
+ }
+ }
+
+ minArray = ExtArray.unique(minArray);
+ erase(arrays, x, 1);
+
+
+
+
+ for (i = 0,ln = minArray.length; i < ln,x = minArray[i]; i++) {
+ var count = 0;
+
+ for (j = 0,arraysLn = arrays.length; j < arraysLn,array = arrays[j]; j++) {
+ for (k = 0,arrayLn = array.length; k < arrayLn,y = array[k]; k++) {
+ if (x === y) {
+ count++;
break;
}
}
- if(empty){
- r[++ri] = ci;
- }
}
- return r;
- },
- "contains" : function(c, v){
- var r = [], ri = -1;
- for(var i = 0, ci; ci = c[i]; i++){
- if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
- r[++ri] = ci;
- }
+ if (count === arraysLn) {
+ intersect.push(x);
}
- return r;
- },
+ }
- "nodeValue" : function(c, v){
- var r = [], ri = -1;
- for(var i = 0, ci; ci = c[i]; i++){
- if(ci.firstChild && ci.firstChild.nodeValue == v){
- r[++ri] = ci;
+ return intersect;
+ },
+
+
+ difference: function(arrayA, arrayB) {
+ var clone = slice.call(arrayA),
+ ln = clone.length,
+ i, j, lnB;
+
+ for (i = 0,lnB = arrayB.length; i < lnB; i++) {
+ for (j = 0; j < ln; j++) {
+ if (clone[j] === arrayB[i]) {
+ erase(clone, j, 1);
+ j--;
+ ln--;
}
}
- return r;
- },
+ }
- "checked" : function(c){
- var r = [], ri = -1;
- for(var i = 0, ci; ci = c[i]; i++){
- if(ci.checked == true){
- r[++ri] = ci;
- }
+ return clone;
+ },
+
+
+
+ slice: ([1,2].slice(1, undefined).length ?
+ function (array, begin, end) {
+ return slice.call(array, begin, end);
+ } :
+
+ function (array, begin, end) {
+
+
+ if (typeof begin === 'undefined') {
+ return slice.call(array);
}
- return r;
- },
+ if (typeof end === 'undefined') {
+ return slice.call(array, begin);
+ }
+ return slice.call(array, begin, end);
+ }
+ ),
- "not" : function(c, ss){
- return Ext.DomQuery.filter(c, ss, true);
- },
+
+ sort: function(array, sortFn) {
+ if (supportsSort) {
+ if (sortFn) {
+ return array.sort(sortFn);
+ } else {
+ return array.sort();
+ }
+ }
- "any" : function(c, selectors){
- var ss = selectors.split('|'),
- r = [], ri = -1, s;
- for(var i = 0, ci; ci = c[i]; i++){
- for(var j = 0; s = ss[j]; j++){
- if(Ext.DomQuery.is(ci, s)){
- r[++ri] = ci;
- break;
+ var length = array.length,
+ i = 0,
+ comparison,
+ j, min, tmp;
+
+ for (; i < length; i++) {
+ min = i;
+ for (j = i + 1; j < length; j++) {
+ if (sortFn) {
+ comparison = sortFn(array[j], array[min]);
+ if (comparison < 0) {
+ min = j;
}
+ } else if (array[j] < array[min]) {
+ min = j;
}
}
- return r;
- },
-
- "odd" : function(c){
- return this["nth-child"](c, "odd");
- },
+ if (min !== i) {
+ tmp = array[i];
+ array[i] = array[min];
+ array[min] = tmp;
+ }
+ }
- "even" : function(c){
- return this["nth-child"](c, "even");
- },
+ return array;
+ },
- "nth" : function(c, a){
- return c[a-1] || [];
- },
+
+ flatten: function(array) {
+ var worker = [];
- "first" : function(c){
- return c[0] || [];
- },
+ function rFlatten(a) {
+ var i, ln, v;
- "last" : function(c){
- return c[c.length-1] || [];
- },
+ for (i = 0, ln = a.length; i < ln; i++) {
+ v = a[i];
- "has" : function(c, ss){
- var s = Ext.DomQuery.select,
- r = [], ri = -1;
- for(var i = 0, ci; ci = c[i]; i++){
- if(s(ss, ci).length > 0){
- r[++ri] = ci;
+ if (Ext.isArray(v)) {
+ rFlatten(v);
+ } else {
+ worker.push(v);
}
}
- return r;
- },
- "next" : function(c, ss){
- var is = Ext.DomQuery.is,
- r = [], ri = -1;
- for(var i = 0, ci; ci = c[i]; i++){
- var n = next(ci);
- if(n && is(n, ss)){
- r[++ri] = ci;
+ return worker;
+ }
+
+ return rFlatten(array);
+ },
+
+
+ min: function(array, comparisonFn) {
+ var min = array[0],
+ i, ln, item;
+
+ for (i = 0, ln = array.length; i < ln; i++) {
+ item = array[i];
+
+ if (comparisonFn) {
+ if (comparisonFn(min, item) === 1) {
+ min = item;
}
}
- return r;
- },
+ else {
+ if (item < min) {
+ min = item;
+ }
+ }
+ }
- "prev" : function(c, ss){
- var is = Ext.DomQuery.is,
- r = [], ri = -1;
- for(var i = 0, ci; ci = c[i]; i++){
- var n = prev(ci);
- if(n && is(n, ss)){
- r[++ri] = ci;
+ return min;
+ },
+
+
+ max: function(array, comparisonFn) {
+ var max = array[0],
+ i, ln, item;
+
+ for (i = 0, ln = array.length; i < ln; i++) {
+ item = array[i];
+
+ if (comparisonFn) {
+ if (comparisonFn(max, item) === -1) {
+ max = item;
+ }
+ }
+ else {
+ if (item > max) {
+ max = item;
}
}
- return r;
}
- }
- };
-}();
+ return max;
+ },
-Ext.query = Ext.DomQuery.select;
+
+ mean: function(array) {
+ return array.length > 0 ? ExtArray.sum(array) / array.length : undefined;
+ },
-Ext.util.DelayedTask = function(fn, scope, args){
- var me = this,
- id,
- call = function(){
- clearInterval(id);
- id = null;
- fn.apply(scope, args || []);
- };
-
-
- me.delay = function(delay, newFn, newScope, newArgs){
- me.cancel();
- fn = newFn || fn;
- scope = newScope || scope;
- args = newArgs || args;
- id = setInterval(call, delay);
+
+ sum: function(array) {
+ var sum = 0,
+ i, ln, item;
+
+ for (i = 0,ln = array.length; i < ln; i++) {
+ item = array[i];
+
+ sum += item;
+ }
+
+ return sum;
+ },
+
+
+
+ erase: erase,
+
+
+ insert: function (array, index, items) {
+ return replace(array, index, 0, items);
+ },
+
+
+ replace: replace,
+
+
+ splice: splice
};
- me.cancel = function(){
- if(id){
- clearInterval(id);
- id = null;
- }
- };
-};(function(){
+ Ext.each = ExtArray.each;
-var EXTUTIL = Ext.util,
- EACH = Ext.each,
- TRUE = true,
- FALSE = false;
+
+ ExtArray.union = ExtArray.merge;
-EXTUTIL.Observable = function(){
- var me = this, e = me.events;
- if(me.listeners){
- me.on(me.listeners);
- delete me.listeners;
- }
- me.events = e || {};
-};
+ Ext.min = ExtArray.min;
-EXTUTIL.Observable.prototype = {
- filterOptRe : /^(?:scope|delay|buffer|single)$/,
+ Ext.max = ExtArray.max;
- fireEvent : function(){
- var a = Array.prototype.slice.call(arguments, 0),
- ename = a[0].toLowerCase(),
- me = this,
- ret = TRUE,
- ce = me.events[ename],
- cc,
- q,
- c;
- if (me.eventsSuspended === TRUE) {
- if (q = me.eventQueue) {
- q.push(a);
+ Ext.sum = ExtArray.sum;
+
+
+ Ext.mean = ExtArray.mean;
+
+
+ Ext.flatten = ExtArray.flatten;
+
+
+ Ext.clean = ExtArray.clean;
+
+
+ Ext.unique = ExtArray.unique;
+
+
+ Ext.pluck = ExtArray.pluck;
+
+
+ Ext.toArray = function() {
+ return ExtArray.toArray.apply(ExtArray, arguments);
+ };
+})();
+
+
+Ext.Function = {
+
+
+ flexSetter: function(fn) {
+ return function(a, b) {
+ var k, i;
+
+ if (a === null) {
+ return this;
}
- }
- else if(typeof ce == 'object') {
- if (ce.bubble){
- if(ce.fire.apply(ce, a.slice(1)) === FALSE) {
- return FALSE;
+
+ if (typeof a !== 'string') {
+ for (k in a) {
+ if (a.hasOwnProperty(k)) {
+ fn.call(this, k, a[k]);
+ }
}
- c = me.getBubbleTarget && me.getBubbleTarget();
- if(c && c.enableBubble) {
- cc = c.events[ename];
- if(!cc || typeof cc != 'object' || !cc.bubble) {
- c.enableBubble(ename);
+
+ if (Ext.enumerables) {
+ for (i = Ext.enumerables.length; i--;) {
+ k = Ext.enumerables[i];
+ if (a.hasOwnProperty(k)) {
+ fn.call(this, k, a[k]);
+ }
}
- return c.fireEvent.apply(c, a);
}
+ } else {
+ fn.call(this, a, b);
}
- else {
- a.shift();
- ret = ce.fire.apply(ce, a);
- }
- }
- return ret;
+
+ return this;
+ };
},
- addListener : function(eventName, fn, scope, o){
- var me = this,
- e,
- oe,
- isF,
- ce;
- if (typeof eventName == 'object') {
- o = eventName;
- for (e in o){
- oe = o[e];
- if (!me.filterOptRe.test(e)) {
- me.addListener(e, oe.fn || oe, oe.scope || o.scope, oe.fn ? oe : o);
- }
- }
- } else {
- eventName = eventName.toLowerCase();
- ce = me.events[eventName] || TRUE;
- if (typeof ce == 'boolean') {
- me.events[eventName] = ce = new EXTUTIL.Event(me, eventName);
+ bind: function(fn, scope, args, appendArgs) {
+ if (arguments.length === 2) {
+ return function() {
+ return fn.apply(scope, arguments);
}
- ce.addListener(fn, scope, typeof o == 'object' ? o : {});
}
+
+ var method = fn,
+ slice = Array.prototype.slice;
+
+ return function() {
+ var callArgs = args || arguments;
+
+ if (appendArgs === true) {
+ callArgs = slice.call(arguments, 0);
+ callArgs = callArgs.concat(args);
+ }
+ else if (typeof appendArgs == 'number') {
+ callArgs = slice.call(arguments, 0);
+ Ext.Array.insert(callArgs, appendArgs, args);
+ }
+
+ return method.apply(scope || window, callArgs);
+ };
},
- removeListener : function(eventName, fn, scope){
- var ce = this.events[eventName.toLowerCase()];
- if (typeof ce == 'object') {
- ce.removeListener(fn, scope);
+ pass: function(fn, args, scope) {
+ if (args) {
+ args = Ext.Array.from(args);
}
+
+ return function() {
+ return fn.apply(scope, args.concat(Ext.Array.toArray(arguments)));
+ };
},
- purgeListeners : function(){
- var events = this.events,
- evt,
- key;
- for(key in events){
- evt = events[key];
- if(typeof evt == 'object'){
- evt.clearListeners();
- }
+ alias: function(object, methodName) {
+ return function() {
+ return object[methodName].apply(object, arguments);
+ };
+ },
+
+
+ createInterceptor: function(origFn, newFn, scope, returnValue) {
+ var method = origFn;
+ if (!Ext.isFunction(newFn)) {
+ return origFn;
+ }
+ else {
+ return function() {
+ var me = this,
+ args = arguments;
+ newFn.target = me;
+ newFn.method = origFn;
+ return (newFn.apply(scope || me || window, args) !== false) ? origFn.apply(me || window, args) : returnValue || null;
+ };
}
},
- addEvents : function(o){
- var me = this;
- me.events = me.events || {};
- if (typeof o == 'string') {
- var a = arguments,
- i = a.length;
- while(i--) {
- me.events[a[i]] = me.events[a[i]] || TRUE;
- }
- } else {
- Ext.applyIf(me.events, o);
+ createDelayed: function(fn, delay, scope, args, appendArgs) {
+ if (scope || args) {
+ fn = Ext.Function.bind(fn, scope, args, appendArgs);
}
+ return function() {
+ var me = this;
+ setTimeout(function() {
+ fn.apply(me, arguments);
+ }, delay);
+ };
},
- hasListener : function(eventName){
- var e = this.events[eventName.toLowerCase()];
- return typeof e == 'object' && e.listeners.length > 0;
+ defer: function(fn, millis, obj, args, appendArgs) {
+ fn = Ext.Function.bind(fn, obj, args, appendArgs);
+ if (millis > 0) {
+ return setTimeout(fn, millis);
+ }
+ fn();
+ return 0;
},
- suspendEvents : function(queueSuspended){
- this.eventsSuspended = TRUE;
- if(queueSuspended && !this.eventQueue){
- this.eventQueue = [];
+ createSequence: function(origFn, newFn, scope) {
+ if (!Ext.isFunction(newFn)) {
+ return origFn;
+ }
+ else {
+ return function() {
+ var retval = origFn.apply(this || window, arguments);
+ newFn.apply(scope || this || window, arguments);
+ return retval;
+ };
}
},
- resumeEvents : function(){
- var me = this,
- queued = me.eventQueue || [];
- me.eventsSuspended = FALSE;
- delete me.eventQueue;
- EACH(queued, function(e) {
- me.fireEvent.apply(me, e);
- });
+ createBuffered: function(fn, buffer, scope, args) {
+ return function(){
+ var timerId;
+ return function() {
+ var me = this;
+ if (timerId) {
+ clearTimeout(timerId);
+ timerId = null;
+ }
+ timerId = setTimeout(function(){
+ fn.apply(scope || me, args || arguments);
+ }, buffer);
+ };
+ }();
+ },
+
+
+ createThrottled: function(fn, interval, scope) {
+ var lastCallTime, elapsed, lastArgs, timer, execute = function() {
+ fn.apply(scope || this, lastArgs);
+ lastCallTime = new Date().getTime();
+ };
+
+ return function() {
+ elapsed = new Date().getTime() - lastCallTime;
+ lastArgs = arguments;
+
+ clearTimeout(timer);
+ if (!lastCallTime || (elapsed >= interval)) {
+ execute();
+ } else {
+ timer = setTimeout(execute, interval - elapsed);
+ }
+ };
+ },
+
+
+ interceptBefore: function(object, methodName, fn) {
+ var method = object[methodName] || Ext.emptyFn;
+
+ return object[methodName] = function() {
+ var ret = fn.apply(this, arguments);
+ method.apply(this, arguments);
+
+ return ret;
+ };
+ },
+
+
+ interceptAfter: function(object, methodName, fn) {
+ var method = object[methodName] || Ext.emptyFn;
+
+ return object[methodName] = function() {
+ method.apply(this, arguments);
+ return fn.apply(this, arguments);
+ };
}
};
-var OBSERVABLE = EXTUTIL.Observable.prototype;
-OBSERVABLE.on = OBSERVABLE.addListener;
+Ext.defer = Ext.Function.alias(Ext.Function, 'defer');
-OBSERVABLE.un = OBSERVABLE.removeListener;
+Ext.pass = Ext.Function.alias(Ext.Function, 'pass');
-EXTUTIL.Observable.releaseCapture = function(o){
- o.fireEvent = OBSERVABLE.fireEvent;
-};
-function createTargeted(h, o, scope){
- return function(){
- if(o.target == arguments[0]){
- h.apply(scope, Array.prototype.slice.call(arguments, 0));
- }
- };
-};
+Ext.bind = Ext.Function.alias(Ext.Function, 'bind');
-function createBuffered(h, o, l, scope){
- l.task = new EXTUTIL.DelayedTask();
- return function(){
- l.task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));
- };
-};
-function createSingle(h, e, fn, scope){
- return function(){
- e.removeListener(fn, scope);
- return h.apply(scope, arguments);
- };
-};
-function createDelayed(h, o, l, scope){
- return function(){
- var task = new EXTUTIL.DelayedTask();
- if(!l.tasks) {
- l.tasks = [];
- }
- l.tasks.push(task);
- task.delay(o.delay || 10, h, scope, Array.prototype.slice.call(arguments, 0));
- };
-};
+(function() {
-EXTUTIL.Event = function(obj, name){
- this.name = name;
- this.obj = obj;
- this.listeners = [];
-};
+var ExtObject = Ext.Object = {
-EXTUTIL.Event.prototype = {
- addListener : function(fn, scope, options){
- var me = this,
- l;
- scope = scope || me.obj;
- if(!me.isListening(fn, scope)){
- l = me.createListener(fn, scope, options);
- if(me.firing){
- me.listeners = me.listeners.slice(0);
- }
- me.listeners.push(l);
- }
- },
+
+ toQueryObjects: function(name, value, recursive) {
+ var self = ExtObject.toQueryObjects,
+ objects = [],
+ i, ln;
- createListener: function(fn, scope, o){
- o = o || {}, scope = scope || this.obj;
- var l = {
- fn: fn,
- scope: scope,
- options: o
- }, h = fn;
- if(o.target){
- h = createTargeted(h, o, scope);
- }
- if(o.delay){
- h = createDelayed(h, o, l, scope);
+ if (Ext.isArray(value)) {
+ for (i = 0, ln = value.length; i < ln; i++) {
+ if (recursive) {
+ objects = objects.concat(self(name + '[' + i + ']', value[i], true));
+ }
+ else {
+ objects.push({
+ name: name,
+ value: value[i]
+ });
+ }
+ }
}
- if(o.single){
- h = createSingle(h, this, fn, scope);
+ else if (Ext.isObject(value)) {
+ for (i in value) {
+ if (value.hasOwnProperty(i)) {
+ if (recursive) {
+ objects = objects.concat(self(name + '[' + i + ']', value[i], true));
+ }
+ else {
+ objects.push({
+ name: name,
+ value: value[i]
+ });
+ }
+ }
+ }
}
- if(o.buffer){
- h = createBuffered(h, o, l, scope);
+ else {
+ objects.push({
+ name: name,
+ value: value
+ });
}
- l.fireFn = h;
- return l;
+
+ return objects;
},
- findListener : function(fn, scope){
- var list = this.listeners,
- i = list.length,
- l;
+
+ toQueryString: function(object, recursive) {
+ var paramObjects = [],
+ params = [],
+ i, j, ln, paramObject, value;
- scope = scope || this.obj;
- while(i--){
- l = list[i];
- if(l){
- if(l.fn == fn && l.scope == scope){
- return i;
- }
+ for (i in object) {
+ if (object.hasOwnProperty(i)) {
+ paramObjects = paramObjects.concat(ExtObject.toQueryObjects(i, object[i], recursive));
}
}
- return -1;
- },
- isListening : function(fn, scope){
- return this.findListener(fn, scope) != -1;
- },
+ for (j = 0, ln = paramObjects.length; j < ln; j++) {
+ paramObject = paramObjects[j];
+ value = paramObject.value;
- removeListener : function(fn, scope){
- var index,
- l,
- k,
- me = this,
- ret = FALSE;
- if((index = me.findListener(fn, scope)) != -1){
- if (me.firing) {
- me.listeners = me.listeners.slice(0);
- }
- l = me.listeners[index];
- if(l.task) {
- l.task.cancel();
- delete l.task;
+ if (Ext.isEmpty(value)) {
+ value = '';
}
- k = l.tasks && l.tasks.length;
- if(k) {
- while(k--) {
- l.tasks[k].cancel();
- }
- delete l.tasks;
+ else if (Ext.isDate(value)) {
+ value = Ext.Date.toString(value);
}
- me.listeners.splice(index, 1);
- ret = TRUE;
+
+ params.push(encodeURIComponent(paramObject.name) + '=' + encodeURIComponent(String(value)));
}
- return ret;
+
+ return params.join('&');
},
- clearListeners : function(){
- var me = this,
- l = me.listeners,
- i = l.length;
- while(i--) {
- me.removeListener(l[i].fn, l[i].scope);
- }
- },
+ fromQueryString: function(queryString, recursive) {
+ var parts = queryString.replace(/^\?/, '').split('&'),
+ object = {},
+ temp, components, name, value, i, ln,
+ part, j, subLn, matchedKeys, matchedName,
+ keys, key, nextKey;
- fire : function(){
- var me = this,
- listeners = me.listeners,
- len = listeners.length,
- i = 0,
- l;
+ for (i = 0, ln = parts.length; i < ln; i++) {
+ part = parts[i];
- if(len > 0){
- me.firing = TRUE;
- var args = Array.prototype.slice.call(arguments, 0);
- for (; i < len; i++) {
- l = listeners[i];
- if(l && l.fireFn.apply(l.scope || me.obj || window, args) === FALSE) {
- return (me.firing = FALSE);
+ if (part.length > 0) {
+ components = part.split('=');
+ name = decodeURIComponent(components[0]);
+ value = (components[1] !== undefined) ? decodeURIComponent(components[1]) : '';
+
+ if (!recursive) {
+ if (object.hasOwnProperty(name)) {
+ if (!Ext.isArray(object[name])) {
+ object[name] = [object[name]];
+ }
+
+ object[name].push(value);
+ }
+ else {
+ object[name] = value;
+ }
}
- }
- }
- me.firing = FALSE;
- return TRUE;
- }
+ else {
+ matchedKeys = name.match(/(\[):?([^\]]*)\]/g);
+ matchedName = name.match(/^([^\[]+)/);
-};
-})();
-Ext.apply(Ext.util.Observable.prototype, function(){
-
-
-
- function getMethodEvent(method){
- var e = (this.methodEvents = this.methodEvents ||
- {})[method], returnValue, v, cancel, obj = this;
+ name = matchedName[0];
+ keys = [];
- if (!e) {
- this.methodEvents[method] = e = {};
- e.originalFn = this[method];
- e.methodName = method;
- e.before = [];
- e.after = [];
+ if (matchedKeys === null) {
+ object[name] = value;
+ continue;
+ }
- var makeCall = function(fn, scope, args){
- if((v = fn.apply(scope || obj, args)) !== undefined){
- if (typeof v == 'object') {
- if(v.returnValue !== undefined){
- returnValue = v.returnValue;
- }else{
- returnValue = v;
- }
- cancel = !!v.cancel;
+ for (j = 0, subLn = matchedKeys.length; j < subLn; j++) {
+ key = matchedKeys[j];
+ key = (key.length === 2) ? '' : key.substring(1, key.length - 1);
+ keys.push(key);
}
- else
- if (v === false) {
- cancel = true;
+
+ keys.unshift(name);
+
+ temp = object;
+
+ for (j = 0, subLn = keys.length; j < subLn; j++) {
+ key = keys[j];
+
+ if (j === subLn - 1) {
+ if (Ext.isArray(temp) && key === '') {
+ temp.push(value);
+ }
+ else {
+ temp[key] = value;
+ }
}
else {
- returnValue = v;
- }
- }
- };
+ if (temp[key] === undefined || typeof temp[key] === 'string') {
+ nextKey = keys[j+1];
- this[method] = function(){
- var args = Array.prototype.slice.call(arguments, 0),
- b;
- returnValue = v = undefined;
- cancel = false;
+ temp[key] = (Ext.isNumeric(nextKey) || nextKey === '') ? [] : {};
+ }
- for(var i = 0, len = e.before.length; i < len; i++){
- b = e.before[i];
- makeCall(b.fn, b.scope, args);
- if (cancel) {
- return returnValue;
+ temp = temp[key];
+ }
}
}
+ }
+ }
- if((v = e.originalFn.apply(obj, args)) !== undefined){
- returnValue = v;
- }
+ return object;
+ },
- for(var i = 0, len = e.after.length; i < len; i++){
- b = e.after[i];
- makeCall(b.fn, b.scope, args);
- if (cancel) {
- return returnValue;
- }
+
+ each: function(object, fn, scope) {
+ for (var property in object) {
+ if (object.hasOwnProperty(property)) {
+ if (fn.call(scope || object, property, object[property], object) === false) {
+ return;
}
- return returnValue;
- };
+ }
}
- return e;
- }
-
- return {
-
-
-
- beforeMethod : function(method, fn, scope){
- getMethodEvent.call(this, method).before.push({
- fn: fn,
- scope: scope
- });
- },
-
-
- afterMethod : function(method, fn, scope){
- getMethodEvent.call(this, method).after.push({
- fn: fn,
- scope: scope
- });
- },
+ },
- removeMethodListener: function(method, fn, scope){
- var e = this.getMethodEvent(method);
- for(var i = 0, len = e.before.length; i < len; i++){
- if(e.before[i].fn == fn && e.before[i].scope == scope){
- e.before.splice(i, 1);
- return;
+
+ merge: function(source, key, value) {
+ if (typeof key === 'string') {
+ if (value && value.constructor === Object) {
+ if (source[key] && source[key].constructor === Object) {
+ ExtObject.merge(source[key], value);
}
- }
- for(var i = 0, len = e.after.length; i < len; i++){
- if(e.after[i].fn == fn && e.after[i].scope == scope){
- e.after.splice(i, 1);
- return;
+ else {
+ source[key] = Ext.clone(value);
}
}
- },
-
-
- relayEvents : function(o, events){
- var me = this;
- function createHandler(ename){
- return function(){
- return me.fireEvent.apply(me, [ename].concat(Array.prototype.slice.call(arguments, 0)));
- };
- }
- for(var i = 0, len = events.length; i < len; i++){
- var ename = events[i];
- me.events[ename] = me.events[ename] || true;
- o.on(ename, createHandler(ename), me);
+ else {
+ source[key] = value;
}
- },
-
- enableBubble : function(events){
- var me = this;
- if(!Ext.isEmpty(events)){
- events = Ext.isArray(events) ? events : Array.prototype.slice.call(arguments, 0);
- for(var i = 0, len = events.length; i < len; i++){
- var ename = events[i];
- ename = ename.toLowerCase();
- var ce = me.events[ename] || true;
- if (typeof ce == 'boolean') {
- ce = new Ext.util.Event(me, ename);
- me.events[ename] = ce;
- }
- ce.bubble = true;
- }
- }
+ return source;
}
- };
-}());
-
-
-
-Ext.util.Observable.capture = function(o, fn, scope){
- o.fireEvent = o.fireEvent.createInterceptor(fn, scope);
-};
-
-
-
-Ext.util.Observable.observeClass = function(c, listeners){
- if(c){
- if(!c.fireEvent){
- Ext.apply(c, new Ext.util.Observable());
- Ext.util.Observable.capture(c.prototype, c.fireEvent, c);
- }
- if(typeof listeners == 'object'){
- c.on(listeners);
- }
- return c;
- }
-};
+ var i = 1,
+ ln = arguments.length,
+ object, property;
-Ext.EventManager = function(){
- var docReadyEvent,
- docReadyProcId,
- docReadyState = false,
- DETECT_NATIVE = Ext.isGecko || Ext.isWebKit || Ext.isSafari,
- E = Ext.lib.Event,
- D = Ext.lib.Dom,
- DOC = document,
- WINDOW = window,
- DOMCONTENTLOADED = "DOMContentLoaded",
- COMPLETE = 'complete',
- propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,
-
- specialElCache = [];
+ for (; i < ln; i++) {
+ object = arguments[i];
- function getId(el){
- var id = false,
- i = 0,
- len = specialElCache.length,
- id = false,
- skip = false,
- o;
- if(el){
- if(el.getElementById || el.navigator){
-
- for(; i < len; ++i){
- o = specialElCache[i];
- if(o.el === el){
- id = o.id;
- break;
- }
- }
- if(!id){
-
- id = Ext.id(el);
- specialElCache.push({
- id: id,
- el: el
- });
- skip = true;
- }
- }else{
- id = Ext.id(el);
- }
- if(!Ext.elCache[id]){
- Ext.Element.addToCache(new Ext.Element(el), id);
- if(skip){
- Ext.elCache[id].skipGC = true;
+ for (property in object) {
+ if (object.hasOwnProperty(property)) {
+ ExtObject.merge(source, property, object[property]);
}
}
}
- return id;
- };
-
- function addListener(el, ename, fn, task, wrap, scope){
- el = Ext.getDom(el);
- var id = getId(el),
- es = Ext.elCache[id].events,
- wfn;
+ return source;
+ },
- wfn = E.on(el, ename, wrap);
- es[ename] = es[ename] || [];
+
+ getKey: function(object, value) {
+ for (var property in object) {
+ if (object.hasOwnProperty(property) && object[property] === value) {
+ return property;
+ }
+ }
-
- es[ename].push([fn, wrap, scope, wfn, task]);
+ return null;
+ },
-
-
+
+ getValues: function(object) {
+ var values = [],
+ property;
-
- if(el.addEventListener && ename == "mousewheel"){
- var args = ["DOMMouseScroll", wrap, false];
- el.addEventListener.apply(el, args);
- Ext.EventManager.addListener(WINDOW, 'unload', function(){
- el.removeEventListener.apply(el, args);
- });
+ for (property in object) {
+ if (object.hasOwnProperty(property)) {
+ values.push(object[property]);
+ }
}
-
- if(el == DOC && ename == "mousedown"){
- Ext.EventManager.stoppedMouseDownEvent.addListener(wrap);
- }
- };
+ return values;
+ },
- function doScrollChk(){
-
- if(window != top){
- return false;
- }
+
+ getKeys: ('keys' in Object.prototype) ? Object.keys : function(object) {
+ var keys = [],
+ property;
- try{
- DOC.documentElement.doScroll('left');
- }catch(e){
- return false;
+ for (property in object) {
+ if (object.hasOwnProperty(property)) {
+ keys.push(property);
+ }
}
- fireDocReady();
- return true;
- }
+ return keys;
+ },
+
- function checkReadyState(e){
+ getSize: function(object) {
+ var size = 0,
+ property;
- if(Ext.isIE && doScrollChk()){
- return true;
- }
- if(DOC.readyState == COMPLETE){
- fireDocReady();
- return true;
+ for (property in object) {
+ if (object.hasOwnProperty(property)) {
+ size++;
+ }
}
- docReadyState || (docReadyProcId = setTimeout(arguments.callee, 2));
- return false;
- }
- var styles;
- function checkStyleSheets(e){
- styles || (styles = Ext.query('style, link[rel=stylesheet]'));
- if(styles.length == DOC.styleSheets.length){
- fireDocReady();
- return true;
- }
- docReadyState || (docReadyProcId = setTimeout(arguments.callee, 2));
- return false;
+ return size;
}
+};
- function OperaDOMContentLoaded(e){
- DOC.removeEventListener(DOMCONTENTLOADED, arguments.callee, false);
- checkStyleSheets();
- }
- function fireDocReady(e){
- if(!docReadyState){
- docReadyState = true;
- if(docReadyProcId){
- clearTimeout(docReadyProcId);
- }
- if(DETECT_NATIVE) {
- DOC.removeEventListener(DOMCONTENTLOADED, fireDocReady, false);
- }
- if(Ext.isIE && checkReadyState.bindIE){
- DOC.detachEvent('onreadystatechange', checkReadyState);
- }
- E.un(WINDOW, "load", arguments.callee);
- }
- if(docReadyEvent && !Ext.isReady){
- Ext.isReady = true;
- docReadyEvent.fire();
- docReadyEvent.listeners = [];
- }
+Ext.merge = Ext.Object.merge;
- };
- function initDocReady(){
- docReadyEvent || (docReadyEvent = new Ext.util.Event());
- if (DETECT_NATIVE) {
- DOC.addEventListener(DOMCONTENTLOADED, fireDocReady, false);
- }
-
- if (Ext.isIE){
-
-
- if(!checkReadyState()){
- checkReadyState.bindIE = true;
- DOC.attachEvent('onreadystatechange', checkReadyState);
- }
+Ext.urlEncode = function() {
+ var args = Ext.Array.from(arguments),
+ prefix = '';
- }else if(Ext.isOpera ){
-
+
+ if ((typeof args[1] === 'string')) {
+ prefix = args[1] + '&';
+ args[1] = false;
+ }
-
- (DOC.readyState == COMPLETE && checkStyleSheets()) ||
- DOC.addEventListener(DOMCONTENTLOADED, OperaDOMContentLoaded, false);
+ return prefix + Ext.Object.toQueryString.apply(Ext.Object, args);
+};
- }else if (Ext.isWebKit){
-
- checkReadyState();
- }
-
- E.on(WINDOW, "load", fireDocReady);
- };
- function createTargeted(h, o){
- return function(){
- var args = Ext.toArray(arguments);
- if(o.target == Ext.EventObject.setEvent(args[0]).target){
- h.apply(this, args);
- }
- };
- };
+Ext.urlDecode = function() {
+ return Ext.Object.fromQueryString.apply(Ext.Object, arguments);
+};
- function createBuffered(h, o, task){
- return function(e){
-
- task.delay(o.buffer, h, null, [new Ext.EventObjectImpl(e)]);
- };
- };
+})();
- function createSingle(h, el, ename, fn, scope){
- return function(e){
- Ext.EventManager.removeListener(el, ename, fn, scope);
- h(e);
- };
- };
- function createDelayed(h, o, fn){
- return function(e){
- var task = new Ext.util.DelayedTask(h);
- if(!fn.tasks) {
- fn.tasks = [];
- }
- fn.tasks.push(task);
- task.delay(o.delay || 10, h, null, [new Ext.EventObjectImpl(e)]);
- };
- };
- function listen(element, ename, opt, fn, scope){
- var o = (!opt || typeof opt == "boolean") ? {} : opt,
- el = Ext.getDom(element), task;
- fn = fn || o.fn;
- scope = scope || o.scope;
- if(!el){
- throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';
- }
- function h(e){
-
- if(!Ext){
- return;
- }
- e = Ext.EventObject.setEvent(e);
- var t;
- if (o.delegate) {
- if(!(t = e.getTarget(o.delegate, el))){
- return;
- }
- } else {
- t = e.target;
- }
- if (o.stopEvent) {
- e.stopEvent();
- }
- if (o.preventDefault) {
- e.preventDefault();
- }
- if (o.stopPropagation) {
- e.stopPropagation();
- }
- if (o.normalized) {
- e = e.browserEvent;
- }
+(function() {
- fn.call(scope || el, e, t, o);
- };
- if(o.target){
- h = createTargeted(h, o);
- }
- if(o.delay){
- h = createDelayed(h, o, fn);
- }
- if(o.single){
- h = createSingle(h, el, ename, fn, scope);
- }
- if(o.buffer){
- task = new Ext.util.DelayedTask(h);
- h = createBuffered(h, o, task);
- }
- addListener(el, ename, fn, task, h, scope);
- return h;
- };
- var pub = {
-
- addListener : function(element, eventName, fn, scope, options){
- if(typeof eventName == 'object'){
- var o = eventName, e, val;
- for(e in o){
- val = o[e];
- if(!propRe.test(e)){
- if(Ext.isFunction(val)){
-
- listen(element, e, o, val, o.scope);
- }else{
-
- listen(element, e, val);
- }
- }
- }
- } else {
- listen(element, eventName, options, fn, scope);
- }
- },
-
- removeListener : function(el, eventName, fn, scope){
- el = Ext.getDom(el);
- var id = getId(el),
- f = el && (Ext.elCache[id].events)[eventName] || [],
- wrap, i, l, k, len, fnc;
+function xf(format) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ return format.replace(/\{(\d+)\}/g, function(m, i) {
+ return args[i];
+ });
+}
- for (i = 0, len = f.length; i < len; i++) {
+Ext.Date = {
+
+ now: Date.now || function() {
+ return +new Date();
+ },
-
- if (Ext.isArray(fnc = f[i]) && fnc[0] == fn && (!scope || fnc[2] == scope)) {
- if(fnc[4]) {
- fnc[4].cancel();
- }
- k = fn.tasks && fn.tasks.length;
- if(k) {
- while(k--) {
- fn.tasks[k].cancel();
- }
- delete fn.tasks;
- }
- wrap = fnc[1];
- E.un(el, eventName, E.extAdapter ? fnc[3] : wrap);
+
+ toString: function(date) {
+ var pad = Ext.String.leftPad;
-
- if(wrap && el.addEventListener && eventName == "mousewheel"){
- el.removeEventListener("DOMMouseScroll", wrap, false);
- }
+ return date.getFullYear() + "-"
+ + pad(date.getMonth() + 1, 2, '0') + "-"
+ + pad(date.getDate(), 2, '0') + "T"
+ + pad(date.getHours(), 2, '0') + ":"
+ + pad(date.getMinutes(), 2, '0') + ":"
+ + pad(date.getSeconds(), 2, '0');
+ },
-
- if(wrap && el == DOC && eventName == "mousedown"){
- Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);
- }
+
+ getElapsed: function(dateA, dateB) {
+ return Math.abs(dateA - (dateB || new Date()));
+ },
- f.splice(i, 1);
- if (f.length === 0) {
- delete Ext.elCache[id].events[eventName];
- }
- for (k in Ext.elCache[id].events) {
- return false;
- }
- Ext.elCache[id].events = {};
- return false;
- }
- }
- },
+
+ useStrict: false,
+
+ formatCodeToRegex: function(character, currentGroup) {
- removeAll : function(el){
- el = Ext.getDom(el);
- var id = getId(el),
- ec = Ext.elCache[id] || {},
- es = ec.events || {},
- f, i, len, ename, fn, k, wrap;
-
- for(ename in es){
- if(es.hasOwnProperty(ename)){
- f = es[ename];
-
- for (i = 0, len = f.length; i < len; i++) {
- fn = f[i];
- if(fn[4]) {
- fn[4].cancel();
- }
- if(fn[0].tasks && (k = fn[0].tasks.length)) {
- while(k--) {
- fn[0].tasks[k].cancel();
- }
- delete fn.tasks;
- }
- wrap = fn[1];
- E.un(el, ename, E.extAdapter ? fn[3] : wrap);
-
-
- if(el.addEventListener && wrap && ename == "mousewheel"){
- el.removeEventListener("DOMMouseScroll", wrap, false);
- }
-
-
- if(wrap && el == DOC && ename == "mousedown"){
- Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);
- }
- }
- }
- }
- if (Ext.elCache[id]) {
- Ext.elCache[id].events = {};
- }
- },
+ var p = utilDate.parseCodes[character];
- getListeners : function(el, eventName) {
- el = Ext.getDom(el);
- var id = getId(el),
- ec = Ext.elCache[id] || {},
- es = ec.events || {},
- results = [];
- if (es && es[eventName]) {
- return es[eventName];
- } else {
- return null;
- }
- },
-
- purgeElement : function(el, recurse, eventName) {
- el = Ext.getDom(el);
- var id = getId(el),
- ec = Ext.elCache[id] || {},
- es = ec.events || {},
- i, f, len;
- if (eventName) {
- if (es && es.hasOwnProperty(eventName)) {
- f = es[eventName];
- for (i = 0, len = f.length; i < len; i++) {
- Ext.EventManager.removeListener(el, eventName, f[i][0]);
- }
- }
- } else {
- Ext.EventManager.removeAll(el);
- }
- if (recurse && el && el.childNodes) {
- for (i = 0, len = el.childNodes.length; i < len; i++) {
- Ext.EventManager.purgeElement(el.childNodes[i], recurse, eventName);
- }
- }
- },
+ if (p) {
+ p = typeof p == 'function'? p() : p;
+ utilDate.parseCodes[character] = p;
+ }
- _unload : function() {
- var el;
- for (el in Ext.elCache) {
- Ext.EventManager.removeAll(el);
- }
- delete Ext.elCache;
- delete Ext.Element._flyweights;
+ return p ? Ext.applyIf({
+ c: p.c ? xf(p.c, currentGroup || "{0}") : p.c
+ }, p) : {
+ g: 0,
+ c: null,
+ s: Ext.String.escapeRegex(character)
+ };
+ },
+
+ parseFunctions: {
+ "MS": function(input, strict) {
- var c,
- conn,
- tid,
- ajax = Ext.lib.Ajax;
- (typeof ajax.conn == 'object') ? conn = ajax.conn : conn = {};
- for (tid in conn) {
- c = conn[tid];
- if (c) {
- ajax.abort({conn: c, tId: tid});
- }
- }
- },
-
- onDocumentReady : function(fn, scope, options){
- if(Ext.isReady){
- docReadyEvent || (docReadyEvent = new Ext.util.Event());
- docReadyEvent.addListener(fn, scope, options);
- docReadyEvent.fire();
- docReadyEvent.listeners = [];
- }else{
- if(!docReadyEvent){
- initDocReady();
- }
- options = options || {};
- options.delay = options.delay || 1;
- docReadyEvent.addListener(fn, scope, options);
- }
- },
+
+ var re = new RegExp('\\/Date\\(([-+])?(\\d+)(?:[+-]\\d{4})?\\)\\/');
+ var r = (input || '').match(re);
+ return r? new Date(((r[1] || '') + r[2]) * 1) : null;
+ }
+ },
+ parseRegexes: [],
-
- fireDocReady : fireDocReady
- };
-
- pub.on = pub.addListener;
- pub.un = pub.removeListener;
+ formatFunctions: {
+ "MS": function() {
+
+ return '\\/Date(' + this.getTime() + ')\\/';
+ }
+ },
- pub.stoppedMouseDownEvent = new Ext.util.Event();
- return pub;
-}();
+ y2kYear : 50,
-Ext.onReady = Ext.EventManager.onDocumentReady;
+
+ MILLI : "ms",
+
+ SECOND : "s",
+
+ MINUTE : "mi",
-(function(){
+
+ HOUR : "h",
- var initExtCss = function(){
-
- var bd = document.body || document.getElementsByTagName('body')[0];
- if(!bd){ return false; }
- var cls = [' ',
- Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : (Ext.isIE7 ? 'ext-ie7' : 'ext-ie8'))
- : Ext.isGecko ? "ext-gecko " + (Ext.isGecko2 ? 'ext-gecko2' : 'ext-gecko3')
- : Ext.isOpera ? "ext-opera"
- : Ext.isWebKit ? "ext-webkit" : ""];
+
+ DAY : "d",
- if(Ext.isSafari){
- cls.push("ext-safari " + (Ext.isSafari2 ? 'ext-safari2' : (Ext.isSafari3 ? 'ext-safari3' : 'ext-safari4')));
- }else if(Ext.isChrome){
- cls.push("ext-chrome");
- }
+
+ MONTH : "mo",
- if(Ext.isMac){
- cls.push("ext-mac");
- }
- if(Ext.isLinux){
- cls.push("ext-linux");
- }
+
+ YEAR : "y",
- if(Ext.isStrict || Ext.isBorderBox){
- var p = bd.parentNode;
- if(p){
- p.className += Ext.isStrict ? ' ext-strict' : ' ext-border-box';
- }
- }
- bd.className += cls.join(' ');
- return true;
- }
+
+ defaults: {},
- if(!initExtCss()){
- Ext.onReady(initExtCss);
- }
-})();
+
+ dayNames : [
+ "Sunday",
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday"
+ ],
+
+
+ monthNames : [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"
+ ],
+
+ monthNumbers : {
+ Jan:0,
+ Feb:1,
+ Mar:2,
+ Apr:3,
+ May:4,
+ Jun:5,
+ Jul:6,
+ Aug:7,
+ Sep:8,
+ Oct:9,
+ Nov:10,
+ Dec:11
+ },
+
+ defaultFormat : "m/d/Y",
+
+ getShortMonthName : function(month) {
+ return utilDate.monthNames[month].substring(0, 3);
+ },
+
+ getShortDayName : function(day) {
+ return utilDate.dayNames[day].substring(0, 3);
+ },
-Ext.EventObject = function(){
- var E = Ext.lib.Event,
-
- safariKeys = {
- 3 : 13,
- 63234 : 37,
- 63235 : 39,
- 63232 : 38,
- 63233 : 40,
- 63276 : 33,
- 63277 : 34,
- 63272 : 46,
- 63273 : 36,
- 63275 : 35
- },
+
+ getMonthNumber : function(name) {
- btnMap = Ext.isIE ? {1:0,4:1,2:2} :
- (Ext.isWebKit ? {1:0,2:1,3:2} : {0:0,1:1,2:2});
+ return utilDate.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
+ },
- Ext.EventObjectImpl = function(e){
- if(e){
- this.setEvent(e.browserEvent || e);
- }
- };
+
+ formatContainsHourInfo : (function(){
+ var stripEscapeRe = /(\\.)/g,
+ hourInfoRe = /([gGhHisucUOPZ]|MS)/;
+ return function(format){
+ return hourInfoRe.test(format.replace(stripEscapeRe, ''));
+ };
+ })(),
- Ext.EventObjectImpl.prototype = {
-
- setEvent : function(e){
- var me = this;
- if(e == me || (e && e.browserEvent)){
- return e;
- }
- me.browserEvent = e;
- if(e){
-
- me.button = e.button ? btnMap[e.button] : (e.which ? e.which - 1 : -1);
- if(e.type == 'click' && me.button == -1){
- me.button = 0;
- }
- me.type = e.type;
- me.shiftKey = e.shiftKey;
-
- me.ctrlKey = e.ctrlKey || e.metaKey || false;
- me.altKey = e.altKey;
-
- me.keyCode = e.keyCode;
- me.charCode = e.charCode;
-
- me.target = E.getTarget(e);
-
- me.xy = E.getXY(e);
- }else{
- me.button = -1;
- me.shiftKey = false;
- me.ctrlKey = false;
- me.altKey = false;
- me.keyCode = 0;
- me.charCode = 0;
- me.target = null;
- me.xy = [0, 0];
- }
- return me;
- },
+
+ formatContainsDateInfo : (function(){
+ var stripEscapeRe = /(\\.)/g,
+ dateInfoRe = /([djzmnYycU]|MS)/;
-
- stopEvent : function(){
- var me = this;
- if(me.browserEvent){
- if(me.browserEvent.type == 'mousedown'){
- Ext.EventManager.stoppedMouseDownEvent.fire(me);
- }
- E.stopEvent(me.browserEvent);
- }
- },
+ return function(format){
+ return dateInfoRe.test(format.replace(stripEscapeRe, ''));
+ };
+ })(),
-
- preventDefault : function(){
- if(this.browserEvent){
- E.preventDefault(this.browserEvent);
- }
- },
+
+ formatCodes : {
+ d: "Ext.String.leftPad(this.getDate(), 2, '0')",
+ D: "Ext.Date.getShortDayName(this.getDay())",
+ j: "this.getDate()",
+ l: "Ext.Date.dayNames[this.getDay()]",
+ N: "(this.getDay() ? this.getDay() : 7)",
+ S: "Ext.Date.getSuffix(this)",
+ w: "this.getDay()",
+ z: "Ext.Date.getDayOfYear(this)",
+ W: "Ext.String.leftPad(Ext.Date.getWeekOfYear(this), 2, '0')",
+ F: "Ext.Date.monthNames[this.getMonth()]",
+ m: "Ext.String.leftPad(this.getMonth() + 1, 2, '0')",
+ M: "Ext.Date.getShortMonthName(this.getMonth())",
+ n: "(this.getMonth() + 1)",
+ t: "Ext.Date.getDaysInMonth(this)",
+ L: "(Ext.Date.isLeapYear(this) ? 1 : 0)",
+ o: "(this.getFullYear() + (Ext.Date.getWeekOfYear(this) == 1 && this.getMonth() > 0 ? +1 : (Ext.Date.getWeekOfYear(this) >= 52 && this.getMonth() < 11 ? -1 : 0)))",
+ Y: "Ext.String.leftPad(this.getFullYear(), 4, '0')",
+ y: "('' + this.getFullYear()).substring(2, 4)",
+ a: "(this.getHours() < 12 ? 'am' : 'pm')",
+ A: "(this.getHours() < 12 ? 'AM' : 'PM')",
+ g: "((this.getHours() % 12) ? this.getHours() % 12 : 12)",
+ G: "this.getHours()",
+ h: "Ext.String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0')",
+ H: "Ext.String.leftPad(this.getHours(), 2, '0')",
+ i: "Ext.String.leftPad(this.getMinutes(), 2, '0')",
+ s: "Ext.String.leftPad(this.getSeconds(), 2, '0')",
+ u: "Ext.String.leftPad(this.getMilliseconds(), 3, '0')",
+ O: "Ext.Date.getGMTOffset(this)",
+ P: "Ext.Date.getGMTOffset(this, true)",
+ T: "Ext.Date.getTimezone(this)",
+ Z: "(this.getTimezoneOffset() * -60)",
-
- stopPropagation : function(){
- var me = this;
- if(me.browserEvent){
- if(me.browserEvent.type == 'mousedown'){
- Ext.EventManager.stoppedMouseDownEvent.fire(me);
- }
- E.stopPropagation(me.browserEvent);
+ c: function() {
+ for (var c = "Y-m-dTH:i:sP", code = [], i = 0, l = c.length; i < l; ++i) {
+ var e = c.charAt(i);
+ code.push(e == "T" ? "'T'" : utilDate.getFormatCode(e));
}
+ return code.join(" + ");
},
-
- getCharCode : function(){
- return this.charCode || this.keyCode;
- },
-
- getKey : function(){
- return this.normalizeKey(this.keyCode || this.charCode)
- },
+ U: "Math.round(this.getTime() / 1000)"
+ },
+
+ isValid : function(y, m, d, h, i, s, ms) {
- normalizeKey: function(k){
- return Ext.isSafari ? (safariKeys[k] || k) : k;
- },
+ h = h || 0;
+ i = i || 0;
+ s = s || 0;
+ ms = ms || 0;
- getPageX : function(){
- return this.xy[0];
- },
+ var dt = utilDate.add(new Date(y < 100 ? 100 : y, m - 1, d, h, i, s, ms), utilDate.YEAR, y < 100 ? y - 100 : 0);
-
- getPageY : function(){
- return this.xy[1];
- },
+ return y == dt.getFullYear() &&
+ m == dt.getMonth() + 1 &&
+ d == dt.getDate() &&
+ h == dt.getHours() &&
+ i == dt.getMinutes() &&
+ s == dt.getSeconds() &&
+ ms == dt.getMilliseconds();
+ },
-
- getXY : function(){
- return this.xy;
- },
+
+ parse : function(input, format, strict) {
+ var p = utilDate.parseFunctions;
+ if (p[format] == null) {
+ utilDate.createParser(format);
+ }
+ return p[format](input, Ext.isDefined(strict) ? strict : utilDate.useStrict);
+ },
-
- getTarget : function(selector, maxDepth, returnEl){
- return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target);
- },
+
+ parseDate: function(input, format, strict){
+ return utilDate.parse(input, format, strict);
+ },
-
- getRelatedTarget : function(){
- return this.browserEvent ? E.getRelatedTarget(this.browserEvent) : null;
- },
-
- getWheelDelta : function(){
- var e = this.browserEvent;
- var delta = 0;
- if(e.wheelDelta){
- delta = e.wheelDelta/120;
- }else if(e.detail){
- delta = -e.detail/3;
- }
- return delta;
- },
+
+ getFormatCode : function(character) {
+ var f = utilDate.formatCodes[character];
-
- within : function(el, related, allowEl){
- if(el){
- var t = this[related ? "getRelatedTarget" : "getTarget"]();
- return t && ((allowEl ? (t == Ext.getDom(el)) : false) || Ext.fly(el).contains(t));
- }
- return false;
+ if (f) {
+ f = typeof f == 'function'? f() : f;
+ utilDate.formatCodes[character] = f;
}
- };
-
- return new Ext.EventObjectImpl();
-}();
-Ext.apply(Ext.EventManager, function(){
- var resizeEvent,
- resizeTask,
- textEvent,
- textSize,
- D = Ext.lib.Dom,
- propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,
- curWidth = 0,
- curHeight = 0,
-
-
-
- useKeydown = Ext.isWebKit ?
- Ext.num(navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1]) >= 525 :
- !((Ext.isGecko && !Ext.isWindows) || Ext.isOpera);
+
+ return f || ("'" + Ext.String.escape(character) + "'");
+ },
- return {
-
- doResizeEvent: function(){
- var h = D.getViewHeight(),
- w = D.getViewWidth();
+
+ createFormat : function(format) {
+ var code = [],
+ special = false,
+ ch = '';
-
- if(curHeight != h || curWidth != w){
- resizeEvent.fire(curWidth = w, curHeight = h);
+ for (var i = 0; i < format.length; ++i) {
+ ch = format.charAt(i);
+ if (!special && ch == "\\") {
+ special = true;
+ } else if (special) {
+ special = false;
+ code.push("'" + Ext.String.escape(ch) + "'");
+ } else {
+ code.push(utilDate.getFormatCode(ch));
}
- },
-
-
- onWindowResize : function(fn, scope, options){
- if(!resizeEvent){
- resizeEvent = new Ext.util.Event();
- resizeTask = new Ext.util.DelayedTask(this.doResizeEvent);
- Ext.EventManager.on(window, "resize", this.fireWindowResize, this);
- }
- resizeEvent.addListener(fn, scope, options);
- },
+ }
+ utilDate.formatFunctions[format] = Ext.functionFactory("return " + code.join('+'));
+ },
-
- fireWindowResize : function(){
- if(resizeEvent){
- resizeTask.delay(100);
- }
- },
+
+ createParser : (function() {
+ var code = [
+ "var dt, y, m, d, h, i, s, ms, o, z, zz, u, v,",
+ "def = Ext.Date.defaults,",
+ "results = String(input).match(Ext.Date.parseRegexes[{0}]);",
-
- onTextResize : function(fn, scope, options){
- if(!textEvent){
- textEvent = new Ext.util.Event();
- var textEl = new Ext.Element(document.createElement('div'));
- textEl.dom.className = 'x-text-resize';
- textEl.dom.innerHTML = 'X';
- textEl.appendTo(document.body);
- textSize = textEl.dom.offsetHeight;
- setInterval(function(){
- if(textEl.dom.offsetHeight != textSize){
- textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);
- }
- }, this.textResizeInterval);
- }
- textEvent.addListener(fn, scope, options);
- },
+ "if(results){",
+ "{1}",
-
- removeResizeListener : function(fn, scope){
- if(resizeEvent){
- resizeEvent.removeListener(fn, scope);
- }
- },
+ "if(u != null){",
+ "v = new Date(u * 1000);",
+ "}else{",
+
+
+
+ "dt = Ext.Date.clearTime(new Date);",
-
- fireResize : function(){
- if(resizeEvent){
- resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
- }
- },
+
+ "y = Ext.Number.from(y, Ext.Number.from(def.y, dt.getFullYear()));",
+ "m = Ext.Number.from(m, Ext.Number.from(def.m - 1, dt.getMonth()));",
+ "d = Ext.Number.from(d, Ext.Number.from(def.d, dt.getDate()));",
-
- textResizeInterval : 50,
+
+ "h = Ext.Number.from(h, Ext.Number.from(def.h, dt.getHours()));",
+ "i = Ext.Number.from(i, Ext.Number.from(def.i, dt.getMinutes()));",
+ "s = Ext.Number.from(s, Ext.Number.from(def.s, dt.getSeconds()));",
+ "ms = Ext.Number.from(ms, Ext.Number.from(def.ms, dt.getMilliseconds()));",
-
- ieDeferSrc : false,
+ "if(z >= 0 && y >= 0){",
+
+
-
-
- useKeydown: useKeydown
- };
-}());
+
+
+ "v = Ext.Date.add(new Date(y < 100 ? 100 : y, 0, 1, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
-Ext.EventManager.on = Ext.EventManager.addListener;
+
+ "v = !strict? v : (strict === true && (z <= 364 || (Ext.Date.isLeapYear(v) && z <= 365))? Ext.Date.add(v, Ext.Date.DAY, z) : null);",
+ "}else if(strict === true && !Ext.Date.isValid(y, m + 1, d, h, i, s, ms)){",
+ "v = null;",
+ "}else{",
+
+
+ "v = Ext.Date.add(new Date(y < 100 ? 100 : y, m, d, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
+ "}",
+ "}",
+ "}",
+ "if(v){",
+
+ "if(zz != null){",
+
+ "v = Ext.Date.add(v, Ext.Date.SECOND, -v.getTimezoneOffset() * 60 - zz);",
+ "}else if(o){",
+
+ "v = Ext.Date.add(v, Ext.Date.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn));",
+ "}",
+ "}",
+
+ "return v;"
+ ].join('\n');
+
+ return function(format) {
+ var regexNum = utilDate.parseRegexes.length,
+ currentGroup = 1,
+ calc = [],
+ regex = [],
+ special = false,
+ ch = "";
+
+ for (var i = 0; i < format.length; ++i) {
+ ch = format.charAt(i);
+ if (!special && ch == "\\") {
+ special = true;
+ } else if (special) {
+ special = false;
+ regex.push(Ext.String.escape(ch));
+ } else {
+ var obj = utilDate.formatCodeToRegex(ch, currentGroup);
+ currentGroup += obj.g;
+ regex.push(obj.s);
+ if (obj.g && obj.c) {
+ calc.push(obj.c);
+ }
+ }
+ }
+
+ utilDate.parseRegexes[regexNum] = new RegExp("^" + regex.join('') + "$", 'i');
+ utilDate.parseFunctions[format] = Ext.functionFactory("input", "strict", xf(code, regexNum, calc.join('')));
+ };
+ })(),
+
+
+ parseCodes : {
+
+ d: {
+ g:1,
+ c:"d = parseInt(results[{0}], 10);\n",
+ s:"(\\d{2})"
+ },
+ j: {
+ g:1,
+ c:"d = parseInt(results[{0}], 10);\n",
+ s:"(\\d{1,2})"
+ },
+ D: function() {
+ for (var a = [], i = 0; i < 7; a.push(utilDate.getShortDayName(i)), ++i);
+ return {
+ g:0,
+ c:null,
+ s:"(?:" + a.join("|") +")"
+ };
+ },
+ l: function() {
+ return {
+ g:0,
+ c:null,
+ s:"(?:" + utilDate.dayNames.join("|") + ")"
+ };
+ },
+ N: {
+ g:0,
+ c:null,
+ s:"[1-7]"
+ },
+ S: {
+ g:0,
+ c:null,
+ s:"(?:st|nd|rd|th)"
+ },
+ w: {
+ g:0,
+ c:null,
+ s:"[0-6]"
+ },
+ z: {
+ g:1,
+ c:"z = parseInt(results[{0}], 10);\n",
+ s:"(\\d{1,3})"
+ },
+ W: {
+ g:0,
+ c:null,
+ s:"(?:\\d{2})"
+ },
+ F: function() {
+ return {
+ g:1,
+ c:"m = parseInt(Ext.Date.getMonthNumber(results[{0}]), 10);\n",
+ s:"(" + utilDate.monthNames.join("|") + ")"
+ };
+ },
+ M: function() {
+ for (var a = [], i = 0; i < 12; a.push(utilDate.getShortMonthName(i)), ++i);
+ return Ext.applyIf({
+ s:"(" + a.join("|") + ")"
+ }, utilDate.formatCodeToRegex("F"));
+ },
+ m: {
+ g:1,
+ c:"m = parseInt(results[{0}], 10) - 1;\n",
+ s:"(\\d{2})"
+ },
+ n: {
+ g:1,
+ c:"m = parseInt(results[{0}], 10) - 1;\n",
+ s:"(\\d{1,2})"
+ },
+ t: {
+ g:0,
+ c:null,
+ s:"(?:\\d{2})"
+ },
+ L: {
+ g:0,
+ c:null,
+ s:"(?:1|0)"
+ },
+ o: function() {
+ return utilDate.formatCodeToRegex("Y");
+ },
+ Y: {
+ g:1,
+ c:"y = parseInt(results[{0}], 10);\n",
+ s:"(\\d{4})"
+ },
+ y: {
+ g:1,
+ c:"var ty = parseInt(results[{0}], 10);\n"
+ + "y = ty > Ext.Date.y2kYear ? 1900 + ty : 2000 + ty;\n",
+ s:"(\\d{1,2})"
+ },
+
+ a: {
+ g:1,
+ c:"if (/(am)/i.test(results[{0}])) {\n"
+ + "if (!h || h == 12) { h = 0; }\n"
+ + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
+ s:"(am|pm|AM|PM)"
+ },
+ A: {
+ g:1,
+ c:"if (/(am)/i.test(results[{0}])) {\n"
+ + "if (!h || h == 12) { h = 0; }\n"
+ + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
+ s:"(AM|PM|am|pm)"
+ },
+ g: function() {
+ return utilDate.formatCodeToRegex("G");
+ },
+ G: {
+ g:1,
+ c:"h = parseInt(results[{0}], 10);\n",
+ s:"(\\d{1,2})"
+ },
+ h: function() {
+ return utilDate.formatCodeToRegex("H");
+ },
+ H: {
+ g:1,
+ c:"h = parseInt(results[{0}], 10);\n",
+ s:"(\\d{2})"
+ },
+ i: {
+ g:1,
+ c:"i = parseInt(results[{0}], 10);\n",
+ s:"(\\d{2})"
+ },
+ s: {
+ g:1,
+ c:"s = parseInt(results[{0}], 10);\n",
+ s:"(\\d{2})"
+ },
+ u: {
+ g:1,
+ c:"ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n",
+ s:"(\\d+)"
+ },
+ O: {
+ g:1,
+ c:[
+ "o = results[{0}];",
+ "var sn = o.substring(0,1),",
+ "hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60),",
+ "mn = o.substring(3,5) % 60;",
+ "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + Ext.String.leftPad(hr, 2, '0') + Ext.String.leftPad(mn, 2, '0')) : null;\n"
+ ].join("\n"),
+ s: "([+\-]\\d{4})"
+ },
+ P: {
+ g:1,
+ c:[
+ "o = results[{0}];",
+ "var sn = o.substring(0,1),",
+ "hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60),",
+ "mn = o.substring(4,6) % 60;",
+ "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + Ext.String.leftPad(hr, 2, '0') + Ext.String.leftPad(mn, 2, '0')) : null;\n"
+ ].join("\n"),
+ s: "([+\-]\\d{2}:\\d{2})"
+ },
+ T: {
+ g:0,
+ c:null,
+ s:"[A-Z]{1,4}"
+ },
+ Z: {
+ g:1,
+ c:"zz = results[{0}] * 1;\n"
+ + "zz = (-43200 <= zz && zz <= 50400)? zz : null;\n",
+ s:"([+\-]?\\d{1,5})"
+ },
+ c: function() {
+ var calc = [],
+ arr = [
+ utilDate.formatCodeToRegex("Y", 1),
+ utilDate.formatCodeToRegex("m", 2),
+ utilDate.formatCodeToRegex("d", 3),
+ utilDate.formatCodeToRegex("h", 4),
+ utilDate.formatCodeToRegex("i", 5),
+ utilDate.formatCodeToRegex("s", 6),
+ {c:"ms = results[7] || '0'; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n"},
+ {c:[
+ "if(results[8]) {",
+ "if(results[8] == 'Z'){",
+ "zz = 0;",
+ "}else if (results[8].indexOf(':') > -1){",
+ utilDate.formatCodeToRegex("P", 8).c,
+ "}else{",
+ utilDate.formatCodeToRegex("O", 8).c,
+ "}",
+ "}"
+ ].join('\n')}
+ ];
+
+ for (var i = 0, l = arr.length; i < l; ++i) {
+ calc.push(arr[i].c);
+ }
+
+ return {
+ g:1,
+ c:calc.join(""),
+ s:[
+ arr[0].s,
+ "(?:", "-", arr[1].s,
+ "(?:", "-", arr[2].s,
+ "(?:",
+ "(?:T| )?",
+ arr[3].s, ":", arr[4].s,
+ "(?::", arr[5].s, ")?",
+ "(?:(?:\\.|,)(\\d+))?",
+ "(Z|(?:[-+]\\d{2}(?::)?\\d{2}))?",
+ ")?",
+ ")?",
+ ")?"
+ ].join("")
+ };
+ },
+ U: {
+ g:1,
+ c:"u = parseInt(results[{0}], 10);\n",
+ s:"(-?\\d+)"
+ }
+ },
+
+
+
+ dateFormat: function(date, format) {
+ return utilDate.format(date, format);
+ },
+
+
+ format: function(date, format) {
+ if (utilDate.formatFunctions[format] == null) {
+ utilDate.createFormat(format);
+ }
+ var result = utilDate.formatFunctions[format].call(date);
+ return result + '';
+ },
+
+
+ getTimezone : function(date) {
+
+
+
+
+
+
+
+
+
+
+
+
+ return date.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");
+ },
+
+
+ getGMTOffset : function(date, colon) {
+ var offset = date.getTimezoneOffset();
+ return (offset > 0 ? "-" : "+")
+ + Ext.String.leftPad(Math.floor(Math.abs(offset) / 60), 2, "0")
+ + (colon ? ":" : "")
+ + Ext.String.leftPad(Math.abs(offset % 60), 2, "0");
+ },
+
+
+ getDayOfYear: function(date) {
+ var num = 0,
+ d = Ext.Date.clone(date),
+ m = date.getMonth(),
+ i;
+
+ for (i = 0, d.setDate(1), d.setMonth(0); i < m; d.setMonth(++i)) {
+ num += utilDate.getDaysInMonth(d);
+ }
+ return num + date.getDate() - 1;
+ },
+
+
+ getWeekOfYear : (function() {
+
+ var ms1d = 864e5,
+ ms7d = 7 * ms1d;
+
+ return function(date) {
+ var DC3 = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate() + 3) / ms1d,
+ AWN = Math.floor(DC3 / 7),
+ Wyr = new Date(AWN * ms7d).getUTCFullYear();
+
+ return AWN - Math.floor(Date.UTC(Wyr, 0, 7) / ms7d) + 1;
+ };
+ })(),
+
+
+ isLeapYear : function(date) {
+ var year = date.getFullYear();
+ return !!((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
+ },
+
+
+ getFirstDayOfMonth : function(date) {
+ var day = (date.getDay() - (date.getDate() - 1)) % 7;
+ return (day < 0) ? (day + 7) : day;
+ },
+
+
+ getLastDayOfMonth : function(date) {
+ return utilDate.getLastDateOfMonth(date).getDay();
+ },
+
+
+
+ getFirstDateOfMonth : function(date) {
+ return new Date(date.getFullYear(), date.getMonth(), 1);
+ },
+
+
+ getLastDateOfMonth : function(date) {
+ return new Date(date.getFullYear(), date.getMonth(), utilDate.getDaysInMonth(date));
+ },
+
+
+ getDaysInMonth: (function() {
+ var daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+
+ return function(date) {
+ var m = date.getMonth();
+
+ return m == 1 && utilDate.isLeapYear(date) ? 29 : daysInMonth[m];
+ };
+ })(),
+
+
+ getSuffix : function(date) {
+ switch (date.getDate()) {
+ case 1:
+ case 21:
+ case 31:
+ return "st";
+ case 2:
+ case 22:
+ return "nd";
+ case 3:
+ case 23:
+ return "rd";
+ default:
+ return "th";
+ }
+ },
+
+
+ clone : function(date) {
+ return new Date(date.getTime());
+ },
+
+
+ isDST : function(date) {
+
+
+ return new Date(date.getFullYear(), 0, 1).getTimezoneOffset() != date.getTimezoneOffset();
+ },
+
+
+ clearTime : function(date, clone) {
+ if (clone) {
+ return Ext.Date.clearTime(Ext.Date.clone(date));
+ }
+
+
+ var d = date.getDate();
+
+
+ date.setHours(0);
+ date.setMinutes(0);
+ date.setSeconds(0);
+ date.setMilliseconds(0);
+
+ if (date.getDate() != d) {
+
+
+
+
+ for (var hr = 1, c = utilDate.add(date, Ext.Date.HOUR, hr); c.getDate() != d; hr++, c = utilDate.add(date, Ext.Date.HOUR, hr));
+
+ date.setDate(d);
+ date.setHours(c.getHours());
+ }
+
+ return date;
+ },
+
+
+ add : function(date, interval, value) {
+ var d = Ext.Date.clone(date),
+ Date = Ext.Date;
+ if (!interval || value === 0) return d;
+
+ switch(interval.toLowerCase()) {
+ case Ext.Date.MILLI:
+ d.setMilliseconds(d.getMilliseconds() + value);
+ break;
+ case Ext.Date.SECOND:
+ d.setSeconds(d.getSeconds() + value);
+ break;
+ case Ext.Date.MINUTE:
+ d.setMinutes(d.getMinutes() + value);
+ break;
+ case Ext.Date.HOUR:
+ d.setHours(d.getHours() + value);
+ break;
+ case Ext.Date.DAY:
+ d.setDate(d.getDate() + value);
+ break;
+ case Ext.Date.MONTH:
+ var day = date.getDate();
+ if (day > 28) {
+ day = Math.min(day, Ext.Date.getLastDateOfMonth(Ext.Date.add(Ext.Date.getFirstDateOfMonth(date), 'mo', value)).getDate());
+ }
+ d.setDate(day);
+ d.setMonth(date.getMonth() + value);
+ break;
+ case Ext.Date.YEAR:
+ d.setFullYear(date.getFullYear() + value);
+ break;
+ }
+ return d;
+ },
+
+
+ between : function(date, start, end) {
+ var t = date.getTime();
+ return start.getTime() <= t && t <= end.getTime();
+ },
+
+
+ compat: function() {
+ var nativeDate = window.Date,
+ p, u,
+ statics = ['useStrict', 'formatCodeToRegex', 'parseFunctions', 'parseRegexes', 'formatFunctions', 'y2kYear', 'MILLI', 'SECOND', 'MINUTE', 'HOUR', 'DAY', 'MONTH', 'YEAR', 'defaults', 'dayNames', 'monthNames', 'monthNumbers', 'getShortMonthName', 'getShortDayName', 'getMonthNumber', 'formatCodes', 'isValid', 'parseDate', 'getFormatCode', 'createFormat', 'createParser', 'parseCodes'],
+ proto = ['dateFormat', 'format', 'getTimezone', 'getGMTOffset', 'getDayOfYear', 'getWeekOfYear', 'isLeapYear', 'getFirstDayOfMonth', 'getLastDayOfMonth', 'getDaysInMonth', 'getSuffix', 'clone', 'isDST', 'clearTime', 'add', 'between'];
+
+
+ Ext.Array.forEach(statics, function(s) {
+ nativeDate[s] = utilDate[s];
+ });
+
+
+ Ext.Array.forEach(proto, function(s) {
+ nativeDate.prototype[s] = function() {
+ var args = Array.prototype.slice.call(arguments);
+ args.unshift(this);
+ return utilDate[s].apply(utilDate, args);
+ };
+ });
+ }
+};
+
+var utilDate = Ext.Date;
+
+})();
+
+
+(function(flexSetter) {
+
+var Base = Ext.Base = function() {};
+ Base.prototype = {
+ $className: 'Ext.Base',
+
+ $class: Base,
+
+
+ self: Base,
+
+
+ constructor: function() {
+ return this;
+ },
+
+
+
+ initConfig: function(config) {
+ if (!this.$configInited) {
+ this.config = Ext.Object.merge({}, this.config || {}, config || {});
+
+ this.applyConfig(this.config);
+
+ this.$configInited = true;
+ }
+
+ return this;
+ },
+
+
+ setConfig: function(config) {
+ this.applyConfig(config || {});
+
+ return this;
+ },
+
+
+ applyConfig: flexSetter(function(name, value) {
+ var setter = 'set' + Ext.String.capitalize(name);
+
+ if (typeof this[setter] === 'function') {
+ this[setter].call(this, value);
+ }
+
+ return this;
+ }),
+
+
+
+ callParent: function(args) {
+ var method = this.callParent.caller,
+ parentClass, methodName;
+
+ if (!method.$owner) {
+
+ method = method.caller;
+ }
+
+ parentClass = method.$owner.superclass;
+ methodName = method.$name;
+
+
+ return parentClass[methodName].apply(this, args || []);
+ },
+
+
+
+ statics: function() {
+ var method = this.statics.caller,
+ self = this.self;
+
+ if (!method) {
+ return self;
+ }
+
+ return method.$owner;
+ },
+
+
+ callOverridden: function(args) {
+ var method = this.callOverridden.caller;
+
+
+ return method.$previous.apply(this, args || []);
+ },
+
+ destroy: function() {}
+ };
+
+
+ Ext.apply(Ext.Base, {
+
+ create: function() {
+ return Ext.create.apply(Ext, [this].concat(Array.prototype.slice.call(arguments, 0)));
+ },
+
+
+ own: function(name, value) {
+ if (typeof value == 'function') {
+ this.ownMethod(name, value);
+ }
+ else {
+ this.prototype[name] = value;
+ }
+ },
+
+
+ ownMethod: function(name, fn) {
+ var originalFn;
+
+ if (typeof fn.$owner !== 'undefined' && fn !== Ext.emptyFn) {
+ originalFn = fn;
+
+ fn = function() {
+ return originalFn.apply(this, arguments);
+ };
+ }
+
+ fn.$owner = this;
+ fn.$name = name;
+
+ this.prototype[name] = fn;
+ },
+
+
+ addStatics: function(members) {
+ for (var name in members) {
+ if (members.hasOwnProperty(name)) {
+ this[name] = members[name];
+ }
+ }
+
+ return this;
+ },
+
+
+ addInheritableStatics: function(members) {
+ var inheritableStatics,
+ hasInheritableStatics,
+ prototype = this.prototype,
+ name, member;
+
+ inheritableStatics = prototype.$inheritableStatics;
+ hasInheritableStatics = prototype.$hasInheritableStatics;
+
+ if (!inheritableStatics) {
+ inheritableStatics = prototype.$inheritableStatics = [];
+ hasInheritableStatics = prototype.$hasInheritableStatics = {};
+ }
+
+
+ for (name in members) {
+ if (members.hasOwnProperty(name)) {
+ member = members[name];
+ this[name] = member;
+
+ if (!hasInheritableStatics[name]) {
+ hasInheritableStatics[name] = true;
+ inheritableStatics.push(name);
+ }
+ }
+ }
+
+ return this;
+ },
+
+
+ implement: function(members) {
+ var prototype = this.prototype,
+ enumerables = Ext.enumerables,
+ name, i, member;
+ for (name in members) {
+ if (members.hasOwnProperty(name)) {
+ member = members[name];
+
+ if (typeof member === 'function') {
+ member.$owner = this;
+ member.$name = name;
+ }
+
+ prototype[name] = member;
+ }
+ }
+
+ if (enumerables) {
+ for (i = enumerables.length; i--;) {
+ name = enumerables[i];
+
+ if (members.hasOwnProperty(name)) {
+ member = members[name];
+ member.$owner = this;
+ member.$name = name;
+ prototype[name] = member;
+ }
+ }
+ }
+ },
+
+
+ borrow: function(fromClass, members) {
+ var fromPrototype = fromClass.prototype,
+ i, ln, member;
+
+ members = Ext.Array.from(members);
+
+ for (i = 0, ln = members.length; i < ln; i++) {
+ member = members[i];
+
+ this.own(member, fromPrototype[member]);
+ }
+
+ return this;
+ },
+
+
+ override: function(members) {
+ var prototype = this.prototype,
+ enumerables = Ext.enumerables,
+ name, i, member, previous;
+
+ if (arguments.length === 2) {
+ name = members;
+ member = arguments[1];
+
+ if (typeof member == 'function') {
+ if (typeof prototype[name] == 'function') {
+ previous = prototype[name];
+ member.$previous = previous;
+ }
+
+ this.ownMethod(name, member);
+ }
+ else {
+ prototype[name] = member;
+ }
+
+ return this;
+ }
+
+ for (name in members) {
+ if (members.hasOwnProperty(name)) {
+ member = members[name];
+
+ if (typeof member === 'function') {
+ if (typeof prototype[name] === 'function') {
+ previous = prototype[name];
+ member.$previous = previous;
+ }
+
+ this.ownMethod(name, member);
+ }
+ else {
+ prototype[name] = member;
+ }
+ }
+ }
+
+ if (enumerables) {
+ for (i = enumerables.length; i--;) {
+ name = enumerables[i];
+
+ if (members.hasOwnProperty(name)) {
+ if (typeof prototype[name] !== 'undefined') {
+ previous = prototype[name];
+ members[name].$previous = previous;
+ }
+
+ this.ownMethod(name, members[name]);
+ }
+ }
+ }
+
+ return this;
+ },
+
+
+
+ mixin: function(name, cls) {
+ var mixin = cls.prototype,
+ my = this.prototype,
+ key, fn;
+
+ for (key in mixin) {
+ if (mixin.hasOwnProperty(key)) {
+ if (typeof my[key] === 'undefined' && key !== 'mixins' && key !== 'mixinId') {
+ if (typeof mixin[key] === 'function') {
+ fn = mixin[key];
+
+ if (typeof fn.$owner === 'undefined') {
+ this.ownMethod(key, fn);
+ }
+ else {
+ my[key] = fn;
+ }
+ }
+ else {
+ my[key] = mixin[key];
+ }
+ }
+
+ else if (key === 'config' && my.config && mixin.config) {
+ Ext.Object.merge(my.config, mixin.config);
+ }
+
+ }
+ }
+
+ if (typeof mixin.onClassMixedIn !== 'undefined') {
+ mixin.onClassMixedIn.call(cls, this);
+ }
+
+ if (!my.hasOwnProperty('mixins')) {
+ if ('mixins' in my) {
+ my.mixins = Ext.Object.merge({}, my.mixins);
+ }
+ else {
+ my.mixins = {};
+ }
+ }
+
+ my.mixins[name] = mixin;
+ },
+
+
+
+ getName: function() {
+ return Ext.getClassName(this);
+ },
+
+
+ createAlias: flexSetter(function(alias, origin) {
+ this.prototype[alias] = function() {
+ return this[origin].apply(this, arguments);
+ }
+ })
+ });
+
+})(Ext.Function.flexSetter);
+
+
+(function() {
+
+ var Class,
+ Base = Ext.Base,
+ baseStaticProperties = [],
+ baseStaticProperty;
+
+ for (baseStaticProperty in Base) {
+ if (Base.hasOwnProperty(baseStaticProperty)) {
+ baseStaticProperties.push(baseStaticProperty);
+ }
+ }
+
+
+ Ext.Class = Class = function(newClass, classData, onClassCreated) {
+ if (typeof newClass != 'function') {
+ onClassCreated = classData;
+ classData = newClass;
+ newClass = function() {
+ return this.constructor.apply(this, arguments);
+ };
+ }
+
+ if (!classData) {
+ classData = {};
+ }
+
+ var preprocessorStack = classData.preprocessors || Class.getDefaultPreprocessors(),
+ registeredPreprocessors = Class.getPreprocessors(),
+ index = 0,
+ preprocessors = [],
+ preprocessor, staticPropertyName, process, i, j, ln;
+
+ for (i = 0, ln = baseStaticProperties.length; i < ln; i++) {
+ staticPropertyName = baseStaticProperties[i];
+ newClass[staticPropertyName] = Base[staticPropertyName];
+ }
+
+ delete classData.preprocessors;
+
+ for (j = 0, ln = preprocessorStack.length; j < ln; j++) {
+ preprocessor = preprocessorStack[j];
+
+ if (typeof preprocessor == 'string') {
+ preprocessor = registeredPreprocessors[preprocessor];
+
+ if (!preprocessor.always) {
+ if (classData.hasOwnProperty(preprocessor.name)) {
+ preprocessors.push(preprocessor.fn);
+ }
+ }
+ else {
+ preprocessors.push(preprocessor.fn);
+ }
+ }
+ else {
+ preprocessors.push(preprocessor);
+ }
+ }
+
+ classData.onClassCreated = onClassCreated || Ext.emptyFn;
+
+ classData.onBeforeClassCreated = function(cls, data) {
+ onClassCreated = data.onClassCreated;
+
+ delete data.onBeforeClassCreated;
+ delete data.onClassCreated;
+
+ cls.implement(data);
+
+ onClassCreated.call(cls, cls);
+ };
+
+ process = function(cls, data) {
+ preprocessor = preprocessors[index++];
+
+ if (!preprocessor) {
+ data.onBeforeClassCreated.apply(this, arguments);
+ return;
+ }
+
+ if (preprocessor.call(this, cls, data, process) !== false) {
+ process.apply(this, arguments);
+ }
+ };
+
+ process.call(Class, newClass, classData);
+
+ return newClass;
+ };
+
+ Ext.apply(Class, {
+
+
+ preprocessors: {},
+
+
+ registerPreprocessor: function(name, fn, always) {
+ this.preprocessors[name] = {
+ name: name,
+ always: always || false,
+ fn: fn
+ };
+
+ return this;
+ },
+
+
+ getPreprocessor: function(name) {
+ return this.preprocessors[name];
+ },
+
+ getPreprocessors: function() {
+ return this.preprocessors;
+ },
+
+
+ getDefaultPreprocessors: function() {
+ return this.defaultPreprocessors || [];
+ },
+
+
+ setDefaultPreprocessors: function(preprocessors) {
+ this.defaultPreprocessors = Ext.Array.from(preprocessors);
+
+ return this;
+ },
+
+
+ setDefaultPreprocessorPosition: function(name, offset, relativeName) {
+ var defaultPreprocessors = this.defaultPreprocessors,
+ index;
+
+ if (typeof offset == 'string') {
+ if (offset === 'first') {
+ defaultPreprocessors.unshift(name);
+
+ return this;
+ }
+ else if (offset === 'last') {
+ defaultPreprocessors.push(name);
+
+ return this;
+ }
+
+ offset = (offset === 'after') ? 1 : -1;
+ }
+
+ index = Ext.Array.indexOf(defaultPreprocessors, relativeName);
+
+ if (index !== -1) {
+ Ext.Array.splice(defaultPreprocessors, Math.max(0, index + offset), 0, name);
+ }
+
+ return this;
+ }
+ });
+
+
+ Class.registerPreprocessor('extend', function(cls, data) {
+ var extend = data.extend,
+ base = Ext.Base,
+ basePrototype = base.prototype,
+ prototype = function() {},
+ parent, i, k, ln, staticName, parentStatics,
+ parentPrototype, clsPrototype;
+
+ if (extend && extend !== Object) {
+ parent = extend;
+ }
+ else {
+ parent = base;
+ }
+
+ parentPrototype = parent.prototype;
+
+ prototype.prototype = parentPrototype;
+ clsPrototype = cls.prototype = new prototype();
+
+ if (!('$class' in parent)) {
+ for (i in basePrototype) {
+ if (!parentPrototype[i]) {
+ parentPrototype[i] = basePrototype[i];
+ }
+ }
+ }
+
+ clsPrototype.self = cls;
+
+ cls.superclass = clsPrototype.superclass = parentPrototype;
+
+ delete data.extend;
+
+
+
+ parentStatics = parentPrototype.$inheritableStatics;
+
+ if (parentStatics) {
+ for (k = 0, ln = parentStatics.length; k < ln; k++) {
+ staticName = parentStatics[k];
+
+ if (!cls.hasOwnProperty(staticName)) {
+ cls[staticName] = parent[staticName];
+ }
+ }
+ }
+
+
+
+
+ if (parentPrototype.config) {
+ clsPrototype.config = Ext.Object.merge({}, parentPrototype.config);
+ }
+ else {
+ clsPrototype.config = {};
+ }
+
+
+
+ if (clsPrototype.$onExtended) {
+ clsPrototype.$onExtended.call(cls, cls, data);
+ }
+
+ if (data.onClassExtended) {
+ clsPrototype.$onExtended = data.onClassExtended;
+ delete data.onClassExtended;
+ }
+
+
+ }, true);
+
+
+
+ Class.registerPreprocessor('statics', function(cls, data) {
+ cls.addStatics(data.statics);
+
+ delete data.statics;
+ });
+
+
+
+
+ Class.registerPreprocessor('inheritableStatics', function(cls, data) {
+ cls.addInheritableStatics(data.inheritableStatics);
+
+ delete data.inheritableStatics;
+ });
+
+
+
+
+ Class.registerPreprocessor('config', function(cls, data) {
+ var prototype = cls.prototype;
+
+ Ext.Object.each(data.config, function(name) {
+ var cName = name.charAt(0).toUpperCase() + name.substr(1),
+ pName = name,
+ apply = 'apply' + cName,
+ setter = 'set' + cName,
+ getter = 'get' + cName;
+
+ if (!(apply in prototype) && !data.hasOwnProperty(apply)) {
+ data[apply] = function(val) {
+ return val;
+ };
+ }
+
+ if (!(setter in prototype) && !data.hasOwnProperty(setter)) {
+ data[setter] = function(val) {
+ var ret = this[apply].call(this, val, this[pName]);
+
+ if (typeof ret != 'undefined') {
+ this[pName] = ret;
+ }
+
+ return this;
+ };
+ }
+
+ if (!(getter in prototype) && !data.hasOwnProperty(getter)) {
+ data[getter] = function() {
+ return this[pName];
+ };
+ }
+ });
+
+ Ext.Object.merge(prototype.config, data.config);
+ delete data.config;
+ });
+
+
+
+
+ Class.registerPreprocessor('mixins', function(cls, data) {
+ var mixins = data.mixins,
+ name, mixin, i, ln;
+
+ delete data.mixins;
+
+ Ext.Function.interceptBefore(data, 'onClassCreated', function(cls) {
+ if (mixins instanceof Array) {
+ for (i = 0,ln = mixins.length; i < ln; i++) {
+ mixin = mixins[i];
+ name = mixin.prototype.mixinId || mixin.$className;
+
+ cls.mixin(name, mixin);
+ }
+ }
+ else {
+ for (name in mixins) {
+ if (mixins.hasOwnProperty(name)) {
+ cls.mixin(name, mixins[name]);
+ }
+ }
+ }
+ });
+ });
+
+
+
+ Class.setDefaultPreprocessors([
+ 'extend'
+
+ ,'statics'
+
+
+ ,'inheritableStatics'
+
+
+ ,'config'
+
+
+ ,'mixins'
+
+ ]);
+
+
+
+ Ext.extend = function(subclass, superclass, members) {
+ if (arguments.length === 2 && Ext.isObject(superclass)) {
+ members = superclass;
+ superclass = subclass;
+ subclass = null;
+ }
+
+ var cls;
+
+ if (!superclass) {
+ Ext.Error.raise("Attempting to extend from a class which has not been loaded on the page.");
+ }
+
+ members.extend = superclass;
+ members.preprocessors = [
+ 'extend'
+
+ ,'statics'
+
+
+ ,'inheritableStatics'
+
+
+ ,'mixins'
+
+
+ ,'config'
+
+ ];
+
+ if (subclass) {
+ cls = new Class(subclass, members);
+ }
+ else {
+ cls = new Class(members);
+ }
+
+ cls.prototype.override = function(o) {
+ for (var m in o) {
+ if (o.hasOwnProperty(m)) {
+ this[m] = o[m];
+ }
+ }
+ };
+
+ return cls;
+ };
+
+
+})();
+
+
+(function(Class, alias) {
+
+ var slice = Array.prototype.slice;
+
+ var Manager = Ext.ClassManager = {
+
+
+ classes: {},
+
+
+ existCache: {},
+
+
+ namespaceRewrites: [{
+ from: 'Ext.',
+ to: Ext
+ }],
+
+
+ maps: {
+ alternateToName: {},
+ aliasToName: {},
+ nameToAliases: {}
+ },
+
+
+ enableNamespaceParseCache: true,
+
+
+ namespaceParseCache: {},
+
+
+ instantiators: [],
+
+
+
+ isCreated: function(className) {
+ var i, ln, part, root, parts;
+
+
+ if (this.classes.hasOwnProperty(className) || this.existCache.hasOwnProperty(className)) {
+ return true;
+ }
+
+ root = Ext.global;
+ parts = this.parseNamespace(className);
+
+ for (i = 0, ln = parts.length; i < ln; i++) {
+ part = parts[i];
+
+ if (typeof part !== 'string') {
+ root = part;
+ } else {
+ if (!root || !root[part]) {
+ return false;
+ }
+
+ root = root[part];
+ }
+ }
+
+ Ext.Loader.historyPush(className);
+
+ this.existCache[className] = true;
+
+ return true;
+ },
+
+
+ parseNamespace: function(namespace) {
+
+ var cache = this.namespaceParseCache;
+
+ if (this.enableNamespaceParseCache) {
+ if (cache.hasOwnProperty(namespace)) {
+ return cache[namespace];
+ }
+ }
+
+ var parts = [],
+ rewrites = this.namespaceRewrites,
+ rewrite, from, to, i, ln, root = Ext.global;
+
+ for (i = 0, ln = rewrites.length; i < ln; i++) {
+ rewrite = rewrites[i];
+ from = rewrite.from;
+ to = rewrite.to;
+
+ if (namespace === from || namespace.substring(0, from.length) === from) {
+ namespace = namespace.substring(from.length);
+
+ if (typeof to !== 'string') {
+ root = to;
+ } else {
+ parts = parts.concat(to.split('.'));
+ }
+
+ break;
+ }
+ }
+
+ parts.push(root);
+
+ parts = parts.concat(namespace.split('.'));
+
+ if (this.enableNamespaceParseCache) {
+ cache[namespace] = parts;
+ }
+
+ return parts;
+ },
+
+
+ setNamespace: function(name, value) {
+ var root = Ext.global,
+ parts = this.parseNamespace(name),
+ ln = parts.length - 1,
+ leaf = parts[ln],
+ i, part;
+
+ for (i = 0; i < ln; i++) {
+ part = parts[i];
+
+ if (typeof part !== 'string') {
+ root = part;
+ } else {
+ if (!root[part]) {
+ root[part] = {};
+ }
+
+ root = root[part];
+ }
+ }
+
+ root[leaf] = value;
+
+ return root[leaf];
+ },
+
+
+ createNamespaces: function() {
+ var root = Ext.global,
+ parts, part, i, j, ln, subLn;
+
+ for (i = 0, ln = arguments.length; i < ln; i++) {
+ parts = this.parseNamespace(arguments[i]);
+
+ for (j = 0, subLn = parts.length; j < subLn; j++) {
+ part = parts[j];
+
+ if (typeof part !== 'string') {
+ root = part;
+ } else {
+ if (!root[part]) {
+ root[part] = {};
+ }
+
+ root = root[part];
+ }
+ }
+ }
+
+ return root;
+ },
+
+
+ set: function(name, value) {
+ var targetName = this.getName(value);
+
+ this.classes[name] = this.setNamespace(name, value);
+
+ if (targetName && targetName !== name) {
+ this.maps.alternateToName[name] = targetName;
+ }
+
+ return this;
+ },
+
+
+ get: function(name) {
+ if (this.classes.hasOwnProperty(name)) {
+ return this.classes[name];
+ }
+
+ var root = Ext.global,
+ parts = this.parseNamespace(name),
+ part, i, ln;
+
+ for (i = 0, ln = parts.length; i < ln; i++) {
+ part = parts[i];
+
+ if (typeof part !== 'string') {
+ root = part;
+ } else {
+ if (!root || !root[part]) {
+ return null;
+ }
+
+ root = root[part];
+ }
+ }
+
+ return root;
+ },
+
+
+ setAlias: function(cls, alias) {
+ var aliasToNameMap = this.maps.aliasToName,
+ nameToAliasesMap = this.maps.nameToAliases,
+ className;
+
+ if (typeof cls === 'string') {
+ className = cls;
+ } else {
+ className = this.getName(cls);
+ }
+
+ if (alias && aliasToNameMap[alias] !== className) {
+
+ aliasToNameMap[alias] = className;
+ }
+
+ if (!nameToAliasesMap[className]) {
+ nameToAliasesMap[className] = [];
+ }
+
+ if (alias) {
+ Ext.Array.include(nameToAliasesMap[className], alias);
+ }
+
+ return this;
+ },
+
+
+ getByAlias: function(alias) {
+ return this.get(this.getNameByAlias(alias));
+ },
+
+
+ getNameByAlias: function(alias) {
+ return this.maps.aliasToName[alias] || '';
+ },
+
+
+ getNameByAlternate: function(alternate) {
+ return this.maps.alternateToName[alternate] || '';
+ },
+
+
+ getAliasesByName: function(name) {
+ return this.maps.nameToAliases[name] || [];
+ },
+
+
+ getName: function(object) {
+ return object && object.$className || '';
+ },
+
+
+ getClass: function(object) {
+ return object && object.self || null;
+ },
+
+
+ create: function(className, data, createdFn) {
+ var manager = this;
+
+
+ data.$className = className;
+
+ return new Class(data, function() {
+ var postprocessorStack = data.postprocessors || manager.defaultPostprocessors,
+ registeredPostprocessors = manager.postprocessors,
+ index = 0,
+ postprocessors = [],
+ postprocessor, process, i, ln;
+
+ delete data.postprocessors;
+
+ for (i = 0, ln = postprocessorStack.length; i < ln; i++) {
+ postprocessor = postprocessorStack[i];
+
+ if (typeof postprocessor === 'string') {
+ postprocessor = registeredPostprocessors[postprocessor];
+
+ if (!postprocessor.always) {
+ if (data[postprocessor.name] !== undefined) {
+ postprocessors.push(postprocessor.fn);
+ }
+ }
+ else {
+ postprocessors.push(postprocessor.fn);
+ }
+ }
+ else {
+ postprocessors.push(postprocessor);
+ }
+ }
+
+ process = function(clsName, cls, clsData) {
+ postprocessor = postprocessors[index++];
+
+ if (!postprocessor) {
+ manager.set(className, cls);
+
+ Ext.Loader.historyPush(className);
+
+ if (createdFn) {
+ createdFn.call(cls, cls);
+ }
+
+ return;
+ }
+
+ if (postprocessor.call(this, clsName, cls, clsData, process) !== false) {
+ process.apply(this, arguments);
+ }
+ };
+
+ process.call(manager, className, this, data);
+ });
+ },
+
+
+ instantiateByAlias: function() {
+ var alias = arguments[0],
+ args = slice.call(arguments),
+ className = this.getNameByAlias(alias);
+
+ if (!className) {
+ className = this.maps.aliasToName[alias];
+
+
+
+ Ext.syncRequire(className);
+ }
+
+ args[0] = className;
+
+ return this.instantiate.apply(this, args);
+ },
+
+
+ instantiate: function() {
+ var name = arguments[0],
+ args = slice.call(arguments, 1),
+ alias = name,
+ possibleName, cls;
+
+ if (typeof name !== 'function') {
+
+ cls = this.get(name);
+ }
+ else {
+ cls = name;
+ }
+
+
+ if (!cls) {
+ possibleName = this.getNameByAlias(name);
+
+ if (possibleName) {
+ name = possibleName;
+
+ cls = this.get(name);
+ }
+ }
+
+
+ if (!cls) {
+ possibleName = this.getNameByAlternate(name);
+
+ if (possibleName) {
+ name = possibleName;
+
+ cls = this.get(name);
+ }
+ }
+
+
+ if (!cls) {
+
+ Ext.syncRequire(name);
+
+ cls = this.get(name);
+ }
+
+
+
+ return this.getInstantiator(args.length)(cls, args);
+ },
+
+
+ dynInstantiate: function(name, args) {
+ args = Ext.Array.from(args, true);
+ args.unshift(name);
+
+ return this.instantiate.apply(this, args);
+ },
+
+
+ getInstantiator: function(length) {
+ if (!this.instantiators[length]) {
+ var i = length,
+ args = [];
+
+ for (i = 0; i < length; i++) {
+ args.push('a['+i+']');
+ }
+
+ this.instantiators[length] = new Function('c', 'a', 'return new c('+args.join(',')+')');
+ }
+
+ return this.instantiators[length];
+ },
+
+
+ postprocessors: {},
+
+
+ defaultPostprocessors: [],
+
+
+ registerPostprocessor: function(name, fn, always) {
+ this.postprocessors[name] = {
+ name: name,
+ always: always || false,
+ fn: fn
+ };
+
+ return this;
+ },
+
+
+ setDefaultPostprocessors: function(postprocessors) {
+ this.defaultPostprocessors = Ext.Array.from(postprocessors);
+
+ return this;
+ },
+
+
+ setDefaultPostprocessorPosition: function(name, offset, relativeName) {
+ var defaultPostprocessors = this.defaultPostprocessors,
+ index;
+
+ if (typeof offset === 'string') {
+ if (offset === 'first') {
+ defaultPostprocessors.unshift(name);
+
+ return this;
+ }
+ else if (offset === 'last') {
+ defaultPostprocessors.push(name);
+
+ return this;
+ }
+
+ offset = (offset === 'after') ? 1 : -1;
+ }
+
+ index = Ext.Array.indexOf(defaultPostprocessors, relativeName);
+
+ if (index !== -1) {
+ Ext.Array.splice(defaultPostprocessors, Math.max(0, index + offset), 0, name);
+ }
+
+ return this;
+ },
+
+
+ getNamesByExpression: function(expression) {
+ var nameToAliasesMap = this.maps.nameToAliases,
+ names = [],
+ name, alias, aliases, possibleName, regex, i, ln;
+
+
+ if (expression.indexOf('*') !== -1) {
+ expression = expression.replace(/\*/g, '(.*?)');
+ regex = new RegExp('^' + expression + '$');
+
+ for (name in nameToAliasesMap) {
+ if (nameToAliasesMap.hasOwnProperty(name)) {
+ aliases = nameToAliasesMap[name];
+
+ if (name.search(regex) !== -1) {
+ names.push(name);
+ }
+ else {
+ for (i = 0, ln = aliases.length; i < ln; i++) {
+ alias = aliases[i];
+
+ if (alias.search(regex) !== -1) {
+ names.push(name);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ } else {
+ possibleName = this.getNameByAlias(expression);
+
+ if (possibleName) {
+ names.push(possibleName);
+ } else {
+ possibleName = this.getNameByAlternate(expression);
+
+ if (possibleName) {
+ names.push(possibleName);
+ } else {
+ names.push(expression);
+ }
+ }
+ }
+
+ return names;
+ }
+ };
+
+ var defaultPostprocessors = Manager.defaultPostprocessors;
+
+
+
+ Manager.registerPostprocessor('alias', function(name, cls, data) {
+ var aliases = data.alias,
+ i, ln;
+
+ delete data.alias;
+
+ for (i = 0, ln = aliases.length; i < ln; i++) {
+ alias = aliases[i];
+
+ this.setAlias(cls, alias);
+ }
+ });
+
+
+ Manager.registerPostprocessor('singleton', function(name, cls, data, fn) {
+ fn.call(this, name, new cls(), data);
+ return false;
+ });
+
+
+ Manager.registerPostprocessor('alternateClassName', function(name, cls, data) {
+ var alternates = data.alternateClassName,
+ i, ln, alternate;
+
+ if (!(alternates instanceof Array)) {
+ alternates = [alternates];
+ }
+
+ for (i = 0, ln = alternates.length; i < ln; i++) {
+ alternate = alternates[i];
+
+
+ this.set(alternate, cls);
+ }
+ });
+
+ Manager.setDefaultPostprocessors(['alias', 'singleton', 'alternateClassName']);
+
+ Ext.apply(Ext, {
+
+ create: alias(Manager, 'instantiate'),
+
+
+ factory: function(item, namespace) {
+ if (item instanceof Array) {
+ var i, ln;
+
+ for (i = 0, ln = item.length; i < ln; i++) {
+ item[i] = Ext.factory(item[i], namespace);
+ }
+
+ return item;
+ }
+
+ var isString = (typeof item === 'string');
+
+ if (isString || (item instanceof Object && item.constructor === Object)) {
+ var name, config = {};
+
+ if (isString) {
+ name = item;
+ }
+ else {
+ name = item.className;
+ config = item;
+ delete config.className;
+ }
+
+ if (namespace !== undefined && name.indexOf(namespace) === -1) {
+ name = namespace + '.' + Ext.String.capitalize(name);
+ }
+
+ return Ext.create(name, config);
+ }
+
+ if (typeof item === 'function') {
+ return Ext.create(item);
+ }
+
+ return item;
+ },
+
+
+ widget: function(name) {
+ var args = slice.call(arguments);
+ args[0] = 'widget.' + name;
+
+ return Manager.instantiateByAlias.apply(Manager, args);
+ },
+
+
+ createByAlias: alias(Manager, 'instantiateByAlias'),
+
+
+
+
+ define: function (className, data, createdFn) {
+ if (!data.override) {
+ return Manager.create.apply(Manager, arguments);
+ }
+
+ var requires = data.requires,
+ uses = data.uses,
+ overrideName = className;
+
+ className = data.override;
+
+
+ data = Ext.apply({}, data);
+ delete data.requires;
+ delete data.uses;
+ delete data.override;
+
+
+ if (typeof requires == 'string') {
+ requires = [ className, requires ];
+ } else if (requires) {
+ requires = requires.slice(0);
+ requires.unshift(className);
+ } else {
+ requires = [ className ];
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ return Manager.create(overrideName, {
+ requires: requires,
+ uses: uses,
+ isPartial: true,
+ constructor: function () {
+ }
+ }, function () {
+ var cls = Manager.get(className);
+ if (cls.override) {
+ cls.override(data);
+ } else {
+ cls.self.override(data);
+ }
+
+ if (createdFn) {
+
+
+
+ createdFn.call(cls);
+ }
+ });
+ },
+
+
+ getClassName: alias(Manager, 'getName'),
+
+
+ getDisplayName: function(object) {
+ if (object.displayName) {
+ return object.displayName;
+ }
+
+ if (object.$name && object.$class) {
+ return Ext.getClassName(object.$class) + '#' + object.$name;
+ }
+
+ if (object.$className) {
+ return object.$className;
+ }
+
+ return 'Anonymous';
+ },
+
+
+ getClass: alias(Manager, 'getClass'),
+
+
+ namespace: alias(Manager, 'createNamespaces')
+ });
+
+
+ Ext.createWidget = Ext.widget;
+
+
+ Ext.ns = Ext.namespace;
+
+ Class.registerPreprocessor('className', function(cls, data) {
+ if (data.$className) {
+ cls.$className = data.$className;
+ }
+ }, true);
+
+ Class.setDefaultPreprocessorPosition('className', 'first');
+
+ Class.registerPreprocessor('xtype', function(cls, data) {
+ var xtypes = Ext.Array.from(data.xtype),
+ widgetPrefix = 'widget.',
+ aliases = Ext.Array.from(data.alias),
+ i, ln, xtype;
+
+ data.xtype = xtypes[0];
+ data.xtypes = xtypes;
+
+ aliases = data.alias = Ext.Array.from(data.alias);
+
+ for (i = 0,ln = xtypes.length; i < ln; i++) {
+ xtype = xtypes[i];
+
+
+ aliases.push(widgetPrefix + xtype);
+ }
+
+ data.alias = aliases;
+ });
+
+ Class.setDefaultPreprocessorPosition('xtype', 'last');
+
+ Class.registerPreprocessor('alias', function(cls, data) {
+ var aliases = Ext.Array.from(data.alias),
+ xtypes = Ext.Array.from(data.xtypes),
+ widgetPrefix = 'widget.',
+ widgetPrefixLength = widgetPrefix.length,
+ i, ln, alias, xtype;
+
+ for (i = 0, ln = aliases.length; i < ln; i++) {
+ alias = aliases[i];
+
+
+ if (alias.substring(0, widgetPrefixLength) === widgetPrefix) {
+ xtype = alias.substring(widgetPrefixLength);
+ Ext.Array.include(xtypes, xtype);
+
+ if (!cls.xtype) {
+ cls.xtype = data.xtype = xtype;
+ }
+ }
+ }
+
+ data.alias = aliases;
+ data.xtypes = xtypes;
+ });
+
+ Class.setDefaultPreprocessorPosition('alias', 'last');
+
+})(Ext.Class, Ext.Function.alias);
+
+
+(function(Manager, Class, flexSetter, alias) {
+
+ var
+ dependencyProperties = ['extend', 'mixins', 'requires'],
+ Loader;
+
+ Loader = Ext.Loader = {
+
+ documentHead: typeof document !== 'undefined' && (document.head || document.getElementsByTagName('head')[0]),
+
+
+ isLoading: false,
+
+
+ queue: [],
+
+
+ isFileLoaded: {},
+
+
+ readyListeners: [],
+
+
+ optionalRequires: [],
+
+
+ requiresMap: {},
+
+
+ numPendingFiles: 0,
+
+
+ numLoadedFiles: 0,
+
+
+ hasFileLoadError: false,
+
+
+ classNameToFilePathMap: {},
+
+
+ history: [],
+
+
+ config: {
+
+ enabled: false,
+
+
+ disableCaching: true,
+
+
+ disableCachingParam: '_dc',
+
+
+ paths: {
+ 'Ext': '.'
+ }
+ },
+
+
+ setConfig: function(name, value) {
+ if (Ext.isObject(name) && arguments.length === 1) {
+ Ext.Object.merge(this.config, name);
+ }
+ else {
+ this.config[name] = (Ext.isObject(value)) ? Ext.Object.merge(this.config[name], value) : value;
+ }
+
+ return this;
+ },
+
+
+ getConfig: function(name) {
+ if (name) {
+ return this.config[name];
+ }
+
+ return this.config;
+ },
+
+
+ setPath: flexSetter(function(name, path) {
+ this.config.paths[name] = path;
+
+ return this;
+ }),
+
+
+ getPath: function(className) {
+ var path = '',
+ paths = this.config.paths,
+ prefix = this.getPrefix(className);
+
+ if (prefix.length > 0) {
+ if (prefix === className) {
+ return paths[prefix];
+ }
+
+ path = paths[prefix];
+ className = className.substring(prefix.length + 1);
+ }
+
+ if (path.length > 0) {
+ path += '/';
+ }
+
+ return path.replace(/\/\.\//g, '/') + className.replace(/\./g, "/") + '.js';
+ },
+
+
+ getPrefix: function(className) {
+ var paths = this.config.paths,
+ prefix, deepestPrefix = '';
+
+ if (paths.hasOwnProperty(className)) {
+ return className;
+ }
+
+ for (prefix in paths) {
+ if (paths.hasOwnProperty(prefix) && prefix + '.' === className.substring(0, prefix.length + 1)) {
+ if (prefix.length > deepestPrefix.length) {
+ deepestPrefix = prefix;
+ }
+ }
+ }
+
+ return deepestPrefix;
+ },
+
+
+ refreshQueue: function() {
+ var ln = this.queue.length,
+ i, item, j, requires;
+
+ if (ln === 0) {
+ this.triggerReady();
+ return;
+ }
+
+ for (i = 0; i < ln; i++) {
+ item = this.queue[i];
+
+ if (item) {
+ requires = item.requires;
+
+
+
+ if (requires.length > this.numLoadedFiles) {
+ continue;
+ }
+
+ j = 0;
+
+ do {
+ if (Manager.isCreated(requires[j])) {
+
+ Ext.Array.erase(requires, j, 1);
+ }
+ else {
+ j++;
+ }
+ } while (j < requires.length);
+
+ if (item.requires.length === 0) {
+ Ext.Array.erase(this.queue, i, 1);
+ item.callback.call(item.scope);
+ this.refreshQueue();
+ break;
+ }
+ }
+ }
+
+ return this;
+ },
+
+
+ injectScriptElement: function(url, onLoad, onError, scope) {
+ var script = document.createElement('script'),
+ me = this,
+ onLoadFn = function() {
+ me.cleanupScriptElement(script);
+ onLoad.call(scope);
+ },
+ onErrorFn = function() {
+ me.cleanupScriptElement(script);
+ onError.call(scope);
+ };
+
+ script.type = 'text/javascript';
+ script.src = url;
+ script.onload = onLoadFn;
+ script.onerror = onErrorFn;
+ script.onreadystatechange = function() {
+ if (this.readyState === 'loaded' || this.readyState === 'complete') {
+ onLoadFn();
+ }
+ };
+
+ this.documentHead.appendChild(script);
+
+ return script;
+ },
+
+
+ cleanupScriptElement: function(script) {
+ script.onload = null;
+ script.onreadystatechange = null;
+ script.onerror = null;
+
+ return this;
+ },
+
+
+ loadScriptFile: function(url, onLoad, onError, scope, synchronous) {
+ var me = this,
+ noCacheUrl = url + (this.getConfig('disableCaching') ? ('?' + this.getConfig('disableCachingParam') + '=' + Ext.Date.now()) : ''),
+ fileName = url.split('/').pop(),
+ isCrossOriginRestricted = false,
+ xhr, status, onScriptError;
+
+ scope = scope || this;
+
+ this.isLoading = true;
+
+ if (!synchronous) {
+ onScriptError = function() {
+ onError.call(scope, "Failed loading '" + url + "', please verify that the file exists", synchronous);
+ };
+
+ if (!Ext.isReady && Ext.onDocumentReady) {
+ Ext.onDocumentReady(function() {
+ me.injectScriptElement(noCacheUrl, onLoad, onScriptError, scope);
+ });
+ }
+ else {
+ this.injectScriptElement(noCacheUrl, onLoad, onScriptError, scope);
+ }
+ }
+ else {
+ if (typeof XMLHttpRequest !== 'undefined') {
+ xhr = new XMLHttpRequest();
+ } else {
+ xhr = new ActiveXObject('Microsoft.XMLHTTP');
+ }
+
+ try {
+ xhr.open('GET', noCacheUrl, false);
+ xhr.send(null);
+ } catch (e) {
+ isCrossOriginRestricted = true;
+ }
+
+ status = (xhr.status === 1223) ? 204 : xhr.status;
+
+ if (!isCrossOriginRestricted) {
+ isCrossOriginRestricted = (status === 0);
+ }
+
+ if (isCrossOriginRestricted
+ ) {
+ onError.call(this, "Failed loading synchronously via XHR: '" + url + "'; It's likely that the file is either " +
+ "being loaded from a different domain or from the local file system whereby cross origin " +
+ "requests are not allowed due to security reasons. Use asynchronous loading with " +
+ "Ext.require instead.", synchronous);
+ }
+ else if (status >= 200 && status < 300
+ ) {
+
+ new Function(xhr.responseText + "\n//@ sourceURL=" + fileName)();
+
+ onLoad.call(scope);
+ }
+ else {
+ onError.call(this, "Failed loading synchronously via XHR: '" + url + "'; please " +
+ "verify that the file exists. " +
+ "XHR status code: " + status, synchronous);
+ }
+
+
+ xhr = null;
+ }
+ },
+
+
+ exclude: function(excludes) {
+ var me = this;
+
+ return {
+ require: function(expressions, fn, scope) {
+ return me.require(expressions, fn, scope, excludes);
+ },
+
+ syncRequire: function(expressions, fn, scope) {
+ return me.syncRequire(expressions, fn, scope, excludes);
+ }
+ };
+ },
+
+
+ syncRequire: function() {
+ this.syncModeEnabled = true;
+ this.require.apply(this, arguments);
+ this.refreshQueue();
+ this.syncModeEnabled = false;
+ },
+
+
+ require: function(expressions, fn, scope, excludes) {
+ var filePath, expression, exclude, className, excluded = {},
+ excludedClassNames = [],
+ possibleClassNames = [],
+ possibleClassName, classNames = [],
+ i, j, ln, subLn;
+
+ expressions = Ext.Array.from(expressions);
+ excludes = Ext.Array.from(excludes);
+
+ fn = fn || Ext.emptyFn;
+
+ scope = scope || Ext.global;
+
+ for (i = 0, ln = excludes.length; i < ln; i++) {
+ exclude = excludes[i];
+
+ if (typeof exclude === 'string' && exclude.length > 0) {
+ excludedClassNames = Manager.getNamesByExpression(exclude);
+
+ for (j = 0, subLn = excludedClassNames.length; j < subLn; j++) {
+ excluded[excludedClassNames[j]] = true;
+ }
+ }
+ }
+
+ for (i = 0, ln = expressions.length; i < ln; i++) {
+ expression = expressions[i];
+
+ if (typeof expression === 'string' && expression.length > 0) {
+ possibleClassNames = Manager.getNamesByExpression(expression);
+
+ for (j = 0, subLn = possibleClassNames.length; j < subLn; j++) {
+ possibleClassName = possibleClassNames[j];
+
+ if (!excluded.hasOwnProperty(possibleClassName) && !Manager.isCreated(possibleClassName)) {
+ Ext.Array.include(classNames, possibleClassName);
+ }
+ }
+ }
+ }
+
+
+
+ if (!this.config.enabled) {
+ if (classNames.length > 0) {
+ Ext.Error.raise({
+ sourceClass: "Ext.Loader",
+ sourceMethod: "require",
+ msg: "Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. " +
+ "Missing required class" + ((classNames.length > 1) ? "es" : "") + ": " + classNames.join(', ')
+ });
+ }
+ }
+
+ if (classNames.length === 0) {
+ fn.call(scope);
+ return this;
+ }
+
+ this.queue.push({
+ requires: classNames,
+ callback: fn,
+ scope: scope
+ });
+
+ classNames = classNames.slice();
+
+ for (i = 0, ln = classNames.length; i < ln; i++) {
+ className = classNames[i];
+
+ if (!this.isFileLoaded.hasOwnProperty(className)) {
+ this.isFileLoaded[className] = false;
+
+ filePath = this.getPath(className);
+
+ this.classNameToFilePathMap[className] = filePath;
+
+ this.numPendingFiles++;
+
+ this.loadScriptFile(
+ filePath,
+ Ext.Function.pass(this.onFileLoaded, [className, filePath], this),
+ Ext.Function.pass(this.onFileLoadError, [className, filePath]),
+ this,
+ this.syncModeEnabled
+ );
+ }
+ }
+
+ return this;
+ },
+
+
+ onFileLoaded: function(className, filePath) {
+ this.numLoadedFiles++;
+
+ this.isFileLoaded[className] = true;
+
+ this.numPendingFiles--;
+
+ if (this.numPendingFiles === 0) {
+ this.refreshQueue();
+ }
+
+
+ },
+
+
+ onFileLoadError: function(className, filePath, errorMessage, isSynchronous) {
+ this.numPendingFiles--;
+ this.hasFileLoadError = true;
+
+ },
+
+
+ addOptionalRequires: function(requires) {
+ var optionalRequires = this.optionalRequires,
+ i, ln, require;
+
+ requires = Ext.Array.from(requires);
+
+ for (i = 0, ln = requires.length; i < ln; i++) {
+ require = requires[i];
+
+ Ext.Array.include(optionalRequires, require);
+ }
+
+ return this;
+ },
+
+
+ triggerReady: function(force) {
+ var readyListeners = this.readyListeners,
+ optionalRequires, listener;
+
+ if (this.isLoading || force) {
+ this.isLoading = false;
+
+ if (this.optionalRequires.length) {
+
+ optionalRequires = Ext.Array.clone(this.optionalRequires);
+
+
+ this.optionalRequires.length = 0;
+
+ this.require(optionalRequires, Ext.Function.pass(this.triggerReady, [true], this), this);
+ return this;
+ }
+
+ while (readyListeners.length) {
+ listener = readyListeners.shift();
+ listener.fn.call(listener.scope);
+
+ if (this.isLoading) {
+ return this;
+ }
+ }
+ }
+
+ return this;
+ },
+
+
+ onReady: function(fn, scope, withDomReady, options) {
+ var oldFn;
+
+ if (withDomReady !== false && Ext.onDocumentReady) {
+ oldFn = fn;
+
+ fn = function() {
+ Ext.onDocumentReady(oldFn, scope, options);
+ };
+ }
+
+ if (!this.isLoading) {
+ fn.call(scope);
+ }
+ else {
+ this.readyListeners.push({
+ fn: fn,
+ scope: scope
+ });
+ }
+ },
+
+
+ historyPush: function(className) {
+ if (className && this.isFileLoaded.hasOwnProperty(className)) {
+ Ext.Array.include(this.history, className);
+ }
+
+ return this;
+ }
+ };
+
+
+ Ext.require = alias(Loader, 'require');
+
+
+ Ext.syncRequire = alias(Loader, 'syncRequire');
+
+
+ Ext.exclude = alias(Loader, 'exclude');
+
+
+ Ext.onReady = function(fn, scope, options) {
+ Loader.onReady(fn, scope, true, options);
+ };
+
+
+ Class.registerPreprocessor('loader', function(cls, data, continueFn) {
+ var me = this,
+ dependencies = [],
+ className = Manager.getName(cls),
+ i, j, ln, subLn, value, propertyName, propertyValue;
+
+
+
+ for (i = 0, ln = dependencyProperties.length; i < ln; i++) {
+ propertyName = dependencyProperties[i];
+
+ if (data.hasOwnProperty(propertyName)) {
+ propertyValue = data[propertyName];
+
+ if (typeof propertyValue === 'string') {
+ dependencies.push(propertyValue);
+ }
+ else if (propertyValue instanceof Array) {
+ for (j = 0, subLn = propertyValue.length; j < subLn; j++) {
+ value = propertyValue[j];
+
+ if (typeof value === 'string') {
+ dependencies.push(value);
+ }
+ }
+ }
+ else if (typeof propertyValue != 'function') {
+ for (j in propertyValue) {
+ if (propertyValue.hasOwnProperty(j)) {
+ value = propertyValue[j];
+
+ if (typeof value === 'string') {
+ dependencies.push(value);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (dependencies.length === 0) {
+
+ return;
+ }
+
+
+ Loader.require(dependencies, function() {
+ for (i = 0, ln = dependencyProperties.length; i < ln; i++) {
+ propertyName = dependencyProperties[i];
+
+ if (data.hasOwnProperty(propertyName)) {
+ propertyValue = data[propertyName];
+
+ if (typeof propertyValue === 'string') {
+ data[propertyName] = Manager.get(propertyValue);
+ }
+ else if (propertyValue instanceof Array) {
+ for (j = 0, subLn = propertyValue.length; j < subLn; j++) {
+ value = propertyValue[j];
+
+ if (typeof value === 'string') {
+ data[propertyName][j] = Manager.get(value);
+ }
+ }
+ }
+ else if (typeof propertyValue != 'function') {
+ for (var k in propertyValue) {
+ if (propertyValue.hasOwnProperty(k)) {
+ value = propertyValue[k];
+
+ if (typeof value === 'string') {
+ data[propertyName][k] = Manager.get(value);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ continueFn.call(me, cls, data);
+ });
+
+ return false;
+ }, true);
+
+ Class.setDefaultPreprocessorPosition('loader', 'after', 'className');
+
+
+ Manager.registerPostprocessor('uses', function(name, cls, data) {
+ var uses = Ext.Array.from(data.uses),
+ items = [],
+ i, ln, item;
+
+ for (i = 0, ln = uses.length; i < ln; i++) {
+ item = uses[i];
+
+ if (typeof item === 'string') {
+ items.push(item);
+ }
+ }
+
+ Loader.addOptionalRequires(items);
+ });
+
+ Manager.setDefaultPostprocessorPosition('uses', 'last');
+
+})(Ext.ClassManager, Ext.Class, Ext.Function.flexSetter, Ext.Function.alias);
+
+
+Ext.Error = Ext.extend(Error, {
+ statics: {
+
+ ignore: false,
+
+
+
+
+
+ raise: function(err){
+ err = err || {};
+ if (Ext.isString(err)) {
+ err = { msg: err };
+ }
+
+ var method = this.raise.caller;
+
+ if (method) {
+ if (method.$name) {
+ err.sourceMethod = method.$name;
+ }
+ if (method.$owner) {
+ err.sourceClass = method.$owner.$className;
+ }
+ }
+
+ if (Ext.Error.handle(err) !== true) {
+ var msg = Ext.Error.prototype.toString.call(err);
+
+ Ext.log({
+ msg: msg,
+ level: 'error',
+ dump: err,
+ stack: true
+ });
+
+ throw new Ext.Error(err);
+ }
+ },
+
+
+ handle: function(){
+ return Ext.Error.ignore;
+ }
+ },
+
+
+ name: 'Ext.Error',
+
+
+ constructor: function(config){
+ if (Ext.isString(config)) {
+ config = { msg: config };
+ }
+
+ var me = this;
+
+ Ext.apply(me, config);
+
+ me.message = me.message || me.msg;
+
+ },
+
+
+ toString: function(){
+ var me = this,
+ className = me.className ? me.className : '',
+ methodName = me.methodName ? '.' + me.methodName + '(): ' : '',
+ msg = me.msg || '(No description provided)';
+
+ return className + methodName + msg;
+ }
+});
+
+
+
+
+
+
+
+Ext.JSON = new(function() {
+ var useHasOwn = !! {}.hasOwnProperty,
+ isNative = function() {
+ var useNative = null;
+
+ return function() {
+ if (useNative === null) {
+ useNative = Ext.USE_NATIVE_JSON && window.JSON && JSON.toString() == '[object JSON]';
+ }
+
+ return useNative;
+ };
+ }(),
+ pad = function(n) {
+ return n < 10 ? "0" + n : n;
+ },
+ doDecode = function(json) {
+ return eval("(" + json + ')');
+ },
+ doEncode = function(o) {
+ if (!Ext.isDefined(o) || o === null) {
+ return "null";
+ } else if (Ext.isArray(o)) {
+ return encodeArray(o);
+ } else if (Ext.isDate(o)) {
+ return Ext.JSON.encodeDate(o);
+ } else if (Ext.isString(o)) {
+ return encodeString(o);
+ } else if (typeof o == "number") {
+
+ return isFinite(o) ? String(o) : "null";
+ } else if (Ext.isBoolean(o)) {
+ return String(o);
+ } else if (Ext.isObject(o)) {
+ return encodeObject(o);
+ } else if (typeof o === "function") {
+ return "null";
+ }
+ return 'undefined';
+ },
+ m = {
+ "\b": '\\b',
+ "\t": '\\t',
+ "\n": '\\n',
+ "\f": '\\f',
+ "\r": '\\r',
+ '"': '\\"',
+ "\\": '\\\\',
+ '\x0b': '\\u000b'
+ },
+ charToReplace = /[\\\"\x00-\x1f\x7f-\uffff]/g,
+ encodeString = function(s) {
+ return '"' + s.replace(charToReplace, function(a) {
+ var c = m[a];
+ return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ }) + '"';
+ },
+ encodeArray = function(o) {
+ var a = ["[", ""],
+
+ len = o.length,
+ i;
+ for (i = 0; i < len; i += 1) {
+ a.push(doEncode(o[i]), ',');
+ }
+
+ a[a.length - 1] = ']';
+ return a.join("");
+ },
+ encodeObject = function(o) {
+ var a = ["{", ""],
+
+ i;
+ for (i in o) {
+ if (!useHasOwn || o.hasOwnProperty(i)) {
+ a.push(doEncode(i), ":", doEncode(o[i]), ',');
+ }
+ }
+
+ a[a.length - 1] = '}';
+ return a.join("");
+ };
+
+
+ this.encodeDate = function(o) {
+ return '"' + o.getFullYear() + "-"
+ + pad(o.getMonth() + 1) + "-"
+ + pad(o.getDate()) + "T"
+ + pad(o.getHours()) + ":"
+ + pad(o.getMinutes()) + ":"
+ + pad(o.getSeconds()) + '"';
+ };
+
+
+ this.encode = function() {
+ var ec;
+ return function(o) {
+ if (!ec) {
+
+ ec = isNative() ? JSON.stringify : doEncode;
+ }
+ return ec(o);
+ };
+ }();
+
+
+
+ this.decode = function() {
+ var dc;
+ return function(json, safe) {
+ if (!dc) {
+
+ dc = isNative() ? JSON.parse : doDecode;
+ }
+ try {
+ return dc(json);
+ } catch (e) {
+ if (safe === true) {
+ return null;
+ }
+ Ext.Error.raise({
+ sourceClass: "Ext.JSON",
+ sourceMethod: "decode",
+ msg: "You're trying to decode an invalid JSON String: " + json
+ });
+ }
+ };
+ }();
+
+})();
+
+Ext.encode = Ext.JSON.encode;
+
+Ext.decode = Ext.JSON.decode;
+
+
+
+Ext.apply(Ext, {
+ userAgent: navigator.userAgent.toLowerCase(),
+ cache: {},
+ idSeed: 1000,
+ windowId: 'ext-window',
+ documentId: 'ext-document',
+
+
+ isReady: false,
+
+
+ enableGarbageCollector: true,
+
+
+ enableListenerCollection: true,
+
+
+ id: function(el, prefix) {
+ var me = this,
+ sandboxPrefix = '';
+ el = Ext.getDom(el, true) || {};
+ if (el === document) {
+ el.id = me.documentId;
+ }
+ else if (el === window) {
+ el.id = me.windowId;
+ }
+ if (!el.id) {
+ if (me.isSandboxed) {
+ if (!me.uniqueGlobalNamespace) {
+ me.getUniqueGlobalNamespace();
+ }
+ sandboxPrefix = me.uniqueGlobalNamespace + '-';
+ }
+ el.id = sandboxPrefix + (prefix || "ext-gen") + (++Ext.idSeed);
+ }
+ return el.id;
+ },
+
+
+ getBody: function() {
+ return Ext.get(document.body || false);
+ },
+
+
+ getHead: function() {
+ var head;
+
+ return function() {
+ if (head == undefined) {
+ head = Ext.get(document.getElementsByTagName("head")[0]);
+ }
+
+ return head;
+ };
+ }(),
+
+
+ getDoc: function() {
+ return Ext.get(document);
+ },
+
+
+ getCmp: function(id) {
+ return Ext.ComponentManager.get(id);
+ },
+
+
+ getOrientation: function() {
+ return window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
+ },
+
+
+ destroy: function() {
+ var ln = arguments.length,
+ i, arg;
+
+ for (i = 0; i < ln; i++) {
+ arg = arguments[i];
+ if (arg) {
+ if (Ext.isArray(arg)) {
+ this.destroy.apply(this, arg);
+ }
+ else if (Ext.isFunction(arg.destroy)) {
+ arg.destroy();
+ }
+ else if (arg.dom) {
+ arg.remove();
+ }
+ }
+ }
+ },
+
+
+ callback: function(callback, scope, args, delay){
+ if(Ext.isFunction(callback)){
+ args = args || [];
+ scope = scope || window;
+ if (delay) {
+ Ext.defer(callback, delay, scope, args);
+ } else {
+ callback.apply(scope, args);
+ }
+ }
+ },
+
+
+ htmlEncode : function(value) {
+ return Ext.String.htmlEncode(value);
+ },
+
+
+ htmlDecode : function(value) {
+ return Ext.String.htmlDecode(value);
+ },
+
+
+ urlAppend : function(url, s) {
+ if (!Ext.isEmpty(s)) {
+ return url + (url.indexOf('?') === -1 ? '?' : '&') + s;
+ }
+ return url;
+ }
+});
+
+
+Ext.ns = Ext.namespace;
+
+
+window.undefined = window.undefined;
+
+
+(function(){
+
+ var check = function(regex){
+ return regex.test(Ext.userAgent);
+ },
+ isStrict = document.compatMode == "CSS1Compat",
+ version = function (is, regex) {
+ var m;
+ return (is && (m = regex.exec(Ext.userAgent))) ? parseFloat(m[1]) : 0;
+ },
+ docMode = document.documentMode,
+ isOpera = check(/opera/),
+ isOpera10_5 = isOpera && check(/version\/10\.5/),
+ isChrome = check(/\bchrome\b/),
+ isWebKit = check(/webkit/),
+ isSafari = !isChrome && check(/safari/),
+ isSafari2 = isSafari && check(/applewebkit\/4/),
+ isSafari3 = isSafari && check(/version\/3/),
+ isSafari4 = isSafari && check(/version\/4/),
+ isSafari5 = isSafari && check(/version\/5/),
+ isIE = !isOpera && check(/msie/),
+ isIE7 = isIE && (check(/msie 7/) || docMode == 7),
+ isIE8 = isIE && (check(/msie 8/) && docMode != 7 && docMode != 9 || docMode == 8),
+ isIE9 = isIE && (check(/msie 9/) && docMode != 7 && docMode != 8 || docMode == 9),
+ isIE6 = isIE && check(/msie 6/),
+ isGecko = !isWebKit && check(/gecko/),
+ isGecko3 = isGecko && check(/rv:1\.9/),
+ isGecko4 = isGecko && check(/rv:2\.0/),
+ isGecko5 = isGecko && check(/rv:5\./),
+ isFF3_0 = isGecko3 && check(/rv:1\.9\.0/),
+ isFF3_5 = isGecko3 && check(/rv:1\.9\.1/),
+ isFF3_6 = isGecko3 && check(/rv:1\.9\.2/),
+ isWindows = check(/windows|win32/),
+ isMac = check(/macintosh|mac os x/),
+ isLinux = check(/linux/),
+ scrollbarSize = null,
+ chromeVersion = version(true, /\bchrome\/(\d+\.\d+)/),
+ firefoxVersion = version(true, /\bfirefox\/(\d+\.\d+)/),
+ ieVersion = version(isIE, /msie (\d+\.\d+)/),
+ operaVersion = version(isOpera, /version\/(\d+\.\d+)/),
+ safariVersion = version(isSafari, /version\/(\d+\.\d+)/),
+ webKitVersion = version(isWebKit, /webkit\/(\d+\.\d+)/),
+ isSecure = /^https/i.test(window.location.protocol);
+
+
+ try {
+ document.execCommand("BackgroundImageCache", false, true);
+ } catch(e) {}
+
+
+ Ext.setVersion('extjs', '4.0.7');
+ Ext.apply(Ext, {
+
+ SSL_SECURE_URL : isSecure && isIE ? 'javascript:""' : 'about:blank',
+
+
+
+
+ scopeResetCSS : Ext.buildSettings.scopeResetCSS,
+
+
+ enableNestedListenerRemoval : false,
+
+
+ USE_NATIVE_JSON : false,
+
+
+ getDom : function(el, strict) {
+ if (!el || !document) {
+ return null;
+ }
+ if (el.dom) {
+ return el.dom;
+ } else {
+ if (typeof el == 'string') {
+ var e = document.getElementById(el);
+
+
+ if (e && isIE && strict) {
+ if (el == e.getAttribute('id')) {
+ return e;
+ } else {
+ return null;
+ }
+ }
+ return e;
+ } else {
+ return el;
+ }
+ }
+ },
+
+
+ removeNode : isIE6 || isIE7 ? function() {
+ var d;
+ return function(n){
+ if(n && n.tagName != 'BODY'){
+ (Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n) : Ext.EventManager.removeAll(n);
+ d = d || document.createElement('div');
+ d.appendChild(n);
+ d.innerHTML = '';
+ delete Ext.cache[n.id];
+ }
+ };
+ }() : function(n) {
+ if (n && n.parentNode && n.tagName != 'BODY') {
+ (Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n) : Ext.EventManager.removeAll(n);
+ n.parentNode.removeChild(n);
+ delete Ext.cache[n.id];
+ }
+ },
+
+ isStrict: isStrict,
+
+ isIEQuirks: isIE && !isStrict,
+
+
+ isOpera : isOpera,
+
+
+ isOpera10_5 : isOpera10_5,
+
+
+ isWebKit : isWebKit,
+
+
+ isChrome : isChrome,
+
+
+ isSafari : isSafari,
+
+
+ isSafari3 : isSafari3,
+
+
+ isSafari4 : isSafari4,
+
+
+ isSafari5 : isSafari5,
+
+
+ isSafari2 : isSafari2,
+
+
+ isIE : isIE,
+
+
+ isIE6 : isIE6,
+
+
+ isIE7 : isIE7,
+
+
+ isIE8 : isIE8,
+
+
+ isIE9 : isIE9,
+
+
+ isGecko : isGecko,
+
+
+ isGecko3 : isGecko3,
+
+
+ isGecko4 : isGecko4,
+
+
+ isGecko5 : isGecko5,
+
+
+ isFF3_0 : isFF3_0,
+
+
+ isFF3_5 : isFF3_5,
+
+
+ isFF3_6 : isFF3_6,
+
+
+ isFF4 : 4 <= firefoxVersion && firefoxVersion < 5,
+
+
+ isFF5 : 5 <= firefoxVersion && firefoxVersion < 6,
+
+
+ isLinux : isLinux,
+
+
+ isWindows : isWindows,
+
+
+ isMac : isMac,
+
+
+ chromeVersion: chromeVersion,
+
+
+ firefoxVersion: firefoxVersion,
+
+
+ ieVersion: ieVersion,
+
+
+ operaVersion: operaVersion,
+
+
+ safariVersion: safariVersion,
+
+
+ webKitVersion: webKitVersion,
+
+
+ isSecure: isSecure,
+
+
+ BLANK_IMAGE_URL : (isIE6 || isIE7) ? '/' + '/www.sencha.com/s.gif' : 'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
+
+
+ value : function(v, defaultValue, allowBlank){
+ return Ext.isEmpty(v, allowBlank) ? defaultValue : v;
+ },
+
+
+ escapeRe : function(s) {
+ return s.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1");
+ },
+
+
+ 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;
+ }
+ },
+
+
+ getScrollbarSize: function (force) {
+ if(!Ext.isReady){
+ return 0;
+ }
+
+ if(force === true || scrollbarSize === null){
+
+
+
+ var cssClass = Ext.isIE9 ? '' : Ext.baseCSSPrefix + 'hide-offsets',
+
+ div = Ext.getBody().createChild(''),
+ child = div.child('div', true),
+ w1 = child.offsetWidth;
+
+ div.setStyle('overflow', (Ext.isWebKit || Ext.isGecko) ? 'auto' : 'scroll');
+
+ var w2 = child.offsetWidth, width = w1 - w2;
+ div.remove();
+
+
+ scrollbarSize = { width: width, height: width };
+ }
+
+ return scrollbarSize;
+ },
+
+
+ getScrollBarWidth: function(force){
+ var size = Ext.getScrollbarSize(force);
+ return size.width + 2;
+ },
+
+
+ copyTo : function(dest, source, names, usePrototypeKeys){
+ if(typeof names == 'string'){
+ names = names.split(/[,;\s]/);
+ }
+ Ext.each(names, function(name){
+ if(usePrototypeKeys || source.hasOwnProperty(name)){
+ dest[name] = source[name];
+ }
+ }, this);
+ return dest;
+ },
+
+
+ destroyMembers : function(o){
+ for (var i = 1, a = arguments, len = a.length; i < len; i++) {
+ Ext.destroy(o[a[i]]);
+ delete o[a[i]];
+ }
+ },
+
+
+ log :
+ Ext.emptyFn,
+
+
+ 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;
+ },
+
+
+ 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;
+ },
+
+
+ toSentence: function(items, connector) {
+ var length = items.length;
+
+ if (length <= 1) {
+ return items[0];
+ } else {
+ var head = items.slice(0, length - 1),
+ tail = items[length - 1];
+
+ return Ext.util.Format.format("{0} {1} {2}", head.join(", "), connector || 'and', tail);
+ }
+ },
+
+
+ useShims: isIE6
+ });
+})();
+
+
+Ext.application = function(config) {
+ Ext.require('Ext.app.Application');
+
+ Ext.onReady(function() {
+ Ext.create('Ext.app.Application', config);
+ });
+};
+
+
+(function() {
+ Ext.ns('Ext.util');
+
+ Ext.util.Format = {};
+ var UtilFormat = Ext.util.Format,
+ stripTagsRE = /<\/?[^>]+>/gi,
+ stripScriptsRe = /(?:)((\n|\r|.)*?)(?:<\/script>)/ig,
+ nl2brRe = /\r?\n/g,
+
+
+ formatCleanRe = /[^\d\.]/g,
+
+
+
+ I18NFormatCleanRe;
+
+ Ext.apply(UtilFormat, {
+
+ thousandSeparator: ',',
+
+
+ decimalSeparator: '.',
+
+
+ currencyPrecision: 2,
+
+
+ currencySign: '$',
+
+
+ currencyAtEnd: false,
+
+
+ undef : function(value) {
+ return value !== undefined ? value : "";
+ },
+
+
+ defaultValue : function(value, defaultValue) {
+ return value !== undefined && value !== '' ? value : defaultValue;
+ },
+
+
+ substr : function(value, start, length) {
+ return String(value).substr(start, length);
+ },
+
+
+ lowercase : function(value) {
+ return String(value).toLowerCase();
+ },
+
+
+ uppercase : function(value) {
+ return String(value).toUpperCase();
+ },
+
+
+ usMoney : function(v) {
+ return UtilFormat.currency(v, '$', 2);
+ },
+
+
+ currency: function(v, currencySign, decimals, end) {
+ var negativeSign = '',
+ format = ",0",
+ i = 0;
+ v = v - 0;
+ if (v < 0) {
+ v = -v;
+ negativeSign = '-';
+ }
+ decimals = decimals || UtilFormat.currencyPrecision;
+ format += format + (decimals > 0 ? '.' : '');
+ for (; i < decimals; i++) {
+ format += '0';
+ }
+ v = UtilFormat.number(v, format);
+ if ((end || UtilFormat.currencyAtEnd) === true) {
+ return Ext.String.format("{0}{1}{2}", negativeSign, v, currencySign || UtilFormat.currencySign);
+ } else {
+ return Ext.String.format("{0}{1}{2}", negativeSign, currencySign || UtilFormat.currencySign, v);
+ }
+ },
+
+
+ date: function(v, format) {
+ if (!v) {
+ return "";
+ }
+ if (!Ext.isDate(v)) {
+ v = new Date(Date.parse(v));
+ }
+ return Ext.Date.dateFormat(v, format || Ext.Date.defaultFormat);
+ },
+
+
+ dateRenderer : function(format) {
+ return function(v) {
+ return UtilFormat.date(v, format);
+ };
+ },
+
+
+ stripTags : function(v) {
+ return !v ? v : String(v).replace(stripTagsRE, "");
+ },
+
+
+ stripScripts : function(v) {
+ return !v ? v : String(v).replace(stripScriptsRe, "");
+ },
+
+
+ fileSize : function(size) {
+ if (size < 1024) {
+ return size + " bytes";
+ } else if (size < 1048576) {
+ return (Math.round(((size*10) / 1024))/10) + " KB";
+ } else {
+ return (Math.round(((size*10) / 1048576))/10) + " MB";
+ }
+ },
+
+
+ math : function(){
+ var fns = {};
+
+ return function(v, a){
+ if (!fns[a]) {
+ fns[a] = Ext.functionFactory('v', 'return v ' + a + ';');
+ }
+ return fns[a](v);
+ };
+ }(),
+
+
+ round : function(value, precision) {
+ var result = Number(value);
+ if (typeof precision == 'number') {
+ precision = Math.pow(10, precision);
+ result = Math.round(value * precision) / precision;
+ }
+ return result;
+ },
+
+
+ number: function(v, formatString) {
+ if (!formatString) {
+ return v;
+ }
+ v = Ext.Number.from(v, NaN);
+ if (isNaN(v)) {
+ return '';
+ }
+ var comma = UtilFormat.thousandSeparator,
+ dec = UtilFormat.decimalSeparator,
+ i18n = false,
+ neg = v < 0,
+ hasComma,
+ psplit;
+
+ v = Math.abs(v);
+
+
+
+
+
+ if (formatString.substr(formatString.length - 2) == '/i') {
+ if (!I18NFormatCleanRe) {
+ I18NFormatCleanRe = new RegExp('[^\\d\\' + UtilFormat.decimalSeparator + ']','g');
+ }
+ formatString = formatString.substr(0, formatString.length - 2);
+ i18n = true;
+ hasComma = formatString.indexOf(comma) != -1;
+ psplit = formatString.replace(I18NFormatCleanRe, '').split(dec);
+ } else {
+ hasComma = formatString.indexOf(',') != -1;
+ psplit = formatString.replace(formatCleanRe, '').split('.');
+ }
+
+ if (1 < psplit.length) {
+ v = v.toFixed(psplit[1].length);
+ } else if(2 < psplit.length) {
+ } else {
+ v = v.toFixed(0);
+ }
+
+ var fnum = v.toString();
+
+ psplit = fnum.split('.');
+
+ if (hasComma) {
+ var cnum = psplit[0],
+ parr = [],
+ j = cnum.length,
+ m = Math.floor(j / 3),
+ n = cnum.length % 3 || 3,
+ i;
+
+ for (i = 0; i < j; i += n) {
+ if (i !== 0) {
+ n = 3;
+ }
+
+ parr[parr.length] = cnum.substr(i, n);
+ m -= 1;
+ }
+ fnum = parr.join(comma);
+ if (psplit[1]) {
+ fnum += dec + psplit[1];
+ }
+ } else {
+ if (psplit[1]) {
+ fnum = psplit[0] + dec + psplit[1];
+ }
+ }
+
+ if (neg) {
+
+ neg = fnum.replace(/[^1-9]/g, '') !== '';
+ }
+
+ return (neg ? '-' : '') + formatString.replace(/[\d,?\.?]+/, fnum);
+ },
+
+
+ numberRenderer : function(format) {
+ return function(v) {
+ return UtilFormat.number(v, format);
+ };
+ },
+
+
+ plural : function(v, s, p) {
+ return v +' ' + (v == 1 ? s : (p ? p : s+'s'));
+ },
+
+
+ nl2br : function(v) {
+ return Ext.isEmpty(v) ? '' : v.replace(nl2brRe, '
');
+ },
+
+
+ capitalize: Ext.String.capitalize,
+
+
+ ellipsis: Ext.String.ellipsis,
+
+
+ format: Ext.String.format,
+
+
+ htmlDecode: Ext.String.htmlDecode,
+
+
+ htmlEncode: Ext.String.htmlEncode,
+
+
+ leftPad: Ext.String.leftPad,
+
+
+ trim : Ext.String.trim,
+
+
+ parseBox : function(box) {
+ if (Ext.isNumber(box)) {
+ box = box.toString();
+ }
+ var parts = box.split(' '),
+ ln = parts.length;
+
+ if (ln == 1) {
+ parts[1] = parts[2] = parts[3] = parts[0];
+ }
+ else if (ln == 2) {
+ parts[2] = parts[0];
+ parts[3] = parts[1];
+ }
+ else if (ln == 3) {
+ parts[3] = parts[1];
+ }
+
+ return {
+ top :parseInt(parts[0], 10) || 0,
+ right :parseInt(parts[1], 10) || 0,
+ bottom:parseInt(parts[2], 10) || 0,
+ left :parseInt(parts[3], 10) || 0
+ };
+ },
+
+
+ escapeRegex : function(s) {
+ return s.replace(/([\-.*+?\^${}()|\[\]\/\\])/g, "\\$1");
+ }
+ });
+})();
+
+
+Ext.ns('Ext.util');
+
+Ext.util.TaskRunner = function(interval) {
+ interval = interval || 10;
+ var tasks = [],
+ removeQueue = [],
+ id = 0,
+ running = false,
+
+
+ stopThread = function() {
+ running = false;
+ clearInterval(id);
+ id = 0;
+ },
+
+
+ startThread = function() {
+ if (!running) {
+ running = true;
+ id = setInterval(runTasks, interval);
+ }
+ },
+
+
+ removeTask = function(t) {
+ removeQueue.push(t);
+ if (t.onStop) {
+ t.onStop.apply(t.scope || t);
+ }
+ },
+
+
+ runTasks = function() {
+ var rqLen = removeQueue.length,
+ now = new Date().getTime(),
+ i;
+
+ if (rqLen > 0) {
+ for (i = 0; i < rqLen; i++) {
+ Ext.Array.remove(tasks, removeQueue[i]);
+ }
+ removeQueue = [];
+ if (tasks.length < 1) {
+ stopThread();
+ return;
+ }
+ }
+ i = 0;
+ var t,
+ itime,
+ rt,
+ len = tasks.length;
+ for (; i < len; ++i) {
+ t = tasks[i];
+ itime = now - t.taskRunTime;
+ if (t.interval <= itime) {
+ rt = t.run.apply(t.scope || t, t.args || [++t.taskRunCount]);
+ t.taskRunTime = now;
+ if (rt === false || t.taskRunCount === t.repeat) {
+ removeTask(t);
+ return;
+ }
+ }
+ if (t.duration && t.duration <= (now - t.taskStartTime)) {
+ removeTask(t);
+ }
+ }
+ };
+
+
+ this.start = function(task) {
+ tasks.push(task);
+ task.taskStartTime = new Date().getTime();
+ task.taskRunTime = 0;
+ task.taskRunCount = 0;
+ startThread();
+ return task;
+ };
+
+
+ this.stop = function(task) {
+ removeTask(task);
+ return task;
+ };
+
+
+ this.stopAll = function() {
+ stopThread();
+ for (var i = 0, len = tasks.length; i < len; i++) {
+ if (tasks[i].onStop) {
+ tasks[i].onStop();
+ }
+ }
+ tasks = [];
+ removeQueue = [];
+ };
+};
+
+
+Ext.TaskManager = Ext.create('Ext.util.TaskRunner');
+
+Ext.is = {
+ init : function(navigator) {
+ var platforms = this.platforms,
+ ln = platforms.length,
+ i, platform;
+
+ navigator = navigator || window.navigator;
+
+ for (i = 0; i < ln; i++) {
+ platform = platforms[i];
+ this[platform.identity] = platform.regex.test(navigator[platform.property]);
+ }
+
+
+ this.Desktop = this.Mac || this.Windows || (this.Linux && !this.Android);
+
+ this.Tablet = this.iPad;
+
+ this.Phone = !this.Desktop && !this.Tablet;
+
+ this.iOS = this.iPhone || this.iPad || this.iPod;
+
+
+ this.Standalone = !!window.navigator.standalone;
+ },
+
+
+ platforms: [{
+ property: 'platform',
+ regex: /iPhone/i,
+ identity: 'iPhone'
+ },
+
+
+ {
+ property: 'platform',
+ regex: /iPod/i,
+ identity: 'iPod'
+ },
+
+
+ {
+ property: 'userAgent',
+ regex: /iPad/i,
+ identity: 'iPad'
+ },
+
+
+ {
+ property: 'userAgent',
+ regex: /Blackberry/i,
+ identity: 'Blackberry'
+ },
+
+
+ {
+ property: 'userAgent',
+ regex: /Android/i,
+ identity: 'Android'
+ },
+
+
+ {
+ property: 'platform',
+ regex: /Mac/i,
+ identity: 'Mac'
+ },
+
+
+ {
+ property: 'platform',
+ regex: /Win/i,
+ identity: 'Windows'
+ },
+
+
+ {
+ property: 'platform',
+ regex: /Linux/i,
+ identity: 'Linux'
+ }]
+};
+
+Ext.is.init();
+
+
+Ext.supports = {
+ init : function() {
+ var doc = document,
+ div = doc.createElement('div'),
+ tests = this.tests,
+ ln = tests.length,
+ i, test;
+
+ div.innerHTML = [
+ '',
+ '',
+ ''
+ ].join('');
+
+ doc.body.appendChild(div);
+
+ for (i = 0; i < ln; i++) {
+ test = tests[i];
+ this[test.identity] = test.fn.call(this, doc, div);
+ }
+
+ doc.body.removeChild(div);
+ },
+
+
+ CSS3BoxShadow: Ext.isDefined(document.documentElement.style.boxShadow),
+
+
+ ClassList: !!document.documentElement.classList,
+
+
+ OrientationChange: ((typeof window.orientation != 'undefined') && ('onorientationchange' in window)),
+
+
+ DeviceMotion: ('ondevicemotion' in window),
+
+
+
+
+ Touch: ('ontouchstart' in window) && (!Ext.is.Desktop),
+
+ tests: [
+
+ {
+ identity: 'Transitions',
+ fn: function(doc, div) {
+ var prefix = [
+ 'webkit',
+ 'Moz',
+ 'o',
+ 'ms',
+ 'khtml'
+ ],
+ TE = 'TransitionEnd',
+ transitionEndName = [
+ prefix[0] + TE,
+ 'transitionend',
+ prefix[2] + TE,
+ prefix[3] + TE,
+ prefix[4] + TE
+ ],
+ ln = prefix.length,
+ i = 0,
+ out = false;
+ div = Ext.get(div);
+ for (; i < ln; i++) {
+ if (div.getStyle(prefix[i] + "TransitionProperty")) {
+ Ext.supports.CSS3Prefix = prefix[i];
+ Ext.supports.CSS3TransitionEnd = transitionEndName[i];
+ out = true;
+ break;
+ }
+ }
+ return out;
+ }
+ },
+
+
+ {
+ identity: 'RightMargin',
+ fn: function(doc, div) {
+ var view = doc.defaultView;
+ return !(view && view.getComputedStyle(div.firstChild.firstChild, null).marginRight != '0px');
+ }
+ },
+
+
+ {
+ identity: 'DisplayChangeInputSelectionBug',
+ fn: function() {
+ var webKitVersion = Ext.webKitVersion;
+
+ return 0 < webKitVersion && webKitVersion < 533;
+ }
+ },
+
+
+ {
+ identity: 'DisplayChangeTextAreaSelectionBug',
+ fn: function() {
+ var webKitVersion = Ext.webKitVersion;
+
+
+ return 0 < webKitVersion && webKitVersion < 534.24;
+ }
+ },
+
+
+ {
+ identity: 'TransparentColor',
+ fn: function(doc, div, view) {
+ view = doc.defaultView;
+ return !(view && view.getComputedStyle(div.lastChild, null).backgroundColor != 'transparent');
+ }
+ },
+
+
+ {
+ identity: 'ComputedStyle',
+ fn: function(doc, div, view) {
+ view = doc.defaultView;
+ return view && view.getComputedStyle;
+ }
+ },
+
+
+ {
+ identity: 'Svg',
+ fn: function(doc) {
+ return !!doc.createElementNS && !!doc.createElementNS( "http:/" + "/www.w3.org/2000/svg", "svg").createSVGRect;
+ }
+ },
+
+
+ {
+ identity: 'Canvas',
+ fn: function(doc) {
+ return !!doc.createElement('canvas').getContext;
+ }
+ },
+
+
+ {
+ identity: 'Vml',
+ fn: function(doc) {
+ var d = doc.createElement("div");
+ d.innerHTML = "";
+ return (d.childNodes.length == 2);
+ }
+ },
+
+
+ {
+ identity: 'Float',
+ fn: function(doc, div) {
+ return !!div.lastChild.style.cssFloat;
+ }
+ },
+
+
+ {
+ identity: 'AudioTag',
+ fn: function(doc) {
+ return !!doc.createElement('audio').canPlayType;
+ }
+ },
+
+
+ {
+ identity: 'History',
+ fn: function() {
+ return !!(window.history && history.pushState);
+ }
+ },
+
+
+ {
+ identity: 'CSS3DTransform',
+ fn: function() {
+ return (typeof WebKitCSSMatrix != 'undefined' && new WebKitCSSMatrix().hasOwnProperty('m41'));
+ }
+ },
+
+
+ {
+ identity: 'CSS3LinearGradient',
+ fn: function(doc, div) {
+ var property = 'background-image:',
+ webkit = '-webkit-gradient(linear, left top, right bottom, from(black), to(white))',
+ w3c = 'linear-gradient(left top, black, white)',
+ moz = '-moz-' + w3c,
+ options = [property + webkit, property + w3c, property + moz];
+
+ div.style.cssText = options.join(';');
+
+ return ("" + div.style.backgroundImage).indexOf('gradient') !== -1;
+ }
+ },
+
+
+ {
+ identity: 'CSS3BorderRadius',
+ fn: function(doc, div) {
+ var domPrefixes = ['borderRadius', 'BorderRadius', 'MozBorderRadius', 'WebkitBorderRadius', 'OBorderRadius', 'KhtmlBorderRadius'],
+ pass = false,
+ i;
+ for (i = 0; i < domPrefixes.length; i++) {
+ if (document.body.style[domPrefixes[i]] !== undefined) {
+ return true;
+ }
+ }
+ return pass;
+ }
+ },
+
+
+ {
+ identity: 'GeoLocation',
+ fn: function() {
+ return (typeof navigator != 'undefined' && typeof navigator.geolocation != 'undefined') || (typeof google != 'undefined' && typeof google.gears != 'undefined');
+ }
+ },
+
+ {
+ identity: 'MouseEnterLeave',
+ fn: function(doc, div){
+ return ('onmouseenter' in div && 'onmouseleave' in div);
+ }
+ },
+
+ {
+ identity: 'MouseWheel',
+ fn: function(doc, div) {
+ return ('onmousewheel' in div);
+ }
+ },
+
+ {
+ identity: 'Opacity',
+ fn: function(doc, div){
+
+ if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8) {
+ return false;
+ }
+ div.firstChild.style.cssText = 'opacity:0.73';
+ return div.firstChild.style.opacity == '0.73';
+ }
+ },
+
+ {
+ identity: 'Placeholder',
+ fn: function(doc) {
+ return 'placeholder' in doc.createElement('input');
+ }
+ },
+
+
+ {
+ identity: 'Direct2DBug',
+ fn: function() {
+ return Ext.isString(document.body.style.msTransformOrigin);
+ }
+ },
+
+ {
+ identity: 'BoundingClientRect',
+ fn: function(doc, div) {
+ return Ext.isFunction(div.getBoundingClientRect);
+ }
+ },
+ {
+ identity: 'IncludePaddingInWidthCalculation',
+ fn: function(doc, div){
+ var el = Ext.get(div.childNodes[1].firstChild);
+ return el.getWidth() == 210;
+ }
+ },
+ {
+ identity: 'IncludePaddingInHeightCalculation',
+ fn: function(doc, div){
+ var el = Ext.get(div.childNodes[1].firstChild);
+ return el.getHeight() == 210;
+ }
+ },
+
+
+ {
+ identity: 'ArraySort',
+ fn: function() {
+ var a = [1,2,3,4,5].sort(function(){ return 0; });
+ return a[0] === 1 && a[1] === 2 && a[2] === 3 && a[3] === 4 && a[4] === 5;
+ }
+ },
+
+ {
+ identity: 'Range',
+ fn: function() {
+ return !!document.createRange;
+ }
+ },
+
+ {
+ identity: 'CreateContextualFragment',
+ fn: function() {
+ var range = Ext.supports.Range ? document.createRange() : false;
+
+ return range && !!range.createContextualFragment;
+ }
+ },
+
+
+ {
+ identity: 'WindowOnError',
+ fn: function () {
+
+ return Ext.isIE || Ext.isGecko || Ext.webKitVersion >= 534.16;
+ }
+ }
+ ]
+};
+
+
+
+
+
+Ext.ns('Ext.core');
+Ext.core.DomHelper = Ext.DomHelper = function(){
+ var tempTableEl = null,
+ emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i,
+ tableRe = /^table|tbody|tr|td$/i,
+ confRe = /tag|children|cn|html$/i,
+ tableElRe = /td|tr|tbody/i,
+ endRe = /end/i,
+ pub,
+
+ afterbegin = 'afterbegin',
+ afterend = 'afterend',
+ beforebegin = 'beforebegin',
+ beforeend = 'beforeend',
+ ts = '',
+ tbs = ts+'',
+ tbe = ''+te,
+ trs = tbs + '',
+ tre = '
'+tbe;
+
+
+ function doInsert(el, o, returnElement, pos, sibling, append){
+ el = Ext.getDom(el);
+ var newNode;
+ if (pub.useDom) {
+ newNode = createDom(o, null);
+ if (append) {
+ el.appendChild(newNode);
+ } else {
+ (sibling == 'firstChild' ? el : el.parentNode).insertBefore(newNode, el[sibling] || el);
+ }
+ } else {
+ newNode = Ext.DomHelper.insertHtml(pos, el, Ext.DomHelper.createHtml(o));
+ }
+ return returnElement ? Ext.get(newNode, true) : newNode;
+ }
+
+ function createDom(o, parentNode){
+ var el,
+ doc = document,
+ useSet,
+ attr,
+ val,
+ cn;
+
+ if (Ext.isArray(o)) {
+ el = doc.createDocumentFragment();
+ for (var i = 0, l = o.length; i < l; i++) {
+ createDom(o[i], el);
+ }
+ } else if (typeof o == 'string') {
+ el = doc.createTextNode(o);
+ } else {
+ el = doc.createElement( o.tag || 'div' );
+ useSet = !!el.setAttribute;
+ for (attr in o) {
+ if(!confRe.test(attr)){
+ val = o[attr];
+ if(attr == 'cls'){
+ el.className = val;
+ }else{
+ if(useSet){
+ el.setAttribute(attr, val);
+ }else{
+ el[attr] = val;
+ }
+ }
+ }
+ }
+ Ext.DomHelper.applyStyles(el, o.style);
+
+ if ((cn = o.children || o.cn)) {
+ createDom(cn, el);
+ } else if (o.html) {
+ el.innerHTML = o.html;
+ }
+ }
+ if(parentNode){
+ parentNode.appendChild(el);
+ }
+ return el;
+ }
+
+
+ function createHtml(o){
+ var b = '',
+ attr,
+ val,
+ key,
+ cn,
+ i;
+
+ if(typeof o == "string"){
+ b = o;
+ } else if (Ext.isArray(o)) {
+ for (i=0; i < o.length; i++) {
+ if(o[i]) {
+ b += createHtml(o[i]);
+ }
+ }
+ } else {
+ b += '<' + (o.tag = o.tag || 'div');
+ for (attr in o) {
+ val = o[attr];
+ if(!confRe.test(attr)){
+ if (typeof val == "object") {
+ b += ' ' + attr + '="';
+ for (key in val) {
+ b += key + ':' + val[key] + ';';
+ }
+ b += '"';
+ }else{
+ b += ' ' + ({cls : 'class', htmlFor : 'for'}[attr] || attr) + '="' + val + '"';
+ }
+ }
+ }
+
+ if (emptyTags.test(o.tag)) {
+ b += '/>';
+ } else {
+ b += '>';
+ if ((cn = o.children || o.cn)) {
+ b += createHtml(cn);
+ } else if(o.html){
+ b += o.html;
+ }
+ b += '' + o.tag + '>';
+ }
+ }
+ return b;
+ }
+
+ function ieTable(depth, s, h, e){
+ tempTableEl.innerHTML = [s, h, e].join('');
+ var i = -1,
+ el = tempTableEl,
+ ns;
+ while(++i < depth){
+ el = el.firstChild;
+ }
+
+ ns = el.nextSibling;
+ if (ns){
+ var df = document.createDocumentFragment();
+ while(el){
+ ns = el.nextSibling;
+ df.appendChild(el);
+ el = ns;
+ }
+ el = df;
+ }
+ return el;
+ }
+
+
+ function insertIntoTable(tag, where, el, html) {
+ var node,
+ before;
+
+ tempTableEl = tempTableEl || document.createElement('div');
+
+ if(tag == 'td' && (where == afterbegin || where == beforeend) ||
+ !tableElRe.test(tag) && (where == beforebegin || where == afterend)) {
+ return null;
+ }
+ before = where == beforebegin ? el :
+ where == afterend ? el.nextSibling :
+ where == afterbegin ? el.firstChild : null;
+
+ if (where == beforebegin || where == afterend) {
+ el = el.parentNode;
+ }
+
+ if (tag == 'td' || (tag == 'tr' && (where == beforeend || where == afterbegin))) {
+ node = ieTable(4, trs, html, tre);
+ } else if ((tag == 'tbody' && (where == beforeend || where == afterbegin)) ||
+ (tag == 'tr' && (where == beforebegin || where == afterend))) {
+ node = ieTable(3, tbs, html, tbe);
+ } else {
+ node = ieTable(2, ts, html, te);
+ }
+ el.insertBefore(node, before);
+ return node;
+ }
+
+
+ function createContextualFragment(html){
+ var div = document.createElement("div"),
+ fragment = document.createDocumentFragment(),
+ i = 0,
+ length, childNodes;
+
+ div.innerHTML = html;
+ childNodes = div.childNodes;
+ length = childNodes.length;
+
+ for (; i < length; i++) {
+ fragment.appendChild(childNodes[i].cloneNode(true));
+ }
+
+ return fragment;
+ }
+
+ pub = {
+
+ markup : function(o){
+ return createHtml(o);
+ },
+
+
+ applyStyles : function(el, styles){
+ if (styles) {
+ el = Ext.fly(el);
+ if (typeof styles == "function") {
+ styles = styles.call();
+ }
+ if (typeof styles == "string") {
+ styles = Ext.Element.parseStyles(styles);
+ }
+ if (typeof styles == "object") {
+ el.setStyle(styles);
+ }
+ }
+ },
+
+
+ insertHtml : function(where, el, html){
+ var hash = {},
+ hashVal,
+ range,
+ rangeEl,
+ setStart,
+ frag,
+ rs;
+
+ where = where.toLowerCase();
+
+ hash[beforebegin] = ['BeforeBegin', 'previousSibling'];
+ hash[afterend] = ['AfterEnd', 'nextSibling'];
+
+
+ if (el.insertAdjacentHTML) {
+ if(tableRe.test(el.tagName) && (rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html))){
+ return rs;
+ }
+
+
+ hash[afterbegin] = ['AfterBegin', 'firstChild'];
+ hash[beforeend] = ['BeforeEnd', 'lastChild'];
+ if ((hashVal = hash[where])) {
+ el.insertAdjacentHTML(hashVal[0], html);
+ return el[hashVal[1]];
+ }
+
+ } else {
+
+ if (Ext.isTextNode(el)) {
+ where = where === 'afterbegin' ? 'beforebegin' : where;
+ where = where === 'beforeend' ? 'afterend' : where;
+ }
+ range = Ext.supports.CreateContextualFragment ? el.ownerDocument.createRange() : undefined;
+ setStart = 'setStart' + (endRe.test(where) ? 'After' : 'Before');
+ if (hash[where]) {
+ if (range) {
+ range[setStart](el);
+ frag = range.createContextualFragment(html);
+ } else {
+ frag = createContextualFragment(html);
+ }
+ el.parentNode.insertBefore(frag, where == beforebegin ? el : el.nextSibling);
+ return el[(where == beforebegin ? 'previous' : 'next') + 'Sibling'];
+ } else {
+ rangeEl = (where == afterbegin ? 'first' : 'last') + 'Child';
+ if (el.firstChild) {
+ if (range) {
+ range[setStart](el[rangeEl]);
+ frag = range.createContextualFragment(html);
+ } else {
+ frag = createContextualFragment(html);
+ }
+
+ if(where == afterbegin){
+ el.insertBefore(frag, el.firstChild);
+ }else{
+ el.appendChild(frag);
+ }
+ } else {
+ el.innerHTML = html;
+ }
+ return el[rangeEl];
+ }
+ }
+ },
+
+
+ insertBefore : function(el, o, returnElement){
+ return doInsert(el, o, returnElement, beforebegin);
+ },
+
+
+ insertAfter : function(el, o, returnElement){
+ return doInsert(el, o, returnElement, afterend, 'nextSibling');
+ },
+
+
+ insertFirst : function(el, o, returnElement){
+ return doInsert(el, o, returnElement, afterbegin, 'firstChild');
+ },
+
+
+ append : function(el, o, returnElement){
+ return doInsert(el, o, returnElement, beforeend, '', true);
+ },
+
+
+ overwrite : function(el, o, returnElement){
+ el = Ext.getDom(el);
+ el.innerHTML = createHtml(o);
+ return returnElement ? Ext.get(el.firstChild) : el.firstChild;
+ },
+
+ createHtml : createHtml,
+
+
+ createDom: createDom,
+
+
+ useDom : false,
+
+
+ createTemplate : function(o){
+ var html = Ext.DomHelper.createHtml(o);
+ return Ext.create('Ext.Template', html);
+ }
+ };
+ return pub;
+}();
+
+
+
+Ext.ns('Ext.core');
+
+Ext.core.DomQuery = Ext.DomQuery = function(){
+ var cache = {},
+ simpleCache = {},
+ valueCache = {},
+ nonSpace = /\S/,
+ trimRe = /^\s+|\s+$/g,
+ tplRe = /\{(\d+)\}/g,
+ modeRe = /^(\s?[\/>+~]\s?|\s|$)/,
+ tagTokenRe = /^(#)?([\w-\*]+)/,
+ nthRe = /(\d*)n\+?(\d*)/,
+ nthRe2 = /\D/,
+ startIdRe = /^\s*\#/,
+
+
+
+ isIE = window.ActiveXObject ? true : false,
+ key = 30803;
+
+
+
+ eval("var batch = 30803;");
+
+
+
+ function child(parent, index){
+ var i = 0,
+ n = parent.firstChild;
+ while(n){
+ if(n.nodeType == 1){
+ if(++i == index){
+ return n;
+ }
+ }
+ n = n.nextSibling;
+ }
+ return null;
+ }
+
+
+ function next(n){
+ while((n = n.nextSibling) && n.nodeType != 1);
+ return n;
+ }
+
+
+ function prev(n){
+ while((n = n.previousSibling) && n.nodeType != 1);
+ return n;
+ }
+
+
+
+ function children(parent){
+ var n = parent.firstChild,
+ nodeIndex = -1,
+ nextNode;
+ while(n){
+ nextNode = n.nextSibling;
+
+ if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
+ parent.removeChild(n);
+ }else{
+
+ n.nodeIndex = ++nodeIndex;
+ }
+ n = nextNode;
+ }
+ return this;
+ }
+
+
+
+
+ function byClassName(nodeSet, cls){
+ if(!cls){
+ return nodeSet;
+ }
+ var result = [], ri = -1;
+ for(var i = 0, ci; ci = nodeSet[i]; i++){
+ if((' '+ci.className+' ').indexOf(cls) != -1){
+ result[++ri] = ci;
+ }
+ }
+ return result;
+ };
+
+ function attrValue(n, attr){
+
+ if(!n.tagName && typeof n.length != "undefined"){
+ n = n[0];
+ }
+ if(!n){
+ return null;
+ }
+
+ if(attr == "for"){
+ return n.htmlFor;
+ }
+ if(attr == "class" || attr == "className"){
+ return n.className;
+ }
+ return n.getAttribute(attr) || n[attr];
+
+ };
+
+
+
+
+
+ function getNodes(ns, mode, tagName){
+ var result = [], ri = -1, cs;
+ if(!ns){
+ return result;
+ }
+ tagName = tagName || "*";
+
+ if(typeof ns.getElementsByTagName != "undefined"){
+ ns = [ns];
+ }
+
+
+
+ if(!mode){
+ for(var i = 0, ni; ni = ns[i]; i++){
+ cs = ni.getElementsByTagName(tagName);
+ for(var j = 0, ci; ci = cs[j]; j++){
+ result[++ri] = ci;
+ }
+ }
+
+
+ } else if(mode == "/" || mode == ">"){
+ var utag = tagName.toUpperCase();
+ for(var i = 0, ni, cn; ni = ns[i]; i++){
+ cn = ni.childNodes;
+ for(var j = 0, cj; cj = cn[j]; j++){
+ if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
+ result[++ri] = cj;
+ }
+ }
+ }
+
+
+ }else if(mode == "+"){
+ var utag = tagName.toUpperCase();
+ for(var i = 0, n; n = ns[i]; i++){
+ while((n = n.nextSibling) && n.nodeType != 1);
+ if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
+ result[++ri] = n;
+ }
+ }
+
+
+ }else if(mode == "~"){
+ var utag = tagName.toUpperCase();
+ for(var i = 0, n; n = ns[i]; i++){
+ while((n = n.nextSibling)){
+ if (n.nodeName == utag || n.nodeName == tagName || tagName == '*'){
+ result[++ri] = n;
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ function concat(a, b){
+ if(b.slice){
+ return a.concat(b);
+ }
+ for(var i = 0, l = b.length; i < l; i++){
+ a[a.length] = b[i];
+ }
+ return a;
+ }
+
+ function byTag(cs, tagName){
+ if(cs.tagName || cs == document){
+ cs = [cs];
+ }
+ if(!tagName){
+ return cs;
+ }
+ var result = [], ri = -1;
+ tagName = tagName.toLowerCase();
+ for(var i = 0, ci; ci = cs[i]; i++){
+ if(ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName){
+ result[++ri] = ci;
+ }
+ }
+ return result;
+ }
+
+ function byId(cs, id){
+ if(cs.tagName || cs == document){
+ cs = [cs];
+ }
+ if(!id){
+ return cs;
+ }
+ var result = [], ri = -1;
+ for(var i = 0, ci; ci = cs[i]; i++){
+ if(ci && ci.id == id){
+ result[++ri] = ci;
+ return result;
+ }
+ }
+ return result;
+ }
+
+
+
+ function byAttribute(cs, attr, value, op, custom){
+ var result = [],
+ ri = -1,
+ useGetStyle = custom == "{",
+ fn = Ext.DomQuery.operators[op],
+ a,
+ xml,
+ hasXml;
+
+ for(var i = 0, ci; ci = cs[i]; i++){
+
+ if(ci.nodeType != 1){
+ continue;
+ }
+
+ if(!hasXml){
+ xml = Ext.DomQuery.isXml(ci);
+ hasXml = true;
+ }
+
+
+ if(!xml){
+ if(useGetStyle){
+ a = Ext.DomQuery.getStyle(ci, attr);
+ } else if (attr == "class" || attr == "className"){
+ a = ci.className;
+ } else if (attr == "for"){
+ a = ci.htmlFor;
+ } else if (attr == "href"){
+
+
+ a = ci.getAttribute("href", 2);
+ } else{
+ a = ci.getAttribute(attr);
+ }
+ }else{
+ a = ci.getAttribute(attr);
+ }
+ if((fn && fn(a, value)) || (!fn && a)){
+ result[++ri] = ci;
+ }
+ }
+ return result;
+ }
+
+ function byPseudo(cs, name, value){
+ return Ext.DomQuery.pseudos[name](cs, value);
+ }
+
+ function nodupIEXml(cs){
+ var d = ++key,
+ r;
+ cs[0].setAttribute("_nodup", d);
+ r = [cs[0]];
+ for(var i = 1, len = cs.length; i < len; i++){
+ var c = cs[i];
+ if(!c.getAttribute("_nodup") != d){
+ c.setAttribute("_nodup", d);
+ r[r.length] = c;
+ }
+ }
+ for(var i = 0, len = cs.length; i < len; i++){
+ cs[i].removeAttribute("_nodup");
+ }
+ return r;
+ }
+
+ function nodup(cs){
+ if(!cs){
+ return [];
+ }
+ var len = cs.length, c, i, r = cs, cj, ri = -1;
+ if(!len || typeof cs.nodeType != "undefined" || len == 1){
+ return cs;
+ }
+ if(isIE && typeof cs[0].selectSingleNode != "undefined"){
+ return nodupIEXml(cs);
+ }
+ var d = ++key;
+ cs[0]._nodup = d;
+ for(i = 1; c = cs[i]; i++){
+ if(c._nodup != d){
+ c._nodup = d;
+ }else{
+ r = [];
+ for(var j = 0; j < i; j++){
+ r[++ri] = cs[j];
+ }
+ for(j = i+1; cj = cs[j]; j++){
+ if(cj._nodup != d){
+ cj._nodup = d;
+ r[++ri] = cj;
+ }
+ }
+ return r;
+ }
+ }
+ return r;
+ }
+
+ function quickDiffIEXml(c1, c2){
+ var d = ++key,
+ r = [];
+ for(var i = 0, len = c1.length; i < len; i++){
+ c1[i].setAttribute("_qdiff", d);
+ }
+ for(var i = 0, len = c2.length; i < len; i++){
+ if(c2[i].getAttribute("_qdiff") != d){
+ r[r.length] = c2[i];
+ }
+ }
+ for(var i = 0, len = c1.length; i < len; i++){
+ c1[i].removeAttribute("_qdiff");
+ }
+ return r;
+ }
+
+ function quickDiff(c1, c2){
+ var len1 = c1.length,
+ d = ++key,
+ r = [];
+ if(!len1){
+ return c2;
+ }
+ if(isIE && typeof c1[0].selectSingleNode != "undefined"){
+ return quickDiffIEXml(c1, c2);
+ }
+ for(var i = 0; i < len1; i++){
+ c1[i]._qdiff = d;
+ }
+ for(var i = 0, len = c2.length; i < len; i++){
+ if(c2[i]._qdiff != d){
+ r[r.length] = c2[i];
+ }
+ }
+ return r;
+ }
+
+ function quickId(ns, mode, root, id){
+ if(ns == root){
+ var d = root.ownerDocument || root;
+ return d.getElementById(id);
+ }
+ ns = getNodes(ns, mode, "*");
+ return byId(ns, id);
+ }
+
+ return {
+ getStyle : function(el, name){
+ return Ext.fly(el).getStyle(name);
+ },
+
+ compile : function(path, type){
+ type = type || "select";
+
+
+ var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"],
+ mode,
+ lastPath,
+ matchers = Ext.DomQuery.matchers,
+ matchersLn = matchers.length,
+ modeMatch,
+
+ lmode = path.match(modeRe);
+
+ if(lmode && lmode[1]){
+ fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
+ path = path.replace(lmode[1], "");
+ }
+
+
+ while(path.substr(0, 1)=="/"){
+ path = path.substr(1);
+ }
+
+ while(path && lastPath != path){
+ lastPath = path;
+ var tokenMatch = path.match(tagTokenRe);
+ if(type == "select"){
+ if(tokenMatch){
+
+ if(tokenMatch[1] == "#"){
+ fn[fn.length] = 'n = quickId(n, mode, root, "'+tokenMatch[2]+'");';
+ }else{
+ fn[fn.length] = 'n = getNodes(n, mode, "'+tokenMatch[2]+'");';
+ }
+ path = path.replace(tokenMatch[0], "");
+ }else if(path.substr(0, 1) != '@'){
+ fn[fn.length] = 'n = getNodes(n, mode, "*");';
+ }
+
+ }else{
+ if(tokenMatch){
+ if(tokenMatch[1] == "#"){
+ fn[fn.length] = 'n = byId(n, "'+tokenMatch[2]+'");';
+ }else{
+ fn[fn.length] = 'n = byTag(n, "'+tokenMatch[2]+'");';
+ }
+ path = path.replace(tokenMatch[0], "");
+ }
+ }
+ while(!(modeMatch = path.match(modeRe))){
+ var matched = false;
+ for(var j = 0; j < matchersLn; j++){
+ var t = matchers[j];
+ var m = path.match(t.re);
+ if(m){
+ fn[fn.length] = t.select.replace(tplRe, function(x, i){
+ return m[i];
+ });
+ path = path.replace(m[0], "");
+ matched = true;
+ break;
+ }
+ }
+
+ if(!matched){
+ }
+ }
+ if(modeMatch[1]){
+ fn[fn.length] = 'mode="'+modeMatch[1].replace(trimRe, "")+'";';
+ path = path.replace(modeMatch[1], "");
+ }
+ }
+
+ fn[fn.length] = "return nodup(n);\n}";
+
+
+ eval(fn.join(""));
+ return f;
+ },
+
+
+ jsSelect: function(path, root, type){
+
+ root = root || document;
+
+ if(typeof root == "string"){
+ root = document.getElementById(root);
+ }
+ var paths = path.split(","),
+ results = [];
+
+
+ for(var i = 0, len = paths.length; i < len; i++){
+ var subPath = paths[i].replace(trimRe, "");
+
+ if(!cache[subPath]){
+ cache[subPath] = Ext.DomQuery.compile(subPath);
+ if(!cache[subPath]){
+ }
+ }
+ var result = cache[subPath](root);
+ if(result && result != document){
+ results = results.concat(result);
+ }
+ }
+
+
+
+ if(paths.length > 1){
+ return nodup(results);
+ }
+ return results;
+ },
+
+ isXml: function(el) {
+ var docEl = (el ? el.ownerDocument || el : 0).documentElement;
+ return docEl ? docEl.nodeName !== "HTML" : false;
+ },
+
+
+ select : document.querySelectorAll ? function(path, root, type) {
+ root = root || document;
+
+ if (!Ext.DomQuery.isXml(root) && !(Ext.isSafari3 && !Ext.isStrict)) {
+ try {
+
+ var isDocumentRoot = root.nodeType === 9,
+ _path = path,
+ _root = root;
+
+ if (!isDocumentRoot && path.indexOf(',') === -1 && !startIdRe.test(path)) {
+ _path = '#' + Ext.id(root) + ' ' + path;
+ _root = root.parentNode;
+ }
+ return Ext.Array.toArray(_root.querySelectorAll(_path));
+ }
+ catch (e) {
+ }
+ }
+ return Ext.DomQuery.jsSelect.call(this, path, root, type);
+ } : function(path, root, type) {
+ return Ext.DomQuery.jsSelect.call(this, path, root, type);
+ },
+
+
+ selectNode : function(path, root){
+ return Ext.DomQuery.select(path, root)[0];
+ },
+
+
+ selectValue : function(path, root, defaultValue){
+ path = path.replace(trimRe, "");
+ if(!valueCache[path]){
+ valueCache[path] = Ext.DomQuery.compile(path, "select");
+ }
+ var n = valueCache[path](root), v;
+ n = n[0] ? n[0] : n;
+
+
+
+
+
+ if (typeof n.normalize == 'function') n.normalize();
+
+ v = (n && n.firstChild ? n.firstChild.nodeValue : null);
+ return ((v === null||v === undefined||v==='') ? defaultValue : v);
+ },
+
+
+ selectNumber : function(path, root, defaultValue){
+ var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
+ return parseFloat(v);
+ },
+
+
+ is : function(el, ss){
+ if(typeof el == "string"){
+ el = document.getElementById(el);
+ }
+ var isArray = Ext.isArray(el),
+ result = Ext.DomQuery.filter(isArray ? el : [el], ss);
+ return isArray ? (result.length == el.length) : (result.length > 0);
+ },
+
+
+ filter : function(els, ss, nonMatches){
+ ss = ss.replace(trimRe, "");
+ if(!simpleCache[ss]){
+ simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
+ }
+ var result = simpleCache[ss](els);
+ return nonMatches ? quickDiff(result, els) : result;
+ },
+
+
+ matchers : [{
+ re: /^\.([\w-]+)/,
+ select: 'n = byClassName(n, " {1} ");'
+ }, {
+ re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
+ select: 'n = byPseudo(n, "{1}", "{2}");'
+ },{
+ re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
+ select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
+ }, {
+ re: /^#([\w-]+)/,
+ select: 'n = byId(n, "{1}");'
+ },{
+ re: /^@([\w-]+)/,
+ select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
+ }
+ ],
+
+
+ operators : {
+ "=" : function(a, v){
+ return a == v;
+ },
+ "!=" : function(a, v){
+ return a != v;
+ },
+ "^=" : function(a, v){
+ return a && a.substr(0, v.length) == v;
+ },
+ "$=" : function(a, v){
+ return a && a.substr(a.length-v.length) == v;
+ },
+ "*=" : function(a, v){
+ return a && a.indexOf(v) !== -1;
+ },
+ "%=" : function(a, v){
+ return (a % v) == 0;
+ },
+ "|=" : function(a, v){
+ return a && (a == v || a.substr(0, v.length+1) == v+'-');
+ },
+ "~=" : function(a, v){
+ return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
+ }
+ },
+
+
+ pseudos : {
+ "first-child" : function(c){
+ var r = [], ri = -1, n;
+ for(var i = 0, ci; ci = n = c[i]; i++){
+ while((n = n.previousSibling) && n.nodeType != 1);
+ if(!n){
+ r[++ri] = ci;
+ }
+ }
+ return r;
+ },
+
+ "last-child" : function(c){
+ var r = [], ri = -1, n;
+ for(var i = 0, ci; ci = n = c[i]; i++){
+ while((n = n.nextSibling) && n.nodeType != 1);
+ if(!n){
+ r[++ri] = ci;
+ }
+ }
+ return r;
+ },
+
+ "nth-child" : function(c, a) {
+ var r = [], ri = -1,
+ m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),
+ f = (m[1] || 1) - 0, l = m[2] - 0;
+ for(var i = 0, n; n = c[i]; i++){
+ var pn = n.parentNode;
+ if (batch != pn._batch) {
+ var j = 0;
+ for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
+ if(cn.nodeType == 1){
+ cn.nodeIndex = ++j;
+ }
+ }
+ pn._batch = batch;
+ }
+ if (f == 1) {
+ if (l == 0 || n.nodeIndex == l){
+ r[++ri] = n;
+ }
+ } else if ((n.nodeIndex + l) % f == 0){
+ r[++ri] = n;
+ }
+ }
+
+ return r;
+ },
+
+ "only-child" : function(c){
+ var r = [], ri = -1;;
+ for(var i = 0, ci; ci = c[i]; i++){
+ if(!prev(ci) && !next(ci)){
+ r[++ri] = ci;
+ }
+ }
+ return r;
+ },
+
+ "empty" : function(c){
+ var r = [], ri = -1;
+ for(var i = 0, ci; ci = c[i]; i++){
+ var cns = ci.childNodes, j = 0, cn, empty = true;
+ while(cn = cns[j]){
+ ++j;
+ if(cn.nodeType == 1 || cn.nodeType == 3){
+ empty = false;
+ break;
+ }
+ }
+ if(empty){
+ r[++ri] = ci;
+ }
+ }
+ return r;
+ },
+
+ "contains" : function(c, v){
+ var r = [], ri = -1;
+ for(var i = 0, ci; ci = c[i]; i++){
+ if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
+ r[++ri] = ci;
+ }
+ }
+ return r;
+ },
+
+ "nodeValue" : function(c, v){
+ var r = [], ri = -1;
+ for(var i = 0, ci; ci = c[i]; i++){
+ if(ci.firstChild && ci.firstChild.nodeValue == v){
+ r[++ri] = ci;
+ }
+ }
+ return r;
+ },
+
+ "checked" : function(c){
+ var r = [], ri = -1;
+ for(var i = 0, ci; ci = c[i]; i++){
+ if(ci.checked == true){
+ r[++ri] = ci;
+ }
+ }
+ return r;
+ },
+
+ "not" : function(c, ss){
+ return Ext.DomQuery.filter(c, ss, true);
+ },
+
+ "any" : function(c, selectors){
+ var ss = selectors.split('|'),
+ r = [], ri = -1, s;
+ for(var i = 0, ci; ci = c[i]; i++){
+ for(var j = 0; s = ss[j]; j++){
+ if(Ext.DomQuery.is(ci, s)){
+ r[++ri] = ci;
+ break;
+ }
+ }
+ }
+ return r;
+ },
+
+ "odd" : function(c){
+ return this["nth-child"](c, "odd");
+ },
+
+ "even" : function(c){
+ return this["nth-child"](c, "even");
+ },
+
+ "nth" : function(c, a){
+ return c[a-1] || [];
+ },
+
+ "first" : function(c){
+ return c[0] || [];
+ },
+
+ "last" : function(c){
+ return c[c.length-1] || [];
+ },
+
+ "has" : function(c, ss){
+ var s = Ext.DomQuery.select,
+ r = [], ri = -1;
+ for(var i = 0, ci; ci = c[i]; i++){
+ if(s(ss, ci).length > 0){
+ r[++ri] = ci;
+ }
+ }
+ return r;
+ },
+
+ "next" : function(c, ss){
+ var is = Ext.DomQuery.is,
+ r = [], ri = -1;
+ for(var i = 0, ci; ci = c[i]; i++){
+ var n = next(ci);
+ if(n && is(n, ss)){
+ r[++ri] = ci;
+ }
+ }
+ return r;
+ },
+
+ "prev" : function(c, ss){
+ var is = Ext.DomQuery.is,
+ r = [], ri = -1;
+ for(var i = 0, ci; ci = c[i]; i++){
+ var n = prev(ci);
+ if(n && is(n, ss)){
+ r[++ri] = ci;
+ }
+ }
+ return r;
+ }
+ }
+ };
+}();
+
+
+Ext.query = Ext.DomQuery.select;
+
+
+ (function() {
+ var DOC = document,
+ EC = Ext.cache;
+
+ Ext.Element = Ext.core.Element = function(element, forceNew) {
+ var dom = typeof element == "string" ? DOC.getElementById(element) : element,
+ id;
+
+ if (!dom) {
+ return null;
+ }
+
+ id = dom.id;
+
+ if (!forceNew && id && EC[id]) {
+
+ return EC[id].el;
+ }
+
+
+ this.dom = dom;
+
+
+ this.id = id || Ext.id(dom);
+ };
+
+ var DH = Ext.DomHelper,
+ El = Ext.Element;
+
+
+ El.prototype = {
+
+ set: function(o, useSet) {
+ var el = this.dom,
+ attr,
+ val;
+ useSet = (useSet !== false) && !!el.setAttribute;
+
+ for (attr in o) {
+ if (o.hasOwnProperty(attr)) {
+ val = o[attr];
+ if (attr == 'style') {
+ DH.applyStyles(el, val);
+ } else if (attr == 'cls') {
+ el.className = val;
+ } else if (useSet) {
+ el.setAttribute(attr, val);
+ } else {
+ el[attr] = val;
+ }
+ }
+ }
+ return this;
+ },
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ defaultUnit: "px",
+
+
+ is: function(simpleSelector) {
+ return Ext.DomQuery.is(this.dom, simpleSelector);
+ },
+
+
+ focus: function(defer,
+
+ dom) {
+ var me = this;
+ dom = dom || me.dom;
+ try {
+ if (Number(defer)) {
+ Ext.defer(me.focus, defer, null, [null, dom]);
+ } else {
+ dom.focus();
+ }
+ } catch(e) {}
+ return me;
+ },
+
+
+ blur: function() {
+ try {
+ this.dom.blur();
+ } catch(e) {}
+ return this;
+ },
+
+
+ getValue: function(asNumber) {
+ var val = this.dom.value;
+ return asNumber ? parseInt(val, 10) : val;
+ },
+
+
+ addListener: function(eventName, fn, scope, options) {
+ Ext.EventManager.on(this.dom, eventName, fn, scope || this, options);
+ return this;
+ },
+
+
+ removeListener: function(eventName, fn, scope) {
+ Ext.EventManager.un(this.dom, eventName, fn, scope || this);
+ return this;
+ },
+
+
+ removeAllListeners: function() {
+ Ext.EventManager.removeAll(this.dom);
+ return this;
+ },
+
+
+ purgeAllListeners: function() {
+ Ext.EventManager.purgeElement(this);
+ return this;
+ },
+
+
+ addUnits: function(size, units) {
+
+
+ if (Ext.isNumber(size)) {
+ return size + (units || this.defaultUnit || 'px');
+ }
+
+
+ if (size === "" || size == "auto" || size == null) {
+ return size || '';
+ }
+
+
+ if (!unitPattern.test(size)) {
+ return size || '';
+ }
+ return size;
+ },
+
+
+ isBorderBox: function() {
+ return Ext.isBorderBox || noBoxAdjust[(this.dom.tagName || "").toLowerCase()];
+ },
+
+
+ remove: function() {
+ var me = this,
+ dom = me.dom;
+
+ if (dom) {
+ delete me.dom;
+ Ext.removeNode(dom);
+ }
+ },
+
+
+ hover: function(overFn, outFn, scope, options) {
+ var me = this;
+ me.on('mouseenter', overFn, scope || me.dom, options);
+ me.on('mouseleave', outFn, scope || me.dom, options);
+ return me;
+ },
+
+
+ contains: function(el) {
+ return ! el ? false: Ext.Element.isAncestor(this.dom, el.dom ? el.dom: el);
+ },
+
+
+ getAttributeNS: function(ns, name) {
+ return this.getAttribute(name, ns);
+ },
+
+
+ getAttribute: (Ext.isIE && !(Ext.isIE9 && document.documentMode === 9)) ?
+ function(name, ns) {
+ var d = this.dom,
+ type;
+ if(ns) {
+ type = typeof d[ns + ":" + name];
+ if (type != 'undefined' && type != 'unknown') {
+ return d[ns + ":" + name] || null;
+ }
+ return null;
+ }
+ if (name === "for") {
+ name = "htmlFor";
+ }
+ return d[name] || null;
+ }: function(name, ns) {
+ var d = this.dom;
+ if (ns) {
+ return d.getAttributeNS(ns, name) || d.getAttribute(ns + ":" + name);
+ }
+ return d.getAttribute(name) || d[name] || null;
+ },
+
+
+ update: function(html) {
+ if (this.dom) {
+ this.dom.innerHTML = html;
+ }
+ return this;
+ }
+ };
+
+ var ep = El.prototype;
+
+ El.addMethods = function(o) {
+ Ext.apply(ep, o);
+ };
+
+
+ ep.on = ep.addListener;
+
+
+ ep.un = ep.removeListener;
+
+
+ ep.clearListeners = ep.removeAllListeners;
+
+
+ ep.destroy = ep.remove;
+
+
+ ep.autoBoxAdjust = true;
+
+
+ var unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,
+ docEl;
+
+
+ El.get = function(el) {
+ var ex,
+ elm,
+ id;
+ if (!el) {
+ return null;
+ }
+ if (typeof el == "string") {
+
+ if (! (elm = DOC.getElementById(el))) {
+ return null;
+ }
+ if (EC[el] && EC[el].el) {
+ ex = EC[el].el;
+ ex.dom = elm;
+ } else {
+ ex = El.addToCache(new El(elm));
+ }
+ return ex;
+ } else if (el.tagName) {
+
+ if (! (id = el.id)) {
+ id = Ext.id(el);
+ }
+ if (EC[id] && EC[id].el) {
+ ex = EC[id].el;
+ ex.dom = el;
+ } else {
+ ex = El.addToCache(new El(el));
+ }
+ return ex;
+ } else if (el instanceof El) {
+ if (el != docEl) {
+
+
+
+ if (Ext.isIE && (el.id == undefined || el.id == '')) {
+ el.dom = el.dom;
+ } else {
+ el.dom = DOC.getElementById(el.id) || el.dom;
+ }
+ }
+ return el;
+ } else if (el.isComposite) {
+ return el;
+ } else if (Ext.isArray(el)) {
+ return El.select(el);
+ } else if (el == DOC) {
+
+ if (!docEl) {
+ var f = function() {};
+ f.prototype = El.prototype;
+ docEl = new f();
+ docEl.dom = DOC;
+ }
+ return docEl;
+ }
+ return null;
+ };
+
+
+ ep.getById = (!Ext.isIE6 && !Ext.isIE7 && !Ext.isIE8) ? El.get :
+ function (id) {
+ var dom = this.dom,
+ cached, el, ret;
+
+ if (dom) {
+ el = dom.all[id];
+ if (el) {
+
+
+ cached = EC[id];
+ if (cached && cached.el) {
+ ret = cached.el;
+ ret.dom = el;
+ } else {
+ ret = El.addToCache(new El(el));
+ }
+ return ret;
+ }
+ }
+
+ return El.get(id);
+ };
+
+ El.addToCache = function(el, id) {
+ if (el) {
+ id = id || el.id;
+ EC[id] = {
+ el: el,
+ data: {},
+ events: {}
+ };
+ }
+ return el;
+ };
+
+
+ El.data = function(el, key, value) {
+ el = El.get(el);
+ if (!el) {
+ return null;
+ }
+ var c = EC[el.id].data;
+ if (arguments.length == 2) {
+ return c[key];
+ } else {
+ return (c[key] = value);
+ }
+ };
+
+
+
+
+ function garbageCollect() {
+ if (!Ext.enableGarbageCollector) {
+ clearInterval(El.collectorThreadId);
+ } else {
+ var eid,
+ el,
+ d,
+ o;
+
+ for (eid in EC) {
+ if (!EC.hasOwnProperty(eid)) {
+ continue;
+ }
+ o = EC[eid];
+ if (o.skipGarbageCollection) {
+ continue;
+ }
+ el = o.el;
+ d = el.dom;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ if (!d || !d.parentNode || (!d.offsetParent && !DOC.getElementById(eid))) {
+ if (d && Ext.enableListenerCollection) {
+ Ext.EventManager.removeAll(d);
+ }
+ delete EC[eid];
+ }
+ }
+
+ if (Ext.isIE) {
+ var t = {};
+ for (eid in EC) {
+ if (!EC.hasOwnProperty(eid)) {
+ continue;
+ }
+ t[eid] = EC[eid];
+ }
+ EC = Ext.cache = t;
+ }
+ }
+ }
+ El.collectorThreadId = setInterval(garbageCollect, 30000);
+
+ var flyFn = function() {};
+ flyFn.prototype = El.prototype;
+
+
+ El.Flyweight = function(dom) {
+ this.dom = dom;
+ };
+
+ El.Flyweight.prototype = new flyFn();
+ El.Flyweight.prototype.isFlyweight = true;
+ El._flyweights = {};
+
+
+ El.fly = function(el, named) {
+ var ret = null;
+ named = named || '_global';
+ el = Ext.getDom(el);
+ if (el) {
+ (El._flyweights[named] = El._flyweights[named] || new El.Flyweight()).dom = el;
+ ret = El._flyweights[named];
+ }
+ return ret;
+ };
+
+
+ Ext.get = El.get;
+
+
+ Ext.fly = El.fly;
+
+
+ var noBoxAdjust = Ext.isStrict ? {
+ select: 1
+ }: {
+ input: 1,
+ select: 1,
+ textarea: 1
+ };
+ if (Ext.isIE || Ext.isGecko) {
+ noBoxAdjust['button'] = 1;
+ }
+})();
+
+
+Ext.Element.addMethods({
+
+ findParent : function(simpleSelector, maxDepth, returnEl) {
+ var p = this.dom,
+ b = document.body,
+ depth = 0,
+ stopEl;
+
+ maxDepth = maxDepth || 50;
+ if (isNaN(maxDepth)) {
+ stopEl = Ext.getDom(maxDepth);
+ maxDepth = Number.MAX_VALUE;
+ }
+ while (p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl) {
+ if (Ext.DomQuery.is(p, simpleSelector)) {
+ return returnEl ? Ext.get(p) : p;
+ }
+ depth++;
+ p = p.parentNode;
+ }
+ return null;
+ },
+
+
+ findParentNode : function(simpleSelector, maxDepth, returnEl) {
+ var p = Ext.fly(this.dom.parentNode, '_internal');
+ return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
+ },
+
+
+ up : function(simpleSelector, maxDepth) {
+ return this.findParentNode(simpleSelector, maxDepth, true);
+ },
+
+
+ select : function(selector) {
+ return Ext.Element.select(selector, false, this.dom);
+ },
+
+
+ query : function(selector) {
+ return Ext.DomQuery.select(selector, this.dom);
+ },
+
+
+ down : function(selector, returnDom) {
+ var n = Ext.DomQuery.selectNode(selector, this.dom);
+ return returnDom ? n : Ext.get(n);
+ },
+
+
+ child : function(selector, returnDom) {
+ var node,
+ me = this,
+ id;
+ id = Ext.get(me).id;
+
+ id = id.replace(/[\.:]/g, "\\$0");
+ node = Ext.DomQuery.selectNode('#' + id + " > " + selector, me.dom);
+ return returnDom ? node : Ext.get(node);
+ },
+
+
+ parent : function(selector, returnDom) {
+ return this.matchNode('parentNode', 'parentNode', selector, returnDom);
+ },
+
+
+ next : function(selector, returnDom) {
+ return this.matchNode('nextSibling', 'nextSibling', selector, returnDom);
+ },
+
+
+ prev : function(selector, returnDom) {
+ return this.matchNode('previousSibling', 'previousSibling', selector, returnDom);
+ },
+
+
+
+ first : function(selector, returnDom) {
+ return this.matchNode('nextSibling', 'firstChild', selector, returnDom);
+ },
+
+
+ last : function(selector, returnDom) {
+ return this.matchNode('previousSibling', 'lastChild', selector, returnDom);
+ },
+
+ matchNode : function(dir, start, selector, returnDom) {
+ if (!this.dom) {
+ return null;
+ }
+
+ var n = this.dom[start];
+ while (n) {
+ if (n.nodeType == 1 && (!selector || Ext.DomQuery.is(n, selector))) {
+ return !returnDom ? Ext.get(n) : n;
+ }
+ n = n[dir];
+ }
+ return null;
+ }
+});
+
+
+Ext.Element.addMethods({
+
+ appendChild : function(el) {
+ return Ext.get(el).appendTo(this);
+ },
+
+
+ appendTo : function(el) {
+ Ext.getDom(el).appendChild(this.dom);
+ return this;
+ },
+
+
+ insertBefore : function(el) {
+ el = Ext.getDom(el);
+ el.parentNode.insertBefore(this.dom, el);
+ return this;
+ },
+
+
+ insertAfter : function(el) {
+ el = Ext.getDom(el);
+ el.parentNode.insertBefore(this.dom, el.nextSibling);
+ return this;
+ },
+
+
+ insertFirst : function(el, returnDom) {
+ el = el || {};
+ if (el.nodeType || el.dom || typeof el == 'string') {
+ el = Ext.getDom(el);
+ this.dom.insertBefore(el, this.dom.firstChild);
+ return !returnDom ? Ext.get(el) : el;
+ }
+ else {
+ return this.createChild(el, this.dom.firstChild, returnDom);
+ }
+ },
+
+
+ insertSibling: function(el, where, returnDom){
+ var me = this, rt,
+ isAfter = (where || 'before').toLowerCase() == 'after',
+ insertEl;
+
+ if(Ext.isArray(el)){
+ insertEl = me;
+ Ext.each(el, function(e) {
+ rt = Ext.fly(insertEl, '_internal').insertSibling(e, where, returnDom);
+ if(isAfter){
+ insertEl = rt;
+ }
+ });
+ return rt;
+ }
+
+ el = el || {};
+
+ if(el.nodeType || el.dom){
+ rt = me.dom.parentNode.insertBefore(Ext.getDom(el), isAfter ? me.dom.nextSibling : me.dom);
+ if (!returnDom) {
+ rt = Ext.get(rt);
+ }
+ }else{
+ if (isAfter && !me.dom.nextSibling) {
+ rt = Ext.DomHelper.append(me.dom.parentNode, el, !returnDom);
+ } else {
+ rt = Ext.DomHelper[isAfter ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);
+ }
+ }
+ return rt;
+ },
+
+
+ replace : function(el) {
+ el = Ext.get(el);
+ this.insertBefore(el);
+ el.remove();
+ return this;
+ },
+
+
+ replaceWith: function(el){
+ var me = this;
+
+ if(el.nodeType || el.dom || typeof el == 'string'){
+ el = Ext.get(el);
+ me.dom.parentNode.insertBefore(el, me.dom);
+ }else{
+ el = Ext.DomHelper.insertBefore(me.dom, el);
+ }
+
+ delete Ext.cache[me.id];
+ Ext.removeNode(me.dom);
+ me.id = Ext.id(me.dom = el);
+ Ext.Element.addToCache(me.isFlyweight ? new Ext.Element(me.dom) : me);
+ return me;
+ },
+
+
+ createChild : function(config, insertBefore, returnDom) {
+ config = config || {tag:'div'};
+ if (insertBefore) {
+ return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
+ }
+ else {
+ return Ext.DomHelper[!this.dom.firstChild ? 'insertFirst' : 'append'](this.dom, config, returnDom !== true);
+ }
+ },
+
+
+ wrap : function(config, returnDom) {
+ var newEl = Ext.DomHelper.insertBefore(this.dom, config || {tag: "div"}, !returnDom),
+ d = newEl.dom || newEl;
+
+ d.appendChild(this.dom);
+ return newEl;
+ },
+
+
+ insertHtml : function(where, html, returnEl) {
+ var el = Ext.DomHelper.insertHtml(where, this.dom, html);
+ return returnEl ? Ext.get(el) : el;
+ }
+});
+
+
+(function(){
+
+ var ELEMENT = Ext.Element,
+ supports = Ext.supports,
+ view = document.defaultView,
+ opacityRe = /alpha\(opacity=(.*)\)/i,
+ trimRe = /^\s+|\s+$/g,
+ spacesRe = /\s+/,
+ wordsRe = /\w/g,
+ adjustDirect2DTableRe = /table-row|table-.*-group/,
+ INTERNAL = '_internal',
+ PADDING = 'padding',
+ MARGIN = 'margin',
+ BORDER = 'border',
+ LEFT = '-left',
+ RIGHT = '-right',
+ TOP = '-top',
+ BOTTOM = '-bottom',
+ WIDTH = '-width',
+ MATH = Math,
+ HIDDEN = 'hidden',
+ ISCLIPPED = 'isClipped',
+ OVERFLOW = 'overflow',
+ OVERFLOWX = 'overflow-x',
+ OVERFLOWY = 'overflow-y',
+ ORIGINALCLIP = 'originalClip',
+
+ borders = {l: BORDER + LEFT + WIDTH, r: BORDER + RIGHT + WIDTH, t: BORDER + TOP + WIDTH, b: BORDER + BOTTOM + WIDTH},
+ paddings = {l: PADDING + LEFT, r: PADDING + RIGHT, t: PADDING + TOP, b: PADDING + BOTTOM},
+ margins = {l: MARGIN + LEFT, r: MARGIN + RIGHT, t: MARGIN + TOP, b: MARGIN + BOTTOM},
+ data = ELEMENT.data;
+
+ ELEMENT.boxMarkup = '';
+
+
+
+ ELEMENT.inheritedProps = {
+ fontSize: 1,
+ fontStyle: 1,
+ opacity: 1
+ };
+
+ Ext.override(ELEMENT, {
+
+
+
+ adjustWidth : function(width) {
+ var me = this,
+ isNum = (typeof width == 'number');
+
+ if(isNum && me.autoBoxAdjust && !me.isBorderBox()){
+ width -= (me.getBorderWidth("lr") + me.getPadding("lr"));
+ }
+ return (isNum && width < 0) ? 0 : width;
+ },
+
+
+ adjustHeight : function(height) {
+ var me = this,
+ isNum = (typeof height == "number");
+
+ if(isNum && me.autoBoxAdjust && !me.isBorderBox()){
+ height -= (me.getBorderWidth("tb") + me.getPadding("tb"));
+ }
+ return (isNum && height < 0) ? 0 : height;
+ },
+
+
+
+ addCls : function(className){
+ var me = this,
+ cls = [],
+ space = ((me.dom.className.replace(trimRe, '') == '') ? "" : " "),
+ i, len, v;
+ if (className === undefined) {
+ return me;
+ }
+
+ if (Object.prototype.toString.call(className) !== '[object Array]') {
+ if (typeof className === 'string') {
+ className = className.replace(trimRe, '').split(spacesRe);
+ if (className.length === 1) {
+ className = className[0];
+ if (!me.hasCls(className)) {
+ me.dom.className += space + className;
+ }
+ } else {
+ this.addCls(className);
+ }
+ }
+ } else {
+ for (i = 0, len = className.length; i < len; i++) {
+ v = className[i];
+ if (typeof v == 'string' && (' ' + me.dom.className + ' ').indexOf(' ' + v + ' ') == -1) {
+ cls.push(v);
+ }
+ }
+ if (cls.length) {
+ me.dom.className += space + cls.join(" ");
+ }
+ }
+ return me;
+ },
+
+
+ removeCls : function(className){
+ var me = this,
+ i, idx, len, cls, elClasses;
+ if (className === undefined) {
+ return me;
+ }
+ if (Object.prototype.toString.call(className) !== '[object Array]') {
+ className = className.replace(trimRe, '').split(spacesRe);
+ }
+ if (me.dom && me.dom.className) {
+ elClasses = me.dom.className.replace(trimRe, '').split(spacesRe);
+ for (i = 0, len = className.length; i < len; i++) {
+ cls = className[i];
+ if (typeof cls == 'string') {
+ cls = cls.replace(trimRe, '');
+ idx = Ext.Array.indexOf(elClasses, cls);
+ if (idx != -1) {
+ Ext.Array.erase(elClasses, idx, 1);
+ }
+ }
+ }
+ me.dom.className = elClasses.join(" ");
+ }
+ return me;
+ },
+
+
+ radioCls : function(className){
+ var cn = this.dom.parentNode.childNodes,
+ v, i, len;
+ className = Ext.isArray(className) ? className : [className];
+ for (i = 0, len = cn.length; i < len; i++) {
+ v = cn[i];
+ if (v && v.nodeType == 1) {
+ Ext.fly(v, '_internal').removeCls(className);
+ }
+ }
+ return this.addCls(className);
+ },
+
+
+ toggleCls : Ext.supports.ClassList ?
+ function(className) {
+ this.dom.classList.toggle(Ext.String.trim(className));
+ return this;
+ } :
+ function(className) {
+ return this.hasCls(className) ? this.removeCls(className) : this.addCls(className);
+ },
+
+
+ hasCls : Ext.supports.ClassList ?
+ function(className) {
+ if (!className) {
+ return false;
+ }
+ className = className.split(spacesRe);
+ var ln = className.length,
+ i = 0;
+ for (; i < ln; i++) {
+ if (className[i] && this.dom.classList.contains(className[i])) {
+ return true;
+ }
+ }
+ return false;
+ } :
+ function(className){
+ return className && (' ' + this.dom.className + ' ').indexOf(' ' + className + ' ') != -1;
+ },
+
+
+ replaceCls : function(oldClassName, newClassName){
+ return this.removeCls(oldClassName).addCls(newClassName);
+ },
+
+ isStyle : function(style, val) {
+ return this.getStyle(style) == val;
+ },
+
+
+ getStyle : function() {
+ return view && view.getComputedStyle ?
+ function(prop){
+ var el = this.dom,
+ v, cs, out, display, cleaner;
+
+ if(el == document){
+ return null;
+ }
+ prop = ELEMENT.normalize(prop);
+ out = (v = el.style[prop]) ? v :
+ (cs = view.getComputedStyle(el, "")) ? cs[prop] : null;
+
+
+
+ if(prop == 'marginRight' && out != '0px' && !supports.RightMargin){
+ cleaner = ELEMENT.getRightMarginFixCleaner(el);
+ display = this.getStyle('display');
+ el.style.display = 'inline-block';
+ out = view.getComputedStyle(el, '').marginRight;
+ el.style.display = display;
+ cleaner();
+ }
+
+ if(prop == 'backgroundColor' && out == 'rgba(0, 0, 0, 0)' && !supports.TransparentColor){
+ out = 'transparent';
+ }
+ return out;
+ } :
+ function (prop) {
+ var el = this.dom,
+ m, cs;
+
+ if (el == document) {
+ return null;
+ }
+ prop = ELEMENT.normalize(prop);
+
+ do {
+ if (prop == 'opacity') {
+ if (el.style.filter.match) {
+ m = el.style.filter.match(opacityRe);
+ if(m){
+ var fv = parseFloat(m[1]);
+ if(!isNaN(fv)){
+ return fv ? fv / 100 : 0;
+ }
+ }
+ }
+ return 1;
+ }
+
+
+
+ if (!Ext.isIE6) {
+ return el.style[prop] || ((cs = el.currentStyle) ? cs[prop] : null);
+ }
+
+ try {
+ return el.style[prop] || ((cs = el.currentStyle) ? cs[prop] : null);
+ } catch (e) {
+
+
+ }
+
+ if (!ELEMENT.inheritedProps[prop]) {
+ break;
+ }
+
+ el = el.parentNode;
+
+
+
+ } while (el);
+
+ return null;
+ }
+ }(),
+
+
+ getColor : function(attr, defaultValue, prefix){
+ var v = this.getStyle(attr),
+ color = prefix || prefix === '' ? prefix : '#',
+ h;
+
+ if(!v || (/transparent|inherit/.test(v))) {
+ return defaultValue;
+ }
+ if(/^r/.test(v)){
+ Ext.each(v.slice(4, v.length -1).split(','), function(s){
+ h = parseInt(s, 10);
+ color += (h < 16 ? '0' : '') + h.toString(16);
+ });
+ }else{
+ v = v.replace('#', '');
+ color += v.length == 3 ? v.replace(/^(\w)(\w)(\w)$/, '$1$1$2$2$3$3') : v;
+ }
+ return(color.length > 5 ? color.toLowerCase() : defaultValue);
+ },
+
+
+ setStyle : function(prop, value){
+ var me = this,
+ tmp, style;
+
+ if (!me.dom) {
+ return me;
+ }
+ if (typeof prop === 'string') {
+ tmp = {};
+ tmp[prop] = value;
+ prop = tmp;
+ }
+ for (style in prop) {
+ if (prop.hasOwnProperty(style)) {
+ value = Ext.value(prop[style], '');
+ if (style == 'opacity') {
+ me.setOpacity(value);
+ }
+ else {
+ me.dom.style[ELEMENT.normalize(style)] = value;
+ }
+ }
+ }
+ return me;
+ },
+
+
+ setOpacity: function(opacity, animate) {
+ var me = this,
+ dom = me.dom,
+ val,
+ style;
+
+ if (!me.dom) {
+ return me;
+ }
+
+ style = me.dom.style;
+
+ if (!animate || !me.anim) {
+ if (!Ext.supports.Opacity) {
+ opacity = opacity < 1 ? 'alpha(opacity=' + opacity * 100 + ')': '';
+ val = style.filter.replace(opacityRe, '').replace(trimRe, '');
+
+ style.zoom = 1;
+ style.filter = val + (val.length > 0 ? ' ': '') + opacity;
+ }
+ else {
+ style.opacity = opacity;
+ }
+ }
+ else {
+ if (!Ext.isObject(animate)) {
+ animate = {
+ duration: 350,
+ easing: 'ease-in'
+ };
+ }
+ me.animate(Ext.applyIf({
+ to: {
+ opacity: opacity
+ }
+ },
+ animate));
+ }
+ return me;
+ },
+
+
+
+ clearOpacity : function(){
+ var style = this.dom.style;
+ if(!Ext.supports.Opacity){
+ if(!Ext.isEmpty(style.filter)){
+ style.filter = style.filter.replace(opacityRe, '').replace(trimRe, '');
+ }
+ }else{
+ style.opacity = style['-moz-opacity'] = style['-khtml-opacity'] = '';
+ }
+ return this;
+ },
+
+
+ adjustDirect2DDimension: function(dimension) {
+ var me = this,
+ dom = me.dom,
+ display = me.getStyle('display'),
+ inlineDisplay = dom.style['display'],
+ inlinePosition = dom.style['position'],
+ originIndex = dimension === 'width' ? 0 : 1,
+ floating;
+
+ if (display === 'inline') {
+ dom.style['display'] = 'inline-block';
+ }
+
+ dom.style['position'] = display.match(adjustDirect2DTableRe) ? 'absolute' : 'static';
+
+
+
+ floating = (parseFloat(me.getStyle(dimension)) || parseFloat(dom.currentStyle.msTransformOrigin.split(' ')[originIndex]) * 2) % 1;
+
+ dom.style['position'] = inlinePosition;
+
+ if (display === 'inline') {
+ dom.style['display'] = inlineDisplay;
+ }
+
+ return floating;
+ },
+
+
+ getHeight: function(contentHeight, preciseHeight) {
+ var me = this,
+ dom = me.dom,
+ hidden = Ext.isIE && me.isStyle('display', 'none'),
+ height, overflow, style, floating;
+
+
+
+ if (Ext.isIEQuirks) {
+ style = dom.style;
+ overflow = style.overflow;
+ me.setStyle({ overflow: 'hidden'});
+ }
+
+ height = dom.offsetHeight;
+
+ height = MATH.max(height, hidden ? 0 : dom.clientHeight) || 0;
+
+
+ if (!hidden && Ext.supports.Direct2DBug) {
+ floating = me.adjustDirect2DDimension('height');
+ if (preciseHeight) {
+ height += floating;
+ }
+ else if (floating > 0 && floating < 0.5) {
+ height++;
+ }
+ }
+
+ if (contentHeight) {
+ height -= (me.getBorderWidth("tb") + me.getPadding("tb"));
+ }
+
+ if (Ext.isIEQuirks) {
+ me.setStyle({ overflow: overflow});
+ }
+
+ if (height < 0) {
+ height = 0;
+ }
+ return height;
+ },
+
+
+ getWidth: function(contentWidth, preciseWidth) {
+ var me = this,
+ dom = me.dom,
+ hidden = Ext.isIE && me.isStyle('display', 'none'),
+ rect, width, overflow, style, floating, parentPosition;
+
+
+
+ if (Ext.isIEQuirks) {
+ style = dom.style;
+ overflow = style.overflow;
+ me.setStyle({overflow: 'hidden'});
+ }
+
+
+ if (Ext.isOpera10_5) {
+ if (dom.parentNode.currentStyle.position === 'relative') {
+ parentPosition = dom.parentNode.style.position;
+ dom.parentNode.style.position = 'static';
+ width = dom.offsetWidth;
+ dom.parentNode.style.position = parentPosition;
+ }
+ width = Math.max(width || 0, dom.offsetWidth);
+
+
+
+
+
+
+ } else if (Ext.supports.BoundingClientRect) {
+ rect = dom.getBoundingClientRect();
+ width = rect.right - rect.left;
+ width = preciseWidth ? width : Math.ceil(width);
+ } else {
+ width = dom.offsetWidth;
+ }
+
+ width = MATH.max(width, hidden ? 0 : dom.clientWidth) || 0;
+
+
+ if (!hidden && Ext.supports.Direct2DBug) {
+ floating = me.adjustDirect2DDimension('width');
+ if (preciseWidth) {
+ width += floating;
+ }
+ else if (floating > 0 && floating < 0.5) {
+ width++;
+ }
+ }
+
+ if (contentWidth) {
+ width -= (me.getBorderWidth("lr") + me.getPadding("lr"));
+ }
+
+ if (Ext.isIEQuirks) {
+ me.setStyle({ overflow: overflow});
+ }
+
+ if (width < 0) {
+ width = 0;
+ }
+ return width;
+ },
+
+
+ setWidth : function(width, animate){
+ var me = this;
+ width = me.adjustWidth(width);
+ if (!animate || !me.anim) {
+ me.dom.style.width = me.addUnits(width);
+ }
+ else {
+ if (!Ext.isObject(animate)) {
+ animate = {};
+ }
+ me.animate(Ext.applyIf({
+ to: {
+ width: width
+ }
+ }, animate));
+ }
+ return me;
+ },
+
+
+ setHeight : function(height, animate){
+ var me = this;
+ height = me.adjustHeight(height);
+ if (!animate || !me.anim) {
+ me.dom.style.height = me.addUnits(height);
+ }
+ else {
+ if (!Ext.isObject(animate)) {
+ animate = {};
+ }
+ me.animate(Ext.applyIf({
+ to: {
+ height: height
+ }
+ }, animate));
+ }
+ return me;
+ },
+
+
+ getBorderWidth : function(side){
+ return this.addStyles(side, borders);
+ },
+
+
+ getPadding : function(side){
+ return this.addStyles(side, paddings);
+ },
+
+
+ clip : function(){
+ var me = this,
+ dom = me.dom;
+
+ if(!data(dom, ISCLIPPED)){
+ data(dom, ISCLIPPED, true);
+ data(dom, ORIGINALCLIP, {
+ o: me.getStyle(OVERFLOW),
+ x: me.getStyle(OVERFLOWX),
+ y: me.getStyle(OVERFLOWY)
+ });
+ me.setStyle(OVERFLOW, HIDDEN);
+ me.setStyle(OVERFLOWX, HIDDEN);
+ me.setStyle(OVERFLOWY, HIDDEN);
+ }
+ return me;
+ },
+
+
+ unclip : function(){
+ var me = this,
+ dom = me.dom,
+ clip;
+
+ if(data(dom, ISCLIPPED)){
+ data(dom, ISCLIPPED, false);
+ clip = data(dom, ORIGINALCLIP);
+ if(clip.o){
+ me.setStyle(OVERFLOW, clip.o);
+ }
+ if(clip.x){
+ me.setStyle(OVERFLOWX, clip.x);
+ }
+ if(clip.y){
+ me.setStyle(OVERFLOWY, clip.y);
+ }
+ }
+ return me;
+ },
+
+
+ addStyles : function(sides, styles){
+ var totalSize = 0,
+ sidesArr = sides.match(wordsRe),
+ i = 0,
+ len = sidesArr.length,
+ side, size;
+ for (; i < len; i++) {
+ side = sidesArr[i];
+ size = side && parseInt(this.getStyle(styles[side]), 10);
+ if (size) {
+ totalSize += MATH.abs(size);
+ }
+ }
+ return totalSize;
+ },
+
+ margins : margins,
+
+
+ applyStyles : function(style){
+ Ext.DomHelper.applyStyles(this.dom, style);
+ return this;
+ },
+
+
+ getStyles : function(){
+ var styles = {},
+ len = arguments.length,
+ i = 0, style;
+
+ for(; i < len; ++i) {
+ style = arguments[i];
+ styles[style] = this.getStyle(style);
+ }
+ return styles;
+ },
+
+
+ boxWrap : function(cls){
+ cls = cls || Ext.baseCSSPrefix + 'box';
+ var el = Ext.get(this.insertHtml("beforeBegin", "" + Ext.String.format(ELEMENT.boxMarkup, cls) + "
"));
+ Ext.DomQuery.selectNode('.' + cls + '-mc', el.dom).appendChild(this.dom);
+ return el;
+ },
+
+
+ setSize : function(width, height, animate){
+ var me = this;
+ if (Ext.isObject(width)) {
+ animate = height;
+ height = width.height;
+ width = width.width;
+ }
+ width = me.adjustWidth(width);
+ height = me.adjustHeight(height);
+ if(!animate || !me.anim){
+
+
+ if (!Ext.isIEQuirks && (Ext.isIE6 || Ext.isIE7)) {
+ me.dom.offsetTop;
+ }
+ me.dom.style.width = me.addUnits(width);
+ me.dom.style.height = me.addUnits(height);
+ }
+ else {
+ if (animate === true) {
+ animate = {};
+ }
+ me.animate(Ext.applyIf({
+ to: {
+ width: width,
+ height: height
+ }
+ }, animate));
+ }
+ return me;
+ },
+
+
+ getComputedHeight : function(){
+ var me = this,
+ h = Math.max(me.dom.offsetHeight, me.dom.clientHeight);
+ if(!h){
+ h = parseFloat(me.getStyle('height')) || 0;
+ if(!me.isBorderBox()){
+ h += me.getFrameWidth('tb');
+ }
+ }
+ return h;
+ },
+
+
+ getComputedWidth : function(){
+ var me = this,
+ w = Math.max(me.dom.offsetWidth, me.dom.clientWidth);
+
+ if(!w){
+ w = parseFloat(me.getStyle('width')) || 0;
+ if(!me.isBorderBox()){
+ w += me.getFrameWidth('lr');
+ }
+ }
+ return w;
+ },
+
+
+ getFrameWidth : function(sides, onlyContentBox){
+ return onlyContentBox && this.isBorderBox() ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));
+ },
+
+
+ addClsOnOver : function(className){
+ var dom = this.dom;
+ this.hover(
+ function(){
+ Ext.fly(dom, INTERNAL).addCls(className);
+ },
+ function(){
+ Ext.fly(dom, INTERNAL).removeCls(className);
+ }
+ );
+ return this;
+ },
+
+
+ addClsOnFocus : function(className){
+ var me = this,
+ dom = me.dom;
+ me.on("focus", function(){
+ Ext.fly(dom, INTERNAL).addCls(className);
+ });
+ me.on("blur", function(){
+ Ext.fly(dom, INTERNAL).removeCls(className);
+ });
+ return me;
+ },
+
+
+ addClsOnClick : function(className){
+ var dom = this.dom;
+ this.on("mousedown", function(){
+ Ext.fly(dom, INTERNAL).addCls(className);
+ var d = Ext.getDoc(),
+ fn = function(){
+ Ext.fly(dom, INTERNAL).removeCls(className);
+ d.removeListener("mouseup", fn);
+ };
+ d.on("mouseup", fn);
+ });
+ return this;
+ },
+
+
+
+ getViewSize : function(){
+ var me = this,
+ dom = me.dom,
+ isDoc = (dom == Ext.getDoc().dom || dom == Ext.getBody().dom),
+ style, overflow, ret;
+
+
+ if (isDoc) {
+ ret = {
+ width : ELEMENT.getViewWidth(),
+ height : ELEMENT.getViewHeight()
+ };
+
+
+ }
+ else {
+
+
+ if (Ext.isIE6 || Ext.isIEQuirks) {
+ style = dom.style;
+ overflow = style.overflow;
+ me.setStyle({ overflow: 'hidden'});
+ }
+ ret = {
+ width : dom.clientWidth,
+ height : dom.clientHeight
+ };
+ if (Ext.isIE6 || Ext.isIEQuirks) {
+ me.setStyle({ overflow: overflow });
+ }
+ }
+ return ret;
+ },
+
+
+
+ getStyleSize : function(){
+ var me = this,
+ doc = document,
+ d = this.dom,
+ isDoc = (d == doc || d == doc.body),
+ s = d.style,
+ w, h;
+
+
+ if (isDoc) {
+ return {
+ width : ELEMENT.getViewWidth(),
+ height : ELEMENT.getViewHeight()
+ };
+ }
+
+ if(s.width && s.width != 'auto'){
+ w = parseFloat(s.width);
+ if(me.isBorderBox()){
+ w -= me.getFrameWidth('lr');
+ }
+ }
+
+ if(s.height && s.height != 'auto'){
+ h = parseFloat(s.height);
+ if(me.isBorderBox()){
+ h -= me.getFrameWidth('tb');
+ }
+ }
+
+ return {width: w || me.getWidth(true), height: h || me.getHeight(true)};
+ },
+
+
+ getSize : function(contentSize){
+ return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};
+ },
+
+
+ repaint : function(){
+ var dom = this.dom;
+ this.addCls(Ext.baseCSSPrefix + 'repaint');
+ setTimeout(function(){
+ Ext.fly(dom).removeCls(Ext.baseCSSPrefix + 'repaint');
+ }, 1);
+ return this;
+ },
+
+
+ selectable : function() {
+ var me = this;
+ me.dom.unselectable = "off";
+
+ me.on('selectstart', function (e) {
+ e.stopPropagation();
+ return true;
+ });
+ me.applyStyles("-moz-user-select: text; -khtml-user-select: text;");
+ me.removeCls(Ext.baseCSSPrefix + 'unselectable');
+ return me;
+ },
+
+
+ unselectable : function(){
+ var me = this;
+ me.dom.unselectable = "on";
+
+ me.swallowEvent("selectstart", true);
+ me.applyStyles("-moz-user-select:-moz-none;-khtml-user-select:none;");
+ me.addCls(Ext.baseCSSPrefix + 'unselectable');
+
+ return me;
+ },
+
+
+ getMargin : function(side){
+ var me = this,
+ hash = {t:"top", l:"left", r:"right", b: "bottom"},
+ o = {},
+ key;
+
+ if (!side) {
+ for (key in me.margins){
+ o[hash[key]] = parseFloat(me.getStyle(me.margins[key])) || 0;
+ }
+ return o;
+ } else {
+ return me.addStyles.call(me, side, me.margins);
+ }
+ }
+ });
+})();
+
+
+Ext.Element.VISIBILITY = 1;
+
+Ext.Element.DISPLAY = 2;
+
+
+Ext.Element.OFFSETS = 3;
+
+
+Ext.Element.ASCLASS = 4;
+
+
+Ext.Element.visibilityCls = Ext.baseCSSPrefix + 'hide-nosize';
+
+Ext.Element.addMethods(function(){
+ var El = Ext.Element,
+ OPACITY = "opacity",
+ VISIBILITY = "visibility",
+ DISPLAY = "display",
+ HIDDEN = "hidden",
+ OFFSETS = "offsets",
+ ASCLASS = "asclass",
+ NONE = "none",
+ NOSIZE = 'nosize',
+ ORIGINALDISPLAY = 'originalDisplay',
+ VISMODE = 'visibilityMode',
+ ISVISIBLE = 'isVisible',
+ data = El.data,
+ getDisplay = function(dom){
+ var d = data(dom, ORIGINALDISPLAY);
+ if(d === undefined){
+ data(dom, ORIGINALDISPLAY, d = '');
+ }
+ return d;
+ },
+ getVisMode = function(dom){
+ var m = data(dom, VISMODE);
+ if(m === undefined){
+ data(dom, VISMODE, m = 1);
+ }
+ return m;
+ };
+
+ return {
+
+ originalDisplay : "",
+ visibilityMode : 1,
+
+
+ setVisibilityMode : function(visMode){
+ data(this.dom, VISMODE, visMode);
+ return this;
+ },
+
+
+ isVisible : function() {
+ var me = this,
+ dom = me.dom,
+ visible = data(dom, ISVISIBLE);
+
+ if(typeof visible == 'boolean'){
+ return visible;
+ }
+
+ visible = !me.isStyle(VISIBILITY, HIDDEN) &&
+ !me.isStyle(DISPLAY, NONE) &&
+ !((getVisMode(dom) == El.ASCLASS) && me.hasCls(me.visibilityCls || El.visibilityCls));
+
+ data(dom, ISVISIBLE, visible);
+ return visible;
+ },
+
+
+ setVisible : function(visible, animate){
+ var me = this, isDisplay, isVisibility, isOffsets, isNosize,
+ dom = me.dom,
+ visMode = getVisMode(dom);
+
+
+
+ if (typeof animate == 'string'){
+ switch (animate) {
+ case DISPLAY:
+ visMode = El.DISPLAY;
+ break;
+ case VISIBILITY:
+ visMode = El.VISIBILITY;
+ break;
+ case OFFSETS:
+ visMode = El.OFFSETS;
+ break;
+ case NOSIZE:
+ case ASCLASS:
+ visMode = El.ASCLASS;
+ break;
+ }
+ me.setVisibilityMode(visMode);
+ animate = false;
+ }
+
+ if (!animate || !me.anim) {
+ if(visMode == El.ASCLASS ){
+
+ me[visible?'removeCls':'addCls'](me.visibilityCls || El.visibilityCls);
+
+ } else if (visMode == El.DISPLAY){
+
+ return me.setDisplayed(visible);
+
+ } else if (visMode == El.OFFSETS){
+
+ if (!visible){
+
+ if (!me.hideModeStyles) {
+ me.hideModeStyles = {
+ position: me.getStyle('position'),
+ top: me.getStyle('top'),
+ left: me.getStyle('left')
+ };
+ }
+ me.applyStyles({position: 'absolute', top: '-10000px', left: '-10000px'});
+ }
+
+
+
+ else if (me.hideModeStyles) {
+ me.applyStyles(me.hideModeStyles || {position: '', top: '', left: ''});
+ delete me.hideModeStyles;
+ }
+
+ }else{
+ me.fixDisplay();
+
+ dom.style.visibility = visible ? '' : HIDDEN;
+ }
+ }else{
+
+ if(visible){
+ me.setOpacity(0.01);
+ me.setVisible(true);
+ }
+ if (!Ext.isObject(animate)) {
+ animate = {
+ duration: 350,
+ easing: 'ease-in'
+ };
+ }
+ me.animate(Ext.applyIf({
+ callback: function() {
+ visible || me.setVisible(false).setOpacity(1);
+ },
+ to: {
+ opacity: (visible) ? 1 : 0
+ }
+ }, animate));
+ }
+ data(dom, ISVISIBLE, visible);
+ return me;
+ },
+
+
+
+ hasMetrics : function(){
+ var dom = this.dom;
+ return this.isVisible() || (getVisMode(dom) == El.OFFSETS) || (getVisMode(dom) == El.VISIBILITY);
+ },
+
+
+ toggle : function(animate){
+ var me = this;
+ me.setVisible(!me.isVisible(), me.anim(animate));
+ return me;
+ },
+
+
+ setDisplayed : function(value) {
+ if(typeof value == "boolean"){
+ value = value ? getDisplay(this.dom) : NONE;
+ }
+ this.setStyle(DISPLAY, value);
+ return this;
+ },
+
+
+ fixDisplay : function(){
+ var me = this;
+ if (me.isStyle(DISPLAY, NONE)) {
+ me.setStyle(VISIBILITY, HIDDEN);
+ me.setStyle(DISPLAY, getDisplay(this.dom));
+ if (me.isStyle(DISPLAY, NONE)) {
+ me.setStyle(DISPLAY, "block");
+ }
+ }
+ },
+
+
+ hide : function(animate){
+
+ if (typeof animate == 'string'){
+ this.setVisible(false, animate);
+ return this;
+ }
+ this.setVisible(false, this.anim(animate));
+ return this;
+ },
+
+
+ show : function(animate){
+
+ if (typeof animate == 'string'){
+ this.setVisible(true, animate);
+ return this;
+ }
+ this.setVisible(true, this.anim(animate));
+ return this;
+ }
+ };
+}());
+
+Ext.applyIf(Ext.Element.prototype, {
+
+ animate: function(config) {
+ var me = this;
+ if (!me.id) {
+ me = Ext.get(me.dom);
+ }
+ if (Ext.fx.Manager.hasFxBlock(me.id)) {
+ return me;
+ }
+ Ext.fx.Manager.queueFx(Ext.create('Ext.fx.Anim', me.anim(config)));
+ return this;
+ },
+
+
+ anim: function(config) {
+ if (!Ext.isObject(config)) {
+ return (config) ? {} : false;
+ }
+
+ var me = this,
+ duration = config.duration || Ext.fx.Anim.prototype.duration,
+ easing = config.easing || 'ease',
+ animConfig;
+
+ if (config.stopAnimation) {
+ me.stopAnimation();
+ }
+
+ Ext.applyIf(config, Ext.fx.Manager.getFxDefaults(me.id));
+
+
+ Ext.fx.Manager.setFxDefaults(me.id, {
+ delay: 0
+ });
+
+ animConfig = {
+ target: me,
+ remove: config.remove,
+ alternate: config.alternate || false,
+ duration: duration,
+ easing: easing,
+ callback: config.callback,
+ listeners: config.listeners,
+ iterations: config.iterations || 1,
+ scope: config.scope,
+ block: config.block,
+ concurrent: config.concurrent,
+ delay: config.delay || 0,
+ paused: true,
+ keyframes: config.keyframes,
+ from: config.from || {},
+ to: Ext.apply({}, config)
+ };
+ Ext.apply(animConfig.to, config.to);
+
+
+ delete animConfig.to.to;
+ delete animConfig.to.from;
+ delete animConfig.to.remove;
+ delete animConfig.to.alternate;
+ delete animConfig.to.keyframes;
+ delete animConfig.to.iterations;
+ delete animConfig.to.listeners;
+ delete animConfig.to.target;
+ delete animConfig.to.paused;
+ delete animConfig.to.callback;
+ delete animConfig.to.scope;
+ delete animConfig.to.duration;
+ delete animConfig.to.easing;
+ delete animConfig.to.concurrent;
+ delete animConfig.to.block;
+ delete animConfig.to.stopAnimation;
+ delete animConfig.to.delay;
+ return animConfig;
+ },
+
+
+ slideIn: function(anchor, obj, slideOut) {
+ var me = this,
+ elStyle = me.dom.style,
+ beforeAnim, wrapAnim;
+
+ anchor = anchor || "t";
+ obj = obj || {};
+
+ beforeAnim = function() {
+ var animScope = this,
+ listeners = obj.listeners,
+ box, position, restoreSize, wrap, anim;
+
+ if (!slideOut) {
+ me.fixDisplay();
+ }
+
+ box = me.getBox();
+ if ((anchor == 't' || anchor == 'b') && box.height === 0) {
+ box.height = me.dom.scrollHeight;
+ }
+ else if ((anchor == 'l' || anchor == 'r') && box.width === 0) {
+ box.width = me.dom.scrollWidth;
+ }
+
+ position = me.getPositioning();
+ me.setSize(box.width, box.height);
+
+ wrap = me.wrap({
+ style: {
+ visibility: slideOut ? 'visible' : 'hidden'
+ }
+ });
+ wrap.setPositioning(position);
+ if (wrap.isStyle('position', 'static')) {
+ wrap.position('relative');
+ }
+ me.clearPositioning('auto');
+ wrap.clip();
+
+
+
+
+ me.setStyle({
+ visibility: '',
+ position: 'absolute'
+ });
+ if (slideOut) {
+ wrap.setSize(box.width, box.height);
+ }
+
+ switch (anchor) {
+ case 't':
+ anim = {
+ from: {
+ width: box.width + 'px',
+ height: '0px'
+ },
+ to: {
+ width: box.width + 'px',
+ height: box.height + 'px'
+ }
+ };
+ elStyle.bottom = '0px';
+ break;
+ case 'l':
+ anim = {
+ from: {
+ width: '0px',
+ height: box.height + 'px'
+ },
+ to: {
+ width: box.width + 'px',
+ height: box.height + 'px'
+ }
+ };
+ elStyle.right = '0px';
+ break;
+ case 'r':
+ anim = {
+ from: {
+ x: box.x + box.width,
+ width: '0px',
+ height: box.height + 'px'
+ },
+ to: {
+ x: box.x,
+ width: box.width + 'px',
+ height: box.height + 'px'
+ }
+ };
+ break;
+ case 'b':
+ anim = {
+ from: {
+ y: box.y + box.height,
+ width: box.width + 'px',
+ height: '0px'
+ },
+ to: {
+ y: box.y,
+ width: box.width + 'px',
+ height: box.height + 'px'
+ }
+ };
+ break;
+ case 'tl':
+ anim = {
+ from: {
+ x: box.x,
+ y: box.y,
+ width: '0px',
+ height: '0px'
+ },
+ to: {
+ width: box.width + 'px',
+ height: box.height + 'px'
+ }
+ };
+ elStyle.bottom = '0px';
+ elStyle.right = '0px';
+ break;
+ case 'bl':
+ anim = {
+ from: {
+ x: box.x + box.width,
+ width: '0px',
+ height: '0px'
+ },
+ to: {
+ x: box.x,
+ width: box.width + 'px',
+ height: box.height + 'px'
+ }
+ };
+ elStyle.right = '0px';
+ break;
+ case 'br':
+ anim = {
+ from: {
+ x: box.x + box.width,
+ y: box.y + box.height,
+ width: '0px',
+ height: '0px'
+ },
+ to: {
+ x: box.x,
+ y: box.y,
+ width: box.width + 'px',
+ height: box.height + 'px'
+ }
+ };
+ break;
+ case 'tr':
+ anim = {
+ from: {
+ y: box.y + box.height,
+ width: '0px',
+ height: '0px'
+ },
+ to: {
+ y: box.y,
+ width: box.width + 'px',
+ height: box.height + 'px'
+ }
+ };
+ elStyle.bottom = '0px';
+ break;
+ }
+
+ wrap.show();
+ wrapAnim = Ext.apply({}, obj);
+ delete wrapAnim.listeners;
+ wrapAnim = Ext.create('Ext.fx.Anim', Ext.applyIf(wrapAnim, {
+ target: wrap,
+ duration: 500,
+ easing: 'ease-out',
+ from: slideOut ? anim.to : anim.from,
+ to: slideOut ? anim.from : anim.to
+ }));
+
+
+ wrapAnim.on('afteranimate', function() {
+ if (slideOut) {
+ me.setPositioning(position);
+ if (obj.useDisplay) {
+ me.setDisplayed(false);
+ } else {
+ me.hide();
+ }
+ }
+ else {
+ me.clearPositioning();
+ me.setPositioning(position);
+ }
+ if (wrap.dom) {
+ wrap.dom.parentNode.insertBefore(me.dom, wrap.dom);
+ wrap.remove();
+ }
+ me.setSize(box.width, box.height);
+ animScope.end();
+ });
+
+ if (listeners) {
+ wrapAnim.on(listeners);
+ }
+ };
+
+ me.animate({
+ duration: obj.duration ? obj.duration * 2 : 1000,
+ listeners: {
+ beforeanimate: {
+ fn: beforeAnim
+ },
+ afteranimate: {
+ fn: function() {
+ if (wrapAnim && wrapAnim.running) {
+ wrapAnim.end();
+ }
+ }
+ }
+ }
+ });
+ return me;
+ },
+
+
+
+ slideOut: function(anchor, o) {
+ return this.slideIn(anchor, o, true);
+ },
+
+
+ puff: function(obj) {
+ var me = this,
+ beforeAnim;
+ obj = Ext.applyIf(obj || {}, {
+ easing: 'ease-out',
+ duration: 500,
+ useDisplay: false
+ });
+
+ beforeAnim = function() {
+ me.clearOpacity();
+ me.show();
+
+ var box = me.getBox(),
+ fontSize = me.getStyle('fontSize'),
+ position = me.getPositioning();
+ this.to = {
+ width: box.width * 2,
+ height: box.height * 2,
+ x: box.x - (box.width / 2),
+ y: box.y - (box.height /2),
+ opacity: 0,
+ fontSize: '200%'
+ };
+ this.on('afteranimate',function() {
+ if (me.dom) {
+ if (obj.useDisplay) {
+ me.setDisplayed(false);
+ } else {
+ me.hide();
+ }
+ me.clearOpacity();
+ me.setPositioning(position);
+ me.setStyle({fontSize: fontSize});
+ }
+ });
+ };
+
+ me.animate({
+ duration: obj.duration,
+ easing: obj.easing,
+ listeners: {
+ beforeanimate: {
+ fn: beforeAnim
+ }
+ }
+ });
+ return me;
+ },
+
+
+ switchOff: function(obj) {
+ var me = this,
+ beforeAnim;
+
+ obj = Ext.applyIf(obj || {}, {
+ easing: 'ease-in',
+ duration: 500,
+ remove: false,
+ useDisplay: false
+ });
+
+ beforeAnim = function() {
+ var animScope = this,
+ size = me.getSize(),
+ xy = me.getXY(),
+ keyframe, position;
+ me.clearOpacity();
+ me.clip();
+ position = me.getPositioning();
+
+ keyframe = Ext.create('Ext.fx.Animator', {
+ target: me,
+ duration: obj.duration,
+ easing: obj.easing,
+ keyframes: {
+ 33: {
+ opacity: 0.3
+ },
+ 66: {
+ height: 1,
+ y: xy[1] + size.height / 2
+ },
+ 100: {
+ width: 1,
+ x: xy[0] + size.width / 2
+ }
+ }
+ });
+ keyframe.on('afteranimate', function() {
+ if (obj.useDisplay) {
+ me.setDisplayed(false);
+ } else {
+ me.hide();
+ }
+ me.clearOpacity();
+ me.setPositioning(position);
+ me.setSize(size);
+ animScope.end();
+ });
+ };
+ me.animate({
+ duration: (obj.duration * 2),
+ listeners: {
+ beforeanimate: {
+ fn: beforeAnim
+ }
+ }
+ });
+ return me;
+ },
+
+
+ frame : function(color, count, obj){
+ var me = this,
+ beforeAnim;
+
+ color = color || '#C3DAF9';
+ count = count || 1;
+ obj = obj || {};
+
+ beforeAnim = function() {
+ me.show();
+ var animScope = this,
+ box = me.getBox(),
+ proxy = Ext.getBody().createChild({
+ style: {
+ position : 'absolute',
+ 'pointer-events': 'none',
+ 'z-index': 35000,
+ border : '0px solid ' + color
+ }
+ }),
+ proxyAnim;
+ proxyAnim = Ext.create('Ext.fx.Anim', {
+ target: proxy,
+ duration: obj.duration || 1000,
+ iterations: count,
+ from: {
+ top: box.y,
+ left: box.x,
+ borderWidth: 0,
+ opacity: 1,
+ height: box.height,
+ width: box.width
+ },
+ to: {
+ top: box.y - 20,
+ left: box.x - 20,
+ borderWidth: 10,
+ opacity: 0,
+ height: box.height + 40,
+ width: box.width + 40
+ }
+ });
+ proxyAnim.on('afteranimate', function() {
+ proxy.remove();
+ animScope.end();
+ });
+ };
+
+ me.animate({
+ duration: (obj.duration * 2) || 2000,
+ listeners: {
+ beforeanimate: {
+ fn: beforeAnim
+ }
+ }
+ });
+ return me;
+ },
+
+
+ ghost: function(anchor, obj) {
+ var me = this,
+ beforeAnim;
+
+ anchor = anchor || "b";
+ beforeAnim = function() {
+ var width = me.getWidth(),
+ height = me.getHeight(),
+ xy = me.getXY(),
+ position = me.getPositioning(),
+ to = {
+ opacity: 0
+ };
+ switch (anchor) {
+ case 't':
+ to.y = xy[1] - height;
+ break;
+ case 'l':
+ to.x = xy[0] - width;
+ break;
+ case 'r':
+ to.x = xy[0] + width;
+ break;
+ case 'b':
+ to.y = xy[1] + height;
+ break;
+ case 'tl':
+ to.x = xy[0] - width;
+ to.y = xy[1] - height;
+ break;
+ case 'bl':
+ to.x = xy[0] - width;
+ to.y = xy[1] + height;
+ break;
+ case 'br':
+ to.x = xy[0] + width;
+ to.y = xy[1] + height;
+ break;
+ case 'tr':
+ to.x = xy[0] + width;
+ to.y = xy[1] - height;
+ break;
+ }
+ this.to = to;
+ this.on('afteranimate', function () {
+ if (me.dom) {
+ me.hide();
+ me.clearOpacity();
+ me.setPositioning(position);
+ }
+ });
+ };
+
+ me.animate(Ext.applyIf(obj || {}, {
+ duration: 500,
+ easing: 'ease-out',
+ listeners: {
+ beforeanimate: {
+ fn: beforeAnim
+ }
+ }
+ }));
+ return me;
+ },
+
+
+ highlight: function(color, o) {
+ var me = this,
+ dom = me.dom,
+ from = {},
+ restore, to, attr, lns, event, fn;
+
+ o = o || {};
+ lns = o.listeners || {};
+ attr = o.attr || 'backgroundColor';
+ from[attr] = color || 'ffff9c';
+
+ if (!o.to) {
+ to = {};
+ to[attr] = o.endColor || me.getColor(attr, 'ffffff', '');
+ }
+ else {
+ to = o.to;
+ }
+
+
+ o.listeners = Ext.apply(Ext.apply({}, lns), {
+ beforeanimate: function() {
+ restore = dom.style[attr];
+ me.clearOpacity();
+ me.show();
+
+ event = lns.beforeanimate;
+ if (event) {
+ fn = event.fn || event;
+ return fn.apply(event.scope || lns.scope || window, arguments);
+ }
+ },
+ afteranimate: function() {
+ if (dom) {
+ dom.style[attr] = restore;
+ }
+
+ event = lns.afteranimate;
+ if (event) {
+ fn = event.fn || event;
+ fn.apply(event.scope || lns.scope || window, arguments);
+ }
+ }
+ });
+
+ me.animate(Ext.apply({}, o, {
+ duration: 1000,
+ easing: 'ease-in',
+ from: from,
+ to: to
+ }));
+ return me;
+ },
+
+
+ pause: function(ms) {
+ var me = this;
+ Ext.fx.Manager.setFxDefaults(me.id, {
+ delay: ms
+ });
+ return me;
+ },
+
+
+ fadeIn: function(o) {
+ this.animate(Ext.apply({}, o, {
+ opacity: 1
+ }));
+ return this;
+ },
+
+
+ fadeOut: function(o) {
+ this.animate(Ext.apply({}, o, {
+ opacity: 0
+ }));
+ return this;
+ },
+
+
+ scale: function(w, h, o) {
+ this.animate(Ext.apply({}, o, {
+ width: w,
+ height: h
+ }));
+ return this;
+ },
+
+
+ shift: function(config) {
+ this.animate(config);
+ return this;
+ }
+});
+
+
+Ext.applyIf(Ext.Element, {
+ unitRe: /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,
+ camelRe: /(-[a-z])/gi,
+ opacityRe: /alpha\(opacity=(.*)\)/i,
+ cssRe: /([a-z0-9-]+)\s*:\s*([^;\s]+(?:\s*[^;\s]+)*);?/gi,
+ propertyCache: {},
+ defaultUnit : "px",
+ borders: {l: 'border-left-width', r: 'border-right-width', t: 'border-top-width', b: 'border-bottom-width'},
+ paddings: {l: 'padding-left', r: 'padding-right', t: 'padding-top', b: 'padding-bottom'},
+ margins: {l: 'margin-left', r: 'margin-right', t: 'margin-top', b: 'margin-bottom'},
+
+
+ addUnits : Ext.Element.prototype.addUnits,
+
+
+ parseBox : function(box) {
+ if (Ext.isObject(box)) {
+ return {
+ top: box.top || 0,
+ right: box.right || 0,
+ bottom: box.bottom || 0,
+ left: box.left || 0
+ };
+ } else {
+ if (typeof box != 'string') {
+ box = box.toString();
+ }
+ var parts = box.split(' '),
+ ln = parts.length;
+
+ if (ln == 1) {
+ parts[1] = parts[2] = parts[3] = parts[0];
+ }
+ else if (ln == 2) {
+ parts[2] = parts[0];
+ parts[3] = parts[1];
+ }
+ else if (ln == 3) {
+ parts[3] = parts[1];
+ }
+
+ return {
+ top :parseFloat(parts[0]) || 0,
+ right :parseFloat(parts[1]) || 0,
+ bottom:parseFloat(parts[2]) || 0,
+ left :parseFloat(parts[3]) || 0
+ };
+ }
+
+ },
+
+
+ unitizeBox : function(box, units) {
+ var A = this.addUnits,
+ B = this.parseBox(box);
+
+ return A(B.top, units) + ' ' +
+ A(B.right, units) + ' ' +
+ A(B.bottom, units) + ' ' +
+ A(B.left, units);
+
+ },
+
+
+ camelReplaceFn : function(m, a) {
+ return a.charAt(1).toUpperCase();
+ },
+
+
+ normalize : function(prop) {
+ if (prop == 'float') {
+ prop = Ext.supports.Float ? 'cssFloat' : 'styleFloat';
+ }
+ return this.propertyCache[prop] || (this.propertyCache[prop] = prop.replace(this.camelRe, this.camelReplaceFn));
+ },
+
+
+ getDocumentHeight: function() {
+ return Math.max(!Ext.isStrict ? document.body.scrollHeight : document.documentElement.scrollHeight, this.getViewportHeight());
+ },
+
+
+ getDocumentWidth: function() {
+ return Math.max(!Ext.isStrict ? document.body.scrollWidth : document.documentElement.scrollWidth, this.getViewportWidth());
+ },
+
+
+ getViewportHeight: function(){
+ return window.innerHeight;
+ },
+
+
+ getViewportWidth : function() {
+ return window.innerWidth;
+ },
+
+
+ getViewSize : function() {
+ return {
+ width: window.innerWidth,
+ height: window.innerHeight
+ };
+ },
+
+
+ getOrientation : function() {
+ if (Ext.supports.OrientationChange) {
+ return (window.orientation == 0) ? 'portrait' : 'landscape';
+ }
+
+ return (window.innerHeight > window.innerWidth) ? 'portrait' : 'landscape';
+ },
+
+
+ fromPoint: function(x, y) {
+ return Ext.get(document.elementFromPoint(x, y));
+ },
+
+
+ parseStyles: function(styles){
+ var out = {},
+ cssRe = this.cssRe,
+ matches;
+
+ if (styles) {
+
+
+
+
+ cssRe.lastIndex = 0;
+ while ((matches = cssRe.exec(styles))) {
+ out[matches[1]] = matches[2];
+ }
+ }
+ return out;
+ }
+});
+
+
+Ext.CompositeElementLite = function(els, root){
+
+ this.elements = [];
+ this.add(els, root);
+ this.el = new Ext.Element.Flyweight();
+};
+
+Ext.CompositeElementLite.prototype = {
+ isComposite: true,
+
+
+ getElement : function(el){
+
+ var e = this.el;
+ e.dom = el;
+ e.id = el.id;
+ return e;
+ },
+
+
+ transformElement : function(el){
+ return Ext.getDom(el);
+ },
+
+
+ getCount : function(){
+ return this.elements.length;
+ },
+
+ add : function(els, root){
+ var me = this,
+ elements = me.elements;
+ if(!els){
+ return this;
+ }
+ if(typeof els == "string"){
+ els = Ext.Element.selectorFunction(els, root);
+ }else if(els.isComposite){
+ els = els.elements;
+ }else if(!Ext.isIterable(els)){
+ els = [els];
+ }
+
+ for(var i = 0, len = els.length; i < len; ++i){
+ elements.push(me.transformElement(els[i]));
+ }
+ return me;
+ },
+
+ invoke : function(fn, args){
+ var me = this,
+ els = me.elements,
+ len = els.length,
+ e,
+ i;
+
+ for(i = 0; i < len; i++) {
+ e = els[i];
+ if(e){
+ Ext.Element.prototype[fn].apply(me.getElement(e), args);
+ }
+ }
+ return me;
+ },
+
+ item : function(index){
+ var me = this,
+ el = me.elements[index],
+ out = null;
+
+ if(el){
+ out = me.getElement(el);
+ }
+ return out;
+ },
+
+
+ addListener : function(eventName, handler, scope, opt){
+ var els = this.elements,
+ len = els.length,
+ i, e;
+
+ for(i = 0; i -1){
+ replacement = Ext.getDom(replacement);
+ if(domReplace){
+ d = this.elements[index];
+ d.parentNode.insertBefore(replacement, d);
+ Ext.removeNode(d);
+ }
+ Ext.Array.splice(this.elements, index, 1, replacement);
+ }
+ return this;
+ },
+
+
+ clear : function(){
+ this.elements = [];
+ }
+};
+
+Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;
+
+
+Ext.CompositeElementLite.importElementMethods = function() {
+ var fnName,
+ ElProto = Ext.Element.prototype,
+ CelProto = Ext.CompositeElementLite.prototype;
+
+ for (fnName in ElProto) {
+ if (typeof ElProto[fnName] == 'function'){
+ (function(fnName) {
+ CelProto[fnName] = CelProto[fnName] || function() {
+ return this.invoke(fnName, arguments);
+ };
+ }).call(CelProto, fnName);
+
+ }
+ }
+};
+
+Ext.CompositeElementLite.importElementMethods();
+
+if(Ext.DomQuery){
+ Ext.Element.selectorFunction = Ext.DomQuery.select;
+}
+
+
+Ext.Element.select = function(selector, root){
+ var els;
+ if(typeof selector == "string"){
+ els = Ext.Element.selectorFunction(selector, root);
+ }else if(selector.length !== undefined){
+ els = selector;
+ }else{
+ }
+ return new Ext.CompositeElementLite(els);
+};
+
+Ext.select = Ext.Element.select;
+
+
+Ext.util.DelayedTask = function(fn, scope, args) {
+ var me = this,
+ id,
+ call = function() {
+ clearInterval(id);
+ id = null;
+ fn.apply(scope, args || []);
+ };
+
+
+ this.delay = function(delay, newFn, newScope, newArgs) {
+ me.cancel();
+ fn = newFn || fn;
+ scope = newScope || scope;
+ args = newArgs || args;
+ id = setInterval(call, delay);
+ };
+
+
+ this.cancel = function(){
+ if (id) {
+ clearInterval(id);
+ id = null;
+ }
+ };
+};
+Ext.require('Ext.util.DelayedTask', function() {
+
+ Ext.util.Event = Ext.extend(Object, (function() {
+ function createBuffered(handler, listener, o, scope) {
+ listener.task = new Ext.util.DelayedTask();
+ return function() {
+ listener.task.delay(o.buffer, handler, scope, Ext.Array.toArray(arguments));
+ };
+ }
+
+ function createDelayed(handler, listener, o, scope) {
+ return function() {
+ var task = new Ext.util.DelayedTask();
+ if (!listener.tasks) {
+ listener.tasks = [];
+ }
+ listener.tasks.push(task);
+ task.delay(o.delay || 10, handler, scope, Ext.Array.toArray(arguments));
+ };
+ }
+
+ function createSingle(handler, listener, o, scope) {
+ return function() {
+ listener.ev.removeListener(listener.fn, scope);
+ return handler.apply(scope, arguments);
+ };
+ }
+
+ return {
+ isEvent: true,
+
+ constructor: function(observable, name) {
+ this.name = name;
+ this.observable = observable;
+ this.listeners = [];
+ },
+
+ addListener: function(fn, scope, options) {
+ var me = this,
+ listener;
+ scope = scope || me.observable;
+
+
+ if (!me.isListening(fn, scope)) {
+ listener = me.createListener(fn, scope, options);
+ if (me.firing) {
+
+ me.listeners = me.listeners.slice(0);
+ }
+ me.listeners.push(listener);
+ }
+ },
+
+ createListener: function(fn, scope, o) {
+ o = o || {};
+ scope = scope || this.observable;
+
+ var listener = {
+ fn: fn,
+ scope: scope,
+ o: o,
+ ev: this
+ },
+ handler = fn;
+
+
+
+ if (o.single) {
+ handler = createSingle(handler, listener, o, scope);
+ }
+ if (o.delay) {
+ handler = createDelayed(handler, listener, o, scope);
+ }
+ if (o.buffer) {
+ handler = createBuffered(handler, listener, o, scope);
+ }
+
+ listener.fireFn = handler;
+ return listener;
+ },
+
+ findListener: function(fn, scope) {
+ var listeners = this.listeners,
+ i = listeners.length,
+ listener,
+ s;
+
+ while (i--) {
+ listener = listeners[i];
+ if (listener) {
+ s = listener.scope;
+ if (listener.fn == fn && (s == scope || s == this.observable)) {
+ return i;
+ }
+ }
+ }
+
+ return - 1;
+ },
+
+ isListening: function(fn, scope) {
+ return this.findListener(fn, scope) !== -1;
+ },
+
+ removeListener: function(fn, scope) {
+ var me = this,
+ index,
+ listener,
+ k;
+ index = me.findListener(fn, scope);
+ if (index != -1) {
+ listener = me.listeners[index];
+
+ if (me.firing) {
+ me.listeners = me.listeners.slice(0);
+ }
+
+
+ if (listener.task) {
+ listener.task.cancel();
+ delete listener.task;
+ }
+
+
+ k = listener.tasks && listener.tasks.length;
+ if (k) {
+ while (k--) {
+ listener.tasks[k].cancel();
+ }
+ delete listener.tasks;
+ }
+
+
+ Ext.Array.erase(me.listeners, index, 1);
+ return true;
+ }
+
+ return false;
+ },
+
+
+ clearListeners: function() {
+ var listeners = this.listeners,
+ i = listeners.length;
+
+ while (i--) {
+ this.removeListener(listeners[i].fn, listeners[i].scope);
+ }
+ },
+
+ fire: function() {
+ var me = this,
+ listeners = me.listeners,
+ count = listeners.length,
+ i,
+ args,
+ listener;
+
+ if (count > 0) {
+ me.firing = true;
+ for (i = 0; i < count; i++) {
+ listener = listeners[i];
+ args = arguments.length ? Array.prototype.slice.call(arguments, 0) : [];
+ if (listener.o) {
+ args.push(listener.o);
+ }
+ if (listener && listener.fireFn.apply(listener.scope || me.observable, args) === false) {
+ return (me.firing = false);
+ }
+ }
+ }
+ me.firing = false;
+ return true;
+ }
+ };
+ })());
+});
+
+
+Ext.EventManager = {
+
+
+
+
+ hasBoundOnReady: false,
+
+
+ hasFiredReady: false,
+
+
+ readyTimeout: null,
+
+
+ hasOnReadyStateChange: false,
+
+
+ readyEvent: new Ext.util.Event(),
+
+
+ checkReadyState: function(){
+ var me = Ext.EventManager;
+
+ if(window.attachEvent){
+
+
+ if (window != top) {
+ return false;
+ }
+ try{
+ document.documentElement.doScroll('left');
+ }catch(e){
+ return false;
+ }
+ me.fireDocReady();
+ return true;
+ }
+ if (document.readyState == 'complete') {
+ me.fireDocReady();
+ return true;
+ }
+ me.readyTimeout = setTimeout(arguments.callee, 2);
+ return false;
+ },
+
+
+ bindReadyEvent: function(){
+ var me = Ext.EventManager;
+ if (me.hasBoundOnReady) {
+ return;
+ }
+
+ if (document.addEventListener) {
+ document.addEventListener('DOMContentLoaded', me.fireDocReady, false);
+
+ window.addEventListener('load', me.fireDocReady, false);
+ } else {
+
+ if (!me.checkReadyState()) {
+ document.attachEvent('onreadystatechange', me.checkReadyState);
+ me.hasOnReadyStateChange = true;
+ }
+
+ window.attachEvent('onload', me.fireDocReady, false);
+ }
+ me.hasBoundOnReady = true;
+ },
+
+
+ fireDocReady: function(){
+ var me = Ext.EventManager;
+
+
+ if (!me.hasFiredReady) {
+ me.hasFiredReady = true;
+
+ if (document.addEventListener) {
+ document.removeEventListener('DOMContentLoaded', me.fireDocReady, false);
+ window.removeEventListener('load', me.fireDocReady, false);
+ } else {
+ if (me.readyTimeout !== null) {
+ clearTimeout(me.readyTimeout);
+ }
+ if (me.hasOnReadyStateChange) {
+ document.detachEvent('onreadystatechange', me.checkReadyState);
+ }
+ window.detachEvent('onload', me.fireDocReady);
+ }
+ Ext.supports.init();
+ }
+ if (!Ext.isReady) {
+ Ext.isReady = true;
+ me.onWindowUnload();
+ me.readyEvent.fire();
+ }
+ },
+
+
+ onDocumentReady: function(fn, scope, options){
+ options = options || {};
+ var me = Ext.EventManager,
+ readyEvent = me.readyEvent;
+
+
+ options.single = true;
+
+
+ if (Ext.isReady) {
+ readyEvent.addListener(fn, scope, options);
+ readyEvent.fire();
+ } else {
+ options.delay = options.delay || 1;
+ readyEvent.addListener(fn, scope, options);
+ me.bindReadyEvent();
+ }
+ },
+
+
+
+
+
+ stoppedMouseDownEvent: new Ext.util.Event(),
+
+
+ propRe: /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate|freezeEvent)$/,
+
+
+ getId : function(element) {
+ var skipGarbageCollection = false,
+ id;
+
+ element = Ext.getDom(element);
+
+ if (element === document || element === window) {
+ id = element === document ? Ext.documentId : Ext.windowId;
+ }
+ else {
+ id = Ext.id(element);
+ }
+
+ if (element && (element.getElementById || element.navigator)) {
+ skipGarbageCollection = true;
+ }
+
+ if (!Ext.cache[id]){
+ Ext.Element.addToCache(new Ext.Element(element), id);
+ if (skipGarbageCollection) {
+ Ext.cache[id].skipGarbageCollection = true;
+ }
+ }
+ return id;
+ },
+
+
+ prepareListenerConfig: function(element, config, isRemove){
+ var me = this,
+ propRe = me.propRe,
+ key, value, args;
+
+
+ for (key in config) {
+ if (config.hasOwnProperty(key)) {
+
+ if (!propRe.test(key)) {
+ value = config[key];
+
+
+ if (Ext.isFunction(value)) {
+
+ args = [element, key, value, config.scope, config];
+ } else {
+
+ args = [element, key, value.fn, value.scope, value];
+ }
+
+ if (isRemove === true) {
+ me.removeListener.apply(this, args);
+ } else {
+ me.addListener.apply(me, args);
+ }
+ }
+ }
+ }
+ },
+
+
+ normalizeEvent: function(eventName, fn){
+ if (/mouseenter|mouseleave/.test(eventName) && !Ext.supports.MouseEnterLeave) {
+ if (fn) {
+ fn = Ext.Function.createInterceptor(fn, this.contains, this);
+ }
+ eventName = eventName == 'mouseenter' ? 'mouseover' : 'mouseout';
+ } else if (eventName == 'mousewheel' && !Ext.supports.MouseWheel && !Ext.isOpera){
+ eventName = 'DOMMouseScroll';
+ }
+ return {
+ eventName: eventName,
+ fn: fn
+ };
+ },
+
+
+ contains: function(event){
+ var parent = event.browserEvent.currentTarget,
+ child = this.getRelatedTarget(event);
+
+ if (parent && parent.firstChild) {
+ while (child) {
+ if (child === parent) {
+ return false;
+ }
+ child = child.parentNode;
+ if (child && (child.nodeType != 1)) {
+ child = null;
+ }
+ }
+ }
+ return true;
+ },
+
+
+ addListener: function(element, eventName, fn, scope, options){
+
+ if (typeof eventName !== 'string') {
+ this.prepareListenerConfig(element, eventName);
+ return;
+ }
+
+ var dom = Ext.getDom(element),
+ bind,
+ wrap;
+
+
+
+ options = options || {};
+
+ bind = this.normalizeEvent(eventName, fn);
+ wrap = this.createListenerWrap(dom, eventName, bind.fn, scope, options);
+
+
+ if (dom.attachEvent) {
+ dom.attachEvent('on' + bind.eventName, wrap);
+ } else {
+ dom.addEventListener(bind.eventName, wrap, options.capture || false);
+ }
+
+ if (dom == document && eventName == 'mousedown') {
+ this.stoppedMouseDownEvent.addListener(wrap);
+ }
+
+
+ this.getEventListenerCache(dom, eventName).push({
+ fn: fn,
+ wrap: wrap,
+ scope: scope
+ });
+ },
+
+
+ removeListener : function(element, eventName, fn, scope) {
+
+ if (typeof eventName !== 'string') {
+ this.prepareListenerConfig(element, eventName, true);
+ return;
+ }
+
+ var dom = Ext.getDom(element),
+ cache = this.getEventListenerCache(dom, eventName),
+ bindName = this.normalizeEvent(eventName).eventName,
+ i = cache.length, j,
+ listener, wrap, tasks;
+
+
+ while (i--) {
+ listener = cache[i];
+
+ if (listener && (!fn || listener.fn == fn) && (!scope || listener.scope === scope)) {
+ wrap = listener.wrap;
+
+
+ if (wrap.task) {
+ clearTimeout(wrap.task);
+ delete wrap.task;
+ }
+
+
+ j = wrap.tasks && wrap.tasks.length;
+ if (j) {
+ while (j--) {
+ clearTimeout(wrap.tasks[j]);
+ }
+ delete wrap.tasks;
+ }
+
+ if (dom.detachEvent) {
+ dom.detachEvent('on' + bindName, wrap);
+ } else {
+ dom.removeEventListener(bindName, wrap, false);
+ }
+
+ if (wrap && dom == document && eventName == 'mousedown') {
+ this.stoppedMouseDownEvent.removeListener(wrap);
+ }
+
+
+ Ext.Array.erase(cache, i, 1);
+ }
+ }
+ },
+
+
+ removeAll : function(element){
+ var dom = Ext.getDom(element),
+ cache, ev;
+ if (!dom) {
+ return;
+ }
+ cache = this.getElementEventCache(dom);
+
+ for (ev in cache) {
+ if (cache.hasOwnProperty(ev)) {
+ this.removeListener(dom, ev);
+ }
+ }
+ Ext.cache[dom.id].events = {};
+ },
+
+
+ purgeElement : function(element, eventName) {
+ var dom = Ext.getDom(element),
+ i = 0, len;
+
+ if(eventName) {
+ this.removeListener(dom, eventName);
+ }
+ else {
+ this.removeAll(dom);
+ }
+
+ if(dom && dom.childNodes) {
+ for(len = element.childNodes.length; i < len; i++) {
+ this.purgeElement(element.childNodes[i], eventName);
+ }
+ }
+ },
+
+
+ createListenerWrap : function(dom, ename, fn, scope, options) {
+ options = options || {};
+
+ var f, gen;
+
+ return function wrap(e, args) {
+
+ if (!gen) {
+ f = ['if(!Ext) {return;}'];
+
+ if(options.buffer || options.delay || options.freezeEvent) {
+ f.push('e = new Ext.EventObjectImpl(e, ' + (options.freezeEvent ? 'true' : 'false' ) + ');');
+ } else {
+ f.push('e = Ext.EventObject.setEvent(e);');
+ }
+
+ if (options.delegate) {
+ f.push('var t = e.getTarget("' + options.delegate + '", this);');
+ f.push('if(!t) {return;}');
+ } else {
+ f.push('var t = e.target;');
+ }
+
+ if (options.target) {
+ f.push('if(e.target !== options.target) {return;}');
+ }
+
+ if(options.stopEvent) {
+ f.push('e.stopEvent();');
+ } else {
+ if(options.preventDefault) {
+ f.push('e.preventDefault();');
+ }
+ if(options.stopPropagation) {
+ f.push('e.stopPropagation();');
+ }
+ }
+
+ if(options.normalized === false) {
+ f.push('e = e.browserEvent;');
+ }
+
+ if(options.buffer) {
+ f.push('(wrap.task && clearTimeout(wrap.task));');
+ f.push('wrap.task = setTimeout(function(){');
+ }
+
+ if(options.delay) {
+ f.push('wrap.tasks = wrap.tasks || [];');
+ f.push('wrap.tasks.push(setTimeout(function(){');
+ }
+
+
+ f.push('fn.call(scope || dom, e, t, options);');
+
+ if(options.single) {
+ f.push('Ext.EventManager.removeListener(dom, ename, fn, scope);');
+ }
+
+ if(options.delay) {
+ f.push('}, ' + options.delay + '));');
+ }
+
+ if(options.buffer) {
+ f.push('}, ' + options.buffer + ');');
+ }
+
+ gen = Ext.functionFactory('e', 'options', 'fn', 'scope', 'ename', 'dom', 'wrap', 'args', f.join('\n'));
+ }
+
+ gen.call(dom, e, options, fn, scope, ename, dom, wrap, args);
+ };
+ },
+
+
+ getEventListenerCache : function(element, eventName) {
+ if (!element) {
+ return [];
+ }
+
+ var eventCache = this.getElementEventCache(element);
+ return eventCache[eventName] || (eventCache[eventName] = []);
+ },
+
+
+ getElementEventCache : function(element) {
+ if (!element) {
+ return {};
+ }
+ var elementCache = Ext.cache[this.getId(element)];
+ return elementCache.events || (elementCache.events = {});
+ },
+
+
+ mouseLeaveRe: /(mouseout|mouseleave)/,
+ mouseEnterRe: /(mouseover|mouseenter)/,
+
+
+ stopEvent: function(event) {
+ this.stopPropagation(event);
+ this.preventDefault(event);
+ },
+
+
+ stopPropagation: function(event) {
+ event = event.browserEvent || event;
+ if (event.stopPropagation) {
+ event.stopPropagation();
+ } else {
+ event.cancelBubble = true;
+ }
+ },
+
+
+ preventDefault: function(event) {
+ event = event.browserEvent || event;
+ if (event.preventDefault) {
+ event.preventDefault();
+ } else {
+ event.returnValue = false;
+
+ try {
+
+ if (event.ctrlKey || event.keyCode > 111 && event.keyCode < 124) {
+ event.keyCode = -1;
+ }
+ } catch (e) {
+
+ }
+ }
+ },
+
+
+ getRelatedTarget: function(event) {
+ event = event.browserEvent || event;
+ var target = event.relatedTarget;
+ if (!target) {
+ if (this.mouseLeaveRe.test(event.type)) {
+ target = event.toElement;
+ } else if (this.mouseEnterRe.test(event.type)) {
+ target = event.fromElement;
+ }
+ }
+ return this.resolveTextNode(target);
+ },
+
+
+ getPageX: function(event) {
+ return this.getXY(event)[0];
+ },
+
+
+ getPageY: function(event) {
+ return this.getXY(event)[1];
+ },
+
+
+ getPageXY: function(event) {
+ event = event.browserEvent || event;
+ var x = event.pageX,
+ y = event.pageY,
+ doc = document.documentElement,
+ body = document.body;
+
+
+ if (!x && x !== 0) {
+ x = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
+ y = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
+ }
+ return [x, y];
+ },
+
+
+ getTarget: function(event) {
+ event = event.browserEvent || event;
+ return this.resolveTextNode(event.target || event.srcElement);
+ },
+
+
+
+ resolveTextNode: Ext.isGecko ?
+ function(node) {
+ if (!node) {
+ return;
+ }
+
+ var s = HTMLElement.prototype.toString.call(node);
+ if (s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]') {
+ return;
+ }
+ return node.nodeType == 3 ? node.parentNode: node;
+ }: function(node) {
+ return node && node.nodeType == 3 ? node.parentNode: node;
+ },
+
+
+
+
+ curWidth: 0,
+ curHeight: 0,
+
+
+ onWindowResize: function(fn, scope, options){
+ var resize = this.resizeEvent;
+ if(!resize){
+ this.resizeEvent = resize = new Ext.util.Event();
+ this.on(window, 'resize', this.fireResize, this, {buffer: 100});
+ }
+ resize.addListener(fn, scope, options);
+ },
+
+
+ fireResize: function(){
+ var me = this,
+ w = Ext.Element.getViewWidth(),
+ h = Ext.Element.getViewHeight();
+
+
+ if(me.curHeight != h || me.curWidth != w){
+ me.curHeight = h;
+ me.curWidth = w;
+ me.resizeEvent.fire(w, h);
+ }
+ },
+
+
+ removeResizeListener: function(fn, scope){
+ if (this.resizeEvent) {
+ this.resizeEvent.removeListener(fn, scope);
+ }
+ },
+
+ onWindowUnload: function() {
+ var unload = this.unloadEvent;
+ if (!unload) {
+ this.unloadEvent = unload = new Ext.util.Event();
+ this.addListener(window, 'unload', this.fireUnload, this);
+ }
+ },
+
+
+ fireUnload: function() {
+
+ try {
+ this.removeUnloadListener();
+
+ if (Ext.isGecko3) {
+ var gridviews = Ext.ComponentQuery.query('gridview'),
+ i = 0,
+ ln = gridviews.length;
+ for (; i < ln; i++) {
+ gridviews[i].scrollToTop();
+ }
+ }
+
+ var el,
+ cache = Ext.cache;
+ for (el in cache) {
+ if (cache.hasOwnProperty(el)) {
+ Ext.EventManager.removeAll(el);
+ }
+ }
+ } catch(e) {
+ }
+ },
+
+
+ removeUnloadListener: function(){
+ if (this.unloadEvent) {
+ this.removeListener(window, 'unload', this.fireUnload);
+ }
+ },
+
+
+ useKeyDown: Ext.isWebKit ?
+ parseInt(navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1], 10) >= 525 :
+ !((Ext.isGecko && !Ext.isWindows) || Ext.isOpera),
+
+
+ getKeyEvent: function(){
+ return this.useKeyDown ? 'keydown' : 'keypress';
+ }
+};
+
+
+Ext.onReady = function(fn, scope, options) {
+ Ext.Loader.onReady(fn, scope, true, options);
+};
+
+
+Ext.onDocumentReady = Ext.EventManager.onDocumentReady;
+
+
+Ext.EventManager.on = Ext.EventManager.addListener;
+
+
+Ext.EventManager.un = Ext.EventManager.removeListener;
+
+(function(){
+ var initExtCss = function() {
+
+ var bd = document.body || document.getElementsByTagName('body')[0],
+ baseCSSPrefix = Ext.baseCSSPrefix,
+ cls = [baseCSSPrefix + 'body'],
+ htmlCls = [],
+ html;
+
+ if (!bd) {
+ return false;
+ }
+
+ html = bd.parentNode;
+
+ function add (c) {
+ cls.push(baseCSSPrefix + c);
+ }
+
+
+ if (Ext.isIE) {
+ add('ie');
+
+
+
+
+
+
+
+
+
+
+
+
+ if (Ext.isIE6) {
+ add('ie6');
+ } else {
+ add('ie7p');
+
+ if (Ext.isIE7) {
+ add('ie7');
+ } else {
+ add('ie8p');
+
+ if (Ext.isIE8) {
+ add('ie8');
+ } else {
+ add('ie9p');
+
+ if (Ext.isIE9) {
+ add('ie9');
+ }
+ }
+ }
+ }
+
+ if (Ext.isIE6 || Ext.isIE7) {
+ add('ie7m');
+ }
+ if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8) {
+ add('ie8m');
+ }
+ if (Ext.isIE7 || Ext.isIE8) {
+ add('ie78');
+ }
+ }
+ if (Ext.isGecko) {
+ add('gecko');
+ if (Ext.isGecko3) {
+ add('gecko3');
+ }
+ if (Ext.isGecko4) {
+ add('gecko4');
+ }
+ if (Ext.isGecko5) {
+ add('gecko5');
+ }
+ }
+ if (Ext.isOpera) {
+ add('opera');
+ }
+ if (Ext.isWebKit) {
+ add('webkit');
+ }
+ if (Ext.isSafari) {
+ add('safari');
+ if (Ext.isSafari2) {
+ add('safari2');
+ }
+ if (Ext.isSafari3) {
+ add('safari3');
+ }
+ if (Ext.isSafari4) {
+ add('safari4');
+ }
+ if (Ext.isSafari5) {
+ add('safari5');
+ }
+ }
+ if (Ext.isChrome) {
+ add('chrome');
+ }
+ if (Ext.isMac) {
+ add('mac');
+ }
+ if (Ext.isLinux) {
+ add('linux');
+ }
+ if (!Ext.supports.CSS3BorderRadius) {
+ add('nbr');
+ }
+ if (!Ext.supports.CSS3LinearGradient) {
+ add('nlg');
+ }
+ if (!Ext.scopeResetCSS) {
+ add('reset');
+ }
+
+
+ if (html) {
+ if (Ext.isStrict && (Ext.isIE6 || Ext.isIE7)) {
+ Ext.isBorderBox = false;
+ }
+ else {
+ Ext.isBorderBox = true;
+ }
+
+ htmlCls.push(baseCSSPrefix + (Ext.isBorderBox ? 'border-box' : 'strict'));
+ if (!Ext.isStrict) {
+ htmlCls.push(baseCSSPrefix + 'quirks');
+ }
+ Ext.fly(html, '_internal').addCls(htmlCls);
+ }
+
+ Ext.fly(bd, '_internal').addCls(cls);
+ return true;
+ };
+
+ Ext.onReady(initExtCss);
+})();
+
+
+Ext.define('Ext.EventObjectImpl', {
+ uses: ['Ext.util.Point'],
+
+
+ BACKSPACE: 8,
+
+ TAB: 9,
+
+ NUM_CENTER: 12,
+
+ ENTER: 13,
+
+ RETURN: 13,
+
+ SHIFT: 16,
+
+ CTRL: 17,
+
+ ALT: 18,
+
+ PAUSE: 19,
+
+ CAPS_LOCK: 20,
+
+ ESC: 27,
+
+ SPACE: 32,
+
+ PAGE_UP: 33,
+
+ PAGE_DOWN: 34,
+
+ END: 35,
+
+ HOME: 36,
+
+ LEFT: 37,
+
+ UP: 38,
+
+ RIGHT: 39,
+
+ DOWN: 40,
+
+ PRINT_SCREEN: 44,
+
+ INSERT: 45,
+
+ DELETE: 46,
+
+ ZERO: 48,
+
+ ONE: 49,
+
+ TWO: 50,
+
+ THREE: 51,
+
+ FOUR: 52,
+
+ FIVE: 53,
+
+ SIX: 54,
+
+ SEVEN: 55,
+
+ EIGHT: 56,
+
+ NINE: 57,
+
+ A: 65,
+
+ B: 66,
+
+ C: 67,
+
+ D: 68,
+
+ E: 69,
+
+ F: 70,
+
+ G: 71,
+
+ H: 72,
+
+ I: 73,
+
+ J: 74,
+
+ K: 75,
+
+ L: 76,
+
+ M: 77,
+
+ N: 78,
+
+ O: 79,
+
+ P: 80,
+
+ Q: 81,
+
+ R: 82,
+
+ S: 83,
+
+ T: 84,
+
+ U: 85,
+
+ V: 86,
+
+ W: 87,
+
+ X: 88,
+
+ Y: 89,
+
+ Z: 90,
+
+ CONTEXT_MENU: 93,
+
+ NUM_ZERO: 96,
+
+ NUM_ONE: 97,
+
+ NUM_TWO: 98,
+
+ NUM_THREE: 99,
+
+ NUM_FOUR: 100,
+
+ NUM_FIVE: 101,
+
+ NUM_SIX: 102,
+
+ NUM_SEVEN: 103,
+
+ NUM_EIGHT: 104,
+
+ NUM_NINE: 105,
+
+ NUM_MULTIPLY: 106,
+
+ NUM_PLUS: 107,
+
+ NUM_MINUS: 109,
+
+ NUM_PERIOD: 110,
+
+ NUM_DIVISION: 111,
+
+ F1: 112,
+
+ F2: 113,
+
+ F3: 114,
+
+ F4: 115,
+
+ F5: 116,
+
+ F6: 117,
+
+ F7: 118,
+
+ F8: 119,
+
+ F9: 120,
+
+ F10: 121,
+
+ F11: 122,
+
+ F12: 123,
+
+ WHEEL_SCALE: (function () {
+ var scale;
+
+ if (Ext.isGecko) {
+
+ scale = 3;
+ } else if (Ext.isMac) {
+
+
+
+
+ if (Ext.isSafari && Ext.webKitVersion >= 532.0) {
+
+
+
+
+
+
+ scale = 120;
+ } else {
+
+
+ scale = 12;
+ }
+
+
+
+
+
+ scale *= 3;
+ } else {
+
+ scale = 120;
+ }
+
+ return scale;
+ })(),
+
+
+ clickRe: /(dbl)?click/,
+
+ safariKeys: {
+ 3: 13,
+ 63234: 37,
+ 63235: 39,
+ 63232: 38,
+ 63233: 40,
+ 63276: 33,
+ 63277: 34,
+ 63272: 46,
+ 63273: 36,
+ 63275: 35
+ },
+
+ btnMap: Ext.isIE ? {
+ 1: 0,
+ 4: 1,
+ 2: 2
+ } : {
+ 0: 0,
+ 1: 1,
+ 2: 2
+ },
+
+ constructor: function(event, freezeEvent){
+ if (event) {
+ this.setEvent(event.browserEvent || event, freezeEvent);
+ }
+ },
+
+ setEvent: function(event, freezeEvent){
+ var me = this, button, options;
+
+ if (event == me || (event && event.browserEvent)) {
+ return event;
+ }
+ me.browserEvent = event;
+ if (event) {
+
+ button = event.button ? me.btnMap[event.button] : (event.which ? event.which - 1 : -1);
+ if (me.clickRe.test(event.type) && button == -1) {
+ button = 0;
+ }
+ options = {
+ type: event.type,
+ button: button,
+ shiftKey: event.shiftKey,
+
+ ctrlKey: event.ctrlKey || event.metaKey || false,
+ altKey: event.altKey,
+
+ keyCode: event.keyCode,
+ charCode: event.charCode,
+
+ target: Ext.EventManager.getTarget(event),
+ relatedTarget: Ext.EventManager.getRelatedTarget(event),
+ currentTarget: event.currentTarget,
+ xy: (freezeEvent ? me.getXY() : null)
+ };
+ } else {
+ options = {
+ button: -1,
+ shiftKey: false,
+ ctrlKey: false,
+ altKey: false,
+ keyCode: 0,
+ charCode: 0,
+ target: null,
+ xy: [0, 0]
+ };
+ }
+ Ext.apply(me, options);
+ return me;
+ },
+
+
+ stopEvent: function(){
+ this.stopPropagation();
+ this.preventDefault();
+ },
+
+
+ preventDefault: function(){
+ if (this.browserEvent) {
+ Ext.EventManager.preventDefault(this.browserEvent);
+ }
+ },
+
+
+ stopPropagation: function(){
+ var browserEvent = this.browserEvent;
+
+ if (browserEvent) {
+ if (browserEvent.type == 'mousedown') {
+ Ext.EventManager.stoppedMouseDownEvent.fire(this);
+ }
+ Ext.EventManager.stopPropagation(browserEvent);
+ }
+ },
+
+
+ getCharCode: function(){
+ return this.charCode || this.keyCode;
+ },
+
+
+ getKey: function(){
+ return this.normalizeKey(this.keyCode || this.charCode);
+ },
+
+
+ normalizeKey: function(key){
+
+ return Ext.isWebKit ? (this.safariKeys[key] || key) : key;
+ },
+
+
+ getPageX: function(){
+ return this.getX();
+ },
+
+
+ getPageY: function(){
+ return this.getY();
+ },
+
+
+ getX: function() {
+ return this.getXY()[0];
+ },
+
+
+ getY: function() {
+ return this.getXY()[1];
+ },
+
+
+ getXY: function() {
+ if (!this.xy) {
+
+ this.xy = Ext.EventManager.getPageXY(this.browserEvent);
+ }
+ return this.xy;
+ },
+
+
+ getTarget : function(selector, maxDepth, returnEl){
+ if (selector) {
+ return Ext.fly(this.target).findParent(selector, maxDepth, returnEl);
+ }
+ return returnEl ? Ext.get(this.target) : this.target;
+ },
+
+
+ getRelatedTarget : function(selector, maxDepth, returnEl){
+ if (selector) {
+ return Ext.fly(this.relatedTarget).findParent(selector, maxDepth, returnEl);
+ }
+ return returnEl ? Ext.get(this.relatedTarget) : this.relatedTarget;
+ },
+
+
+ correctWheelDelta : function (delta) {
+ var scale = this.WHEEL_SCALE,
+ ret = Math.round(delta / scale);
+
+ if (!ret && delta) {
+ ret = (delta < 0) ? -1 : 1;
+ }
+
+ return ret;
+ },
+
+
+ getWheelDeltas : function () {
+ var me = this,
+ event = me.browserEvent,
+ dx = 0, dy = 0;
+
+ if (Ext.isDefined(event.wheelDeltaX)) {
+ dx = event.wheelDeltaX;
+ dy = event.wheelDeltaY;
+ } else if (event.wheelDelta) {
+ dy = event.wheelDelta;
+ } else if (event.detail) {
+ dy = -event.detail;
+
+
+
+ if (dy > 100) {
+ dy = 3;
+ } else if (dy < -100) {
+ dy = -3;
+ }
+
+
+
+ if (Ext.isDefined(event.axis) && event.axis === event.HORIZONTAL_AXIS) {
+ dx = dy;
+ dy = 0;
+ }
+ }
+
+ return {
+ x: me.correctWheelDelta(dx),
+ y: me.correctWheelDelta(dy)
+ };
+ },
+
+
+ getWheelDelta : function(){
+ var deltas = this.getWheelDeltas();
+
+ return deltas.y;
+ },
+
+
+ within : function(el, related, allowEl){
+ if(el){
+ var t = related ? this.getRelatedTarget() : this.getTarget(),
+ result;
+
+ if (t) {
+ result = Ext.fly(el).contains(t);
+ if (!result && allowEl) {
+ result = t == Ext.getDom(el);
+ }
+ return result;
+ }
+ }
+ return false;
+ },
+
+
+ isNavKeyPress : function(){
+ var me = this,
+ k = this.normalizeKey(me.keyCode);
+
+ return (k >= 33 && k <= 40) ||
+ k == me.RETURN ||
+ k == me.TAB ||
+ k == me.ESC;
+ },
+
+
+ isSpecialKey : function(){
+ var k = this.normalizeKey(this.keyCode);
+ return (this.type == 'keypress' && this.ctrlKey) ||
+ this.isNavKeyPress() ||
+ (k == this.BACKSPACE) ||
+ (k >= 16 && k <= 20) ||
+ (k >= 44 && k <= 46);
+ },
+
+
+ getPoint : function(){
+ var xy = this.getXY();
+ return Ext.create('Ext.util.Point', xy[0], xy[1]);
+ },
+
+
+ hasModifier : function(){
+ return this.ctrlKey || this.altKey || this.shiftKey || this.metaKey;
+ },
+
+
+ injectEvent: function () {
+ var API,
+ dispatchers = {};
+
+
+
+
+
+
+ if (!Ext.isIE && document.createEvent) {
+ API = {
+ createHtmlEvent: function (doc, type, bubbles, cancelable) {
+ var event = doc.createEvent('HTMLEvents');
+
+ event.initEvent(type, bubbles, cancelable);
+ return event;
+ },
+
+ createMouseEvent: function (doc, type, bubbles, cancelable, detail,
+ clientX, clientY, ctrlKey, altKey, shiftKey, metaKey,
+ button, relatedTarget) {
+ var event = doc.createEvent('MouseEvents'),
+ view = doc.defaultView || window;
+
+ if (event.initMouseEvent) {
+ event.initMouseEvent(type, bubbles, cancelable, view, detail,
+ clientX, clientY, clientX, clientY, ctrlKey, altKey,
+ shiftKey, metaKey, button, relatedTarget);
+ } else {
+ event = doc.createEvent('UIEvents');
+ event.initEvent(type, bubbles, cancelable);
+ event.view = view;
+ event.detail = detail;
+ event.screenX = clientX;
+ event.screenY = clientY;
+ event.clientX = clientX;
+ event.clientY = clientY;
+ event.ctrlKey = ctrlKey;
+ event.altKey = altKey;
+ event.metaKey = metaKey;
+ event.shiftKey = shiftKey;
+ event.button = button;
+ event.relatedTarget = relatedTarget;
+ }
+
+ return event;
+ },
+
+ createUIEvent: function (doc, type, bubbles, cancelable, detail) {
+ var event = doc.createEvent('UIEvents'),
+ view = doc.defaultView || window;
+
+ event.initUIEvent(type, bubbles, cancelable, view, detail);
+ return event;
+ },
+
+ fireEvent: function (target, type, event) {
+ target.dispatchEvent(event);
+ },
+
+ fixTarget: function (target) {
+
+ if (target == window && !target.dispatchEvent) {
+ return document;
+ }
+
+ return target;
+ }
+ };
+ } else if (document.createEventObject) {
+ var crazyIEButtons = { 0: 1, 1: 4, 2: 2 };
+
+ API = {
+ createHtmlEvent: function (doc, type, bubbles, cancelable) {
+ var event = doc.createEventObject();
+ event.bubbles = bubbles;
+ event.cancelable = cancelable;
+ return event;
+ },
+
+ createMouseEvent: function (doc, type, bubbles, cancelable, detail,
+ clientX, clientY, ctrlKey, altKey, shiftKey, metaKey,
+ button, relatedTarget) {
+ var event = doc.createEventObject();
+ event.bubbles = bubbles;
+ event.cancelable = cancelable;
+ event.detail = detail;
+ event.screenX = clientX;
+ event.screenY = clientY;
+ event.clientX = clientX;
+ event.clientY = clientY;
+ event.ctrlKey = ctrlKey;
+ event.altKey = altKey;
+ event.shiftKey = shiftKey;
+ event.metaKey = metaKey;
+ event.button = crazyIEButtons[button] || button;
+ event.relatedTarget = relatedTarget;
+ return event;
+ },
+
+ createUIEvent: function (doc, type, bubbles, cancelable, detail) {
+ var event = doc.createEventObject();
+ event.bubbles = bubbles;
+ event.cancelable = cancelable;
+ return event;
+ },
+
+ fireEvent: function (target, type, event) {
+ target.fireEvent('on' + type, event);
+ },
+
+ fixTarget: function (target) {
+ if (target == document) {
+
+
+ return document.documentElement;
+ }
+
+ return target;
+ }
+ };
+ }
+
+
+
+
+ Ext.Object.each({
+ load: [false, false],
+ unload: [false, false],
+ select: [true, false],
+ change: [true, false],
+ submit: [true, true],
+ reset: [true, false],
+ resize: [true, false],
+ scroll: [true, false]
+ },
+ function (name, value) {
+ var bubbles = value[0], cancelable = value[1];
+ dispatchers[name] = function (targetEl, srcEvent) {
+ var e = API.createHtmlEvent(name, bubbles, cancelable);
+ API.fireEvent(targetEl, name, e);
+ };
+ });
+
+
+
+
+ function createMouseEventDispatcher (type, detail) {
+ var cancelable = (type != 'mousemove');
+ return function (targetEl, srcEvent) {
+ var xy = srcEvent.getXY(),
+ e = API.createMouseEvent(targetEl.ownerDocument, type, true, cancelable,
+ detail, xy[0], xy[1], srcEvent.ctrlKey, srcEvent.altKey,
+ srcEvent.shiftKey, srcEvent.metaKey, srcEvent.button,
+ srcEvent.relatedTarget);
+ API.fireEvent(targetEl, type, e);
+ };
+ }
+
+ Ext.each(['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mousemove', 'mouseout'],
+ function (eventName) {
+ dispatchers[eventName] = createMouseEventDispatcher(eventName, 1);
+ });
+
+
+
+
+ Ext.Object.each({
+ focusin: [true, false],
+ focusout: [true, false],
+ activate: [true, true],
+ focus: [false, false],
+ blur: [false, false]
+ },
+ function (name, value) {
+ var bubbles = value[0], cancelable = value[1];
+ dispatchers[name] = function (targetEl, srcEvent) {
+ var e = API.createUIEvent(targetEl.ownerDocument, name, bubbles, cancelable, 1);
+ API.fireEvent(targetEl, name, e);
+ };
+ });
+
+
+ if (!API) {
+
+
+ dispatchers = {};
+
+ API = {
+ fixTarget: function (t) {
+ return t;
+ }
+ };
+ }
+
+ function cannotInject (target, srcEvent) {
+ }
+
+ return function (target) {
+ var me = this,
+ dispatcher = dispatchers[me.type] || cannotInject,
+ t = target ? (target.dom || target) : me.getTarget();
+
+ t = API.fixTarget(t);
+ dispatcher(t, me);
+ };
+ }()
+
+}, function() {
+
+Ext.EventObject = new Ext.EventObjectImpl();
+
+});
+
+
+
+(function(){
+ var doc = document,
+ activeElement = null,
+ isCSS1 = doc.compatMode == "CSS1Compat",
+ ELEMENT = Ext.Element,
+ fly = function(el){
+ if (!_fly) {
+ _fly = new Ext.Element.Flyweight();
+ }
+ _fly.dom = el;
+ return _fly;
+ }, _fly;
+
+
+
+
+ if (!('activeElement' in doc) && doc.addEventListener) {
+ doc.addEventListener('focus',
+ function (ev) {
+ if (ev && ev.target) {
+ activeElement = (ev.target == doc) ? null : ev.target;
+ }
+ }, true);
+ }
+
+
+ function makeSelectionRestoreFn (activeEl, start, end) {
+ return function () {
+ activeEl.selectionStart = start;
+ activeEl.selectionEnd = end;
+ };
+ }
+
+ Ext.apply(ELEMENT, {
+ isAncestor : function(p, c) {
+ var ret = false;
+
+ p = Ext.getDom(p);
+ c = Ext.getDom(c);
+ if (p && c) {
+ if (p.contains) {
+ return p.contains(c);
+ } else if (p.compareDocumentPosition) {
+ return !!(p.compareDocumentPosition(c) & 16);
+ } else {
+ while ((c = c.parentNode)) {
+ ret = c == p || ret;
+ }
+ }
+ }
+ return ret;
+ },
+
+
+ getActiveElement: function () {
+ return doc.activeElement || activeElement;
+ },
+
+
+ getRightMarginFixCleaner: function (target) {
+ var supports = Ext.supports,
+ hasInputBug = supports.DisplayChangeInputSelectionBug,
+ hasTextAreaBug = supports.DisplayChangeTextAreaSelectionBug;
+
+ if (hasInputBug || hasTextAreaBug) {
+ var activeEl = doc.activeElement || activeElement,
+ tag = activeEl && activeEl.tagName,
+ start,
+ end;
+
+ if ((hasTextAreaBug && tag == 'TEXTAREA') ||
+ (hasInputBug && tag == 'INPUT' && activeEl.type == 'text')) {
+ if (ELEMENT.isAncestor(target, activeEl)) {
+ start = activeEl.selectionStart;
+ end = activeEl.selectionEnd;
+
+ if (Ext.isNumber(start) && Ext.isNumber(end)) {
+
+
+
+
+ return makeSelectionRestoreFn(activeEl, start, end);
+ }
+ }
+ }
+ }
+
+ return Ext.emptyFn;
+ },
+
+ getViewWidth : function(full) {
+ return full ? ELEMENT.getDocumentWidth() : ELEMENT.getViewportWidth();
+ },
+
+ getViewHeight : function(full) {
+ return full ? ELEMENT.getDocumentHeight() : ELEMENT.getViewportHeight();
+ },
+
+ getDocumentHeight: function() {
+ return Math.max(!isCSS1 ? doc.body.scrollHeight : doc.documentElement.scrollHeight, ELEMENT.getViewportHeight());
+ },
+
+ getDocumentWidth: function() {
+ return Math.max(!isCSS1 ? doc.body.scrollWidth : doc.documentElement.scrollWidth, ELEMENT.getViewportWidth());
+ },
+
+ getViewportHeight: function(){
+ return Ext.isIE ?
+ (Ext.isStrict ? doc.documentElement.clientHeight : doc.body.clientHeight) :
+ self.innerHeight;
+ },
+
+ getViewportWidth : function() {
+ return (!Ext.isStrict && !Ext.isOpera) ? doc.body.clientWidth :
+ Ext.isIE ? doc.documentElement.clientWidth : self.innerWidth;
+ },
+
+ getY : function(el) {
+ return ELEMENT.getXY(el)[1];
+ },
+
+ getX : function(el) {
+ return ELEMENT.getXY(el)[0];
+ },
+
+ getOffsetParent: function (el) {
+ el = Ext.getDom(el);
+ try {
+
+ return el.offsetParent;
+ } catch (e) {
+ var body = document.body;
+ return (el == body) ? null : body;
+ }
+ },
+
+ getXY : function(el) {
+ var p,
+ pe,
+ b,
+ bt,
+ bl,
+ dbd,
+ x = 0,
+ y = 0,
+ scroll,
+ hasAbsolute,
+ bd = (doc.body || doc.documentElement),
+ ret;
+
+ el = Ext.getDom(el);
+
+ if(el != bd){
+ hasAbsolute = fly(el).isStyle("position", "absolute");
+
+ if (el.getBoundingClientRect) {
+ try {
+ b = el.getBoundingClientRect();
+ scroll = fly(document).getScroll();
+ ret = [ Math.round(b.left + scroll.left), Math.round(b.top + scroll.top) ];
+ } catch (e) {
+
+ }
+ }
+
+ if (!ret) {
+ for (p = el; p; p = ELEMENT.getOffsetParent(p)) {
+ pe = fly(p);
+ x += p.offsetLeft;
+ y += p.offsetTop;
+
+ hasAbsolute = hasAbsolute || pe.isStyle("position", "absolute");
+
+ if (Ext.isGecko) {
+ y += bt = parseInt(pe.getStyle("borderTopWidth"), 10) || 0;
+ x += bl = parseInt(pe.getStyle("borderLeftWidth"), 10) || 0;
+
+ if (p != el && !pe.isStyle('overflow','visible')) {
+ x += bl;
+ y += bt;
+ }
+ }
+ }
+
+ if (Ext.isSafari && hasAbsolute) {
+ x -= bd.offsetLeft;
+ y -= bd.offsetTop;
+ }
+
+ if (Ext.isGecko && !hasAbsolute) {
+ dbd = fly(bd);
+ x += parseInt(dbd.getStyle("borderLeftWidth"), 10) || 0;
+ y += parseInt(dbd.getStyle("borderTopWidth"), 10) || 0;
+ }
+
+ p = el.parentNode;
+ while (p && p != bd) {
+ if (!Ext.isOpera || (p.tagName != 'TR' && !fly(p).isStyle("display", "inline"))) {
+ x -= p.scrollLeft;
+ y -= p.scrollTop;
+ }
+ p = p.parentNode;
+ }
+ ret = [x,y];
+ }
+ }
+ return ret || [0,0];
+ },
+
+ setXY : function(el, xy) {
+ (el = Ext.fly(el, '_setXY')).position();
+
+ var pts = el.translatePoints(xy),
+ style = el.dom.style,
+ pos;
+
+ for (pos in pts) {
+ if (!isNaN(pts[pos])) {
+ style[pos] = pts[pos] + "px";
+ }
+ }
+ },
+
+ setX : function(el, x) {
+ ELEMENT.setXY(el, [x, false]);
+ },
+
+ setY : function(el, y) {
+ ELEMENT.setXY(el, [false, y]);
+ },
+
+
+ serializeForm: function(form) {
+ var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,
+ hasSubmit = false,
+ encoder = encodeURIComponent,
+ name,
+ data = '',
+ type,
+ hasValue;
+
+ Ext.each(fElements, function(element){
+ name = element.name;
+ type = element.type;
+
+ if (!element.disabled && name) {
+ if (/select-(one|multiple)/i.test(type)) {
+ Ext.each(element.options, function(opt){
+ if (opt.selected) {
+ hasValue = opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttributeNode('value').specified;
+ data += Ext.String.format("{0}={1}&", encoder(name), encoder(hasValue ? opt.value : opt.text));
+ }
+ });
+ } else if (!(/file|undefined|reset|button/i.test(type))) {
+ if (!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)) {
+ data += encoder(name) + '=' + encoder(element.value) + '&';
+ hasSubmit = /submit/i.test(type);
+ }
+ }
+ }
+ });
+ return data.substr(0, data.length - 1);
+ }
+ });
+})();
+
+
+
+Ext.Element.addMethods((function(){
+ var focusRe = /button|input|textarea|select|object/;
+ return {
+
+ monitorMouseLeave: function(delay, handler, scope) {
+ var me = this,
+ timer,
+ listeners = {
+ mouseleave: function(e) {
+ timer = setTimeout(Ext.Function.bind(handler, scope||me, [e]), delay);
+ },
+ mouseenter: function() {
+ clearTimeout(timer);
+ },
+ freezeEvent: true
+ };
+
+ me.on(listeners);
+ return listeners;
+ },
+
+
+ swallowEvent : function(eventName, preventDefault) {
+ var me = this;
+ function fn(e) {
+ e.stopPropagation();
+ if (preventDefault) {
+ e.preventDefault();
+ }
+ }
+
+ if (Ext.isArray(eventName)) {
+ Ext.each(eventName, function(e) {
+ me.on(e, fn);
+ });
+ return me;
+ }
+ me.on(eventName, fn);
+ return me;
+ },
+
+
+ relayEvent : function(eventName, observable) {
+ this.on(eventName, function(e) {
+ observable.fireEvent(eventName, e);
+ });
+ },
+
+
+ clean : function(forceReclean) {
+ var me = this,
+ dom = me.dom,
+ n = dom.firstChild,
+ nx,
+ ni = -1;
+
+ if (Ext.Element.data(dom, 'isCleaned') && forceReclean !== true) {
+ return me;
+ }
+
+ while (n) {
+ nx = n.nextSibling;
+ if (n.nodeType == 3) {
+
+ if (!(/\S/.test(n.nodeValue))) {
+ dom.removeChild(n);
+
+ } else if (nx && nx.nodeType == 3) {
+ n.appendData(Ext.String.trim(nx.data));
+ dom.removeChild(nx);
+ nx = n.nextSibling;
+ n.nodeIndex = ++ni;
+ }
+ } else {
+
+ Ext.fly(n).clean();
+ n.nodeIndex = ++ni;
+ }
+ n = nx;
+ }
+
+ Ext.Element.data(dom, 'isCleaned', true);
+ return me;
+ },
+
+
+ load : function(options) {
+ this.getLoader().load(options);
+ return this;
+ },
+
+
+ getLoader : function() {
+ var dom = this.dom,
+ data = Ext.Element.data,
+ loader = data(dom, 'loader');
+
+ if (!loader) {
+ loader = Ext.create('Ext.ElementLoader', {
+ target: this
+ });
+ data(dom, 'loader', loader);
+ }
+ return loader;
+ },
+
+
+ update : function(html, loadScripts, callback) {
+ var me = this,
+ id,
+ dom,
+ interval;
+
+ if (!me.dom) {
+ return me;
+ }
+ html = html || '';
+ dom = me.dom;
+
+ if (loadScripts !== true) {
+ dom.innerHTML = html;
+ Ext.callback(callback, me);
+ return me;
+ }
+
+ id = Ext.id();
+ html += '';
+
+ interval = setInterval(function(){
+ if (!document.getElementById(id)) {
+ return false;
+ }
+ clearInterval(interval);
+ var DOC = document,
+ hd = DOC.getElementsByTagName("head")[0],
+ re = /(?: