2 * Ext JS Library 1.1.1
\r
3 * Copyright(c) 2006-2007, Ext JS, LLC.
\r
4 * licensing@extjs.com
\r
6 * http://www.extjs.com/license
\r
10 Ext.DomHelper = function(){
\r
11 var tempTableEl = null;
\r
12 var emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;
\r
13 var tableRe = /^table|tbody|tr|td$/i;
\r
17 var createHtml = function(o){
\r
18 if(typeof o == 'string'){
\r
27 if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || typeof o[attr] == "function") continue;
\r
28 if(attr == "style"){
\r
30 if(typeof s == "function"){
\r
33 if(typeof s == "string"){
\r
34 b += ' style="' + s + '"';
\r
35 }else if(typeof s == "object"){
\r
38 if(typeof s[key] != "function"){
\r
39 b += key + ":" + s[key] + ";";
\r
46 b += ' class="' + o["cls"] + '"';
\r
47 }else if(attr == "htmlFor"){
\r
48 b += ' for="' + o["htmlFor"] + '"';
\r
50 b += " " + attr + '="' + o[attr] + '"';
\r
54 if(emptyTags.test(o.tag)){
\r
58 var cn = o.children || o.cn;
\r
60 if(cn instanceof Array){
\r
61 for(var i = 0, len = cn.length; i < len; i++) {
\r
62 b += createHtml(cn[i], b);
\r
65 b += createHtml(cn, b);
\r
71 b += "</" + o.tag + ">";
\r
78 var createDom = function(o, parentNode){
\r
79 var el = document.createElement(o.tag||'div');
\r
80 var useSet = el.setAttribute ? true : false;
82 if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || attr == "style" || typeof o[attr] == "function") continue;
\r
84 el.className = o["cls"];
\r
86 if(useSet) el.setAttribute(attr, o[attr]);
\r
87 else el[attr] = o[attr];
\r
90 Ext.DomHelper.applyStyles(el, o.style);
\r
91 var cn = o.children || o.cn;
\r
93 if(cn instanceof Array){
\r
94 for(var i = 0, len = cn.length; i < len; i++) {
\r
95 createDom(cn[i], el);
\r
102 el.innerHTML = o.html;
\r
105 parentNode.appendChild(el);
\r
110 var ieTable = function(depth, s, h, e){
\r
111 tempTableEl.innerHTML = [s, h, e].join('');
\r
112 var i = -1, el = tempTableEl;
\r
113 while(++i < depth){
\r
114 el = el.firstChild;
\r
120 var ts = '<table>',
\r
122 tbs = ts+'<tbody>',
\r
123 tbe = '</tbody>'+te,
\r
124 trs = tbs + '<tr>',
\r
128 var insertIntoTable = function(tag, where, el, html){
\r
130 tempTableEl = document.createElement('div');
\r
135 if(where == 'afterbegin' || where == 'beforeend'){
138 if(where == 'beforebegin'){
\r
140 el = el.parentNode;
\r
142 before = el.nextSibling;
\r
143 el = el.parentNode;
\r
145 node = ieTable(4, trs, html, tre);
\r
147 else if(tag == 'tr'){
\r
148 if(where == 'beforebegin'){
\r
150 el = el.parentNode;
\r
151 node = ieTable(3, tbs, html, tbe);
\r
152 } else if(where == 'afterend'){
\r
153 before = el.nextSibling;
\r
154 el = el.parentNode;
\r
155 node = ieTable(3, tbs, html, tbe);
\r
157 if(where == 'afterbegin'){
\r
158 before = el.firstChild;
\r
160 node = ieTable(4, trs, html, tre);
\r
162 } else if(tag == 'tbody'){
\r
163 if(where == 'beforebegin'){
\r
165 el = el.parentNode;
\r
166 node = ieTable(2, ts, html, te);
\r
167 } else if(where == 'afterend'){
\r
168 before = el.nextSibling;
\r
169 el = el.parentNode;
\r
170 node = ieTable(2, ts, html, te);
\r
172 if(where == 'afterbegin'){
\r
173 before = el.firstChild;
\r
175 node = ieTable(3, tbs, html, tbe);
\r
178 if(where == 'beforebegin' || where == 'afterend'){
181 if(where == 'afterbegin'){
\r
182 before = el.firstChild;
\r
184 node = ieTable(2, ts, html, te);
\r
186 el.insertBefore(node, before);
\r
195 markup : function(o){
\r
196 return createHtml(o);
\r
200 applyStyles : function(el, styles){
\r
203 if(typeof styles == "string"){
\r
204 var re = /\s?([a-z\-]*)\:\s?([^;]*);?/gi;
\r
206 while ((matches = re.exec(styles)) != null){
\r
207 el.setStyle(matches[1], matches[2]);
\r
209 }else if (typeof styles == "object"){
\r
210 for (var style in styles){
\r
211 el.setStyle(style, styles[style]);
\r
213 }else if (typeof styles == "function"){
\r
214 Ext.DomHelper.applyStyles(el, styles.call());
\r
220 insertHtml : function(where, el, html){
\r
221 where = where.toLowerCase();
\r
222 if(el.insertAdjacentHTML){
\r
223 if(tableRe.test(el.tagName)){
\r
225 if(rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html)){
\r
230 case "beforebegin":
\r
231 el.insertAdjacentHTML('BeforeBegin', html);
\r
232 return el.previousSibling;
\r
234 el.insertAdjacentHTML('AfterBegin', html);
\r
235 return el.firstChild;
\r
237 el.insertAdjacentHTML('BeforeEnd', html);
\r
238 return el.lastChild;
\r
240 el.insertAdjacentHTML('AfterEnd', html);
\r
241 return el.nextSibling;
\r
243 throw 'Illegal insertion point -> "' + where + '"';
\r
245 var range = el.ownerDocument.createRange();
\r
248 case "beforebegin":
\r
249 range.setStartBefore(el);
\r
250 frag = range.createContextualFragment(html);
\r
251 el.parentNode.insertBefore(frag, el);
\r
252 return el.previousSibling;
\r
255 range.setStartBefore(el.firstChild);
\r
256 frag = range.createContextualFragment(html);
\r
257 el.insertBefore(frag, el.firstChild);
\r
258 return el.firstChild;
\r
260 el.innerHTML = html;
\r
261 return el.firstChild;
\r
265 range.setStartAfter(el.lastChild);
\r
266 frag = range.createContextualFragment(html);
\r
267 el.appendChild(frag);
\r
268 return el.lastChild;
\r
270 el.innerHTML = html;
\r
271 return el.lastChild;
\r
274 range.setStartAfter(el);
\r
275 frag = range.createContextualFragment(html);
\r
276 el.parentNode.insertBefore(frag, el.nextSibling);
\r
277 return el.nextSibling;
\r
279 throw 'Illegal insertion point -> "' + where + '"';
\r
283 insertBefore : function(el, o, returnElement){
\r
284 return this.doInsert(el, o, returnElement, "beforeBegin");
\r
288 insertAfter : function(el, o, returnElement){
\r
289 return this.doInsert(el, o, returnElement, "afterEnd", "nextSibling");
\r
293 insertFirst : function(el, o, returnElement){
\r
294 return this.doInsert(el, o, returnElement, "afterBegin");
\r
298 doInsert : function(el, o, returnElement, pos, sibling){
\r
299 el = Ext.getDom(el);
\r
302 newNode = createDom(o, null);
\r
303 el.parentNode.insertBefore(newNode, sibling ? el[sibling] : el);
\r
305 var html = createHtml(o);
\r
306 newNode = this.insertHtml(pos, el, html);
\r
308 return returnElement ? Ext.get(newNode, true) : newNode;
\r
312 append : function(el, o, returnElement){
\r
313 el = Ext.getDom(el);
\r
316 newNode = createDom(o, null);
\r
317 el.appendChild(newNode);
\r
319 var html = createHtml(o);
\r
320 newNode = this.insertHtml("beforeEnd", el, html);
\r
322 return returnElement ? Ext.get(newNode, true) : newNode;
\r
326 overwrite : function(el, o, returnElement){
\r
327 el = Ext.getDom(el);
\r
328 el.innerHTML = createHtml(o);
\r
329 return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
\r
333 createTemplate : function(o){
\r
334 var html = createHtml(o);
\r
335 return new Ext.Template(html);
\r
341 Ext.Template = function(html){
\r
342 if(html instanceof Array){
\r
343 html = html.join("");
\r
344 }else if(arguments.length > 1){
\r
345 html = Array.prototype.join.call(arguments, "");
\r
351 Ext.Template.prototype = {
\r
353 applyTemplate : function(values){
\r
355 return this.compiled(values);
\r
357 var useF = this.disableFormats !== true;
\r
358 var fm = Ext.util.Format, tpl = this;
\r
359 var fn = function(m, name, format, args){
\r
360 if(format && useF){
\r
361 if(format.substr(0, 5) == "this."){
\r
362 return tpl.call(format.substr(5), values[name], values);
\r
368 var re = /^\s*['"](.*)["']\s*$/;
\r
369 args = args.split(',');
\r
370 for(var i = 0, len = args.length; i < len; i++){
\r
371 args[i] = args[i].replace(re, "$1");
\r
373 args = [values[name]].concat(args);
\r
375 args = [values[name]];
\r
377 return fm[format].apply(fm, args);
\r
380 return values[name] !== undefined ? values[name] : "";
\r
383 return this.html.replace(this.re, fn);
\r
387 set : function(html, compile){
\r
389 this.compiled = null;
\r
397 disableFormats : false,
\r
400 re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
\r
403 compile : function(){
\r
404 var fm = Ext.util.Format;
\r
405 var useF = this.disableFormats !== true;
\r
406 var sep = Ext.isGecko ? "+" : ",";
\r
407 var fn = function(m, name, format, args){
\r
408 if(format && useF){
\r
409 args = args ? ',' + args : "";
\r
410 if(format.substr(0, 5) != "this."){
\r
411 format = "fm." + format + '(';
\r
413 format = 'this.call("'+ format.substr(5) + '", ';
\r
417 args= ''; format = "(values['" + name + "'] == undefined ? '' : ";
\r
419 return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";
\r
424 body = "this.compiled = function(values){ return '" +
\r
425 this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
\r
428 body = ["this.compiled = function(values){ return ['"];
\r
429 body.push(this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));
\r
430 body.push("'].join('');};");
\r
431 body = body.join('');
\r
438 call : function(fnName, value, allValues){
\r
439 return this[fnName](value, allValues);
\r
443 insertFirst: function(el, values, returnElement){
\r
444 return this.doInsert('afterBegin', el, values, returnElement);
\r
448 insertBefore: function(el, values, returnElement){
\r
449 return this.doInsert('beforeBegin', el, values, returnElement);
\r
453 insertAfter : function(el, values, returnElement){
\r
454 return this.doInsert('afterEnd', el, values, returnElement);
\r
458 append : function(el, values, returnElement){
\r
459 return this.doInsert('beforeEnd', el, values, returnElement);
\r
462 doInsert : function(where, el, values, returnEl){
\r
463 el = Ext.getDom(el);
\r
464 var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values));
\r
465 return returnEl ? Ext.get(newNode, true) : newNode;
\r
469 overwrite : function(el, values, returnElement){
\r
470 el = Ext.getDom(el);
\r
471 el.innerHTML = this.applyTemplate(values);
\r
472 return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
\r
476 Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
\r
479 Ext.DomHelper.Template = Ext.Template;
\r
482 Ext.Template.from = function(el){
\r
483 el = Ext.getDom(el);
\r
484 return new Ext.Template(el.value || el.innerHTML);
\r
488 Ext.DomQuery = function(){
\r
489 var cache = {}, simpleCache = {}, valueCache = {};
\r
490 var nonSpace = /\S/;
\r
491 var trimRe = /^\s+|\s+$/g;
\r
492 var tplRe = /\{(\d+)\}/g;
\r
493 var modeRe = /^(\s?[\/>+~]\s?|\s|$)/;
\r
494 var tagTokenRe = /^(#)?([\w-\*]+)/;
\r
495 var nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/;
\r
497 function child(p, index){
\r
499 var n = p.firstChild;
\r
501 if(n.nodeType == 1){
\r
512 while((n = n.nextSibling) && n.nodeType != 1);
\r
517 while((n = n.previousSibling) && n.nodeType != 1);
\r
521 function children(d){
\r
522 var n = d.firstChild, ni = -1;
\r
524 var nx = n.nextSibling;
\r
525 if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
\r
528 n.nodeIndex = ++ni;
\r
535 function byClassName(c, a, v){
\r
539 var r = [], ri = -1, cn;
\r
540 for(var i = 0, ci; ci = c[i]; i++){
\r
541 if((' '+ci.className+' ').indexOf(v) != -1){
\r
548 function attrValue(n, attr){
\r
549 if(!n.tagName && typeof n.length != "undefined"){
\r
558 if(attr == "class" || attr == "className"){
\r
559 return n.className;
\r
561 return n.getAttribute(attr) || n[attr];
\r
565 function getNodes(ns, mode, tagName){
\r
566 var result = [], ri = -1, cs;
\r
570 tagName = tagName || "*";
\r
571 if(typeof ns.getElementsByTagName != "undefined"){
\r
575 for(var i = 0, ni; ni = ns[i]; i++){
\r
576 cs = ni.getElementsByTagName(tagName);
\r
577 for(var j = 0, ci; ci = cs[j]; j++){
\r
581 }else if(mode == "/" || mode == ">"){
\r
582 var utag = tagName.toUpperCase();
\r
583 for(var i = 0, ni, cn; ni = ns[i]; i++){
\r
584 cn = ni.children || ni.childNodes;
\r
585 for(var j = 0, cj; cj = cn[j]; j++){
\r
586 if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
\r
591 }else if(mode == "+"){
\r
592 var utag = tagName.toUpperCase();
\r
593 for(var i = 0, n; n = ns[i]; i++){
\r
594 while((n = n.nextSibling) && n.nodeType != 1);
\r
595 if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
\r
599 }else if(mode == "~"){
\r
600 for(var i = 0, n; n = ns[i]; i++){
\r
601 while((n = n.nextSibling) && (n.nodeType != 1 || (tagName == '*' || n.tagName.toLowerCase()!=tagName)));
\r
610 function concat(a, b){
\r
612 return a.concat(b);
\r
614 for(var i = 0, l = b.length; i < l; i++){
\r
615 a[a.length] = b[i];
\r
620 function byTag(cs, tagName){
\r
621 if(cs.tagName || cs == document){
\r
627 var r = [], ri = -1;
\r
628 tagName = tagName.toLowerCase();
\r
629 for(var i = 0, ci; ci = cs[i]; i++){
\r
630 if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){
\r
637 function byId(cs, attr, id){
\r
638 if(cs.tagName || cs == document){
\r
644 var r = [], ri = -1;
\r
645 for(var i = 0,ci; ci = cs[i]; i++){
\r
646 if(ci && ci.id == id){
\r
654 function byAttribute(cs, attr, value, op, custom){
\r
655 var r = [], ri = -1, st = custom=="{";
\r
656 var f = Ext.DomQuery.operators[op];
\r
657 for(var i = 0, ci; ci = cs[i]; i++){
\r
660 a = Ext.DomQuery.getStyle(ci, attr);
\r
662 else if(attr == "class" || attr == "className"){
\r
664 }else if(attr == "for"){
\r
666 }else if(attr == "href"){
\r
667 a = ci.getAttribute("href", 2);
\r
669 a = ci.getAttribute(attr);
\r
671 if((f && f(a, value)) || (!f && a)){
\r
678 function byPseudo(cs, name, value){
\r
679 return Ext.DomQuery.pseudos[name](cs, value);
\r
685 var isIE = window.ActiveXObject ? true : false;
\r
689 eval("var batch = 30803;");
\r
693 function nodupIEXml(cs){
\r
695 cs[0].setAttribute("_nodup", d);
\r
697 for(var i = 1, len = cs.length; i < len; i++){
\r
699 if(!c.getAttribute("_nodup") != d){
\r
700 c.setAttribute("_nodup", d);
\r
704 for(var i = 0, len = cs.length; i < len; i++){
\r
705 cs[i].removeAttribute("_nodup");
\r
710 function nodup(cs){
\r
714 var len = cs.length, c, i, r = cs, cj, ri = -1;
\r
715 if(!len || typeof cs.nodeType != "undefined" || len == 1){
\r
718 if(isIE && typeof cs[0].selectSingleNode != "undefined"){
\r
719 return nodupIEXml(cs);
\r
723 for(i = 1; c = cs[i]; i++){
\r
728 for(var j = 0; j < i; j++){
\r
731 for(j = i+1; cj = cs[j]; j++){
\r
732 if(cj._nodup != d){
\r
743 function quickDiffIEXml(c1, c2){
\r
745 for(var i = 0, len = c1.length; i < len; i++){
\r
746 c1[i].setAttribute("_qdiff", d);
\r
749 for(var i = 0, len = c2.length; i < len; i++){
\r
750 if(c2[i].getAttribute("_qdiff") != d){
\r
751 r[r.length] = c2[i];
\r
754 for(var i = 0, len = c1.length; i < len; i++){
\r
755 c1[i].removeAttribute("_qdiff");
\r
760 function quickDiff(c1, c2){
\r
761 var len1 = c1.length;
\r
765 if(isIE && c1[0].selectSingleNode){
\r
766 return quickDiffIEXml(c1, c2);
\r
769 for(var i = 0; i < len1; i++){
\r
773 for(var i = 0, len = c2.length; i < len; i++){
\r
774 if(c2[i]._qdiff != d){
\r
775 r[r.length] = c2[i];
\r
781 function quickId(ns, mode, root, id){
\r
783 var d = root.ownerDocument || root;
\r
784 return d.getElementById(id);
\r
786 ns = getNodes(ns, mode, "*");
\r
787 return byId(ns, null, id);
\r
791 getStyle : function(el, name){
\r
792 return Ext.fly(el).getStyle(name);
\r
795 compile : function(path, type){
\r
796 type = type || "select";
\r
798 var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];
\r
799 var q = path, mode, lq;
\r
800 var tk = Ext.DomQuery.matchers;
\r
801 var tklen = tk.length;
\r
805 var lmode = q.match(modeRe);
\r
806 if(lmode && lmode[1]){
\r
807 fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
\r
808 q = q.replace(lmode[1], "");
\r
811 while(path.substr(0, 1)=="/"){
\r
812 path = path.substr(1);
\r
815 while(q && lq != q){
\r
817 var tm = q.match(tagTokenRe);
\r
818 if(type == "select"){
\r
821 fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");';
\r
823 fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");';
\r
825 q = q.replace(tm[0], "");
\r
826 }else if(q.substr(0, 1) != '@'){
\r
827 fn[fn.length] = 'n = getNodes(n, mode, "*");';
\r
832 fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");';
\r
834 fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");';
\r
836 q = q.replace(tm[0], "");
\r
839 while(!(mm = q.match(modeRe))){
\r
840 var matched = false;
\r
841 for(var j = 0; j < tklen; j++){
\r
843 var m = q.match(t.re);
\r
845 fn[fn.length] = t.select.replace(tplRe, function(x, i){
\r
848 q = q.replace(m[0], "");
\r
855 throw 'Error parsing selector, parsing failed at "' + q + '"';
\r
859 fn[fn.length] = 'mode="'+mm[1].replace(trimRe, "")+'";';
\r
860 q = q.replace(mm[1], "");
\r
863 fn[fn.length] = "return nodup(n);\n}";
\r
869 select : function(path, root, type){
\r
870 if(!root || root == document){
\r
873 if(typeof root == "string"){
\r
874 root = document.getElementById(root);
\r
876 var paths = path.split(",");
\r
878 for(var i = 0, len = paths.length; i < len; i++){
\r
879 var p = paths[i].replace(trimRe, "");
\r
881 cache[p] = Ext.DomQuery.compile(p);
\r
883 throw p + " is not a valid selector";
\r
886 var result = cache[p](root);
\r
887 if(result && result != document){
\r
888 results = results.concat(result);
\r
891 if(paths.length > 1){
\r
892 return nodup(results);
\r
898 selectNode : function(path, root){
\r
899 return Ext.DomQuery.select(path, root)[0];
\r
903 selectValue : function(path, root, defaultValue){
\r
904 path = path.replace(trimRe, "");
\r
905 if(!valueCache[path]){
\r
906 valueCache[path] = Ext.DomQuery.compile(path, "select");
\r
908 var n = valueCache[path](root);
\r
909 n = n[0] ? n[0] : n;
\r
910 var v = (n && n.firstChild ? n.firstChild.nodeValue : null);
\r
911 return ((v === null||v === undefined||v==='') ? defaultValue : v);
\r
915 selectNumber : function(path, root, defaultValue){
\r
916 var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
\r
917 return parseFloat(v);
\r
921 is : function(el, ss){
\r
922 if(typeof el == "string"){
\r
923 el = document.getElementById(el);
\r
925 var isArray = (el instanceof Array);
\r
926 var result = Ext.DomQuery.filter(isArray ? el : [el], ss);
\r
927 return isArray ? (result.length == el.length) : (result.length > 0);
\r
931 filter : function(els, ss, nonMatches){
\r
932 ss = ss.replace(trimRe, "");
\r
933 if(!simpleCache[ss]){
\r
934 simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
\r
936 var result = simpleCache[ss](els);
\r
937 return nonMatches ? quickDiff(result, els) : result;
\r
943 select: 'n = byClassName(n, null, " {1} ");'
\r
945 re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
\r
946 select: 'n = byPseudo(n, "{1}", "{2}");'
\r
948 re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
\r
949 select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
\r
952 select: 'n = byId(n, null, "{1}");'
\r
955 select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
\r
961 "=" : function(a, v){
\r
964 "!=" : function(a, v){
\r
967 "^=" : function(a, v){
\r
968 return a && a.substr(0, v.length) == v;
\r
970 "$=" : function(a, v){
\r
971 return a && a.substr(a.length-v.length) == v;
\r
973 "*=" : function(a, v){
\r
974 return a && a.indexOf(v) !== -1;
\r
976 "%=" : function(a, v){
\r
977 return (a % v) == 0;
\r
979 "|=" : function(a, v){
\r
980 return a && (a == v || a.substr(0, v.length+1) == v+'-');
\r
982 "~=" : function(a, v){
\r
983 return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
\r
989 "first-child" : function(c){
\r
990 var r = [], ri = -1, n;
\r
991 for(var i = 0, ci; ci = n = c[i]; i++){
\r
992 while((n = n.previousSibling) && n.nodeType != 1);
\r
1000 "last-child" : function(c){
\r
1001 var r = [], ri = -1, n;
\r
1002 for(var i = 0, ci; ci = n = c[i]; i++){
\r
1003 while((n = n.nextSibling) && n.nodeType != 1);
\r
1011 "nth-child" : function(c, a) {
\r
1012 var r = [], ri = -1;
\r
1013 var m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a);
\r
1014 var f = (m[1] || 1) - 0, l = m[2] - 0;
\r
1015 for(var i = 0, n; n = c[i]; i++){
\r
1016 var pn = n.parentNode;
\r
1017 if (batch != pn._batch) {
\r
1019 for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
\r
1020 if(cn.nodeType == 1){
\r
1021 cn.nodeIndex = ++j;
\r
1024 pn._batch = batch;
\r
1027 if (l == 0 || n.nodeIndex == l){
\r
1030 } else if ((n.nodeIndex + l) % f == 0){
\r
1038 "only-child" : function(c){
\r
1039 var r = [], ri = -1;;
\r
1040 for(var i = 0, ci; ci = c[i]; i++){
\r
1041 if(!prev(ci) && !next(ci)){
\r
1048 "empty" : function(c){
\r
1049 var r = [], ri = -1;
\r
1050 for(var i = 0, ci; ci = c[i]; i++){
\r
1051 var cns = ci.childNodes, j = 0, cn, empty = true;
\r
1052 while(cn = cns[j]){
\r
1054 if(cn.nodeType == 1 || cn.nodeType == 3){
\r
1066 "contains" : function(c, v){
\r
1067 var r = [], ri = -1;
\r
1068 for(var i = 0, ci; ci = c[i]; i++){
\r
1069 if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
\r
1076 "nodeValue" : function(c, v){
\r
1077 var r = [], ri = -1;
\r
1078 for(var i = 0, ci; ci = c[i]; i++){
\r
1079 if(ci.firstChild && ci.firstChild.nodeValue == v){
\r
1086 "checked" : function(c){
\r
1087 var r = [], ri = -1;
\r
1088 for(var i = 0, ci; ci = c[i]; i++){
\r
1089 if(ci.checked == true){
\r
1096 "not" : function(c, ss){
\r
1097 return Ext.DomQuery.filter(c, ss, true);
\r
1100 "odd" : function(c){
\r
1101 return this["nth-child"](c, "odd");
\r
1104 "even" : function(c){
\r
1105 return this["nth-child"](c, "even");
\r
1108 "nth" : function(c, a){
\r
1109 return c[a-1] || [];
\r
1112 "first" : function(c){
\r
1113 return c[0] || [];
\r
1116 "last" : function(c){
\r
1117 return c[c.length-1] || [];
\r
1120 "has" : function(c, ss){
\r
1121 var s = Ext.DomQuery.select;
\r
1122 var r = [], ri = -1;
\r
1123 for(var i = 0, ci; ci = c[i]; i++){
\r
1124 if(s(ss, ci).length > 0){
\r
1131 "next" : function(c, ss){
\r
1132 var is = Ext.DomQuery.is;
\r
1133 var r = [], ri = -1;
\r
1134 for(var i = 0, ci; ci = c[i]; i++){
\r
1136 if(n && is(n, ss)){
\r
1143 "prev" : function(c, ss){
\r
1144 var is = Ext.DomQuery.is;
\r
1145 var r = [], ri = -1;
\r
1146 for(var i = 0, ci; ci = c[i]; i++){
\r
1148 if(n && is(n, ss)){
\r
1159 Ext.query = Ext.DomQuery.select;
\r
1162 Ext.util.Observable = function(){
1164 this.on(this.listeners);
1165 delete this.listeners;
1168 Ext.util.Observable.prototype = {
1170 fireEvent : function(){
1171 var ce = this.events[arguments[0].toLowerCase()];
1172 if(typeof ce == "object"){
1173 return ce.fire.apply(ce, Array.prototype.slice.call(arguments, 1));
1179 filterOptRe : /^(?:scope|delay|buffer|single)$/,
1182 addListener : function(eventName, fn, scope, o){
1183 if(typeof eventName == "object"){
1186 if(this.filterOptRe.test(e)){
1189 if(typeof o[e] == "function"){
1190 this.addListener(e, o[e], o.scope, o);
1192 this.addListener(e, o[e].fn, o[e].scope, o[e]);
1197 o = (!o || typeof o == "boolean") ? {} : o;
1198 eventName = eventName.toLowerCase();
1199 var ce = this.events[eventName] || true;
1200 if(typeof ce == "boolean"){
1201 ce = new Ext.util.Event(this, eventName);
1202 this.events[eventName] = ce;
1204 ce.addListener(fn, scope, o);
1208 removeListener : function(eventName, fn, scope){
1209 var ce = this.events[eventName.toLowerCase()];
1210 if(typeof ce == "object"){
1211 ce.removeListener(fn, scope);
1216 purgeListeners : function(){
1217 for(var evt in this.events){
1218 if(typeof this.events[evt] == "object"){
1219 this.events[evt].clearListeners();
1224 relayEvents : function(o, events){
1225 var createHandler = function(ename){
1227 return this.fireEvent.apply(this, Ext.combine(ename, Array.prototype.slice.call(arguments, 0)));
1230 for(var i = 0, len = events.length; i < len; i++){
1231 var ename = events[i];
1232 if(!this.events[ename]){ this.events[ename] = true; };
1233 o.on(ename, createHandler(ename), this);
1238 addEvents : function(o){
1242 Ext.applyIf(this.events, o);
1246 hasListener : function(eventName){
1247 var e = this.events[eventName];
1248 return typeof e == "object" && e.listeners.length > 0;
1252 Ext.util.Observable.prototype.on = Ext.util.Observable.prototype.addListener;
1254 Ext.util.Observable.prototype.un = Ext.util.Observable.prototype.removeListener;
1257 Ext.util.Observable.capture = function(o, fn, scope){
1258 o.fireEvent = o.fireEvent.createInterceptor(fn, scope);
1262 Ext.util.Observable.releaseCapture = function(o){
1263 o.fireEvent = Ext.util.Observable.prototype.fireEvent;
1268 var createBuffered = function(h, o, scope){
1269 var task = new Ext.util.DelayedTask();
1271 task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));
1275 var createSingle = function(h, e, fn, scope){
1277 e.removeListener(fn, scope);
1278 return h.apply(scope, arguments);
1282 var createDelayed = function(h, o, scope){
1284 var args = Array.prototype.slice.call(arguments, 0);
1285 setTimeout(function(){
1286 h.apply(scope, args);
1291 Ext.util.Event = function(obj, name){
1294 this.listeners = [];
1297 Ext.util.Event.prototype = {
1298 addListener : function(fn, scope, options){
1299 var o = options || {};
1300 scope = scope || this.obj;
1301 if(!this.isListening(fn, scope)){
1302 var l = {fn: fn, scope: scope, options: o};
1305 h = createDelayed(h, o, scope);
1308 h = createSingle(h, this, fn, scope);
1311 h = createBuffered(h, o, scope);
1314 if(!this.firing){ this.listeners.push(l);
1316 this.listeners = this.listeners.slice(0);
1317 this.listeners.push(l);
1322 findListener : function(fn, scope){
1323 scope = scope || this.obj;
1324 var ls = this.listeners;
1325 for(var i = 0, len = ls.length; i < len; i++){
1327 if(l.fn == fn && l.scope == scope){
1334 isListening : function(fn, scope){
1335 return this.findListener(fn, scope) != -1;
1338 removeListener : function(fn, scope){
1340 if((index = this.findListener(fn, scope)) != -1){
1342 this.listeners.splice(index, 1);
1344 this.listeners = this.listeners.slice(0);
1345 this.listeners.splice(index, 1);
1352 clearListeners : function(){
1353 this.listeners = [];
1357 var ls = this.listeners, scope, len = ls.length;
1360 var args = Array.prototype.slice.call(arguments, 0);
1361 for(var i = 0; i < len; i++){
1363 if(l.fireFn.apply(l.scope||this.obj||window, arguments) === false){
1364 this.firing = false;
1368 this.firing = false;
1375 Ext.EventManager = function(){
\r
1376 var docReadyEvent, docReadyProcId, docReadyState = false;
\r
1377 var resizeEvent, resizeTask, textEvent, textSize;
\r
1378 var E = Ext.lib.Event;
\r
1379 var D = Ext.lib.Dom;
\r
1382 var fireDocReady = function(){
\r
1383 if(!docReadyState){
\r
1384 docReadyState = true;
\r
1385 Ext.isReady = true;
\r
1386 if(docReadyProcId){
\r
1387 clearInterval(docReadyProcId);
\r
1389 if(Ext.isGecko || Ext.isOpera) {
\r
1390 document.removeEventListener("DOMContentLoaded", fireDocReady, false);
\r
1393 var defer = document.getElementById("ie-deferred-loader");
\r
1395 defer.onreadystatechange = null;
\r
1396 defer.parentNode.removeChild(defer);
\r
1399 if(docReadyEvent){
\r
1400 docReadyEvent.fire();
\r
1401 docReadyEvent.clearListeners();
\r
1406 var initDocReady = function(){
\r
1407 docReadyEvent = new Ext.util.Event();
\r
1408 if(Ext.isGecko || Ext.isOpera) {
\r
1409 document.addEventListener("DOMContentLoaded", fireDocReady, false);
\r
1410 }else if(Ext.isIE){
\r
1411 document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>");
\r
1412 var defer = document.getElementById("ie-deferred-loader");
\r
1413 defer.onreadystatechange = function(){
\r
1414 if(this.readyState == "complete"){
\r
1418 }else if(Ext.isSafari){
\r
1419 docReadyProcId = setInterval(function(){
\r
1420 var rs = document.readyState;
\r
1421 if(rs == "complete") {
\r
1427 E.on(window, "load", fireDocReady);
\r
1430 var createBuffered = function(h, o){
\r
1431 var task = new Ext.util.DelayedTask(h);
\r
1432 return function(e){
\r
1434 e = new Ext.EventObjectImpl(e);
\r
1435 task.delay(o.buffer, h, null, [e]);
\r
1439 var createSingle = function(h, el, ename, fn){
\r
1440 return function(e){
\r
1441 Ext.EventManager.removeListener(el, ename, fn);
\r
1446 var createDelayed = function(h, o){
\r
1447 return function(e){
\r
1449 e = new Ext.EventObjectImpl(e);
\r
1450 setTimeout(function(){
\r
1452 }, o.delay || 10);
\r
1456 var listen = function(element, ename, opt, fn, scope){
\r
1457 var o = (!opt || typeof opt == "boolean") ? {} : opt;
\r
1458 fn = fn || o.fn; scope = scope || o.scope;
\r
1459 var el = Ext.getDom(element);
\r
1461 throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';
\r
1463 var h = function(e){
\r
1464 e = Ext.EventObject.setEvent(e);
\r
1467 t = e.getTarget(o.delegate, el);
\r
1474 if(o.stopEvent === true){
\r
1477 if(o.preventDefault === true){
\r
1478 e.preventDefault();
\r
1480 if(o.stopPropagation === true){
\r
1481 e.stopPropagation();
\r
1484 if(o.normalized === false){
\r
1485 e = e.browserEvent;
\r
1488 fn.call(scope || el, e, t, o);
\r
1491 h = createDelayed(h, o);
\r
1494 h = createSingle(h, el, ename, fn);
\r
1497 h = createBuffered(h, o);
\r
1499 fn._handlers = fn._handlers || [];
\r
1500 fn._handlers.push([Ext.id(el), ename, h]);
\r
1502 E.on(el, ename, h);
\r
1503 if(ename == "mousewheel" && el.addEventListener){
1504 el.addEventListener("DOMMouseScroll", h, false);
\r
1505 E.on(window, 'unload', function(){
\r
1506 el.removeEventListener("DOMMouseScroll", h, false);
\r
1509 if(ename == "mousedown" && el == document){
1510 Ext.EventManager.stoppedMouseDownEvent.addListener(h);
\r
1515 var stopListening = function(el, ename, fn){
\r
1516 var id = Ext.id(el), hds = fn._handlers, hd = fn;
\r
1518 for(var i = 0, len = hds.length; i < len; i++){
\r
1520 if(h[0] == id && h[1] == ename){
\r
1527 E.un(el, ename, hd);
\r
1528 el = Ext.getDom(el);
\r
1529 if(ename == "mousewheel" && el.addEventListener){
\r
1530 el.removeEventListener("DOMMouseScroll", hd, false);
\r
1532 if(ename == "mousedown" && el == document){
1533 Ext.EventManager.stoppedMouseDownEvent.removeListener(hd);
\r
1537 var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
\r
1541 wrap : function(fn, scope, override){
\r
1542 return function(e){
\r
1543 Ext.EventObject.setEvent(e);
\r
1544 fn.call(override ? scope || window : window, Ext.EventObject, scope);
\r
1549 addListener : function(element, eventName, fn, scope, options){
\r
1550 if(typeof eventName == "object"){
\r
1551 var o = eventName;
\r
1553 if(propRe.test(e)){
\r
1556 if(typeof o[e] == "function"){
\r
1558 listen(element, e, o, o[e], o.scope);
\r
1561 listen(element, e, o[e]);
\r
1566 return listen(element, eventName, options, fn, scope);
\r
1570 removeListener : function(element, eventName, fn){
\r
1571 return stopListening(element, eventName, fn);
\r
1575 onDocumentReady : function(fn, scope, options){
\r
1577 docReadyEvent.addListener(fn, scope, options);
\r
1578 docReadyEvent.fire();
\r
1579 docReadyEvent.clearListeners();
\r
1582 if(!docReadyEvent){
\r
1585 docReadyEvent.addListener(fn, scope, options);
\r
1589 onWindowResize : function(fn, scope, options){
\r
1591 resizeEvent = new Ext.util.Event();
\r
1592 resizeTask = new Ext.util.DelayedTask(function(){
\r
1593 resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
\r
1595 E.on(window, "resize", function(){
\r
1597 resizeTask.delay(50);
\r
1599 resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
\r
1603 resizeEvent.addListener(fn, scope, options);
\r
1607 onTextResize : function(fn, scope, options){
\r
1609 textEvent = new Ext.util.Event();
\r
1610 var textEl = new Ext.Element(document.createElement('div'));
\r
1611 textEl.dom.className = 'x-text-resize';
\r
1612 textEl.dom.innerHTML = 'X';
\r
1613 textEl.appendTo(document.body);
\r
1614 textSize = textEl.dom.offsetHeight;
\r
1615 setInterval(function(){
\r
1616 if(textEl.dom.offsetHeight != textSize){
\r
1617 textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);
\r
1619 }, this.textResizeInterval);
\r
1621 textEvent.addListener(fn, scope, options);
\r
1625 removeResizeListener : function(fn, scope){
\r
1627 resizeEvent.removeListener(fn, scope);
\r
1632 fireResize : function(){
\r
1634 resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
\r
1638 ieDeferSrc : false,
\r
1640 textResizeInterval : 50
\r
1643 pub.on = pub.addListener;
\r
1644 pub.un = pub.removeListener;
\r
1646 pub.stoppedMouseDownEvent = new Ext.util.Event();
\r
1650 Ext.onReady = Ext.EventManager.onDocumentReady;
\r
1652 Ext.onReady(function(){
\r
1653 var bd = Ext.get(document.body);
\r
1654 if(!bd){ return; }
\r
1657 Ext.isIE ? "ext-ie"
\r
1658 : Ext.isGecko ? "ext-gecko"
\r
1659 : Ext.isOpera ? "ext-opera"
\r
1660 : Ext.isSafari ? "ext-safari" : ""];
\r
1663 cls.push("ext-mac");
\r
1666 cls.push("ext-linux");
\r
1668 if(Ext.isBorderBox){
\r
1669 cls.push('ext-border-box');
\r
1672 var p = bd.dom.parentNode;
\r
1674 p.className += ' ext-strict';
\r
1677 bd.addClass(cls.join(' '));
\r
1681 Ext.EventObject = function(){
\r
1683 var E = Ext.lib.Event;
\r
1686 var safariKeys = {
\r
1699 var btnMap = Ext.isIE ? {1:0,4:1,2:2} :
\r
1700 (Ext.isSafari ? {1:0,2:1,3:2} : {0:0,1:1,2:2});
\r
1702 Ext.EventObjectImpl = function(e){
\r
1704 this.setEvent(e.browserEvent || e);
\r
1707 Ext.EventObjectImpl.prototype = {
\r
1709 browserEvent : null,
\r
1757 setEvent : function(e){
\r
1758 if(e == this || (e && e.browserEvent)){
1761 this.browserEvent = e;
\r
1764 this.button = e.button ? btnMap[e.button] : (e.which ? e.which-1 : -1);
\r
1765 if(e.type == 'click' && this.button == -1){
\r
1768 this.type = e.type;
\r
1769 this.shiftKey = e.shiftKey;
\r
1771 this.ctrlKey = e.ctrlKey || e.metaKey;
\r
1772 this.altKey = e.altKey;
\r
1774 this.keyCode = e.keyCode;
\r
1775 this.charCode = e.charCode;
\r
1777 this.target = E.getTarget(e);
\r
1779 this.xy = E.getXY(e);
\r
1782 this.shiftKey = false;
\r
1783 this.ctrlKey = false;
\r
1784 this.altKey = false;
\r
1787 this.target = null;
\r
1794 stopEvent : function(){
\r
1795 if(this.browserEvent){
\r
1796 if(this.browserEvent.type == 'mousedown'){
\r
1797 Ext.EventManager.stoppedMouseDownEvent.fire(this);
\r
1799 E.stopEvent(this.browserEvent);
\r
1804 preventDefault : function(){
\r
1805 if(this.browserEvent){
\r
1806 E.preventDefault(this.browserEvent);
\r
1811 isNavKeyPress : function(){
\r
1812 var k = this.keyCode;
\r
1813 k = Ext.isSafari ? (safariKeys[k] || k) : k;
\r
1814 return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB || k == this.ESC;
\r
1817 isSpecialKey : function(){
\r
1818 var k = this.keyCode;
\r
1819 return (this.type == 'keypress' && this.ctrlKey) || k == 9 || k == 13 || k == 40 || k == 27 ||
\r
1820 (k == 16) || (k == 17) ||
\r
1821 (k >= 18 && k <= 20) ||
\r
1822 (k >= 33 && k <= 35) ||
\r
1823 (k >= 36 && k <= 39) ||
\r
1824 (k >= 44 && k <= 45);
\r
1827 stopPropagation : function(){
\r
1828 if(this.browserEvent){
\r
1829 if(this.type == 'mousedown'){
\r
1830 Ext.EventManager.stoppedMouseDownEvent.fire(this);
\r
1832 E.stopPropagation(this.browserEvent);
\r
1837 getCharCode : function(){
\r
1838 return this.charCode || this.keyCode;
\r
1842 getKey : function(){
\r
1843 var k = this.keyCode || this.charCode;
\r
1844 return Ext.isSafari ? (safariKeys[k] || k) : k;
\r
1848 getPageX : function(){
\r
1849 return this.xy[0];
\r
1853 getPageY : function(){
\r
1854 return this.xy[1];
\r
1858 getTime : function(){
\r
1859 if(this.browserEvent){
\r
1860 return E.getTime(this.browserEvent);
\r
1866 getXY : function(){
\r
1871 getTarget : function(selector, maxDepth, returnEl){
\r
1872 return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : this.target;
\r
1875 getRelatedTarget : function(){
\r
1876 if(this.browserEvent){
\r
1877 return E.getRelatedTarget(this.browserEvent);
\r
1883 getWheelDelta : function(){
\r
1884 var e = this.browserEvent;
\r
1886 if(e.wheelDelta){
\r
1887 delta = e.wheelDelta/120;
\r
1888 }else if(e.detail){
\r
1889 delta = -e.detail/3;
\r
1895 hasModifier : function(){
\r
1896 return !!((this.ctrlKey || this.altKey) || this.shiftKey);
\r
1900 within : function(el, related){
\r
1901 var t = this[related ? "getRelatedTarget" : "getTarget"]();
\r
1902 return t && Ext.fly(el).contains(t);
\r
1905 getPoint : function(){
\r
1906 return new Ext.lib.Point(this.xy[0], this.xy[1]);
\r
1910 return new Ext.EventObjectImpl();
\r
1916 var D = Ext.lib.Dom;
\r
1917 var E = Ext.lib.Event;
\r
1918 var A = Ext.lib.Anim;
\r
1921 var propCache = {};
\r
1922 var camelRe = /(-[a-z])/gi;
\r
1923 var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };
\r
1924 var view = document.defaultView;
\r
1926 Ext.Element = function(element, forceNew){
\r
1927 var dom = typeof element == "string" ?
\r
1928 document.getElementById(element) : element;
\r
1933 if(forceNew !== true && id && Ext.Element.cache[id]){
1934 return Ext.Element.cache[id];
\r
1941 this.id = id || Ext.id(dom);
\r
1944 var El = Ext.Element;
\r
1948 originalDisplay : "",
\r
1950 visibilityMode : 1,
\r
1952 defaultUnit : "px",
\r
1954 setVisibilityMode : function(visMode){
\r
1955 this.visibilityMode = visMode;
\r
1959 enableDisplayMode : function(display){
\r
1960 this.setVisibilityMode(El.DISPLAY);
\r
1961 if(typeof display != "undefined") this.originalDisplay = display;
\r
1966 findParent : function(simpleSelector, maxDepth, returnEl){
\r
1967 var p = this.dom, b = document.body, depth = 0, dq = Ext.DomQuery, stopEl;
\r
1968 maxDepth = maxDepth || 50;
\r
1969 if(typeof maxDepth != "number"){
\r
1970 stopEl = Ext.getDom(maxDepth);
\r
1973 while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){
\r
1974 if(dq.is(p, simpleSelector)){
\r
1975 return returnEl ? Ext.get(p) : p;
\r
1985 findParentNode : function(simpleSelector, maxDepth, returnEl){
\r
1986 var p = Ext.fly(this.dom.parentNode, '_internal');
\r
1987 return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
\r
1991 up : function(simpleSelector, maxDepth){
\r
1992 return this.findParentNode(simpleSelector, maxDepth, true);
\r
1998 is : function(simpleSelector){
\r
1999 return Ext.DomQuery.is(this.dom, simpleSelector);
\r
2003 animate : function(args, duration, onComplete, easing, animType){
\r
2004 this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType);
\r
2009 anim : function(args, opt, animType, defaultDur, defaultEase, cb){
\r
2010 animType = animType || 'run';
\r
2012 var anim = Ext.lib.Anim[animType](
\r
2014 (opt.duration || defaultDur) || .35,
\r
2015 (opt.easing || defaultEase) || 'easeOut',
\r
2017 Ext.callback(cb, this);
\r
2018 Ext.callback(opt.callback, opt.scope || this, [this, opt]);
\r
2027 preanim : function(a, i){
\r
2028 return !a[i] ? false : (typeof a[i] == "object" ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]});
\r
2032 clean : function(forceReclean){
\r
2033 if(this.isCleaned && forceReclean !== true){
\r
2037 var d = this.dom, n = d.firstChild, ni = -1;
\r
2039 var nx = n.nextSibling;
\r
2040 if(n.nodeType == 3 && !ns.test(n.nodeValue)){
\r
2043 n.nodeIndex = ++ni;
\r
2047 this.isCleaned = true;
\r
2052 calcOffsetsTo : function(el){
\r
2055 var restorePos = false;
\r
2056 if(el.getStyle('position') == 'static'){
\r
2057 el.position('relative');
\r
2058 restorePos = true;
\r
2061 var op = this.dom;
\r
2062 while(op && op != d && op.tagName != 'HTML'){
\r
2063 x+= op.offsetLeft;
\r
2065 op = op.offsetParent;
\r
2068 el.position('static');
\r
2074 scrollIntoView : function(container, hscroll){
\r
2075 var c = Ext.getDom(container) || document.body;
\r
2076 var el = this.dom;
\r
2078 var o = this.calcOffsetsTo(c),
\r
2081 b = t+el.offsetHeight,
\r
2082 r = l+el.offsetWidth;
\r
2084 var ch = c.clientHeight;
\r
2085 var ct = parseInt(c.scrollTop, 10);
\r
2086 var cl = parseInt(c.scrollLeft, 10);
\r
2088 var cr = cl + c.clientWidth;
\r
2093 c.scrollTop = b-ch;
\r
2096 if(hscroll !== false){
\r
2100 c.scrollLeft = r-c.clientWidth;
\r
2107 scrollChildIntoView : function(child, hscroll){
\r
2108 Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);
\r
2112 autoHeight : function(animate, duration, onComplete, easing){
\r
2113 var oldHeight = this.getHeight();
\r
2116 setTimeout(function(){
\r
2117 var height = parseInt(this.dom.scrollHeight, 10);
2119 this.setHeight(height);
\r
2121 if(typeof onComplete == "function"){
\r
2125 this.setHeight(oldHeight);
2126 this.setHeight(height, animate, duration, function(){
\r
2128 if(typeof onComplete == "function") onComplete();
\r
2129 }.createDelegate(this), easing);
\r
2131 }.createDelegate(this), 0);
\r
2136 contains : function(el){
\r
2137 if(!el){return false;}
\r
2138 return D.isAncestor(this.dom, el.dom ? el.dom : el);
\r
2142 isVisible : function(deep) {
\r
2143 var vis = !(this.getStyle("visibility") == "hidden" || this.getStyle("display") == "none");
\r
2144 if(deep !== true || !vis){
\r
2147 var p = this.dom.parentNode;
\r
2148 while(p && p.tagName.toLowerCase() != "body"){
\r
2149 if(!Ext.fly(p, '_isVisible').isVisible()){
\r
2158 select : function(selector, unique){
\r
2159 return El.select(selector, unique, this.dom);
\r
2163 query : function(selector, unique){
\r
2164 return Ext.DomQuery.select(selector, this.dom);
\r
2168 child : function(selector, returnDom){
\r
2169 var n = Ext.DomQuery.selectNode(selector, this.dom);
\r
2170 return returnDom ? n : Ext.get(n);
\r
2174 down : function(selector, returnDom){
\r
2175 var n = Ext.DomQuery.selectNode(" > " + selector, this.dom);
\r
2176 return returnDom ? n : Ext.get(n);
\r
2180 initDD : function(group, config, overrides){
\r
2181 var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);
\r
2182 return Ext.apply(dd, overrides);
\r
2186 initDDProxy : function(group, config, overrides){
\r
2187 var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);
\r
2188 return Ext.apply(dd, overrides);
\r
2192 initDDTarget : function(group, config, overrides){
\r
2193 var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);
\r
2194 return Ext.apply(dd, overrides);
\r
2198 setVisible : function(visible, animate){
\r
2199 if(!animate || !A){
\r
2200 if(this.visibilityMode == El.DISPLAY){
\r
2201 this.setDisplayed(visible);
\r
2203 this.fixDisplay();
\r
2204 this.dom.style.visibility = visible ? "visible" : "hidden";
\r
2208 var dom = this.dom;
\r
2209 var visMode = this.visibilityMode;
\r
2211 this.setOpacity(.01);
\r
2212 this.setVisible(true);
\r
2214 this.anim({opacity: { to: (visible?1:0) }},
\r
2215 this.preanim(arguments, 1),
\r
2216 null, .35, 'easeIn', function(){
\r
2218 if(visMode == El.DISPLAY){
\r
2219 dom.style.display = "none";
\r
2221 dom.style.visibility = "hidden";
\r
2223 Ext.get(dom).setOpacity(1);
\r
2231 isDisplayed : function() {
\r
2232 return this.getStyle("display") != "none";
\r
2236 toggle : function(animate){
\r
2237 this.setVisible(!this.isVisible(), this.preanim(arguments, 0));
\r
2242 setDisplayed : function(value) {
\r
2243 if(typeof value == "boolean"){
\r
2244 value = value ? this.originalDisplay : "none";
\r
2246 this.setStyle("display", value);
\r
2251 focus : function() {
\r
2259 blur : function() {
\r
2267 addClass : function(className){
\r
2268 if(className instanceof Array){
\r
2269 for(var i = 0, len = className.length; i < len; i++) {
\r
2270 this.addClass(className[i]);
\r
2273 if(className && !this.hasClass(className)){
\r
2274 this.dom.className = this.dom.className + " " + className;
\r
2281 radioClass : function(className){
\r
2282 var siblings = this.dom.parentNode.childNodes;
\r
2283 for(var i = 0; i < siblings.length; i++) {
\r
2284 var s = siblings[i];
\r
2285 if(s.nodeType == 1){
\r
2286 Ext.get(s).removeClass(className);
\r
2289 this.addClass(className);
\r
2294 removeClass : function(className){
\r
2295 if(!className || !this.dom.className){
\r
2298 if(className instanceof Array){
\r
2299 for(var i = 0, len = className.length; i < len; i++) {
\r
2300 this.removeClass(className[i]);
\r
2303 if(this.hasClass(className)){
\r
2304 var re = this.classReCache[className];
\r
2306 re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', "g");
\r
2307 this.classReCache[className] = re;
\r
2309 this.dom.className =
\r
2310 this.dom.className.replace(re, " ");
\r
2320 toggleClass : function(className){
\r
2321 if(this.hasClass(className)){
\r
2322 this.removeClass(className);
\r
2324 this.addClass(className);
\r
2330 hasClass : function(className){
\r
2331 return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;
\r
2335 replaceClass : function(oldClassName, newClassName){
\r
2336 this.removeClass(oldClassName);
\r
2337 this.addClass(newClassName);
\r
2342 getStyles : function(){
\r
2343 var a = arguments, len = a.length, r = {};
\r
2344 for(var i = 0; i < len; i++){
\r
2345 r[a[i]] = this.getStyle(a[i]);
\r
2351 getStyle : function(){
\r
2352 return view && view.getComputedStyle ?
\r
2354 var el = this.dom, v, cs, camel;
\r
2355 if(prop == 'float'){
\r
2356 prop = "cssFloat";
\r
2358 if(v = el.style[prop]){
\r
2361 if(cs = view.getComputedStyle(el, "")){
\r
2362 if(!(camel = propCache[prop])){
\r
2363 camel = propCache[prop] = prop.replace(camelRe, camelFn);
\r
2370 var el = this.dom, v, cs, camel;
\r
2371 if(prop == 'opacity'){
\r
2372 if(typeof el.style.filter == 'string'){
\r
2373 var m = el.style.filter.match(/alpha\(opacity=(.*)\)/i);
\r
2375 var fv = parseFloat(m[1]);
\r
2377 return fv ? fv / 100 : 0;
\r
2382 }else if(prop == 'float'){
\r
2383 prop = "styleFloat";
\r
2385 if(!(camel = propCache[prop])){
\r
2386 camel = propCache[prop] = prop.replace(camelRe, camelFn);
\r
2388 if(v = el.style[camel]){
\r
2391 if(cs = el.currentStyle){
\r
2399 setStyle : function(prop, value){
\r
2400 if(typeof prop == "string"){
\r
2402 if(!(camel = propCache[prop])){
\r
2403 camel = propCache[prop] = prop.replace(camelRe, camelFn);
\r
2405 if(camel == 'opacity') {
\r
2406 this.setOpacity(value);
\r
2408 this.dom.style[camel] = value;
\r
2411 for(var style in prop){
\r
2412 if(typeof prop[style] != "function"){
\r
2413 this.setStyle(style, prop[style]);
\r
2421 applyStyles : function(style){
\r
2422 Ext.DomHelper.applyStyles(this.dom, style);
\r
2427 getX : function(){
\r
2428 return D.getX(this.dom);
\r
2432 getY : function(){
\r
2433 return D.getY(this.dom);
\r
2437 getXY : function(){
\r
2438 return D.getXY(this.dom);
\r
2442 setX : function(x, animate){
\r
2443 if(!animate || !A){
\r
2444 D.setX(this.dom, x);
\r
2446 this.setXY([x, this.getY()], this.preanim(arguments, 1));
\r
2452 setY : function(y, animate){
\r
2453 if(!animate || !A){
\r
2454 D.setY(this.dom, y);
\r
2456 this.setXY([this.getX(), y], this.preanim(arguments, 1));
\r
2462 setLeft : function(left){
\r
2463 this.setStyle("left", this.addUnits(left));
\r
2468 setTop : function(top){
\r
2469 this.setStyle("top", this.addUnits(top));
\r
2474 setRight : function(right){
\r
2475 this.setStyle("right", this.addUnits(right));
\r
2480 setBottom : function(bottom){
\r
2481 this.setStyle("bottom", this.addUnits(bottom));
\r
2486 setXY : function(pos, animate){
\r
2487 if(!animate || !A){
\r
2488 D.setXY(this.dom, pos);
\r
2490 this.anim({points: {to: pos}}, this.preanim(arguments, 1), 'motion');
\r
2496 setLocation : function(x, y, animate){
\r
2497 this.setXY([x, y], this.preanim(arguments, 2));
\r
2502 moveTo : function(x, y, animate){
\r
2503 this.setXY([x, y], this.preanim(arguments, 2));
\r
2508 getRegion : function(){
\r
2509 return D.getRegion(this.dom);
\r
2513 getHeight : function(contentHeight){
\r
2514 var h = this.dom.offsetHeight || 0;
\r
2515 return contentHeight !== true ? h : h-this.getBorderWidth("tb")-this.getPadding("tb");
\r
2519 getWidth : function(contentWidth){
\r
2520 var w = this.dom.offsetWidth || 0;
\r
2521 return contentWidth !== true ? w : w-this.getBorderWidth("lr")-this.getPadding("lr");
\r
2525 getComputedHeight : function(){
\r
2526 var h = Math.max(this.dom.offsetHeight, this.dom.clientHeight);
\r
2528 h = parseInt(this.getStyle('height'), 10) || 0;
\r
2529 if(!this.isBorderBox()){
\r
2530 h += this.getFrameWidth('tb');
\r
2537 getComputedWidth : function(){
\r
2538 var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth);
\r
2540 w = parseInt(this.getStyle('width'), 10) || 0;
\r
2541 if(!this.isBorderBox()){
\r
2542 w += this.getFrameWidth('lr');
\r
2549 getSize : function(contentSize){
\r
2550 return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};
\r
2554 getViewSize : function(){
\r
2555 var d = this.dom, doc = document, aw = 0, ah = 0;
\r
2556 if(d == doc || d == doc.body){
\r
2557 return {width : D.getViewWidth(), height: D.getViewHeight()};
\r
2560 width : d.clientWidth,
\r
2561 height: d.clientHeight
\r
2567 getValue : function(asNumber){
\r
2568 return asNumber ? parseInt(this.dom.value, 10) : this.dom.value;
\r
2572 adjustWidth : function(width){
\r
2573 if(typeof width == "number"){
\r
2574 if(this.autoBoxAdjust && !this.isBorderBox()){
\r
2575 width -= (this.getBorderWidth("lr") + this.getPadding("lr"));
\r
2585 adjustHeight : function(height){
\r
2586 if(typeof height == "number"){
\r
2587 if(this.autoBoxAdjust && !this.isBorderBox()){
\r
2588 height -= (this.getBorderWidth("tb") + this.getPadding("tb"));
\r
2598 setWidth : function(width, animate){
\r
2599 width = this.adjustWidth(width);
\r
2600 if(!animate || !A){
\r
2601 this.dom.style.width = this.addUnits(width);
\r
2603 this.anim({width: {to: width}}, this.preanim(arguments, 1));
\r
2609 setHeight : function(height, animate){
\r
2610 height = this.adjustHeight(height);
\r
2611 if(!animate || !A){
\r
2612 this.dom.style.height = this.addUnits(height);
\r
2614 this.anim({height: {to: height}}, this.preanim(arguments, 1));
\r
2620 setSize : function(width, height, animate){
\r
2621 if(typeof width == "object"){
2622 height = width.height; width = width.width;
\r
2624 width = this.adjustWidth(width); height = this.adjustHeight(height);
\r
2625 if(!animate || !A){
\r
2626 this.dom.style.width = this.addUnits(width);
\r
2627 this.dom.style.height = this.addUnits(height);
\r
2629 this.anim({width: {to: width}, height: {to: height}}, this.preanim(arguments, 2));
\r
2635 setBounds : function(x, y, width, height, animate){
\r
2636 if(!animate || !A){
\r
2637 this.setSize(width, height);
\r
2638 this.setLocation(x, y);
\r
2640 width = this.adjustWidth(width); height = this.adjustHeight(height);
\r
2641 this.anim({points: {to: [x, y]}, width: {to: width}, height: {to: height}},
\r
2642 this.preanim(arguments, 4), 'motion');
\r
2648 setRegion : function(region, animate){
\r
2649 this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.preanim(arguments, 1));
\r
2654 addListener : function(eventName, fn, scope, options){
\r
2655 Ext.EventManager.on(this.dom, eventName, fn, scope || this, options);
\r
2659 removeListener : function(eventName, fn){
\r
2660 Ext.EventManager.removeListener(this.dom, eventName, fn);
\r
2665 removeAllListeners : function(){
\r
2666 E.purgeElement(this.dom);
\r
2670 relayEvent : function(eventName, observable){
\r
2671 this.on(eventName, function(e){
\r
2672 observable.fireEvent(eventName, e);
\r
2677 setOpacity : function(opacity, animate){
\r
2678 if(!animate || !A){
\r
2679 var s = this.dom.style;
\r
2682 s.filter = (s.filter || '').replace(/alpha\([^\)]*\)/gi,"") +
\r
2683 (opacity == 1 ? "" : "alpha(opacity=" + opacity * 100 + ")");
\r
2685 s.opacity = opacity;
\r
2688 this.anim({opacity: {to: opacity}}, this.preanim(arguments, 1), null, .35, 'easeIn');
\r
2694 getLeft : function(local){
\r
2696 return this.getX();
\r
2698 return parseInt(this.getStyle("left"), 10) || 0;
\r
2703 getRight : function(local){
\r
2705 return this.getX() + this.getWidth();
\r
2707 return (this.getLeft(true) + this.getWidth()) || 0;
\r
2712 getTop : function(local) {
\r
2714 return this.getY();
\r
2716 return parseInt(this.getStyle("top"), 10) || 0;
\r
2721 getBottom : function(local){
\r
2723 return this.getY() + this.getHeight();
\r
2725 return (this.getTop(true) + this.getHeight()) || 0;
\r
2730 position : function(pos, zIndex, x, y){
\r
2732 if(this.getStyle('position') == 'static'){
\r
2733 this.setStyle('position', 'relative');
\r
2736 this.setStyle("position", pos);
\r
2739 this.setStyle("z-index", zIndex);
\r
2741 if(x !== undefined && y !== undefined){
\r
2742 this.setXY([x, y]);
\r
2743 }else if(x !== undefined){
\r
2745 }else if(y !== undefined){
\r
2751 clearPositioning : function(value){
\r
2752 value = value ||'';
\r
2759 "position" : "static"
\r
2765 getPositioning : function(){
\r
2766 var l = this.getStyle("left");
\r
2767 var t = this.getStyle("top");
\r
2769 "position" : this.getStyle("position"),
\r
2771 "right" : l ? "" : this.getStyle("right"),
\r
2773 "bottom" : t ? "" : this.getStyle("bottom"),
\r
2774 "z-index" : this.getStyle("z-index")
\r
2779 getBorderWidth : function(side){
\r
2780 return this.addStyles(side, El.borders);
\r
2784 getPadding : function(side){
\r
2785 return this.addStyles(side, El.paddings);
\r
2789 setPositioning : function(pc){
\r
2790 this.applyStyles(pc);
\r
2791 if(pc.right == "auto"){
\r
2792 this.dom.style.right = "";
\r
2794 if(pc.bottom == "auto"){
\r
2795 this.dom.style.bottom = "";
\r
2801 fixDisplay : function(){
\r
2802 if(this.getStyle("display") == "none"){
\r
2803 this.setStyle("visibility", "hidden");
\r
2804 this.setStyle("display", this.originalDisplay);
2805 if(this.getStyle("display") == "none"){
2806 this.setStyle("display", "block");
\r
2812 setLeftTop : function(left, top){
\r
2813 this.dom.style.left = this.addUnits(left);
\r
2814 this.dom.style.top = this.addUnits(top);
\r
2819 move : function(direction, distance, animate){
\r
2820 var xy = this.getXY();
\r
2821 direction = direction.toLowerCase();
\r
2822 switch(direction){
\r
2825 this.moveTo(xy[0]-distance, xy[1], this.preanim(arguments, 2));
\r
2829 this.moveTo(xy[0]+distance, xy[1], this.preanim(arguments, 2));
\r
2834 this.moveTo(xy[0], xy[1]-distance, this.preanim(arguments, 2));
\r
2839 this.moveTo(xy[0], xy[1]+distance, this.preanim(arguments, 2));
\r
2846 clip : function(){
\r
2847 if(!this.isClipped){
\r
2848 this.isClipped = true;
\r
2849 this.originalClip = {
\r
2850 "o": this.getStyle("overflow"),
\r
2851 "x": this.getStyle("overflow-x"),
\r
2852 "y": this.getStyle("overflow-y")
\r
2854 this.setStyle("overflow", "hidden");
\r
2855 this.setStyle("overflow-x", "hidden");
\r
2856 this.setStyle("overflow-y", "hidden");
\r
2862 unclip : function(){
\r
2863 if(this.isClipped){
\r
2864 this.isClipped = false;
\r
2865 var o = this.originalClip;
\r
2866 if(o.o){this.setStyle("overflow", o.o);}
\r
2867 if(o.x){this.setStyle("overflow-x", o.x);}
\r
2868 if(o.y){this.setStyle("overflow-y", o.y);}
\r
2875 getAnchorXY : function(anchor, local, s){
\r
2879 var w, h, vp = false;
\r
2882 if(d == document.body || d == document){
\r
2884 w = D.getViewWidth(); h = D.getViewHeight();
\r
2886 w = this.getWidth(); h = this.getHeight();
\r
2889 w = s.width; h = s.height;
\r
2891 var x = 0, y = 0, r = Math.round;
\r
2892 switch((anchor || "tl").toLowerCase()){
\r
2930 if(local === true){
\r
2934 var sc = this.getScroll();
\r
2935 return [x + sc.left, y + sc.top];
\r
2938 var o = this.getXY();
\r
2939 return [x+o[0], y+o[1]];
\r
2943 getAlignToXY : function(el, p, o){
\r
2947 throw "Element.alignTo with an element that doesn't exist";
\r
2950 var p1 = "", p2 = "";
\r
2955 }else if(p == "?"){
\r
2957 }else if(p.indexOf("-") == -1){
\r
2960 p = p.toLowerCase();
\r
2961 var m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/);
\r
2963 throw "Element.alignTo with an invalid alignment " + p;
\r
2965 p1 = m[1]; p2 = m[2]; c = !!m[3];
\r
2969 var a1 = this.getAnchorXY(p1, true);
\r
2970 var a2 = el.getAnchorXY(p2, false);
\r
2971 var x = a2[0] - a1[0] + o[0];
\r
2972 var y = a2[1] - a1[1] + o[1];
\r
2975 var w = this.getWidth(), h = this.getHeight(), r = el.getRegion();
\r
2977 var dw = D.getViewWidth()-5, dh = D.getViewHeight()-5;
\r
2982 var p1y = p1.charAt(0), p1x = p1.charAt(p1.length-1);
\r
2983 var p2y = p2.charAt(0), p2x = p2.charAt(p2.length-1);
\r
2984 var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t"));
\r
2985 var swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r"));
\r
2987 var doc = document;
\r
2988 var scrollX = (doc.documentElement.scrollLeft || doc.body.scrollLeft || 0)+5;
\r
2989 var scrollY = (doc.documentElement.scrollTop || doc.body.scrollTop || 0)+5;
\r
2991 if((x+w) > dw + scrollX){
\r
2992 x = swapX ? r.left-w : dw+scrollX-w;
\r
2995 x = swapX ? r.right : scrollX;
\r
2997 if((y+h) > dh + scrollY){
\r
2998 y = swapY ? r.top-h : dh+scrollY-h;
\r
3001 y = swapY ? r.bottom : scrollY;
\r
3008 getConstrainToXY : function(){
\r
3009 var os = {top:0, left:0, bottom:0, right: 0};
\r
3011 return function(el, local, offsets, proposedXY){
\r
3013 offsets = offsets ? Ext.applyIf(offsets, os) : os;
\r
3015 var vw, vh, vx = 0, vy = 0;
\r
3016 if(el.dom == document.body || el.dom == document){
\r
3017 vw = Ext.lib.Dom.getViewWidth();
\r
3018 vh = Ext.lib.Dom.getViewHeight();
\r
3020 vw = el.dom.clientWidth;
\r
3021 vh = el.dom.clientHeight;
\r
3023 var vxy = el.getXY();
\r
3029 var s = el.getScroll();
\r
3031 vx += offsets.left + s.left;
\r
3032 vy += offsets.top + s.top;
\r
3034 vw -= offsets.right;
\r
3035 vh -= offsets.bottom;
\r
3040 var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]);
\r
3041 var x = xy[0], y = xy[1];
\r
3042 var w = this.dom.offsetWidth, h = this.dom.offsetHeight;
\r
3045 var moved = false;
\r
3065 return moved ? [x, y] : false;
\r
3070 adjustForConstraints : function(xy, parent, offsets){
\r
3071 return this.getConstrainToXY(parent || document, false, offsets, xy) || xy;
\r
3075 alignTo : function(element, position, offsets, animate){
\r
3076 var xy = this.getAlignToXY(element, position, offsets);
\r
3077 this.setXY(xy, this.preanim(arguments, 3));
\r
3082 anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){
\r
3083 var action = function(){
\r
3084 this.alignTo(el, alignment, offsets, animate);
\r
3085 Ext.callback(callback, this);
\r
3087 Ext.EventManager.onWindowResize(action, this);
\r
3088 var tm = typeof monitorScroll;
\r
3089 if(tm != 'undefined'){
\r
3090 Ext.EventManager.on(window, 'scroll', action, this,
\r
3091 {buffer: tm == 'number' ? monitorScroll : 50});
\r
3097 clearOpacity : function(){
\r
3098 if (window.ActiveXObject) {
\r
3099 if(typeof this.dom.style.filter == 'string' && (/alpha/i).test(this.dom.style.filter)){
\r
3100 this.dom.style.filter = "";
\r
3103 this.dom.style.opacity = "";
\r
3104 this.dom.style["-moz-opacity"] = "";
\r
3105 this.dom.style["-khtml-opacity"] = "";
\r
3111 hide : function(animate){
\r
3112 this.setVisible(false, this.preanim(arguments, 0));
\r
3117 show : function(animate){
\r
3118 this.setVisible(true, this.preanim(arguments, 0));
\r
3123 addUnits : function(size){
\r
3124 return Ext.Element.addUnits(size, this.defaultUnit);
\r
3128 beginMeasure : function(){
\r
3129 var el = this.dom;
\r
3130 if(el.offsetWidth || el.offsetHeight){
\r
3134 var p = this.dom, b = document.body;
3135 while((!el.offsetWidth && !el.offsetHeight) && p && p.tagName && p != b){
\r
3136 var pe = Ext.get(p);
\r
3137 if(pe.getStyle('display') == 'none'){
\r
3138 changed.push({el: p, visibility: pe.getStyle("visibility")});
\r
3139 p.style.visibility = "hidden";
\r
3140 p.style.display = "block";
\r
3144 this._measureChanged = changed;
\r
3150 endMeasure : function(){
\r
3151 var changed = this._measureChanged;
\r
3153 for(var i = 0, len = changed.length; i < len; i++) {
\r
3154 var r = changed[i];
\r
3155 r.el.style.visibility = r.visibility;
\r
3156 r.el.style.display = "none";
\r
3158 this._measureChanged = null;
\r
3164 update : function(html, loadScripts, callback){
\r
3165 if(typeof html == "undefined"){
\r
3168 if(loadScripts !== true){
\r
3169 this.dom.innerHTML = html;
\r
3170 if(typeof callback == "function"){
\r
3175 var id = Ext.id();
\r
3176 var dom = this.dom;
\r
3178 html += '<span id="' + id + '"></span>';
\r
3180 E.onAvailable(id, function(){
\r
3181 var hd = document.getElementsByTagName("head")[0];
\r
3182 var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;
\r
3183 var srcRe = /\ssrc=([\'\"])(.*?)\1/i;
\r
3184 var typeRe = /\stype=([\'\"])(.*?)\1/i;
\r
3187 while(match = re.exec(html)){
\r
3188 var attrs = match[1];
\r
3189 var srcMatch = attrs ? attrs.match(srcRe) : false;
\r
3190 if(srcMatch && srcMatch[2]){
\r
3191 var s = document.createElement("script");
\r
3192 s.src = srcMatch[2];
\r
3193 var typeMatch = attrs.match(typeRe);
\r
3194 if(typeMatch && typeMatch[2]){
\r
3195 s.type = typeMatch[2];
\r
3197 hd.appendChild(s);
\r
3198 }else if(match[2] && match[2].length > 0){
\r
3199 if(window.execScript) {
\r
3200 window.execScript(match[2]);
\r
3202 window.eval(match[2]);
\r
3206 var el = document.getElementById(id);
\r
3207 if(el){el.parentNode.removeChild(el);}
\r
3208 if(typeof callback == "function"){
\r
3212 dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");
\r
3217 load : function(){
\r
3218 var um = this.getUpdateManager();
\r
3219 um.update.apply(um, arguments);
\r
3224 getUpdateManager : function(){
\r
3225 if(!this.updateManager){
\r
3226 this.updateManager = new Ext.UpdateManager(this);
\r
3228 return this.updateManager;
\r
3232 unselectable : function(){
\r
3233 this.dom.unselectable = "on";
\r
3234 this.swallowEvent("selectstart", true);
\r
3235 this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");
\r
3236 this.addClass("x-unselectable");
\r
3241 getCenterXY : function(){
\r
3242 return this.getAlignToXY(document, 'c-c');
\r
3246 center : function(centerIn){
\r
3247 this.alignTo(centerIn || document, 'c-c');
\r
3252 isBorderBox : function(){
\r
3253 return noBoxAdjust[this.dom.tagName.toLowerCase()] || Ext.isBorderBox;
\r
3257 getBox : function(contentBox, local){
\r
3260 xy = this.getXY();
\r
3262 var left = parseInt(this.getStyle("left"), 10) || 0;
\r
3263 var top = parseInt(this.getStyle("top"), 10) || 0;
\r
3266 var el = this.dom, w = el.offsetWidth, h = el.offsetHeight, bx;
\r
3268 bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h};
\r
3270 var l = this.getBorderWidth("l")+this.getPadding("l");
\r
3271 var r = this.getBorderWidth("r")+this.getPadding("r");
\r
3272 var t = this.getBorderWidth("t")+this.getPadding("t");
\r
3273 var b = this.getBorderWidth("b")+this.getPadding("b");
\r
3274 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
3276 bx.right = bx.x + bx.width;
\r
3277 bx.bottom = bx.y + bx.height;
\r
3282 getFrameWidth : function(sides, onlyContentBox){
\r
3283 return onlyContentBox && Ext.isBorderBox ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));
\r
3287 setBox : function(box, adjust, animate){
\r
3288 var w = box.width, h = box.height;
\r
3289 if((adjust && !this.autoBoxAdjust) && !this.isBorderBox()){
\r
3290 w -= (this.getBorderWidth("lr") + this.getPadding("lr"));
\r
3291 h -= (this.getBorderWidth("tb") + this.getPadding("tb"));
\r
3293 this.setBounds(box.x, box.y, w, h, this.preanim(arguments, 2));
\r
3298 repaint : function(){
\r
3299 var dom = this.dom;
\r
3300 this.addClass("x-repaint");
\r
3301 setTimeout(function(){
\r
3302 Ext.get(dom).removeClass("x-repaint");
\r
3308 getMargins : function(side){
\r
3311 top: parseInt(this.getStyle("margin-top"), 10) || 0,
\r
3312 left: parseInt(this.getStyle("margin-left"), 10) || 0,
\r
3313 bottom: parseInt(this.getStyle("margin-bottom"), 10) || 0,
\r
3314 right: parseInt(this.getStyle("margin-right"), 10) || 0
\r
3317 return this.addStyles(side, El.margins);
\r
3322 addStyles : function(sides, styles){
\r
3323 var val = 0, v, w;
\r
3324 for(var i = 0, len = sides.length; i < len; i++){
\r
3325 v = this.getStyle(styles[sides.charAt(i)]);
\r
3327 w = parseInt(v, 10);
\r
3328 if(w){ val += w; }
\r
3335 createProxy : function(config, renderTo, matchBox){
\r
3337 renderTo = Ext.getDom(renderTo);
\r
3339 renderTo = document.body;
\r
3341 config = typeof config == "object" ?
\r
3342 config : {tag : "div", cls: config};
\r
3343 var proxy = Ext.DomHelper.append(renderTo, config, true);
\r
3345 proxy.setBox(this.getBox());
\r
3351 mask : function(msg, msgCls){
\r
3352 if(this.getStyle("position") == "static"){
\r
3353 this.setStyle("position", "relative");
\r
3356 this._mask = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask"}, true);
\r
3358 this.addClass("x-masked");
\r
3359 this._mask.setDisplayed(true);
\r
3360 if(typeof msg == 'string'){
\r
3361 if(!this._maskMsg){
\r
3362 this._maskMsg = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask-msg", cn:{tag:'div'}}, true);
\r
3364 var mm = this._maskMsg;
\r
3365 mm.dom.className = msgCls ? "ext-el-mask-msg " + msgCls : "ext-el-mask-msg";
\r
3366 mm.dom.firstChild.innerHTML = msg;
\r
3367 mm.setDisplayed(true);
\r
3370 if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && this.getStyle('height') == 'auto'){
3371 this._mask.setHeight(this.getHeight());
\r
3373 return this._mask;
\r
3377 unmask : function(removeEl){
\r
3379 if(removeEl === true){
\r
3380 this._mask.remove();
\r
3381 delete this._mask;
\r
3382 if(this._maskMsg){
\r
3383 this._maskMsg.remove();
\r
3384 delete this._maskMsg;
\r
3387 this._mask.setDisplayed(false);
\r
3388 if(this._maskMsg){
\r
3389 this._maskMsg.setDisplayed(false);
\r
3393 this.removeClass("x-masked");
\r
3397 isMasked : function(){
\r
3398 return this._mask && this._mask.isVisible();
\r
3402 createShim : function(){
\r
3403 var el = document.createElement('iframe');
\r
3404 el.frameBorder = 'no';
\r
3405 el.className = 'ext-shim';
\r
3406 if(Ext.isIE && Ext.isSecure){
\r
3407 el.src = Ext.SSL_SECURE_URL;
\r
3409 var shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
\r
3410 shim.autoBoxAdjust = false;
\r
3415 remove : function(){
\r
3416 if(this.dom.parentNode){
\r
3417 this.dom.parentNode.removeChild(this.dom);
\r
3419 delete El.cache[this.dom.id];
\r
3423 addClassOnOver : function(className, preventFlicker){
\r
3424 this.on("mouseover", function(){
\r
3425 Ext.fly(this, '_internal').addClass(className);
\r
3427 var removeFn = function(e){
\r
3428 if(preventFlicker !== true || !e.within(this, true)){
\r
3429 Ext.fly(this, '_internal').removeClass(className);
\r
3432 this.on("mouseout", removeFn, this.dom);
\r
3437 addClassOnFocus : function(className){
\r
3438 this.on("focus", function(){
\r
3439 Ext.fly(this, '_internal').addClass(className);
\r
3441 this.on("blur", function(){
\r
3442 Ext.fly(this, '_internal').removeClass(className);
\r
3447 addClassOnClick : function(className){
\r
3448 var dom = this.dom;
\r
3449 this.on("mousedown", function(){
\r
3450 Ext.fly(dom, '_internal').addClass(className);
\r
3451 var d = Ext.get(document);
\r
3452 var fn = function(){
\r
3453 Ext.fly(dom, '_internal').removeClass(className);
\r
3454 d.removeListener("mouseup", fn);
\r
3456 d.on("mouseup", fn);
\r
3462 swallowEvent : function(eventName, preventDefault){
\r
3463 var fn = function(e){
\r
3464 e.stopPropagation();
\r
3465 if(preventDefault){
\r
3466 e.preventDefault();
\r
3469 if(eventName instanceof Array){
\r
3470 for(var i = 0, len = eventName.length; i < len; i++){
\r
3471 this.on(eventName[i], fn);
\r
3475 this.on(eventName, fn);
\r
3480 fitToParentDelegate : Ext.emptyFn,
3483 fitToParent : function(monitorResize, targetParent) {
\r
3484 Ext.EventManager.removeResizeListener(this.fitToParentDelegate);
3485 this.fitToParentDelegate = Ext.emptyFn;
3486 if (monitorResize === true && !this.dom.parentNode) {
3489 var p = Ext.get(targetParent || this.dom.parentNode);
\r
3490 this.setSize(p.getComputedWidth() - p.getFrameWidth('lr'), p.getComputedHeight() - p.getFrameWidth('tb'));
\r
3491 if (monitorResize === true) {
\r
3492 this.fitToParentDelegate = this.fitToParent.createDelegate(this, [true, targetParent]);
\r
3493 Ext.EventManager.onWindowResize(this.fitToParentDelegate);
\r
3499 getNextSibling : function(){
\r
3500 var n = this.dom.nextSibling;
\r
3501 while(n && n.nodeType != 1){
\r
3502 n = n.nextSibling;
\r
3508 getPrevSibling : function(){
\r
3509 var n = this.dom.previousSibling;
\r
3510 while(n && n.nodeType != 1){
\r
3511 n = n.previousSibling;
\r
3518 appendChild: function(el){
\r
3520 el.appendTo(this);
\r
3525 createChild: function(config, insertBefore, returnDom){
\r
3526 config = config || {tag:'div'};
\r
3528 return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
\r
3530 return Ext.DomHelper[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config, returnDom !== true);
\r
3534 appendTo: function(el){
\r
3535 el = Ext.getDom(el);
\r
3536 el.appendChild(this.dom);
\r
3541 insertBefore: function(el){
\r
3542 el = Ext.getDom(el);
\r
3543 el.parentNode.insertBefore(this.dom, el);
\r
3548 insertAfter: function(el){
\r
3549 el = Ext.getDom(el);
\r
3550 el.parentNode.insertBefore(this.dom, el.nextSibling);
\r
3555 insertFirst: function(el, returnDom){
\r
3557 if(typeof el == 'object' && !el.nodeType){
3558 return this.createChild(el, this.dom.firstChild, returnDom);
\r
3560 el = Ext.getDom(el);
\r
3561 this.dom.insertBefore(el, this.dom.firstChild);
\r
3562 return !returnDom ? Ext.get(el) : el;
\r
3567 insertSibling: function(el, where, returnDom){
\r
3568 where = where ? where.toLowerCase() : 'before';
\r
3570 var rt, refNode = where == 'before' ? this.dom : this.dom.nextSibling;
\r
3572 if(typeof el == 'object' && !el.nodeType){
3573 if(where == 'after' && !this.dom.nextSibling){
\r
3574 rt = Ext.DomHelper.append(this.dom.parentNode, el, !returnDom);
\r
3576 rt = Ext.DomHelper[where == 'after' ? 'insertAfter' : 'insertBefore'](this.dom, el, !returnDom);
\r
3580 rt = this.dom.parentNode.insertBefore(Ext.getDom(el),
\r
3581 where == 'before' ? this.dom : this.dom.nextSibling);
\r
3590 wrap: function(config, returnDom){
\r
3592 config = {tag: "div"};
\r
3594 var newEl = Ext.DomHelper.insertBefore(this.dom, config, !returnDom);
\r
3595 newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);
\r
3600 replace: function(el){
\r
3602 this.insertBefore(el);
\r
3608 insertHtml : function(where, html, returnEl){
\r
3609 var el = Ext.DomHelper.insertHtml(where, this.dom, html);
\r
3610 return returnEl ? Ext.get(el) : el;
\r
3614 set : function(o, useSet){
\r
3615 var el = this.dom;
\r
3616 useSet = typeof useSet == 'undefined' ? (el.setAttribute ? true : false) : useSet;
\r
3617 for(var attr in o){
\r
3618 if(attr == "style" || typeof o[attr] == "function") continue;
\r
3620 el.className = o["cls"];
\r
3622 if(useSet) el.setAttribute(attr, o[attr]);
\r
3623 else el[attr] = o[attr];
\r
3627 Ext.DomHelper.applyStyles(el, o.style);
\r
3633 addKeyListener : function(key, fn, scope){
\r
3635 if(typeof key != "object" || key instanceof Array){
\r
3644 shift : key.shift,
\r
3651 return new Ext.KeyMap(this, config);
\r
3655 addKeyMap : function(config){
\r
3656 return new Ext.KeyMap(this, config);
\r
3660 isScrollable : function(){
\r
3661 var dom = this.dom;
\r
3662 return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
\r
3667 scrollTo : function(side, value, animate){
\r
3668 var prop = side.toLowerCase() == "left" ? "scrollLeft" : "scrollTop";
\r
3669 if(!animate || !A){
\r
3670 this.dom[prop] = value;
\r
3672 var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [this.dom.scrollLeft, value];
\r
3673 this.anim({scroll: {"to": to}}, this.preanim(arguments, 2), 'scroll');
\r
3679 scroll : function(direction, distance, animate){
\r
3680 if(!this.isScrollable()){
\r
3683 var el = this.dom;
\r
3684 var l = el.scrollLeft, t = el.scrollTop;
\r
3685 var w = el.scrollWidth, h = el.scrollHeight;
\r
3686 var cw = el.clientWidth, ch = el.clientHeight;
\r
3687 direction = direction.toLowerCase();
\r
3688 var scrolled = false;
\r
3689 var a = this.preanim(arguments, 2);
\r
3690 switch(direction){
\r
3694 var v = Math.min(l + distance, w-cw);
\r
3695 this.scrollTo("left", v, a);
\r
3702 var v = Math.max(l - distance, 0);
\r
3703 this.scrollTo("left", v, a);
\r
3711 var v = Math.max(t - distance, 0);
\r
3712 this.scrollTo("top", v, a);
\r
3720 var v = Math.min(t + distance, h-ch);
\r
3721 this.scrollTo("top", v, a);
\r
3730 translatePoints : function(x, y){
\r
3731 if(typeof x == 'object' || x instanceof Array){
\r
3732 y = x[1]; x = x[0];
\r
3734 var p = this.getStyle('position');
\r
3735 var o = this.getXY();
\r
3737 var l = parseInt(this.getStyle('left'), 10);
\r
3738 var t = parseInt(this.getStyle('top'), 10);
\r
3741 l = (p == "relative") ? 0 : this.dom.offsetLeft;
\r
3744 t = (p == "relative") ? 0 : this.dom.offsetTop;
\r
3747 return {left: (x - o[0] + l), top: (y - o[1] + t)};
\r
3751 getScroll : function(){
\r
3752 var d = this.dom, doc = document;
\r
3753 if(d == doc || d == doc.body){
\r
3754 var l = window.pageXOffset || doc.documentElement.scrollLeft || doc.body.scrollLeft || 0;
\r
3755 var t = window.pageYOffset || doc.documentElement.scrollTop || doc.body.scrollTop || 0;
\r
3756 return {left: l, top: t};
\r
3758 return {left: d.scrollLeft, top: d.scrollTop};
\r
3763 getColor : function(attr, defaultValue, prefix){
\r
3764 var v = this.getStyle(attr);
\r
3765 if(!v || v == "transparent" || v == "inherit") {
\r
3766 return defaultValue;
\r
3768 var color = typeof prefix == "undefined" ? "#" : prefix;
\r
3769 if(v.substr(0, 4) == "rgb("){
\r
3770 var rvs = v.slice(4, v.length -1).split(",");
\r
3771 for(var i = 0; i < 3; i++){
\r
3772 var h = parseInt(rvs[i]).toString(16);
\r
3779 if(v.substr(0, 1) == "#"){
\r
3780 if(v.length == 4) {
\r
3781 for(var i = 1; i < 4; i++){
\r
3782 var c = v.charAt(i);
\r
3785 }else if(v.length == 7){
\r
3786 color += v.substr(1);
\r
3790 return(color.length > 5 ? color.toLowerCase() : defaultValue);
\r
3794 boxWrap : function(cls){
\r
3795 cls = cls || 'x-box';
\r
3796 var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+El.boxMarkup+'</div>', cls)));
\r
3797 el.child('.'+cls+'-mc').dom.appendChild(this.dom);
\r
3802 getAttributeNS : Ext.isIE ? function(ns, name){
\r
3804 var type = typeof d[ns+":"+name];
\r
3805 if(type != 'undefined' && type != 'unknown'){
\r
3806 return d[ns+":"+name];
\r
3809 } : function(ns, name){
\r
3811 return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name];
\r
3815 var ep = El.prototype;
\r
3818 ep.on = ep.addListener;
\r
3820 ep.mon = ep.addListener;
\r
3823 ep.un = ep.removeListener;
\r
3826 ep.autoBoxAdjust = true;
\r
3829 El.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;
\r
3832 El.addUnits = function(v, defaultUnit){
\r
3833 if(v === "" || v == "auto"){
\r
3836 if(v === undefined){
\r
3839 if(typeof v == "number" || !El.unitPattern.test(v)){
\r
3840 return v + (defaultUnit || 'px');
\r
3846 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
3848 El.VISIBILITY = 1;
\r
3852 El.borders = {l: "border-left-width", r: "border-right-width", t: "border-top-width", b: "border-bottom-width"};
\r
3853 El.paddings = {l: "padding-left", r: "padding-right", t: "padding-top", b: "padding-bottom"};
\r
3854 El.margins = {l: "margin-left", r: "margin-right", t: "margin-top", b: "margin-bottom"};
\r
3864 El.get = function(el){
\r
3866 if(!el){ return null; }
\r
3867 if(typeof el == "string"){
3868 if(!(elm = document.getElementById(el))){
\r
3871 if(ex = El.cache[el]){
\r
3874 ex = El.cache[el] = new El(elm);
\r
3877 }else if(el.tagName){
3878 if(!(id = el.id)){
\r
3881 if(ex = El.cache[id]){
\r
3884 ex = El.cache[id] = new El(el);
\r
3887 }else if(el instanceof El){
\r
3889 el.dom = document.getElementById(el.id) || el.dom;
3891 El.cache[el.id] = el;
3894 }else if(el.isComposite){
\r
3896 }else if(el instanceof Array){
\r
3897 return El.select(el);
\r
3898 }else if(el == document){
\r
3901 var f = function(){};
\r
3902 f.prototype = El.prototype;
\r
3904 docEl.dom = document;
\r
3912 El.uncache = function(el){
\r
3913 for(var i = 0, a = arguments, len = a.length; i < len; i++) {
\r
3915 delete El.cache[a[i].id || a[i]];
\r
3923 El.garbageCollect = function(){
\r
3924 if(!Ext.enableGarbageCollector){
\r
3925 clearInterval(El.collectorThread);
\r
3928 for(var eid in El.cache){
\r
3929 var el = El.cache[eid], d = el.dom;
\r
3947 if(!d || !d.parentNode || (!d.offsetParent && !document.getElementById(eid))){
\r
3948 delete El.cache[eid];
\r
3949 if(d && Ext.enableListenerCollection){
\r
3950 E.purgeElement(d);
\r
3955 El.collectorThreadId = setInterval(El.garbageCollect, 30000);
\r
3959 El.Flyweight = function(dom){
\r
3962 El.Flyweight.prototype = El.prototype;
\r
3964 El._flyweights = {};
\r
3966 El.fly = function(el, named){
\r
3967 named = named || '_global';
\r
3968 el = Ext.getDom(el);
\r
3972 if(!El._flyweights[named]){
\r
3973 El._flyweights[named] = new El.Flyweight();
\r
3975 El._flyweights[named].dom = el;
\r
3976 return El._flyweights[named];
\r
3985 var noBoxAdjust = Ext.isStrict ? {
\r
3988 input:1, select:1, textarea:1
\r
3990 if(Ext.isIE || Ext.isGecko){
\r
3991 noBoxAdjust['button'] = 1;
\r
3995 Ext.EventManager.on(window, 'unload', function(){
\r
3997 delete El._flyweights;
\r
4001 Ext.enableFx = true;
4006 slideIn : function(anchor, o){
4007 var el = this.getFxEl();
4010 el.queueFx(o, function(){
4012 anchor = anchor || "t";
4016 var r = this.getFxRestore();
4017 var b = this.getBox();
4020 var wrap = this.fxWrap(r.pos, o, "hidden");
4022 var st = this.dom.style;
4023 st.visibility = "visible";
4024 st.position = "absolute";
4026 var after = function(){
4027 el.fxUnwrap(wrap, r.pos, o);
4029 st.height = r.height;
4032 var a, pt = {to: [b.x, b.y]}, bw = {to: b.width}, bh = {to: b.height};
4034 switch(anchor.toLowerCase()){
4036 wrap.setSize(b.width, 0);
4037 st.left = st.bottom = "0";
4041 wrap.setSize(0, b.height);
4042 st.right = st.top = "0";
4046 wrap.setSize(0, b.height);
4048 st.left = st.top = "0";
4049 a = {width: bw, points: pt};
4052 wrap.setSize(b.width, 0);
4053 wrap.setY(b.bottom);
4054 st.left = st.top = "0";
4055 a = {height: bh, points: pt};
4059 st.right = st.bottom = "0";
4060 a = {width: bw, height: bh};
4064 wrap.setY(b.y+b.height);
4065 st.right = st.top = "0";
4066 a = {width: bw, height: bh, points: pt};
4070 wrap.setXY([b.right, b.bottom]);
4071 st.left = st.top = "0";
4072 a = {width: bw, height: bh, points: pt};
4076 wrap.setX(b.x+b.width);
4077 st.left = st.bottom = "0";
4078 a = {width: bw, height: bh, points: pt};
4081 this.dom.style.visibility = "visible";
4084 arguments.callee.anim = wrap.fxanim(a,
4094 slideOut : function(anchor, o){
4095 var el = this.getFxEl();
4098 el.queueFx(o, function(){
4100 anchor = anchor || "t";
4102 var r = this.getFxRestore();
4104 var b = this.getBox();
4107 var wrap = this.fxWrap(r.pos, o, "visible");
4109 var st = this.dom.style;
4110 st.visibility = "visible";
4111 st.position = "absolute";
4115 var after = function(){
4117 el.setDisplayed(false);
4122 el.fxUnwrap(wrap, r.pos, o);
4125 st.height = r.height;
4130 var a, zero = {to: 0};
4131 switch(anchor.toLowerCase()){
4133 st.left = st.bottom = "0";
4137 st.right = st.top = "0";
4141 st.left = st.top = "0";
4142 a = {width: zero, points: {to:[b.right, b.y]}};
4145 st.left = st.top = "0";
4146 a = {height: zero, points: {to:[b.x, b.bottom]}};
4149 st.right = st.bottom = "0";
4150 a = {width: zero, height: zero};
4153 st.right = st.top = "0";
4154 a = {width: zero, height: zero, points: {to:[b.x, b.bottom]}};
4157 st.left = st.top = "0";
4158 a = {width: zero, height: zero, points: {to:[b.x+b.width, b.bottom]}};
4161 st.left = st.bottom = "0";
4162 a = {width: zero, height: zero, points: {to:[b.right, b.y]}};
4166 arguments.callee.anim = wrap.fxanim(a,
4177 var el = this.getFxEl();
4180 el.queueFx(o, function(){
4181 this.clearOpacity();
4184 var r = this.getFxRestore();
4185 var st = this.dom.style;
4187 var after = function(){
4189 el.setDisplayed(false);
4196 el.setPositioning(r.pos);
4198 st.height = r.height;
4203 var width = this.getWidth();
4204 var height = this.getHeight();
4206 arguments.callee.anim = this.fxanim({
4207 width : {to: this.adjustWidth(width * 2)},
4208 height : {to: this.adjustHeight(height * 2)},
4209 points : {by: [-(width * .5), -(height * .5)]},
4211 fontSize: {to:200, unit: "%"}
4222 switchOff : function(o){
4223 var el = this.getFxEl();
4226 el.queueFx(o, function(){
4227 this.clearOpacity();
4230 var r = this.getFxRestore();
4231 var st = this.dom.style;
4233 var after = function(){
4235 el.setDisplayed(false);
4241 el.setPositioning(r.pos);
4243 st.height = r.height;
4248 this.fxanim({opacity:{to:0.3}}, null, null, .1, null, function(){
4249 this.clearOpacity();
4253 points:{by:[0, this.getHeight() * .5]}
4254 }, o, 'motion', 0.3, 'easeIn', after);
4255 }).defer(100, this);
4262 highlight : function(color, o){
4263 var el = this.getFxEl();
4266 el.queueFx(o, function(){
4267 color = color || "ffff9c";
4268 attr = o.attr || "backgroundColor";
4270 this.clearOpacity();
4273 var origColor = this.getColor(attr);
4274 var restoreColor = this.dom.style[attr];
4275 endColor = (o.endColor || origColor) || "ffffff";
4277 var after = function(){
4278 el.dom.style[attr] = restoreColor;
4283 a[attr] = {from: color, to: endColor};
4284 arguments.callee.anim = this.fxanim(a,
4294 frame : function(color, count, o){
4295 var el = this.getFxEl();
4298 el.queueFx(o, function(){
4299 color = color || "#C3DAF9";
4300 if(color.length == 6){
4301 color = "#" + color;
4304 duration = o.duration || 1;
4307 var b = this.getBox();
4308 var animFn = function(){
4309 var proxy = this.createProxy({
4313 position:"absolute",
4314 "z-index":"35000", border:"0px solid " + color
4317 var scale = Ext.isBorderBox ? 2 : 1;
4319 top:{from:b.y, to:b.y - 20},
4320 left:{from:b.x, to:b.x - 20},
4321 borderWidth:{from:0, to:10},
4322 opacity:{from:1, to:0},
4323 height:{from:b.height, to:(b.height + (20*scale))},
4324 width:{from:b.width, to:(b.width + (20*scale))}
4325 }, duration, function(){
4329 animFn.defer((duration/2)*1000, this);
4340 pause : function(seconds){
4341 var el = this.getFxEl();
4344 el.queueFx(o, function(){
4345 setTimeout(function(){
4353 fadeIn : function(o){
4354 var el = this.getFxEl();
4356 el.queueFx(o, function(){
4359 this.dom.style.visibility = 'visible';
4360 var to = o.endOpacity || 1;
4361 arguments.callee.anim = this.fxanim({opacity:{to:to}},
4362 o, null, .5, "easeOut", function(){
4364 this.clearOpacity();
4373 fadeOut : function(o){
4374 var el = this.getFxEl();
4376 el.queueFx(o, function(){
4377 arguments.callee.anim = this.fxanim({opacity:{to:o.endOpacity || 0}},
4378 o, null, .5, "easeOut", function(){
4379 if(this.visibilityMode == Ext.Element.DISPLAY || o.useDisplay){
4380 this.dom.style.display = "none";
4382 this.dom.style.visibility = "hidden";
4384 this.clearOpacity();
4392 scale : function(w, h, o){
4393 this.shift(Ext.apply({}, o, {
4401 shift : function(o){
4402 var el = this.getFxEl();
4404 el.queueFx(o, function(){
4405 var a = {}, w = o.width, h = o.height, x = o.x, y = o.y, op = o.opacity;
4406 if(w !== undefined){
4407 a.width = {to: this.adjustWidth(w)};
4409 if(h !== undefined){
4410 a.height = {to: this.adjustHeight(h)};
4412 if(x !== undefined || y !== undefined){
4414 x !== undefined ? x : this.getX(),
4415 y !== undefined ? y : this.getY()
4418 if(op !== undefined){
4419 a.opacity = {to: op};
4421 if(o.xy !== undefined){
4422 a.points = {to: o.xy};
4424 arguments.callee.anim = this.fxanim(a,
4425 o, 'motion', .35, "easeOut", function(){
4433 ghost : function(anchor, o){
4434 var el = this.getFxEl();
4437 el.queueFx(o, function(){
4438 anchor = anchor || "b";
4440 var r = this.getFxRestore();
4441 var w = this.getWidth(),
4442 h = this.getHeight();
4444 var st = this.dom.style;
4446 var after = function(){
4448 el.setDisplayed(false);
4454 el.setPositioning(r.pos);
4456 st.height = r.height;
4461 var a = {opacity: {to: 0}, points: {}}, pt = a.points;
4462 switch(anchor.toLowerCase()){
4489 arguments.callee.anim = this.fxanim(a,
4499 syncFx : function(){
4500 this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
4509 sequenceFx : function(){
4510 this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
4519 nextFx : function(){
4520 var ef = this.fxQueue[0];
4527 hasActiveFx : function(){
4528 return this.fxQueue && this.fxQueue[0];
4532 stopFx : function(){
4533 if(this.hasActiveFx()){
4534 var cur = this.fxQueue[0];
4535 if(cur && cur.anim && cur.anim.isAnimated()){
4536 this.fxQueue = [cur]; cur.anim.stop(true);
4543 beforeFx : function(o){
4544 if(this.hasActiveFx() && !o.concurrent){
4555 hasFxBlock : function(){
4556 var q = this.fxQueue;
4557 return q && q[0] && q[0].block;
4561 queueFx : function(o, fn){
4565 if(!this.hasFxBlock()){
4566 Ext.applyIf(o, this.fxDefaults);
4568 var run = this.beforeFx(o);
4570 this.fxQueue.push(fn);
4582 fxWrap : function(pos, o, vis){
4584 if(!o.wrap || !(wrap = Ext.get(o.wrap))){
4587 wrapXY = this.getXY();
4589 var div = document.createElement("div");
4590 div.style.visibility = vis;
4591 wrap = Ext.get(this.dom.parentNode.insertBefore(div, this.dom));
4592 wrap.setPositioning(pos);
4593 if(wrap.getStyle("position") == "static"){
4594 wrap.position("relative");
4596 this.clearPositioning('auto');
4598 wrap.dom.appendChild(this.dom);
4607 fxUnwrap : function(wrap, pos, o){
4608 this.clearPositioning();
4609 this.setPositioning(pos);
4611 wrap.dom.parentNode.insertBefore(this.dom, wrap.dom);
4617 getFxRestore : function(){
4618 var st = this.dom.style;
4619 return {pos: this.getPositioning(), width: st.width, height : st.height};
4623 afterFx : function(o){
4625 this.applyStyles(o.afterStyle);
4628 this.addClass(o.afterCls);
4630 if(o.remove === true){
4633 Ext.callback(o.callback, o.scope, [this]);
4635 this.fxQueue.shift();
4641 getFxEl : function(){ return Ext.get(this.dom);
4645 fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){
4646 animType = animType || 'run';
4648 var anim = Ext.lib.Anim[animType](
4650 (opt.duration || defaultDur) || .35,
4651 (opt.easing || defaultEase) || 'easeOut',
4653 Ext.callback(cb, this);
4662 Ext.Fx.resize = Ext.Fx.scale;
4664 Ext.apply(Ext.Element.prototype, Ext.Fx);
4667 Ext.CompositeElement = function(els){
\r
4668 this.elements = [];
\r
4669 this.addElements(els);
\r
4671 Ext.CompositeElement.prototype = {
\r
4672 isComposite: true,
\r
4673 addElements : function(els){
\r
4674 if(!els) return this;
\r
4675 if(typeof els == "string"){
\r
4676 els = Ext.Element.selectorFunction(els);
\r
4678 var yels = this.elements;
\r
4679 var index = yels.length-1;
\r
4680 for(var i = 0, len = els.length; i < len; i++) {
\r
4681 yels[++index] = Ext.get(els[i]);
\r
4687 fill : function(els){
\r
4688 this.elements = [];
\r
4694 filter : function(selector){
\r
4696 this.each(function(el){
\r
4697 if(el.is(selector)){
\r
4698 els[els.length] = el.dom;
\r
4705 invoke : function(fn, args){
\r
4706 var els = this.elements;
\r
4707 for(var i = 0, len = els.length; i < len; i++) {
\r
4708 Ext.Element.prototype[fn].apply(els[i], args);
\r
4713 add : function(els){
\r
4714 if(typeof els == "string"){
\r
4715 this.addElements(Ext.Element.selectorFunction(els));
\r
4716 }else if(els.length !== undefined){
\r
4717 this.addElements(els);
\r
4719 this.addElements([els]);
\r
4724 each : function(fn, scope){
\r
4725 var els = this.elements;
\r
4726 for(var i = 0, len = els.length; i < len; i++){
\r
4727 if(fn.call(scope || els[i], els[i], this, i) === false) {
\r
4735 item : function(index){
\r
4736 return this.elements[index] || null;
\r
4740 first : function(){
\r
4741 return this.item(0);
\r
4745 last : function(){
\r
4746 return this.item(this.elements.length-1);
\r
4750 getCount : function(){
\r
4751 return this.elements.length;
\r
4755 contains : function(el){
\r
4756 return this.indexOf(el) !== -1;
\r
4760 indexOf : function(el){
\r
4761 return this.elements.indexOf(Ext.get(el));
\r
4766 removeElement : function(el, removeDom){
\r
4767 if(el instanceof Array){
\r
4768 for(var i = 0, len = el.length; i < len; i++){
\r
4769 this.removeElement(el[i]);
\r
4773 var index = typeof el == 'number' ? el : this.indexOf(el);
\r
4776 var d = this.elements[index];
\r
4780 d.parentNode.removeChild(d);
\r
4783 this.elements.splice(index, 1);
\r
4789 replaceElement : function(el, replacement, domReplace){
\r
4790 var index = typeof el == 'number' ? el : this.indexOf(el);
\r
4793 this.elements[index].replaceWith(replacement);
\r
4795 this.elements.splice(index, 1, Ext.get(replacement))
\r
4802 clear : function(){
\r
4803 this.elements = [];
\r
4807 Ext.CompositeElement.createCall = function(proto, fnName){
\r
4808 if(!proto[fnName]){
\r
4809 proto[fnName] = function(){
\r
4810 return this.invoke(fnName, arguments);
\r
4814 for(var fnName in Ext.Element.prototype){
\r
4815 if(typeof Ext.Element.prototype[fnName] == "function"){
\r
4816 Ext.CompositeElement.createCall(Ext.CompositeElement.prototype, fnName);
\r
4822 Ext.CompositeElementLite = function(els){
\r
4823 Ext.CompositeElementLite.superclass.constructor.call(this, els);
\r
4824 this.el = new Ext.Element.Flyweight();
\r
4826 Ext.extend(Ext.CompositeElementLite, Ext.CompositeElement, {
\r
4827 addElements : function(els){
\r
4829 if(els instanceof Array){
\r
4830 this.elements = this.elements.concat(els);
\r
4832 var yels = this.elements;
\r
4833 var index = yels.length-1;
\r
4834 for(var i = 0, len = els.length; i < len; i++) {
\r
4835 yels[++index] = els[i];
\r
4841 invoke : function(fn, args){
\r
4842 var els = this.elements;
\r
4844 for(var i = 0, len = els.length; i < len; i++) {
\r
4846 Ext.Element.prototype[fn].apply(el, args);
\r
4851 item : function(index){
\r
4852 if(!this.elements[index]){
\r
4855 this.el.dom = this.elements[index];
\r
4860 addListener : function(eventName, handler, scope, opt){
\r
4861 var els = this.elements;
\r
4862 for(var i = 0, len = els.length; i < len; i++) {
\r
4863 Ext.EventManager.on(els[i], eventName, handler, scope || els[i], opt);
\r
4869 each : function(fn, scope){
\r
4870 var els = this.elements;
\r
4872 for(var i = 0, len = els.length; i < len; i++){
\r
4874 if(fn.call(scope || el, el, this, i) === false){
\r
4881 indexOf : function(el){
\r
4882 return this.elements.indexOf(Ext.getDom(el));
\r
4885 replaceElement : function(el, replacement, domReplace){
\r
4886 var index = typeof el == 'number' ? el : this.indexOf(el);
\r
4888 replacement = Ext.getDom(replacement);
\r
4890 var d = this.elements[index];
\r
4891 d.parentNode.insertBefore(replacement, d);
\r
4892 d.parentNode.removeChild(d);
\r
4894 this.elements.splice(index, 1, replacement);
\r
4899 Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;
\r
4901 Ext.Element.selectorFunction = Ext.DomQuery.select;
\r
4904 Ext.Element.select = function(selector, unique, root){
\r
4906 if(typeof selector == "string"){
\r
4907 els = Ext.Element.selectorFunction(selector, root);
\r
4908 }else if(selector.length !== undefined){
\r
4911 throw "Invalid selector";
\r
4913 if(unique === true){
\r
4914 return new Ext.CompositeElement(els);
\r
4916 return new Ext.CompositeElementLite(els);
\r
4920 Ext.select = Ext.Element.select;
4922 Ext.data.Connection = function(config){
\r
4923 Ext.apply(this, config);
\r
4926 "beforerequest" : true,
\r
4928 "requestcomplete" : true,
\r
4930 "requestexception" : true
\r
4932 Ext.data.Connection.superclass.constructor.call(this);
\r
4935 Ext.extend(Ext.data.Connection, Ext.util.Observable, {
\r
4946 disableCaching: true,
\r
4949 request : function(o){
\r
4950 if(this.fireEvent("beforerequest", this, o) !== false){
\r
4953 if(typeof p == "function"){
\r
4954 p = p.call(o.scope||window, o);
\r
4956 if(typeof p == "object"){
\r
4957 p = Ext.urlEncode(o.params);
\r
4959 if(this.extraParams){
\r
4960 var extras = Ext.urlEncode(this.extraParams);
\r
4961 p = p ? (p + '&' + extras) : extras;
\r
4964 var url = o.url || this.url;
\r
4965 if(typeof url == 'function'){
\r
4966 url = url.call(o.scope||window, o);
\r
4970 var form = Ext.getDom(o.form);
\r
4971 url = url || form.action;
\r
4973 var enctype = form.getAttribute("enctype");
\r
4974 if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){
\r
4975 return this.doFormUpload(o, p, url);
\r
4977 var f = Ext.lib.Ajax.serializeForm(form);
\r
4978 p = p ? (p + '&' + f) : f;
\r
4981 var hs = o.headers;
\r
4982 if(this.defaultHeaders){
\r
4983 hs = Ext.apply(hs || {}, this.defaultHeaders);
\r
4990 success: this.handleResponse,
\r
4991 failure: this.handleFailure,
\r
4993 argument: {options: o},
\r
4994 timeout : this.timeout
\r
4997 var method = o.method||this.method||(p ? "POST" : "GET");
\r
4999 if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){
\r
5000 url += (url.indexOf('?') != -1 ? '&' : '?') + '_dc=' + (new Date().getTime());
\r
5003 if(typeof o.autoAbort == 'boolean'){
5007 }else if(this.autoAbort !== false){
\r
5011 if((method == 'GET' && p) || o.xmlData){
\r
5012 url += (url.indexOf('?') != -1 ? '&' : '?') + p;
\r
5015 this.transId = Ext.lib.Ajax.request(method, url, cb, p, o);
\r
5016 return this.transId;
\r
5018 Ext.callback(o.callback, o.scope, [o, null, null]);
\r
5024 isLoading : function(transId){
\r
5026 return Ext.lib.Ajax.isCallInProgress(transId);
\r
5028 return this.transId ? true : false;
\r
5033 abort : function(transId){
\r
5034 if(transId || this.isLoading()){
\r
5035 Ext.lib.Ajax.abort(transId || this.transId);
\r
5040 handleResponse : function(response){
\r
5041 this.transId = false;
\r
5042 var options = response.argument.options;
\r
5043 response.argument = options ? options.argument : null;
\r
5044 this.fireEvent("requestcomplete", this, response, options);
\r
5045 Ext.callback(options.success, options.scope, [response, options]);
\r
5046 Ext.callback(options.callback, options.scope, [options, true, response]);
\r
5050 handleFailure : function(response, e){
\r
5051 this.transId = false;
\r
5052 var options = response.argument.options;
\r
5053 response.argument = options ? options.argument : null;
\r
5054 this.fireEvent("requestexception", this, response, options, e);
\r
5055 Ext.callback(options.failure, options.scope, [response, options]);
\r
5056 Ext.callback(options.callback, options.scope, [options, false, response]);
\r
5060 doFormUpload : function(o, ps, url){
\r
5061 var id = Ext.id();
\r
5062 var frame = document.createElement('iframe');
\r
5065 frame.className = 'x-hidden';
\r
5067 frame.src = Ext.SSL_SECURE_URL;
\r
5069 document.body.appendChild(frame);
\r
5072 document.frames[id].name = id;
\r
5075 var form = Ext.getDom(o.form);
\r
5077 form.method = 'POST';
\r
5078 form.enctype = form.encoding = 'multipart/form-data';
\r
5080 form.action = url;
\r
5086 ps = Ext.urlDecode(ps, false);
\r
5088 if(ps.hasOwnProperty(k)){
\r
5089 hd = document.createElement('input');
\r
5090 hd.type = 'hidden';
\r
5093 form.appendChild(hd);
\r
5101 responseText : '',
\r
5102 responseXML : null
\r
5105 r.argument = o ? o.argument : null;
\r
5110 doc = frame.contentWindow.document;
\r
5112 doc = (frame.contentDocument || window.frames[id].document);
\r
5114 if(doc && doc.body){
\r
5115 r.responseText = doc.body.innerHTML;
\r
5117 if(doc && doc.XMLDocument){
\r
5118 r.responseXML = doc.XMLDocument;
\r
5120 r.responseXML = doc;
\r
5127 Ext.EventManager.removeListener(frame, 'load', cb, this);
\r
5129 this.fireEvent("requestcomplete", this, r, o);
\r
5130 Ext.callback(o.success, o.scope, [r, o]);
\r
5131 Ext.callback(o.callback, o.scope, [o, true, r]);
\r
5133 setTimeout(function(){document.body.removeChild(frame);}, 100);
\r
5136 Ext.EventManager.on(frame, 'load', cb, this);
\r
5140 for(var i = 0, len = hiddens.length; i < len; i++){
\r
5141 form.removeChild(hiddens[i]);
\r
5148 Ext.Ajax = new Ext.data.Connection({
\r
5167 autoAbort : false,
\r
5170 serializeForm : function(form){
\r
5171 return Ext.lib.Ajax.serializeForm(form);
\r
5175 Ext.UpdateManager = function(el, forceNew){
\r
5177 if(!forceNew && el.updateManager){
\r
5178 return el.updateManager;
\r
5183 this.defaultUrl = null;
\r
5187 "beforeupdate": true,
\r
5193 var d = Ext.UpdateManager.defaults;
\r
5195 this.sslBlankUrl = d.sslBlankUrl;
\r
5197 this.disableCaching = d.disableCaching;
\r
5199 this.indicatorText = d.indicatorText;
\r
5201 this.showLoadIndicator = d.showLoadIndicator;
\r
5203 this.timeout = d.timeout;
\r
5206 this.loadScripts = d.loadScripts;
\r
5209 this.transaction = null;
\r
5212 this.autoRefreshProcId = null;
\r
5214 this.refreshDelegate = this.refresh.createDelegate(this);
\r
5216 this.updateDelegate = this.update.createDelegate(this);
\r
5218 this.formUpdateDelegate = this.formUpdate.createDelegate(this);
\r
5220 this.successDelegate = this.processSuccess.createDelegate(this);
\r
5222 this.failureDelegate = this.processFailure.createDelegate(this);
\r
5224 if(!this.renderer){
\r
5226 this.renderer = new Ext.UpdateManager.BasicRenderer();
\r
5229 Ext.UpdateManager.superclass.constructor.call(this);
\r
5232 Ext.extend(Ext.UpdateManager, Ext.util.Observable, {
\r
5234 getEl : function(){
\r
5238 update : function(url, params, callback, discardUrl){
\r
5239 if(this.fireEvent("beforeupdate", this.el, url, params) !== false){
\r
5240 var method = this.method, cfg;
\r
5241 if(typeof url == "object"){
5244 params = params || cfg.params;
\r
5245 callback = callback || cfg.callback;
\r
5246 discardUrl = discardUrl || cfg.discardUrl;
\r
5247 if(callback && cfg.scope){
\r
5248 callback = callback.createDelegate(cfg.scope);
\r
5250 if(typeof cfg.method != "undefined"){method = cfg.method;};
\r
5251 if(typeof cfg.nocache != "undefined"){this.disableCaching = cfg.nocache;};
\r
5252 if(typeof cfg.text != "undefined"){this.indicatorText = '<div class="loading-indicator">'+cfg.text+"</div>";};
\r
5253 if(typeof cfg.scripts != "undefined"){this.loadScripts = cfg.scripts;};
\r
5254 if(typeof cfg.timeout != "undefined"){this.timeout = cfg.timeout;};
\r
5256 this.showLoading();
\r
5258 this.defaultUrl = url;
\r
5260 if(typeof url == "function"){
\r
5261 url = url.call(this);
\r
5264 method = method || (params ? "POST" : "GET");
\r
5265 if(method == "GET"){
\r
5266 url = this.prepareUrl(url);
\r
5269 var o = Ext.apply(cfg ||{}, {
\r
5272 success: this.successDelegate,
\r
5273 failure: this.failureDelegate,
\r
5274 callback: undefined,
\r
5275 timeout: (this.timeout*1000),
\r
5276 argument: {"url": url, "form": null, "callback": callback, "params": params}
\r
5279 this.transaction = Ext.Ajax.request(o);
\r
5284 formUpdate : function(form, url, reset, callback){
\r
5285 if(this.fireEvent("beforeupdate", this.el, form, url) !== false){
\r
5286 if(typeof url == "function"){
\r
5287 url = url.call(this);
\r
5289 form = Ext.getDom(form)
\r
5290 this.transaction = Ext.Ajax.request({
\r
5293 success: this.successDelegate,
\r
5294 failure: this.failureDelegate,
\r
5295 timeout: (this.timeout*1000),
\r
5296 argument: {"url": url, "form": form, "callback": callback, "reset": reset}
\r
5298 this.showLoading.defer(1, this);
\r
5303 refresh : function(callback){
\r
5304 if(this.defaultUrl == null){
\r
5307 this.update(this.defaultUrl, null, callback, true);
\r
5311 startAutoRefresh : function(interval, url, params, callback, refreshNow){
\r
5313 this.update(url || this.defaultUrl, params, callback, true);
\r
5315 if(this.autoRefreshProcId){
\r
5316 clearInterval(this.autoRefreshProcId);
\r
5318 this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000);
\r
5322 stopAutoRefresh : function(){
\r
5323 if(this.autoRefreshProcId){
\r
5324 clearInterval(this.autoRefreshProcId);
\r
5325 delete this.autoRefreshProcId;
\r
5329 isAutoRefreshing : function(){
\r
5330 return this.autoRefreshProcId ? true : false;
\r
5333 showLoading : function(){
\r
5334 if(this.showLoadIndicator){
\r
5335 this.el.update(this.indicatorText);
\r
5340 prepareUrl : function(url){
\r
5341 if(this.disableCaching){
\r
5342 var append = "_dc=" + (new Date().getTime());
\r
5343 if(url.indexOf("?") !== -1){
\r
5344 url += "&" + append;
\r
5346 url += "?" + append;
\r
5353 processSuccess : function(response){
\r
5354 this.transaction = null;
\r
5355 if(response.argument.form && response.argument.reset){
\r
5357 response.argument.form.reset();
\r
5360 if(this.loadScripts){
\r
5361 this.renderer.render(this.el, response, this,
\r
5362 this.updateComplete.createDelegate(this, [response]));
\r
5364 this.renderer.render(this.el, response, this);
\r
5365 this.updateComplete(response);
\r
5369 updateComplete : function(response){
\r
5370 this.fireEvent("update", this.el, response);
\r
5371 if(typeof response.argument.callback == "function"){
\r
5372 response.argument.callback(this.el, true, response);
\r
5377 processFailure : function(response){
\r
5378 this.transaction = null;
\r
5379 this.fireEvent("failure", this.el, response);
\r
5380 if(typeof response.argument.callback == "function"){
\r
5381 response.argument.callback(this.el, false, response);
\r
5386 setRenderer : function(renderer){
\r
5387 this.renderer = renderer;
\r
5390 getRenderer : function(){
\r
5391 return this.renderer;
\r
5395 setDefaultUrl : function(defaultUrl){
\r
5396 this.defaultUrl = defaultUrl;
\r
5400 abort : function(){
\r
5401 if(this.transaction){
\r
5402 Ext.Ajax.abort(this.transaction);
\r
5407 isUpdating : function(){
\r
5408 if(this.transaction){
\r
5409 return Ext.Ajax.isLoading(this.transaction);
\r
5416 Ext.UpdateManager.defaults = {
\r
5421 loadScripts : false,
\r
5424 sslBlankUrl : (Ext.SSL_SECURE_URL || "javascript:false"),
\r
5426 disableCaching : false,
\r
5428 showLoadIndicator : true,
\r
5430 indicatorText : '<div class="loading-indicator">Loading...</div>'
\r
5434 Ext.UpdateManager.updateElement = function(el, url, params, options){
\r
5435 var um = Ext.get(el, true).getUpdateManager();
\r
5436 Ext.apply(um, options);
\r
5437 um.update(url, params, options ? options.callback : null);
\r
5440 Ext.UpdateManager.update = Ext.UpdateManager.updateElement;
\r
5442 Ext.UpdateManager.BasicRenderer = function(){};
\r
5444 Ext.UpdateManager.BasicRenderer.prototype = {
\r
5446 render : function(el, response, updateManager, callback){
\r
5447 el.update(response.responseText, updateManager.loadScripts, callback);
\r
5452 Ext.util.DelayedTask = function(fn, scope, args){
5453 var id = null, d, t;
5455 var call = function(){
5456 var now = new Date().getTime();
5460 fn.apply(scope, args || []);
5464 this.delay = function(delay, newFn, newScope, newArgs){
5465 if(id && delay != d){
5469 t = new Date().getTime();
5471 scope = newScope || scope;
5472 args = newArgs || args;
5474 id = setInterval(call, d);
5479 this.cancel = function(){