+++ /dev/null
-/*\r
- * Ext JS Library 2.2.1\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
- */\r
-\r
-\r
-Ext.DomHelper = function(){\r
- var tempTableEl = null;\r
- var emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;\r
- var tableRe = /^table|tbody|tr|td$/i;\r
-\r
- // build as innerHTML where available\r
- var createHtml = function(o){\r
- if(typeof o == 'string'){\r
- return o;\r
- }\r
- var b = "";\r
- if (Ext.isArray(o)) {\r
- for (var i = 0, l = o.length; i < l; i++) {\r
- b += createHtml(o[i]);\r
- }\r
- return b;\r
- }\r
- if(!o.tag){\r
- o.tag = "div";\r
- }\r
- b += "<" + o.tag;\r
- for(var attr in o){\r
- if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || typeof o[attr] == "function") continue;\r
- if(attr == "style"){\r
- var s = o["style"];\r
- if(typeof s == "function"){\r
- s = s.call();\r
- }\r
- if(typeof s == "string"){\r
- b += ' style="' + s + '"';\r
- }else if(typeof s == "object"){\r
- b += ' style="';\r
- for(var key in s){\r
- if(typeof s[key] != "function"){\r
- b += key + ":" + s[key] + ";";\r
- }\r
- }\r
- b += '"';\r
- }\r
- }else{\r
- if(attr == "cls"){\r
- b += ' class="' + o["cls"] + '"';\r
- }else if(attr == "htmlFor"){\r
- b += ' for="' + o["htmlFor"] + '"';\r
- }else{\r
- b += " " + attr + '="' + o[attr] + '"';\r
- }\r
- }\r
- }\r
- if(emptyTags.test(o.tag)){\r
- b += "/>";\r
- }else{\r
- b += ">";\r
- var cn = o.children || o.cn;\r
- if(cn){\r
- b += createHtml(cn);\r
- } else if(o.html){\r
- b += o.html;\r
- }\r
- b += "</" + o.tag + ">";\r
- }\r
- return b;\r
- };\r
-\r
- // build as dom\r
- \r
- var createDom = function(o, parentNode){\r
- var el;\r
- if (Ext.isArray(o)) { // Allow Arrays of siblings to be inserted\r
- el = document.createDocumentFragment(); // in one shot using a DocumentFragment\r
- for(var i = 0, l = o.length; i < l; i++) {\r
- createDom(o[i], el);\r
- }\r
- } else if (typeof o == "string") { // Allow a string as a child spec.\r
- el = document.createTextNode(o);\r
- } else {\r
- el = document.createElement(o.tag||'div');\r
- var useSet = !!el.setAttribute; // In IE some elements don't have setAttribute\r
- for(var attr in o){\r
- if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || attr == "style" || typeof o[attr] == "function") continue;\r
- if(attr=="cls"){\r
- el.className = o["cls"];\r
- }else{\r
- if(useSet) el.setAttribute(attr, o[attr]);\r
- else el[attr] = o[attr];\r
- }\r
- }\r
- Ext.DomHelper.applyStyles(el, o.style);\r
- var cn = o.children || o.cn;\r
- if(cn){\r
- createDom(cn, el);\r
- } else if(o.html){\r
- el.innerHTML = o.html;\r
- }\r
- }\r
- if(parentNode){\r
- parentNode.appendChild(el);\r
- }\r
- return el;\r
- };\r
-\r
- var ieTable = function(depth, s, h, e){\r
- tempTableEl.innerHTML = [s, h, e].join('');\r
- var i = -1, el = tempTableEl;\r
- while(++i < depth){\r
- el = el.firstChild;\r
- }\r
- return el;\r
- };\r
-\r
- // kill repeat to save bytes\r
- var ts = '<table>',\r
- te = '</table>',\r
- tbs = ts+'<tbody>',\r
- tbe = '</tbody>'+te,\r
- trs = tbs + '<tr>',\r
- tre = '</tr>'+tbe;\r
-\r
- \r
- var insertIntoTable = function(tag, where, el, html){\r
- if(!tempTableEl){\r
- tempTableEl = document.createElement('div');\r
- }\r
- var node;\r
- var before = null;\r
- if(tag == 'td'){\r
- if(where == 'afterbegin' || where == 'beforeend'){ // INTO a TD\r
- return;\r
- }\r
- if(where == 'beforebegin'){\r
- before = el;\r
- el = el.parentNode;\r
- } else{\r
- before = el.nextSibling;\r
- el = el.parentNode;\r
- }\r
- node = ieTable(4, trs, html, tre);\r
- }\r
- else if(tag == 'tr'){\r
- if(where == 'beforebegin'){\r
- before = el;\r
- el = el.parentNode;\r
- node = ieTable(3, tbs, html, tbe);\r
- } else if(where == 'afterend'){\r
- before = el.nextSibling;\r
- el = el.parentNode;\r
- node = ieTable(3, tbs, html, tbe);\r
- } else{ // INTO a TR\r
- if(where == 'afterbegin'){\r
- before = el.firstChild;\r
- }\r
- node = ieTable(4, trs, html, tre);\r
- }\r
- } else if(tag == 'tbody'){\r
- if(where == 'beforebegin'){\r
- before = el;\r
- el = el.parentNode;\r
- node = ieTable(2, ts, html, te);\r
- } else if(where == 'afterend'){\r
- before = el.nextSibling;\r
- el = el.parentNode;\r
- node = ieTable(2, ts, html, te);\r
- } else{\r
- if(where == 'afterbegin'){\r
- before = el.firstChild;\r
- }\r
- node = ieTable(3, tbs, html, tbe);\r
- }\r
- } else{ // TABLE\r
- if(where == 'beforebegin' || where == 'afterend'){ // OUTSIDE the table\r
- return;\r
- }\r
- if(where == 'afterbegin'){\r
- before = el.firstChild;\r
- }\r
- node = ieTable(2, ts, html, te);\r
- }\r
- el.insertBefore(node, before);\r
- return node;\r
- };\r
-\r
-\r
- return {\r
- \r
- useDom : false,\r
-\r
- \r
- markup : function(o){\r
- return createHtml(o);\r
- },\r
-\r
- \r
- applyStyles : function(el, styles){\r
- if(styles){\r
- el = Ext.fly(el);\r
- if(typeof styles == "string"){\r
- var re = /\s?([a-z\-]*)\:\s?([^;]*);?/gi;\r
- var matches;\r
- while ((matches = re.exec(styles)) != null){\r
- el.setStyle(matches[1], matches[2]);\r
- }\r
- }else if (typeof styles == "object"){\r
- for (var style in styles){\r
- el.setStyle(style, styles[style]);\r
- }\r
- }else if (typeof styles == "function"){\r
- Ext.DomHelper.applyStyles(el, styles.call());\r
- }\r
- }\r
- },\r
-\r
- \r
- insertHtml : function(where, el, html){\r
- where = where.toLowerCase();\r
- if(el.insertAdjacentHTML){\r
- if(tableRe.test(el.tagName)){\r
- var rs;\r
- if(rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html)){\r
- return rs;\r
- }\r
- }\r
- switch(where){\r
- case "beforebegin":\r
- el.insertAdjacentHTML('BeforeBegin', html);\r
- return el.previousSibling;\r
- case "afterbegin":\r
- el.insertAdjacentHTML('AfterBegin', html);\r
- return el.firstChild;\r
- case "beforeend":\r
- el.insertAdjacentHTML('BeforeEnd', html);\r
- return el.lastChild;\r
- case "afterend":\r
- el.insertAdjacentHTML('AfterEnd', html);\r
- return el.nextSibling;\r
- }\r
- throw 'Illegal insertion point -> "' + where + '"';\r
- }\r
- var range = el.ownerDocument.createRange();\r
- var frag;\r
- switch(where){\r
- case "beforebegin":\r
- range.setStartBefore(el);\r
- frag = range.createContextualFragment(html);\r
- el.parentNode.insertBefore(frag, el);\r
- return el.previousSibling;\r
- case "afterbegin":\r
- if(el.firstChild){\r
- range.setStartBefore(el.firstChild);\r
- frag = range.createContextualFragment(html);\r
- el.insertBefore(frag, el.firstChild);\r
- return el.firstChild;\r
- }else{\r
- el.innerHTML = html;\r
- return el.firstChild;\r
- }\r
- case "beforeend":\r
- if(el.lastChild){\r
- range.setStartAfter(el.lastChild);\r
- frag = range.createContextualFragment(html);\r
- el.appendChild(frag);\r
- return el.lastChild;\r
- }else{\r
- el.innerHTML = html;\r
- return el.lastChild;\r
- }\r
- case "afterend":\r
- range.setStartAfter(el);\r
- frag = range.createContextualFragment(html);\r
- el.parentNode.insertBefore(frag, el.nextSibling);\r
- return el.nextSibling;\r
- }\r
- throw 'Illegal insertion point -> "' + where + '"';\r
- },\r
-\r
- \r
- insertBefore : function(el, o, returnElement){\r
- return this.doInsert(el, o, returnElement, "beforeBegin");\r
- },\r
-\r
- \r
- insertAfter : function(el, o, returnElement){\r
- return this.doInsert(el, o, returnElement, "afterEnd", "nextSibling");\r
- },\r
-\r
- \r
- insertFirst : function(el, o, returnElement){\r
- return this.doInsert(el, o, returnElement, "afterBegin", "firstChild");\r
- },\r
-\r
- // private\r
- doInsert : function(el, o, returnElement, pos, sibling){\r
- el = Ext.getDom(el);\r
- var newNode;\r
- if(this.useDom){\r
- newNode = createDom(o, null);\r
- (sibling === "firstChild" ? el : el.parentNode).insertBefore(newNode, sibling ? el[sibling] : el);\r
- }else{\r
- var html = createHtml(o);\r
- newNode = this.insertHtml(pos, el, html);\r
- }\r
- return returnElement ? Ext.get(newNode, true) : newNode;\r
- },\r
-\r
- \r
- append : function(el, o, returnElement){\r
- el = Ext.getDom(el);\r
- var newNode;\r
- if(this.useDom){\r
- newNode = createDom(o, null);\r
- el.appendChild(newNode);\r
- }else{\r
- var html = createHtml(o);\r
- newNode = this.insertHtml("beforeEnd", el, html);\r
- }\r
- return returnElement ? Ext.get(newNode, true) : newNode;\r
- },\r
-\r
- \r
- overwrite : function(el, o, returnElement){\r
- el = Ext.getDom(el);\r
- el.innerHTML = createHtml(o);\r
- return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;\r
- },\r
-\r
- \r
- createTemplate : function(o){\r
- var html = createHtml(o);\r
- return new Ext.Template(html);\r
- }\r
- };\r
-}();\r
-\r
-\r
-Ext.Template = function(html){\r
- var a = arguments;\r
- if(Ext.isArray(html)){\r
- html = html.join("");\r
- }else if(a.length > 1){\r
- var buf = [];\r
- for(var i = 0, len = a.length; i < len; i++){\r
- if(typeof a[i] == 'object'){\r
- Ext.apply(this, a[i]);\r
- }else{\r
- buf[buf.length] = a[i];\r
- }\r
- }\r
- html = buf.join('');\r
- }\r
- \r
- this.html = html;\r
- if(this.compiled){\r
- this.compile();\r
- }\r
-};\r
-Ext.Template.prototype = {\r
- \r
- applyTemplate : function(values){\r
- if(this.compiled){\r
- return this.compiled(values);\r
- }\r
- var useF = this.disableFormats !== true;\r
- var fm = Ext.util.Format, tpl = this;\r
- var fn = function(m, name, format, args){\r
- if(format && useF){\r
- if(format.substr(0, 5) == "this."){\r
- return tpl.call(format.substr(5), values[name], values);\r
- }else{\r
- if(args){\r
- // quoted values are required for strings in compiled templates,\r
- // but for non compiled we need to strip them\r
- // quoted reversed for jsmin\r
- var re = /^\s*['"](.*)["']\s*$/;\r
- args = args.split(',');\r
- for(var i = 0, len = args.length; i < len; i++){\r
- args[i] = args[i].replace(re, "$1");\r
- }\r
- args = [values[name]].concat(args);\r
- }else{\r
- args = [values[name]];\r
- }\r
- return fm[format].apply(fm, args);\r
- }\r
- }else{\r
- return values[name] !== undefined ? values[name] : "";\r
- }\r
- };\r
- return this.html.replace(this.re, fn);\r
- },\r
-\r
- \r
- set : function(html, compile){\r
- this.html = html;\r
- this.compiled = null;\r
- if(compile){\r
- this.compile();\r
- }\r
- return this;\r
- },\r
-\r
- \r
- disableFormats : false,\r
-\r
- \r
- re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,\r
-\r
- \r
- compile : function(){\r
- var fm = Ext.util.Format;\r
- var useF = this.disableFormats !== true;\r
- var sep = Ext.isGecko ? "+" : ",";\r
- var fn = function(m, name, format, args){\r
- if(format && useF){\r
- args = args ? ',' + args : "";\r
- if(format.substr(0, 5) != "this."){\r
- format = "fm." + format + '(';\r
- }else{\r
- format = 'this.call("'+ format.substr(5) + '", ';\r
- args = ", values";\r
- }\r
- }else{\r
- args= ''; format = "(values['" + name + "'] == undefined ? '' : ";\r
- }\r
- return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";\r
- };\r
- var body;\r
- // branched to use + in gecko and [].join() in others\r
- if(Ext.isGecko){\r
- body = "this.compiled = function(values){ return '" +\r
- this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +\r
- "';};";\r
- }else{\r
- body = ["this.compiled = function(values){ return ['"];\r
- body.push(this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));\r
- body.push("'].join('');};");\r
- body = body.join('');\r
- }\r
- eval(body);\r
- return this;\r
- },\r
-\r
- // private function used to call members\r
- call : function(fnName, value, allValues){\r
- return this[fnName](value, allValues);\r
- },\r
-\r
- \r
- insertFirst: function(el, values, returnElement){\r
- return this.doInsert('afterBegin', el, values, returnElement);\r
- },\r
-\r
- \r
- insertBefore: function(el, values, returnElement){\r
- return this.doInsert('beforeBegin', el, values, returnElement);\r
- },\r
-\r
- \r
- insertAfter : function(el, values, returnElement){\r
- return this.doInsert('afterEnd', el, values, returnElement);\r
- },\r
-\r
- \r
- append : function(el, values, returnElement){\r
- return this.doInsert('beforeEnd', el, values, returnElement);\r
- },\r
-\r
- doInsert : function(where, el, values, returnEl){\r
- el = Ext.getDom(el);\r
- var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values));\r
- return returnEl ? Ext.get(newNode, true) : newNode;\r
- },\r
-\r
- \r
- overwrite : function(el, values, returnElement){\r
- el = Ext.getDom(el);\r
- el.innerHTML = this.applyTemplate(values);\r
- return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;\r
- }\r
-};\r
-\r
-Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;\r
-\r
-// backwards compat\r
-Ext.DomHelper.Template = Ext.Template;\r
-\r
-\r
-Ext.Template.from = function(el, config){\r
- el = Ext.getDom(el);\r
- return new Ext.Template(el.value || el.innerHTML, config || '');\r
-};\r
-\r
-\r
-Ext.DomQuery = function(){\r
- var cache = {}, simpleCache = {}, valueCache = {};\r
- var nonSpace = /\S/;\r
- var trimRe = /^\s+|\s+$/g;\r
- var tplRe = /\{(\d+)\}/g;\r
- var modeRe = /^(\s?[\/>+~]\s?|\s|$)/;\r
- var tagTokenRe = /^(#)?([\w-\*]+)/;\r
- var nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/;\r
-\r
- function child(p, index){\r
- var i = 0;\r
- var n = p.firstChild;\r
- while(n){\r
- if(n.nodeType == 1){\r
- if(++i == index){\r
- return n;\r
- }\r
- }\r
- n = n.nextSibling;\r
- }\r
- return null;\r
- };\r
-\r
- function next(n){\r
- while((n = n.nextSibling) && n.nodeType != 1);\r
- return n;\r
- };\r
-\r
- function prev(n){\r
- while((n = n.previousSibling) && n.nodeType != 1);\r
- return n;\r
- };\r
-\r
- function children(d){\r
- var n = d.firstChild, ni = -1;\r
- while(n){\r
- var nx = n.nextSibling;\r
- if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){\r
- d.removeChild(n);\r
- }else{\r
- n.nodeIndex = ++ni;\r
- }\r
- n = nx;\r
- }\r
- return this;\r
- };\r
-\r
- function byClassName(c, a, v){\r
- if(!v){\r
- return c;\r
- }\r
- var r = [], ri = -1, cn;\r
- for(var i = 0, ci; ci = c[i]; i++){\r
- if((' '+ci.className+' ').indexOf(v) != -1){\r
- r[++ri] = ci;\r
- }\r
- }\r
- return r;\r
- };\r
-\r
- function attrValue(n, attr){\r
- if(!n.tagName && typeof n.length != "undefined"){\r
- n = n[0];\r
- }\r
- if(!n){\r
- return null;\r
- }\r
- if(attr == "for"){\r
- return n.htmlFor;\r
- }\r
- if(attr == "class" || attr == "className"){\r
- return n.className;\r
- }\r
- return n.getAttribute(attr) || n[attr];\r
-\r
- };\r
-\r
- function getNodes(ns, mode, tagName){\r
- var result = [], ri = -1, cs;\r
- if(!ns){\r
- return result;\r
- }\r
- tagName = tagName || "*";\r
- if(typeof ns.getElementsByTagName != "undefined"){\r
- ns = [ns];\r
- }\r
- if(!mode){\r
- for(var i = 0, ni; ni = ns[i]; i++){\r
- cs = ni.getElementsByTagName(tagName);\r
- for(var j = 0, ci; ci = cs[j]; j++){\r
- result[++ri] = ci;\r
- }\r
- }\r
- }else if(mode == "/" || mode == ">"){\r
- var utag = tagName.toUpperCase();\r
- for(var i = 0, ni, cn; ni = ns[i]; i++){\r
- cn = ni.children || ni.childNodes;\r
- for(var j = 0, cj; cj = cn[j]; j++){\r
- if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){\r
- result[++ri] = cj;\r
- }\r
- }\r
- }\r
- }else if(mode == "+"){\r
- var utag = tagName.toUpperCase();\r
- for(var i = 0, n; n = ns[i]; i++){\r
- while((n = n.nextSibling) && n.nodeType != 1);\r
- if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){\r
- result[++ri] = n;\r
- }\r
- }\r
- }else if(mode == "~"){\r
- for(var i = 0, n; n = ns[i]; i++){\r
- while((n = n.nextSibling) && (n.nodeType != 1 || (tagName == '*' || n.tagName.toLowerCase()!=tagName)));\r
- if(n){\r
- result[++ri] = n;\r
- }\r
- }\r
- }\r
- return result;\r
- };\r
-\r
- function concat(a, b){\r
- if(b.slice){\r
- return a.concat(b);\r
- }\r
- for(var i = 0, l = b.length; i < l; i++){\r
- a[a.length] = b[i];\r
- }\r
- return a;\r
- }\r
-\r
- function byTag(cs, tagName){\r
- if(cs.tagName || cs == document){\r
- cs = [cs];\r
- }\r
- if(!tagName){\r
- return cs;\r
- }\r
- var r = [], ri = -1;\r
- tagName = tagName.toLowerCase();\r
- for(var i = 0, ci; ci = cs[i]; i++){\r
- if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){\r
- r[++ri] = ci;\r
- }\r
- }\r
- return r;\r
- };\r
-\r
- function byId(cs, attr, id){\r
- if(cs.tagName || cs == document){\r
- cs = [cs];\r
- }\r
- if(!id){\r
- return cs;\r
- }\r
- var r = [], ri = -1;\r
- for(var i = 0,ci; ci = cs[i]; i++){\r
- if(ci && ci.id == id){\r
- r[++ri] = ci;\r
- return r;\r
- }\r
- }\r
- return r;\r
- };\r
-\r
- function byAttribute(cs, attr, value, op, custom){\r
- var r = [], ri = -1, st = custom=="{";\r
- var f = Ext.DomQuery.operators[op];\r
- for(var i = 0, ci; ci = cs[i]; i++){\r
- var a;\r
- if(st){\r
- a = Ext.DomQuery.getStyle(ci, attr);\r
- }\r
- else if(attr == "class" || attr == "className"){\r
- a = ci.className;\r
- }else if(attr == "for"){\r
- a = ci.htmlFor;\r
- }else if(attr == "href"){\r
- a = ci.getAttribute("href", 2);\r
- }else{\r
- a = ci.getAttribute(attr);\r
- }\r
- if((f && f(a, value)) || (!f && a)){\r
- r[++ri] = ci;\r
- }\r
- }\r
- return r;\r
- };\r
-\r
- function byPseudo(cs, name, value){\r
- return Ext.DomQuery.pseudos[name](cs, value);\r
- };\r
-\r
- // This is for IE MSXML which does not support expandos.\r
- // IE runs the same speed using setAttribute, however FF slows way down\r
- // and Safari completely fails so they need to continue to use expandos.\r
- var isIE = window.ActiveXObject ? true : false;\r
-\r
- // this eval is stop the compressor from\r
- // renaming the variable to something shorter\r
- eval("var batch = 30803;");\r
-\r
- var key = 30803;\r
-\r
- function nodupIEXml(cs){\r
- var d = ++key;\r
- cs[0].setAttribute("_nodup", d);\r
- var r = [cs[0]];\r
- for(var i = 1, len = cs.length; i < len; i++){\r
- var c = cs[i];\r
- if(!c.getAttribute("_nodup") != d){\r
- c.setAttribute("_nodup", d);\r
- r[r.length] = c;\r
- }\r
- }\r
- for(var i = 0, len = cs.length; i < len; i++){\r
- cs[i].removeAttribute("_nodup");\r
- }\r
- return r;\r
- }\r
-\r
- function nodup(cs){\r
- if(!cs){\r
- return [];\r
- }\r
- var len = cs.length, c, i, r = cs, cj, ri = -1;\r
- if(!len || typeof cs.nodeType != "undefined" || len == 1){\r
- return cs;\r
- }\r
- if(isIE && typeof cs[0].selectSingleNode != "undefined"){\r
- return nodupIEXml(cs);\r
- }\r
- var d = ++key;\r
- cs[0]._nodup = d;\r
- for(i = 1; c = cs[i]; i++){\r
- if(c._nodup != d){\r
- c._nodup = d;\r
- }else{\r
- r = [];\r
- for(var j = 0; j < i; j++){\r
- r[++ri] = cs[j];\r
- }\r
- for(j = i+1; cj = cs[j]; j++){\r
- if(cj._nodup != d){\r
- cj._nodup = d;\r
- r[++ri] = cj;\r
- }\r
- }\r
- return r;\r
- }\r
- }\r
- return r;\r
- }\r
-\r
- function quickDiffIEXml(c1, c2){\r
- var d = ++key;\r
- for(var i = 0, len = c1.length; i < len; i++){\r
- c1[i].setAttribute("_qdiff", d);\r
- }\r
- var r = [];\r
- for(var i = 0, len = c2.length; i < len; i++){\r
- if(c2[i].getAttribute("_qdiff") != d){\r
- r[r.length] = c2[i];\r
- }\r
- }\r
- for(var i = 0, len = c1.length; i < len; i++){\r
- c1[i].removeAttribute("_qdiff");\r
- }\r
- return r;\r
- }\r
-\r
- function quickDiff(c1, c2){\r
- var len1 = c1.length;\r
- if(!len1){\r
- return c2;\r
- }\r
- if(isIE && c1[0].selectSingleNode){\r
- return quickDiffIEXml(c1, c2);\r
- }\r
- var d = ++key;\r
- for(var i = 0; i < len1; i++){\r
- c1[i]._qdiff = d;\r
- }\r
- var r = [];\r
- for(var i = 0, len = c2.length; i < len; i++){\r
- if(c2[i]._qdiff != d){\r
- r[r.length] = c2[i];\r
- }\r
- }\r
- return r;\r
- }\r
-\r
- function quickId(ns, mode, root, id){\r
- if(ns == root){\r
- var d = root.ownerDocument || root;\r
- return d.getElementById(id);\r
- }\r
- ns = getNodes(ns, mode, "*");\r
- return byId(ns, null, id);\r
- }\r
-\r
- return {\r
- getStyle : function(el, name){\r
- return Ext.fly(el).getStyle(name);\r
- },\r
- \r
- compile : function(path, type){\r
- type = type || "select";\r
-\r
- var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];\r
- var q = path, mode, lq;\r
- var tk = Ext.DomQuery.matchers;\r
- var tklen = tk.length;\r
- var mm;\r
-\r
- // accept leading mode switch\r
- var lmode = q.match(modeRe);\r
- if(lmode && lmode[1]){\r
- fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';\r
- q = q.replace(lmode[1], "");\r
- }\r
- // strip leading slashes\r
- while(path.substr(0, 1)=="/"){\r
- path = path.substr(1);\r
- }\r
-\r
- while(q && lq != q){\r
- lq = q;\r
- var tm = q.match(tagTokenRe);\r
- if(type == "select"){\r
- if(tm){\r
- if(tm[1] == "#"){\r
- fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");';\r
- }else{\r
- fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");';\r
- }\r
- q = q.replace(tm[0], "");\r
- }else if(q.substr(0, 1) != '@'){\r
- fn[fn.length] = 'n = getNodes(n, mode, "*");';\r
- }\r
- }else{\r
- if(tm){\r
- if(tm[1] == "#"){\r
- fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");';\r
- }else{\r
- fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");';\r
- }\r
- q = q.replace(tm[0], "");\r
- }\r
- }\r
- while(!(mm = q.match(modeRe))){\r
- var matched = false;\r
- for(var j = 0; j < tklen; j++){\r
- var t = tk[j];\r
- var m = q.match(t.re);\r
- if(m){\r
- fn[fn.length] = t.select.replace(tplRe, function(x, i){\r
- return m[i];\r
- });\r
- q = q.replace(m[0], "");\r
- matched = true;\r
- break;\r
- }\r
- }\r
- // prevent infinite loop on bad selector\r
- if(!matched){\r
- throw 'Error parsing selector, parsing failed at "' + q + '"';\r
- }\r
- }\r
- if(mm[1]){\r
- fn[fn.length] = 'mode="'+mm[1].replace(trimRe, "")+'";';\r
- q = q.replace(mm[1], "");\r
- }\r
- }\r
- fn[fn.length] = "return nodup(n);\n}";\r
- eval(fn.join(""));\r
- return f;\r
- },\r
-\r
- \r
- select : function(path, root, type){\r
- if(!root || root == document){\r
- root = document;\r
- }\r
- if(typeof root == "string"){\r
- root = document.getElementById(root);\r
- }\r
- var paths = path.split(",");\r
- var results = [];\r
- for(var i = 0, len = paths.length; i < len; i++){\r
- var p = paths[i].replace(trimRe, "");\r
- if(!cache[p]){\r
- cache[p] = Ext.DomQuery.compile(p);\r
- if(!cache[p]){\r
- throw p + " is not a valid selector";\r
- }\r
- }\r
- var result = cache[p](root);\r
- if(result && result != document){\r
- results = results.concat(result);\r
- }\r
- }\r
- if(paths.length > 1){\r
- return nodup(results);\r
- }\r
- return results;\r
- },\r
-\r
- \r
- selectNode : function(path, root){\r
- return Ext.DomQuery.select(path, root)[0];\r
- },\r
-\r
- \r
- selectValue : function(path, root, defaultValue){\r
- path = path.replace(trimRe, "");\r
- if(!valueCache[path]){\r
- valueCache[path] = Ext.DomQuery.compile(path, "select");\r
- }\r
- var n = valueCache[path](root);\r
- n = n[0] ? n[0] : n;\r
- var v = (n && n.firstChild ? n.firstChild.nodeValue : null);\r
- return ((v === null||v === undefined||v==='') ? defaultValue : v);\r
- },\r
-\r
- \r
- selectNumber : function(path, root, defaultValue){\r
- var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);\r
- return parseFloat(v);\r
- },\r
-\r
- \r
- is : function(el, ss){\r
- if(typeof el == "string"){\r
- el = document.getElementById(el);\r
- }\r
- var isArray = Ext.isArray(el);\r
- var result = Ext.DomQuery.filter(isArray ? el : [el], ss);\r
- return isArray ? (result.length == el.length) : (result.length > 0);\r
- },\r
-\r
- \r
- filter : function(els, ss, nonMatches){\r
- ss = ss.replace(trimRe, "");\r
- if(!simpleCache[ss]){\r
- simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");\r
- }\r
- var result = simpleCache[ss](els);\r
- return nonMatches ? quickDiff(result, els) : result;\r
- },\r
-\r
- \r
- matchers : [{\r
- re: /^\.([\w-]+)/,\r
- select: 'n = byClassName(n, null, " {1} ");'\r
- }, {\r
- re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,\r
- select: 'n = byPseudo(n, "{1}", "{2}");'\r
- },{\r
- re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,\r
- select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'\r
- }, {\r
- re: /^#([\w-]+)/,\r
- select: 'n = byId(n, null, "{1}");'\r
- },{\r
- re: /^@([\w-]+)/,\r
- select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'\r
- }\r
- ],\r
-\r
- \r
- operators : {\r
- "=" : function(a, v){\r
- return a == v;\r
- },\r
- "!=" : function(a, v){\r
- return a != v;\r
- },\r
- "^=" : function(a, v){\r
- return a && a.substr(0, v.length) == v;\r
- },\r
- "$=" : function(a, v){\r
- return a && a.substr(a.length-v.length) == v;\r
- },\r
- "*=" : function(a, v){\r
- return a && a.indexOf(v) !== -1;\r
- },\r
- "%=" : function(a, v){\r
- return (a % v) == 0;\r
- },\r
- "|=" : function(a, v){\r
- return a && (a == v || a.substr(0, v.length+1) == v+'-');\r
- },\r
- "~=" : function(a, v){\r
- return a && (' '+a+' ').indexOf(' '+v+' ') != -1;\r
- }\r
- },\r
-\r
- \r
- pseudos : {\r
- "first-child" : function(c){\r
- var r = [], ri = -1, n;\r
- for(var i = 0, ci; ci = n = c[i]; i++){\r
- while((n = n.previousSibling) && n.nodeType != 1);\r
- if(!n){\r
- r[++ri] = ci;\r
- }\r
- }\r
- return r;\r
- },\r
-\r
- "last-child" : function(c){\r
- var r = [], ri = -1, n;\r
- for(var i = 0, ci; ci = n = c[i]; i++){\r
- while((n = n.nextSibling) && n.nodeType != 1);\r
- if(!n){\r
- r[++ri] = ci;\r
- }\r
- }\r
- return r;\r
- },\r
-\r
- "nth-child" : function(c, a) {\r
- var r = [], ri = -1;\r
- var m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a);\r
- var f = (m[1] || 1) - 0, l = m[2] - 0;\r
- for(var i = 0, n; n = c[i]; i++){\r
- var pn = n.parentNode;\r
- if (batch != pn._batch) {\r
- var j = 0;\r
- for(var cn = pn.firstChild; cn; cn = cn.nextSibling){\r
- if(cn.nodeType == 1){\r
- cn.nodeIndex = ++j;\r
- }\r
- }\r
- pn._batch = batch;\r
- }\r
- if (f == 1) {\r
- if (l == 0 || n.nodeIndex == l){\r
- r[++ri] = n;\r
- }\r
- } else if ((n.nodeIndex + l) % f == 0){\r
- r[++ri] = n;\r
- }\r
- }\r
-\r
- return r;\r
- },\r
-\r
- "only-child" : function(c){\r
- var r = [], ri = -1;;\r
- for(var i = 0, ci; ci = c[i]; i++){\r
- if(!prev(ci) && !next(ci)){\r
- r[++ri] = ci;\r
- }\r
- }\r
- return r;\r
- },\r
-\r
- "empty" : function(c){\r
- var r = [], ri = -1;\r
- for(var i = 0, ci; ci = c[i]; i++){\r
- var cns = ci.childNodes, j = 0, cn, empty = true;\r
- while(cn = cns[j]){\r
- ++j;\r
- if(cn.nodeType == 1 || cn.nodeType == 3){\r
- empty = false;\r
- break;\r
- }\r
- }\r
- if(empty){\r
- r[++ri] = ci;\r
- }\r
- }\r
- return r;\r
- },\r
-\r
- "contains" : function(c, v){\r
- var r = [], ri = -1;\r
- for(var i = 0, ci; ci = c[i]; i++){\r
- if((ci.textContent||ci.innerText||'').indexOf(v) != -1){\r
- r[++ri] = ci;\r
- }\r
- }\r
- return r;\r
- },\r
-\r
- "nodeValue" : function(c, v){\r
- var r = [], ri = -1;\r
- for(var i = 0, ci; ci = c[i]; i++){\r
- if(ci.firstChild && ci.firstChild.nodeValue == v){\r
- r[++ri] = ci;\r
- }\r
- }\r
- return r;\r
- },\r
-\r
- "checked" : function(c){\r
- var r = [], ri = -1;\r
- for(var i = 0, ci; ci = c[i]; i++){\r
- if(ci.checked == true){\r
- r[++ri] = ci;\r
- }\r
- }\r
- return r;\r
- },\r
-\r
- "not" : function(c, ss){\r
- return Ext.DomQuery.filter(c, ss, true);\r
- },\r
-\r
- "any" : function(c, selectors){\r
- var ss = selectors.split('|');\r
- var r = [], ri = -1, s;\r
- for(var i = 0, ci; ci = c[i]; i++){\r
- for(var j = 0; s = ss[j]; j++){\r
- if(Ext.DomQuery.is(ci, s)){\r
- r[++ri] = ci;\r
- break;\r
- }\r
- }\r
- }\r
- return r;\r
- },\r
-\r
- "odd" : function(c){\r
- return this["nth-child"](c, "odd");\r
- },\r
-\r
- "even" : function(c){\r
- return this["nth-child"](c, "even");\r
- },\r
-\r
- "nth" : function(c, a){\r
- return c[a-1] || [];\r
- },\r
-\r
- "first" : function(c){\r
- return c[0] || [];\r
- },\r
-\r
- "last" : function(c){\r
- return c[c.length-1] || [];\r
- },\r
-\r
- "has" : function(c, ss){\r
- var s = Ext.DomQuery.select;\r
- var r = [], ri = -1;\r
- for(var i = 0, ci; ci = c[i]; i++){\r
- if(s(ss, ci).length > 0){\r
- r[++ri] = ci;\r
- }\r
- }\r
- return r;\r
- },\r
-\r
- "next" : function(c, ss){\r
- var is = Ext.DomQuery.is;\r
- var r = [], ri = -1;\r
- for(var i = 0, ci; ci = c[i]; i++){\r
- var n = next(ci);\r
- if(n && is(n, ss)){\r
- r[++ri] = ci;\r
- }\r
- }\r
- return r;\r
- },\r
-\r
- "prev" : function(c, ss){\r
- var is = Ext.DomQuery.is;\r
- var r = [], ri = -1;\r
- for(var i = 0, ci; ci = c[i]; i++){\r
- var n = prev(ci);\r
- if(n && is(n, ss)){\r
- r[++ri] = ci;\r
- }\r
- }\r
- return r;\r
- }\r
- }\r
- };\r
-}();\r
-\r
-\r
-Ext.query = Ext.DomQuery.select;\r
-\r
-\r
-Ext.util.Observable = function(){\r
- \r
- if(this.listeners){\r
- this.on(this.listeners);\r
- delete this.listeners;\r
- }\r
-};\r
-Ext.util.Observable.prototype = {\r
- \r
- fireEvent : function(){\r
- if(this.eventsSuspended !== true){\r
- var ce = this.events[arguments[0].toLowerCase()];\r
- if(typeof ce == "object"){\r
- return ce.fire.apply(ce, Array.prototype.slice.call(arguments, 1));\r
- }\r
- }\r
- return true;\r
- },\r
-\r
- // private\r
- filterOptRe : /^(?:scope|delay|buffer|single)$/,\r
-\r
- \r
- addListener : function(eventName, fn, scope, o){\r
- if(typeof eventName == "object"){\r
- o = eventName;\r
- for(var e in o){\r
- if(this.filterOptRe.test(e)){\r
- continue;\r
- }\r
- if(typeof o[e] == "function"){\r
- // shared options\r
- this.addListener(e, o[e], o.scope, o);\r
- }else{\r
- // individual options\r
- this.addListener(e, o[e].fn, o[e].scope, o[e]);\r
- }\r
- }\r
- return;\r
- }\r
- o = (!o || typeof o == "boolean") ? {} : o;\r
- eventName = eventName.toLowerCase();\r
- var ce = this.events[eventName] || true;\r
- if(typeof ce == "boolean"){\r
- ce = new Ext.util.Event(this, eventName);\r
- this.events[eventName] = ce;\r
- }\r
- ce.addListener(fn, scope, o);\r
- },\r
-\r
- \r
- removeListener : function(eventName, fn, scope){\r
- var ce = this.events[eventName.toLowerCase()];\r
- if(typeof ce == "object"){\r
- ce.removeListener(fn, scope);\r
- }\r
- },\r
-\r
- \r
- purgeListeners : function(){\r
- for(var evt in this.events){\r
- if(typeof this.events[evt] == "object"){\r
- this.events[evt].clearListeners();\r
- }\r
- }\r
- },\r
-\r
- \r
- relayEvents : function(o, events){\r
- var createHandler = function(ename){\r
- return function(){\r
- return this.fireEvent.apply(this, Ext.combine(ename, Array.prototype.slice.call(arguments, 0)));\r
- };\r
- };\r
- for(var i = 0, len = events.length; i < len; i++){\r
- var ename = events[i];\r
- if(!this.events[ename]){ this.events[ename] = true; };\r
- o.on(ename, createHandler(ename), this);\r
- }\r
- },\r
-\r
- \r
- addEvents : function(o){\r
- if(!this.events){\r
- this.events = {};\r
- }\r
- if(typeof o == 'string'){\r
- for(var i = 0, a = arguments, v; v = a[i]; i++){\r
- if(!this.events[a[i]]){\r
- this.events[a[i]] = true;\r
- }\r
- }\r
- }else{\r
- Ext.applyIf(this.events, o);\r
- }\r
- },\r
-\r
- \r
- hasListener : function(eventName){\r
- var e = this.events[eventName];\r
- return typeof e == "object" && e.listeners.length > 0;\r
- },\r
-\r
- \r
- suspendEvents : function(){\r
- this.eventsSuspended = true;\r
- },\r
-\r
- \r
- resumeEvents : function(){\r
- this.eventsSuspended = false;\r
- },\r
-\r
- // these are considered experimental\r
- // allows for easier interceptor and sequences, including cancelling and overwriting the return value of the call\r
- // private\r
- getMethodEvent : function(method){\r
- if(!this.methodEvents){\r
- this.methodEvents = {};\r
- }\r
- var e = this.methodEvents[method];\r
- if(!e){\r
- e = {};\r
- this.methodEvents[method] = e;\r
-\r
- e.originalFn = this[method];\r
- e.methodName = method;\r
- e.before = [];\r
- e.after = [];\r
-\r
-\r
- var returnValue, v, cancel;\r
- var obj = this;\r
-\r
- var makeCall = function(fn, scope, args){\r
- if((v = fn.apply(scope || obj, args)) !== undefined){\r
- if(typeof v === 'object'){\r
- if(v.returnValue !== undefined){\r
- returnValue = v.returnValue;\r
- }else{\r
- returnValue = v;\r
- }\r
- if(v.cancel === true){\r
- cancel = true;\r
- }\r
- }else if(v === false){\r
- cancel = true;\r
- }else {\r
- returnValue = v;\r
- }\r
- }\r
- }\r
-\r
- this[method] = function(){\r
- returnValue = v = undefined; cancel = false;\r
- var args = Array.prototype.slice.call(arguments, 0);\r
- for(var i = 0, len = e.before.length; i < len; i++){\r
- makeCall(e.before[i].fn, e.before[i].scope, args);\r
- if(cancel){\r
- return returnValue;\r
- }\r
- }\r
-\r
- if((v = e.originalFn.apply(obj, args)) !== undefined){\r
- returnValue = v;\r
- }\r
-\r
- for(var i = 0, len = e.after.length; i < len; i++){\r
- makeCall(e.after[i].fn, e.after[i].scope, args);\r
- if(cancel){\r
- return returnValue;\r
- }\r
- }\r
- return returnValue;\r
- };\r
- }\r
- return e;\r
- },\r
-\r
- // adds an "interceptor" called before the original method\r
- beforeMethod : function(method, fn, scope){\r
- var e = this.getMethodEvent(method);\r
- e.before.push({fn: fn, scope: scope});\r
- },\r
-\r
- // adds a "sequence" called after the original method\r
- afterMethod : function(method, fn, scope){\r
- var e = this.getMethodEvent(method);\r
- e.after.push({fn: fn, scope: scope});\r
- },\r
-\r
- removeMethodListener : function(method, fn, scope){\r
- var e = this.getMethodEvent(method);\r
- for(var i = 0, len = e.before.length; i < len; i++){\r
- if(e.before[i].fn == fn && e.before[i].scope == scope){\r
- e.before.splice(i, 1);\r
- return;\r
- }\r
- }\r
- for(var i = 0, len = e.after.length; i < len; i++){\r
- if(e.after[i].fn == fn && e.after[i].scope == scope){\r
- e.after.splice(i, 1);\r
- return;\r
- }\r
- }\r
- }\r
-};\r
-\r
-Ext.util.Observable.prototype.on = Ext.util.Observable.prototype.addListener;\r
-\r
-Ext.util.Observable.prototype.un = Ext.util.Observable.prototype.removeListener;\r
-\r
-\r
-Ext.util.Observable.capture = function(o, fn, scope){\r
- o.fireEvent = o.fireEvent.createInterceptor(fn, scope);\r
-};\r
-\r
-\r
-Ext.util.Observable.releaseCapture = function(o){\r
- o.fireEvent = Ext.util.Observable.prototype.fireEvent;\r
-};\r
-\r
-(function(){\r
-\r
- var createBuffered = function(h, o, scope){\r
- var task = new Ext.util.DelayedTask();\r
- return function(){\r
- task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));\r
- };\r
- };\r
-\r
- var createSingle = function(h, e, fn, scope){\r
- return function(){\r
- e.removeListener(fn, scope);\r
- return h.apply(scope, arguments);\r
- };\r
- };\r
-\r
- var createDelayed = function(h, o, scope){\r
- return function(){\r
- var args = Array.prototype.slice.call(arguments, 0);\r
- setTimeout(function(){\r
- h.apply(scope, args);\r
- }, o.delay || 10);\r
- };\r
- };\r
-\r
- Ext.util.Event = function(obj, name){\r
- this.name = name;\r
- this.obj = obj;\r
- this.listeners = [];\r
- };\r
-\r
- Ext.util.Event.prototype = {\r
- addListener : function(fn, scope, options){\r
- scope = scope || this.obj;\r
- if(!this.isListening(fn, scope)){\r
- var l = this.createListener(fn, scope, options);\r
- if(!this.firing){\r
- this.listeners.push(l);\r
- }else{ // if we are currently firing this event, don't disturb the listener loop\r
- this.listeners = this.listeners.slice(0);\r
- this.listeners.push(l);\r
- }\r
- }\r
- },\r
-\r
- createListener : function(fn, scope, o){\r
- o = o || {};\r
- scope = scope || this.obj;\r
- var l = {fn: fn, scope: scope, options: o};\r
- var h = fn;\r
- if(o.delay){\r
- h = createDelayed(h, o, scope);\r
- }\r
- if(o.single){\r
- h = createSingle(h, this, fn, scope);\r
- }\r
- if(o.buffer){\r
- h = createBuffered(h, o, scope);\r
- }\r
- l.fireFn = h;\r
- return l;\r
- },\r
-\r
- findListener : function(fn, scope){\r
- scope = scope || this.obj;\r
- var ls = this.listeners;\r
- for(var i = 0, len = ls.length; i < len; i++){\r
- var l = ls[i];\r
- if(l.fn == fn && l.scope == scope){\r
- return i;\r
- }\r
- }\r
- return -1;\r
- },\r
-\r
- isListening : function(fn, scope){\r
- return this.findListener(fn, scope) != -1;\r
- },\r
-\r
- removeListener : function(fn, scope){\r
- var index;\r
- if((index = this.findListener(fn, scope)) != -1){\r
- if(!this.firing){\r
- this.listeners.splice(index, 1);\r
- }else{\r
- this.listeners = this.listeners.slice(0);\r
- this.listeners.splice(index, 1);\r
- }\r
- return true;\r
- }\r
- return false;\r
- },\r
-\r
- clearListeners : function(){\r
- this.listeners = [];\r
- },\r
-\r
- fire : function(){\r
- var ls = this.listeners, scope, len = ls.length;\r
- if(len > 0){\r
- this.firing = true;\r
- var args = Array.prototype.slice.call(arguments, 0);\r
- for(var i = 0; i < len; i++){\r
- var l = ls[i];\r
- if(l.fireFn.apply(l.scope||this.obj||window, arguments) === false){\r
- this.firing = false;\r
- return false;\r
- }\r
- }\r
- this.firing = false;\r
- }\r
- return true;\r
- }\r
- };\r
-})();\r
-\r
-Ext.EventManager = function(){\r
- var docReadyEvent, docReadyProcId, docReadyState = false;\r
- var resizeEvent, resizeTask, textEvent, textSize;\r
- var E = Ext.lib.Event;\r
- var D = Ext.lib.Dom;\r
- // fix parser confusion\r
- var xname = 'Ex' + 't';\r
-\r
- var elHash = {};\r
-\r
- var addListener = function(el, ename, fn, wrap, scope){\r
- var id = Ext.id(el);\r
- if(!elHash[id]){\r
- elHash[id] = {};\r
- }\r
- var es = elHash[id];\r
- if(!es[ename]){\r
- es[ename] = [];\r
- }\r
- var ls = es[ename];\r
- ls.push({\r
- id: id,\r
- ename: ename,\r
- fn: fn,\r
- wrap: wrap,\r
- scope: scope\r
- });\r
-\r
- E.on(el, ename, wrap);\r
-\r
- if(ename == "mousewheel" && el.addEventListener){ // workaround for jQuery\r
- el.addEventListener("DOMMouseScroll", wrap, false);\r
- E.on(window, 'unload', function(){\r
- el.removeEventListener("DOMMouseScroll", wrap, false);\r
- });\r
- }\r
- if(ename == "mousedown" && el == document){ // fix stopped mousedowns on the document\r
- Ext.EventManager.stoppedMouseDownEvent.addListener(wrap);\r
- }\r
- }\r
-\r
- var removeListener = function(el, ename, fn, scope){\r
- el = Ext.getDom(el);\r
-\r
- var id = Ext.id(el), es = elHash[id], wrap;\r
- if(es){\r
- var ls = es[ename], l;\r
- if(ls){\r
- for(var i = 0, len = ls.length; i < len; i++){\r
- l = ls[i];\r
- if(l.fn == fn && (!scope || l.scope == scope)){\r
- wrap = l.wrap;\r
- E.un(el, ename, wrap);\r
- ls.splice(i, 1);\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- if(ename == "mousewheel" && el.addEventListener && wrap){\r
- el.removeEventListener("DOMMouseScroll", wrap, false);\r
- }\r
- if(ename == "mousedown" && el == document && wrap){ // fix stopped mousedowns on the document\r
- Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);\r
- }\r
- }\r
-\r
- var removeAll = function(el){\r
- el = Ext.getDom(el);\r
- var id = Ext.id(el), es = elHash[id], ls;\r
- if(es){\r
- for(var ename in es){\r
- if(es.hasOwnProperty(ename)){\r
- ls = es[ename];\r
- for(var i = 0, len = ls.length; i < len; i++){\r
- E.un(el, ename, ls[i].wrap);\r
- ls[i] = null;\r
- }\r
- }\r
- es[ename] = null;\r
- }\r
- delete elHash[id];\r
- }\r
- }\r
-\r
-\r
- var fireDocReady = function(){\r
- if(!docReadyState){\r
- docReadyState = true;\r
- Ext.isReady = true;\r
- if(docReadyProcId){\r
- clearInterval(docReadyProcId);\r
- }\r
- if(Ext.isGecko || Ext.isOpera) {\r
- document.removeEventListener("DOMContentLoaded", fireDocReady, false);\r
- }\r
- if(Ext.isIE){\r
- var defer = document.getElementById("ie-deferred-loader");\r
- if(defer){\r
- defer.onreadystatechange = null;\r
- defer.parentNode.removeChild(defer);\r
- }\r
- }\r
- if(docReadyEvent){\r
- docReadyEvent.fire();\r
- docReadyEvent.clearListeners();\r
- }\r
- }\r
- };\r
-\r
- var initDocReady = function(){\r
- docReadyEvent = new Ext.util.Event();\r
- if(Ext.isGecko || Ext.isOpera) {\r
- document.addEventListener("DOMContentLoaded", fireDocReady, false);\r
- }else if(Ext.isIE){\r
- document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>");\r
- var defer = document.getElementById("ie-deferred-loader");\r
- defer.onreadystatechange = function(){\r
- if(this.readyState == "complete"){\r
- fireDocReady();\r
- }\r
- };\r
- }else if(Ext.isSafari){\r
- docReadyProcId = setInterval(function(){\r
- var rs = document.readyState;\r
- if(rs == "complete") {\r
- fireDocReady();\r
- }\r
- }, 10);\r
- }\r
- // no matter what, make sure it fires on load\r
- E.on(window, "load", fireDocReady);\r
- };\r
-\r
- var createBuffered = function(h, o){\r
- var task = new Ext.util.DelayedTask(h);\r
- return function(e){\r
- // create new event object impl so new events don't wipe out properties\r
- e = new Ext.EventObjectImpl(e);\r
- task.delay(o.buffer, h, null, [e]);\r
- };\r
- };\r
-\r
- var createSingle = function(h, el, ename, fn, scope){\r
- return function(e){\r
- Ext.EventManager.removeListener(el, ename, fn, scope);\r
- h(e);\r
- };\r
- };\r
-\r
- var createDelayed = function(h, o){\r
- return function(e){\r
- // create new event object impl so new events don't wipe out properties\r
- e = new Ext.EventObjectImpl(e);\r
- setTimeout(function(){\r
- h(e);\r
- }, o.delay || 10);\r
- };\r
- };\r
-\r
- var listen = function(element, ename, opt, fn, scope){\r
- var o = (!opt || typeof opt == "boolean") ? {} : opt;\r
- fn = fn || o.fn; scope = scope || o.scope;\r
- var el = Ext.getDom(element);\r
- if(!el){\r
- throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';\r
- }\r
- var h = function(e){\r
- // prevent errors while unload occurring\r
- if(!window[xname]){\r
- return;\r
- }\r
- e = Ext.EventObject.setEvent(e);\r
- var t;\r
- if(o.delegate){\r
- t = e.getTarget(o.delegate, el);\r
- if(!t){\r
- return;\r
- }\r
- }else{\r
- t = e.target;\r
- }\r
- if(o.stopEvent === true){\r
- e.stopEvent();\r
- }\r
- if(o.preventDefault === true){\r
- e.preventDefault();\r
- }\r
- if(o.stopPropagation === true){\r
- e.stopPropagation();\r
- }\r
-\r
- if(o.normalized === false){\r
- e = e.browserEvent;\r
- }\r
-\r
- fn.call(scope || el, e, t, o);\r
- };\r
- if(o.delay){\r
- h = createDelayed(h, o);\r
- }\r
- if(o.single){\r
- h = createSingle(h, el, ename, fn, scope);\r
- }\r
- if(o.buffer){\r
- h = createBuffered(h, o);\r
- }\r
-\r
- addListener(el, ename, fn, h, scope);\r
- return h;\r
- };\r
-\r
- var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;\r
- var pub = {\r
-\r
- \r
- addListener : function(element, eventName, fn, scope, options){\r
- if(typeof eventName == "object"){\r
- var o = eventName;\r
- for(var e in o){\r
- if(propRe.test(e)){\r
- continue;\r
- }\r
- if(typeof o[e] == "function"){\r
- // shared options\r
- listen(element, e, o, o[e], o.scope);\r
- }else{\r
- // individual options\r
- listen(element, e, o[e]);\r
- }\r
- }\r
- return;\r
- }\r
- return listen(element, eventName, options, fn, scope);\r
- },\r
-\r
- \r
- removeListener : function(element, eventName, fn, scope){\r
- return removeListener(element, eventName, fn, scope);\r
- },\r
-\r
- \r
- removeAll : function(element){\r
- return removeAll(element);\r
- },\r
-\r
- \r
- onDocumentReady : function(fn, scope, options){\r
- if(docReadyState){ // if it already fired\r
- docReadyEvent.addListener(fn, scope, options);\r
- docReadyEvent.fire();\r
- docReadyEvent.clearListeners();\r
- return;\r
- }\r
- if(!docReadyEvent){\r
- initDocReady();\r
- }\r
- options = options || {};\r
- if(!options.delay){\r
- options.delay = 1;\r
- }\r
- docReadyEvent.addListener(fn, scope, options);\r
- },\r
- \r
- // private\r
- doResizeEvent: function(){\r
- resizeEvent.fire(D.getViewWidth(), D.getViewHeight());\r
- },\r
-\r
- \r
- onWindowResize : function(fn, scope, options){\r
- if(!resizeEvent){\r
- resizeEvent = new Ext.util.Event();\r
- resizeTask = new Ext.util.DelayedTask(this.doResizeEvent);\r
- E.on(window, "resize", this.fireWindowResize, this);\r
- }\r
- resizeEvent.addListener(fn, scope, options);\r
- },\r
-\r
- // exposed only to allow manual firing\r
- fireWindowResize : function(){\r
- if(resizeEvent){\r
- if((Ext.isIE||Ext.isAir) && resizeTask){\r
- resizeTask.delay(50);\r
- }else{\r
- resizeEvent.fire(D.getViewWidth(), D.getViewHeight());\r
- }\r
- }\r
- },\r
-\r
- \r
- onTextResize : function(fn, scope, options){\r
- if(!textEvent){\r
- textEvent = new Ext.util.Event();\r
- var textEl = new Ext.Element(document.createElement('div'));\r
- textEl.dom.className = 'x-text-resize';\r
- textEl.dom.innerHTML = 'X';\r
- textEl.appendTo(document.body);\r
- textSize = textEl.dom.offsetHeight;\r
- setInterval(function(){\r
- if(textEl.dom.offsetHeight != textSize){\r
- textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);\r
- }\r
- }, this.textResizeInterval);\r
- }\r
- textEvent.addListener(fn, scope, options);\r
- },\r
-\r
- \r
- removeResizeListener : function(fn, scope){\r
- if(resizeEvent){\r
- resizeEvent.removeListener(fn, scope);\r
- }\r
- },\r
-\r
- // private\r
- fireResize : function(){\r
- if(resizeEvent){\r
- resizeEvent.fire(D.getViewWidth(), D.getViewHeight());\r
- }\r
- },\r
- \r
- ieDeferSrc : false,\r
- \r
- textResizeInterval : 50\r
- };\r
- \r
- pub.on = pub.addListener;\r
- \r
- pub.un = pub.removeListener;\r
-\r
- pub.stoppedMouseDownEvent = new Ext.util.Event();\r
- return pub;\r
-}();\r
-\r
-Ext.onReady = Ext.EventManager.onDocumentReady;\r
-\r
-\r
-// Initialize doc classes\r
-(function(){\r
- var initExtCss = function(){\r
- // find the body element\r
- var bd = document.body || document.getElementsByTagName('body')[0];\r
- if(!bd){ return false; }\r
- var cls = [' ',\r
- Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : (Ext.isIE7 ? 'ext-ie7' : 'ext-ie8'))\r
- : Ext.isGecko ? "ext-gecko " + (Ext.isGecko2 ? 'ext-gecko2' : 'ext-gecko3')\r
- : Ext.isOpera ? "ext-opera"\r
- : Ext.isSafari ? "ext-safari"\r
- : Ext.isChrome ? "ext-chrome" : ""];\r
-\r
- if(Ext.isMac){\r
- cls.push("ext-mac");\r
- }\r
- if(Ext.isLinux){\r
- cls.push("ext-linux");\r
- }\r
- if(Ext.isBorderBox){\r
- cls.push('ext-border-box');\r
- }\r
- if(Ext.isStrict){ // add to the parent to allow for selectors like ".ext-strict .ext-ie"\r
- var p = bd.parentNode;\r
- if(p){\r
- p.className += ' ext-strict';\r
- }\r
- }\r
- bd.className += cls.join(' ');\r
- return true;\r
- }\r
-\r
- if(!initExtCss()){\r
- Ext.onReady(initExtCss);\r
- }\r
-})();\r
-\r
-\r
-Ext.EventObject = function(){\r
-\r
- var E = Ext.lib.Event;\r
-\r
- // safari keypress events for special keys return bad keycodes\r
- var safariKeys = {\r
- 3 : 13, // enter\r
- 63234 : 37, // left\r
- 63235 : 39, // right\r
- 63232 : 38, // up\r
- 63233 : 40, // down\r
- 63276 : 33, // page up\r
- 63277 : 34, // page down\r
- 63272 : 46, // delete\r
- 63273 : 36, // home\r
- 63275 : 35 // end\r
- };\r
-\r
- // normalize button clicks\r
- var btnMap = Ext.isIE ? {1:0,4:1,2:2} :\r
- (Ext.isSafari ? {1:0,2:1,3:2} : {0:0,1:1,2:2});\r
-\r
- Ext.EventObjectImpl = function(e){\r
- if(e){\r
- this.setEvent(e.browserEvent || e);\r
- }\r
- };\r
-\r
- Ext.EventObjectImpl.prototype = {\r
- \r
- browserEvent : null,\r
- \r
- button : -1,\r
- \r
- shiftKey : false,\r
- \r
- ctrlKey : false,\r
- \r
- altKey : false,\r
-\r
- \r
- BACKSPACE: 8,\r
- \r
- TAB: 9,\r
- \r
- NUM_CENTER: 12,\r
- \r
- ENTER: 13,\r
- \r
- RETURN: 13,\r
- \r
- SHIFT: 16,\r
- \r
- CTRL: 17,\r
- CONTROL : 17, // legacy\r
- \r
- ALT: 18,\r
- \r
- PAUSE: 19,\r
- \r
- CAPS_LOCK: 20,\r
- \r
- ESC: 27,\r
- \r
- SPACE: 32,\r
- \r
- PAGE_UP: 33,\r
- PAGEUP : 33, // legacy\r
- \r
- PAGE_DOWN: 34,\r
- PAGEDOWN : 34, // legacy\r
- \r
- END: 35,\r
- \r
- HOME: 36,\r
- \r
- LEFT: 37,\r
- \r
- UP: 38,\r
- \r
- RIGHT: 39,\r
- \r
- DOWN: 40,\r
- \r
- PRINT_SCREEN: 44,\r
- \r
- INSERT: 45,\r
- \r
- DELETE: 46,\r
- \r
- ZERO: 48,\r
- \r
- ONE: 49,\r
- \r
- TWO: 50,\r
- \r
- THREE: 51,\r
- \r
- FOUR: 52,\r
- \r
- FIVE: 53,\r
- \r
- SIX: 54,\r
- \r
- SEVEN: 55,\r
- \r
- EIGHT: 56,\r
- \r
- NINE: 57,\r
- \r
- A: 65,\r
- \r
- B: 66,\r
- \r
- C: 67,\r
- \r
- D: 68,\r
- \r
- E: 69,\r
- \r
- F: 70,\r
- \r
- G: 71,\r
- \r
- H: 72,\r
- \r
- I: 73,\r
- \r
- J: 74,\r
- \r
- K: 75,\r
- \r
- L: 76,\r
- \r
- M: 77,\r
- \r
- N: 78,\r
- \r
- O: 79,\r
- \r
- P: 80,\r
- \r
- Q: 81,\r
- \r
- R: 82,\r
- \r
- S: 83,\r
- \r
- T: 84,\r
- \r
- U: 85,\r
- \r
- V: 86,\r
- \r
- W: 87,\r
- \r
- X: 88,\r
- \r
- Y: 89,\r
- \r
- Z: 90,\r
- \r
- CONTEXT_MENU: 93,\r
- \r
- NUM_ZERO: 96,\r
- \r
- NUM_ONE: 97,\r
- \r
- NUM_TWO: 98,\r
- \r
- NUM_THREE: 99,\r
- \r
- NUM_FOUR: 100,\r
- \r
- NUM_FIVE: 101,\r
- \r
- NUM_SIX: 102,\r
- \r
- NUM_SEVEN: 103,\r
- \r
- NUM_EIGHT: 104,\r
- \r
- NUM_NINE: 105,\r
- \r
- NUM_MULTIPLY: 106,\r
- \r
- NUM_PLUS: 107,\r
- \r
- NUM_MINUS: 109,\r
- \r
- NUM_PERIOD: 110,\r
- \r
- NUM_DIVISION: 111,\r
- \r
- F1: 112,\r
- \r
- F2: 113,\r
- \r
- F3: 114,\r
- \r
- F4: 115,\r
- \r
- F5: 116,\r
- \r
- F6: 117,\r
- \r
- F7: 118,\r
- \r
- F8: 119,\r
- \r
- F9: 120,\r
- \r
- F10: 121,\r
- \r
- F11: 122,\r
- \r
- F12: 123,\r
-\r
- \r
- setEvent : function(e){\r
- if(e == this || (e && e.browserEvent)){ // already wrapped\r
- return e;\r
- }\r
- this.browserEvent = e;\r
- if(e){\r
- // normalize buttons\r
- this.button = e.button ? btnMap[e.button] : (e.which ? e.which-1 : -1);\r
- if(e.type == 'click' && this.button == -1){\r
- this.button = 0;\r
- }\r
- this.type = e.type;\r
- this.shiftKey = e.shiftKey;\r
- // mac metaKey behaves like ctrlKey\r
- this.ctrlKey = e.ctrlKey || e.metaKey;\r
- this.altKey = e.altKey;\r
- // in getKey these will be normalized for the mac\r
- this.keyCode = e.keyCode;\r
- this.charCode = e.charCode;\r
- // cache the target for the delayed and or buffered events\r
- this.target = E.getTarget(e);\r
- // same for XY\r
- this.xy = E.getXY(e);\r
- }else{\r
- this.button = -1;\r
- this.shiftKey = false;\r
- this.ctrlKey = false;\r
- this.altKey = false;\r
- this.keyCode = 0;\r
- this.charCode = 0;\r
- this.target = null;\r
- this.xy = [0, 0];\r
- }\r
- return this;\r
- },\r
-\r
- \r
- stopEvent : function(){\r
- if(this.browserEvent){\r
- if(this.browserEvent.type == 'mousedown'){\r
- Ext.EventManager.stoppedMouseDownEvent.fire(this);\r
- }\r
- E.stopEvent(this.browserEvent);\r
- }\r
- },\r
-\r
- \r
- preventDefault : function(){\r
- if(this.browserEvent){\r
- E.preventDefault(this.browserEvent);\r
- }\r
- },\r
-\r
- \r
- isNavKeyPress : function(){\r
- var k = this.keyCode;\r
- k = Ext.isSafari ? (safariKeys[k] || k) : k;\r
- return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB || k == this.ESC;\r
- },\r
-\r
- isSpecialKey : function(){\r
- var k = this.keyCode;\r
- return (this.type == 'keypress' && this.ctrlKey) || k == 9 || k == 13 || k == 40 || k == 27 ||\r
- (k == 16) || (k == 17) ||\r
- (k >= 18 && k <= 20) ||\r
- (k >= 33 && k <= 35) ||\r
- (k >= 36 && k <= 39) ||\r
- (k >= 44 && k <= 45);\r
- },\r
-\r
- \r
- stopPropagation : function(){\r
- if(this.browserEvent){\r
- if(this.browserEvent.type == 'mousedown'){\r
- Ext.EventManager.stoppedMouseDownEvent.fire(this);\r
- }\r
- E.stopPropagation(this.browserEvent);\r
- }\r
- },\r
-\r
- \r
- getCharCode : function(){\r
- return this.charCode || this.keyCode;\r
- },\r
-\r
- \r
- getKey : function(){\r
- var k = this.keyCode || this.charCode;\r
- return Ext.isSafari ? (safariKeys[k] || k) : k;\r
- },\r
-\r
- \r
- getPageX : function(){\r
- return this.xy[0];\r
- },\r
-\r
- \r
- getPageY : function(){\r
- return this.xy[1];\r
- },\r
-\r
- \r
- getTime : function(){\r
- if(this.browserEvent){\r
- return E.getTime(this.browserEvent);\r
- }\r
- return null;\r
- },\r
-\r
- \r
- getXY : function(){\r
- return this.xy;\r
- },\r
-\r
- \r
- getTarget : function(selector, maxDepth, returnEl){\r
- return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target);\r
- },\r
-\r
- \r
- getRelatedTarget : function(){\r
- if(this.browserEvent){\r
- return E.getRelatedTarget(this.browserEvent);\r
- }\r
- return null;\r
- },\r
-\r
- \r
- getWheelDelta : function(){\r
- var e = this.browserEvent;\r
- var delta = 0;\r
- if(e.wheelDelta){ \r
- delta = e.wheelDelta/120;\r
- }else if(e.detail){ \r
- delta = -e.detail/3;\r
- }\r
- return delta;\r
- },\r
-\r
- \r
- hasModifier : function(){\r
- return ((this.ctrlKey || this.altKey) || this.shiftKey) ? true : false;\r
- },\r
-\r
- \r
- within : function(el, related, allowEl){\r
- var t = this[related ? "getRelatedTarget" : "getTarget"]();\r
- return t && ((allowEl ? (t === Ext.getDom(el)) : false) || Ext.fly(el).contains(t));\r
- },\r
-\r
- getPoint : function(){\r
- return new Ext.lib.Point(this.xy[0], this.xy[1]);\r
- }\r
- };\r
-\r
- return new Ext.EventObjectImpl();\r
-}();\r
-\r
-(function(){\r
-var D = Ext.lib.Dom;\r
-var E = Ext.lib.Event;\r
-var A = Ext.lib.Anim;\r
-\r
-// local style camelizing for speed\r
-var propCache = {};\r
-var camelRe = /(-[a-z])/gi;\r
-var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };\r
-var view = document.defaultView;\r
-\r
-Ext.Element = function(element, forceNew){\r
- var dom = typeof element == "string" ?\r
- document.getElementById(element) : element;\r
- if(!dom){ // invalid id/element\r
- return null;\r
- }\r
- var id = dom.id;\r
- if(forceNew !== true && id && Ext.Element.cache[id]){ // element object already exists\r
- return Ext.Element.cache[id];\r
- }\r
-\r
- \r
- this.dom = dom;\r
-\r
- \r
- this.id = id || Ext.id(dom);\r
-};\r
-\r
-var El = Ext.Element;\r
-\r
-El.prototype = {\r
- \r
- originalDisplay : "",\r
-\r
- visibilityMode : 1,\r
- \r
- defaultUnit : "px",\r
- \r
- setVisibilityMode : function(visMode){\r
- this.visibilityMode = visMode;\r
- return this;\r
- },\r
- \r
- enableDisplayMode : function(display){\r
- this.setVisibilityMode(El.DISPLAY);\r
- if(typeof display != "undefined") this.originalDisplay = display;\r
- return this;\r
- },\r
-\r
- \r
- findParent : function(simpleSelector, maxDepth, returnEl){\r
- var p = this.dom, b = document.body, depth = 0, dq = Ext.DomQuery, stopEl;\r
- maxDepth = maxDepth || 50;\r
- if(typeof maxDepth != "number"){\r
- stopEl = Ext.getDom(maxDepth);\r
- maxDepth = 10;\r
- }\r
- while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){\r
- if(dq.is(p, simpleSelector)){\r
- return returnEl ? Ext.get(p) : p;\r
- }\r
- depth++;\r
- p = p.parentNode;\r
- }\r
- return null;\r
- },\r
-\r
-\r
- \r
- findParentNode : function(simpleSelector, maxDepth, returnEl){\r
- var p = Ext.fly(this.dom.parentNode, '_internal');\r
- return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;\r
- },\r
-\r
- \r
- up : function(simpleSelector, maxDepth){\r
- return this.findParentNode(simpleSelector, maxDepth, true);\r
- },\r
-\r
-\r
-\r
- \r
- is : function(simpleSelector){\r
- return Ext.DomQuery.is(this.dom, simpleSelector);\r
- },\r
-\r
- \r
- animate : function(args, duration, onComplete, easing, animType){\r
- this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType);\r
- return this;\r
- },\r
-\r
- \r
- anim : function(args, opt, animType, defaultDur, defaultEase, cb){\r
- animType = animType || 'run';\r
- opt = opt || {};\r
- var anim = Ext.lib.Anim[animType](\r
- this.dom, args,\r
- (opt.duration || defaultDur) || .35,\r
- (opt.easing || defaultEase) || 'easeOut',\r
- function(){\r
- Ext.callback(cb, this);\r
- Ext.callback(opt.callback, opt.scope || this, [this, opt]);\r
- },\r
- this\r
- );\r
- opt.anim = anim;\r
- return anim;\r
- },\r
-\r
- // private legacy anim prep\r
- preanim : function(a, i){\r
- return !a[i] ? false : (typeof a[i] == "object" ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]});\r
- },\r
-\r
- \r
- clean : function(forceReclean){\r
- if(this.isCleaned && forceReclean !== true){\r
- return this;\r
- }\r
- var ns = /\S/;\r
- var d = this.dom, n = d.firstChild, ni = -1;\r
- while(n){\r
- var nx = n.nextSibling;\r
- if(n.nodeType == 3 && !ns.test(n.nodeValue)){\r
- d.removeChild(n);\r
- }else{\r
- n.nodeIndex = ++ni;\r
- }\r
- n = nx;\r
- }\r
- this.isCleaned = true;\r
- return this;\r
- },\r
-\r
- \r
- scrollIntoView : function(container, hscroll){\r
- var c = Ext.getDom(container) || Ext.getBody().dom;\r
- var el = this.dom;\r
-\r
- var o = this.getOffsetsTo(c),\r
- l = o[0] + c.scrollLeft,\r
- t = o[1] + c.scrollTop,\r
- b = t+el.offsetHeight,\r
- r = l+el.offsetWidth;\r
-\r
- var ch = c.clientHeight;\r
- var ct = parseInt(c.scrollTop, 10);\r
- var cl = parseInt(c.scrollLeft, 10);\r
- var cb = ct + ch;\r
- var cr = cl + c.clientWidth;\r
-\r
- if(el.offsetHeight > ch || t < ct){\r
- c.scrollTop = t;\r
- }else if(b > cb){\r
- c.scrollTop = b-ch;\r
- }\r
- c.scrollTop = c.scrollTop; // corrects IE, other browsers will ignore\r
-\r
- if(hscroll !== false){\r
- if(el.offsetWidth > c.clientWidth || l < cl){\r
- c.scrollLeft = l;\r
- }else if(r > cr){\r
- c.scrollLeft = r-c.clientWidth;\r
- }\r
- c.scrollLeft = c.scrollLeft;\r
- }\r
- return this;\r
- },\r
-\r
- // private\r
- scrollChildIntoView : function(child, hscroll){\r
- Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);\r
- },\r
-\r
- \r
- autoHeight : function(animate, duration, onComplete, easing){\r
- var oldHeight = this.getHeight();\r
- this.clip();\r
- this.setHeight(1); // force clipping\r
- setTimeout(function(){\r
- var height = parseInt(this.dom.scrollHeight, 10); // parseInt for Safari\r
- if(!animate){\r
- this.setHeight(height);\r
- this.unclip();\r
- if(typeof onComplete == "function"){\r
- onComplete();\r
- }\r
- }else{\r
- this.setHeight(oldHeight); // restore original height\r
- this.setHeight(height, animate, duration, function(){\r
- this.unclip();\r
- if(typeof onComplete == "function") onComplete();\r
- }.createDelegate(this), easing);\r
- }\r
- }.createDelegate(this), 0);\r
- return this;\r
- },\r
-\r
- \r
- contains : function(el){\r
- if(!el){return false;}\r
- return D.isAncestor(this.dom, el.dom ? el.dom : el);\r
- },\r
-\r
- \r
- isVisible : function(deep) {\r
- var vis = !(this.getStyle("visibility") == "hidden" || this.getStyle("display") == "none");\r
- if(deep !== true || !vis){\r
- return vis;\r
- }\r
- var p = this.dom.parentNode;\r
- while(p && p.tagName.toLowerCase() != "body"){\r
- if(!Ext.fly(p, '_isVisible').isVisible()){\r
- return false;\r
- }\r
- p = p.parentNode;\r
- }\r
- return true;\r
- },\r
-\r
- \r
- select : function(selector, unique){\r
- return El.select(selector, unique, this.dom);\r
- },\r
-\r
- \r
- query : function(selector){\r
- return Ext.DomQuery.select(selector, this.dom);\r
- },\r
-\r
- \r
- child : function(selector, returnDom){\r
- var n = Ext.DomQuery.selectNode(selector, this.dom);\r
- return returnDom ? n : Ext.get(n);\r
- },\r
-\r
- \r
- down : function(selector, returnDom){\r
- var n = Ext.DomQuery.selectNode(" > " + selector, this.dom);\r
- return returnDom ? n : Ext.get(n);\r
- },\r
-\r
- \r
- initDD : function(group, config, overrides){\r
- var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);\r
- return Ext.apply(dd, overrides);\r
- },\r
-\r
- \r
- initDDProxy : function(group, config, overrides){\r
- var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);\r
- return Ext.apply(dd, overrides);\r
- },\r
-\r
- \r
- initDDTarget : function(group, config, overrides){\r
- var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);\r
- return Ext.apply(dd, overrides);\r
- },\r
-\r
- \r
- setVisible : function(visible, animate){\r
- if(!animate || !A){\r
- if(this.visibilityMode == El.DISPLAY){\r
- this.setDisplayed(visible);\r
- }else{\r
- this.fixDisplay();\r
- this.dom.style.visibility = visible ? "visible" : "hidden";\r
- }\r
- }else{\r
- // closure for composites\r
- var dom = this.dom;\r
- var visMode = this.visibilityMode;\r
- if(visible){\r
- this.setOpacity(.01);\r
- this.setVisible(true);\r
- }\r
- this.anim({opacity: { to: (visible?1:0) }},\r
- this.preanim(arguments, 1),\r
- null, .35, 'easeIn', function(){\r
- if(!visible){\r
- if(visMode == El.DISPLAY){\r
- dom.style.display = "none";\r
- }else{\r
- dom.style.visibility = "hidden";\r
- }\r
- Ext.get(dom).setOpacity(1);\r
- }\r
- });\r
- }\r
- return this;\r
- },\r
-\r
- \r
- isDisplayed : function() {\r
- return this.getStyle("display") != "none";\r
- },\r
-\r
- \r
- toggle : function(animate){\r
- this.setVisible(!this.isVisible(), this.preanim(arguments, 0));\r
- return this;\r
- },\r
-\r
- \r
- setDisplayed : function(value) {\r
- if(typeof value == "boolean"){\r
- value = value ? this.originalDisplay : "none";\r
- }\r
- this.setStyle("display", value);\r
- return this;\r
- },\r
-\r
- \r
- focus : function() {\r
- try{\r
- this.dom.focus();\r
- }catch(e){}\r
- return this;\r
- },\r
-\r
- \r
- blur : function() {\r
- try{\r
- this.dom.blur();\r
- }catch(e){}\r
- return this;\r
- },\r
-\r
- \r
- addClass : function(className){\r
- if(Ext.isArray(className)){\r
- for(var i = 0, len = className.length; i < len; i++) {\r
- this.addClass(className[i]);\r
- }\r
- }else{\r
- if(className && !this.hasClass(className)){\r
- this.dom.className = this.dom.className + " " + className;\r
- }\r
- }\r
- return this;\r
- },\r
-\r
- \r
- radioClass : function(className){\r
- var siblings = this.dom.parentNode.childNodes;\r
- for(var i = 0; i < siblings.length; i++) {\r
- var s = siblings[i];\r
- if(s.nodeType == 1){\r
- Ext.get(s).removeClass(className);\r
- }\r
- }\r
- this.addClass(className);\r
- return this;\r
- },\r
-\r
- \r
- removeClass : function(className){\r
- if(!className || !this.dom.className){\r
- return this;\r
- }\r
- if(Ext.isArray(className)){\r
- for(var i = 0, len = className.length; i < len; i++) {\r
- this.removeClass(className[i]);\r
- }\r
- }else{\r
- if(this.hasClass(className)){\r
- var re = this.classReCache[className];\r
- if (!re) {\r
- re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', "g");\r
- this.classReCache[className] = re;\r
- }\r
- this.dom.className =\r
- this.dom.className.replace(re, " ");\r
- }\r
- }\r
- return this;\r
- },\r
-\r
- // private\r
- classReCache: {},\r
-\r
- \r
- toggleClass : function(className){\r
- if(this.hasClass(className)){\r
- this.removeClass(className);\r
- }else{\r
- this.addClass(className);\r
- }\r
- return this;\r
- },\r
-\r
- \r
- hasClass : function(className){\r
- return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;\r
- },\r
-\r
- \r
- replaceClass : function(oldClassName, newClassName){\r
- this.removeClass(oldClassName);\r
- this.addClass(newClassName);\r
- return this;\r
- },\r
-\r
- \r
- getStyles : function(){\r
- var a = arguments, len = a.length, r = {};\r
- for(var i = 0; i < len; i++){\r
- r[a[i]] = this.getStyle(a[i]);\r
- }\r
- return r;\r
- },\r
-\r
- \r
- getStyle : function(){\r
- return view && view.getComputedStyle ?\r
- function(prop){\r
- var el = this.dom, v, cs, camel;\r
- if(prop == 'float'){\r
- prop = "cssFloat";\r
- }\r
- if(v = el.style[prop]){\r
- return v;\r
- }\r
- if(cs = view.getComputedStyle(el, "")){\r
- if(!(camel = propCache[prop])){\r
- camel = propCache[prop] = prop.replace(camelRe, camelFn);\r
- }\r
- return cs[camel];\r
- }\r
- return null;\r
- } :\r
- function(prop){\r
- var el = this.dom, v, cs, camel;\r
- if(prop == 'opacity'){\r
- if(typeof el.style.filter == 'string'){\r
- var m = el.style.filter.match(/alpha\(opacity=(.*)\)/i);\r
- if(m){\r
- var fv = parseFloat(m[1]);\r
- if(!isNaN(fv)){\r
- return fv ? fv / 100 : 0;\r
- }\r
- }\r
- }\r
- return 1;\r
- }else if(prop == 'float'){\r
- prop = "styleFloat";\r
- }\r
- if(!(camel = propCache[prop])){\r
- camel = propCache[prop] = prop.replace(camelRe, camelFn);\r
- }\r
- if(v = el.style[camel]){\r
- return v;\r
- }\r
- if(cs = el.currentStyle){\r
- return cs[camel];\r
- }\r
- return null;\r
- };\r
- }(),\r
-\r
- \r
- setStyle : function(prop, value){\r
- if(typeof prop == "string"){\r
- var camel;\r
- if(!(camel = propCache[prop])){\r
- camel = propCache[prop] = prop.replace(camelRe, camelFn);\r
- }\r
- if(camel == 'opacity') {\r
- this.setOpacity(value);\r
- }else{\r
- this.dom.style[camel] = value;\r
- }\r
- }else{\r
- for(var style in prop){\r
- if(typeof prop[style] != "function"){\r
- this.setStyle(style, prop[style]);\r
- }\r
- }\r
- }\r
- return this;\r
- },\r
-\r
- \r
- applyStyles : function(style){\r
- Ext.DomHelper.applyStyles(this.dom, style);\r
- return this;\r
- },\r
-\r
- \r
- getX : function(){\r
- return D.getX(this.dom);\r
- },\r
-\r
- \r
- getY : function(){\r
- return D.getY(this.dom);\r
- },\r
-\r
- \r
- getXY : function(){\r
- return D.getXY(this.dom);\r
- },\r
-\r
- \r
- getOffsetsTo : function(el){\r
- var o = this.getXY();\r
- var e = Ext.fly(el, '_internal').getXY();\r
- return [o[0]-e[0],o[1]-e[1]];\r
- },\r
-\r
- \r
- setX : function(x, animate){\r
- if(!animate || !A){\r
- D.setX(this.dom, x);\r
- }else{\r
- this.setXY([x, this.getY()], this.preanim(arguments, 1));\r
- }\r
- return this;\r
- },\r
-\r
- \r
- setY : function(y, animate){\r
- if(!animate || !A){\r
- D.setY(this.dom, y);\r
- }else{\r
- this.setXY([this.getX(), y], this.preanim(arguments, 1));\r
- }\r
- return this;\r
- },\r
-\r
- \r
- setLeft : function(left){\r
- this.setStyle("left", this.addUnits(left));\r
- return this;\r
- },\r
-\r
- \r
- setTop : function(top){\r
- this.setStyle("top", this.addUnits(top));\r
- return this;\r
- },\r
-\r
- \r
- setRight : function(right){\r
- this.setStyle("right", this.addUnits(right));\r
- return this;\r
- },\r
-\r
- \r
- setBottom : function(bottom){\r
- this.setStyle("bottom", this.addUnits(bottom));\r
- return this;\r
- },\r
-\r
- \r
- setXY : function(pos, animate){\r
- if(!animate || !A){\r
- D.setXY(this.dom, pos);\r
- }else{\r
- this.anim({points: {to: pos}}, this.preanim(arguments, 1), 'motion');\r
- }\r
- return this;\r
- },\r
-\r
- \r
- setLocation : function(x, y, animate){\r
- this.setXY([x, y], this.preanim(arguments, 2));\r
- return this;\r
- },\r
-\r
- \r
- moveTo : function(x, y, animate){\r
- this.setXY([x, y], this.preanim(arguments, 2));\r
- return this;\r
- },\r
-\r
- \r
- getRegion : function(){\r
- return D.getRegion(this.dom);\r
- },\r
-\r
- \r
- getHeight : function(contentHeight){\r
- var h = this.dom.offsetHeight || 0;\r
- h = contentHeight !== true ? h : h-this.getBorderWidth("tb")-this.getPadding("tb");\r
- return h < 0 ? 0 : h;\r
- },\r
-\r
- \r
- getWidth : function(contentWidth){\r
- var w = this.dom.offsetWidth || 0;\r
- w = contentWidth !== true ? w : w-this.getBorderWidth("lr")-this.getPadding("lr");\r
- return w < 0 ? 0 : w;\r
- },\r
-\r
- \r
- getComputedHeight : function(){\r
- var h = Math.max(this.dom.offsetHeight, this.dom.clientHeight);\r
- if(!h){\r
- h = parseInt(this.getStyle('height'), 10) || 0;\r
- if(!this.isBorderBox()){\r
- h += this.getFrameWidth('tb');\r
- }\r
- }\r
- return h;\r
- },\r
-\r
- \r
- getComputedWidth : function(){\r
- var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth);\r
- if(!w){\r
- w = parseInt(this.getStyle('width'), 10) || 0;\r
- if(!this.isBorderBox()){\r
- w += this.getFrameWidth('lr');\r
- }\r
- }\r
- return w;\r
- },\r
-\r
- \r
- getSize : function(contentSize){\r
- return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};\r
- },\r
-\r
- getStyleSize : function(){\r
- var w, h, d = this.dom, s = d.style;\r
- if(s.width && s.width != 'auto'){\r
- w = parseInt(s.width, 10);\r
- if(Ext.isBorderBox){\r
- w -= this.getFrameWidth('lr');\r
- }\r
- }\r
- if(s.height && s.height != 'auto'){\r
- h = parseInt(s.height, 10);\r
- if(Ext.isBorderBox){\r
- h -= this.getFrameWidth('tb');\r
- }\r
- }\r
- return {width: w || this.getWidth(true), height: h || this.getHeight(true)};\r
-\r
- },\r
-\r
- \r
- getViewSize : function(){\r
- var d = this.dom, doc = document, aw = 0, ah = 0;\r
- if(d == doc || d == doc.body){\r
- return {width : D.getViewWidth(), height: D.getViewHeight()};\r
- }else{\r
- return {\r
- width : d.clientWidth,\r
- height: d.clientHeight\r
- };\r
- }\r
- },\r
-\r
- \r
- getValue : function(asNumber){\r
- return asNumber ? parseInt(this.dom.value, 10) : this.dom.value;\r
- },\r
-\r
- // private\r
- adjustWidth : function(width){\r
- if(typeof width == "number"){\r
- if(this.autoBoxAdjust && !this.isBorderBox()){\r
- width -= (this.getBorderWidth("lr") + this.getPadding("lr"));\r
- }\r
- if(width < 0){\r
- width = 0;\r
- }\r
- }\r
- return width;\r
- },\r
-\r
- // private\r
- adjustHeight : function(height){\r
- if(typeof height == "number"){\r
- if(this.autoBoxAdjust && !this.isBorderBox()){\r
- height -= (this.getBorderWidth("tb") + this.getPadding("tb"));\r
- }\r
- if(height < 0){\r
- height = 0;\r
- }\r
- }\r
- return height;\r
- },\r
-\r
- \r
- setWidth : function(width, animate){\r
- width = this.adjustWidth(width);\r
- if(!animate || !A){\r
- this.dom.style.width = this.addUnits(width);\r
- }else{\r
- this.anim({width: {to: width}}, this.preanim(arguments, 1));\r
- }\r
- return this;\r
- },\r
-\r
- \r
- setHeight : function(height, animate){\r
- height = this.adjustHeight(height);\r
- if(!animate || !A){\r
- this.dom.style.height = this.addUnits(height);\r
- }else{\r
- this.anim({height: {to: height}}, this.preanim(arguments, 1));\r
- }\r
- return this;\r
- },\r
-\r
- \r
- setSize : function(width, height, animate){\r
- if(typeof width == "object"){ // in case of object from getSize()\r
- height = width.height; width = width.width;\r
- }\r
- width = this.adjustWidth(width); height = this.adjustHeight(height);\r
- if(!animate || !A){\r
- this.dom.style.width = this.addUnits(width);\r
- this.dom.style.height = this.addUnits(height);\r
- }else{\r
- this.anim({width: {to: width}, height: {to: height}}, this.preanim(arguments, 2));\r
- }\r
- return this;\r
- },\r
-\r
- \r
- setBounds : function(x, y, width, height, animate){\r
- if(!animate || !A){\r
- this.setSize(width, height);\r
- this.setLocation(x, y);\r
- }else{\r
- width = this.adjustWidth(width); height = this.adjustHeight(height);\r
- this.anim({points: {to: [x, y]}, width: {to: width}, height: {to: height}},\r
- this.preanim(arguments, 4), 'motion');\r
- }\r
- return this;\r
- },\r
-\r
- \r
- setRegion : function(region, animate){\r
- this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.preanim(arguments, 1));\r
- return this;\r
- },\r
-\r
- \r
- addListener : function(eventName, fn, scope, options){\r
- Ext.EventManager.on(this.dom, eventName, fn, scope || this, options);\r
- },\r
-\r
- \r
- removeListener : function(eventName, fn, scope){\r
- Ext.EventManager.removeListener(this.dom, eventName, fn, scope || this);\r
- return this;\r
- },\r
-\r
- \r
- removeAllListeners : function(){\r
- Ext.EventManager.removeAll(this.dom);\r
- return this;\r
- },\r
-\r
- \r
- relayEvent : function(eventName, observable){\r
- this.on(eventName, function(e){\r
- observable.fireEvent(eventName, e);\r
- });\r
- },\r
-\r
- \r
- setOpacity : function(opacity, animate){\r
- if(!animate || !A){\r
- var s = this.dom.style;\r
- if(Ext.isIE){\r
- s.zoom = 1;\r
- s.filter = (s.filter || '').replace(/alpha\([^\)]*\)/gi,"") +\r
- (opacity == 1 ? "" : " alpha(opacity=" + opacity * 100 + ")");\r
- }else{\r
- s.opacity = opacity;\r
- }\r
- }else{\r
- this.anim({opacity: {to: opacity}}, this.preanim(arguments, 1), null, .35, 'easeIn');\r
- }\r
- return this;\r
- },\r
-\r
- \r
- getLeft : function(local){\r
- if(!local){\r
- return this.getX();\r
- }else{\r
- return parseInt(this.getStyle("left"), 10) || 0;\r
- }\r
- },\r
-\r
- \r
- getRight : function(local){\r
- if(!local){\r
- return this.getX() + this.getWidth();\r
- }else{\r
- return (this.getLeft(true) + this.getWidth()) || 0;\r
- }\r
- },\r
-\r
- \r
- getTop : function(local) {\r
- if(!local){\r
- return this.getY();\r
- }else{\r
- return parseInt(this.getStyle("top"), 10) || 0;\r
- }\r
- },\r
-\r
- \r
- getBottom : function(local){\r
- if(!local){\r
- return this.getY() + this.getHeight();\r
- }else{\r
- return (this.getTop(true) + this.getHeight()) || 0;\r
- }\r
- },\r
-\r
- \r
- position : function(pos, zIndex, x, y){\r
- if(!pos){\r
- if(this.getStyle('position') == 'static'){\r
- this.setStyle('position', 'relative');\r
- }\r
- }else{\r
- this.setStyle("position", pos);\r
- }\r
- if(zIndex){\r
- this.setStyle("z-index", zIndex);\r
- }\r
- if(x !== undefined && y !== undefined){\r
- this.setXY([x, y]);\r
- }else if(x !== undefined){\r
- this.setX(x);\r
- }else if(y !== undefined){\r
- this.setY(y);\r
- }\r
- },\r
-\r
- \r
- clearPositioning : function(value){\r
- value = value ||'';\r
- this.setStyle({\r
- "left": value,\r
- "right": value,\r
- "top": value,\r
- "bottom": value,\r
- "z-index": "",\r
- "position" : "static"\r
- });\r
- return this;\r
- },\r
-\r
- \r
- getPositioning : function(){\r
- var l = this.getStyle("left");\r
- var t = this.getStyle("top");\r
- return {\r
- "position" : this.getStyle("position"),\r
- "left" : l,\r
- "right" : l ? "" : this.getStyle("right"),\r
- "top" : t,\r
- "bottom" : t ? "" : this.getStyle("bottom"),\r
- "z-index" : this.getStyle("z-index")\r
- };\r
- },\r
-\r
- \r
- getBorderWidth : function(side){\r
- return this.addStyles(side, El.borders);\r
- },\r
-\r
- \r
- getPadding : function(side){\r
- return this.addStyles(side, El.paddings);\r
- },\r
-\r
- \r
- setPositioning : function(pc){\r
- this.applyStyles(pc);\r
- if(pc.right == "auto"){\r
- this.dom.style.right = "";\r
- }\r
- if(pc.bottom == "auto"){\r
- this.dom.style.bottom = "";\r
- }\r
- return this;\r
- },\r
-\r
- // private\r
- fixDisplay : function(){\r
- if(this.getStyle("display") == "none"){\r
- this.setStyle("visibility", "hidden");\r
- this.setStyle("display", this.originalDisplay); // first try reverting to default\r
- if(this.getStyle("display") == "none"){ // if that fails, default to block\r
- this.setStyle("display", "block");\r
- }\r
- }\r
- },\r
-\r
- // private\r
- setOverflow : function(v){\r
- if(v=='auto' && Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug\r
- this.dom.style.overflow = 'hidden';\r
- (function(){this.dom.style.overflow = 'auto';}).defer(1, this);\r
- }else{\r
- this.dom.style.overflow = v;\r
- }\r
- },\r
-\r
- \r
- setLeftTop : function(left, top){\r
- this.dom.style.left = this.addUnits(left);\r
- this.dom.style.top = this.addUnits(top);\r
- return this;\r
- },\r
-\r
- \r
- move : function(direction, distance, animate){\r
- var xy = this.getXY();\r
- direction = direction.toLowerCase();\r
- switch(direction){\r
- case "l":\r
- case "left":\r
- this.moveTo(xy[0]-distance, xy[1], this.preanim(arguments, 2));\r
- break;\r
- case "r":\r
- case "right":\r
- this.moveTo(xy[0]+distance, xy[1], this.preanim(arguments, 2));\r
- break;\r
- case "t":\r
- case "top":\r
- case "up":\r
- this.moveTo(xy[0], xy[1]-distance, this.preanim(arguments, 2));\r
- break;\r
- case "b":\r
- case "bottom":\r
- case "down":\r
- this.moveTo(xy[0], xy[1]+distance, this.preanim(arguments, 2));\r
- break;\r
- }\r
- return this;\r
- },\r
-\r
- \r
- clip : function(){\r
- if(!this.isClipped){\r
- this.isClipped = true;\r
- this.originalClip = {\r
- "o": this.getStyle("overflow"),\r
- "x": this.getStyle("overflow-x"),\r
- "y": this.getStyle("overflow-y")\r
- };\r
- this.setStyle("overflow", "hidden");\r
- this.setStyle("overflow-x", "hidden");\r
- this.setStyle("overflow-y", "hidden");\r
- }\r
- return this;\r
- },\r
-\r
- \r
- unclip : function(){\r
- if(this.isClipped){\r
- this.isClipped = false;\r
- var o = this.originalClip;\r
- if(o.o){this.setStyle("overflow", o.o);}\r
- if(o.x){this.setStyle("overflow-x", o.x);}\r
- if(o.y){this.setStyle("overflow-y", o.y);}\r
- }\r
- return this;\r
- },\r
-\r
-\r
- \r
- getAnchorXY : function(anchor, local, s){\r
- //Passing a different size is useful for pre-calculating anchors,\r
- //especially for anchored animations that change the el size.\r
-\r
- var w, h, vp = false;\r
- if(!s){\r
- var d = this.dom;\r
- if(d == document.body || d == document){\r
- vp = true;\r
- w = D.getViewWidth(); h = D.getViewHeight();\r
- }else{\r
- w = this.getWidth(); h = this.getHeight();\r
- }\r
- }else{\r
- w = s.width; h = s.height;\r
- }\r
- var x = 0, y = 0, r = Math.round;\r
- switch((anchor || "tl").toLowerCase()){\r
- case "c":\r
- x = r(w*.5);\r
- y = r(h*.5);\r
- break;\r
- case "t":\r
- x = r(w*.5);\r
- y = 0;\r
- break;\r
- case "l":\r
- x = 0;\r
- y = r(h*.5);\r
- break;\r
- case "r":\r
- x = w;\r
- y = r(h*.5);\r
- break;\r
- case "b":\r
- x = r(w*.5);\r
- y = h;\r
- break;\r
- case "tl":\r
- x = 0;\r
- y = 0;\r
- break;\r
- case "bl":\r
- x = 0;\r
- y = h;\r
- break;\r
- case "br":\r
- x = w;\r
- y = h;\r
- break;\r
- case "tr":\r
- x = w;\r
- y = 0;\r
- break;\r
- }\r
- if(local === true){\r
- return [x, y];\r
- }\r
- if(vp){\r
- var sc = this.getScroll();\r
- return [x + sc.left, y + sc.top];\r
- }\r
- //Add the element's offset xy\r
- var o = this.getXY();\r
- return [x+o[0], y+o[1]];\r
- },\r
-\r
- \r
- getAlignToXY : function(el, p, o){\r
- el = Ext.get(el);\r
- if(!el || !el.dom){\r
- throw "Element.alignToXY with an element that doesn't exist";\r
- }\r
- var d = this.dom;\r
- var c = false; //constrain to viewport\r
- var p1 = "", p2 = "";\r
- o = o || [0,0];\r
-\r
- if(!p){\r
- p = "tl-bl";\r
- }else if(p == "?"){\r
- p = "tl-bl?";\r
- }else if(p.indexOf("-") == -1){\r
- p = "tl-" + p;\r
- }\r
- p = p.toLowerCase();\r
- var m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/);\r
- if(!m){\r
- throw "Element.alignTo with an invalid alignment " + p;\r
- }\r
- p1 = m[1]; p2 = m[2]; c = !!m[3];\r
-\r
- //Subtract the aligned el's internal xy from the target's offset xy\r
- //plus custom offset to get the aligned el's new offset xy\r
- var a1 = this.getAnchorXY(p1, true);\r
- var a2 = el.getAnchorXY(p2, false);\r
-\r
- var x = a2[0] - a1[0] + o[0];\r
- var y = a2[1] - a1[1] + o[1];\r
-\r
- if(c){\r
- //constrain the aligned el to viewport if necessary\r
- var w = this.getWidth(), h = this.getHeight(), r = el.getRegion();\r
- // 5px of margin for ie\r
- var dw = D.getViewWidth()-5, dh = D.getViewHeight()-5;\r
-\r
- //If we are at a viewport boundary and the aligned el is anchored on a target border that is\r
- //perpendicular to the vp border, allow the aligned el to slide on that border,\r
- //otherwise swap the aligned el to the opposite border of the target.\r
- var p1y = p1.charAt(0), p1x = p1.charAt(p1.length-1);\r
- var p2y = p2.charAt(0), p2x = p2.charAt(p2.length-1);\r
- var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t"));\r
- var swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r"));\r
-\r
- var doc = document;\r
- var scrollX = (doc.documentElement.scrollLeft || doc.body.scrollLeft || 0)+5;\r
- var scrollY = (doc.documentElement.scrollTop || doc.body.scrollTop || 0)+5;\r
-\r
- if((x+w) > dw + scrollX){\r
- x = swapX ? r.left-w : dw+scrollX-w;\r
- }\r
- if(x < scrollX){\r
- x = swapX ? r.right : scrollX;\r
- }\r
- if((y+h) > dh + scrollY){\r
- y = swapY ? r.top-h : dh+scrollY-h;\r
- }\r
- if (y < scrollY){\r
- y = swapY ? r.bottom : scrollY;\r
- }\r
- }\r
- return [x,y];\r
- },\r
-\r
- // private\r
- getConstrainToXY : function(){\r
- var os = {top:0, left:0, bottom:0, right: 0};\r
-\r
- return function(el, local, offsets, proposedXY){\r
- el = Ext.get(el);\r
- offsets = offsets ? Ext.applyIf(offsets, os) : os;\r
-\r
- var vw, vh, vx = 0, vy = 0;\r
- if(el.dom == document.body || el.dom == document){\r
- vw = Ext.lib.Dom.getViewWidth();\r
- vh = Ext.lib.Dom.getViewHeight();\r
- }else{\r
- vw = el.dom.clientWidth;\r
- vh = el.dom.clientHeight;\r
- if(!local){\r
- var vxy = el.getXY();\r
- vx = vxy[0];\r
- vy = vxy[1];\r
- }\r
- }\r
-\r
- var s = el.getScroll();\r
-\r
- vx += offsets.left + s.left;\r
- vy += offsets.top + s.top;\r
-\r
- vw -= offsets.right;\r
- vh -= offsets.bottom;\r
-\r
- var vr = vx+vw;\r
- var vb = vy+vh;\r
-\r
- var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]);\r
- var x = xy[0], y = xy[1];\r
- var w = this.dom.offsetWidth, h = this.dom.offsetHeight;\r
-\r
- // only move it if it needs it\r
- var moved = false;\r
-\r
- // first validate right/bottom\r
- if((x + w) > vr){\r
- x = vr - w;\r
- moved = true;\r
- }\r
- if((y + h) > vb){\r
- y = vb - h;\r
- moved = true;\r
- }\r
- // then make sure top/left isn't negative\r
- if(x < vx){\r
- x = vx;\r
- moved = true;\r
- }\r
- if(y < vy){\r
- y = vy;\r
- moved = true;\r
- }\r
- return moved ? [x, y] : false;\r
- };\r
- }(),\r
-\r
- // private\r
- adjustForConstraints : function(xy, parent, offsets){\r
- return this.getConstrainToXY(parent || document, false, offsets, xy) || xy;\r
- },\r
-\r
- \r
- alignTo : function(element, position, offsets, animate){\r
- var xy = this.getAlignToXY(element, position, offsets);\r
- this.setXY(xy, this.preanim(arguments, 3));\r
- return this;\r
- },\r
-\r
- \r
- anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){\r
- var action = function(){\r
- this.alignTo(el, alignment, offsets, animate);\r
- Ext.callback(callback, this);\r
- };\r
- Ext.EventManager.onWindowResize(action, this);\r
- var tm = typeof monitorScroll;\r
- if(tm != 'undefined'){\r
- Ext.EventManager.on(window, 'scroll', action, this,\r
- {buffer: tm == 'number' ? monitorScroll : 50});\r
- }\r
- action.call(this); // align immediately\r
- return this;\r
- },\r
- \r
- clearOpacity : function(){\r
- if (window.ActiveXObject) {\r
- if(typeof this.dom.style.filter == 'string' && (/alpha/i).test(this.dom.style.filter)){\r
- this.dom.style.filter = "";\r
- }\r
- } else {\r
- this.dom.style.opacity = "";\r
- this.dom.style["-moz-opacity"] = "";\r
- this.dom.style["-khtml-opacity"] = "";\r
- }\r
- return this;\r
- },\r
-\r
- \r
- hide : function(animate){\r
- this.setVisible(false, this.preanim(arguments, 0));\r
- return this;\r
- },\r
-\r
- \r
- show : function(animate){\r
- this.setVisible(true, this.preanim(arguments, 0));\r
- return this;\r
- },\r
-\r
- \r
- addUnits : function(size){\r
- return Ext.Element.addUnits(size, this.defaultUnit);\r
- },\r
-\r
- \r
- update : function(html, loadScripts, callback){\r
- if(typeof html == "undefined"){\r
- html = "";\r
- }\r
- if(loadScripts !== true){\r
- this.dom.innerHTML = html;\r
- if(typeof callback == "function"){\r
- callback();\r
- }\r
- return this;\r
- }\r
- var id = Ext.id();\r
- var dom = this.dom;\r
-\r
- html += '<span id="' + id + '"></span>';\r
-\r
- E.onAvailable(id, function(){\r
- var hd = document.getElementsByTagName("head")[0];\r
- var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;\r
- var srcRe = /\ssrc=([\'\"])(.*?)\1/i;\r
- var typeRe = /\stype=([\'\"])(.*?)\1/i;\r
-\r
- var match;\r
- while(match = re.exec(html)){\r
- var attrs = match[1];\r
- var srcMatch = attrs ? attrs.match(srcRe) : false;\r
- if(srcMatch && srcMatch[2]){\r
- var s = document.createElement("script");\r
- s.src = srcMatch[2];\r
- var typeMatch = attrs.match(typeRe);\r
- if(typeMatch && typeMatch[2]){\r
- s.type = typeMatch[2];\r
- }\r
- hd.appendChild(s);\r
- }else if(match[2] && match[2].length > 0){\r
- if(window.execScript) {\r
- window.execScript(match[2]);\r
- } else {\r
- window.eval(match[2]);\r
- }\r
- }\r
- }\r
- var el = document.getElementById(id);\r
- if(el){Ext.removeNode(el);}\r
- if(typeof callback == "function"){\r
- callback();\r
- }\r
- });\r
- dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");\r
- return this;\r
- },\r
-\r
- \r
- load : function(){\r
- var um = this.getUpdater();\r
- um.update.apply(um, arguments);\r
- return this;\r
- },\r
-\r
- \r
- getUpdater : function(){\r
- if(!this.updateManager){\r
- this.updateManager = new Ext.Updater(this);\r
- }\r
- return this.updateManager;\r
- },\r
-\r
- \r
- unselectable : function(){\r
- this.dom.unselectable = "on";\r
- this.swallowEvent("selectstart", true);\r
- this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");\r
- this.addClass("x-unselectable");\r
- return this;\r
- },\r
-\r
- \r
- getCenterXY : function(){\r
- return this.getAlignToXY(document, 'c-c');\r
- },\r
-\r
- \r
- center : function(centerIn){\r
- this.alignTo(centerIn || document, 'c-c');\r
- return this;\r
- },\r
-\r
- \r
- isBorderBox : function(){\r
- return noBoxAdjust[this.dom.tagName.toLowerCase()] || Ext.isBorderBox;\r
- },\r
-\r
- \r
- getBox : function(contentBox, local){\r
- var xy;\r
- if(!local){\r
- xy = this.getXY();\r
- }else{\r
- var left = parseInt(this.getStyle("left"), 10) || 0;\r
- var top = parseInt(this.getStyle("top"), 10) || 0;\r
- xy = [left, top];\r
- }\r
- var el = this.dom, w = el.offsetWidth, h = el.offsetHeight, bx;\r
- if(!contentBox){\r
- bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h};\r
- }else{\r
- var l = this.getBorderWidth("l")+this.getPadding("l");\r
- var r = this.getBorderWidth("r")+this.getPadding("r");\r
- var t = this.getBorderWidth("t")+this.getPadding("t");\r
- var b = this.getBorderWidth("b")+this.getPadding("b");\r
- bx = {x: xy[0]+l, y: xy[1]+t, 0: xy[0]+l, 1: xy[1]+t, width: w-(l+r), height: h-(t+b)};\r
- }\r
- bx.right = bx.x + bx.width;\r
- bx.bottom = bx.y + bx.height;\r
- return bx;\r
- },\r
-\r
- \r
- getFrameWidth : function(sides, onlyContentBox){\r
- return onlyContentBox && Ext.isBorderBox ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));\r
- },\r
-\r
- \r
- setBox : function(box, adjust, animate){\r
- var w = box.width, h = box.height;\r
- if((adjust && !this.autoBoxAdjust) && !this.isBorderBox()){\r
- w -= (this.getBorderWidth("lr") + this.getPadding("lr"));\r
- h -= (this.getBorderWidth("tb") + this.getPadding("tb"));\r
- }\r
- this.setBounds(box.x, box.y, w, h, this.preanim(arguments, 2));\r
- return this;\r
- },\r
-\r
- \r
- repaint : function(){\r
- var dom = this.dom;\r
- this.addClass("x-repaint");\r
- setTimeout(function(){\r
- Ext.get(dom).removeClass("x-repaint");\r
- }, 1);\r
- return this;\r
- },\r
-\r
- \r
- getMargins : function(side){\r
- if(!side){\r
- return {\r
- top: parseInt(this.getStyle("margin-top"), 10) || 0,\r
- left: parseInt(this.getStyle("margin-left"), 10) || 0,\r
- bottom: parseInt(this.getStyle("margin-bottom"), 10) || 0,\r
- right: parseInt(this.getStyle("margin-right"), 10) || 0\r
- };\r
- }else{\r
- return this.addStyles(side, El.margins);\r
- }\r
- },\r
-\r
- // private\r
- addStyles : function(sides, styles){\r
- var val = 0, v, w;\r
- for(var i = 0, len = sides.length; i < len; i++){\r
- v = this.getStyle(styles[sides.charAt(i)]);\r
- if(v){\r
- w = parseInt(v, 10);\r
- if(w){ val += (w >= 0 ? w : -1 * w); }\r
- }\r
- }\r
- return val;\r
- },\r
-\r
- \r
- createProxy : function(config, renderTo, matchBox){\r
- config = typeof config == "object" ?\r
- config : {tag : "div", cls: config};\r
-\r
- var proxy;\r
- if(renderTo){\r
- proxy = Ext.DomHelper.append(renderTo, config, true);\r
- }else {\r
- proxy = Ext.DomHelper.insertBefore(this.dom, config, true);\r
- }\r
- if(matchBox){\r
- proxy.setBox(this.getBox());\r
- }\r
- return proxy;\r
- },\r
-\r
- \r
- mask : function(msg, msgCls){\r
- if(this.getStyle("position") == "static"){\r
- this.addClass("x-masked-relative");\r
- }\r
- if(this._maskMsg){\r
- this._maskMsg.remove();\r
- }\r
- if(this._mask){\r
- this._mask.remove();\r
- }\r
-\r
- this._mask = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask"}, true);\r
-\r
- this.addClass("x-masked");\r
- this._mask.setDisplayed(true);\r
- if(typeof msg == 'string'){\r
- this._maskMsg = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask-msg", cn:{tag:'div'}}, true);\r
- var mm = this._maskMsg;\r
- mm.dom.className = msgCls ? "ext-el-mask-msg " + msgCls : "ext-el-mask-msg";\r
- mm.dom.firstChild.innerHTML = msg;\r
- mm.setDisplayed(true);\r
- mm.center(this);\r
- }\r
- if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && this.getStyle('height') == 'auto'){ // ie will not expand full height automatically\r
- this._mask.setSize(this.getWidth(), this.getHeight());\r
- }\r
- return this._mask;\r
- },\r
-\r
- \r
- unmask : function(){\r
- if(this._mask){\r
- if(this._maskMsg){\r
- this._maskMsg.remove();\r
- delete this._maskMsg;\r
- }\r
- this._mask.remove();\r
- delete this._mask;\r
- }\r
- this.removeClass(["x-masked", "x-masked-relative"]);\r
- },\r
-\r
- \r
- isMasked : function(){\r
- return this._mask && this._mask.isVisible();\r
- },\r
-\r
- \r
- createShim : function(){\r
- var el = document.createElement('iframe');\r
- el.frameBorder = '0';\r
- el.className = 'ext-shim';\r
- if(Ext.isIE && Ext.isSecure){\r
- el.src = Ext.SSL_SECURE_URL;\r
- }\r
- var shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));\r
- shim.autoBoxAdjust = false;\r
- return shim;\r
- },\r
-\r
- \r
- remove : function(){\r
- Ext.removeNode(this.dom);\r
- delete El.cache[this.dom.id];\r
- },\r
-\r
- \r
- hover : function(overFn, outFn, scope){\r
- var preOverFn = function(e){\r
- if(!e.within(this, true)){\r
- overFn.apply(scope || this, arguments);\r
- }\r
- };\r
- var preOutFn = function(e){\r
- if(!e.within(this, true)){\r
- outFn.apply(scope || this, arguments);\r
- }\r
- };\r
- this.on("mouseover", preOverFn, this.dom);\r
- this.on("mouseout", preOutFn, this.dom);\r
- return this;\r
- },\r
-\r
- \r
- addClassOnOver : function(className){\r
- this.hover(\r
- function(){\r
- Ext.fly(this, '_internal').addClass(className);\r
- },\r
- function(){\r
- Ext.fly(this, '_internal').removeClass(className);\r
- }\r
- );\r
- return this;\r
- },\r
-\r
- \r
- addClassOnFocus : function(className){\r
- this.on("focus", function(){\r
- Ext.fly(this, '_internal').addClass(className);\r
- }, this.dom);\r
- this.on("blur", function(){\r
- Ext.fly(this, '_internal').removeClass(className);\r
- }, this.dom);\r
- return this;\r
- },\r
- \r
- addClassOnClick : function(className){\r
- var dom = this.dom;\r
- this.on("mousedown", function(){\r
- Ext.fly(dom, '_internal').addClass(className);\r
- var d = Ext.getDoc();\r
- var fn = function(){\r
- Ext.fly(dom, '_internal').removeClass(className);\r
- d.removeListener("mouseup", fn);\r
- };\r
- d.on("mouseup", fn);\r
- });\r
- return this;\r
- },\r
-\r
- \r
- swallowEvent : function(eventName, preventDefault){\r
- var fn = function(e){\r
- e.stopPropagation();\r
- if(preventDefault){\r
- e.preventDefault();\r
- }\r
- };\r
- if(Ext.isArray(eventName)){\r
- for(var i = 0, len = eventName.length; i < len; i++){\r
- this.on(eventName[i], fn);\r
- }\r
- return this;\r
- }\r
- this.on(eventName, fn);\r
- return this;\r
- },\r
-\r
- \r
- parent : function(selector, returnDom){\r
- return this.matchNode('parentNode', 'parentNode', selector, returnDom);\r
- },\r
-\r
- \r
- next : function(selector, returnDom){\r
- return this.matchNode('nextSibling', 'nextSibling', selector, returnDom);\r
- },\r
-\r
- \r
- prev : function(selector, returnDom){\r
- return this.matchNode('previousSibling', 'previousSibling', selector, returnDom);\r
- },\r
-\r
-\r
- \r
- first : function(selector, returnDom){\r
- return this.matchNode('nextSibling', 'firstChild', selector, returnDom);\r
- },\r
-\r
- \r
- last : function(selector, returnDom){\r
- return this.matchNode('previousSibling', 'lastChild', selector, returnDom);\r
- },\r
-\r
- matchNode : function(dir, start, selector, returnDom){\r
- var n = this.dom[start];\r
- while(n){\r
- if(n.nodeType == 1 && (!selector || Ext.DomQuery.is(n, selector))){\r
- return !returnDom ? Ext.get(n) : n;\r
- }\r
- n = n[dir];\r
- }\r
- return null;\r
- },\r
-\r
- \r
- appendChild: function(el){\r
- el = Ext.get(el);\r
- el.appendTo(this);\r
- return this;\r
- },\r
-\r
- \r
- createChild: function(config, insertBefore, returnDom){\r
- config = config || {tag:'div'};\r
- if(insertBefore){\r
- return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true);\r
- }\r
- return Ext.DomHelper[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config, returnDom !== true);\r
- },\r
-\r
- \r
- appendTo: function(el){\r
- el = Ext.getDom(el);\r
- el.appendChild(this.dom);\r
- return this;\r
- },\r
-\r
- \r
- insertBefore: function(el){\r
- el = Ext.getDom(el);\r
- el.parentNode.insertBefore(this.dom, el);\r
- return this;\r
- },\r
-\r
- \r
- insertAfter: function(el){\r
- el = Ext.getDom(el);\r
- el.parentNode.insertBefore(this.dom, el.nextSibling);\r
- return this;\r
- },\r
-\r
- \r
- insertFirst: function(el, returnDom){\r
- el = el || {};\r
- if(typeof el == 'object' && !el.nodeType && !el.dom){ // dh config\r
- return this.createChild(el, this.dom.firstChild, returnDom);\r
- }else{\r
- el = Ext.getDom(el);\r
- this.dom.insertBefore(el, this.dom.firstChild);\r
- return !returnDom ? Ext.get(el) : el;\r
- }\r
- },\r
-\r
- \r
- insertSibling: function(el, where, returnDom){\r
- var rt;\r
- if(Ext.isArray(el)){\r
- for(var i = 0, len = el.length; i < len; i++){\r
- rt = this.insertSibling(el[i], where, returnDom);\r
- }\r
- return rt;\r
- }\r
- where = where ? where.toLowerCase() : 'before';\r
- el = el || {};\r
- var refNode = where == 'before' ? this.dom : this.dom.nextSibling;\r
-\r
- if(typeof el == 'object' && !el.nodeType && !el.dom){ // dh config\r
- if(where == 'after' && !this.dom.nextSibling){\r
- rt = Ext.DomHelper.append(this.dom.parentNode, el, !returnDom);\r
- }else{\r
- rt = Ext.DomHelper[where == 'after' ? 'insertAfter' : 'insertBefore'](this.dom, el, !returnDom);\r
- }\r
-\r
- }else{\r
- rt = this.dom.parentNode.insertBefore(Ext.getDom(el), refNode);\r
- if(!returnDom){\r
- rt = Ext.get(rt);\r
- }\r
- }\r
- return rt;\r
- },\r
-\r
- \r
- wrap: function(config, returnDom){\r
- if(!config){\r
- config = {tag: "div"};\r
- }\r
- var newEl = Ext.DomHelper.insertBefore(this.dom, config, !returnDom);\r
- newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);\r
- return newEl;\r
- },\r
-\r
- \r
- replace: function(el){\r
- el = Ext.get(el);\r
- this.insertBefore(el);\r
- el.remove();\r
- return this;\r
- },\r
-\r
- \r
- replaceWith: function(el){\r
- if(typeof el == 'object' && !el.nodeType && !el.dom){ // dh config\r
- el = this.insertSibling(el, 'before');\r
- }else{\r
- el = Ext.getDom(el);\r
- this.dom.parentNode.insertBefore(el, this.dom);\r
- }\r
- El.uncache(this.id);\r
- Ext.removeNode(this.dom);\r
- this.dom = el;\r
- this.id = Ext.id(el);\r
- El.cache[this.id] = this;\r
- return this;\r
- },\r
-\r
- \r
- insertHtml : function(where, html, returnEl){\r
- var el = Ext.DomHelper.insertHtml(where, this.dom, html);\r
- return returnEl ? Ext.get(el) : el;\r
- },\r
-\r
- \r
- set : function(o, useSet){\r
- var el = this.dom;\r
- useSet = typeof useSet == 'undefined' ? (el.setAttribute ? true : false) : useSet;\r
- for(var attr in o){\r
- if(attr == "style" || typeof o[attr] == "function") continue;\r
- if(attr=="cls"){\r
- el.className = o["cls"];\r
- }else if(o.hasOwnProperty(attr)){\r
- if(useSet) el.setAttribute(attr, o[attr]);\r
- else el[attr] = o[attr];\r
- }\r
- }\r
- if(o.style){\r
- Ext.DomHelper.applyStyles(el, o.style);\r
- }\r
- return this;\r
- },\r
-\r
- \r
- addKeyListener : function(key, fn, scope){\r
- var config;\r
- if(typeof key != "object" || Ext.isArray(key)){\r
- config = {\r
- key: key,\r
- fn: fn,\r
- scope: scope\r
- };\r
- }else{\r
- config = {\r
- key : key.key,\r
- shift : key.shift,\r
- ctrl : key.ctrl,\r
- alt : key.alt,\r
- fn: fn,\r
- scope: scope\r
- };\r
- }\r
- return new Ext.KeyMap(this, config);\r
- },\r
-\r
- \r
- addKeyMap : function(config){\r
- return new Ext.KeyMap(this, config);\r
- },\r
-\r
- \r
- isScrollable : function(){\r
- var dom = this.dom;\r
- return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;\r
- },\r
-\r
- \r
- scrollTo : function(side, value, animate){\r
- var prop = side.toLowerCase() == "left" ? "scrollLeft" : "scrollTop";\r
- if(!animate || !A){\r
- this.dom[prop] = value;\r
- }else{\r
- var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [this.dom.scrollLeft, value];\r
- this.anim({scroll: {"to": to}}, this.preanim(arguments, 2), 'scroll');\r
- }\r
- return this;\r
- },\r
-\r
- \r
- scroll : function(direction, distance, animate){\r
- if(!this.isScrollable()){\r
- return;\r
- }\r
- var el = this.dom;\r
- var l = el.scrollLeft, t = el.scrollTop;\r
- var w = el.scrollWidth, h = el.scrollHeight;\r
- var cw = el.clientWidth, ch = el.clientHeight;\r
- direction = direction.toLowerCase();\r
- var scrolled = false;\r
- var a = this.preanim(arguments, 2);\r
- switch(direction){\r
- case "l":\r
- case "left":\r
- if(w - l > cw){\r
- var v = Math.min(l + distance, w-cw);\r
- this.scrollTo("left", v, a);\r
- scrolled = true;\r
- }\r
- break;\r
- case "r":\r
- case "right":\r
- if(l > 0){\r
- var v = Math.max(l - distance, 0);\r
- this.scrollTo("left", v, a);\r
- scrolled = true;\r
- }\r
- break;\r
- case "t":\r
- case "top":\r
- case "up":\r
- if(t > 0){\r
- var v = Math.max(t - distance, 0);\r
- this.scrollTo("top", v, a);\r
- scrolled = true;\r
- }\r
- break;\r
- case "b":\r
- case "bottom":\r
- case "down":\r
- if(h - t > ch){\r
- var v = Math.min(t + distance, h-ch);\r
- this.scrollTo("top", v, a);\r
- scrolled = true;\r
- }\r
- break;\r
- }\r
- return scrolled;\r
- },\r
-\r
- \r
- translatePoints : function(x, y){\r
- if(typeof x == 'object' || Ext.isArray(x)){\r
- y = x[1]; x = x[0];\r
- }\r
- var p = this.getStyle('position');\r
- var o = this.getXY();\r
-\r
- var l = parseInt(this.getStyle('left'), 10);\r
- var t = parseInt(this.getStyle('top'), 10);\r
-\r
- if(isNaN(l)){\r
- l = (p == "relative") ? 0 : this.dom.offsetLeft;\r
- }\r
- if(isNaN(t)){\r
- t = (p == "relative") ? 0 : this.dom.offsetTop;\r
- }\r
-\r
- return {left: (x - o[0] + l), top: (y - o[1] + t)};\r
- },\r
-\r
- \r
- getScroll : function(){\r
- var d = this.dom, doc = document;\r
- if(d == doc || d == doc.body){\r
- var l, t;\r
- if(Ext.isIE && Ext.isStrict){\r
- l = doc.documentElement.scrollLeft || (doc.body.scrollLeft || 0);\r
- t = doc.documentElement.scrollTop || (doc.body.scrollTop || 0);\r
- }else{\r
- l = window.pageXOffset || (doc.body.scrollLeft || 0);\r
- t = window.pageYOffset || (doc.body.scrollTop || 0);\r
- }\r
- return {left: l, top: t};\r
- }else{\r
- return {left: d.scrollLeft, top: d.scrollTop};\r
- }\r
- },\r
-\r
- \r
- getColor : function(attr, defaultValue, prefix){\r
- var v = this.getStyle(attr);\r
- if(!v || v == "transparent" || v == "inherit") {\r
- return defaultValue;\r
- }\r
- var color = typeof prefix == "undefined" ? "#" : prefix;\r
- if(v.substr(0, 4) == "rgb("){\r
- var rvs = v.slice(4, v.length -1).split(",");\r
- for(var i = 0; i < 3; i++){\r
- var h = parseInt(rvs[i]);\r
- var s = h.toString(16);\r
- if(h < 16){\r
- s = "0" + s;\r
- }\r
- color += s;\r
- }\r
- } else {\r
- if(v.substr(0, 1) == "#"){\r
- if(v.length == 4) {\r
- for(var i = 1; i < 4; i++){\r
- var c = v.charAt(i);\r
- color += c + c;\r
- }\r
- }else if(v.length == 7){\r
- color += v.substr(1);\r
- }\r
- }\r
- }\r
- return(color.length > 5 ? color.toLowerCase() : defaultValue);\r
- },\r
-\r
- \r
- boxWrap : function(cls){\r
- cls = cls || 'x-box';\r
- var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+El.boxMarkup+'</div>', cls)));\r
- el.child('.'+cls+'-mc').dom.appendChild(this.dom);\r
- return el;\r
- },\r
-\r
- \r
- getAttributeNS : Ext.isIE ? function(ns, name){\r
- var d = this.dom;\r
- var type = typeof d[ns+":"+name];\r
- if(type != 'undefined' && type != 'unknown'){\r
- return d[ns+":"+name];\r
- }\r
- return d[name];\r
- } : function(ns, name){\r
- var d = this.dom;\r
- return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name];\r
- },\r
-\r
- \r
- getTextWidth : function(text, min, max){\r
- return (Ext.util.TextMetrics.measure(this.dom, Ext.value(text, this.dom.innerHTML, true)).width).constrain(min || 0, max || 1000000);\r
- }\r
-};\r
-\r
-var ep = El.prototype;\r
-\r
-\r
-ep.on = ep.addListener;\r
- // backwards compat\r
-ep.mon = ep.addListener;\r
-\r
-ep.getUpdateManager = ep.getUpdater;\r
-\r
-\r
-ep.un = ep.removeListener;\r
-\r
-\r
-ep.autoBoxAdjust = true;\r
-\r
-// private\r
-El.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;\r
-\r
-// private\r
-El.addUnits = function(v, defaultUnit){\r
- if(v === "" || v == "auto"){\r
- return v;\r
- }\r
- if(v === undefined){\r
- return '';\r
- }\r
- if(typeof v == "number" || !El.unitPattern.test(v)){\r
- return v + (defaultUnit || 'px');\r
- }\r
- return v;\r
-};\r
-\r
-// special markup used throughout Ext when box wrapping elements\r
-El.boxMarkup = '<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';\r
-\r
-El.VISIBILITY = 1;\r
-\r
-El.DISPLAY = 2;\r
-\r
-El.borders = {l: "border-left-width", r: "border-right-width", t: "border-top-width", b: "border-bottom-width"};\r
-El.paddings = {l: "padding-left", r: "padding-right", t: "padding-top", b: "padding-bottom"};\r
-El.margins = {l: "margin-left", r: "margin-right", t: "margin-top", b: "margin-bottom"};\r
-\r
-\r
-\r
-\r
-El.cache = {};\r
-\r
-var docEl;\r
-\r
-\r
-El.get = function(el){\r
- var ex, elm, id;\r
- if(!el){ return null; }\r
- if(typeof el == "string"){ // element id\r
- if(!(elm = document.getElementById(el))){\r
- return null;\r
- }\r
- if(ex = El.cache[el]){\r
- ex.dom = elm;\r
- }else{\r
- ex = El.cache[el] = new El(elm);\r
- }\r
- return ex;\r
- }else if(el.tagName){ // dom element\r
- if(!(id = el.id)){\r
- id = Ext.id(el);\r
- }\r
- if(ex = El.cache[id]){\r
- ex.dom = el;\r
- }else{\r
- ex = El.cache[id] = new El(el);\r
- }\r
- return ex;\r
- }else if(el instanceof El){\r
- if(el != docEl){\r
- el.dom = document.getElementById(el.id) || el.dom; // refresh dom element in case no longer valid,\r
- // catch case where it hasn't been appended\r
- El.cache[el.id] = el; // in case it was created directly with Element(), let's cache it\r
- }\r
- return el;\r
- }else if(el.isComposite){\r
- return el;\r
- }else if(Ext.isArray(el)){\r
- return El.select(el);\r
- }else if(el == document){\r
- // create a bogus element object representing the document object\r
- if(!docEl){\r
- var f = function(){};\r
- f.prototype = El.prototype;\r
- docEl = new f();\r
- docEl.dom = document;\r
- }\r
- return docEl;\r
- }\r
- return null;\r
-};\r
-\r
-// private\r
-El.uncache = function(el){\r
- for(var i = 0, a = arguments, len = a.length; i < len; i++) {\r
- if(a[i]){\r
- delete El.cache[a[i].id || a[i]];\r
- }\r
- }\r
-};\r
-\r
-// private\r
-// Garbage collection - uncache elements/purge listeners on orphaned elements\r
-// so we don't hold a reference and cause the browser to retain them\r
-El.garbageCollect = function(){\r
- if(!Ext.enableGarbageCollector){\r
- clearInterval(El.collectorThread);\r
- return;\r
- }\r
- for(var eid in El.cache){\r
- var el = El.cache[eid], d = el.dom;\r
- // -------------------------------------------------------\r
- // Determining what is garbage:\r
- // -------------------------------------------------------\r
- // !d\r
- // dom node is null, definitely garbage\r
- // -------------------------------------------------------\r
- // !d.parentNode\r
- // no parentNode == direct orphan, definitely garbage\r
- // -------------------------------------------------------\r
- // !d.offsetParent && !document.getElementById(eid)\r
- // display none elements have no offsetParent so we will\r
- // also try to look it up by it's id. However, check\r
- // offsetParent first so we don't do unneeded lookups.\r
- // This enables collection of elements that are not orphans\r
- // directly, but somewhere up the line they have an orphan\r
- // parent.\r
- // -------------------------------------------------------\r
- if(!d || !d.parentNode || (!d.offsetParent && !document.getElementById(eid))){\r
- delete El.cache[eid];\r
- if(d && Ext.enableListenerCollection){\r
- Ext.EventManager.removeAll(d);\r
- }\r
- }\r
- }\r
-}\r
-El.collectorThreadId = setInterval(El.garbageCollect, 30000);\r
-\r
-var flyFn = function(){};\r
-flyFn.prototype = El.prototype;\r
-var _cls = new flyFn();\r
-\r
-// dom is optional\r
-El.Flyweight = function(dom){\r
- this.dom = dom;\r
-};\r
-\r
-El.Flyweight.prototype = _cls;\r
-El.Flyweight.prototype.isFlyweight = true;\r
-\r
-El._flyweights = {};\r
-\r
-El.fly = function(el, named){\r
- named = named || '_global';\r
- el = Ext.getDom(el);\r
- if(!el){\r
- return null;\r
- }\r
- if(!El._flyweights[named]){\r
- El._flyweights[named] = new El.Flyweight();\r
- }\r
- El._flyweights[named].dom = el;\r
- return El._flyweights[named];\r
-};\r
-\r
-\r
-Ext.get = El.get;\r
-\r
-Ext.fly = El.fly;\r
-\r
-// speedy lookup for elements never to box adjust\r
-var noBoxAdjust = Ext.isStrict ? {\r
- select:1\r
-} : {\r
- input:1, select:1, textarea:1\r
-};\r
-if(Ext.isIE || Ext.isGecko){\r
- noBoxAdjust['button'] = 1;\r
-}\r
-\r
-\r
-Ext.EventManager.on(window, 'unload', function(){\r
- delete El.cache;\r
- delete El._flyweights;\r
-});\r
-})();\r
-\r
-//Notifies Element that fx methods are available\r
-Ext.enableFx = true;\r
-\r
-\r
-Ext.Fx = {\r
- \r
- slideIn : function(anchor, o){\r
- var el = this.getFxEl();\r
- o = o || {};\r
-\r
- el.queueFx(o, function(){\r
-\r
- anchor = anchor || "t";\r
-\r
- // fix display to visibility\r
- this.fixDisplay();\r
-\r
- // restore values after effect\r
- var r = this.getFxRestore();\r
- var b = this.getBox();\r
- // fixed size for slide\r
- this.setSize(b);\r
-\r
- // wrap if needed\r
- var wrap = this.fxWrap(r.pos, o, "hidden");\r
-\r
- var st = this.dom.style;\r
- st.visibility = "visible";\r
- st.position = "absolute";\r
-\r
- // clear out temp styles after slide and unwrap\r
- var after = function(){\r
- el.fxUnwrap(wrap, r.pos, o);\r
- st.width = r.width;\r
- st.height = r.height;\r
- el.afterFx(o);\r
- };\r
- // time to calc the positions\r
- var a, pt = {to: [b.x, b.y]}, bw = {to: b.width}, bh = {to: b.height};\r
-\r
- switch(anchor.toLowerCase()){\r
- case "t":\r
- wrap.setSize(b.width, 0);\r
- st.left = st.bottom = "0";\r
- a = {height: bh};\r
- break;\r
- case "l":\r
- wrap.setSize(0, b.height);\r
- st.right = st.top = "0";\r
- a = {width: bw};\r
- break;\r
- case "r":\r
- wrap.setSize(0, b.height);\r
- wrap.setX(b.right);\r
- st.left = st.top = "0";\r
- a = {width: bw, points: pt};\r
- break;\r
- case "b":\r
- wrap.setSize(b.width, 0);\r
- wrap.setY(b.bottom);\r
- st.left = st.top = "0";\r
- a = {height: bh, points: pt};\r
- break;\r
- case "tl":\r
- wrap.setSize(0, 0);\r
- st.right = st.bottom = "0";\r
- a = {width: bw, height: bh};\r
- break;\r
- case "bl":\r
- wrap.setSize(0, 0);\r
- wrap.setY(b.y+b.height);\r
- st.right = st.top = "0";\r
- a = {width: bw, height: bh, points: pt};\r
- break;\r
- case "br":\r
- wrap.setSize(0, 0);\r
- wrap.setXY([b.right, b.bottom]);\r
- st.left = st.top = "0";\r
- a = {width: bw, height: bh, points: pt};\r
- break;\r
- case "tr":\r
- wrap.setSize(0, 0);\r
- wrap.setX(b.x+b.width);\r
- st.left = st.bottom = "0";\r
- a = {width: bw, height: bh, points: pt};\r
- break;\r
- }\r
- this.dom.style.visibility = "visible";\r
- wrap.show();\r
-\r
- arguments.callee.anim = wrap.fxanim(a,\r
- o,\r
- 'motion',\r
- .5,\r
- 'easeOut', after);\r
- });\r
- return this;\r
- },\r
- \r
- \r
- slideOut : function(anchor, o){\r
- var el = this.getFxEl();\r
- o = o || {};\r
-\r
- el.queueFx(o, function(){\r
-\r
- anchor = anchor || "t";\r
-\r
- // restore values after effect\r
- var r = this.getFxRestore();\r
- \r
- var b = this.getBox();\r
- // fixed size for slide\r
- this.setSize(b);\r
-\r
- // wrap if needed\r
- var wrap = this.fxWrap(r.pos, o, "visible");\r
-\r
- var st = this.dom.style;\r
- st.visibility = "visible";\r
- st.position = "absolute";\r
-\r
- wrap.setSize(b);\r
-\r
- var after = function(){\r
- if(o.useDisplay){\r
- el.setDisplayed(false);\r
- }else{\r
- el.hide();\r
- }\r
-\r
- el.fxUnwrap(wrap, r.pos, o);\r
-\r
- st.width = r.width;\r
- st.height = r.height;\r
-\r
- el.afterFx(o);\r
- };\r
-\r
- var a, zero = {to: 0};\r
- switch(anchor.toLowerCase()){\r
- case "t":\r
- st.left = st.bottom = "0";\r
- a = {height: zero};\r
- break;\r
- case "l":\r
- st.right = st.top = "0";\r
- a = {width: zero};\r
- break;\r
- case "r":\r
- st.left = st.top = "0";\r
- a = {width: zero, points: {to:[b.right, b.y]}};\r
- break;\r
- case "b":\r
- st.left = st.top = "0";\r
- a = {height: zero, points: {to:[b.x, b.bottom]}};\r
- break;\r
- case "tl":\r
- st.right = st.bottom = "0";\r
- a = {width: zero, height: zero};\r
- break;\r
- case "bl":\r
- st.right = st.top = "0";\r
- a = {width: zero, height: zero, points: {to:[b.x, b.bottom]}};\r
- break;\r
- case "br":\r
- st.left = st.top = "0";\r
- a = {width: zero, height: zero, points: {to:[b.x+b.width, b.bottom]}};\r
- break;\r
- case "tr":\r
- st.left = st.bottom = "0";\r
- a = {width: zero, height: zero, points: {to:[b.right, b.y]}};\r
- break;\r
- }\r
-\r
- arguments.callee.anim = wrap.fxanim(a,\r
- o,\r
- 'motion',\r
- .5,\r
- "easeOut", after);\r
- });\r
- return this;\r
- },\r
-\r
- \r
- puff : function(o){\r
- var el = this.getFxEl();\r
- o = o || {};\r
-\r
- el.queueFx(o, function(){\r
- this.clearOpacity();\r
- this.show();\r
-\r
- // restore values after effect\r
- var r = this.getFxRestore();\r
- var st = this.dom.style;\r
-\r
- var after = function(){\r
- if(o.useDisplay){\r
- el.setDisplayed(false);\r
- }else{\r
- el.hide();\r
- }\r
-\r
- el.clearOpacity();\r
-\r
- el.setPositioning(r.pos);\r
- st.width = r.width;\r
- st.height = r.height;\r
- st.fontSize = '';\r
- el.afterFx(o);\r
- };\r
-\r
- var width = this.getWidth();\r
- var height = this.getHeight();\r
-\r
- arguments.callee.anim = this.fxanim({\r
- width : {to: this.adjustWidth(width * 2)},\r
- height : {to: this.adjustHeight(height * 2)},\r
- points : {by: [-(width * .5), -(height * .5)]},\r
- opacity : {to: 0},\r
- fontSize: {to:200, unit: "%"}\r
- },\r
- o,\r
- 'motion',\r
- .5,\r
- "easeOut", after);\r
- });\r
- return this;\r
- },\r
-\r
- \r
- switchOff : function(o){\r
- var el = this.getFxEl();\r
- o = o || {};\r
-\r
- el.queueFx(o, function(){\r
- this.clearOpacity();\r
- this.clip();\r
-\r
- // restore values after effect\r
- var r = this.getFxRestore();\r
- var st = this.dom.style;\r
-\r
- var after = function(){\r
- if(o.useDisplay){\r
- el.setDisplayed(false);\r
- }else{\r
- el.hide();\r
- }\r
-\r
- el.clearOpacity();\r
- el.setPositioning(r.pos);\r
- st.width = r.width;\r
- st.height = r.height;\r
-\r
- el.afterFx(o);\r
- };\r
-\r
- this.fxanim({opacity:{to:0.3}}, null, null, .1, null, function(){\r
- this.clearOpacity();\r
- (function(){\r
- this.fxanim({\r
- height:{to:1},\r
- points:{by:[0, this.getHeight() * .5]}\r
- }, o, 'motion', 0.3, 'easeIn', after);\r
- }).defer(100, this);\r
- });\r
- });\r
- return this;\r
- },\r
-\r
- \r
- highlight : function(color, o){\r
- var el = this.getFxEl();\r
- o = o || {};\r
-\r
- el.queueFx(o, function(){\r
- color = color || "ffff9c";\r
- var attr = o.attr || "backgroundColor";\r
-\r
- this.clearOpacity();\r
- this.show();\r
-\r
- var origColor = this.getColor(attr);\r
- var restoreColor = this.dom.style[attr];\r
- var endColor = (o.endColor || origColor) || "ffffff";\r
-\r
- var after = function(){\r
- el.dom.style[attr] = restoreColor;\r
- el.afterFx(o);\r
- };\r
-\r
- var a = {};\r
- a[attr] = {from: color, to: endColor};\r
- arguments.callee.anim = this.fxanim(a,\r
- o,\r
- 'color',\r
- 1,\r
- 'easeIn', after);\r
- });\r
- return this;\r
- },\r
-\r
- \r
- frame : function(color, count, o){\r
- var el = this.getFxEl();\r
- o = o || {};\r
-\r
- el.queueFx(o, function(){\r
- color = color || "#C3DAF9";\r
- if(color.length == 6){\r
- color = "#" + color;\r
- }\r
- count = count || 1;\r
- var duration = o.duration || 1;\r
- this.show();\r
-\r
- var b = this.getBox();\r
- var animFn = function(){\r
- var proxy = Ext.getBody().createChild({\r
- style:{\r
- visbility:"hidden",\r
- position:"absolute",\r
- "z-index":"35000", // yee haw\r
- border:"0px solid " + color\r
- }\r
- });\r
- var scale = Ext.isBorderBox ? 2 : 1;\r
- proxy.animate({\r
- top:{from:b.y, to:b.y - 20},\r
- left:{from:b.x, to:b.x - 20},\r
- borderWidth:{from:0, to:10},\r
- opacity:{from:1, to:0},\r
- height:{from:b.height, to:(b.height + (20*scale))},\r
- width:{from:b.width, to:(b.width + (20*scale))}\r
- }, duration, function(){\r
- proxy.remove();\r
- if(--count > 0){\r
- animFn();\r
- }else{\r
- el.afterFx(o);\r
- }\r
- });\r
- };\r
- animFn.call(this);\r
- });\r
- return this;\r
- },\r
-\r
- \r
- pause : function(seconds){\r
- var el = this.getFxEl();\r
- var o = {};\r
-\r
- el.queueFx(o, function(){\r
- setTimeout(function(){\r
- el.afterFx(o);\r
- }, seconds * 1000);\r
- });\r
- return this;\r
- },\r
-\r
- \r
- fadeIn : function(o){\r
- var el = this.getFxEl();\r
- o = o || {};\r
- el.queueFx(o, function(){\r
- this.setOpacity(0);\r
- this.fixDisplay();\r
- this.dom.style.visibility = 'visible';\r
- var to = o.endOpacity || 1;\r
- arguments.callee.anim = this.fxanim({opacity:{to:to}},\r
- o, null, .5, "easeOut", function(){\r
- if(to == 1){\r
- this.clearOpacity();\r
- }\r
- el.afterFx(o);\r
- });\r
- });\r
- return this;\r
- },\r
-\r
- \r
- fadeOut : function(o){\r
- var el = this.getFxEl();\r
- o = o || {};\r
- el.queueFx(o, function(){\r
- var to = o.endOpacity || 0;\r
- arguments.callee.anim = this.fxanim({opacity:{to:to}},\r
- o, null, .5, "easeOut", function(){\r
- if(to === 0){\r
- if(this.visibilityMode == Ext.Element.DISPLAY || o.useDisplay){\r
- this.dom.style.display = "none";\r
- }else{\r
- this.dom.style.visibility = "hidden";\r
- }\r
- this.clearOpacity();\r
- }\r
- el.afterFx(o);\r
- });\r
- });\r
- return this;\r
- },\r
-\r
- \r
- scale : function(w, h, o){\r
- this.shift(Ext.apply({}, o, {\r
- width: w,\r
- height: h\r
- }));\r
- return this;\r
- },\r
-\r
- \r
- shift : function(o){\r
- var el = this.getFxEl();\r
- o = o || {};\r
- el.queueFx(o, function(){\r
- var a = {}, w = o.width, h = o.height, x = o.x, y = o.y, op = o.opacity;\r
- if(w !== undefined){\r
- a.width = {to: this.adjustWidth(w)};\r
- }\r
- if(h !== undefined){\r
- a.height = {to: this.adjustHeight(h)};\r
- }\r
- if(o.left !== undefined){\r
- a.left = {to: o.left};\r
- }\r
- if(o.top !== undefined){\r
- a.top = {to: o.top};\r
- }\r
- if(o.right !== undefined){\r
- a.right = {to: o.right};\r
- }\r
- if(o.bottom !== undefined){\r
- a.bottom = {to: o.bottom};\r
- }\r
- if(x !== undefined || y !== undefined){\r
- a.points = {to: [\r
- x !== undefined ? x : this.getX(),\r
- y !== undefined ? y : this.getY()\r
- ]};\r
- }\r
- if(op !== undefined){\r
- a.opacity = {to: op};\r
- }\r
- if(o.xy !== undefined){\r
- a.points = {to: o.xy};\r
- }\r
- arguments.callee.anim = this.fxanim(a,\r
- o, 'motion', .35, "easeOut", function(){\r
- el.afterFx(o);\r
- });\r
- });\r
- return this;\r
- },\r
-\r
- \r
- ghost : function(anchor, o){\r
- var el = this.getFxEl();\r
- o = o || {};\r
-\r
- el.queueFx(o, function(){\r
- anchor = anchor || "b";\r
-\r
- // restore values after effect\r
- var r = this.getFxRestore();\r
- var w = this.getWidth(),\r
- h = this.getHeight();\r
-\r
- var st = this.dom.style;\r
-\r
- var after = function(){\r
- if(o.useDisplay){\r
- el.setDisplayed(false);\r
- }else{\r
- el.hide();\r
- }\r
-\r
- el.clearOpacity();\r
- el.setPositioning(r.pos);\r
- st.width = r.width;\r
- st.height = r.height;\r
-\r
- el.afterFx(o);\r
- };\r
-\r
- var a = {opacity: {to: 0}, points: {}}, pt = a.points;\r
- switch(anchor.toLowerCase()){\r
- case "t":\r
- pt.by = [0, -h];\r
- break;\r
- case "l":\r
- pt.by = [-w, 0];\r
- break;\r
- case "r":\r
- pt.by = [w, 0];\r
- break;\r
- case "b":\r
- pt.by = [0, h];\r
- break;\r
- case "tl":\r
- pt.by = [-w, -h];\r
- break;\r
- case "bl":\r
- pt.by = [-w, h];\r
- break;\r
- case "br":\r
- pt.by = [w, h];\r
- break;\r
- case "tr":\r
- pt.by = [w, -h];\r
- break;\r
- }\r
-\r
- arguments.callee.anim = this.fxanim(a,\r
- o,\r
- 'motion',\r
- .5,\r
- "easeOut", after);\r
- });\r
- return this;\r
- },\r
-\r
- \r
- syncFx : function(){\r
- this.fxDefaults = Ext.apply(this.fxDefaults || {}, {\r
- block : false,\r
- concurrent : true,\r
- stopFx : false\r
- });\r
- return this;\r
- },\r
-\r
- \r
- sequenceFx : function(){\r
- this.fxDefaults = Ext.apply(this.fxDefaults || {}, {\r
- block : false,\r
- concurrent : false,\r
- stopFx : false\r
- });\r
- return this;\r
- },\r
-\r
- \r
- nextFx : function(){\r
- var ef = this.fxQueue[0];\r
- if(ef){\r
- ef.call(this);\r
- }\r
- },\r
-\r
- \r
- hasActiveFx : function(){\r
- return this.fxQueue && this.fxQueue[0];\r
- },\r
-\r
- \r
- stopFx : function(){\r
- if(this.hasActiveFx()){\r
- var cur = this.fxQueue[0];\r
- if(cur && cur.anim && cur.anim.isAnimated()){\r
- this.fxQueue = [cur]; // clear out others\r
- cur.anim.stop(true);\r
- }\r
- }\r
- return this;\r
- },\r
-\r
- \r
- beforeFx : function(o){\r
- if(this.hasActiveFx() && !o.concurrent){\r
- if(o.stopFx){\r
- this.stopFx();\r
- return true;\r
- }\r
- return false;\r
- }\r
- return true;\r
- },\r
-\r
- \r
- hasFxBlock : function(){\r
- var q = this.fxQueue;\r
- return q && q[0] && q[0].block;\r
- },\r
-\r
- \r
- queueFx : function(o, fn){\r
- if(!this.fxQueue){\r
- this.fxQueue = [];\r
- }\r
- if(!this.hasFxBlock()){\r
- Ext.applyIf(o, this.fxDefaults);\r
- if(!o.concurrent){\r
- var run = this.beforeFx(o);\r
- fn.block = o.block;\r
- this.fxQueue.push(fn);\r
- if(run){\r
- this.nextFx();\r
- }\r
- }else{\r
- fn.call(this);\r
- }\r
- }\r
- return this;\r
- },\r
-\r
- \r
- fxWrap : function(pos, o, vis){\r
- var wrap;\r
- if(!o.wrap || !(wrap = Ext.get(o.wrap))){\r
- var wrapXY;\r
- if(o.fixPosition){\r
- wrapXY = this.getXY();\r
- }\r
- var div = document.createElement("div");\r
- div.style.visibility = vis;\r
- wrap = Ext.get(this.dom.parentNode.insertBefore(div, this.dom));\r
- wrap.setPositioning(pos);\r
- if(wrap.getStyle("position") == "static"){\r
- wrap.position("relative");\r
- }\r
- this.clearPositioning('auto');\r
- wrap.clip();\r
- wrap.dom.appendChild(this.dom);\r
- if(wrapXY){\r
- wrap.setXY(wrapXY);\r
- }\r
- }\r
- return wrap;\r
- },\r
-\r
- \r
- fxUnwrap : function(wrap, pos, o){\r
- this.clearPositioning();\r
- this.setPositioning(pos);\r
- if(!o.wrap){\r
- wrap.dom.parentNode.insertBefore(this.dom, wrap.dom);\r
- wrap.remove();\r
- }\r
- },\r
-\r
- \r
- getFxRestore : function(){\r
- var st = this.dom.style;\r
- return {pos: this.getPositioning(), width: st.width, height : st.height};\r
- },\r
-\r
- \r
- afterFx : function(o){\r
- if(o.afterStyle){\r
- this.applyStyles(o.afterStyle);\r
- }\r
- if(o.afterCls){\r
- this.addClass(o.afterCls);\r
- }\r
- if(o.remove === true){\r
- this.remove();\r
- }\r
- Ext.callback(o.callback, o.scope, [this]);\r
- if(!o.concurrent){\r
- this.fxQueue.shift();\r
- this.nextFx();\r
- }\r
- },\r
-\r
- \r
- getFxEl : function(){ // support for composite element fx\r
- return Ext.get(this.dom);\r
- },\r
-\r
- \r
- fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){\r
- animType = animType || 'run';\r
- opt = opt || {};\r
- var anim = Ext.lib.Anim[animType](\r
- this.dom, args,\r
- (opt.duration || defaultDur) || .35,\r
- (opt.easing || defaultEase) || 'easeOut',\r
- function(){\r
- Ext.callback(cb, this);\r
- },\r
- this\r
- );\r
- opt.anim = anim;\r
- return anim;\r
- }\r
-};\r
-\r
-// backwords compat\r
-Ext.Fx.resize = Ext.Fx.scale;\r
-\r
-//When included, Ext.Fx is automatically applied to Element so that all basic\r
-//effects are available directly via the Element API\r
-Ext.apply(Ext.Element.prototype, Ext.Fx);\r
-\r
-\r
-Ext.CompositeElement = function(els){\r
- this.elements = [];\r
- this.addElements(els);\r
-};\r
-Ext.CompositeElement.prototype = {\r
- isComposite: true,\r
- addElements : function(els){\r
- if(!els) return this;\r
- if(typeof els == "string"){\r
- els = Ext.Element.selectorFunction(els);\r
- }\r
- var yels = this.elements;\r
- var index = yels.length-1;\r
- for(var i = 0, len = els.length; i < len; i++) {\r
- yels[++index] = Ext.get(els[i]);\r
- }\r
- return this;\r
- },\r
-\r
- \r
- fill : function(els){\r
- this.elements = [];\r
- this.add(els);\r
- return this;\r
- },\r
-\r
- \r
- filter : function(selector){\r
- var els = [];\r
- this.each(function(el){\r
- if(el.is(selector)){\r
- els[els.length] = el.dom;\r
- }\r
- });\r
- this.fill(els);\r
- return this;\r
- },\r
-\r
- invoke : function(fn, args){\r
- var els = this.elements;\r
- for(var i = 0, len = els.length; i < len; i++) {\r
- Ext.Element.prototype[fn].apply(els[i], args);\r
- }\r
- return this;\r
- },\r
- \r
- add : function(els){\r
- if(typeof els == "string"){\r
- this.addElements(Ext.Element.selectorFunction(els));\r
- }else if(els.length !== undefined){\r
- this.addElements(els);\r
- }else{\r
- this.addElements([els]);\r
- }\r
- return this;\r
- },\r
- \r
- each : function(fn, scope){\r
- var els = this.elements;\r
- for(var i = 0, len = els.length; i < len; i++){\r
- if(fn.call(scope || els[i], els[i], this, i) === false) {\r
- break;\r
- }\r
- }\r
- return this;\r
- },\r
-\r
- \r
- item : function(index){\r
- return this.elements[index] || null;\r
- },\r
-\r
- \r
- first : function(){\r
- return this.item(0);\r
- },\r
-\r
- \r
- last : function(){\r
- return this.item(this.elements.length-1);\r
- },\r
-\r
- \r
- getCount : function(){\r
- return this.elements.length;\r
- },\r
-\r
- \r
- contains : function(el){\r
- return this.indexOf(el) !== -1;\r
- },\r
-\r
- \r
- indexOf : function(el){\r
- return this.elements.indexOf(Ext.get(el));\r
- },\r
-\r
-\r
- \r
- removeElement : function(el, removeDom){\r
- if(Ext.isArray(el)){\r
- for(var i = 0, len = el.length; i < len; i++){\r
- this.removeElement(el[i]);\r
- }\r
- return this;\r
- }\r
- var index = typeof el == 'number' ? el : this.indexOf(el);\r
- if(index !== -1 && this.elements[index]){\r
- if(removeDom){\r
- var d = this.elements[index];\r
- if(d.dom){\r
- d.remove();\r
- }else{\r
- Ext.removeNode(d);\r
- }\r
- }\r
- this.elements.splice(index, 1);\r
- }\r
- return this;\r
- },\r
-\r
- \r
- replaceElement : function(el, replacement, domReplace){\r
- var index = typeof el == 'number' ? el : this.indexOf(el);\r
- if(index !== -1){\r
- if(domReplace){\r
- this.elements[index].replaceWith(replacement);\r
- }else{\r
- this.elements.splice(index, 1, Ext.get(replacement))\r
- }\r
- }\r
- return this;\r
- },\r
-\r
- \r
- clear : function(){\r
- this.elements = [];\r
- }\r
-};\r
-(function(){\r
-Ext.CompositeElement.createCall = function(proto, fnName){\r
- if(!proto[fnName]){\r
- proto[fnName] = function(){\r
- return this.invoke(fnName, arguments);\r
- };\r
- }\r
-};\r
-for(var fnName in Ext.Element.prototype){\r
- if(typeof Ext.Element.prototype[fnName] == "function"){\r
- Ext.CompositeElement.createCall(Ext.CompositeElement.prototype, fnName);\r
- }\r
-};\r
-})();\r
-\r
-\r
-Ext.CompositeElementLite = function(els){\r
- Ext.CompositeElementLite.superclass.constructor.call(this, els);\r
- this.el = new Ext.Element.Flyweight();\r
-};\r
-Ext.extend(Ext.CompositeElementLite, Ext.CompositeElement, {\r
- addElements : function(els){\r
- if(els){\r
- if(Ext.isArray(els)){\r
- this.elements = this.elements.concat(els);\r
- }else{\r
- var yels = this.elements;\r
- var index = yels.length-1;\r
- for(var i = 0, len = els.length; i < len; i++) {\r
- yels[++index] = els[i];\r
- }\r
- }\r
- }\r
- return this;\r
- },\r
- invoke : function(fn, args){\r
- var els = this.elements;\r
- var el = this.el;\r
- for(var i = 0, len = els.length; i < len; i++) {\r
- el.dom = els[i];\r
- Ext.Element.prototype[fn].apply(el, args);\r
- }\r
- return this;\r
- },\r
- \r
- item : function(index){\r
- if(!this.elements[index]){\r
- return null;\r
- }\r
- this.el.dom = this.elements[index];\r
- return this.el;\r
- },\r
-\r
- // fixes scope with flyweight\r
- addListener : function(eventName, handler, scope, opt){\r
- var els = this.elements;\r
- for(var i = 0, len = els.length; i < len; i++) {\r
- Ext.EventManager.on(els[i], eventName, handler, scope || els[i], opt);\r
- }\r
- return this;\r
- },\r
-\r
- \r
- each : function(fn, scope){\r
- var els = this.elements;\r
- var el = this.el;\r
- for(var i = 0, len = els.length; i < len; i++){\r
- el.dom = els[i];\r
- if(fn.call(scope || el, el, this, i) === false){\r
- break;\r
- }\r
- }\r
- return this;\r
- },\r
-\r
- indexOf : function(el){\r
- return this.elements.indexOf(Ext.getDom(el));\r
- },\r
-\r
- replaceElement : function(el, replacement, domReplace){\r
- var index = typeof el == 'number' ? el : this.indexOf(el);\r
- if(index !== -1){\r
- replacement = Ext.getDom(replacement);\r
- if(domReplace){\r
- var d = this.elements[index];\r
- d.parentNode.insertBefore(replacement, d);\r
- Ext.removeNode(d);\r
- }\r
- this.elements.splice(index, 1, replacement);\r
- }\r
- return this;\r
- }\r
-});\r
-Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;\r
-if(Ext.DomQuery){\r
- Ext.Element.selectorFunction = Ext.DomQuery.select;\r
-}\r
-\r
-Ext.Element.select = function(selector, unique, root){\r
- var els;\r
- if(typeof selector == "string"){\r
- els = Ext.Element.selectorFunction(selector, root);\r
- }else if(selector.length !== undefined){\r
- els = selector;\r
- }else{\r
- throw "Invalid selector";\r
- }\r
- if(unique === true){\r
- return new Ext.CompositeElement(els);\r
- }else{\r
- return new Ext.CompositeElementLite(els);\r
- }\r
-};\r
-\r
-Ext.select = Ext.Element.select;\r
-\r
-Ext.data.Connection = function(config){\r
- Ext.apply(this, config);\r
- this.addEvents(\r
- \r
- "beforerequest",\r
- \r
- "requestcomplete",\r
- \r
- "requestexception"\r
- );\r
- Ext.data.Connection.superclass.constructor.call(this);\r
-};\r
-\r
-Ext.extend(Ext.data.Connection, Ext.util.Observable, {\r
- \r
- \r
- \r
- \r
- \r
- timeout : 30000,\r
- \r
- autoAbort:false,\r
-\r
- \r
- disableCaching: true,\r
- \r
- \r
- disableCachingParam: '_dc',\r
- \r
-\r
- \r
- request : function(o){\r
- if(this.fireEvent("beforerequest", this, o) !== false){\r
- var p = o.params;\r
-\r
- if(typeof p == "function"){\r
- p = p.call(o.scope||window, o);\r
- }\r
- if(typeof p == "object"){\r
- p = Ext.urlEncode(p);\r
- }\r
- if(this.extraParams){\r
- var extras = Ext.urlEncode(this.extraParams);\r
- p = p ? (p + '&' + extras) : extras;\r
- }\r
-\r
- var url = o.url || this.url;\r
- if(typeof url == 'function'){\r
- url = url.call(o.scope||window, o);\r
- }\r
-\r
- if(o.form){\r
- var form = Ext.getDom(o.form);\r
- url = url || form.action;\r
-\r
- var enctype = form.getAttribute("enctype");\r
- if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){\r
- return this.doFormUpload(o, p, url);\r
- }\r
- var f = Ext.lib.Ajax.serializeForm(form);\r
- p = p ? (p + '&' + f) : f;\r
- }\r
-\r
- var hs = o.headers;\r
- if(this.defaultHeaders){\r
- hs = Ext.apply(hs || {}, this.defaultHeaders);\r
- if(!o.headers){\r
- o.headers = hs;\r
- }\r
- }\r
-\r
- var cb = {\r
- success: this.handleResponse,\r
- failure: this.handleFailure,\r
- scope: this,\r
- argument: {options: o},\r
- timeout : o.timeout || this.timeout\r
- };\r
-\r
- var method = o.method||this.method||((p || o.xmlData || o.jsonData) ? "POST" : "GET");\r
-\r
- if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){\r
- var dcp = o.disableCachingParam || this.disableCachingParam;\r
- url += (url.indexOf('?') != -1 ? '&' : '?') + dcp + '=' + (new Date().getTime());\r
- }\r
-\r
- if(typeof o.autoAbort == 'boolean'){ // options gets top priority\r
- if(o.autoAbort){\r
- this.abort();\r
- }\r
- }else if(this.autoAbort !== false){\r
- this.abort();\r
- }\r
- if((method == 'GET' || o.xmlData || o.jsonData) && p){\r
- url += (url.indexOf('?') != -1 ? '&' : '?') + p;\r
- p = '';\r
- }\r
- this.transId = Ext.lib.Ajax.request(method, url, cb, p, o);\r
- return this.transId;\r
- }else{\r
- Ext.callback(o.callback, o.scope, [o, null, null]);\r
- return null;\r
- }\r
- },\r
-\r
- \r
- isLoading : function(transId){\r
- if(transId){\r
- return Ext.lib.Ajax.isCallInProgress(transId);\r
- }else{\r
- return this.transId ? true : false;\r
- }\r
- },\r
-\r
- \r
- abort : function(transId){\r
- if(transId || this.isLoading()){\r
- Ext.lib.Ajax.abort(transId || this.transId);\r
- }\r
- },\r
-\r
- // private\r
- handleResponse : function(response){\r
- this.transId = false;\r
- var options = response.argument.options;\r
- response.argument = options ? options.argument : null;\r
- this.fireEvent("requestcomplete", this, response, options);\r
- Ext.callback(options.success, options.scope, [response, options]);\r
- Ext.callback(options.callback, options.scope, [options, true, response]);\r
- },\r
-\r
- // private\r
- handleFailure : function(response, e){\r
- this.transId = false;\r
- var options = response.argument.options;\r
- response.argument = options ? options.argument : null;\r
- this.fireEvent("requestexception", this, response, options, e);\r
- Ext.callback(options.failure, options.scope, [response, options]);\r
- Ext.callback(options.callback, options.scope, [options, false, response]);\r
- },\r
-\r
- // private\r
- doFormUpload : function(o, ps, url){\r
- var id = Ext.id();\r
- var frame = document.createElement('iframe');\r
- frame.id = id;\r
- frame.name = id;\r
- frame.className = 'x-hidden';\r
- if(Ext.isIE){\r
- frame.src = Ext.SSL_SECURE_URL;\r
- }\r
- document.body.appendChild(frame);\r
-\r
- if(Ext.isIE){\r
- document.frames[id].name = id;\r
- }\r
-\r
- var form = Ext.getDom(o.form);\r
- form.target = id;\r
- form.method = 'POST';\r
- form.enctype = form.encoding = 'multipart/form-data';\r
- if(url){\r
- form.action = url;\r
- }\r
-\r
- var hiddens, hd;\r
- if(ps){ // add dynamic params\r
- hiddens = [];\r
- ps = Ext.urlDecode(ps, false);\r
- for(var k in ps){\r
- if(ps.hasOwnProperty(k)){\r
- hd = document.createElement('input');\r
- hd.type = 'hidden';\r
- hd.name = k;\r
- hd.value = ps[k];\r
- form.appendChild(hd);\r
- hiddens.push(hd);\r
- }\r
- }\r
- }\r
-\r
- function cb(){\r
- var r = { // bogus response object\r
- responseText : '',\r
- responseXML : null\r
- };\r
-\r
- r.argument = o ? o.argument : null;\r
-\r
- try { //\r
- var doc;\r
- if(Ext.isIE){\r
- doc = frame.contentWindow.document;\r
- }else {\r
- doc = (frame.contentDocument || window.frames[id].document);\r
- }\r
- if(doc && doc.body){\r
- r.responseText = doc.body.innerHTML;\r
- }\r
- if(doc && doc.XMLDocument){\r
- r.responseXML = doc.XMLDocument;\r
- }else {\r
- r.responseXML = doc;\r
- }\r
- }\r
- catch(e) {\r
- // ignore\r
- }\r
-\r
- Ext.EventManager.removeListener(frame, 'load', cb, this);\r
-\r
- this.fireEvent("requestcomplete", this, r, o);\r
-\r
- Ext.callback(o.success, o.scope, [r, o]);\r
- Ext.callback(o.callback, o.scope, [o, true, r]);\r
-\r
- setTimeout(function(){Ext.removeNode(frame);}, 100);\r
- }\r
-\r
- Ext.EventManager.on(frame, 'load', cb, this);\r
- form.submit();\r
-\r
- if(hiddens){ // remove dynamic params\r
- for(var i = 0, len = hiddens.length; i < len; i++){\r
- Ext.removeNode(hiddens[i]);\r
- }\r
- }\r
- }\r
-});\r
-\r
-\r
-Ext.Ajax = new Ext.data.Connection({\r
- \r
- \r
- \r
- \r
- \r
- \r
-\r
- \r
-\r
- \r
- \r
- \r
- \r
- \r
- \r
-\r
- \r
- autoAbort : false,\r
-\r
- \r
- serializeForm : function(form){\r
- return Ext.lib.Ajax.serializeForm(form);\r
- }\r
-});\r
-\r
-Ext.Updater = Ext.extend(Ext.util.Observable, {\r
- constructor: function(el, forceNew){\r
- el = Ext.get(el);\r
- if(!forceNew && el.updateManager){\r
- return el.updateManager;\r
- }\r
- \r
- this.el = el;\r
- \r
- this.defaultUrl = null;\r
-\r
- this.addEvents(\r
- \r
- "beforeupdate",\r
- \r
- "update",\r
- \r
- "failure"\r
- );\r
- var d = Ext.Updater.defaults;\r
- \r
- this.sslBlankUrl = d.sslBlankUrl;\r
- \r
- this.disableCaching = d.disableCaching;\r
- \r
- this.indicatorText = d.indicatorText;\r
- \r
- this.showLoadIndicator = d.showLoadIndicator;\r
- \r
- this.timeout = d.timeout;\r
- \r
- this.loadScripts = d.loadScripts;\r
- \r
- this.transaction = null;\r
- \r
- this.refreshDelegate = this.refresh.createDelegate(this);\r
- \r
- this.updateDelegate = this.update.createDelegate(this);\r
- \r
- this.formUpdateDelegate = this.formUpdate.createDelegate(this);\r
-\r
- if(!this.renderer){\r
- \r
- this.renderer = this.getDefaultRenderer();\r
- }\r
- Ext.Updater.superclass.constructor.call(this);\r
- },\r
- \r
- getDefaultRenderer: function() {\r
- return new Ext.Updater.BasicRenderer();\r
- },\r
- \r
- getEl : function(){\r
- return this.el;\r
- },\r
-\r
- \r
- update : function(url, params, callback, discardUrl){\r
- if(this.fireEvent("beforeupdate", this.el, url, params) !== false){\r
- var cfg, callerScope;\r
- if(typeof url == "object"){ // must be config object\r
- cfg = url;\r
- url = cfg.url;\r
- params = params || cfg.params;\r
- callback = callback || cfg.callback;\r
- discardUrl = discardUrl || cfg.discardUrl;\r
- callerScope = cfg.scope;\r
- if(typeof cfg.nocache != "undefined"){this.disableCaching = cfg.nocache;};\r
- if(typeof cfg.text != "undefined"){this.indicatorText = '<div class="loading-indicator">'+cfg.text+"</div>";};\r
- if(typeof cfg.scripts != "undefined"){this.loadScripts = cfg.scripts;};\r
- if(typeof cfg.timeout != "undefined"){this.timeout = cfg.timeout;};\r
- }\r
- this.showLoading();\r
-\r
- if(!discardUrl){\r
- this.defaultUrl = url;\r
- }\r
- if(typeof url == "function"){\r
- url = url.call(this);\r
- }\r
-\r
- var o = Ext.apply({}, {\r
- url : url,\r
- params: (typeof params == "function" && callerScope) ? params.createDelegate(callerScope) : params,\r
- success: this.processSuccess,\r
- failure: this.processFailure,\r
- scope: this,\r
- callback: undefined,\r
- timeout: (this.timeout*1000),\r
- disableCaching: this.disableCaching,\r
- argument: {\r
- "options": cfg,\r
- "url": url,\r
- "form": null,\r
- "callback": callback,\r
- "scope": callerScope || window,\r
- "params": params\r
- }\r
- }, cfg);\r
-\r
- this.transaction = Ext.Ajax.request(o);\r
- }\r
- },\r
-\r
- \r
- formUpdate : function(form, url, reset, callback){\r
- if(this.fireEvent("beforeupdate", this.el, form, url) !== false){\r
- if(typeof url == "function"){\r
- url = url.call(this);\r
- }\r
- form = Ext.getDom(form)\r
- this.transaction = Ext.Ajax.request({\r
- form: form,\r
- url:url,\r
- success: this.processSuccess,\r
- failure: this.processFailure,\r
- scope: this,\r
- timeout: (this.timeout*1000),\r
- argument: {\r
- "url": url,\r
- "form": form,\r
- "callback": callback,\r
- "reset": reset\r
- }\r
- });\r
- this.showLoading.defer(1, this);\r
- }\r
- },\r
-\r
- \r
- refresh : function(callback){\r
- if(this.defaultUrl == null){\r
- return;\r
- }\r
- this.update(this.defaultUrl, null, callback, true);\r
- },\r
-\r
- \r
- startAutoRefresh : function(interval, url, params, callback, refreshNow){\r
- if(refreshNow){\r
- this.update(url || this.defaultUrl, params, callback, true);\r
- }\r
- if(this.autoRefreshProcId){\r
- clearInterval(this.autoRefreshProcId);\r
- }\r
- this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000);\r
- },\r
-\r
- \r
- stopAutoRefresh : function(){\r
- if(this.autoRefreshProcId){\r
- clearInterval(this.autoRefreshProcId);\r
- delete this.autoRefreshProcId;\r
- }\r
- },\r
-\r
- \r
- isAutoRefreshing : function(){\r
- return this.autoRefreshProcId ? true : false;\r
- },\r
-\r
- \r
- showLoading : function(){\r
- if(this.showLoadIndicator){\r
- this.el.update(this.indicatorText);\r
- }\r
- },\r
-\r
- // private\r
- processSuccess : function(response){\r
- this.transaction = null;\r
- if(response.argument.form && response.argument.reset){\r
- try{ // put in try/catch since some older FF releases had problems with this\r
- response.argument.form.reset();\r
- }catch(e){}\r
- }\r
- if(this.loadScripts){\r
- this.renderer.render(this.el, response, this,\r
- this.updateComplete.createDelegate(this, [response]));\r
- }else{\r
- this.renderer.render(this.el, response, this);\r
- this.updateComplete(response);\r
- }\r
- },\r
-\r
- // private\r
- updateComplete : function(response){\r
- this.fireEvent("update", this.el, response);\r
- if(typeof response.argument.callback == "function"){\r
- response.argument.callback.call(response.argument.scope, this.el, true, response, response.argument.options);\r
- }\r
- },\r
-\r
- // private\r
- processFailure : function(response){\r
- this.transaction = null;\r
- this.fireEvent("failure", this.el, response);\r
- if(typeof response.argument.callback == "function"){\r
- response.argument.callback.call(response.argument.scope, this.el, false, response, response.argument.options);\r
- }\r
- },\r
-\r
- \r
- setRenderer : function(renderer){\r
- this.renderer = renderer;\r
- },\r
-\r
- \r
- getRenderer : function(){\r
- return this.renderer;\r
- },\r
-\r
- \r
- setDefaultUrl : function(defaultUrl){\r
- this.defaultUrl = defaultUrl;\r
- },\r
-\r
- \r
- abort : function(){\r
- if(this.transaction){\r
- Ext.Ajax.abort(this.transaction);\r
- }\r
- },\r
-\r
- \r
- isUpdating : function(){\r
- if(this.transaction){\r
- return Ext.Ajax.isLoading(this.transaction);\r
- }\r
- return false;\r
- }\r
-});\r
-\r
-\r
- Ext.Updater.defaults = {\r
- \r
- timeout : 30,\r
- \r
- loadScripts : false,\r
- \r
- sslBlankUrl : (Ext.SSL_SECURE_URL || "javascript:false"),\r
- \r
- disableCaching : false,\r
- \r
- showLoadIndicator : true,\r
- \r
- indicatorText : '<div class="loading-indicator">Loading...</div>'\r
- };\r
-\r
-\r
-Ext.Updater.updateElement = function(el, url, params, options){\r
- var um = Ext.get(el).getUpdater();\r
- Ext.apply(um, options);\r
- um.update(url, params, options ? options.callback : null);\r
-};\r
-\r
-Ext.Updater.BasicRenderer = function(){};\r
-\r
-Ext.Updater.BasicRenderer.prototype = {\r
- \r
- render : function(el, response, updateManager, callback){\r
- el.update(response.responseText, updateManager.loadScripts, callback);\r
- }\r
-};\r
-\r
-Ext.UpdateManager = Ext.Updater;\r
-\r
-\r
-Ext.util.DelayedTask = function(fn, scope, args){\r
- var id = null, d, t;\r
-\r
- var call = function(){\r
- var now = new Date().getTime();\r
- if(now - t >= d){\r
- clearInterval(id);\r
- id = null;\r
- fn.apply(scope, args || []);\r
- }\r
- };\r
- \r
- this.delay = function(delay, newFn, newScope, newArgs){\r
- if(id && delay != d){\r
- this.cancel();\r
- }\r
- d = delay;\r
- t = new Date().getTime();\r
- fn = newFn || fn;\r
- scope = newScope || scope;\r
- args = newArgs || args;\r
- if(!id){\r
- id = setInterval(call, d);\r
- }\r
- };\r
-\r
- \r
- this.cancel = function(){\r
- if(id){\r
- clearInterval(id);\r
- id = null;\r
- }\r
- };\r
-};\r