3
* Copyright(c) 2006-2008, Ext JS, LLC.
6
* http://extjs.com/license
10
Ext.DomHelper = function(){
11
var tempTableEl = null;
12
var emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;
13
var tableRe = /^table|tbody|tr|td$/i;
15
var createHtml = function(o){
16
if(typeof o == 'string'){
21
for (var i = 0, l = o.length; i < l; i++) {
22
b += createHtml(o[i]);
31
if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || typeof o[attr] == "function") continue;
34
if(typeof s == "function"){
37
if(typeof s == "string"){
38
b += ' style="' + s + '"';
39
}else if(typeof s == "object"){
42
if(typeof s[key] != "function"){
43
b += key + ":" + s[key] + ";";
50
b += ' class="' + o["cls"] + '"';
51
}else if(attr == "htmlFor"){
52
b += ' for="' + o["htmlFor"] + '"';
54
b += " " + attr + '="' + o[attr] + '"';
58
if(emptyTags.test(o.tag)){
62
var cn = o.children || o.cn;
68
b += "</" + o.tag + ">";
74
var createDom = function(o, parentNode){
76
if (Ext.isArray(o)) { el = document.createDocumentFragment(); for(var i = 0, l = o.length; i < l; i++) {
79
} else if (typeof o == "string") { el = document.createTextNode(o);
81
el = document.createElement(o.tag||'div');
82
var useSet = !!el.setAttribute; for(var attr in o){
83
if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || attr == "style" || typeof o[attr] == "function") continue;
85
el.className = o["cls"];
87
if(useSet) el.setAttribute(attr, o[attr]);
88
else el[attr] = o[attr];
91
Ext.DomHelper.applyStyles(el, o.style);
92
var cn = o.children || o.cn;
96
el.innerHTML = o.html;
100
parentNode.appendChild(el);
105
var ieTable = function(depth, s, h, e){
106
tempTableEl.innerHTML = [s, h, e].join('');
107
var i = -1, el = tempTableEl;
122
var insertIntoTable = function(tag, where, el, html){
124
tempTableEl = document.createElement('div');
129
if(where == 'afterbegin' || where == 'beforeend'){ return;
131
if(where == 'beforebegin'){
135
before = el.nextSibling;
138
node = ieTable(4, trs, html, tre);
140
else if(tag == 'tr'){
141
if(where == 'beforebegin'){
144
node = ieTable(3, tbs, html, tbe);
145
} else if(where == 'afterend'){
146
before = el.nextSibling;
148
node = ieTable(3, tbs, html, tbe);
149
} else{ if(where == 'afterbegin'){
150
before = el.firstChild;
152
node = ieTable(4, trs, html, tre);
154
} else if(tag == 'tbody'){
155
if(where == 'beforebegin'){
158
node = ieTable(2, ts, html, te);
159
} else if(where == 'afterend'){
160
before = el.nextSibling;
162
node = ieTable(2, ts, html, te);
164
if(where == 'afterbegin'){
165
before = el.firstChild;
167
node = ieTable(3, tbs, html, tbe);
169
} else{ if(where == 'beforebegin' || where == 'afterend'){ return;
171
if(where == 'afterbegin'){
172
before = el.firstChild;
174
node = ieTable(2, ts, html, te);
176
el.insertBefore(node, before);
186
markup : function(o){
187
return createHtml(o);
191
applyStyles : function(el, styles){
194
if(typeof styles == "string"){
195
var re = /\s?([a-z\-]*)\:\s?([^;]*);?/gi;
197
while ((matches = re.exec(styles)) != null){
198
el.setStyle(matches[1], matches[2]);
200
}else if (typeof styles == "object"){
201
for (var style in styles){
202
el.setStyle(style, styles[style]);
204
}else if (typeof styles == "function"){
205
Ext.DomHelper.applyStyles(el, styles.call());
211
insertHtml : function(where, el, html){
212
where = where.toLowerCase();
213
if(el.insertAdjacentHTML){
214
if(tableRe.test(el.tagName)){
216
if(rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html)){
222
el.insertAdjacentHTML('BeforeBegin', html);
223
return el.previousSibling;
225
el.insertAdjacentHTML('AfterBegin', html);
226
return el.firstChild;
228
el.insertAdjacentHTML('BeforeEnd', html);
231
el.insertAdjacentHTML('AfterEnd', html);
232
return el.nextSibling;
234
throw 'Illegal insertion point -> "' + where + '"';
236
var range = el.ownerDocument.createRange();
240
range.setStartBefore(el);
241
frag = range.createContextualFragment(html);
242
el.parentNode.insertBefore(frag, el);
243
return el.previousSibling;
246
range.setStartBefore(el.firstChild);
247
frag = range.createContextualFragment(html);
248
el.insertBefore(frag, el.firstChild);
249
return el.firstChild;
252
return el.firstChild;
256
range.setStartAfter(el.lastChild);
257
frag = range.createContextualFragment(html);
258
el.appendChild(frag);
265
range.setStartAfter(el);
266
frag = range.createContextualFragment(html);
267
el.parentNode.insertBefore(frag, el.nextSibling);
268
return el.nextSibling;
270
throw 'Illegal insertion point -> "' + where + '"';
274
insertBefore : function(el, o, returnElement){
275
return this.doInsert(el, o, returnElement, "beforeBegin");
279
insertAfter : function(el, o, returnElement){
280
return this.doInsert(el, o, returnElement, "afterEnd", "nextSibling");
284
insertFirst : function(el, o, returnElement){
285
return this.doInsert(el, o, returnElement, "afterBegin", "firstChild");
288
doInsert : function(el, o, returnElement, pos, sibling){
292
newNode = createDom(o, null);
293
(sibling === "firstChild" ? el : el.parentNode).insertBefore(newNode, sibling ? el[sibling] : el);
295
var html = createHtml(o);
296
newNode = this.insertHtml(pos, el, html);
298
return returnElement ? Ext.get(newNode, true) : newNode;
302
append : function(el, o, returnElement){
306
newNode = createDom(o, null);
307
el.appendChild(newNode);
309
var html = createHtml(o);
310
newNode = this.insertHtml("beforeEnd", el, html);
312
return returnElement ? Ext.get(newNode, true) : newNode;
316
overwrite : function(el, o, returnElement){
318
el.innerHTML = createHtml(o);
319
return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
323
createTemplate : function(o){
324
var html = createHtml(o);
325
return new Ext.Template(html);
331
Ext.Template = function(html){
333
if(Ext.isArray(html)){
334
html = html.join("");
335
}else if(a.length > 1){
337
for(var i = 0, len = a.length; i < len; i++){
338
if(typeof a[i] == 'object'){
339
Ext.apply(this, a[i]);
341
buf[buf.length] = a[i];
352
Ext.Template.prototype = {
354
applyTemplate : function(values){
356
return this.compiled(values);
358
var useF = this.disableFormats !== true;
359
var fm = Ext.util.Format, tpl = this;
360
var fn = function(m, name, format, args){
362
if(format.substr(0, 5) == "this."){
363
return tpl.call(format.substr(5), values[name], values);
366
var re = /^\s*['"](.*)["']\s*$/;
367
args = args.split(',');
368
for(var i = 0, len = args.length; i < len; i++){
369
args[i] = args[i].replace(re, "$1");
371
args = [values[name]].concat(args);
373
args = [values[name]];
375
return fm[format].apply(fm, args);
378
return values[name] !== undefined ? values[name] : "";
381
return this.html.replace(this.re, fn);
385
set : function(html, compile){
387
this.compiled = null;
395
disableFormats : false,
398
re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
401
compile : function(){
402
var fm = Ext.util.Format;
403
var useF = this.disableFormats !== true;
404
var sep = Ext.isGecko ? "+" : ",";
405
var fn = function(m, name, format, args){
407
args = args ? ',' + args : "";
408
if(format.substr(0, 5) != "this."){
409
format = "fm." + format + '(';
411
format = 'this.call("'+ format.substr(5) + '", ';
415
args= ''; format = "(values['" + name + "'] == undefined ? '' : ";
417
return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";
421
body = "this.compiled = function(values){ return '" +
422
this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
425
body = ["this.compiled = function(values){ return ['"];
426
body.push(this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));
427
body.push("'].join('');};");
428
body = body.join('');
434
call : function(fnName, value, allValues){
435
return this[fnName](value, allValues);
439
insertFirst: function(el, values, returnElement){
440
return this.doInsert('afterBegin', el, values, returnElement);
444
insertBefore: function(el, values, returnElement){
445
return this.doInsert('beforeBegin', el, values, returnElement);
449
insertAfter : function(el, values, returnElement){
450
return this.doInsert('afterEnd', el, values, returnElement);
454
append : function(el, values, returnElement){
455
return this.doInsert('beforeEnd', el, values, returnElement);
458
doInsert : function(where, el, values, returnEl){
460
var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values));
461
return returnEl ? Ext.get(newNode, true) : newNode;
465
overwrite : function(el, values, returnElement){
467
el.innerHTML = this.applyTemplate(values);
468
return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
472
Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
474
Ext.DomHelper.Template = Ext.Template;
477
Ext.Template.from = function(el, config){
479
return new Ext.Template(el.value || el.innerHTML, config || '');
483
Ext.DomQuery = function(){
484
var cache = {}, simpleCache = {}, valueCache = {};
486
var trimRe = /^\s+|\s+$/g;
487
var tplRe = /\{(\d+)\}/g;
488
var modeRe = /^(\s?[\/>+~]\s?|\s|$)/;
489
var tagTokenRe = /^(#)?([\w-\*]+)/;
490
var nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/;
492
function child(p, index){
494
var n = p.firstChild;
507
while((n = n.nextSibling) && n.nodeType != 1);
512
while((n = n.previousSibling) && n.nodeType != 1);
516
function children(d){
517
var n = d.firstChild, ni = -1;
519
var nx = n.nextSibling;
520
if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
530
function byClassName(c, a, v){
534
var r = [], ri = -1, cn;
535
for(var i = 0, ci; ci = c[i]; i++){
536
if((' '+ci.className+' ').indexOf(v) != -1){
543
function attrValue(n, attr){
544
if(!n.tagName && typeof n.length != "undefined"){
553
if(attr == "class" || attr == "className"){
556
return n.getAttribute(attr) || n[attr];
560
function getNodes(ns, mode, tagName){
561
var result = [], ri = -1, cs;
565
tagName = tagName || "*";
566
if(typeof ns.getElementsByTagName != "undefined"){
570
for(var i = 0, ni; ni = ns[i]; i++){
571
cs = ni.getElementsByTagName(tagName);
572
for(var j = 0, ci; ci = cs[j]; j++){
576
}else if(mode == "/" || mode == ">"){
577
var utag = tagName.toUpperCase();
578
for(var i = 0, ni, cn; ni = ns[i]; i++){
579
cn = ni.children || ni.childNodes;
580
for(var j = 0, cj; cj = cn[j]; j++){
581
if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
586
}else if(mode == "+"){
587
var utag = tagName.toUpperCase();
588
for(var i = 0, n; n = ns[i]; i++){
589
while((n = n.nextSibling) && n.nodeType != 1);
590
if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
594
}else if(mode == "~"){
595
for(var i = 0, n; n = ns[i]; i++){
596
while((n = n.nextSibling) && (n.nodeType != 1 || (tagName == '*' || n.tagName.toLowerCase()!=tagName)));
605
function concat(a, b){
609
for(var i = 0, l = b.length; i < l; i++){
615
function byTag(cs, tagName){
616
if(cs.tagName || cs == document){
623
tagName = tagName.toLowerCase();
624
for(var i = 0, ci; ci = cs[i]; i++){
625
if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){
632
function byId(cs, attr, id){
633
if(cs.tagName || cs == document){
640
for(var i = 0,ci; ci = cs[i]; i++){
641
if(ci && ci.id == id){
649
function byAttribute(cs, attr, value, op, custom){
650
var r = [], ri = -1, st = custom=="{";
651
var f = Ext.DomQuery.operators[op];
652
for(var i = 0, ci; ci = cs[i]; i++){
655
a = Ext.DomQuery.getStyle(ci, attr);
657
else if(attr == "class" || attr == "className"){
659
}else if(attr == "for"){
661
}else if(attr == "href"){
662
a = ci.getAttribute("href", 2);
664
a = ci.getAttribute(attr);
666
if((f && f(a, value)) || (!f && a)){
673
function byPseudo(cs, name, value){
674
return Ext.DomQuery.pseudos[name](cs, value);
680
var isIE = window.ActiveXObject ? true : false;
684
eval("var batch = 30803;");
688
function nodupIEXml(cs){
690
cs[0].setAttribute("_nodup", d);
692
for(var i = 1, len = cs.length; i < len; i++){
694
if(!c.getAttribute("_nodup") != d){
695
c.setAttribute("_nodup", d);
699
for(var i = 0, len = cs.length; i < len; i++){
700
cs[i].removeAttribute("_nodup");
709
var len = cs.length, c, i, r = cs, cj, ri = -1;
710
if(!len || typeof cs.nodeType != "undefined" || len == 1){
713
if(isIE && typeof cs[0].selectSingleNode != "undefined"){
714
return nodupIEXml(cs);
718
for(i = 1; c = cs[i]; i++){
723
for(var j = 0; j < i; j++){
726
for(j = i+1; cj = cs[j]; j++){
738
function quickDiffIEXml(c1, c2){
740
for(var i = 0, len = c1.length; i < len; i++){
741
c1[i].setAttribute("_qdiff", d);
744
for(var i = 0, len = c2.length; i < len; i++){
745
if(c2[i].getAttribute("_qdiff") != d){
749
for(var i = 0, len = c1.length; i < len; i++){
750
c1[i].removeAttribute("_qdiff");
755
function quickDiff(c1, c2){
756
var len1 = c1.length;
760
if(isIE && c1[0].selectSingleNode){
761
return quickDiffIEXml(c1, c2);
764
for(var i = 0; i < len1; i++){
768
for(var i = 0, len = c2.length; i < len; i++){
769
if(c2[i]._qdiff != d){
776
function quickId(ns, mode, root, id){
778
var d = root.ownerDocument || root;
779
return d.getElementById(id);
781
ns = getNodes(ns, mode, "*");
782
return byId(ns, null, id);
786
getStyle : function(el, name){
787
return Ext.fly(el).getStyle(name);
790
compile : function(path, type){
791
type = type || "select";
793
var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];
794
var q = path, mode, lq;
795
var tk = Ext.DomQuery.matchers;
796
var tklen = tk.length;
800
var lmode = q.match(modeRe);
801
if(lmode && lmode[1]){
802
fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
803
q = q.replace(lmode[1], "");
806
while(path.substr(0, 1)=="/"){
807
path = path.substr(1);
812
var tm = q.match(tagTokenRe);
813
if(type == "select"){
816
fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");';
818
fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");';
820
q = q.replace(tm[0], "");
821
}else if(q.substr(0, 1) != '@'){
822
fn[fn.length] = 'n = getNodes(n, mode, "*");';
827
fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");';
829
fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");';
831
q = q.replace(tm[0], "");
834
while(!(mm = q.match(modeRe))){
836
for(var j = 0; j < tklen; j++){
838
var m = q.match(t.re);
840
fn[fn.length] = t.select.replace(tplRe, function(x, i){
843
q = q.replace(m[0], "");
850
throw 'Error parsing selector, parsing failed at "' + q + '"';
854
fn[fn.length] = 'mode="'+mm[1].replace(trimRe, "")+'";';
855
q = q.replace(mm[1], "");
858
fn[fn.length] = "return nodup(n);\n}";
864
select : function(path, root, type){
865
if(!root || root == document){
868
if(typeof root == "string"){
869
root = document.getElementById(root);
871
var paths = path.split(",");
873
for(var i = 0, len = paths.length; i < len; i++){
874
var p = paths[i].replace(trimRe, "");
876
cache[p] = Ext.DomQuery.compile(p);
878
throw p + " is not a valid selector";
881
var result = cache[p](root);
882
if(result && result != document){
883
results = results.concat(result);
886
if(paths.length > 1){
887
return nodup(results);
893
selectNode : function(path, root){
894
return Ext.DomQuery.select(path, root)[0];
898
selectValue : function(path, root, defaultValue){
899
path = path.replace(trimRe, "");
900
if(!valueCache[path]){
901
valueCache[path] = Ext.DomQuery.compile(path, "select");
903
var n = valueCache[path](root);
905
var v = (n && n.firstChild ? n.firstChild.nodeValue : null);
906
return ((v === null||v === undefined||v==='') ? defaultValue : v);
910
selectNumber : function(path, root, defaultValue){
911
var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
912
return parseFloat(v);
916
is : function(el, ss){
917
if(typeof el == "string"){
918
el = document.getElementById(el);
920
var isArray = Ext.isArray(el);
921
var result = Ext.DomQuery.filter(isArray ? el : [el], ss);
922
return isArray ? (result.length == el.length) : (result.length > 0);
926
filter : function(els, ss, nonMatches){
927
ss = ss.replace(trimRe, "");
928
if(!simpleCache[ss]){
929
simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
931
var result = simpleCache[ss](els);
932
return nonMatches ? quickDiff(result, els) : result;
938
select: 'n = byClassName(n, null, " {1} ");'
940
re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
941
select: 'n = byPseudo(n, "{1}", "{2}");'
943
re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
944
select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
947
select: 'n = byId(n, null, "{1}");'
950
select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
956
"=" : function(a, v){
959
"!=" : function(a, v){
962
"^=" : function(a, v){
963
return a && a.substr(0, v.length) == v;
965
"$=" : function(a, v){
966
return a && a.substr(a.length-v.length) == v;
968
"*=" : function(a, v){
969
return a && a.indexOf(v) !== -1;
971
"%=" : function(a, v){
974
"|=" : function(a, v){
975
return a && (a == v || a.substr(0, v.length+1) == v+'-');
977
"~=" : function(a, v){
978
return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
984
"first-child" : function(c){
985
var r = [], ri = -1, n;
986
for(var i = 0, ci; ci = n = c[i]; i++){
987
while((n = n.previousSibling) && n.nodeType != 1);
995
"last-child" : function(c){
996
var r = [], ri = -1, n;
997
for(var i = 0, ci; ci = n = c[i]; i++){
998
while((n = n.nextSibling) && n.nodeType != 1);
1006
"nth-child" : function(c, a) {
1007
var r = [], ri = -1;
1008
var m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a);
1009
var f = (m[1] || 1) - 0, l = m[2] - 0;
1010
for(var i = 0, n; n = c[i]; i++){
1011
var pn = n.parentNode;
1012
if (batch != pn._batch) {
1014
for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
1015
if(cn.nodeType == 1){
1022
if (l == 0 || n.nodeIndex == l){
1025
} else if ((n.nodeIndex + l) % f == 0){
1033
"only-child" : function(c){
1034
var r = [], ri = -1;;
1035
for(var i = 0, ci; ci = c[i]; i++){
1036
if(!prev(ci) && !next(ci)){
1043
"empty" : function(c){
1044
var r = [], ri = -1;
1045
for(var i = 0, ci; ci = c[i]; i++){
1046
var cns = ci.childNodes, j = 0, cn, empty = true;
1049
if(cn.nodeType == 1 || cn.nodeType == 3){
1061
"contains" : function(c, v){
1062
var r = [], ri = -1;
1063
for(var i = 0, ci; ci = c[i]; i++){
1064
if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
1071
"nodeValue" : function(c, v){
1072
var r = [], ri = -1;
1073
for(var i = 0, ci; ci = c[i]; i++){
1074
if(ci.firstChild && ci.firstChild.nodeValue == v){
1081
"checked" : function(c){
1082
var r = [], ri = -1;
1083
for(var i = 0, ci; ci = c[i]; i++){
1084
if(ci.checked == true){
1091
"not" : function(c, ss){
1092
return Ext.DomQuery.filter(c, ss, true);
1095
"any" : function(c, selectors){
1096
var ss = selectors.split('|');
1097
var r = [], ri = -1, s;
1098
for(var i = 0, ci; ci = c[i]; i++){
1099
for(var j = 0; s = ss[j]; j++){
1100
if(Ext.DomQuery.is(ci, s)){
1109
"odd" : function(c){
1110
return this["nth-child"](c, "odd");
1113
"even" : function(c){
1114
return this["nth-child"](c, "even");
1117
"nth" : function(c, a){
1118
return c[a-1] || [];
1121
"first" : function(c){
1125
"last" : function(c){
1126
return c[c.length-1] || [];
1129
"has" : function(c, ss){
1130
var s = Ext.DomQuery.select;
1131
var r = [], ri = -1;
1132
for(var i = 0, ci; ci = c[i]; i++){
1133
if(s(ss, ci).length > 0){
1140
"next" : function(c, ss){
1141
var is = Ext.DomQuery.is;
1142
var r = [], ri = -1;
1143
for(var i = 0, ci; ci = c[i]; i++){
1152
"prev" : function(c, ss){
1153
var is = Ext.DomQuery.is;
1154
var r = [], ri = -1;
1155
for(var i = 0, ci; ci = c[i]; i++){
1168
Ext.query = Ext.DomQuery.select;
1171
Ext.util.Observable = function(){
1174
this.on(this.listeners);
1175
delete this.listeners;
1178
Ext.util.Observable.prototype = {
1180
fireEvent : function(){
1181
if(this.eventsSuspended !== true){
1182
var ce = this.events[arguments[0].toLowerCase()];
1183
if(typeof ce == "object"){
1184
return ce.fire.apply(ce, Array.prototype.slice.call(arguments, 1));
1190
filterOptRe : /^(?:scope|delay|buffer|single)$/,
1193
addListener : function(eventName, fn, scope, o){
1194
if(typeof eventName == "object"){
1197
if(this.filterOptRe.test(e)){
1200
if(typeof o[e] == "function"){
1201
this.addListener(e, o[e], o.scope, o);
1203
this.addListener(e, o[e].fn, o[e].scope, o[e]);
1208
o = (!o || typeof o == "boolean") ? {} : o;
1209
eventName = eventName.toLowerCase();
1210
var ce = this.events[eventName] || true;
1211
if(typeof ce == "boolean"){
1212
ce = new Ext.util.Event(this, eventName);
1213
this.events[eventName] = ce;
1215
ce.addListener(fn, scope, o);
1219
removeListener : function(eventName, fn, scope){
1220
var ce = this.events[eventName.toLowerCase()];
1221
if(typeof ce == "object"){
1222
ce.removeListener(fn, scope);
1227
purgeListeners : function(){
1228
for(var evt in this.events){
1229
if(typeof this.events[evt] == "object"){
1230
this.events[evt].clearListeners();
1236
relayEvents : function(o, events){
1237
var createHandler = function(ename){
1239
return this.fireEvent.apply(this, Ext.combine(ename, Array.prototype.slice.call(arguments, 0)));
1242
for(var i = 0, len = events.length; i < len; i++){
1243
var ename = events[i];
1244
if(!this.events[ename]){ this.events[ename] = true; };
1245
o.on(ename, createHandler(ename), this);
1250
addEvents : function(o){
1254
if(typeof o == 'string'){
1255
for(var i = 0, a = arguments, v; v = a[i]; i++){
1256
if(!this.events[a[i]]){
1257
this.events[a[i]] = true;
1261
Ext.applyIf(this.events, o);
1266
hasListener : function(eventName){
1267
var e = this.events[eventName];
1268
return typeof e == "object" && e.listeners.length > 0;
1272
suspendEvents : function(){
1273
this.eventsSuspended = true;
1277
resumeEvents : function(){
1278
this.eventsSuspended = false;
1281
getMethodEvent : function(method){
1282
if(!this.methodEvents){
1283
this.methodEvents = {};
1285
var e = this.methodEvents[method];
1288
this.methodEvents[method] = e;
1290
e.originalFn = this[method];
1291
e.methodName = method;
1296
var returnValue, v, cancel;
1299
var makeCall = function(fn, scope, args){
1300
if((v = fn.apply(scope || obj, args)) !== undefined){
1301
if(typeof v === 'object'){
1302
if(v.returnValue !== undefined){
1303
returnValue = v.returnValue;
1307
if(v.cancel === true){
1310
}else if(v === false){
1318
this[method] = function(){
1319
returnValue = v = undefined; cancel = false;
1320
var args = Array.prototype.slice.call(arguments, 0);
1321
for(var i = 0, len = e.before.length; i < len; i++){
1322
makeCall(e.before[i].fn, e.before[i].scope, args);
1328
if((v = e.originalFn.apply(obj, args)) !== undefined){
1332
for(var i = 0, len = e.after.length; i < len; i++){
1333
makeCall(e.after[i].fn, e.after[i].scope, args);
1344
beforeMethod : function(method, fn, scope){
1345
var e = this.getMethodEvent(method);
1346
e.before.push({fn: fn, scope: scope});
1349
afterMethod : function(method, fn, scope){
1350
var e = this.getMethodEvent(method);
1351
e.after.push({fn: fn, scope: scope});
1354
removeMethodListener : function(method, fn, scope){
1355
var e = this.getMethodEvent(method);
1356
for(var i = 0, len = e.before.length; i < len; i++){
1357
if(e.before[i].fn == fn && e.before[i].scope == scope){
1358
e.before.splice(i, 1);
1362
for(var i = 0, len = e.after.length; i < len; i++){
1363
if(e.after[i].fn == fn && e.after[i].scope == scope){
1364
e.after.splice(i, 1);
1371
Ext.util.Observable.prototype.on = Ext.util.Observable.prototype.addListener;
1373
Ext.util.Observable.prototype.un = Ext.util.Observable.prototype.removeListener;
1376
Ext.util.Observable.capture = function(o, fn, scope){
1377
o.fireEvent = o.fireEvent.createInterceptor(fn, scope);
1381
Ext.util.Observable.releaseCapture = function(o){
1382
o.fireEvent = Ext.util.Observable.prototype.fireEvent;
1387
var createBuffered = function(h, o, scope){
1388
var task = new Ext.util.DelayedTask();
1390
task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));
1394
var createSingle = function(h, e, fn, scope){
1396
e.removeListener(fn, scope);
1397
return h.apply(scope, arguments);
1401
var createDelayed = function(h, o, scope){
1403
var args = Array.prototype.slice.call(arguments, 0);
1404
setTimeout(function(){
1405
h.apply(scope, args);
1410
Ext.util.Event = function(obj, name){
1413
this.listeners = [];
1416
Ext.util.Event.prototype = {
1417
addListener : function(fn, scope, options){
1418
scope = scope || this.obj;
1419
if(!this.isListening(fn, scope)){
1420
var l = this.createListener(fn, scope, options);
1422
this.listeners.push(l);
1423
}else{ this.listeners = this.listeners.slice(0);
1424
this.listeners.push(l);
1429
createListener : function(fn, scope, o){
1431
scope = scope || this.obj;
1432
var l = {fn: fn, scope: scope, options: o};
1435
h = createDelayed(h, o, scope);
1438
h = createSingle(h, this, fn, scope);
1441
h = createBuffered(h, o, scope);
1447
findListener : function(fn, scope){
1448
scope = scope || this.obj;
1449
var ls = this.listeners;
1450
for(var i = 0, len = ls.length; i < len; i++){
1452
if(l.fn == fn && l.scope == scope){
1459
isListening : function(fn, scope){
1460
return this.findListener(fn, scope) != -1;
1463
removeListener : function(fn, scope){
1465
if((index = this.findListener(fn, scope)) != -1){
1467
this.listeners.splice(index, 1);
1469
this.listeners = this.listeners.slice(0);
1470
this.listeners.splice(index, 1);
1477
clearListeners : function(){
1478
this.listeners = [];
1482
var ls = this.listeners, scope, len = ls.length;
1485
var args = Array.prototype.slice.call(arguments, 0);
1486
for(var i = 0; i < len; i++){
1488
if(l.fireFn.apply(l.scope||this.obj||window, arguments) === false){
1489
this.firing = false;
1493
this.firing = false;
1500
Ext.EventManager = function(){
1501
var docReadyEvent, docReadyProcId, docReadyState = false;
1502
var resizeEvent, resizeTask, textEvent, textSize;
1503
var E = Ext.lib.Event;
1504
var D = Ext.lib.Dom;
1505
var xname = 'Ex' + 't';
1509
var addListener = function(el, ename, fn, wrap, scope){
1510
var id = Ext.id(el);
1514
var es = elHash[id];
1527
E.on(el, ename, wrap);
1529
if(ename == "mousewheel" && el.addEventListener){ el.addEventListener("DOMMouseScroll", wrap, false);
1530
E.on(window, 'unload', function(){
1531
el.removeEventListener("DOMMouseScroll", wrap, false);
1534
if(ename == "mousedown" && el == document){ Ext.EventManager.stoppedMouseDownEvent.addListener(wrap);
1538
var removeListener = function(el, ename, fn, scope){
1539
el = Ext.getDom(el);
1540
var id = Ext.id(el), es = elHash[id], wrap;
1542
var ls = es[ename], l;
1544
for(var i = 0, len = ls.length; i < len; i++){
1546
if(l.fn == fn && (!scope || l.scope == scope)){
1548
E.un(el, ename, wrap);
1555
if(ename == "mousewheel" && el.addEventListener && wrap){
1556
el.removeEventListener("DOMMouseScroll", wrap, false);
1558
if(ename == "mousedown" && el == document && wrap){ Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);
1562
var removeAll = function(el){
1563
el = Ext.getDom(el);
1564
var id = Ext.id(el), es = elHash[id], ls;
1566
for(var ename in es){
1567
if(es.hasOwnProperty(ename)){
1569
for(var i = 0, len = ls.length; i < len; i++){
1570
E.un(el, ename, ls[i].wrap);
1580
var fireDocReady = function(){
1582
docReadyState = Ext.isReady = true;
1583
if(Ext.isGecko || Ext.isOpera) {
1584
document.removeEventListener("DOMContentLoaded", fireDocReady, false);
1588
clearInterval(docReadyProcId);
1589
docReadyProcId = null;
1592
docReadyEvent.fire();
1593
docReadyEvent.clearListeners();
1597
var initDocReady = function(){
1598
docReadyEvent = new Ext.util.Event();
1604
E.on(window, 'load', fireDocReady);
1606
if(Ext.isGecko || Ext.isOpera) {
1607
document.addEventListener('DOMContentLoaded', fireDocReady, false);
1610
docReadyProcId = setInterval(function(){
1612
Ext.isReady || (document.documentElement.doScroll('left'));
1616
fireDocReady(); }, 5);
1618
document.onreadystatechange = function(){
1619
if(document.readyState == 'complete'){
1620
document.onreadystatechange = null;
1625
else if(Ext.isSafari){
1626
docReadyProcId = setInterval(function(){
1627
var rs = document.readyState;
1628
if(rs == 'complete') {
1635
var createBuffered = function(h, o){
1636
var task = new Ext.util.DelayedTask(h);
1638
e = new Ext.EventObjectImpl(e);
1639
task.delay(o.buffer, h, null, [e]);
1643
var createSingle = function(h, el, ename, fn, scope){
1645
Ext.EventManager.removeListener(el, ename, fn, scope);
1650
var createDelayed = function(h, o){
1652
e = new Ext.EventObjectImpl(e);
1653
setTimeout(function(){
1659
var listen = function(element, ename, opt, fn, scope){
1660
var o = (!opt || typeof opt == "boolean") ? {} : opt;
1661
fn = fn || o.fn; scope = scope || o.scope;
1662
var el = Ext.getDom(element);
1664
throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';
1666
var h = function(e){
1670
e = Ext.EventObject.setEvent(e);
1673
t = e.getTarget(o.delegate, el);
1680
if(o.stopEvent === true){
1683
if(o.preventDefault === true){
1686
if(o.stopPropagation === true){
1687
e.stopPropagation();
1690
if(o.normalized === false){
1694
fn.call(scope || el, e, t, o);
1697
h = createDelayed(h, o);
1700
h = createSingle(h, el, ename, fn, scope);
1703
h = createBuffered(h, o);
1706
addListener(el, ename, fn, h, scope);
1710
var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
1714
addListener : function(element, eventName, fn, scope, options){
1715
if(typeof eventName == "object"){
1721
if(typeof o[e] == "function"){
1722
listen(element, e, o, o[e], o.scope);
1724
listen(element, e, o[e]);
1729
return listen(element, eventName, options, fn, scope);
1733
removeListener : function(element, eventName, fn, scope){
1734
return removeListener(element, eventName, fn, scope);
1738
removeAll : function(element){
1739
return removeAll(element);
1743
onDocumentReady : function(fn, scope, options){
1747
if(docReadyState || Ext.isReady){ options || (options = {});
1748
fn.defer(options.delay||0, scope);
1750
docReadyEvent.addListener(fn, scope, options);
1755
onWindowResize : function(fn, scope, options){
1757
resizeEvent = new Ext.util.Event();
1758
resizeTask = new Ext.util.DelayedTask(function(){
1759
resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1761
E.on(window, "resize", this.fireWindowResize, this);
1763
resizeEvent.addListener(fn, scope, options);
1766
fireWindowResize : function(){
1768
if((Ext.isIE||Ext.isAir) && resizeTask){
1769
resizeTask.delay(50);
1771
resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1777
onTextResize : function(fn, scope, options){
1779
textEvent = new Ext.util.Event();
1780
var textEl = new Ext.Element(document.createElement('div'));
1781
textEl.dom.className = 'x-text-resize';
1782
textEl.dom.innerHTML = 'X';
1783
textEl.appendTo(document.body);
1784
textSize = textEl.dom.offsetHeight;
1785
setInterval(function(){
1786
if(textEl.dom.offsetHeight != textSize){
1787
textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);
1789
}, this.textResizeInterval);
1791
textEvent.addListener(fn, scope, options);
1795
removeResizeListener : function(fn, scope){
1797
resizeEvent.removeListener(fn, scope);
1801
fireResize : function(){
1803
resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1809
textResizeInterval : 50
1812
pub.on = pub.addListener;
1814
pub.un = pub.removeListener;
1816
pub.stoppedMouseDownEvent = new Ext.util.Event();
1820
Ext.onReady = Ext.EventManager.onDocumentReady;
1824
var initExtCss = function(){
1825
var bd = document.body || document.getElementsByTagName('body')[0];
1826
if(!bd){ return false; }
1828
Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : 'ext-ie7')
1829
: Ext.isGecko ? "ext-gecko " + (Ext.isGecko2 ? 'ext-gecko2' : 'ext-gecko3')
1830
: Ext.isOpera ? "ext-opera"
1831
: Ext.isSafari ? "ext-safari" : ""];
1834
cls.push("ext-mac");
1837
cls.push("ext-linux");
1839
if(Ext.isBorderBox){
1840
cls.push('ext-border-box');
1842
if(Ext.isStrict){ var p = bd.parentNode;
1844
p.className += ' ext-strict';
1847
bd.className += cls.join(' ');
1852
Ext.onReady(initExtCss);
1857
Ext.EventObject = function(){
1859
var E = Ext.lib.Event;
1862
3 : 13, 63234 : 37, 63235 : 39, 63232 : 38, 63233 : 40, 63276 : 33, 63277 : 34, 63272 : 46, 63273 : 36, 63275 : 35 };
1864
var btnMap = Ext.isIE ? {1:0,4:1,2:2} :
1865
(Ext.isSafari ? {1:0,2:1,3:2} : {0:0,1:1,2:2});
1867
Ext.EventObjectImpl = function(e){
1869
this.setEvent(e.browserEvent || e);
1873
Ext.EventObjectImpl.prototype = {
1875
browserEvent : null,
2061
setEvent : function(e){
2062
if(e == this || (e && e.browserEvent)){ return e;
2064
this.browserEvent = e;
2066
this.button = e.button ? btnMap[e.button] : (e.which ? e.which-1 : -1);
2067
if(e.type == 'click' && this.button == -1){
2071
this.shiftKey = e.shiftKey;
2072
this.ctrlKey = e.ctrlKey || e.metaKey;
2073
this.altKey = e.altKey;
2074
this.keyCode = e.keyCode;
2075
this.charCode = e.charCode;
2076
this.target = E.getTarget(e);
2077
this.xy = E.getXY(e);
2080
this.shiftKey = false;
2081
this.ctrlKey = false;
2082
this.altKey = false;
2092
stopEvent : function(){
2093
if(this.browserEvent){
2094
if(this.browserEvent.type == 'mousedown'){
2095
Ext.EventManager.stoppedMouseDownEvent.fire(this);
2097
E.stopEvent(this.browserEvent);
2102
preventDefault : function(){
2103
if(this.browserEvent){
2104
E.preventDefault(this.browserEvent);
2109
isNavKeyPress : function(){
2110
var k = this.keyCode;
2111
k = Ext.isSafari ? (safariKeys[k] || k) : k;
2112
return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB || k == this.ESC;
2115
isSpecialKey : function(){
2116
var k = this.keyCode;
2117
return (this.type == 'keypress' && this.ctrlKey) || k == 9 || k == 13 || k == 40 || k == 27 ||
2118
(k == 16) || (k == 17) ||
2119
(k >= 18 && k <= 20) ||
2120
(k >= 33 && k <= 35) ||
2121
(k >= 36 && k <= 39) ||
2122
(k >= 44 && k <= 45);
2126
stopPropagation : function(){
2127
if(this.browserEvent){
2128
if(this.browserEvent.type == 'mousedown'){
2129
Ext.EventManager.stoppedMouseDownEvent.fire(this);
2131
E.stopPropagation(this.browserEvent);
2136
getCharCode : function(){
2137
return this.charCode || this.keyCode;
2141
getKey : function(){
2142
var k = this.keyCode || this.charCode;
2143
return Ext.isSafari ? (safariKeys[k] || k) : k;
2147
getPageX : function(){
2152
getPageY : function(){
2157
getTime : function(){
2158
if(this.browserEvent){
2159
return E.getTime(this.browserEvent);
2170
getTarget : function(selector, maxDepth, returnEl){
2171
return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target);
2175
getRelatedTarget : function(){
2176
if(this.browserEvent){
2177
return E.getRelatedTarget(this.browserEvent);
2183
getWheelDelta : function(){
2184
var e = this.browserEvent;
2187
delta = e.wheelDelta/120;
2189
delta = -e.detail/3;
2195
hasModifier : function(){
2196
return ((this.ctrlKey || this.altKey) || this.shiftKey) ? true : false;
2200
within : function(el, related){
2201
var t = this[related ? "getRelatedTarget" : "getTarget"]();
2202
return t && Ext.fly(el).contains(t);
2205
getPoint : function(){
2206
return new Ext.lib.Point(this.xy[0], this.xy[1]);
2210
return new Ext.EventObjectImpl();
2214
var D = Ext.lib.Dom;
2215
var E = Ext.lib.Event;
2216
var A = Ext.lib.Anim;
2219
var camelRe = /(-[a-z])/gi;
2220
var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };
2221
var view = document.defaultView;
2223
Ext.Element = function(element, forceNew){
2224
var dom = typeof element == "string" ?
2225
document.getElementById(element) : element;
2226
if(!dom){ return null;
2229
if(forceNew !== true && id && Ext.Element.cache[id]){ return Ext.Element.cache[id];
2236
this.id = id || Ext.id(dom);
2239
var El = Ext.Element;
2243
originalDisplay : "",
2249
setVisibilityMode : function(visMode){
2250
this.visibilityMode = visMode;
2254
enableDisplayMode : function(display){
2255
this.setVisibilityMode(El.DISPLAY);
2256
if(typeof display != "undefined") this.originalDisplay = display;
2261
findParent : function(simpleSelector, maxDepth, returnEl){
2262
var p = this.dom, b = document.body, depth = 0, dq = Ext.DomQuery, stopEl;
2263
maxDepth = maxDepth || 50;
2264
if(typeof maxDepth != "number"){
2265
stopEl = Ext.getDom(maxDepth);
2268
while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){
2269
if(dq.is(p, simpleSelector)){
2270
return returnEl ? Ext.get(p) : p;
2280
findParentNode : function(simpleSelector, maxDepth, returnEl){
2281
var p = Ext.fly(this.dom.parentNode, '_internal');
2282
return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
2286
up : function(simpleSelector, maxDepth){
2287
return this.findParentNode(simpleSelector, maxDepth, true);
2293
is : function(simpleSelector){
2294
return Ext.DomQuery.is(this.dom, simpleSelector);
2298
animate : function(args, duration, onComplete, easing, animType){
2299
this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType);
2304
anim : function(args, opt, animType, defaultDur, defaultEase, cb){
2305
animType = animType || 'run';
2307
var anim = Ext.lib.Anim[animType](
2309
(opt.duration || defaultDur) || .35,
2310
(opt.easing || defaultEase) || 'easeOut',
2312
Ext.callback(cb, this);
2313
Ext.callback(opt.callback, opt.scope || this, [this, opt]);
2321
preanim : function(a, i){
2322
return !a[i] ? false : (typeof a[i] == "object" ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]});
2326
clean : function(forceReclean){
2327
if(this.isCleaned && forceReclean !== true){
2331
var d = this.dom, n = d.firstChild, ni = -1;
2333
var nx = n.nextSibling;
2334
if(n.nodeType == 3 && !ns.test(n.nodeValue)){
2341
this.isCleaned = true;
2346
scrollIntoView : function(container, hscroll){
2347
var c = Ext.getDom(container) || Ext.getBody().dom;
2350
var o = this.getOffsetsTo(c),
2351
l = o[0] + c.scrollLeft,
2352
t = o[1] + c.scrollTop,
2353
b = t+el.offsetHeight,
2354
r = l+el.offsetWidth;
2356
var ch = c.clientHeight;
2357
var ct = parseInt(c.scrollTop, 10);
2358
var cl = parseInt(c.scrollLeft, 10);
2360
var cr = cl + c.clientWidth;
2362
if(el.offsetHeight > ch || t < ct){
2367
c.scrollTop = c.scrollTop;
2368
if(hscroll !== false){
2369
if(el.offsetWidth > c.clientWidth || l < cl){
2372
c.scrollLeft = r-c.clientWidth;
2374
c.scrollLeft = c.scrollLeft;
2379
scrollChildIntoView : function(child, hscroll){
2380
Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);
2384
autoHeight : function(animate, duration, onComplete, easing){
2385
var oldHeight = this.getHeight();
2387
this.setHeight(1); setTimeout(function(){
2388
var height = parseInt(this.dom.scrollHeight, 10); if(!animate){
2389
this.setHeight(height);
2391
if(typeof onComplete == "function"){
2395
this.setHeight(oldHeight); this.setHeight(height, animate, duration, function(){
2397
if(typeof onComplete == "function") onComplete();
2398
}.createDelegate(this), easing);
2400
}.createDelegate(this), 0);
2405
contains : function(el){
2406
if(!el){return false;}
2407
return D.isAncestor(this.dom, el.dom ? el.dom : el);
2411
isVisible : function(deep) {
2412
var vis = !(this.getStyle("visibility") == "hidden" || this.getStyle("display") == "none");
2413
if(deep !== true || !vis){
2416
var p = this.dom.parentNode;
2417
while(p && p.tagName.toLowerCase() != "body"){
2418
if(!Ext.fly(p, '_isVisible').isVisible()){
2427
select : function(selector, unique){
2428
return El.select(selector, unique, this.dom);
2432
query : function(selector){
2433
return Ext.DomQuery.select(selector, this.dom);
2437
child : function(selector, returnDom){
2438
var n = Ext.DomQuery.selectNode(selector, this.dom);
2439
return returnDom ? n : Ext.get(n);
2443
down : function(selector, returnDom){
2444
var n = Ext.DomQuery.selectNode(" > " + selector, this.dom);
2445
return returnDom ? n : Ext.get(n);
2449
initDD : function(group, config, overrides){
2450
var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);
2451
return Ext.apply(dd, overrides);
2455
initDDProxy : function(group, config, overrides){
2456
var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);
2457
return Ext.apply(dd, overrides);
2461
initDDTarget : function(group, config, overrides){
2462
var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);
2463
return Ext.apply(dd, overrides);
2467
setVisible : function(visible, animate){
2469
if(this.visibilityMode == El.DISPLAY){
2470
this.setDisplayed(visible);
2473
this.dom.style.visibility = visible ? "visible" : "hidden";
2477
var visMode = this.visibilityMode;
2479
this.setOpacity(.01);
2480
this.setVisible(true);
2482
this.anim({opacity: { to: (visible?1:0) }},
2483
this.preanim(arguments, 1),
2484
null, .35, 'easeIn', function(){
2486
if(visMode == El.DISPLAY){
2487
dom.style.display = "none";
2489
dom.style.visibility = "hidden";
2491
Ext.get(dom).setOpacity(1);
2499
isDisplayed : function() {
2500
return this.getStyle("display") != "none";
2504
toggle : function(animate){
2505
this.setVisible(!this.isVisible(), this.preanim(arguments, 0));
2510
setDisplayed : function(value) {
2511
if(typeof value == "boolean"){
2512
value = value ? this.originalDisplay : "none";
2514
this.setStyle("display", value);
2519
focus : function() {
2535
addClass : function(className){
2536
if(Ext.isArray(className)){
2537
for(var i = 0, len = className.length; i < len; i++) {
2538
this.addClass(className[i]);
2541
if(className && !this.hasClass(className)){
2542
this.dom.className = this.dom.className + " " + className;
2549
radioClass : function(className){
2550
var siblings = this.dom.parentNode.childNodes;
2551
for(var i = 0; i < siblings.length; i++) {
2552
var s = siblings[i];
2553
if(s.nodeType == 1){
2554
Ext.get(s).removeClass(className);
2557
this.addClass(className);
2562
removeClass : function(className){
2563
if(!className || !this.dom.className){
2566
if(Ext.isArray(className)){
2567
for(var i = 0, len = className.length; i < len; i++) {
2568
this.removeClass(className[i]);
2571
if(this.hasClass(className)){
2572
var re = this.classReCache[className];
2574
re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', "g");
2575
this.classReCache[className] = re;
2577
this.dom.className =
2578
this.dom.className.replace(re, " ");
2587
toggleClass : function(className){
2588
if(this.hasClass(className)){
2589
this.removeClass(className);
2591
this.addClass(className);
2597
hasClass : function(className){
2598
return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;
2602
replaceClass : function(oldClassName, newClassName){
2603
this.removeClass(oldClassName);
2604
this.addClass(newClassName);
2609
getStyles : function(){
2610
var a = arguments, len = a.length, r = {};
2611
for(var i = 0; i < len; i++){
2612
r[a[i]] = this.getStyle(a[i]);
2618
getStyle : function(){
2619
return view && view.getComputedStyle ?
2621
var el = this.dom, v, cs, camel;
2622
if(prop == 'float'){
2625
if(v = el.style[prop]){
2628
if(cs = view.getComputedStyle(el, "")){
2629
if(!(camel = propCache[prop])){
2630
camel = propCache[prop] = prop.replace(camelRe, camelFn);
2637
var el = this.dom, v, cs, camel;
2638
if(prop == 'opacity'){
2639
if(typeof el.style.filter == 'string'){
2640
var m = el.style.filter.match(/alpha\(opacity=(.*)\)/i);
2642
var fv = parseFloat(m[1]);
2644
return fv ? fv / 100 : 0;
2649
}else if(prop == 'float'){
2650
prop = "styleFloat";
2652
if(!(camel = propCache[prop])){
2653
camel = propCache[prop] = prop.replace(camelRe, camelFn);
2655
if(v = el.style[camel]){
2658
if(cs = el.currentStyle){
2666
setStyle : function(prop, value){
2667
if(typeof prop == "string"){
2669
if(!(camel = propCache[prop])){
2670
camel = propCache[prop] = prop.replace(camelRe, camelFn);
2672
if(camel == 'opacity') {
2673
this.setOpacity(value);
2675
this.dom.style[camel] = value;
2678
for(var style in prop){
2679
if(typeof prop[style] != "function"){
2680
this.setStyle(style, prop[style]);
2688
applyStyles : function(style){
2689
Ext.DomHelper.applyStyles(this.dom, style);
2695
return D.getX(this.dom);
2700
return D.getY(this.dom);
2705
return D.getXY(this.dom);
2709
getOffsetsTo : function(el){
2710
var o = this.getXY();
2711
var e = Ext.fly(el, '_internal').getXY();
2712
return [o[0]-e[0],o[1]-e[1]];
2716
setX : function(x, animate){
2718
D.setX(this.dom, x);
2720
this.setXY([x, this.getY()], this.preanim(arguments, 1));
2726
setY : function(y, animate){
2728
D.setY(this.dom, y);
2730
this.setXY([this.getX(), y], this.preanim(arguments, 1));
2736
setLeft : function(left){
2737
this.setStyle("left", this.addUnits(left));
2742
setTop : function(top){
2743
this.setStyle("top", this.addUnits(top));
2748
setRight : function(right){
2749
this.setStyle("right", this.addUnits(right));
2754
setBottom : function(bottom){
2755
this.setStyle("bottom", this.addUnits(bottom));
2760
setXY : function(pos, animate){
2762
D.setXY(this.dom, pos);
2764
this.anim({points: {to: pos}}, this.preanim(arguments, 1), 'motion');
2770
setLocation : function(x, y, animate){
2771
this.setXY([x, y], this.preanim(arguments, 2));
2776
moveTo : function(x, y, animate){
2777
this.setXY([x, y], this.preanim(arguments, 2));
2782
getRegion : function(){
2783
return D.getRegion(this.dom);
2787
getHeight : function(contentHeight){
2788
var h = this.dom.offsetHeight || 0;
2789
h = contentHeight !== true ? h : h-this.getBorderWidth("tb")-this.getPadding("tb");
2790
return h < 0 ? 0 : h;
2794
getWidth : function(contentWidth){
2795
var w = this.dom.offsetWidth || 0;
2796
w = contentWidth !== true ? w : w-this.getBorderWidth("lr")-this.getPadding("lr");
2797
return w < 0 ? 0 : w;
2801
getComputedHeight : function(){
2802
var h = Math.max(this.dom.offsetHeight, this.dom.clientHeight);
2804
h = parseInt(this.getStyle('height'), 10) || 0;
2805
if(!this.isBorderBox()){
2806
h += this.getFrameWidth('tb');
2813
getComputedWidth : function(){
2814
var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth);
2816
w = parseInt(this.getStyle('width'), 10) || 0;
2817
if(!this.isBorderBox()){
2818
w += this.getFrameWidth('lr');
2825
getSize : function(contentSize){
2826
return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};
2829
getStyleSize : function(){
2830
var w, h, d = this.dom, s = d.style;
2831
if(s.width && s.width != 'auto'){
2832
w = parseInt(s.width, 10);
2833
if(Ext.isBorderBox){
2834
w -= this.getFrameWidth('lr');
2837
if(s.height && s.height != 'auto'){
2838
h = parseInt(s.height, 10);
2839
if(Ext.isBorderBox){
2840
h -= this.getFrameWidth('tb');
2843
return {width: w || this.getWidth(true), height: h || this.getHeight(true)};
2848
getViewSize : function(){
2849
var d = this.dom, doc = document, aw = 0, ah = 0;
2850
if(d == doc || d == doc.body){
2851
return {width : D.getViewWidth(), height: D.getViewHeight()};
2854
width : d.clientWidth,
2855
height: d.clientHeight
2861
getValue : function(asNumber){
2862
return asNumber ? parseInt(this.dom.value, 10) : this.dom.value;
2865
adjustWidth : function(width){
2866
if(typeof width == "number"){
2867
if(this.autoBoxAdjust && !this.isBorderBox()){
2868
width -= (this.getBorderWidth("lr") + this.getPadding("lr"));
2877
adjustHeight : function(height){
2878
if(typeof height == "number"){
2879
if(this.autoBoxAdjust && !this.isBorderBox()){
2880
height -= (this.getBorderWidth("tb") + this.getPadding("tb"));
2890
setWidth : function(width, animate){
2891
width = this.adjustWidth(width);
2893
this.dom.style.width = this.addUnits(width);
2895
this.anim({width: {to: width}}, this.preanim(arguments, 1));
2901
setHeight : function(height, animate){
2902
height = this.adjustHeight(height);
2904
this.dom.style.height = this.addUnits(height);
2906
this.anim({height: {to: height}}, this.preanim(arguments, 1));
2912
setSize : function(width, height, animate){
2913
if(typeof width == "object"){ height = width.height; width = width.width;
2915
width = this.adjustWidth(width); height = this.adjustHeight(height);
2917
this.dom.style.width = this.addUnits(width);
2918
this.dom.style.height = this.addUnits(height);
2920
this.anim({width: {to: width}, height: {to: height}}, this.preanim(arguments, 2));
2926
setBounds : function(x, y, width, height, animate){
2928
this.setSize(width, height);
2929
this.setLocation(x, y);
2931
width = this.adjustWidth(width); height = this.adjustHeight(height);
2932
this.anim({points: {to: [x, y]}, width: {to: width}, height: {to: height}},
2933
this.preanim(arguments, 4), 'motion');
2939
setRegion : function(region, animate){
2940
this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.preanim(arguments, 1));
2945
addListener : function(eventName, fn, scope, options){
2946
Ext.EventManager.on(this.dom, eventName, fn, scope || this, options);
2950
removeListener : function(eventName, fn, scope){
2951
Ext.EventManager.removeListener(this.dom, eventName, fn, scope || this);
2956
removeAllListeners : function(){
2957
Ext.EventManager.removeAll(this.dom);
2962
relayEvent : function(eventName, observable){
2963
this.on(eventName, function(e){
2964
observable.fireEvent(eventName, e);
2969
setOpacity : function(opacity, animate){
2971
var s = this.dom.style;
2974
s.filter = (s.filter || '').replace(/alpha\([^\)]*\)/gi,"") +
2975
(opacity == 1 ? "" : " alpha(opacity=" + opacity * 100 + ")");
2977
s.opacity = opacity;
2980
this.anim({opacity: {to: opacity}}, this.preanim(arguments, 1), null, .35, 'easeIn');
2986
getLeft : function(local){
2990
return parseInt(this.getStyle("left"), 10) || 0;
2995
getRight : function(local){
2997
return this.getX() + this.getWidth();
2999
return (this.getLeft(true) + this.getWidth()) || 0;
3004
getTop : function(local) {
3008
return parseInt(this.getStyle("top"), 10) || 0;
3013
getBottom : function(local){
3015
return this.getY() + this.getHeight();
3017
return (this.getTop(true) + this.getHeight()) || 0;
3022
position : function(pos, zIndex, x, y){
3024
if(this.getStyle('position') == 'static'){
3025
this.setStyle('position', 'relative');
3028
this.setStyle("position", pos);
3031
this.setStyle("z-index", zIndex);
3033
if(x !== undefined && y !== undefined){
3035
}else if(x !== undefined){
3037
}else if(y !== undefined){
3043
clearPositioning : function(value){
3051
"position" : "static"
3057
getPositioning : function(){
3058
var l = this.getStyle("left");
3059
var t = this.getStyle("top");
3061
"position" : this.getStyle("position"),
3063
"right" : l ? "" : this.getStyle("right"),
3065
"bottom" : t ? "" : this.getStyle("bottom"),
3066
"z-index" : this.getStyle("z-index")
3071
getBorderWidth : function(side){
3072
return this.addStyles(side, El.borders);
3076
getPadding : function(side){
3077
return this.addStyles(side, El.paddings);
3081
setPositioning : function(pc){
3082
this.applyStyles(pc);
3083
if(pc.right == "auto"){
3084
this.dom.style.right = "";
3086
if(pc.bottom == "auto"){
3087
this.dom.style.bottom = "";
3092
fixDisplay : function(){
3093
if(this.getStyle("display") == "none"){
3094
this.setStyle("visibility", "hidden");
3095
this.setStyle("display", this.originalDisplay); if(this.getStyle("display") == "none"){ this.setStyle("display", "block");
3100
setOverflow : function(v){
3101
if(v=='auto' && Ext.isMac && Ext.isGecko2){ this.dom.style.overflow = 'hidden';
3102
(function(){this.dom.style.overflow = 'auto';}).defer(1, this);
3104
this.dom.style.overflow = v;
3109
setLeftTop : function(left, top){
3110
this.dom.style.left = this.addUnits(left);
3111
this.dom.style.top = this.addUnits(top);
3116
move : function(direction, distance, animate){
3117
var xy = this.getXY();
3118
direction = direction.toLowerCase();
3122
this.moveTo(xy[0]-distance, xy[1], this.preanim(arguments, 2));
3126
this.moveTo(xy[0]+distance, xy[1], this.preanim(arguments, 2));
3131
this.moveTo(xy[0], xy[1]-distance, this.preanim(arguments, 2));
3136
this.moveTo(xy[0], xy[1]+distance, this.preanim(arguments, 2));
3144
if(!this.isClipped){
3145
this.isClipped = true;
3146
this.originalClip = {
3147
"o": this.getStyle("overflow"),
3148
"x": this.getStyle("overflow-x"),
3149
"y": this.getStyle("overflow-y")
3151
this.setStyle("overflow", "hidden");
3152
this.setStyle("overflow-x", "hidden");
3153
this.setStyle("overflow-y", "hidden");
3159
unclip : function(){
3161
this.isClipped = false;
3162
var o = this.originalClip;
3163
if(o.o){this.setStyle("overflow", o.o);}
3164
if(o.x){this.setStyle("overflow-x", o.x);}
3165
if(o.y){this.setStyle("overflow-y", o.y);}
3172
getAnchorXY : function(anchor, local, s){
3174
var w, h, vp = false;
3177
if(d == document.body || d == document){
3179
w = D.getViewWidth(); h = D.getViewHeight();
3181
w = this.getWidth(); h = this.getHeight();
3184
w = s.width; h = s.height;
3186
var x = 0, y = 0, r = Math.round;
3187
switch((anchor || "tl").toLowerCase()){
3229
var sc = this.getScroll();
3230
return [x + sc.left, y + sc.top];
3232
var o = this.getXY();
3233
return [x+o[0], y+o[1]];
3237
getAlignToXY : function(el, p, o){
3240
throw "Element.alignToXY with an element that doesn't exist";
3243
var c = false; var p1 = "", p2 = "";
3250
}else if(p.indexOf("-") == -1){
3253
p = p.toLowerCase();
3254
var m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/);
3256
throw "Element.alignTo with an invalid alignment " + p;
3258
p1 = m[1]; p2 = m[2]; c = !!m[3];
3260
var a1 = this.getAnchorXY(p1, true);
3261
var a2 = el.getAnchorXY(p2, false);
3263
var x = a2[0] - a1[0] + o[0];
3264
var y = a2[1] - a1[1] + o[1];
3267
var w = this.getWidth(), h = this.getHeight(), r = el.getRegion();
3268
var dw = D.getViewWidth()-5, dh = D.getViewHeight()-5;
3270
var p1y = p1.charAt(0), p1x = p1.charAt(p1.length-1);
3271
var p2y = p2.charAt(0), p2x = p2.charAt(p2.length-1);
3272
var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t"));
3273
var swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r"));
3276
var scrollX = (doc.documentElement.scrollLeft || doc.body.scrollLeft || 0)+5;
3277
var scrollY = (doc.documentElement.scrollTop || doc.body.scrollTop || 0)+5;
3279
if((x+w) > dw + scrollX){
3280
x = swapX ? r.left-w : dw+scrollX-w;
3283
x = swapX ? r.right : scrollX;
3285
if((y+h) > dh + scrollY){
3286
y = swapY ? r.top-h : dh+scrollY-h;
3289
y = swapY ? r.bottom : scrollY;
3295
getConstrainToXY : function(){
3296
var os = {top:0, left:0, bottom:0, right: 0};
3298
return function(el, local, offsets, proposedXY){
3300
offsets = offsets ? Ext.applyIf(offsets, os) : os;
3302
var vw, vh, vx = 0, vy = 0;
3303
if(el.dom == document.body || el.dom == document){
3304
vw = Ext.lib.Dom.getViewWidth();
3305
vh = Ext.lib.Dom.getViewHeight();
3307
vw = el.dom.clientWidth;
3308
vh = el.dom.clientHeight;
3310
var vxy = el.getXY();
3316
var s = el.getScroll();
3318
vx += offsets.left + s.left;
3319
vy += offsets.top + s.top;
3321
vw -= offsets.right;
3322
vh -= offsets.bottom;
3327
var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]);
3328
var x = xy[0], y = xy[1];
3329
var w = this.dom.offsetWidth, h = this.dom.offsetHeight;
3349
return moved ? [x, y] : false;
3353
adjustForConstraints : function(xy, parent, offsets){
3354
return this.getConstrainToXY(parent || document, false, offsets, xy) || xy;
3358
alignTo : function(element, position, offsets, animate){
3359
var xy = this.getAlignToXY(element, position, offsets);
3360
this.setXY(xy, this.preanim(arguments, 3));
3365
anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){
3366
var action = function(){
3367
this.alignTo(el, alignment, offsets, animate);
3368
Ext.callback(callback, this);
3370
Ext.EventManager.onWindowResize(action, this);
3371
var tm = typeof monitorScroll;
3372
if(tm != 'undefined'){
3373
Ext.EventManager.on(window, 'scroll', action, this,
3374
{buffer: tm == 'number' ? monitorScroll : 50});
3376
action.call(this); return this;
3379
clearOpacity : function(){
3380
if (window.ActiveXObject) {
3381
if(typeof this.dom.style.filter == 'string' && (/alpha/i).test(this.dom.style.filter)){
3382
this.dom.style.filter = "";
3385
this.dom.style.opacity = "";
3386
this.dom.style["-moz-opacity"] = "";
3387
this.dom.style["-khtml-opacity"] = "";
3393
hide : function(animate){
3394
this.setVisible(false, this.preanim(arguments, 0));
3399
show : function(animate){
3400
this.setVisible(true, this.preanim(arguments, 0));
3405
addUnits : function(size){
3406
return Ext.Element.addUnits(size, this.defaultUnit);
3410
update : function(html, loadScripts, callback){
3411
if(typeof html == "undefined"){
3414
if(loadScripts !== true){
3415
this.dom.innerHTML = html;
3416
if(typeof callback == "function"){
3424
html += '<span id="' + id + '"></span>';
3426
E.onAvailable(id, function(){
3427
var hd = document.getElementsByTagName("head")[0];
3428
var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;
3429
var srcRe = /\ssrc=([\'\"])(.*?)\1/i;
3430
var typeRe = /\stype=([\'\"])(.*?)\1/i;
3433
while(match = re.exec(html)){
3434
var attrs = match[1];
3435
var srcMatch = attrs ? attrs.match(srcRe) : false;
3436
if(srcMatch && srcMatch[2]){
3437
var s = document.createElement("script");
3438
s.src = srcMatch[2];
3439
var typeMatch = attrs.match(typeRe);
3440
if(typeMatch && typeMatch[2]){
3441
s.type = typeMatch[2];
3444
}else if(match[2] && match[2].length > 0){
3445
if(window.execScript) {
3446
window.execScript(match[2]);
3448
window.eval(match[2]);
3452
var el = document.getElementById(id);
3453
if(el){Ext.removeNode(el);}
3454
if(typeof callback == "function"){
3458
dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");
3464
var um = this.getUpdater();
3465
um.update.apply(um, arguments);
3470
getUpdater : function(){
3471
if(!this.updateManager){
3472
this.updateManager = new Ext.Updater(this);
3474
return this.updateManager;
3478
unselectable : function(){
3479
this.dom.unselectable = "on";
3480
this.swallowEvent("selectstart", true);
3481
this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");
3482
this.addClass("x-unselectable");
3487
getCenterXY : function(){
3488
return this.getAlignToXY(document, 'c-c');
3492
center : function(centerIn){
3493
this.alignTo(centerIn || document, 'c-c');
3498
isBorderBox : function(){
3499
return noBoxAdjust[this.dom.tagName.toLowerCase()] || Ext.isBorderBox;
3503
getBox : function(contentBox, local){
3508
var left = parseInt(this.getStyle("left"), 10) || 0;
3509
var top = parseInt(this.getStyle("top"), 10) || 0;
3512
var el = this.dom, w = el.offsetWidth, h = el.offsetHeight, bx;
3514
bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h};
3516
var l = this.getBorderWidth("l")+this.getPadding("l");
3517
var r = this.getBorderWidth("r")+this.getPadding("r");
3518
var t = this.getBorderWidth("t")+this.getPadding("t");
3519
var b = this.getBorderWidth("b")+this.getPadding("b");
3520
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)};
3522
bx.right = bx.x + bx.width;
3523
bx.bottom = bx.y + bx.height;
3528
getFrameWidth : function(sides, onlyContentBox){
3529
return onlyContentBox && Ext.isBorderBox ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));
3533
setBox : function(box, adjust, animate){
3534
var w = box.width, h = box.height;
3535
if((adjust && !this.autoBoxAdjust) && !this.isBorderBox()){
3536
w -= (this.getBorderWidth("lr") + this.getPadding("lr"));
3537
h -= (this.getBorderWidth("tb") + this.getPadding("tb"));
3539
this.setBounds(box.x, box.y, w, h, this.preanim(arguments, 2));
3544
repaint : function(){
3546
this.addClass("x-repaint");
3547
setTimeout(function(){
3548
Ext.get(dom).removeClass("x-repaint");
3554
getMargins : function(side){
3557
top: parseInt(this.getStyle("margin-top"), 10) || 0,
3558
left: parseInt(this.getStyle("margin-left"), 10) || 0,
3559
bottom: parseInt(this.getStyle("margin-bottom"), 10) || 0,
3560
right: parseInt(this.getStyle("margin-right"), 10) || 0
3563
return this.addStyles(side, El.margins);
3567
addStyles : function(sides, styles){
3569
for(var i = 0, len = sides.length; i < len; i++){
3570
v = this.getStyle(styles[sides.charAt(i)]);
3572
w = parseInt(v, 10);
3573
if(w){ val += (w >= 0 ? w : -1 * w); }
3580
createProxy : function(config, renderTo, matchBox){
3581
config = typeof config == "object" ?
3582
config : {tag : "div", cls: config};
3586
proxy = Ext.DomHelper.append(renderTo, config, true);
3588
proxy = Ext.DomHelper.insertBefore(this.dom, config, true);
3591
proxy.setBox(this.getBox());
3597
mask : function(msg, msgCls){
3598
if(this.getStyle("position") == "static"){
3599
this.setStyle("position", "relative");
3602
this._maskMsg.remove();
3605
this._mask.remove();
3608
this._mask = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask"}, true);
3610
this.addClass("x-masked");
3611
this._mask.setDisplayed(true);
3612
if(typeof msg == 'string'){
3613
this._maskMsg = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask-msg", cn:{tag:'div'}}, true);
3614
var mm = this._maskMsg;
3615
mm.dom.className = msgCls ? "ext-el-mask-msg " + msgCls : "ext-el-mask-msg";
3616
mm.dom.firstChild.innerHTML = msg;
3617
mm.setDisplayed(true);
3620
if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && this.getStyle('height') == 'auto'){ this._mask.setSize(this.dom.clientWidth, this.getHeight());
3626
unmask : function(){
3629
this._maskMsg.remove();
3630
delete this._maskMsg;
3632
this._mask.remove();
3635
this.removeClass("x-masked");
3639
isMasked : function(){
3640
return this._mask && this._mask.isVisible();
3644
createShim : function(){
3645
var el = document.createElement('iframe');
3646
el.frameBorder = '0';
3647
el.className = 'ext-shim';
3648
if(Ext.isIE && Ext.isSecure){
3649
el.src = Ext.SSL_SECURE_URL;
3651
var shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
3652
shim.autoBoxAdjust = false;
3657
remove : function(){
3658
Ext.removeNode(this.dom);
3659
delete El.cache[this.dom.id];
3663
hover : function(overFn, outFn, scope){
3664
var preOverFn = function(e){
3665
if(!e.within(this, true)){
3666
overFn.apply(scope || this, arguments);
3669
var preOutFn = function(e){
3670
if(!e.within(this, true)){
3671
outFn.apply(scope || this, arguments);
3674
this.on("mouseover", preOverFn, this.dom);
3675
this.on("mouseout", preOutFn, this.dom);
3680
addClassOnOver : function(className){
3683
Ext.fly(this, '_internal').addClass(className);
3686
Ext.fly(this, '_internal').removeClass(className);
3693
addClassOnFocus : function(className){
3694
this.on("focus", function(){
3695
Ext.fly(this, '_internal').addClass(className);
3697
this.on("blur", function(){
3698
Ext.fly(this, '_internal').removeClass(className);
3703
addClassOnClick : function(className){
3705
this.on("mousedown", function(){
3706
Ext.fly(dom, '_internal').addClass(className);
3707
var d = Ext.getDoc();
3708
var fn = function(){
3709
Ext.fly(dom, '_internal').removeClass(className);
3710
d.removeListener("mouseup", fn);
3712
d.on("mouseup", fn);
3718
swallowEvent : function(eventName, preventDefault){
3719
var fn = function(e){
3720
e.stopPropagation();
3725
if(Ext.isArray(eventName)){
3726
for(var i = 0, len = eventName.length; i < len; i++){
3727
this.on(eventName[i], fn);
3731
this.on(eventName, fn);
3736
parent : function(selector, returnDom){
3737
return this.matchNode('parentNode', 'parentNode', selector, returnDom);
3741
next : function(selector, returnDom){
3742
return this.matchNode('nextSibling', 'nextSibling', selector, returnDom);
3746
prev : function(selector, returnDom){
3747
return this.matchNode('previousSibling', 'previousSibling', selector, returnDom);
3752
first : function(selector, returnDom){
3753
return this.matchNode('nextSibling', 'firstChild', selector, returnDom);
3757
last : function(selector, returnDom){
3758
return this.matchNode('previousSibling', 'lastChild', selector, returnDom);
3761
matchNode : function(dir, start, selector, returnDom){
3762
var n = this.dom[start];
3764
if(n.nodeType == 1 && (!selector || Ext.DomQuery.is(n, selector))){
3765
return !returnDom ? Ext.get(n) : n;
3773
appendChild: function(el){
3780
createChild: function(config, insertBefore, returnDom){
3781
config = config || {tag:'div'};
3783
return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
3785
return Ext.DomHelper[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config, returnDom !== true);
3789
appendTo: function(el){
3790
el = Ext.getDom(el);
3791
el.appendChild(this.dom);
3796
insertBefore: function(el){
3797
el = Ext.getDom(el);
3798
el.parentNode.insertBefore(this.dom, el);
3803
insertAfter: function(el){
3804
el = Ext.getDom(el);
3805
el.parentNode.insertBefore(this.dom, el.nextSibling);
3810
insertFirst: function(el, returnDom){
3812
if(typeof el == 'object' && !el.nodeType && !el.dom){ return this.createChild(el, this.dom.firstChild, returnDom);
3814
el = Ext.getDom(el);
3815
this.dom.insertBefore(el, this.dom.firstChild);
3816
return !returnDom ? Ext.get(el) : el;
3821
insertSibling: function(el, where, returnDom){
3823
if(Ext.isArray(el)){
3824
for(var i = 0, len = el.length; i < len; i++){
3825
rt = this.insertSibling(el[i], where, returnDom);
3829
where = where ? where.toLowerCase() : 'before';
3831
var refNode = where == 'before' ? this.dom : this.dom.nextSibling;
3833
if(typeof el == 'object' && !el.nodeType && !el.dom){ if(where == 'after' && !this.dom.nextSibling){
3834
rt = Ext.DomHelper.append(this.dom.parentNode, el, !returnDom);
3836
rt = Ext.DomHelper[where == 'after' ? 'insertAfter' : 'insertBefore'](this.dom, el, !returnDom);
3840
rt = this.dom.parentNode.insertBefore(Ext.getDom(el), refNode);
3849
wrap: function(config, returnDom){
3851
config = {tag: "div"};
3853
var newEl = Ext.DomHelper.insertBefore(this.dom, config, !returnDom);
3854
newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);
3859
replace: function(el){
3861
this.insertBefore(el);
3867
replaceWith: function(el){
3868
if(typeof el == 'object' && !el.nodeType && !el.dom){ el = this.insertSibling(el, 'before');
3870
el = Ext.getDom(el);
3871
this.dom.parentNode.insertBefore(el, this.dom);
3873
El.uncache(this.id);
3874
this.dom.parentNode.removeChild(this.dom);
3876
this.id = Ext.id(el);
3877
El.cache[this.id] = this;
3882
insertHtml : function(where, html, returnEl){
3883
var el = Ext.DomHelper.insertHtml(where, this.dom, html);
3884
return returnEl ? Ext.get(el) : el;
3888
set : function(o, useSet){
3890
useSet = typeof useSet == 'undefined' ? (el.setAttribute ? true : false) : useSet;
3892
if(attr == "style" || typeof o[attr] == "function") continue;
3894
el.className = o["cls"];
3895
}else if(o.hasOwnProperty(attr)){
3896
if(useSet) el.setAttribute(attr, o[attr]);
3897
else el[attr] = o[attr];
3901
Ext.DomHelper.applyStyles(el, o.style);
3907
addKeyListener : function(key, fn, scope){
3909
if(typeof key != "object" || Ext.isArray(key)){
3925
return new Ext.KeyMap(this, config);
3929
addKeyMap : function(config){
3930
return new Ext.KeyMap(this, config);
3934
isScrollable : function(){
3936
return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
3940
scrollTo : function(side, value, animate){
3941
var prop = side.toLowerCase() == "left" ? "scrollLeft" : "scrollTop";
3943
this.dom[prop] = value;
3945
var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [this.dom.scrollLeft, value];
3946
this.anim({scroll: {"to": to}}, this.preanim(arguments, 2), 'scroll');
3952
scroll : function(direction, distance, animate){
3953
if(!this.isScrollable()){
3957
var l = el.scrollLeft, t = el.scrollTop;
3958
var w = el.scrollWidth, h = el.scrollHeight;
3959
var cw = el.clientWidth, ch = el.clientHeight;
3960
direction = direction.toLowerCase();
3961
var scrolled = false;
3962
var a = this.preanim(arguments, 2);
3967
var v = Math.min(l + distance, w-cw);
3968
this.scrollTo("left", v, a);
3975
var v = Math.max(l - distance, 0);
3976
this.scrollTo("left", v, a);
3984
var v = Math.max(t - distance, 0);
3985
this.scrollTo("top", v, a);
3993
var v = Math.min(t + distance, h-ch);
3994
this.scrollTo("top", v, a);
4003
translatePoints : function(x, y){
4004
if(typeof x == 'object' || Ext.isArray(x)){
4007
var p = this.getStyle('position');
4008
var o = this.getXY();
4010
var l = parseInt(this.getStyle('left'), 10);
4011
var t = parseInt(this.getStyle('top'), 10);
4014
l = (p == "relative") ? 0 : this.dom.offsetLeft;
4017
t = (p == "relative") ? 0 : this.dom.offsetTop;
4020
return {left: (x - o[0] + l), top: (y - o[1] + t)};
4024
getScroll : function(){
4025
var d = this.dom, doc = document;
4026
if(d == doc || d == doc.body){
4028
if(Ext.isIE && Ext.isStrict){
4029
l = doc.documentElement.scrollLeft || (doc.body.scrollLeft || 0);
4030
t = doc.documentElement.scrollTop || (doc.body.scrollTop || 0);
4032
l = window.pageXOffset || (doc.body.scrollLeft || 0);
4033
t = window.pageYOffset || (doc.body.scrollTop || 0);
4035
return {left: l, top: t};
4037
return {left: d.scrollLeft, top: d.scrollTop};
4042
getColor : function(attr, defaultValue, prefix){
4043
var v = this.getStyle(attr);
4044
if(!v || v == "transparent" || v == "inherit") {
4045
return defaultValue;
4047
var color = typeof prefix == "undefined" ? "#" : prefix;
4048
if(v.substr(0, 4) == "rgb("){
4049
var rvs = v.slice(4, v.length -1).split(",");
4050
for(var i = 0; i < 3; i++){
4051
var h = parseInt(rvs[i]);
4052
var s = h.toString(16);
4059
if(v.substr(0, 1) == "#"){
4061
for(var i = 1; i < 4; i++){
4062
var c = v.charAt(i);
4065
}else if(v.length == 7){
4066
color += v.substr(1);
4070
return(color.length > 5 ? color.toLowerCase() : defaultValue);
4074
boxWrap : function(cls){
4075
cls = cls || 'x-box';
4076
var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+El.boxMarkup+'</div>', cls)));
4077
el.child('.'+cls+'-mc').dom.appendChild(this.dom);
4082
getAttributeNS : Ext.isIE ? function(ns, name){
4084
var type = typeof d[ns+":"+name];
4085
if(type != 'undefined' && type != 'unknown'){
4086
return d[ns+":"+name];
4089
} : function(ns, name){
4091
return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name];
4095
getTextWidth : function(text, min, max){
4096
return (Ext.util.TextMetrics.measure(this.dom, Ext.value(text, this.dom.innerHTML, true)).width).constrain(min || 0, max || 1000000);
4100
var ep = El.prototype;
4103
ep.on = ep.addListener;
4104
ep.mon = ep.addListener;
4106
ep.getUpdateManager = ep.getUpdater;
4109
ep.un = ep.removeListener;
4112
ep.autoBoxAdjust = true;
4114
El.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;
4116
El.addUnits = function(v, defaultUnit){
4117
if(v === "" || v == "auto"){
4120
if(v === undefined){
4123
if(typeof v == "number" || !El.unitPattern.test(v)){
4124
return v + (defaultUnit || 'px');
4129
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>';
4135
El.borders = {l: "border-left-width", r: "border-right-width", t: "border-top-width", b: "border-bottom-width"};
4136
El.paddings = {l: "padding-left", r: "padding-right", t: "padding-top", b: "padding-bottom"};
4137
El.margins = {l: "margin-left", r: "margin-right", t: "margin-top", b: "margin-bottom"};
4147
El.get = function(el){
4149
if(!el){ return null; }
4150
if(typeof el == "string"){ if(!(elm = document.getElementById(el))){
4153
if(ex = El.cache[el]){
4156
ex = El.cache[el] = new El(elm);
4159
}else if(el.tagName){ if(!(id = el.id)){
4162
if(ex = El.cache[id]){
4165
ex = El.cache[id] = new El(el);
4168
}else if(el instanceof El){
4170
el.dom = document.getElementById(el.id) || el.dom; El.cache[el.id] = el; }
4172
}else if(el.isComposite){
4174
}else if(Ext.isArray(el)){
4175
return El.select(el);
4176
}else if(el == document){
4178
var f = function(){};
4179
f.prototype = El.prototype;
4181
docEl.dom = document;
4188
El.uncache = function(el){
4189
for(var i = 0, a = arguments, len = a.length; i < len; i++) {
4191
delete El.cache[a[i].id || a[i]];
4196
El.garbageCollect = function(){
4197
if(!Ext.enableGarbageCollector){
4198
clearInterval(El.collectorThread);
4201
for(var eid in El.cache){
4202
var el = El.cache[eid], d = el.dom;
4203
if(!d || !d.parentNode || (!d.offsetParent && !document.getElementById(eid))){
4204
delete El.cache[eid];
4205
if(d && Ext.enableListenerCollection){
4206
Ext.EventManager.removeAll(d);
4211
El.collectorThreadId = setInterval(El.garbageCollect, 30000);
4213
var flyFn = function(){};
4214
flyFn.prototype = El.prototype;
4215
var _cls = new flyFn();
4217
El.Flyweight = function(dom){
4221
El.Flyweight.prototype = _cls;
4222
El.Flyweight.prototype.isFlyweight = true;
4224
El._flyweights = {};
4226
El.fly = function(el, named){
4227
named = named || '_global';
4228
el = Ext.getDom(el);
4232
if(!El._flyweights[named]){
4233
El._flyweights[named] = new El.Flyweight();
4235
El._flyweights[named].dom = el;
4236
return El._flyweights[named];
4244
var noBoxAdjust = Ext.isStrict ? {
4247
input:1, select:1, textarea:1
4249
if(Ext.isIE || Ext.isGecko){
4250
noBoxAdjust['button'] = 1;
4254
Ext.EventManager.on(window, 'unload', function(){
4256
delete El._flyweights;
4260
Ext.enableFx = true;
4265
slideIn : function(anchor, o){
4266
var el = this.getFxEl();
4269
el.queueFx(o, function(){
4271
anchor = anchor || "t";
4275
var r = this.getFxRestore();
4276
var b = this.getBox();
4279
var wrap = this.fxWrap(r.pos, o, "hidden");
4281
var st = this.dom.style;
4282
st.visibility = "visible";
4283
st.position = "absolute";
4285
var after = function(){
4286
el.fxUnwrap(wrap, r.pos, o);
4288
st.height = r.height;
4291
var a, pt = {to: [b.x, b.y]}, bw = {to: b.width}, bh = {to: b.height};
4293
switch(anchor.toLowerCase()){
4295
wrap.setSize(b.width, 0);
4296
st.left = st.bottom = "0";
4300
wrap.setSize(0, b.height);
4301
st.right = st.top = "0";
4305
wrap.setSize(0, b.height);
4307
st.left = st.top = "0";
4308
a = {width: bw, points: pt};
4311
wrap.setSize(b.width, 0);
4312
wrap.setY(b.bottom);
4313
st.left = st.top = "0";
4314
a = {height: bh, points: pt};
4318
st.right = st.bottom = "0";
4319
a = {width: bw, height: bh};
4323
wrap.setY(b.y+b.height);
4324
st.right = st.top = "0";
4325
a = {width: bw, height: bh, points: pt};
4329
wrap.setXY([b.right, b.bottom]);
4330
st.left = st.top = "0";
4331
a = {width: bw, height: bh, points: pt};
4335
wrap.setX(b.x+b.width);
4336
st.left = st.bottom = "0";
4337
a = {width: bw, height: bh, points: pt};
4340
this.dom.style.visibility = "visible";
4343
arguments.callee.anim = wrap.fxanim(a,
4353
slideOut : function(anchor, o){
4354
var el = this.getFxEl();
4357
el.queueFx(o, function(){
4359
anchor = anchor || "t";
4361
var r = this.getFxRestore();
4363
var b = this.getBox();
4366
var wrap = this.fxWrap(r.pos, o, "visible");
4368
var st = this.dom.style;
4369
st.visibility = "visible";
4370
st.position = "absolute";
4374
var after = function(){
4376
el.setDisplayed(false);
4381
el.fxUnwrap(wrap, r.pos, o);
4384
st.height = r.height;
4389
var a, zero = {to: 0};
4390
switch(anchor.toLowerCase()){
4392
st.left = st.bottom = "0";
4396
st.right = st.top = "0";
4400
st.left = st.top = "0";
4401
a = {width: zero, points: {to:[b.right, b.y]}};
4404
st.left = st.top = "0";
4405
a = {height: zero, points: {to:[b.x, b.bottom]}};
4408
st.right = st.bottom = "0";
4409
a = {width: zero, height: zero};
4412
st.right = st.top = "0";
4413
a = {width: zero, height: zero, points: {to:[b.x, b.bottom]}};
4416
st.left = st.top = "0";
4417
a = {width: zero, height: zero, points: {to:[b.x+b.width, b.bottom]}};
4420
st.left = st.bottom = "0";
4421
a = {width: zero, height: zero, points: {to:[b.right, b.y]}};
4425
arguments.callee.anim = wrap.fxanim(a,
4436
var el = this.getFxEl();
4439
el.queueFx(o, function(){
4440
this.clearOpacity();
4443
var r = this.getFxRestore();
4444
var st = this.dom.style;
4446
var after = function(){
4448
el.setDisplayed(false);
4455
el.setPositioning(r.pos);
4457
st.height = r.height;
4462
var width = this.getWidth();
4463
var height = this.getHeight();
4465
arguments.callee.anim = this.fxanim({
4466
width : {to: this.adjustWidth(width * 2)},
4467
height : {to: this.adjustHeight(height * 2)},
4468
points : {by: [-(width * .5), -(height * .5)]},
4470
fontSize: {to:200, unit: "%"}
4481
switchOff : function(o){
4482
var el = this.getFxEl();
4485
el.queueFx(o, function(){
4486
this.clearOpacity();
4489
var r = this.getFxRestore();
4490
var st = this.dom.style;
4492
var after = function(){
4494
el.setDisplayed(false);
4500
el.setPositioning(r.pos);
4502
st.height = r.height;
4507
this.fxanim({opacity:{to:0.3}}, null, null, .1, null, function(){
4508
this.clearOpacity();
4512
points:{by:[0, this.getHeight() * .5]}
4513
}, o, 'motion', 0.3, 'easeIn', after);
4514
}).defer(100, this);
4521
highlight : function(color, o){
4522
var el = this.getFxEl();
4525
el.queueFx(o, function(){
4526
color = color || "ffff9c";
4527
var attr = o.attr || "backgroundColor";
4529
this.clearOpacity();
4532
var origColor = this.getColor(attr);
4533
var restoreColor = this.dom.style[attr];
4534
var endColor = (o.endColor || origColor) || "ffffff";
4536
var after = function(){
4537
el.dom.style[attr] = restoreColor;
4542
a[attr] = {from: color, to: endColor};
4543
arguments.callee.anim = this.fxanim(a,
4553
frame : function(color, count, o){
4554
var el = this.getFxEl();
4557
el.queueFx(o, function(){
4558
color = color || "#C3DAF9";
4559
if(color.length == 6){
4560
color = "#" + color;
4563
var duration = o.duration || 1;
4566
var b = this.getBox();
4567
var animFn = function(){
4568
var proxy = Ext.getBody().createChild({
4571
position:"absolute",
4572
"z-index":"35000", border:"0px solid " + color
4575
var scale = Ext.isBorderBox ? 2 : 1;
4577
top:{from:b.y, to:b.y - 20},
4578
left:{from:b.x, to:b.x - 20},
4579
borderWidth:{from:0, to:10},
4580
opacity:{from:1, to:0},
4581
height:{from:b.height, to:(b.height + (20*scale))},
4582
width:{from:b.width, to:(b.width + (20*scale))}
4583
}, duration, function(){
4598
pause : function(seconds){
4599
var el = this.getFxEl();
4602
el.queueFx(o, function(){
4603
setTimeout(function(){
4611
fadeIn : function(o){
4612
var el = this.getFxEl();
4614
el.queueFx(o, function(){
4617
this.dom.style.visibility = 'visible';
4618
var to = o.endOpacity || 1;
4619
arguments.callee.anim = this.fxanim({opacity:{to:to}},
4620
o, null, .5, "easeOut", function(){
4622
this.clearOpacity();
4631
fadeOut : function(o){
4632
var el = this.getFxEl();
4634
el.queueFx(o, function(){
4635
arguments.callee.anim = this.fxanim({opacity:{to:o.endOpacity || 0}},
4636
o, null, .5, "easeOut", function(){
4637
if(this.visibilityMode == Ext.Element.DISPLAY || o.useDisplay){
4638
this.dom.style.display = "none";
4640
this.dom.style.visibility = "hidden";
4642
this.clearOpacity();
4650
scale : function(w, h, o){
4651
this.shift(Ext.apply({}, o, {
4659
shift : function(o){
4660
var el = this.getFxEl();
4662
el.queueFx(o, function(){
4663
var a = {}, w = o.width, h = o.height, x = o.x, y = o.y, op = o.opacity;
4664
if(w !== undefined){
4665
a.width = {to: this.adjustWidth(w)};
4667
if(h !== undefined){
4668
a.height = {to: this.adjustHeight(h)};
4670
if(o.left !== undefined){
4671
a.left = {to: o.left};
4673
if(o.top !== undefined){
4674
a.top = {to: o.top};
4676
if(o.right !== undefined){
4677
a.right = {to: o.right};
4679
if(o.bottom !== undefined){
4680
a.bottom = {to: o.bottom};
4682
if(x !== undefined || y !== undefined){
4684
x !== undefined ? x : this.getX(),
4685
y !== undefined ? y : this.getY()
4688
if(op !== undefined){
4689
a.opacity = {to: op};
4691
if(o.xy !== undefined){
4692
a.points = {to: o.xy};
4694
arguments.callee.anim = this.fxanim(a,
4695
o, 'motion', .35, "easeOut", function(){
4703
ghost : function(anchor, o){
4704
var el = this.getFxEl();
4707
el.queueFx(o, function(){
4708
anchor = anchor || "b";
4710
var r = this.getFxRestore();
4711
var w = this.getWidth(),
4712
h = this.getHeight();
4714
var st = this.dom.style;
4716
var after = function(){
4718
el.setDisplayed(false);
4724
el.setPositioning(r.pos);
4726
st.height = r.height;
4731
var a = {opacity: {to: 0}, points: {}}, pt = a.points;
4732
switch(anchor.toLowerCase()){
4759
arguments.callee.anim = this.fxanim(a,
4769
syncFx : function(){
4770
this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
4779
sequenceFx : function(){
4780
this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
4789
nextFx : function(){
4790
var ef = this.fxQueue[0];
4797
hasActiveFx : function(){
4798
return this.fxQueue && this.fxQueue[0];
4802
stopFx : function(){
4803
if(this.hasActiveFx()){
4804
var cur = this.fxQueue[0];
4805
if(cur && cur.anim && cur.anim.isAnimated()){
4806
this.fxQueue = [cur]; cur.anim.stop(true);
4813
beforeFx : function(o){
4814
if(this.hasActiveFx() && !o.concurrent){
4825
hasFxBlock : function(){
4826
var q = this.fxQueue;
4827
return q && q[0] && q[0].block;
4831
queueFx : function(o, fn){
4835
if(!this.hasFxBlock()){
4836
Ext.applyIf(o, this.fxDefaults);
4838
var run = this.beforeFx(o);
4840
this.fxQueue.push(fn);
4852
fxWrap : function(pos, o, vis){
4854
if(!o.wrap || !(wrap = Ext.get(o.wrap))){
4857
wrapXY = this.getXY();
4859
var div = document.createElement("div");
4860
div.style.visibility = vis;
4861
wrap = Ext.get(this.dom.parentNode.insertBefore(div, this.dom));
4862
wrap.setPositioning(pos);
4863
if(wrap.getStyle("position") == "static"){
4864
wrap.position("relative");
4866
this.clearPositioning('auto');
4868
wrap.dom.appendChild(this.dom);
4877
fxUnwrap : function(wrap, pos, o){
4878
this.clearPositioning();
4879
this.setPositioning(pos);
4881
wrap.dom.parentNode.insertBefore(this.dom, wrap.dom);
4887
getFxRestore : function(){
4888
var st = this.dom.style;
4889
return {pos: this.getPositioning(), width: st.width, height : st.height};
4893
afterFx : function(o){
4895
this.applyStyles(o.afterStyle);
4898
this.addClass(o.afterCls);
4900
if(o.remove === true){
4903
Ext.callback(o.callback, o.scope, [this]);
4905
this.fxQueue.shift();
4911
getFxEl : function(){ return Ext.get(this.dom);
4915
fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){
4916
animType = animType || 'run';
4918
var anim = Ext.lib.Anim[animType](
4920
(opt.duration || defaultDur) || .35,
4921
(opt.easing || defaultEase) || 'easeOut',
4923
Ext.callback(cb, this);
4932
Ext.Fx.resize = Ext.Fx.scale;
4934
Ext.apply(Ext.Element.prototype, Ext.Fx);
4937
Ext.CompositeElement = function(els){
4939
this.addElements(els);
4941
Ext.CompositeElement.prototype = {
4943
addElements : function(els){
4944
if(!els) return this;
4945
if(typeof els == "string"){
4946
els = Ext.Element.selectorFunction(els);
4948
var yels = this.elements;
4949
var index = yels.length-1;
4950
for(var i = 0, len = els.length; i < len; i++) {
4951
yels[++index] = Ext.get(els[i]);
4957
fill : function(els){
4964
filter : function(selector){
4966
this.each(function(el){
4967
if(el.is(selector)){
4968
els[els.length] = el.dom;
4975
invoke : function(fn, args){
4976
var els = this.elements;
4977
for(var i = 0, len = els.length; i < len; i++) {
4978
Ext.Element.prototype[fn].apply(els[i], args);
4983
add : function(els){
4984
if(typeof els == "string"){
4985
this.addElements(Ext.Element.selectorFunction(els));
4986
}else if(els.length !== undefined){
4987
this.addElements(els);
4989
this.addElements([els]);
4994
each : function(fn, scope){
4995
var els = this.elements;
4996
for(var i = 0, len = els.length; i < len; i++){
4997
if(fn.call(scope || els[i], els[i], this, i) === false) {
5005
item : function(index){
5006
return this.elements[index] || null;
5011
return this.item(0);
5016
return this.item(this.elements.length-1);
5020
getCount : function(){
5021
return this.elements.length;
5025
contains : function(el){
5026
return this.indexOf(el) !== -1;
5030
indexOf : function(el){
5031
return this.elements.indexOf(Ext.get(el));
5036
removeElement : function(el, removeDom){
5037
if(Ext.isArray(el)){
5038
for(var i = 0, len = el.length; i < len; i++){
5039
this.removeElement(el[i]);
5043
var index = typeof el == 'number' ? el : this.indexOf(el);
5044
if(index !== -1 && this.elements[index]){
5046
var d = this.elements[index];
5053
this.elements.splice(index, 1);
5059
replaceElement : function(el, replacement, domReplace){
5060
var index = typeof el == 'number' ? el : this.indexOf(el);
5063
this.elements[index].replaceWith(replacement);
5065
this.elements.splice(index, 1, Ext.get(replacement))
5077
Ext.CompositeElement.createCall = function(proto, fnName){
5079
proto[fnName] = function(){
5080
return this.invoke(fnName, arguments);
5084
for(var fnName in Ext.Element.prototype){
5085
if(typeof Ext.Element.prototype[fnName] == "function"){
5086
Ext.CompositeElement.createCall(Ext.CompositeElement.prototype, fnName);
5092
Ext.CompositeElementLite = function(els){
5093
Ext.CompositeElementLite.superclass.constructor.call(this, els);
5094
this.el = new Ext.Element.Flyweight();
5096
Ext.extend(Ext.CompositeElementLite, Ext.CompositeElement, {
5097
addElements : function(els){
5099
if(Ext.isArray(els)){
5100
this.elements = this.elements.concat(els);
5102
var yels = this.elements;
5103
var index = yels.length-1;
5104
for(var i = 0, len = els.length; i < len; i++) {
5105
yels[++index] = els[i];
5111
invoke : function(fn, args){
5112
var els = this.elements;
5114
for(var i = 0, len = els.length; i < len; i++) {
5116
Ext.Element.prototype[fn].apply(el, args);
5121
item : function(index){
5122
if(!this.elements[index]){
5125
this.el.dom = this.elements[index];
5130
addListener : function(eventName, handler, scope, opt){
5131
var els = this.elements;
5132
for(var i = 0, len = els.length; i < len; i++) {
5133
Ext.EventManager.on(els[i], eventName, handler, scope || els[i], opt);
5139
each : function(fn, scope){
5140
var els = this.elements;
5142
for(var i = 0, len = els.length; i < len; i++){
5144
if(fn.call(scope || el, el, this, i) === false){
5151
indexOf : function(el){
5152
return this.elements.indexOf(Ext.getDom(el));
5155
replaceElement : function(el, replacement, domReplace){
5156
var index = typeof el == 'number' ? el : this.indexOf(el);
5158
replacement = Ext.getDom(replacement);
5160
var d = this.elements[index];
5161
d.parentNode.insertBefore(replacement, d);
5164
this.elements.splice(index, 1, replacement);
5169
Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;
5171
Ext.Element.selectorFunction = Ext.DomQuery.select;
5174
Ext.Element.select = function(selector, unique, root){
5176
if(typeof selector == "string"){
5177
els = Ext.Element.selectorFunction(selector, root);
5178
}else if(selector.length !== undefined){
5181
throw "Invalid selector";
5183
if(unique === true){
5184
return new Ext.CompositeElement(els);
5186
return new Ext.CompositeElementLite(els);
5190
Ext.select = Ext.Element.select;
5192
Ext.data.Connection = function(config){
5193
Ext.apply(this, config);
5202
Ext.data.Connection.superclass.constructor.call(this);
5205
Ext.extend(Ext.data.Connection, Ext.util.Observable, {
5216
disableCaching: true,
5219
disableCachingParam: '_dc',
5223
request : function(o){
5224
if(this.fireEvent("beforerequest", this, o) !== false){
5227
if(typeof p == "function"){
5228
p = p.call(o.scope||window, o);
5230
if(typeof p == "object"){
5231
p = Ext.urlEncode(p);
5233
if(this.extraParams){
5234
var extras = Ext.urlEncode(this.extraParams);
5235
p = p ? (p + '&' + extras) : extras;
5238
var url = o.url || this.url;
5239
if(typeof url == 'function'){
5240
url = url.call(o.scope||window, o);
5244
var form = Ext.getDom(o.form);
5245
url = url || form.action;
5247
var enctype = form.getAttribute("enctype");
5248
if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){
5249
return this.doFormUpload(o, p, url);
5251
var f = Ext.lib.Ajax.serializeForm(form);
5252
p = p ? (p + '&' + f) : f;
5256
if(this.defaultHeaders){
5257
hs = Ext.apply(hs || {}, this.defaultHeaders);
5264
success: this.handleResponse,
5265
failure: this.handleFailure,
5267
argument: {options: o},
5268
timeout : o.timeout || this.timeout
5271
var method = o.method||this.method||((p || o.xmlData || o.jsonData) ? "POST" : "GET");
5273
if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){
5274
var dcp = o.disableCachingParam || this.disableCachingParam;
5275
url += (url.indexOf('?') != -1 ? '&' : '?') + dcp + '=' + (new Date().getTime());
5278
if(typeof o.autoAbort == 'boolean'){ if(o.autoAbort){
5281
}else if(this.autoAbort !== false){
5284
if((method == 'GET' || o.xmlData || o.jsonData) && p){
5285
url += (url.indexOf('?') != -1 ? '&' : '?') + p;
5288
this.transId = Ext.lib.Ajax.request(method, url, cb, p, o);
5289
return this.transId;
5291
Ext.callback(o.callback, o.scope, [o, null, null]);
5297
isLoading : function(transId){
5299
return Ext.lib.Ajax.isCallInProgress(transId);
5301
return this.transId ? true : false;
5306
abort : function(transId){
5307
if(transId || this.isLoading()){
5308
Ext.lib.Ajax.abort(transId || this.transId);
5312
handleResponse : function(response){
5313
this.transId = false;
5314
var options = response.argument.options;
5315
response.argument = options ? options.argument : null;
5316
this.fireEvent("requestcomplete", this, response, options);
5317
Ext.callback(options.success, options.scope, [response, options]);
5318
Ext.callback(options.callback, options.scope, [options, true, response]);
5321
handleFailure : function(response, e){
5322
this.transId = false;
5323
var options = response.argument.options;
5324
response.argument = options ? options.argument : null;
5325
this.fireEvent("requestexception", this, response, options, e);
5326
Ext.callback(options.failure, options.scope, [response, options]);
5327
Ext.callback(options.callback, options.scope, [options, false, response]);
5330
doFormUpload : function(o, ps, url){
5332
var frame = document.createElement('iframe');
5335
frame.className = 'x-hidden';
5337
frame.src = Ext.SSL_SECURE_URL;
5339
document.body.appendChild(frame);
5342
document.frames[id].name = id;
5345
var form = Ext.getDom(o.form);
5347
form.method = 'POST';
5348
form.enctype = form.encoding = 'multipart/form-data';
5354
if(ps){ hiddens = [];
5355
ps = Ext.urlDecode(ps, false);
5357
if(ps.hasOwnProperty(k)){
5358
hd = document.createElement('input');
5362
form.appendChild(hd);
5369
var r = { responseText : '',
5373
r.argument = o ? o.argument : null;
5377
doc = frame.contentWindow.document;
5379
doc = (frame.contentDocument || window.frames[id].document);
5381
if(doc && doc.body){
5382
r.responseText = doc.body.innerHTML;
5384
if(doc && doc.XMLDocument){
5385
r.responseXML = doc.XMLDocument;
5387
r.responseXML = doc;
5393
Ext.EventManager.removeListener(frame, 'load', cb, this);
5395
this.fireEvent("requestcomplete", this, r, o);
5397
Ext.callback(o.success, o.scope, [r, o]);
5398
Ext.callback(o.callback, o.scope, [o, true, r]);
5400
setTimeout(function(){Ext.removeNode(frame);}, 100);
5403
Ext.EventManager.on(frame, 'load', cb, this);
5406
if(hiddens){ for(var i = 0, len = hiddens.length; i < len; i++){
5407
Ext.removeNode(hiddens[i]);
5414
Ext.Ajax = new Ext.data.Connection({
5435
serializeForm : function(form){
5436
return Ext.lib.Ajax.serializeForm(form);
5440
Ext.Updater = Ext.extend(Ext.util.Observable, {
5441
constructor: function(el, forceNew){
5443
if(!forceNew && el.updateManager){
5444
return el.updateManager;
5449
this.defaultUrl = null;
5459
var d = Ext.Updater.defaults;
5461
this.sslBlankUrl = d.sslBlankUrl;
5463
this.disableCaching = d.disableCaching;
5465
this.indicatorText = d.indicatorText;
5467
this.showLoadIndicator = d.showLoadIndicator;
5469
this.timeout = d.timeout;
5471
this.loadScripts = d.loadScripts;
5473
this.transaction = null;
5475
this.refreshDelegate = this.refresh.createDelegate(this);
5477
this.updateDelegate = this.update.createDelegate(this);
5479
this.formUpdateDelegate = this.formUpdate.createDelegate(this);
5483
this.renderer = this.getDefaultRenderer();
5485
Ext.Updater.superclass.constructor.call(this);
5488
getDefaultRenderer: function() {
5489
return new Ext.Updater.BasicRenderer();
5497
update : function(url, params, callback, discardUrl){
5498
if(this.fireEvent("beforeupdate", this.el, url, params) !== false){
5499
var cfg, callerScope;
5500
if(typeof url == "object"){ cfg = url;
5502
params = params || cfg.params;
5503
callback = callback || cfg.callback;
5504
discardUrl = discardUrl || cfg.discardUrl;
5505
callerScope = cfg.scope;
5506
if(typeof cfg.nocache != "undefined"){this.disableCaching = cfg.nocache;};
5507
if(typeof cfg.text != "undefined"){this.indicatorText = '<div class="loading-indicator">'+cfg.text+"</div>";};
5508
if(typeof cfg.scripts != "undefined"){this.loadScripts = cfg.scripts;};
5509
if(typeof cfg.timeout != "undefined"){this.timeout = cfg.timeout;};
5514
this.defaultUrl = url;
5516
if(typeof url == "function"){
5517
url = url.call(this);
5520
var o = Ext.apply({}, {
5522
params: (typeof params == "function" && callerScope) ? params.createDelegate(callerScope) : params,
5523
success: this.processSuccess,
5524
failure: this.processFailure,
5526
callback: undefined,
5527
timeout: (this.timeout*1000),
5528
disableCaching: this.disableCaching,
5533
"callback": callback,
5534
"scope": callerScope || window,
5539
this.transaction = Ext.Ajax.request(o);
5544
formUpdate : function(form, url, reset, callback){
5545
if(this.fireEvent("beforeupdate", this.el, form, url) !== false){
5546
if(typeof url == "function"){
5547
url = url.call(this);
5549
form = Ext.getDom(form)
5550
this.transaction = Ext.Ajax.request({
5553
success: this.processSuccess,
5554
failure: this.processFailure,
5556
timeout: (this.timeout*1000),
5560
"callback": callback,
5564
this.showLoading.defer(1, this);
5569
refresh : function(callback){
5570
if(this.defaultUrl == null){
5573
this.update(this.defaultUrl, null, callback, true);
5577
startAutoRefresh : function(interval, url, params, callback, refreshNow){
5579
this.update(url || this.defaultUrl, params, callback, true);
5581
if(this.autoRefreshProcId){
5582
clearInterval(this.autoRefreshProcId);
5584
this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000);
5588
stopAutoRefresh : function(){
5589
if(this.autoRefreshProcId){
5590
clearInterval(this.autoRefreshProcId);
5591
delete this.autoRefreshProcId;
5596
isAutoRefreshing : function(){
5597
return this.autoRefreshProcId ? true : false;
5601
showLoading : function(){
5602
if(this.showLoadIndicator){
5603
this.el.update(this.indicatorText);
5607
processSuccess : function(response){
5608
this.transaction = null;
5609
if(response.argument.form && response.argument.reset){
5610
try{ response.argument.form.reset();
5613
if(this.loadScripts){
5614
this.renderer.render(this.el, response, this,
5615
this.updateComplete.createDelegate(this, [response]));
5617
this.renderer.render(this.el, response, this);
5618
this.updateComplete(response);
5622
updateComplete : function(response){
5623
this.fireEvent("update", this.el, response);
5624
if(typeof response.argument.callback == "function"){
5625
response.argument.callback.call(response.argument.scope, this.el, true, response, response.argument.options);
5629
processFailure : function(response){
5630
this.transaction = null;
5631
this.fireEvent("failure", this.el, response);
5632
if(typeof response.argument.callback == "function"){
5633
response.argument.callback.call(response.argument.scope, this.el, false, response, response.argument.options);
5638
setRenderer : function(renderer){
5639
this.renderer = renderer;
5643
getRenderer : function(){
5644
return this.renderer;
5648
setDefaultUrl : function(defaultUrl){
5649
this.defaultUrl = defaultUrl;
5654
if(this.transaction){
5655
Ext.Ajax.abort(this.transaction);
5660
isUpdating : function(){
5661
if(this.transaction){
5662
return Ext.Ajax.isLoading(this.transaction);
5669
Ext.Updater.defaults = {
5673
loadScripts : false,
5675
sslBlankUrl : (Ext.SSL_SECURE_URL || "javascript:false"),
5677
disableCaching : false,
5679
showLoadIndicator : true,
5681
indicatorText : '<div class="loading-indicator">Loading...</div>'
5685
Ext.Updater.updateElement = function(el, url, params, options){
5686
var um = Ext.get(el).getUpdater();
5687
Ext.apply(um, options);
5688
um.update(url, params, options ? options.callback : null);
5691
Ext.Updater.BasicRenderer = function(){};
5693
Ext.Updater.BasicRenderer.prototype = {
5695
render : function(el, response, updateManager, callback){
5696
el.update(response.responseText, updateManager.loadScripts, callback);
5700
Ext.UpdateManager = Ext.Updater;
5707
Date.formatCodeToRegex = function(character, currentGroup) {
5708
var p = Date.parseCodes[character];
5711
p = Ext.type(p) == 'function'? p() : p;
5712
Date.parseCodes[character] = p; }
5714
return p? Ext.applyIf({
5715
c: p.c? String.format(p.c, currentGroup || "{0}") : p.c
5719
s:Ext.escapeRe(character) }
5722
var $f = Date.formatCodeToRegex;
5725
parseFunctions: {count:0},
5727
formatFunctions: {count:0},
5728
daysInMonth : [31,28,31,30,31,30,31,31,30,31,30,31],
5796
getShortMonthName : function(month) {
5797
return Date.monthNames[month].substring(0, 3);
5801
getShortDayName : function(day) {
5802
return Date.dayNames[day].substring(0, 3);
5806
getMonthNumber : function(name) {
5807
return Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
5812
d: "String.leftPad(this.getDate(), 2, '0')",
5813
D: "Date.getShortDayName(this.getDay())", j: "this.getDate()",
5814
l: "Date.dayNames[this.getDay()]",
5815
N: "(this.getDay() ? this.getDay() : 7)",
5816
S: "this.getSuffix()",
5818
z: "this.getDayOfYear()",
5819
W: "String.leftPad(this.getWeekOfYear(), 2, '0')",
5820
F: "Date.monthNames[this.getMonth()]",
5821
m: "String.leftPad(this.getMonth() + 1, 2, '0')",
5822
M: "Date.getShortMonthName(this.getMonth())", n: "(this.getMonth() + 1)",
5823
t: "this.getDaysInMonth()",
5824
L: "(this.isLeapYear() ? 1 : 0)",
5825
o: "(this.getFullYear() + (this.getWeekOfYear() == 1 && this.getMonth() > 0 ? +1 : (this.getWeekOfYear() >= 52 && this.getMonth() < 11 ? -1 : 0)))",
5826
Y: "this.getFullYear()",
5827
y: "('' + this.getFullYear()).substring(2, 4)",
5828
a: "(this.getHours() < 12 ? 'am' : 'pm')",
5829
A: "(this.getHours() < 12 ? 'AM' : 'PM')",
5830
g: "((this.getHours() % 12) ? this.getHours() % 12 : 12)",
5831
G: "this.getHours()",
5832
h: "String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0')",
5833
H: "String.leftPad(this.getHours(), 2, '0')",
5834
i: "String.leftPad(this.getMinutes(), 2, '0')",
5835
s: "String.leftPad(this.getSeconds(), 2, '0')",
5836
u: "String.leftPad(this.getMilliseconds(), 3, '0')",
5837
O: "this.getGMTOffset()",
5838
P: "this.getGMTOffset(true)",
5839
T: "this.getTimezone()",
5840
Z: "(this.getTimezoneOffset() * -60)",
5841
c: function() { for (var c = "Y-m-dTH:i:sP", code = [], i = 0, l = c.length; i < l; ++i) {
5842
var e = c.charAt(i);
5843
code.push(e == "T" ? "'T'" : Date.getFormatCode(e)); }
5844
return code.join(" + ");
5847
U: "Math.round(this.getTime() / 1000)"
5851
parseDate : function(input, format) {
5852
var p = Date.parseFunctions;
5853
if (p[format] == null) {
5854
Date.createParser(format);
5856
var func = p[format];
5857
return Date[func](input);
5860
getFormatCode : function(character) {
5861
var f = Date.formatCodes[character];
5864
f = Ext.type(f) == 'function'? f() : f;
5865
Date.formatCodes[character] = f; }
5867
return f || ("'" + String.escape(character) + "'");
5870
createNewFormat : function(format) {
5871
var funcName = "format" + Date.formatFunctions.count++;
5872
Date.formatFunctions[format] = funcName;
5873
var code = "Date.prototype." + funcName + " = function(){return ";
5874
var special = false;
5876
for (var i = 0; i < format.length; ++i) {
5877
ch = format.charAt(i);
5878
if (!special && ch == "\\") {
5883
code += "'" + String.escape(ch) + "' + ";
5886
code += Date.getFormatCode(ch) + " + ";
5889
eval(code.substring(0, code.length - 3) + ";}");
5892
createParser : function(format) {
5893
var funcName = "parse" + Date.parseFunctions.count++;
5894
var regexNum = Date.parseRegexes.length;
5895
var currentGroup = 1;
5896
Date.parseFunctions[format] = funcName;
5898
var code = "Date." + funcName + " = function(input){\n"
5899
+ "var y, m, d, h = 0, i = 0, s = 0, ms = 0, o, z, u, v;\n"
5900
+ "input = String(input);\n"
5901
+ "d = new Date();\n"
5902
+ "y = d.getFullYear();\n"
5903
+ "m = d.getMonth();\n"
5904
+ "d = d.getDate();\n"
5905
+ "var results = input.match(Date.parseRegexes[" + regexNum + "]);\n"
5906
+ "if (results && results.length > 0) {";
5909
var special = false;
5911
for (var i = 0; i < format.length; ++i) {
5912
ch = format.charAt(i);
5913
if (!special && ch == "\\") {
5918
regex += String.escape(ch);
5921
var obj = Date.formatCodeToRegex(ch, currentGroup);
5922
currentGroup += obj.g;
5924
if (obj.g && obj.c) {
5931
+ "v = new Date(u * 1000);\n" + "}else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0 && ms >= 0){\n"
5932
+ "v = new Date(y, m, d, h, i, s, ms);\n"
5933
+ "}else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0){\n"
5934
+ "v = new Date(y, m, d, h, i, s);\n"
5935
+ "}else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0){\n"
5936
+ "v = new Date(y, m, d, h, i);\n"
5937
+ "}else if (y >= 0 && m >= 0 && d > 0 && h >= 0){\n"
5938
+ "v = new Date(y, m, d, h);\n"
5939
+ "}else if (y >= 0 && m >= 0 && d > 0){\n"
5940
+ "v = new Date(y, m, d);\n"
5941
+ "}else if (y >= 0 && m >= 0){\n"
5942
+ "v = new Date(y, m);\n"
5943
+ "}else if (y >= 0){\n"
5944
+ "v = new Date(y);\n"
5945
+ "}\n}\nreturn (v && (z || o))?" + " (Ext.type(z) == 'number' ? v.add(Date.SECOND, -v.getTimezoneOffset() * 60 - z) :" + " v.add(Date.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn))) : v;\n" + "}";
5947
Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$", "i");
5955
c:"d = parseInt(results[{0}], 10);\n",
5959
c:"d = parseInt(results[{0}], 10);\n",
5962
for (var a = [], i = 0; i < 7; a.push(Date.getShortDayName(i)), ++i); return {
5965
s:"(?:" + a.join("|") +")"
5972
s:"(?:" + Date.dayNames.join("|") + ")"
5999
c:"m = parseInt(Date.getMonthNumber(results[{0}]), 10);\n", s:"(" + Date.monthNames.join("|") + ")"
6003
for (var a = [], i = 0; i < 12; a.push(Date.getShortMonthName(i)), ++i); return Ext.applyIf({
6004
s:"(" + a.join("|") + ")"
6009
c:"m = parseInt(results[{0}], 10) - 1;\n",
6013
c:"m = parseInt(results[{0}], 10) - 1;\n",
6029
c:"y = parseInt(results[{0}], 10);\n",
6033
c:"var ty = parseInt(results[{0}], 10);\n"
6034
+ "y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n", s:"(\\d{1,2})"
6038
c:"if (results[{0}] == 'am') {\n"
6039
+ "if (h == 12) { h = 0; }\n"
6040
+ "} else { if (h < 12) { h += 12; }}",
6045
c:"if (results[{0}] == 'AM') {\n"
6046
+ "if (h == 12) { h = 0; }\n"
6047
+ "} else { if (h < 12) { h += 12; }}",
6055
c:"h = parseInt(results[{0}], 10);\n",
6062
c:"h = parseInt(results[{0}], 10);\n",
6066
c:"i = parseInt(results[{0}], 10);\n",
6070
c:"s = parseInt(results[{0}], 10);\n",
6074
c:"ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n",
6079
"o = results[{0}];",
6080
"var sn = o.substring(0,1);", "var hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60);", "var mn = o.substring(3,5) % 60;", "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n" ].join("\n"),
6081
s: "([+\-]\\d{4})" },
6085
"o = results[{0}];",
6086
"var sn = o.substring(0,1);", "var hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60);", "var mn = o.substring(4,6) % 60;", "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n" ].join("\n"),
6087
s: "([+\-]\\d{2}:\\d{2})" },
6094
c:"z = results[{0}] * 1;\n" + "z = (-43200 <= z && z <= 50400)? z : null;\n",
6095
s:"([+\-]?\\d{1,5})" },
6099
$f("Y", 1), $f("m", 2), $f("d", 3), $f("h", 4), $f("i", 5), $f("s", 6), {c:"ms = (results[7] || '.0').substring(1); ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n"}, {c:"if(results[9] == 'Z'){\no = 0;\n}else{\n" + $f("P", 9).c + "\n}"} ];
6100
for (var i = 0, l = arr.length; i < l; ++i) {
6101
calc.push(arr[i].c);
6107
s:arr[0].s + "-" + arr[1].s + "-" + arr[2].s + "T" + arr[3].s + ":" + arr[4].s + ":" + arr[5].s
6108
+ "((\.|,)\\d+)?" + "(" + $f("P", null).s + "|Z)" }
6112
c:"u = parseInt(results[{0}], 10);\n",
6119
Ext.override(Date, {
6120
dateFormat : function(format) {
6121
if (Date.formatFunctions[format] == null) {
6122
Date.createNewFormat(format);
6124
var func = Date.formatFunctions[format];
6125
return this[func]();
6129
getTimezone : function() {
6130
return this.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");
6134
getGMTOffset : function(colon) {
6135
return (this.getTimezoneOffset() > 0 ? "-" : "+")
6136
+ String.leftPad(Math.abs(Math.floor(this.getTimezoneOffset() / 60)), 2, "0")
6137
+ (colon ? ":" : "")
6138
+ String.leftPad(Math.abs(this.getTimezoneOffset() % 60), 2, "0");
6142
getDayOfYear : function() {
6144
Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;
6145
for (var i = 0; i < this.getMonth(); ++i) {
6146
num += Date.daysInMonth[i];
6148
return num + this.getDate() - 1;
6152
getWeekOfYear : function() {
6153
var ms1d = 864e5; var ms7d = 7 * ms1d; var DC3 = Date.UTC(this.getFullYear(), this.getMonth(), this.getDate() + 3) / ms1d; var AWN = Math.floor(DC3 / 7); var Wyr = new Date(AWN * ms7d).getUTCFullYear();
6154
return AWN - Math.floor(Date.UTC(Wyr, 0, 7) / ms7d) + 1;
6158
isLeapYear : function() {
6159
var year = this.getFullYear();
6160
return !!((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
6164
getFirstDayOfMonth : function() {
6165
var day = (this.getDay() - (this.getDate() - 1)) % 7;
6166
return (day < 0) ? (day + 7) : day;
6170
getLastDayOfMonth : function() {
6171
var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7;
6172
return (day < 0) ? (day + 7) : day;
6177
getFirstDateOfMonth : function() {
6178
return new Date(this.getFullYear(), this.getMonth(), 1);
6182
getLastDateOfMonth : function() {
6183
return new Date(this.getFullYear(), this.getMonth(), this.getDaysInMonth());
6187
getDaysInMonth : function() {
6188
Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;
6189
return Date.daysInMonth[this.getMonth()];
6193
getSuffix : function() {
6194
switch (this.getDate()) {
6211
clone : function() {
6212
return new Date(this.getTime());
6216
clearTime : function(clone){
6218
return this.clone().clearTime();
6223
this.setMilliseconds(0);
6228
add : function(interval, value){
6229
var d = this.clone();
6230
if (!interval || value === 0) return d;
6232
switch(interval.toLowerCase()){
6234
d.setMilliseconds(this.getMilliseconds() + value);
6237
d.setSeconds(this.getSeconds() + value);
6240
d.setMinutes(this.getMinutes() + value);
6243
d.setHours(this.getHours() + value);
6246
d.setDate(this.getDate() + value);
6249
var day = this.getDate();
6251
day = Math.min(day, this.getFirstDateOfMonth().add('mo', value).getLastDateOfMonth().getDate());
6254
d.setMonth(this.getMonth() + value);
6257
d.setFullYear(this.getFullYear() + value);
6264
between : function(start, end){
6265
var t = this.getTime();
6266
return start.getTime() <= t && t <= end.getTime();
6272
Date.prototype.format = Date.prototype.dateFormat;
6276
Date.brokenSetMonth = Date.prototype.setMonth;
6277
Date.prototype.setMonth = function(num){
6279
var n = Math.ceil(-num);
6280
var back_year = Math.ceil(n/12);
6281
var month = (n % 12) ? 12 - n % 12 : 0 ;
6282
this.setFullYear(this.getFullYear() - back_year);
6283
return Date.brokenSetMonth.call(this, month);
6285
return Date.brokenSetMonth.apply(this, arguments);
6290
Ext.util.DelayedTask = function(fn, scope, args){
6291
var id = null, d, t;
6293
var call = function(){
6294
var now = new Date().getTime();
6298
fn.apply(scope, args || []);
6302
this.delay = function(delay, newFn, newScope, newArgs){
6303
if(id && delay != d){
6307
t = new Date().getTime();
6309
scope = newScope || scope;
6310
args = newArgs || args;
6312
id = setInterval(call, d);
6317
this.cancel = function(){
6325
Ext.util.TaskRunner = function(interval){
6326
interval = interval || 10;
6327
var tasks = [], removeQueue = [];
6329
var running = false;
6331
var stopThread = function(){
6337
var startThread = function(){
6340
id = setInterval(runTasks, interval);
6344
var removeTask = function(t){
6345
removeQueue.push(t);
6347
t.onStop.apply(t.scope || t);
6351
var runTasks = function(){
6352
if(removeQueue.length > 0){
6353
for(var i = 0, len = removeQueue.length; i < len; i++){
6354
tasks.remove(removeQueue[i]);
6357
if(tasks.length < 1){
6362
var now = new Date().getTime();
6363
for(var i = 0, len = tasks.length; i < len; ++i){
6365
var itime = now - t.taskRunTime;
6366
if(t.interval <= itime){
6367
var rt = t.run.apply(t.scope || t, t.args || [++t.taskRunCount]);
6368
t.taskRunTime = now;
6369
if(rt === false || t.taskRunCount === t.repeat){
6374
if(t.duration && t.duration <= (now - t.taskStartTime)){
6381
this.start = function(task){
6383
task.taskStartTime = new Date().getTime();
6384
task.taskRunTime = 0;
6385
task.taskRunCount = 0;
6391
this.stop = function(task){
6397
this.stopAll = function(){
6399
for(var i = 0, len = tasks.length; i < len; i++){
6400
if(tasks[i].onStop){
6410
Ext.TaskMgr = new Ext.util.TaskRunner();
6412
Ext.util.MixedCollection = function(allowFunctions, keyFn){
6428
this.allowFunctions = allowFunctions === true;
6430
this.getKey = keyFn;
6432
Ext.util.MixedCollection.superclass.constructor.call(this);
6435
Ext.extend(Ext.util.MixedCollection, Ext.util.Observable, {
6436
allowFunctions : false,
6439
add : function(key, o){
6440
if(arguments.length == 1){
6442
key = this.getKey(o);
6444
if(typeof key == "undefined" || key === null){
6447
this.keys.push(null);
6449
var old = this.map[key];
6451
return this.replace(key, o);
6456
this.keys.push(key);
6458
this.fireEvent("add", this.length-1, o, key);
6463
getKey : function(o){
6468
replace : function(key, o){
6469
if(arguments.length == 1){
6471
key = this.getKey(o);
6473
var old = this.item(key);
6474
if(typeof key == "undefined" || key === null || typeof old == "undefined"){
6475
return this.add(key, o);
6477
var index = this.indexOfKey(key);
6478
this.items[index] = o;
6480
this.fireEvent("replace", key, old, o);
6485
addAll : function(objs){
6486
if(arguments.length > 1 || Ext.isArray(objs)){
6487
var args = arguments.length > 1 ? arguments : objs;
6488
for(var i = 0, len = args.length; i < len; i++){
6492
for(var key in objs){
6493
if(this.allowFunctions || typeof objs[key] != "function"){
6494
this.add(key, objs[key]);
6501
each : function(fn, scope){
6502
var items = [].concat(this.items); for(var i = 0, len = items.length; i < len; i++){
6503
if(fn.call(scope || items[i], items[i], i, len) === false){
6510
eachKey : function(fn, scope){
6511
for(var i = 0, len = this.keys.length; i < len; i++){
6512
fn.call(scope || window, this.keys[i], this.items[i], i, len);
6517
find : function(fn, scope){
6518
for(var i = 0, len = this.items.length; i < len; i++){
6519
if(fn.call(scope || window, this.items[i], this.keys[i])){
6520
return this.items[i];
6527
insert : function(index, key, o){
6528
if(arguments.length == 2){
6530
key = this.getKey(o);
6532
if(index >= this.length){
6533
return this.add(key, o);
6536
this.items.splice(index, 0, o);
6537
if(typeof key != "undefined" && key != null){
6540
this.keys.splice(index, 0, key);
6541
this.fireEvent("add", index, o, key);
6546
remove : function(o){
6547
return this.removeAt(this.indexOf(o));
6551
removeAt : function(index){
6552
if(index < this.length && index >= 0){
6554
var o = this.items[index];
6555
this.items.splice(index, 1);
6556
var key = this.keys[index];
6557
if(typeof key != "undefined"){
6558
delete this.map[key];
6560
this.keys.splice(index, 1);
6561
this.fireEvent("remove", o, key);
6568
removeKey : function(key){
6569
return this.removeAt(this.indexOfKey(key));
6573
getCount : function(){
6578
indexOf : function(o){
6579
return this.items.indexOf(o);
6583
indexOfKey : function(key){
6584
return this.keys.indexOf(key);
6588
item : function(key){
6589
var item = typeof this.map[key] != "undefined" ? this.map[key] : this.items[key];
6590
return typeof item != 'function' || this.allowFunctions ? item : null; },
6593
itemAt : function(index){
6594
return this.items[index];
6598
key : function(key){
6599
return this.map[key];
6603
contains : function(o){
6604
return this.indexOf(o) != -1;
6608
containsKey : function(key){
6609
return typeof this.map[key] != "undefined";
6618
this.fireEvent("clear");
6623
return this.items[0];
6628
return this.items[this.length-1];
6631
_sort : function(property, dir, fn){
6632
var dsc = String(dir).toUpperCase() == "DESC" ? -1 : 1;
6633
fn = fn || function(a, b){
6636
var c = [], k = this.keys, items = this.items;
6637
for(var i = 0, len = items.length; i < len; i++){
6638
c[c.length] = {key: k[i], value: items[i], index: i};
6640
c.sort(function(a, b){
6641
var v = fn(a[property], b[property]) * dsc;
6643
v = (a.index < b.index ? -1 : 1);
6647
for(var i = 0, len = c.length; i < len; i++){
6648
items[i] = c[i].value;
6651
this.fireEvent("sort", this);
6655
sort : function(dir, fn){
6656
this._sort("value", dir, fn);
6660
keySort : function(dir, fn){
6661
this._sort("key", dir, fn || function(a, b){
6662
return String(a).toUpperCase()-String(b).toUpperCase();
6667
getRange : function(start, end){
6668
var items = this.items;
6669
if(items.length < 1){
6673
end = Math.min(typeof end == "undefined" ? this.length-1 : end, this.length-1);
6676
for(var i = start; i <= end; i++) {
6677
r[r.length] = items[i];
6680
for(var i = start; i >= end; i--) {
6681
r[r.length] = items[i];
6688
filter : function(property, value, anyMatch, caseSensitive){
6689
if(Ext.isEmpty(value, false)){
6690
return this.clone();
6692
value = this.createValueMatcher(value, anyMatch, caseSensitive);
6693
return this.filterBy(function(o){
6694
return o && value.test(o[property]);
6699
filterBy : function(fn, scope){
6700
var r = new Ext.util.MixedCollection();
6701
r.getKey = this.getKey;
6702
var k = this.keys, it = this.items;
6703
for(var i = 0, len = it.length; i < len; i++){
6704
if(fn.call(scope||this, it[i], k[i])){
6712
findIndex : function(property, value, start, anyMatch, caseSensitive){
6713
if(Ext.isEmpty(value, false)){
6716
value = this.createValueMatcher(value, anyMatch, caseSensitive);
6717
return this.findIndexBy(function(o){
6718
return o && value.test(o[property]);
6723
findIndexBy : function(fn, scope, start){
6724
var k = this.keys, it = this.items;
6725
for(var i = (start||0), len = it.length; i < len; i++){
6726
if(fn.call(scope||this, it[i], k[i])){
6730
if(typeof start == 'number' && start > 0){
6731
for(var i = 0; i < start; i++){
6732
if(fn.call(scope||this, it[i], k[i])){
6740
createValueMatcher : function(value, anyMatch, caseSensitive){
6741
if(!value.exec){ value = String(value);
6742
value = new RegExp((anyMatch === true ? '' : '^') + Ext.escapeRe(value), caseSensitive ? '' : 'i');
6749
var r = new Ext.util.MixedCollection();
6750
var k = this.keys, it = this.items;
6751
for(var i = 0, len = it.length; i < len; i++){
6754
r.getKey = this.getKey;
6759
Ext.util.MixedCollection.prototype.get = Ext.util.MixedCollection.prototype.item;
6761
Ext.util.JSON = new (function(){
6762
var useHasOwn = !!{}.hasOwnProperty;
6765
var pad = function(n) {
6766
return n < 10 ? "0" + n : n;
6779
var encodeString = function(s){
6780
if (/["\\\x00-\x1f]/.test(s)) {
6781
return '"' + s.replace(/([\x00-\x1f\\"])/g, function(a, b) {
6788
Math.floor(c / 16).toString(16) +
6789
(c % 16).toString(16);
6792
return '"' + s + '"';
6795
var encodeArray = function(o){
6796
var a = ["["], b, i, l = o.length, v;
6797
for (i = 0; i < l; i += 1) {
6808
a.push(v === null ? "null" : Ext.util.JSON.encode(v));
6816
this.encodeDate = function(o){
6817
return '"' + o.getFullYear() + "-" +
6818
pad(o.getMonth() + 1) + "-" +
6819
pad(o.getDate()) + "T" +
6820
pad(o.getHours()) + ":" +
6821
pad(o.getMinutes()) + ":" +
6822
pad(o.getSeconds()) + '"';
6826
this.encode = function(o){
6827
if(typeof o == "undefined" || o === null){
6829
}else if(Ext.isArray(o)){
6830
return encodeArray(o);
6831
}else if(Ext.isDate(o)){
6832
return Ext.util.JSON.encodeDate(o);
6833
}else if(typeof o == "string"){
6834
return encodeString(o);
6835
}else if(typeof o == "number"){
6836
return isFinite(o) ? String(o) : "null";
6837
}else if(typeof o == "boolean"){
6840
var a = ["{"], b, i, v;
6842
if(!useHasOwn || o.hasOwnProperty(i)) {
6853
a.push(this.encode(i), ":",
6854
v === null ? "null" : this.encode(v));
6865
this.decode = function(json){
6866
return eval("(" + json + ')');
6870
Ext.encode = Ext.util.JSON.encode;
6872
Ext.decode = Ext.util.JSON.decode;
6875
Ext.util.Format = function(){
6876
var trimRe = /^\s+|\s+$/g;
6879
ellipsis : function(value, len){
6880
if(value && value.length > len){
6881
return value.substr(0, len-3)+"...";
6887
undef : function(value){
6888
return value !== undefined ? value : "";
6892
defaultValue : function(value, defaultValue){
6893
return value !== undefined && value !== '' ? value : defaultValue;
6897
htmlEncode : function(value){
6898
return !value ? value : String(value).replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """);
6902
htmlDecode : function(value){
6903
return !value ? value : String(value).replace(/>/g, ">").replace(/</g, "<").replace(/"/g, '"').replace(/&/g, "&");
6907
trim : function(value){
6908
return String(value).replace(trimRe, "");
6912
substr : function(value, start, length){
6913
return String(value).substr(start, length);
6917
lowercase : function(value){
6918
return String(value).toLowerCase();
6922
uppercase : function(value){
6923
return String(value).toUpperCase();
6927
capitalize : function(value){
6928
return !value ? value : value.charAt(0).toUpperCase() + value.substr(1).toLowerCase();
6932
call : function(value, fn){
6933
if(arguments.length > 2){
6934
var args = Array.prototype.slice.call(arguments, 2);
6935
args.unshift(value);
6936
return eval(fn).apply(window, args);
6938
return eval(fn).call(window, value);
6943
usMoney : function(v){
6944
v = (Math.round((v-0)*100))/100;
6945
v = (v == Math.floor(v)) ? v + ".00" : ((v*10 == Math.floor(v*10)) ? v + "0" : v);
6947
var ps = v.split('.');
6949
var sub = ps[1] ? '.'+ ps[1] : '.00';
6950
var r = /(\d+)(\d{3})/;
6951
while (r.test(whole)) {
6952
whole = whole.replace(r, '$1' + ',' + '$2');
6955
if(v.charAt(0) == '-'){
6956
return '-$' + v.substr(1);
6962
date : function(v, format){
6967
v = new Date(Date.parse(v));
6969
return v.dateFormat(format || "m/d/Y");
6973
dateRenderer : function(format){
6975
return Ext.util.Format.date(v, format);
6980
stripTagsRE : /<\/?[^>]+>/gi,
6983
stripTags : function(v){
6984
return !v ? v : String(v).replace(this.stripTagsRE, "");
6987
stripScriptsRe : /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,
6990
stripScripts : function(v){
6991
return !v ? v : String(v).replace(this.stripScriptsRe, "");
6995
fileSize : function(size){
6997
return size + " bytes";
6998
} else if(size < 1048576) {
6999
return (Math.round(((size*10) / 1024))/10) + " KB";
7001
return (Math.round(((size*10) / 1048576))/10) + " MB";
7007
return function(v, a){
7009
fns[a] = new Function('v', 'return v ' + a + ';');
7015
nl2br : function(v){
7016
return v === undefined || v === null ? '' : v.replace(/\n/g, '<br/>');
7021
Ext.XTemplate = function(){
7022
Ext.XTemplate.superclass.constructor.apply(this, arguments);
7025
s = ['<tpl>', s, '</tpl>'].join('');
7027
var re = /<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/;
7029
var nameRe = /^<tpl\b[^>]*?for="(.*?)"/;
7030
var ifRe = /^<tpl\b[^>]*?if="(.*?)"/;
7031
var execRe = /^<tpl\b[^>]*?exec="(.*?)"/;
7035
while(m = s.match(re)){
7036
var m2 = m[0].match(nameRe);
7037
var m3 = m[0].match(ifRe);
7038
var m4 = m[0].match(execRe);
7039
var exp = null, fn = null, exec = null;
7040
var name = m2 && m2[1] ? m2[1] : '';
7042
exp = m3 && m3[1] ? m3[1] : null;
7044
fn = new Function('values', 'parent', 'xindex', 'xcount', 'with(values){ return '+(Ext.util.Format.htmlDecode(exp))+'; }');
7048
exp = m4 && m4[1] ? m4[1] : null;
7050
exec = new Function('values', 'parent', 'xindex', 'xcount', 'with(values){ '+(Ext.util.Format.htmlDecode(exp))+'; }');
7055
case '.': name = new Function('values', 'parent', 'with(values){ return values; }'); break;
7056
case '..': name = new Function('values', 'parent', 'with(values){ return parent; }'); break;
7057
default: name = new Function('values', 'parent', 'with(values){ return '+name+'; }');
7067
s = s.replace(m[0], '{xtpl'+ id + '}');
7070
for(var i = tpls.length-1; i >= 0; --i){
7071
this.compileTpl(tpls[i]);
7073
this.master = tpls[tpls.length-1];
7076
Ext.extend(Ext.XTemplate, Ext.Template, {
7077
re : /\{([\w-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\\]\s?[\d\.\+\-\*\\\(\)]+)?\}/g,
7078
codeRe : /\{\[((?:\\\]|.|\n)*?)\]\}/g,
7080
applySubTemplate : function(id, values, parent, xindex, xcount){
7081
var t = this.tpls[id];
7082
if(t.test && !t.test.call(this, values, parent, xindex, xcount)){
7085
if(t.exec && t.exec.call(this, values, parent, xindex, xcount)){
7088
var vs = t.target ? t.target.call(this, values, parent) : values;
7089
parent = t.target ? values : parent;
7090
if(t.target && Ext.isArray(vs)){
7092
for(var i = 0, len = vs.length; i < len; i++){
7093
buf[buf.length] = t.compiled.call(this, vs[i], parent, i+1, len);
7095
return buf.join('');
7097
return t.compiled.call(this, vs, parent, xindex, xcount);
7100
compileTpl : function(tpl){
7101
var fm = Ext.util.Format;
7102
var useF = this.disableFormats !== true;
7103
var sep = Ext.isGecko ? "+" : ",";
7104
var fn = function(m, name, format, args, math){
7105
if(name.substr(0, 4) == 'xtpl'){
7106
return "'"+ sep +'this.applySubTemplate('+name.substr(4)+', values, parent, xindex, xcount)'+sep+"'";
7111
}else if(name === '#'){
7113
}else if(name.indexOf('.') != -1){
7116
v = "values['" + name + "']";
7119
v = '(' + v + math + ')';
7122
args = args ? ',' + args : "";
7123
if(format.substr(0, 5) != "this."){
7124
format = "fm." + format + '(';
7126
format = 'this.call("'+ format.substr(5) + '", ';
7130
args= ''; format = "("+v+" === undefined ? '' : ";
7132
return "'"+ sep + format + v + args + ")"+sep+"'";
7134
var codeFn = function(m, code){
7135
return "'"+ sep +'('+code+')'+sep+"'";
7140
body = "tpl.compiled = function(values, parent, xindex, xcount){ return '" +
7141
tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn).replace(this.codeRe, codeFn) +
7144
body = ["tpl.compiled = function(values, parent, xindex, xcount){ return ['"];
7145
body.push(tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn).replace(this.codeRe, codeFn));
7146
body.push("'].join('');};");
7147
body = body.join('');
7154
applyTemplate : function(values){
7155
return this.master.compiled.call(this, values, {}, 1, 1);
7159
compile : function(){return this;}
7167
Ext.XTemplate.prototype.apply = Ext.XTemplate.prototype.applyTemplate;
7170
Ext.XTemplate.from = function(el){
7171
el = Ext.getDom(el);
7172
return new Ext.XTemplate(el.value || el.innerHTML);
7175
Ext.util.CSS = function(){
7179
var camelRe = /(-[a-z])/gi;
7180
var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };
7184
createStyleSheet : function(cssText, id){
7186
var head = doc.getElementsByTagName("head")[0];
7187
var rules = doc.createElement("style");
7188
rules.setAttribute("type", "text/css");
7190
rules.setAttribute("id", id);
7193
head.appendChild(rules);
7194
ss = rules.styleSheet;
7195
ss.cssText = cssText;
7198
rules.appendChild(doc.createTextNode(cssText));
7200
rules.cssText = cssText;
7202
head.appendChild(rules);
7203
ss = rules.styleSheet ? rules.styleSheet : (rules.sheet || doc.styleSheets[doc.styleSheets.length-1]);
7205
this.cacheStyleSheet(ss);
7210
removeStyleSheet : function(id){
7211
var existing = doc.getElementById(id);
7213
existing.parentNode.removeChild(existing);
7218
swapStyleSheet : function(id, url){
7219
this.removeStyleSheet(id);
7220
var ss = doc.createElement("link");
7221
ss.setAttribute("rel", "stylesheet");
7222
ss.setAttribute("type", "text/css");
7223
ss.setAttribute("id", id);
7224
ss.setAttribute("href", url);
7225
doc.getElementsByTagName("head")[0].appendChild(ss);
7229
refreshCache : function(){
7230
return this.getRules(true);
7234
cacheStyleSheet : function(ss){
7239
var ssRules = ss.cssRules || ss.rules;
7240
for(var j = ssRules.length-1; j >= 0; --j){
7241
rules[ssRules[j].selectorText] = ssRules[j];
7247
getRules : function(refreshCache){
7248
if(rules == null || refreshCache){
7250
var ds = doc.styleSheets;
7251
for(var i =0, len = ds.length; i < len; i++){
7253
this.cacheStyleSheet(ds[i]);
7261
getRule : function(selector, refreshCache){
7262
var rs = this.getRules(refreshCache);
7263
if(!Ext.isArray(selector)){
7264
return rs[selector];
7266
for(var i = 0; i < selector.length; i++){
7267
if(rs[selector[i]]){
7268
return rs[selector[i]];
7276
updateRule : function(selector, property, value){
7277
if(!Ext.isArray(selector)){
7278
var rule = this.getRule(selector);
7280
rule.style[property.replace(camelRe, camelFn)] = value;
7284
for(var i = 0; i < selector.length; i++){
7285
if(this.updateRule(selector[i], property, value)){
7295
Ext.util.ClickRepeater = function(el, config)
7297
this.el = Ext.get(el);
7298
this.el.unselectable();
7300
Ext.apply(this, config);
7311
this.el.on("mousedown", this.handleMouseDown, this);
7312
if(this.preventDefault || this.stopDefault){
7313
this.el.on("click", function(e){
7314
if(this.preventDefault){
7317
if(this.stopDefault){
7324
this.on("click", this.handler, this.scope || this);
7327
Ext.util.ClickRepeater.superclass.constructor.call(this);
7330
Ext.extend(Ext.util.ClickRepeater, Ext.util.Observable, {
7333
preventDefault : true,
7334
stopDefault : false,
7337
handleMouseDown : function(){
7338
clearTimeout(this.timer);
7340
if(this.pressClass){
7341
this.el.addClass(this.pressClass);
7343
this.mousedownTime = new Date();
7345
Ext.getDoc().on("mouseup", this.handleMouseUp, this);
7346
this.el.on("mouseout", this.handleMouseOut, this);
7348
this.fireEvent("mousedown", this);
7349
this.fireEvent("click", this);
7351
if (this.accelerate) {
7354
this.timer = this.click.defer(this.delay || this.interval, this);
7358
this.fireEvent("click", this);
7359
this.timer = this.click.defer(this.accelerate ?
7360
this.easeOutExpo(this.mousedownTime.getElapsed(),
7364
this.interval, this);
7367
easeOutExpo : function (t, b, c, d) {
7368
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
7371
handleMouseOut : function(){
7372
clearTimeout(this.timer);
7373
if(this.pressClass){
7374
this.el.removeClass(this.pressClass);
7376
this.el.on("mouseover", this.handleMouseReturn, this);
7379
handleMouseReturn : function(){
7380
this.el.un("mouseover", this.handleMouseReturn, this);
7381
if(this.pressClass){
7382
this.el.addClass(this.pressClass);
7387
handleMouseUp : function(){
7388
clearTimeout(this.timer);
7389
this.el.un("mouseover", this.handleMouseReturn, this);
7390
this.el.un("mouseout", this.handleMouseOut, this);
7391
Ext.getDoc().un("mouseup", this.handleMouseUp, this);
7392
this.el.removeClass(this.pressClass);
7393
this.fireEvent("mouseup", this);
7397
Ext.KeyNav = function(el, config){
7398
this.el = Ext.get(el);
7399
Ext.apply(this, config);
7401
this.disabled = true;
7406
Ext.KeyNav.prototype = {
7410
defaultEventAction: "stopEvent",
7412
forceKeyDown : false,
7414
prepareEvent : function(e){
7416
var h = this.keyToHandler[k];
7417
if(Ext.isSafari2 && h && k >= 37 && k <= 40){
7422
relay : function(e){
7424
var h = this.keyToHandler[k];
7426
if(this.doRelay(e, this[h], h) !== true){
7427
e[this.defaultEventAction]();
7432
doRelay : function(e, h, hname){
7433
return h.call(this.scope || this, e);
7467
if(this.forceKeyDown || Ext.isIE || Ext.isSafari3 || Ext.isAir){
7468
this.el.on("keydown", this.relay, this);
7470
this.el.on("keydown", this.prepareEvent, this);
7471
this.el.on("keypress", this.relay, this);
7473
this.disabled = false;
7478
disable: function(){
7480
if(this.forceKeyDown || Ext.isIE || Ext.isSafari3 || Ext.isAir){
7481
this.el.un("keydown", this.relay);
7483
this.el.un("keydown", this.prepareEvent);
7484
this.el.un("keypress", this.relay);
7486
this.disabled = true;
7491
Ext.KeyMap = function(el, config, eventName){
7492
this.el = Ext.get(el);
7493
this.eventName = eventName || "keydown";
7496
this.addBinding(config);
7501
Ext.KeyMap.prototype = {
7506
addBinding : function(config){
7507
if(Ext.isArray(config)){
7508
for(var i = 0, len = config.length; i < len; i++){
7509
this.addBinding(config[i]);
7513
var keyCode = config.key,
7514
shift = config.shift,
7517
fn = config.fn || config.handler,
7518
scope = config.scope;
7520
if (config.stopEvent) {
7521
this.stopEvent = config.stopEvent;
7524
if(typeof keyCode == "string"){
7526
var keyString = keyCode.toUpperCase();
7527
for(var j = 0, len = keyString.length; j < len; j++){
7528
ks.push(keyString.charCodeAt(j));
7532
var keyArray = Ext.isArray(keyCode);
7534
var handler = function(e){
7535
if((!shift || e.shiftKey) && (!ctrl || e.ctrlKey) && (!alt || e.altKey)){
7538
for(var i = 0, len = keyCode.length; i < len; i++){
7539
if(keyCode[i] == k){
7543
fn.call(scope || window, k, e);
7552
fn.call(scope || window, k, e);
7557
this.bindings.push(handler);
7561
on : function(key, fn, scope){
7562
var keyCode, shift, ctrl, alt;
7563
if(typeof key == "object" && !Ext.isArray(key)){
7582
handleKeyDown : function(e){
7584
var b = this.bindings;
7585
for(var i = 0, len = b.length; i < len; i++){
7592
isEnabled : function(){
7593
return this.enabled;
7599
this.el.on(this.eventName, this.handleKeyDown, this);
7600
this.enabled = true;
7605
disable: function(){
7607
this.el.removeListener(this.eventName, this.handleKeyDown, this);
7608
this.enabled = false;
7613
Ext.util.TextMetrics = function(){
7617
measure : function(el, text, fixedWidth){
7619
shared = Ext.util.TextMetrics.Instance(el, fixedWidth);
7622
shared.setFixedWidth(fixedWidth || 'auto');
7623
return shared.getSize(text);
7627
createInstance : function(el, fixedWidth){
7628
return Ext.util.TextMetrics.Instance(el, fixedWidth);
7633
Ext.util.TextMetrics.Instance = function(bindTo, fixedWidth){
7634
var ml = new Ext.Element(document.createElement('div'));
7635
document.body.appendChild(ml.dom);
7636
ml.position('absolute');
7637
ml.setLeftTop(-1000, -1000);
7641
ml.setWidth(fixedWidth);
7646
getSize : function(text){
7648
var s = ml.getSize();
7654
bind : function(el){
7656
Ext.fly(el).getStyles('font-size','font-style', 'font-weight', 'font-family','line-height', 'text-transform', 'letter-spacing')
7661
setFixedWidth : function(width){
7666
getWidth : function(text){
7667
ml.dom.style.width = 'auto';
7668
return this.getSize(text).width;
7672
getHeight : function(text){
7673
return this.getSize(text).height;
7677
instance.bind(bindTo);
7682
Ext.Element.measureText = Ext.util.TextMetrics.measure;
7687
var Event=Ext.EventManager;
7688
var Dom=Ext.lib.Dom;
7691
Ext.dd.DragDrop = function(id, sGroup, config) {
7693
this.init(id, sGroup, config);
7697
Ext.dd.DragDrop.prototype = {
7712
invalidHandleTypes: null,
7715
invalidHandleIds: null,
7718
invalidHandleClasses: null,
7733
lock: function() { this.locked = true; },
7736
unlock: function() { this.locked = false; },
7769
maintainOffset: false,
7778
primaryButtonOnly: true,
7784
hasOuterHandles: false,
7787
b4StartDrag: function(x, y) { },
7790
startDrag: function(x, y) { },
7793
b4Drag: function(e) { },
7796
onDrag: function(e) { },
7799
onDragEnter: function(e, id) { },
7802
b4DragOver: function(e) { },
7805
onDragOver: function(e, id) { },
7808
b4DragOut: function(e) { },
7811
onDragOut: function(e, id) { },
7814
b4DragDrop: function(e) { },
7817
onDragDrop: function(e, id) { },
7820
onInvalidDrop: function(e) { },
7823
b4EndDrag: function(e) { },
7826
endDrag: function(e) { },
7829
b4MouseDown: function(e) { },
7832
onMouseDown: function(e) { },
7835
onMouseUp: function(e) { },
7838
onAvailable: function () {
7842
defaultPadding : {left:0, right:0, top:0, bottom:0},
7845
constrainTo : function(constrainTo, pad, inContent){
7846
if(typeof pad == "number"){
7847
pad = {left: pad, right:pad, top:pad, bottom:pad};
7849
pad = pad || this.defaultPadding;
7850
var b = Ext.get(this.getEl()).getBox();
7851
var ce = Ext.get(constrainTo);
7852
var s = ce.getScroll();
7854
if(cd == document.body){
7855
c = { x: s.left, y: s.top, width: Ext.lib.Dom.getViewWidth(), height: Ext.lib.Dom.getViewHeight()};
7857
var xy = ce.getXY();
7858
c = {x : xy[0]+s.left, y: xy[1]+s.top, width: cd.clientWidth, height: cd.clientHeight};
7862
var topSpace = b.y - c.y;
7863
var leftSpace = b.x - c.x;
7865
this.resetConstraints();
7866
this.setXConstraint(leftSpace - (pad.left||0),
7867
c.width - leftSpace - b.width - (pad.right||0),
7870
this.setYConstraint(topSpace - (pad.top||0),
7871
c.height - topSpace - b.height - (pad.bottom||0),
7878
if (!this._domRef) {
7879
this._domRef = Ext.getDom(this.id);
7882
return this._domRef;
7886
getDragEl: function() {
7887
return Ext.getDom(this.dragElId);
7891
init: function(id, sGroup, config) {
7892
this.initTarget(id, sGroup, config);
7893
Event.on(this.id, "mousedown", this.handleMouseDown, this);
7898
initTarget: function(id, sGroup, config) {
7901
this.config = config || {};
7904
this.DDM = Ext.dd.DDM;
7910
if (typeof id !== "string") {
7918
this.addToGroup((sGroup) ? sGroup : "default");
7922
this.handleElId = id;
7925
this.setDragElId(id);
7928
this.invalidHandleTypes = { A: "A" };
7929
this.invalidHandleIds = {};
7930
this.invalidHandleClasses = [];
7934
this.handleOnAvailable();
7938
applyConfig: function() {
7942
this.padding = this.config.padding || [0, 0, 0, 0];
7943
this.isTarget = (this.config.isTarget !== false);
7944
this.maintainOffset = (this.config.maintainOffset);
7945
this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);
7950
handleOnAvailable: function() {
7951
this.available = true;
7952
this.resetConstraints();
7957
setPadding: function(iTop, iRight, iBot, iLeft) {
7959
if (!iRight && 0 !== iRight) {
7960
this.padding = [iTop, iTop, iTop, iTop];
7961
} else if (!iBot && 0 !== iBot) {
7962
this.padding = [iTop, iRight, iTop, iRight];
7964
this.padding = [iTop, iRight, iBot, iLeft];
7969
setInitPosition: function(diffX, diffY) {
7970
var el = this.getEl();
7972
if (!this.DDM.verifyEl(el)) {
7976
var dx = diffX || 0;
7977
var dy = diffY || 0;
7979
var p = Dom.getXY( el );
7981
this.initPageX = p[0] - dx;
7982
this.initPageY = p[1] - dy;
7984
this.lastPageX = p[0];
7985
this.lastPageY = p[1];
7988
this.setStartPosition(p);
7992
setStartPosition: function(pos) {
7993
var p = pos || Dom.getXY( this.getEl() );
7994
this.deltaSetXY = null;
7996
this.startPageX = p[0];
7997
this.startPageY = p[1];
8001
addToGroup: function(sGroup) {
8002
this.groups[sGroup] = true;
8003
this.DDM.regDragDrop(this, sGroup);
8007
removeFromGroup: function(sGroup) {
8008
if (this.groups[sGroup]) {
8009
delete this.groups[sGroup];
8012
this.DDM.removeDDFromGroup(this, sGroup);
8016
setDragElId: function(id) {
8021
setHandleElId: function(id) {
8022
if (typeof id !== "string") {
8025
this.handleElId = id;
8026
this.DDM.regHandle(this.id, id);
8030
setOuterHandleElId: function(id) {
8031
if (typeof id !== "string") {
8034
Event.on(id, "mousedown",
8035
this.handleMouseDown, this);
8036
this.setHandleElId(id);
8038
this.hasOuterHandles = true;
8043
Event.un(this.id, "mousedown",
8044
this.handleMouseDown);
8045
this._domRef = null;
8046
this.DDM._remove(this);
8049
destroy : function(){
8054
isLocked: function() {
8055
return (this.DDM.isLocked() || this.locked);
8059
handleMouseDown: function(e, oDD){
8060
if (this.primaryButtonOnly && e.button != 0) {
8064
if (this.isLocked()) {
8068
this.DDM.refreshCache(this.groups);
8070
var pt = new Ext.lib.Point(Ext.lib.Event.getPageX(e), Ext.lib.Event.getPageY(e));
8071
if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) {
8073
if (this.clickValidator(e)) {
8076
this.setStartPosition();
8079
this.b4MouseDown(e);
8080
this.onMouseDown(e);
8082
this.DDM.handleMouseDown(e, this);
8084
this.DDM.stopEvent(e);
8092
clickValidator: function(e) {
8093
var target = e.getTarget();
8094
return ( this.isValidHandleChild(target) &&
8095
(this.id == this.handleElId ||
8096
this.DDM.handleWasClicked(target, this.id)) );
8100
addInvalidHandleType: function(tagName) {
8101
var type = tagName.toUpperCase();
8102
this.invalidHandleTypes[type] = type;
8106
addInvalidHandleId: function(id) {
8107
if (typeof id !== "string") {
8110
this.invalidHandleIds[id] = id;
8114
addInvalidHandleClass: function(cssClass) {
8115
this.invalidHandleClasses.push(cssClass);
8119
removeInvalidHandleType: function(tagName) {
8120
var type = tagName.toUpperCase();
8122
delete this.invalidHandleTypes[type];
8126
removeInvalidHandleId: function(id) {
8127
if (typeof id !== "string") {
8130
delete this.invalidHandleIds[id];
8134
removeInvalidHandleClass: function(cssClass) {
8135
for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {
8136
if (this.invalidHandleClasses[i] == cssClass) {
8137
delete this.invalidHandleClasses[i];
8143
isValidHandleChild: function(node) {
8149
nodeName = node.nodeName.toUpperCase();
8151
nodeName = node.nodeName;
8153
valid = valid && !this.invalidHandleTypes[nodeName];
8154
valid = valid && !this.invalidHandleIds[node.id];
8156
for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {
8157
valid = !Ext.fly(node).hasClass(this.invalidHandleClasses[i]);
8166
setXTicks: function(iStartX, iTickSize) {
8168
this.xTickSize = iTickSize;
8172
for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {
8174
this.xTicks[this.xTicks.length] = i;
8179
for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {
8181
this.xTicks[this.xTicks.length] = i;
8186
this.xTicks.sort(this.DDM.numericSort) ;
8190
setYTicks: function(iStartY, iTickSize) {
8192
this.yTickSize = iTickSize;
8196
for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {
8198
this.yTicks[this.yTicks.length] = i;
8203
for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {
8205
this.yTicks[this.yTicks.length] = i;
8210
this.yTicks.sort(this.DDM.numericSort) ;
8214
setXConstraint: function(iLeft, iRight, iTickSize) {
8215
this.leftConstraint = iLeft;
8216
this.rightConstraint = iRight;
8218
this.minX = this.initPageX - iLeft;
8219
this.maxX = this.initPageX + iRight;
8220
if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
8222
this.constrainX = true;
8226
clearConstraints: function() {
8227
this.constrainX = false;
8228
this.constrainY = false;
8233
clearTicks: function() {
8241
setYConstraint: function(iUp, iDown, iTickSize) {
8242
this.topConstraint = iUp;
8243
this.bottomConstraint = iDown;
8245
this.minY = this.initPageY - iUp;
8246
this.maxY = this.initPageY + iDown;
8247
if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
8249
this.constrainY = true;
8254
resetConstraints: function() {
8258
if (this.initPageX || this.initPageX === 0) {
8260
var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
8261
var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;
8263
this.setInitPosition(dx, dy);
8267
this.setInitPosition();
8270
if (this.constrainX) {
8271
this.setXConstraint( this.leftConstraint,
8272
this.rightConstraint,
8276
if (this.constrainY) {
8277
this.setYConstraint( this.topConstraint,
8278
this.bottomConstraint,
8284
getTick: function(val, tickArray) {
8290
} else if (tickArray[0] >= val) {
8293
return tickArray[0];
8295
for (var i=0, len=tickArray.length; i<len; ++i) {
8297
if (tickArray[next] && tickArray[next] >= val) {
8298
var diff1 = val - tickArray[i];
8299
var diff2 = tickArray[next] - val;
8300
return (diff2 > diff1) ? tickArray[i] : tickArray[next];
8306
return tickArray[tickArray.length - 1];
8311
toString: function() {
8312
return ("DragDrop " + this.id);
8322
if (!Ext.dd.DragDropMgr) {
8325
Ext.dd.DragDropMgr = function() {
8327
var Event = Ext.EventManager;
8350
preventDefault: true,
8353
stopPropagation: true,
8363
this.initialized = true;
8376
_execOnAll: function(sMethod, args) {
8377
for (var i in this.ids) {
8378
for (var j in this.ids[i]) {
8379
var oDD = this.ids[i][j];
8380
if (! this.isTypeOfDD(oDD)) {
8383
oDD[sMethod].apply(oDD, args);
8389
_onLoad: function() {
8394
Event.on(document, "mouseup", this.handleMouseUp, this, true);
8395
Event.on(document, "mousemove", this.handleMouseMove, this, true);
8396
Event.on(window, "unload", this._onUnload, this, true);
8397
Event.on(window, "resize", this._onResize, this, true);
8403
_onResize: function(e) {
8404
this._execOnAll("resetConstraints", []);
8408
lock: function() { this.locked = true; },
8411
unlock: function() { this.locked = false; },
8414
isLocked: function() { return this.locked; },
8423
clickPixelThresh: 3,
8426
clickTimeThresh: 350,
8429
dragThreshMet: false,
8441
regDragDrop: function(oDD, sGroup) {
8442
if (!this.initialized) { this.init(); }
8444
if (!this.ids[sGroup]) {
8445
this.ids[sGroup] = {};
8447
this.ids[sGroup][oDD.id] = oDD;
8451
removeDDFromGroup: function(oDD, sGroup) {
8452
if (!this.ids[sGroup]) {
8453
this.ids[sGroup] = {};
8456
var obj = this.ids[sGroup];
8457
if (obj && obj[oDD.id]) {
8463
_remove: function(oDD) {
8464
for (var g in oDD.groups) {
8465
if (g && this.ids[g][oDD.id]) {
8466
delete this.ids[g][oDD.id];
8469
delete this.handleIds[oDD.id];
8473
regHandle: function(sDDId, sHandleId) {
8474
if (!this.handleIds[sDDId]) {
8475
this.handleIds[sDDId] = {};
8477
this.handleIds[sDDId][sHandleId] = sHandleId;
8481
isDragDrop: function(id) {
8482
return ( this.getDDById(id) ) ? true : false;
8486
getRelated: function(p_oDD, bTargetsOnly) {
8488
for (var i in p_oDD.groups) {
8489
for (j in this.ids[i]) {
8490
var dd = this.ids[i][j];
8491
if (! this.isTypeOfDD(dd)) {
8494
if (!bTargetsOnly || dd.isTarget) {
8495
oDDs[oDDs.length] = dd;
8504
isLegalTarget: function (oDD, oTargetDD) {
8505
var targets = this.getRelated(oDD, true);
8506
for (var i=0, len=targets.length;i<len;++i) {
8507
if (targets[i].id == oTargetDD.id) {
8516
isTypeOfDD: function (oDD) {
8517
return (oDD && oDD.__ygDragDrop);
8521
isHandle: function(sDDId, sHandleId) {
8522
return ( this.handleIds[sDDId] &&
8523
this.handleIds[sDDId][sHandleId] );
8527
getDDById: function(id) {
8528
for (var i in this.ids) {
8529
if (this.ids[i][id]) {
8530
return this.ids[i][id];
8537
handleMouseDown: function(e, oDD) {
8539
Ext.QuickTips.disable();
8541
this.currentTarget = e.getTarget();
8543
this.dragCurrent = oDD;
8545
var el = oDD.getEl();
8548
this.startX = e.getPageX();
8549
this.startY = e.getPageY();
8551
this.deltaX = this.startX - el.offsetLeft;
8552
this.deltaY = this.startY - el.offsetTop;
8554
this.dragThreshMet = false;
8556
this.clickTimeout = setTimeout(
8558
var DDM = Ext.dd.DDM;
8559
DDM.startDrag(DDM.startX, DDM.startY);
8561
this.clickTimeThresh );
8565
startDrag: function(x, y) {
8566
clearTimeout(this.clickTimeout);
8567
if (this.dragCurrent) {
8568
this.dragCurrent.b4StartDrag(x, y);
8569
this.dragCurrent.startDrag(x, y);
8571
this.dragThreshMet = true;
8575
handleMouseUp: function(e) {
8578
Ext.QuickTips.enable();
8580
if (! this.dragCurrent) {
8584
clearTimeout(this.clickTimeout);
8586
if (this.dragThreshMet) {
8587
this.fireEvents(e, true);
8597
stopEvent: function(e){
8598
if(this.stopPropagation) {
8599
e.stopPropagation();
8602
if (this.preventDefault) {
8608
stopDrag: function(e) {
8610
if (this.dragCurrent) {
8611
if (this.dragThreshMet) {
8612
this.dragCurrent.b4EndDrag(e);
8613
this.dragCurrent.endDrag(e);
8616
this.dragCurrent.onMouseUp(e);
8619
this.dragCurrent = null;
8620
this.dragOvers = {};
8624
handleMouseMove: function(e) {
8625
if (! this.dragCurrent) {
8632
if (Ext.isIE && (e.button !== 0 && e.button !== 1 && e.button !== 2)) {
8634
return this.handleMouseUp(e);
8637
if (!this.dragThreshMet) {
8638
var diffX = Math.abs(this.startX - e.getPageX());
8639
var diffY = Math.abs(this.startY - e.getPageY());
8640
if (diffX > this.clickPixelThresh ||
8641
diffY > this.clickPixelThresh) {
8642
this.startDrag(this.startX, this.startY);
8646
if (this.dragThreshMet) {
8647
this.dragCurrent.b4Drag(e);
8648
this.dragCurrent.onDrag(e);
8649
if(!this.dragCurrent.moveOnly){
8650
this.fireEvents(e, false);
8660
fireEvents: function(e, isDrop) {
8661
var dc = this.dragCurrent;
8665
if (!dc || dc.isLocked()) {
8669
var pt = e.getPoint();
8681
for (var i in this.dragOvers) {
8683
var ddo = this.dragOvers[i];
8685
if (! this.isTypeOfDD(ddo)) {
8689
if (! this.isOverTarget(pt, ddo, this.mode)) {
8690
outEvts.push( ddo );
8694
delete this.dragOvers[i];
8697
for (var sGroup in dc.groups) {
8699
if ("string" != typeof sGroup) {
8703
for (i in this.ids[sGroup]) {
8704
var oDD = this.ids[sGroup][i];
8705
if (! this.isTypeOfDD(oDD)) {
8709
if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {
8710
if (this.isOverTarget(pt, oDD, this.mode)) {
8713
dropEvts.push( oDD );
8718
if (!oldOvers[oDD.id]) {
8719
enterEvts.push( oDD );
8722
overEvts.push( oDD );
8725
this.dragOvers[oDD.id] = oDD;
8733
if (outEvts.length) {
8734
dc.b4DragOut(e, outEvts);
8735
dc.onDragOut(e, outEvts);
8738
if (enterEvts.length) {
8739
dc.onDragEnter(e, enterEvts);
8742
if (overEvts.length) {
8743
dc.b4DragOver(e, overEvts);
8744
dc.onDragOver(e, overEvts);
8747
if (dropEvts.length) {
8748
dc.b4DragDrop(e, dropEvts);
8749
dc.onDragDrop(e, dropEvts);
8755
for (i=0, len=outEvts.length; i<len; ++i) {
8756
dc.b4DragOut(e, outEvts[i].id);
8757
dc.onDragOut(e, outEvts[i].id);
8761
for (i=0,len=enterEvts.length; i<len; ++i) {
8763
dc.onDragEnter(e, enterEvts[i].id);
8767
for (i=0,len=overEvts.length; i<len; ++i) {
8768
dc.b4DragOver(e, overEvts[i].id);
8769
dc.onDragOver(e, overEvts[i].id);
8773
for (i=0, len=dropEvts.length; i<len; ++i) {
8774
dc.b4DragDrop(e, dropEvts[i].id);
8775
dc.onDragDrop(e, dropEvts[i].id);
8781
if (isDrop && !dropEvts.length) {
8782
dc.onInvalidDrop(e);
8788
getBestMatch: function(dds) {
8796
var len = dds.length;
8802
for (var i=0; i<len; ++i) {
8807
if (dd.cursorIsOver) {
8813
winner.overlap.getArea() < dd.overlap.getArea()) {
8824
refreshCache: function(groups) {
8825
for (var sGroup in groups) {
8826
if ("string" != typeof sGroup) {
8829
for (var i in this.ids[sGroup]) {
8830
var oDD = this.ids[sGroup][i];
8832
if (this.isTypeOfDD(oDD)) {
8834
var loc = this.getLocation(oDD);
8836
this.locationCache[oDD.id] = loc;
8838
delete this.locationCache[oDD.id];
8849
verifyEl: function(el) {
8854
parent = el.offsetParent;
8857
parent = el.offsetParent;
8868
getLocation: function(oDD) {
8869
if (! this.isTypeOfDD(oDD)) {
8873
var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
8876
pos= Ext.lib.Dom.getXY(el);
8884
x2 = x1 + el.offsetWidth;
8886
y2 = y1 + el.offsetHeight;
8888
t = y1 - oDD.padding[0];
8889
r = x2 + oDD.padding[1];
8890
b = y2 + oDD.padding[2];
8891
l = x1 - oDD.padding[3];
8893
return new Ext.lib.Region( t, r, b, l );
8897
isOverTarget: function(pt, oTarget, intersect) {
8899
var loc = this.locationCache[oTarget.id];
8900
if (!loc || !this.useCache) {
8901
loc = this.getLocation(oTarget);
8902
this.locationCache[oTarget.id] = loc;
8910
oTarget.cursorIsOver = loc.contains( pt );
8917
var dc = this.dragCurrent;
8918
if (!dc || !dc.getTargetCoord ||
8919
(!intersect && !dc.constrainX && !dc.constrainY)) {
8920
return oTarget.cursorIsOver;
8923
oTarget.overlap = null;
8929
var pos = dc.getTargetCoord(pt.x, pt.y);
8931
var el = dc.getDragEl();
8932
var curRegion = new Ext.lib.Region( pos.y,
8933
pos.x + el.offsetWidth,
8934
pos.y + el.offsetHeight,
8937
var overlap = curRegion.intersect(loc);
8940
oTarget.overlap = overlap;
8941
return (intersect) ? true : oTarget.cursorIsOver;
8948
_onUnload: function(e, me) {
8949
Ext.dd.DragDropMgr.unregAll();
8953
unregAll: function() {
8955
if (this.dragCurrent) {
8957
this.dragCurrent = null;
8960
this._execOnAll("unreg", []);
8962
for (var i in this.elementCache) {
8963
delete this.elementCache[i];
8966
this.elementCache = {};
8974
getElWrapper: function(id) {
8975
var oWrapper = this.elementCache[id];
8976
if (!oWrapper || !oWrapper.el) {
8977
oWrapper = this.elementCache[id] =
8978
new this.ElementWrapper(Ext.getDom(id));
8984
getElement: function(id) {
8985
return Ext.getDom(id);
8989
getCss: function(id) {
8990
var el = Ext.getDom(id);
8991
return (el) ? el.style : null;
8995
ElementWrapper: function(el) {
8997
this.el = el || null;
8999
this.id = this.el && el.id;
9001
this.css = this.el && el.style;
9005
getPosX: function(el) {
9006
return Ext.lib.Dom.getX(el);
9010
getPosY: function(el) {
9011
return Ext.lib.Dom.getY(el);
9015
swapNode: function(n1, n2) {
9019
var p = n2.parentNode;
9020
var s = n2.nextSibling;
9023
p.insertBefore(n1, n2);
9024
} else if (n2 == n1.nextSibling) {
9025
p.insertBefore(n2, n1);
9027
n1.parentNode.replaceChild(n2, n1);
9028
p.insertBefore(n1, s);
9034
getScroll: function () {
9035
var t, l, dde=document.documentElement, db=document.body;
9036
if (dde && (dde.scrollTop || dde.scrollLeft)) {
9045
return { top: t, left: l };
9049
getStyle: function(el, styleProp) {
9050
return Ext.fly(el).getStyle(styleProp);
9054
getScrollTop: function () { return this.getScroll().top; },
9057
getScrollLeft: function () { return this.getScroll().left; },
9060
moveToEl: function (moveEl, targetEl) {
9061
var aCoord = Ext.lib.Dom.getXY(targetEl);
9062
Ext.lib.Dom.setXY(moveEl, aCoord);
9066
numericSort: function(a, b) { return (a - b); },
9072
_addListeners: function() {
9073
var DDM = Ext.dd.DDM;
9074
if ( Ext.lib.Event && document ) {
9077
if (DDM._timeoutCount > 2000) {
9079
setTimeout(DDM._addListeners, 10);
9080
if (document && document.body) {
9081
DDM._timeoutCount += 1;
9088
handleWasClicked: function(node, id) {
9089
if (this.isHandle(id, node.id)) {
9093
var p = node.parentNode;
9096
if (this.isHandle(id, p.id)) {
9112
Ext.dd.DDM = Ext.dd.DragDropMgr;
9113
Ext.dd.DDM._addListeners();
9118
Ext.dd.DD = function(id, sGroup, config) {
9120
this.init(id, sGroup, config);
9124
Ext.extend(Ext.dd.DD, Ext.dd.DragDrop, {
9130
autoOffset: function(iPageX, iPageY) {
9131
var x = iPageX - this.startPageX;
9132
var y = iPageY - this.startPageY;
9133
this.setDelta(x, y);
9137
setDelta: function(iDeltaX, iDeltaY) {
9138
this.deltaX = iDeltaX;
9139
this.deltaY = iDeltaY;
9143
setDragElPos: function(iPageX, iPageY) {
9147
var el = this.getDragEl();
9148
this.alignElWithMouse(el, iPageX, iPageY);
9152
alignElWithMouse: function(el, iPageX, iPageY) {
9153
var oCoord = this.getTargetCoord(iPageX, iPageY);
9154
var fly = el.dom ? el : Ext.fly(el, '_dd');
9155
if (!this.deltaSetXY) {
9156
var aCoord = [oCoord.x, oCoord.y];
9158
var newLeft = fly.getLeft(true);
9159
var newTop = fly.getTop(true);
9160
this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
9162
fly.setLeftTop(oCoord.x + this.deltaSetXY[0], oCoord.y + this.deltaSetXY[1]);
9165
this.cachePosition(oCoord.x, oCoord.y);
9166
this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
9171
cachePosition: function(iPageX, iPageY) {
9173
this.lastPageX = iPageX;
9174
this.lastPageY = iPageY;
9176
var aCoord = Ext.lib.Dom.getXY(this.getEl());
9177
this.lastPageX = aCoord[0];
9178
this.lastPageY = aCoord[1];
9183
autoScroll: function(x, y, h, w) {
9187
var clientH = Ext.lib.Dom.getViewHeight();
9190
var clientW = Ext.lib.Dom.getViewWidth();
9193
var st = this.DDM.getScrollTop();
9196
var sl = this.DDM.getScrollLeft();
9207
var toBot = (clientH + st - y - this.deltaY);
9210
var toRight = (clientW + sl - x - this.deltaX);
9220
var scrAmt = (document.all) ? 80 : 30;
9224
if ( bot > clientH && toBot < thresh ) {
9225
window.scrollTo(sl, st + scrAmt);
9230
if ( y < st && st > 0 && y - st < thresh ) {
9231
window.scrollTo(sl, st - scrAmt);
9236
if ( right > clientW && toRight < thresh ) {
9237
window.scrollTo(sl + scrAmt, st);
9242
if ( x < sl && sl > 0 && x - sl < thresh ) {
9243
window.scrollTo(sl - scrAmt, st);
9249
getTargetCoord: function(iPageX, iPageY) {
9252
var x = iPageX - this.deltaX;
9253
var y = iPageY - this.deltaY;
9255
if (this.constrainX) {
9256
if (x < this.minX) { x = this.minX; }
9257
if (x > this.maxX) { x = this.maxX; }
9260
if (this.constrainY) {
9261
if (y < this.minY) { y = this.minY; }
9262
if (y > this.maxY) { y = this.maxY; }
9265
x = this.getTick(x, this.xTicks);
9266
y = this.getTick(y, this.yTicks);
9273
applyConfig: function() {
9274
Ext.dd.DD.superclass.applyConfig.call(this);
9275
this.scroll = (this.config.scroll !== false);
9279
b4MouseDown: function(e) {
9281
this.autoOffset(e.getPageX(),
9286
b4Drag: function(e) {
9287
this.setDragElPos(e.getPageX(),
9291
toString: function() {
9292
return ("DD " + this.id);
9302
Ext.dd.DDProxy = function(id, sGroup, config) {
9304
this.init(id, sGroup, config);
9310
Ext.dd.DDProxy.dragElId = "ygddfdiv";
9312
Ext.extend(Ext.dd.DDProxy, Ext.dd.DD, {
9321
createFrame: function() {
9323
var body = document.body;
9325
if (!body || !body.firstChild) {
9326
setTimeout( function() { self.createFrame(); }, 50 );
9330
var div = this.getDragEl();
9333
div = document.createElement("div");
9334
div.id = this.dragElId;
9337
s.position = "absolute";
9338
s.visibility = "hidden";
9340
s.border = "2px solid #aaa";
9346
body.insertBefore(div, body.firstChild);
9351
initFrame: function() {
9355
applyConfig: function() {
9356
Ext.dd.DDProxy.superclass.applyConfig.call(this);
9358
this.resizeFrame = (this.config.resizeFrame !== false);
9359
this.centerFrame = (this.config.centerFrame);
9360
this.setDragElId(this.config.dragElId || Ext.dd.DDProxy.dragElId);
9364
showFrame: function(iPageX, iPageY) {
9365
var el = this.getEl();
9366
var dragEl = this.getDragEl();
9367
var s = dragEl.style;
9369
this._resizeProxy();
9371
if (this.centerFrame) {
9372
this.setDelta( Math.round(parseInt(s.width, 10)/2),
9373
Math.round(parseInt(s.height, 10)/2) );
9376
this.setDragElPos(iPageX, iPageY);
9378
Ext.fly(dragEl).show();
9382
_resizeProxy: function() {
9383
if (this.resizeFrame) {
9384
var el = this.getEl();
9385
Ext.fly(this.getDragEl()).setSize(el.offsetWidth, el.offsetHeight);
9390
b4MouseDown: function(e) {
9391
var x = e.getPageX();
9392
var y = e.getPageY();
9393
this.autoOffset(x, y);
9394
this.setDragElPos(x, y);
9398
b4StartDrag: function(x, y) {
9400
this.showFrame(x, y);
9404
b4EndDrag: function(e) {
9405
Ext.fly(this.getDragEl()).hide();
9411
endDrag: function(e) {
9413
var lel = this.getEl();
9414
var del = this.getDragEl();
9417
del.style.visibility = "";
9422
lel.style.visibility = "hidden";
9423
Ext.dd.DDM.moveToEl(lel, del);
9424
del.style.visibility = "hidden";
9425
lel.style.visibility = "";
9430
beforeMove : function(){
9434
afterDrag : function(){
9438
toString: function() {
9439
return ("DDProxy " + this.id);
9444
Ext.dd.DDTarget = function(id, sGroup, config) {
9446
this.initTarget(id, sGroup, config);
9451
Ext.extend(Ext.dd.DDTarget, Ext.dd.DragDrop, {
9452
toString: function() {
9453
return ("DDTarget " + this.id);
9457
Ext.dd.DragTracker = function(config){
9458
Ext.apply(this, config);
9468
this.dragRegion = new Ext.lib.Region(0,0,0,0);
9471
this.initEl(this.el);
9475
Ext.extend(Ext.dd.DragTracker, Ext.util.Observable, {
9480
initEl: function(el){
9481
this.el = Ext.get(el);
9482
el.on('mousedown', this.onMouseDown, this,
9483
this.delegate ? {delegate: this.delegate} : undefined);
9486
destroy : function(){
9487
this.el.un('mousedown', this.onMouseDown, this);
9490
onMouseDown: function(e, target){
9491
if(this.fireEvent('mousedown', this, e) !== false && this.onBeforeStart(e) !== false){
9492
this.startXY = this.lastXY = e.getXY();
9493
this.dragTarget = this.delegate ? target : this.el.dom;
9495
var doc = Ext.getDoc();
9496
doc.on('mouseup', this.onMouseUp, this);
9497
doc.on('mousemove', this.onMouseMove, this);
9498
doc.on('selectstart', this.stopSelect, this);
9500
this.timer = this.triggerStart.defer(this.autoStart === true ? 1000 : this.autoStart, this);
9505
onMouseMove: function(e, target){
9507
var xy = e.getXY(), s = this.startXY;
9510
if(Math.abs(s[0]-xy[0]) > this.tolerance || Math.abs(s[1]-xy[1]) > this.tolerance){
9511
this.triggerStart();
9516
this.fireEvent('mousemove', this, e);
9518
this.fireEvent('drag', this, e);
9521
onMouseUp: function(e){
9522
var doc = Ext.getDoc();
9523
doc.un('mousemove', this.onMouseMove, this);
9524
doc.un('mouseup', this.onMouseUp, this);
9525
doc.un('selectstart', this.stopSelect, this);
9528
this.active = false;
9529
delete this.elRegion;
9530
this.fireEvent('mouseup', this, e);
9532
this.fireEvent('dragend', this, e);
9535
triggerStart: function(isTimer){
9538
this.onStart(this.startXY);
9539
this.fireEvent('dragstart', this, this.startXY);
9542
clearStart : function(){
9544
clearTimeout(this.timer);
9549
stopSelect : function(e){
9554
onBeforeStart : function(e){
9558
onStart : function(xy){
9562
onDrag : function(e){
9566
onEnd : function(e){
9570
getDragTarget : function(){
9571
return this.dragTarget;
9574
getDragCt : function(){
9578
getXY : function(constrain){
9580
this.constrainModes[constrain].call(this, this.lastXY) : this.lastXY;
9583
getOffset : function(constrain){
9584
var xy = this.getXY(constrain);
9585
var s = this.startXY;
9586
return [s[0]-xy[0], s[1]-xy[1]];
9590
'point' : function(xy){
9593
this.elRegion = this.getDragCt().getRegion();
9596
var dr = this.dragRegion;
9603
dr.constrainTo(this.elRegion);
9605
return [dr.left, dr.top];
9610
Ext.dd.ScrollManager = function(){
9611
var ddm = Ext.dd.DragDropMgr;
9616
var onStop = function(e){
9621
var triggerRefresh = function(){
9622
if(ddm.dragCurrent){
9623
ddm.refreshCache(ddm.dragCurrent.groups);
9627
var doScroll = function(){
9628
if(ddm.dragCurrent){
9629
var dds = Ext.dd.ScrollManager;
9630
var inc = proc.el.ddScrollConfig ?
9631
proc.el.ddScrollConfig.increment : dds.increment;
9633
if(proc.el.scroll(proc.dir, inc)){
9637
proc.el.scroll(proc.dir, inc, true, dds.animDuration, triggerRefresh);
9642
var clearProc = function(){
9644
clearInterval(proc.id);
9651
var startProc = function(el, dir){
9655
var freq = (el.ddScrollConfig && el.ddScrollConfig.frequency) ?
9656
el.ddScrollConfig.frequency : Ext.dd.ScrollManager.frequency;
9657
proc.id = setInterval(doScroll, freq);
9660
var onFire = function(e, isDrop){
9661
if(isDrop || !ddm.dragCurrent){ return; }
9662
var dds = Ext.dd.ScrollManager;
9663
if(!dragEl || dragEl != ddm.dragCurrent){
9664
dragEl = ddm.dragCurrent;
9669
var xy = Ext.lib.Event.getXY(e);
9670
var pt = new Ext.lib.Point(xy[0], xy[1]);
9672
var el = els[id], r = el._region;
9673
var c = el.ddScrollConfig ? el.ddScrollConfig : dds;
9674
if(r && r.contains(pt) && el.isScrollable()){
9675
if(r.bottom - pt.y <= c.vthresh){
9677
startProc(el, "down");
9680
}else if(r.right - pt.x <= c.hthresh){
9682
startProc(el, "left");
9685
}else if(pt.y - r.top <= c.vthresh){
9687
startProc(el, "up");
9690
}else if(pt.x - r.left <= c.hthresh){
9692
startProc(el, "right");
9701
ddm.fireEvents = ddm.fireEvents.createSequence(onFire, ddm);
9702
ddm.stopDrag = ddm.stopDrag.createSequence(onStop, ddm);
9706
register : function(el){
9707
if(Ext.isArray(el)){
9708
for(var i = 0, len = el.length; i < len; i++) {
9709
this.register(el[i]);
9718
unregister : function(el){
9719
if(Ext.isArray(el)){
9720
for(var i = 0, len = el.length; i < len; i++) {
9721
this.unregister(el[i]);
9747
refreshCache : function(){
9749
if(typeof els[id] == 'object'){
9750
els[id]._region = els[id].getRegion();
9757
Ext.dd.Registry = function(){
9762
var getId = function(el, autogen){
9763
if(typeof el == "string"){
9767
if(!id && autogen !== false){
9768
id = "extdd-" + (++autoIdSeed);
9776
register : function(el, data){
9778
if(typeof el == "string"){
9779
el = document.getElementById(el);
9782
elements[getId(el)] = data;
9783
if(data.isHandle !== false){
9784
handles[data.ddel.id] = data;
9787
var hs = data.handles;
9788
for(var i = 0, len = hs.length; i < len; i++){
9789
handles[getId(hs[i])] = data;
9795
unregister : function(el){
9796
var id = getId(el, false);
9797
var data = elements[id];
9799
delete elements[id];
9801
var hs = data.handles;
9802
for(var i = 0, len = hs.length; i < len; i++){
9803
delete handles[getId(hs[i], false)];
9810
getHandle : function(id){
9811
if(typeof id != "string"){
9818
getHandleFromEvent : function(e){
9819
var t = Ext.lib.Event.getTarget(e);
9820
return t ? handles[t.id] : null;
9824
getTarget : function(id){
9825
if(typeof id != "string"){
9828
return elements[id];
9832
getTargetFromEvent : function(e){
9833
var t = Ext.lib.Event.getTarget(e);
9834
return t ? elements[t.id] || handles[t.id] : null;
9839
Ext.dd.StatusProxy = function(config){
9840
Ext.apply(this, config);
9841
this.id = this.id || Ext.id();
9842
this.el = new Ext.Layer({
9844
id: this.id, tag: "div", cls: "x-dd-drag-proxy "+this.dropNotAllowed, children: [
9845
{tag: "div", cls: "x-dd-drop-icon"},
9846
{tag: "div", cls: "x-dd-drag-ghost"}
9849
shadow: !config || config.shadow !== false
9851
this.ghost = Ext.get(this.el.dom.childNodes[1]);
9852
this.dropStatus = this.dropNotAllowed;
9855
Ext.dd.StatusProxy.prototype = {
9857
dropAllowed : "x-dd-drop-ok",
9859
dropNotAllowed : "x-dd-drop-nodrop",
9862
setStatus : function(cssClass){
9863
cssClass = cssClass || this.dropNotAllowed;
9864
if(this.dropStatus != cssClass){
9865
this.el.replaceClass(this.dropStatus, cssClass);
9866
this.dropStatus = cssClass;
9871
reset : function(clearGhost){
9872
this.el.dom.className = "x-dd-drag-proxy " + this.dropNotAllowed;
9873
this.dropStatus = this.dropNotAllowed;
9875
this.ghost.update("");
9880
update : function(html){
9881
if(typeof html == "string"){
9882
this.ghost.update(html);
9884
this.ghost.update("");
9885
html.style.margin = "0";
9886
this.ghost.dom.appendChild(html);
9888
var el = this.ghost.dom.firstChild;
9890
Ext.fly(el).setStyle(Ext.isIE ? 'styleFloat' : 'cssFloat', 'none');
9900
getGhost : function(){
9905
hide : function(clear){
9914
if(this.anim && this.anim.isAnimated && this.anim.isAnimated()){
9930
repair : function(xy, callback, scope){
9931
this.callback = callback;
9933
if(xy && this.animRepair !== false){
9934
this.el.addClass("x-dd-drag-repair");
9935
this.el.hideUnders(true);
9936
this.anim = this.el.shift({
9937
duration: this.repairDuration || .5,
9941
callback: this.afterRepair,
9950
afterRepair : function(){
9952
if(typeof this.callback == "function"){
9953
this.callback.call(this.scope || this);
9955
this.callback = null;
9960
Ext.dd.DragSource = function(el, config){
9961
this.el = Ext.get(el);
9966
Ext.apply(this, config);
9969
this.proxy = new Ext.dd.StatusProxy();
9971
Ext.dd.DragSource.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group,
9972
{dragElId : this.proxy.id, resizeFrame: false, isTarget: false, scroll: this.scroll === true});
9974
this.dragging = false;
9977
Ext.extend(Ext.dd.DragSource, Ext.dd.DDProxy, {
9980
dropAllowed : "x-dd-drop-ok",
9982
dropNotAllowed : "x-dd-drop-nodrop",
9985
getDragData : function(e){
9986
return this.dragData;
9990
onDragEnter : function(e, id){
9991
var target = Ext.dd.DragDropMgr.getDDById(id);
9992
this.cachedTarget = target;
9993
if(this.beforeDragEnter(target, e, id) !== false){
9994
if(target.isNotifyTarget){
9995
var status = target.notifyEnter(this, e, this.dragData);
9996
this.proxy.setStatus(status);
9998
this.proxy.setStatus(this.dropAllowed);
10001
if(this.afterDragEnter){
10003
this.afterDragEnter(target, e, id);
10009
beforeDragEnter : function(target, e, id){
10014
alignElWithMouse: function() {
10015
Ext.dd.DragSource.superclass.alignElWithMouse.apply(this, arguments);
10020
onDragOver : function(e, id){
10021
var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);
10022
if(this.beforeDragOver(target, e, id) !== false){
10023
if(target.isNotifyTarget){
10024
var status = target.notifyOver(this, e, this.dragData);
10025
this.proxy.setStatus(status);
10028
if(this.afterDragOver){
10030
this.afterDragOver(target, e, id);
10036
beforeDragOver : function(target, e, id){
10041
onDragOut : function(e, id){
10042
var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);
10043
if(this.beforeDragOut(target, e, id) !== false){
10044
if(target.isNotifyTarget){
10045
target.notifyOut(this, e, this.dragData);
10047
this.proxy.reset();
10048
if(this.afterDragOut){
10050
this.afterDragOut(target, e, id);
10053
this.cachedTarget = null;
10057
beforeDragOut : function(target, e, id){
10062
onDragDrop : function(e, id){
10063
var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);
10064
if(this.beforeDragDrop(target, e, id) !== false){
10065
if(target.isNotifyTarget){
10066
if(target.notifyDrop(this, e, this.dragData)){
10067
this.onValidDrop(target, e, id);
10069
this.onInvalidDrop(target, e, id);
10072
this.onValidDrop(target, e, id);
10075
if(this.afterDragDrop){
10077
this.afterDragDrop(target, e, id);
10080
delete this.cachedTarget;
10084
beforeDragDrop : function(target, e, id){
10089
onValidDrop : function(target, e, id){
10091
if(this.afterValidDrop){
10093
this.afterValidDrop(target, e, id);
10098
getRepairXY : function(e, data){
10099
return this.el.getXY();
10103
onInvalidDrop : function(target, e, id){
10104
this.beforeInvalidDrop(target, e, id);
10105
if(this.cachedTarget){
10106
if(this.cachedTarget.isNotifyTarget){
10107
this.cachedTarget.notifyOut(this, e, this.dragData);
10109
this.cacheTarget = null;
10111
this.proxy.repair(this.getRepairXY(e, this.dragData), this.afterRepair, this);
10113
if(this.afterInvalidDrop){
10115
this.afterInvalidDrop(e, id);
10120
afterRepair : function(){
10122
this.el.highlight(this.hlColor || "c3daf9");
10124
this.dragging = false;
10128
beforeInvalidDrop : function(target, e, id){
10133
handleMouseDown : function(e){
10134
if(this.dragging) {
10137
var data = this.getDragData(e);
10138
if(data && this.onBeforeDrag(data, e) !== false){
10139
this.dragData = data;
10141
Ext.dd.DragSource.superclass.handleMouseDown.apply(this, arguments);
10146
onBeforeDrag : function(data, e){
10151
onStartDrag : Ext.emptyFn,
10154
startDrag : function(x, y){
10155
this.proxy.reset();
10156
this.dragging = true;
10157
this.proxy.update("");
10158
this.onInitDrag(x, y);
10163
onInitDrag : function(x, y){
10164
var clone = this.el.dom.cloneNode(true);
10165
clone.id = Ext.id();
10166
this.proxy.update(clone);
10167
this.onStartDrag(x, y);
10172
getProxy : function(){
10177
hideProxy : function(){
10179
this.proxy.reset(true);
10180
this.dragging = false;
10184
triggerCacheRefresh : function(){
10185
Ext.dd.DDM.refreshCache(this.groups);
10189
b4EndDrag: function(e) {
10193
endDrag : function(e){
10194
this.onEndDrag(this.dragData, e);
10198
onEndDrag : function(data, e){
10202
autoOffset : function(x, y) {
10203
this.setDelta(-12, -20);
10207
Ext.dd.DropTarget = function(el, config){
10208
this.el = Ext.get(el);
10210
Ext.apply(this, config);
10212
if(this.containerScroll){
10213
Ext.dd.ScrollManager.register(this.el);
10216
Ext.dd.DropTarget.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group,
10221
Ext.extend(Ext.dd.DropTarget, Ext.dd.DDTarget, {
10225
dropAllowed : "x-dd-drop-ok",
10227
dropNotAllowed : "x-dd-drop-nodrop",
10233
isNotifyTarget : true,
10236
notifyEnter : function(dd, e, data){
10237
if(this.overClass){
10238
this.el.addClass(this.overClass);
10240
return this.dropAllowed;
10244
notifyOver : function(dd, e, data){
10245
return this.dropAllowed;
10249
notifyOut : function(dd, e, data){
10250
if(this.overClass){
10251
this.el.removeClass(this.overClass);
10256
notifyDrop : function(dd, e, data){
10261
Ext.dd.DragZone = function(el, config){
10262
Ext.dd.DragZone.superclass.constructor.call(this, el, config);
10263
if(this.containerScroll){
10264
Ext.dd.ScrollManager.register(this.el);
10268
Ext.extend(Ext.dd.DragZone, Ext.dd.DragSource, {
10273
getDragData : function(e){
10274
return Ext.dd.Registry.getHandleFromEvent(e);
10278
onInitDrag : function(x, y){
10279
this.proxy.update(this.dragData.ddel.cloneNode(true));
10280
this.onStartDrag(x, y);
10285
afterRepair : function(){
10287
Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9");
10289
this.dragging = false;
10293
getRepairXY : function(e){
10294
return Ext.Element.fly(this.dragData.ddel).getXY();
10298
Ext.dd.DropZone = function(el, config){
10299
Ext.dd.DropZone.superclass.constructor.call(this, el, config);
10302
Ext.extend(Ext.dd.DropZone, Ext.dd.DropTarget, {
10304
getTargetFromEvent : function(e){
10305
return Ext.dd.Registry.getTargetFromEvent(e);
10309
onNodeEnter : function(n, dd, e, data){
10314
onNodeOver : function(n, dd, e, data){
10315
return this.dropAllowed;
10319
onNodeOut : function(n, dd, e, data){
10324
onNodeDrop : function(n, dd, e, data){
10329
onContainerOver : function(dd, e, data){
10330
return this.dropNotAllowed;
10334
onContainerDrop : function(dd, e, data){
10339
notifyEnter : function(dd, e, data){
10340
return this.dropNotAllowed;
10344
notifyOver : function(dd, e, data){
10345
var n = this.getTargetFromEvent(e);
10347
if(this.lastOverNode){
10348
this.onNodeOut(this.lastOverNode, dd, e, data);
10349
this.lastOverNode = null;
10351
return this.onContainerOver(dd, e, data);
10353
if(this.lastOverNode != n){
10354
if(this.lastOverNode){
10355
this.onNodeOut(this.lastOverNode, dd, e, data);
10357
this.onNodeEnter(n, dd, e, data);
10358
this.lastOverNode = n;
10360
return this.onNodeOver(n, dd, e, data);
10364
notifyOut : function(dd, e, data){
10365
if(this.lastOverNode){
10366
this.onNodeOut(this.lastOverNode, dd, e, data);
10367
this.lastOverNode = null;
10372
notifyDrop : function(dd, e, data){
10373
if(this.lastOverNode){
10374
this.onNodeOut(this.lastOverNode, dd, e, data);
10375
this.lastOverNode = null;
10377
var n = this.getTargetFromEvent(e);
10379
this.onNodeDrop(n, dd, e, data) :
10380
this.onContainerDrop(dd, e, data);
10384
triggerCacheRefresh : function(){
10385
Ext.dd.DDM.refreshCache(this.groups);
10390
Ext.data.SortTypes = {
10392
none : function(s){
10397
stripTagsRE : /<\/?[^>]+>/gi,
10400
asText : function(s){
10401
return String(s).replace(this.stripTagsRE, "");
10405
asUCText : function(s){
10406
return String(s).toUpperCase().replace(this.stripTagsRE, "");
10410
asUCString : function(s) {
10411
return String(s).toUpperCase();
10415
asDate : function(s) {
10420
return s.getTime();
10422
return Date.parse(String(s));
10426
asFloat : function(s) {
10427
var val = parseFloat(String(s).replace(/,/g, ""));
10428
if(isNaN(val)) val = 0;
10433
asInt : function(s) {
10434
var val = parseInt(String(s).replace(/,/g, ""));
10435
if(isNaN(val)) val = 0;
10440
Ext.data.Record = function(data, id){
10441
this.id = (id || id === 0) ? id : ++Ext.data.Record.AUTO_ID;
10446
Ext.data.Record.create = function(o){
10447
var f = Ext.extend(Ext.data.Record, {});
10448
var p = f.prototype;
10449
p.fields = new Ext.util.MixedCollection(false, function(field){
10452
for(var i = 0, len = o.length; i < len; i++){
10453
p.fields.add(new Ext.data.Field(o[i]));
10455
f.getField = function(name){
10456
return p.fields.get(name);
10461
Ext.data.Record.AUTO_ID = 1000;
10462
Ext.data.Record.EDIT = 'edit';
10463
Ext.data.Record.REJECT = 'reject';
10464
Ext.data.Record.COMMIT = 'commit';
10466
Ext.data.Record.prototype = {
10476
join : function(store){
10477
this.store = store;
10481
set : function(name, value){
10482
if(String(this.data[name]) == String(value)){
10486
if(!this.modified){
10487
this.modified = {};
10489
if(typeof this.modified[name] == 'undefined'){
10490
this.modified[name] = this.data[name];
10492
this.data[name] = value;
10493
if(!this.editing && this.store){
10494
this.store.afterEdit(this);
10499
get : function(name){
10500
return this.data[name];
10504
beginEdit : function(){
10505
this.editing = true;
10506
this.modified = {};
10510
cancelEdit : function(){
10511
this.editing = false;
10512
delete this.modified;
10516
endEdit : function(){
10517
this.editing = false;
10518
if(this.dirty && this.store){
10519
this.store.afterEdit(this);
10524
reject : function(silent){
10525
var m = this.modified;
10527
if(typeof m[n] != "function"){
10528
this.data[n] = m[n];
10531
this.dirty = false;
10532
delete this.modified;
10533
this.editing = false;
10534
if(this.store && silent !== true){
10535
this.store.afterReject(this);
10540
commit : function(silent){
10541
this.dirty = false;
10542
delete this.modified;
10543
this.editing = false;
10544
if(this.store && silent !== true){
10545
this.store.afterCommit(this);
10550
getChanges : function(){
10551
var m = this.modified, cs = {};
10553
if(m.hasOwnProperty(n)){
10554
cs[n] = this.data[n];
10560
hasError : function(){
10561
return this.error != null;
10564
clearError : function(){
10569
copy : function(newId) {
10570
return new this.constructor(Ext.apply({}, this.data), newId || this.id);
10574
isModified : function(fieldName){
10575
return !!(this.modified && this.modified.hasOwnProperty(fieldName));
10579
Ext.StoreMgr = Ext.apply(new Ext.util.MixedCollection(), {
10583
register : function(){
10584
for(var i = 0, s; s = arguments[i]; i++){
10590
unregister : function(){
10591
for(var i = 0, s; s = arguments[i]; i++){
10592
this.remove(this.lookup(s));
10597
lookup : function(id){
10598
return typeof id == "object" ? id : this.get(id);
10601
getKey : function(o){
10602
return o.storeId || o.id;
10606
Ext.data.Store = function(config){
10607
this.data = new Ext.util.MixedCollection(false);
10608
this.data.getKey = function(o){
10612
this.baseParams = {};
10613
this.paramNames = {
10620
if(config && config.data){
10621
this.inlineData = config.data;
10622
delete config.data;
10625
Ext.apply(this, config);
10627
if(this.url && !this.proxy){
10628
this.proxy = new Ext.data.HttpProxy({url: this.url});
10631
if(this.reader){ if(!this.recordType){
10632
this.recordType = this.reader.recordType;
10634
if(this.reader.onMetaChange){
10635
this.reader.onMetaChange = this.onMetaChange.createDelegate(this);
10639
if(this.recordType){
10640
this.fields = this.recordType.prototype.fields;
10642
this.modified = [];
10666
this.relayEvents(this.proxy, ["loadexception"]);
10669
this.sortToggle = {};
10671
this.setDefaultSort(this.sortInfo.field, this.sortInfo.direction);
10674
Ext.data.Store.superclass.constructor.call(this);
10676
if(this.storeId || this.id){
10677
Ext.StoreMgr.register(this);
10679
if(this.inlineData){
10680
this.loadData(this.inlineData);
10681
delete this.inlineData;
10682
}else if(this.autoLoad){
10683
this.load.defer(10, this, [
10684
typeof this.autoLoad == 'object' ?
10685
this.autoLoad : undefined]);
10688
Ext.extend(Ext.data.Store, Ext.util.Observable, {
10698
remoteSort : false,
10701
pruneModifiedRecords : false,
10704
lastOptions : null,
10706
destroy : function(){
10708
Ext.StoreMgr.unregister(this);
10711
this.purgeListeners();
10715
add : function(records){
10716
records = [].concat(records);
10717
if(records.length < 1){
10720
for(var i = 0, len = records.length; i < len; i++){
10721
records[i].join(this);
10723
var index = this.data.length;
10724
this.data.addAll(records);
10726
this.snapshot.addAll(records);
10728
this.fireEvent("add", this, records, index);
10732
addSorted : function(record){
10733
var index = this.findInsertIndex(record);
10734
this.insert(index, record);
10738
remove : function(record){
10739
var index = this.data.indexOf(record);
10740
this.data.removeAt(index);
10741
if(this.pruneModifiedRecords){
10742
this.modified.remove(record);
10745
this.snapshot.remove(record);
10747
this.fireEvent("remove", this, record, index);
10751
removeAll : function(){
10754
this.snapshot.clear();
10756
if(this.pruneModifiedRecords){
10757
this.modified = [];
10759
this.fireEvent("clear", this);
10763
insert : function(index, records){
10764
records = [].concat(records);
10765
for(var i = 0, len = records.length; i < len; i++){
10766
this.data.insert(index, records[i]);
10767
records[i].join(this);
10769
this.fireEvent("add", this, records, index);
10773
indexOf : function(record){
10774
return this.data.indexOf(record);
10778
indexOfId : function(id){
10779
return this.data.indexOfKey(id);
10783
getById : function(id){
10784
return this.data.key(id);
10788
getAt : function(index){
10789
return this.data.itemAt(index);
10793
getRange : function(start, end){
10794
return this.data.getRange(start, end);
10797
storeOptions : function(o){
10798
o = Ext.apply({}, o);
10801
this.lastOptions = o;
10805
load : function(options){
10806
options = options || {};
10807
if(this.fireEvent("beforeload", this, options) !== false){
10808
this.storeOptions(options);
10809
var p = Ext.apply(options.params || {}, this.baseParams);
10810
if(this.sortInfo && this.remoteSort){
10811
var pn = this.paramNames;
10812
p[pn["sort"]] = this.sortInfo.field;
10813
p[pn["dir"]] = this.sortInfo.direction;
10815
this.proxy.load(p, this.reader, this.loadRecords, this, options);
10823
reload : function(options){
10824
this.load(Ext.applyIf(options||{}, this.lastOptions));
10827
loadRecords : function(o, options, success){
10828
if(!o || success === false){
10829
if(success !== false){
10830
this.fireEvent("load", this, [], options);
10832
if(options.callback){
10833
options.callback.call(options.scope || this, [], options, false);
10837
var r = o.records, t = o.totalRecords || r.length;
10838
if(!options || options.add !== true){
10839
if(this.pruneModifiedRecords){
10840
this.modified = [];
10842
for(var i = 0, len = r.length; i < len; i++){
10846
this.data = this.snapshot;
10847
delete this.snapshot;
10850
this.data.addAll(r);
10851
this.totalLength = t;
10853
this.fireEvent("datachanged", this);
10855
this.totalLength = Math.max(t, this.data.length+r.length);
10858
this.fireEvent("load", this, r, options);
10859
if(options.callback){
10860
options.callback.call(options.scope || this, r, options, true);
10865
loadData : function(o, append){
10866
var r = this.reader.readRecords(o);
10867
this.loadRecords(r, {add: append}, true);
10871
getCount : function(){
10872
return this.data.length || 0;
10876
getTotalCount : function(){
10877
return this.totalLength || 0;
10881
getSortState : function(){
10882
return this.sortInfo;
10885
applySort : function(){
10886
if(this.sortInfo && !this.remoteSort){
10887
var s = this.sortInfo, f = s.field;
10888
this.sortData(f, s.direction);
10892
sortData : function(f, direction){
10893
direction = direction || 'ASC';
10894
var st = this.fields.get(f).sortType;
10895
var fn = function(r1, r2){
10896
var v1 = st(r1.data[f]), v2 = st(r2.data[f]);
10897
return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
10899
this.data.sort(direction, fn);
10900
if(this.snapshot && this.snapshot != this.data){
10901
this.snapshot.sort(direction, fn);
10906
setDefaultSort : function(field, dir){
10907
dir = dir ? dir.toUpperCase() : "ASC";
10908
this.sortInfo = {field: field, direction: dir};
10909
this.sortToggle[field] = dir;
10913
sort : function(fieldName, dir){
10914
var f = this.fields.get(fieldName);
10919
if(this.sortInfo && this.sortInfo.field == f.name){ dir = (this.sortToggle[f.name] || "ASC").toggle("ASC", "DESC");
10924
var st = (this.sortToggle) ? this.sortToggle[f.name] : null;
10925
var si = (this.sortInfo) ? this.sortInfo : null;
10927
this.sortToggle[f.name] = dir;
10928
this.sortInfo = {field: f.name, direction: dir};
10929
if(!this.remoteSort){
10931
this.fireEvent("datachanged", this);
10933
if (!this.load(this.lastOptions)) {
10935
this.sortToggle[f.name] = st;
10938
this.sortInfo = si;
10945
each : function(fn, scope){
10946
this.data.each(fn, scope);
10950
getModifiedRecords : function(){
10951
return this.modified;
10954
createFilterFn : function(property, value, anyMatch, caseSensitive){
10955
if(Ext.isEmpty(value, false)){
10958
value = this.data.createValueMatcher(value, anyMatch, caseSensitive);
10959
return function(r){
10960
return value.test(r.data[property]);
10965
sum : function(property, start, end){
10966
var rs = this.data.items, v = 0;
10967
start = start || 0;
10968
end = (end || end === 0) ? end : rs.length-1;
10970
for(var i = start; i <= end; i++){
10971
v += (rs[i].data[property] || 0);
10977
filter : function(property, value, anyMatch, caseSensitive){
10978
var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);
10979
return fn ? this.filterBy(fn) : this.clearFilter();
10983
filterBy : function(fn, scope){
10984
this.snapshot = this.snapshot || this.data;
10985
this.data = this.queryBy(fn, scope||this);
10986
this.fireEvent("datachanged", this);
10990
query : function(property, value, anyMatch, caseSensitive){
10991
var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);
10992
return fn ? this.queryBy(fn) : this.data.clone();
10996
queryBy : function(fn, scope){
10997
var data = this.snapshot || this.data;
10998
return data.filterBy(fn, scope||this);
11002
find : function(property, value, start, anyMatch, caseSensitive){
11003
var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);
11004
return fn ? this.data.findIndexBy(fn, null, start) : -1;
11008
findBy : function(fn, scope, start){
11009
return this.data.findIndexBy(fn, scope, start);
11013
collect : function(dataIndex, allowNull, bypassFilter){
11014
var d = (bypassFilter === true && this.snapshot) ?
11015
this.snapshot.items : this.data.items;
11016
var v, sv, r = [], l = {};
11017
for(var i = 0, len = d.length; i < len; i++){
11018
v = d[i].data[dataIndex];
11020
if((allowNull || !Ext.isEmpty(v)) && !l[sv]){
11029
clearFilter : function(suppressEvent){
11030
if(this.isFiltered()){
11031
this.data = this.snapshot;
11032
delete this.snapshot;
11033
if(suppressEvent !== true){
11034
this.fireEvent("datachanged", this);
11040
isFiltered : function(){
11041
return this.snapshot && this.snapshot != this.data;
11044
afterEdit : function(record){
11045
if(this.modified.indexOf(record) == -1){
11046
this.modified.push(record);
11048
this.fireEvent("update", this, record, Ext.data.Record.EDIT);
11051
afterReject : function(record){
11052
this.modified.remove(record);
11053
this.fireEvent("update", this, record, Ext.data.Record.REJECT);
11056
afterCommit : function(record){
11057
this.modified.remove(record);
11058
this.fireEvent("update", this, record, Ext.data.Record.COMMIT);
11062
commitChanges : function(){
11063
var m = this.modified.slice(0);
11064
this.modified = [];
11065
for(var i = 0, len = m.length; i < len; i++){
11071
rejectChanges : function(){
11072
var m = this.modified.slice(0);
11073
this.modified = [];
11074
for(var i = 0, len = m.length; i < len; i++){
11079
onMetaChange : function(meta, rtype, o){
11080
this.recordType = rtype;
11081
this.fields = rtype.prototype.fields;
11082
delete this.snapshot;
11083
this.sortInfo = meta.sortInfo;
11084
this.modified = [];
11085
this.fireEvent('metachange', this, this.reader.meta);
11088
findInsertIndex : function(record){
11089
this.suspendEvents();
11090
var data = this.data.clone();
11091
this.data.add(record);
11093
var index = this.data.indexOf(record);
11095
this.resumeEvents();
11100
Ext.data.SimpleStore = function(config){
11101
Ext.data.SimpleStore.superclass.constructor.call(this, Ext.apply(config, {
11102
reader: new Ext.data.ArrayReader({
11105
Ext.data.Record.create(config.fields)
11109
Ext.extend(Ext.data.SimpleStore, Ext.data.Store, {
11110
loadData : function(data, append){
11111
if(this.expandData === true){
11113
for(var i = 0, len = data.length; i < len; i++){
11114
r[r.length] = [data[i]];
11118
Ext.data.SimpleStore.superclass.loadData.call(this, data, append);
11122
Ext.data.JsonStore = function(c){
11125
Ext.data.JsonStore.superclass.constructor.call(this, Ext.apply(c, {
11126
proxy: c.proxy || (!c.data ? new Ext.data.HttpProxy({url: c.url}) : undefined),
11127
reader: new Ext.data.JsonReader(c, c.fields)
11130
Ext.extend(Ext.data.JsonStore, Ext.data.Store);
11134
Ext.data.Field = function(config){
11135
if(typeof config == "string"){
11136
config = {name: config};
11138
Ext.apply(this, config);
11141
this.type = "auto";
11144
var st = Ext.data.SortTypes;
11146
if(typeof this.sortType == "string"){
11147
this.sortType = st[this.sortType];
11151
if(!this.sortType){
11154
this.sortType = st.asUCString;
11157
this.sortType = st.asDate;
11160
this.sortType = st.none;
11165
var stripRe = /[\$,%]/g;
11170
var cv, dateFormat = this.dateFormat;
11175
cv = function(v){ return v; };
11178
cv = function(v){ return (v === undefined || v === null) ? '' : String(v); };
11182
return v !== undefined && v !== null && v !== '' ?
11183
parseInt(String(v).replace(stripRe, ""), 10) : '';
11188
return v !== undefined && v !== null && v !== '' ?
11189
parseFloat(String(v).replace(stripRe, ""), 10) : '';
11194
cv = function(v){ return v === true || v === "true" || v == 1; };
11205
if(dateFormat == "timestamp"){
11206
return new Date(v*1000);
11208
if(dateFormat == "time"){
11209
return new Date(parseInt(v, 10));
11211
return Date.parseDate(v, dateFormat);
11213
var parsed = Date.parse(v);
11214
return parsed ? new Date(parsed) : null;
11223
Ext.data.Field.prototype = {
11231
Ext.data.DataReader = function(meta, recordType){
11234
this.recordType = Ext.isArray(recordType) ?
11235
Ext.data.Record.create(recordType) : recordType;
11238
Ext.data.DataReader.prototype = {
11242
Ext.data.DataProxy = function(){
11249
Ext.data.DataProxy.superclass.constructor.call(this);
11252
Ext.extend(Ext.data.DataProxy, Ext.util.Observable);
11254
Ext.data.MemoryProxy = function(data){
11255
Ext.data.MemoryProxy.superclass.constructor.call(this);
11259
Ext.extend(Ext.data.MemoryProxy, Ext.data.DataProxy, {
11263
load : function(params, reader, callback, scope, arg){
11264
params = params || {};
11267
result = reader.readRecords(this.data);
11269
this.fireEvent("loadexception", this, arg, null, e);
11270
callback.call(scope, null, arg, false);
11273
callback.call(scope, result, arg, true);
11277
update : function(params, records){
11282
Ext.data.HttpProxy = function(conn){
11283
Ext.data.HttpProxy.superclass.constructor.call(this);
11286
this.useAjax = !conn || !conn.events;
11291
Ext.extend(Ext.data.HttpProxy, Ext.data.DataProxy, {
11293
getConnection : function(){
11294
return this.useAjax ? Ext.Ajax : this.conn;
11298
load : function(params, reader, callback, scope, arg){
11299
if(this.fireEvent("beforeload", this, params) !== false){
11301
params : params || {},
11303
callback : callback,
11308
callback : this.loadResponse,
11312
Ext.applyIf(o, this.conn);
11313
if(this.activeRequest){
11314
Ext.Ajax.abort(this.activeRequest);
11316
this.activeRequest = Ext.Ajax.request(o);
11318
this.conn.request(o);
11321
callback.call(scope||this, null, arg, false);
11326
loadResponse : function(o, success, response){
11327
delete this.activeRequest;
11329
this.fireEvent("loadexception", this, o, response);
11330
o.request.callback.call(o.request.scope, null, o.request.arg, false);
11335
result = o.reader.read(response);
11337
this.fireEvent("loadexception", this, o, response, e);
11338
o.request.callback.call(o.request.scope, null, o.request.arg, false);
11341
this.fireEvent("load", this, o, o.request.arg);
11342
o.request.callback.call(o.request.scope, result, o.request.arg, true);
11346
update : function(dataSet){
11351
updateResponse : function(dataSet){
11356
Ext.data.ScriptTagProxy = function(config){
11357
Ext.data.ScriptTagProxy.superclass.constructor.call(this);
11358
Ext.apply(this, config);
11359
this.head = document.getElementsByTagName("head")[0];
11364
Ext.data.ScriptTagProxy.TRANS_ID = 1000;
11366
Ext.extend(Ext.data.ScriptTagProxy, Ext.data.DataProxy, {
11371
callbackParam : "callback",
11376
load : function(params, reader, callback, scope, arg){
11377
if(this.fireEvent("beforeload", this, params) !== false){
11379
var p = Ext.urlEncode(Ext.apply(params, this.extraParams));
11381
var url = this.url;
11382
url += (url.indexOf("?") != -1 ? "&" : "?") + p;
11384
url += "&_dc=" + (new Date().getTime());
11386
var transId = ++Ext.data.ScriptTagProxy.TRANS_ID;
11389
cb : "stcCallback"+transId,
11390
scriptId : "stcScript"+transId,
11394
callback : callback,
11400
window[trans.cb] = function(o){
11401
conn.handleResponse(o, trans);
11404
url += String.format("&{0}={1}", this.callbackParam, trans.cb);
11406
if(this.autoAbort !== false){
11410
trans.timeoutId = this.handleFailure.defer(this.timeout, this, [trans]);
11412
var script = document.createElement("script");
11413
script.setAttribute("src", url);
11414
script.setAttribute("type", "text/javascript");
11415
script.setAttribute("id", trans.scriptId);
11416
this.head.appendChild(script);
11418
this.trans = trans;
11420
callback.call(scope||this, null, arg, false);
11425
isLoading : function(){
11426
return this.trans ? true : false;
11430
abort : function(){
11431
if(this.isLoading()){
11432
this.destroyTrans(this.trans);
11437
destroyTrans : function(trans, isLoaded){
11438
this.head.removeChild(document.getElementById(trans.scriptId));
11439
clearTimeout(trans.timeoutId);
11441
window[trans.cb] = undefined;
11443
delete window[trans.cb];
11447
window[trans.cb] = function(){
11448
window[trans.cb] = undefined;
11450
delete window[trans.cb];
11457
handleResponse : function(o, trans){
11458
this.trans = false;
11459
this.destroyTrans(trans, true);
11462
result = trans.reader.readRecords(o);
11464
this.fireEvent("loadexception", this, o, trans.arg, e);
11465
trans.callback.call(trans.scope||window, null, trans.arg, false);
11468
this.fireEvent("load", this, o, trans.arg);
11469
trans.callback.call(trans.scope||window, result, trans.arg, true);
11473
handleFailure : function(trans){
11474
this.trans = false;
11475
this.destroyTrans(trans, false);
11476
this.fireEvent("loadexception", this, null, trans.arg);
11477
trans.callback.call(trans.scope||window, null, trans.arg, false);
11481
Ext.data.JsonReader = function(meta, recordType){
11483
Ext.data.JsonReader.superclass.constructor.call(this, meta, recordType || meta.fields);
11485
Ext.extend(Ext.data.JsonReader, Ext.data.DataReader, {
11488
read : function(response){
11489
var json = response.responseText;
11490
var o = eval("("+json+")");
11492
throw {message: "JsonReader.read: Json object not found"};
11494
return this.readRecords(o);
11497
onMetaChange : function(meta, recordType, o){
11502
simpleAccess: function(obj, subsc) {
11507
getJsonAccessor: function(){
11509
return function(expr) {
11511
return(re.test(expr))
11512
? new Function("obj", "return obj." + expr)
11517
return Ext.emptyFn;
11522
readRecords : function(o){
11527
this.meta = o.metaData;
11528
this.recordType = Ext.data.Record.create(o.metaData.fields);
11529
this.onMetaChange(this.meta, this.recordType, o);
11531
var s = this.meta, Record = this.recordType,
11532
f = Record.prototype.fields, fi = f.items, fl = f.length;
11535
if(s.totalProperty) {
11536
this.getTotal = this.getJsonAccessor(s.totalProperty);
11538
if(s.successProperty) {
11539
this.getSuccess = this.getJsonAccessor(s.successProperty);
11541
this.getRoot = s.root ? this.getJsonAccessor(s.root) : function(p){return p;};
11543
var g = this.getJsonAccessor(s.id);
11544
this.getId = function(rec) {
11546
return (r === undefined || r === "") ? null : r;
11549
this.getId = function(){return null;};
11552
for(var i = 0; i < fl; i++){
11554
var map = (f.mapping !== undefined && f.mapping !== null) ? f.mapping : f.name;
11555
this.ef[i] = this.getJsonAccessor(map);
11559
var root = this.getRoot(o), c = root.length, totalRecords = c, success = true;
11560
if(s.totalProperty){
11561
var v = parseInt(this.getTotal(o), 10);
11566
if(s.successProperty){
11567
var v = this.getSuccess(o);
11568
if(v === false || v === 'false'){
11573
for(var i = 0; i < c; i++){
11576
var id = this.getId(n);
11577
for(var j = 0; j < fl; j++){
11579
var v = this.ef[j](n);
11580
values[f.name] = f.convert((v !== undefined) ? v : f.defaultValue, n);
11582
var record = new Record(values, id);
11584
records[i] = record;
11589
totalRecords : totalRecords
11594
Ext.data.XmlReader = function(meta, recordType){
11596
Ext.data.XmlReader.superclass.constructor.call(this, meta, recordType || meta.fields);
11598
Ext.extend(Ext.data.XmlReader, Ext.data.DataReader, {
11600
read : function(response){
11601
var doc = response.responseXML;
11603
throw {message: "XmlReader.read: XML Document not available"};
11605
return this.readRecords(doc);
11609
readRecords : function(doc){
11611
this.xmlData = doc;
11612
var root = doc.documentElement || doc;
11613
var q = Ext.DomQuery;
11614
var recordType = this.recordType, fields = recordType.prototype.fields;
11615
var sid = this.meta.id;
11616
var totalRecords = 0, success = true;
11617
if(this.meta.totalRecords){
11618
totalRecords = q.selectNumber(this.meta.totalRecords, root, 0);
11621
if(this.meta.success){
11622
var sv = q.selectValue(this.meta.success, root, true);
11623
success = sv !== false && sv !== 'false';
11626
var ns = q.select(this.meta.record, root);
11627
for(var i = 0, len = ns.length; i < len; i++) {
11630
var id = sid ? q.selectValue(sid, n) : undefined;
11631
for(var j = 0, jlen = fields.length; j < jlen; j++){
11632
var f = fields.items[j];
11633
var v = q.selectValue(f.mapping || f.name, n, f.defaultValue);
11634
v = f.convert(v, n);
11635
values[f.name] = v;
11637
var record = new recordType(values, id);
11639
records[records.length] = record;
11645
totalRecords : totalRecords || records.length
11650
Ext.data.ArrayReader = Ext.extend(Ext.data.JsonReader, {
11652
readRecords : function(o){
11653
var sid = this.meta ? this.meta.id : null;
11654
var recordType = this.recordType, fields = recordType.prototype.fields;
11657
for(var i = 0; i < root.length; i++){
11660
var id = ((sid || sid === 0) && n[sid] !== undefined && n[sid] !== "" ? n[sid] : null);
11661
for(var j = 0, jlen = fields.length; j < jlen; j++){
11662
var f = fields.items[j];
11663
var k = f.mapping !== undefined && f.mapping !== null ? f.mapping : j;
11664
var v = n[k] !== undefined ? n[k] : f.defaultValue;
11665
v = f.convert(v, n);
11666
values[f.name] = v;
11668
var record = new recordType(values, id);
11670
records[records.length] = record;
11674
totalRecords : records.length
11679
Ext.data.Tree = function(root){
11680
this.nodeHash = {};
11684
this.setRootNode(root);
11705
Ext.data.Tree.superclass.constructor.call(this);
11708
Ext.extend(Ext.data.Tree, Ext.util.Observable, {
11710
pathSeparator: "/",
11713
proxyNodeEvent : function(){
11714
return this.fireEvent.apply(this, arguments);
11718
getRootNode : function(){
11723
setRootNode : function(node){
11725
node.ownerTree = this;
11726
node.isRoot = true;
11727
this.registerNode(node);
11732
getNodeById : function(id){
11733
return this.nodeHash[id];
11737
registerNode : function(node){
11738
this.nodeHash[node.id] = node;
11742
unregisterNode : function(node){
11743
delete this.nodeHash[node.id];
11746
toString : function(){
11747
return "[Tree"+(this.id?" "+this.id:"")+"]";
11752
Ext.data.Node = function(attributes){
11754
this.attributes = attributes || {};
11755
this.leaf = this.attributes.leaf;
11757
this.id = this.attributes.id;
11759
this.id = Ext.id(null, "ynode-");
11760
this.attributes.id = this.id;
11763
this.childNodes = [];
11764
if(!this.childNodes.indexOf){
11765
this.childNodes.indexOf = function(o){
11766
for(var i = 0, len = this.length; i < len; i++){
11767
if(this[i] == o) return i;
11773
this.parentNode = null;
11775
this.firstChild = null;
11777
this.lastChild = null;
11779
this.previousSibling = null;
11781
this.nextSibling = null;
11793
"beforeappend" : true,
11795
"beforeremove" : true,
11797
"beforemove" : true,
11799
"beforeinsert" : true
11801
this.listeners = this.attributes.listeners;
11802
Ext.data.Node.superclass.constructor.call(this);
11805
Ext.extend(Ext.data.Node, Ext.util.Observable, {
11807
fireEvent : function(evtName){
11809
if(Ext.data.Node.superclass.fireEvent.apply(this, arguments) === false){
11813
var ot = this.getOwnerTree();
11815
if(ot.proxyNodeEvent.apply(ot, arguments) === false){
11823
isLeaf : function(){
11824
return this.leaf === true;
11828
setFirstChild : function(node){
11829
this.firstChild = node;
11833
setLastChild : function(node){
11834
this.lastChild = node;
11839
isLast : function(){
11840
return (!this.parentNode ? true : this.parentNode.lastChild == this);
11844
isFirst : function(){
11845
return (!this.parentNode ? true : this.parentNode.firstChild == this);
11849
hasChildNodes : function(){
11850
return !this.isLeaf() && this.childNodes.length > 0;
11854
isExpandable : function(){
11855
return this.attributes.expandable || this.hasChildNodes();
11859
appendChild : function(node){
11861
if(Ext.isArray(node)){
11863
}else if(arguments.length > 1){
11868
for(var i = 0, len = multi.length; i < len; i++) {
11869
this.appendChild(multi[i]);
11872
if(this.fireEvent("beforeappend", this.ownerTree, this, node) === false){
11875
var index = this.childNodes.length;
11876
var oldParent = node.parentNode;
11879
if(node.fireEvent("beforemove", node.getOwnerTree(), node, oldParent, this, index) === false){
11882
oldParent.removeChild(node);
11884
index = this.childNodes.length;
11886
this.setFirstChild(node);
11888
this.childNodes.push(node);
11889
node.parentNode = this;
11890
var ps = this.childNodes[index-1];
11892
node.previousSibling = ps;
11893
ps.nextSibling = node;
11895
node.previousSibling = null;
11897
node.nextSibling = null;
11898
this.setLastChild(node);
11899
node.setOwnerTree(this.getOwnerTree());
11900
this.fireEvent("append", this.ownerTree, this, node, index);
11902
node.fireEvent("move", this.ownerTree, node, oldParent, this, index);
11909
removeChild : function(node){
11910
var index = this.childNodes.indexOf(node);
11914
if(this.fireEvent("beforeremove", this.ownerTree, this, node) === false){
11919
this.childNodes.splice(index, 1);
11922
if(node.previousSibling){
11923
node.previousSibling.nextSibling = node.nextSibling;
11925
if(node.nextSibling){
11926
node.nextSibling.previousSibling = node.previousSibling;
11930
if(this.firstChild == node){
11931
this.setFirstChild(node.nextSibling);
11933
if(this.lastChild == node){
11934
this.setLastChild(node.previousSibling);
11937
node.setOwnerTree(null);
11939
node.parentNode = null;
11940
node.previousSibling = null;
11941
node.nextSibling = null;
11942
this.fireEvent("remove", this.ownerTree, this, node);
11947
insertBefore : function(node, refNode){
11949
return this.appendChild(node);
11952
if(node == refNode){
11956
if(this.fireEvent("beforeinsert", this.ownerTree, this, node, refNode) === false){
11959
var index = this.childNodes.indexOf(refNode);
11960
var oldParent = node.parentNode;
11961
var refIndex = index;
11964
if(oldParent == this && this.childNodes.indexOf(node) < index){
11970
if(node.fireEvent("beforemove", node.getOwnerTree(), node, oldParent, this, index, refNode) === false){
11973
oldParent.removeChild(node);
11976
this.setFirstChild(node);
11978
this.childNodes.splice(refIndex, 0, node);
11979
node.parentNode = this;
11980
var ps = this.childNodes[refIndex-1];
11982
node.previousSibling = ps;
11983
ps.nextSibling = node;
11985
node.previousSibling = null;
11987
node.nextSibling = refNode;
11988
refNode.previousSibling = node;
11989
node.setOwnerTree(this.getOwnerTree());
11990
this.fireEvent("insert", this.ownerTree, this, node, refNode);
11992
node.fireEvent("move", this.ownerTree, node, oldParent, this, refIndex, refNode);
11998
remove : function(){
11999
this.parentNode.removeChild(this);
12004
item : function(index){
12005
return this.childNodes[index];
12009
replaceChild : function(newChild, oldChild){
12010
this.insertBefore(newChild, oldChild);
12011
this.removeChild(oldChild);
12016
indexOf : function(child){
12017
return this.childNodes.indexOf(child);
12021
getOwnerTree : function(){
12023
if(!this.ownerTree){
12027
this.ownerTree = p.ownerTree;
12033
return this.ownerTree;
12037
getDepth : function(){
12040
while(p.parentNode){
12048
setOwnerTree : function(tree){
12050
if(tree != this.ownerTree){
12051
if(this.ownerTree){
12052
this.ownerTree.unregisterNode(this);
12054
this.ownerTree = tree;
12055
var cs = this.childNodes;
12056
for(var i = 0, len = cs.length; i < len; i++) {
12057
cs[i].setOwnerTree(tree);
12060
tree.registerNode(this);
12066
getPath : function(attr){
12067
attr = attr || "id";
12068
var p = this.parentNode;
12069
var b = [this.attributes[attr]];
12071
b.unshift(p.attributes[attr]);
12074
var sep = this.getOwnerTree().pathSeparator;
12075
return sep + b.join(sep);
12079
bubble : function(fn, scope, args){
12082
if(fn.apply(scope || p, args || [p]) === false){
12090
cascade : function(fn, scope, args){
12091
if(fn.apply(scope || this, args || [this]) !== false){
12092
var cs = this.childNodes;
12093
for(var i = 0, len = cs.length; i < len; i++) {
12094
cs[i].cascade(fn, scope, args);
12100
eachChild : function(fn, scope, args){
12101
var cs = this.childNodes;
12102
for(var i = 0, len = cs.length; i < len; i++) {
12103
if(fn.apply(scope || this, args || [cs[i]]) === false){
12110
findChild : function(attribute, value){
12111
var cs = this.childNodes;
12112
for(var i = 0, len = cs.length; i < len; i++) {
12113
if(cs[i].attributes[attribute] == value){
12121
findChildBy : function(fn, scope){
12122
var cs = this.childNodes;
12123
for(var i = 0, len = cs.length; i < len; i++) {
12124
if(fn.call(scope||cs[i], cs[i]) === true){
12132
sort : function(fn, scope){
12133
var cs = this.childNodes;
12134
var len = cs.length;
12136
var sortFn = scope ? function(){fn.apply(scope, arguments);} : fn;
12138
for(var i = 0; i < len; i++){
12140
n.previousSibling = cs[i-1];
12141
n.nextSibling = cs[i+1];
12143
this.setFirstChild(n);
12146
this.setLastChild(n);
12153
contains : function(node){
12154
return node.isAncestor(this);
12158
isAncestor : function(node){
12159
var p = this.parentNode;
12169
toString : function(){
12170
return "[Node"+(this.id?" "+this.id:"")+"]";
12174
Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {
12177
remoteGroup : false,
12182
clearGrouping : function(){
12183
this.groupField = false;
12184
if(this.remoteGroup){
12185
if(this.baseParams){
12186
delete this.baseParams.groupBy;
12191
this.fireEvent('datachanged', this);
12196
groupBy : function(field, forceRegroup){
12197
if(this.groupField == field && !forceRegroup){
12200
this.groupField = field;
12201
if(this.remoteGroup){
12202
if(!this.baseParams){
12203
this.baseParams = {};
12205
this.baseParams['groupBy'] = field;
12207
if(this.groupOnSort){
12211
if(this.remoteGroup){
12214
var si = this.sortInfo || {};
12215
if(si.field != field){
12218
this.sortData(field);
12220
this.fireEvent('datachanged', this);
12225
applySort : function(){
12226
Ext.data.GroupingStore.superclass.applySort.call(this);
12227
if(!this.groupOnSort && !this.remoteGroup){
12228
var gs = this.getGroupState();
12229
if(gs && gs != this.sortInfo.field){
12230
this.sortData(this.groupField);
12236
applyGrouping : function(alwaysFireChange){
12237
if(this.groupField !== false){
12238
this.groupBy(this.groupField, true);
12241
if(alwaysFireChange === true){
12242
this.fireEvent('datachanged', this);
12249
getGroupState : function(){
12250
return this.groupOnSort && this.groupField !== false ?
12251
(this.sortInfo ? this.sortInfo.field : undefined) : this.groupField;
12255
Ext.ComponentMgr = function(){
12256
var all = new Ext.util.MixedCollection();
12261
register : function(c){
12266
unregister : function(c){
12271
get : function(id){
12272
return all.get(id);
12276
onAvailable : function(id, fn, scope){
12277
all.on("add", function(index, o){
12279
fn.call(scope || o, o);
12280
all.un("add", fn, scope);
12289
registerType : function(xtype, cls){
12290
types[xtype] = cls;
12295
create : function(config, defaultType){
12296
return new types[config.xtype || defaultType](config);
12302
Ext.reg = Ext.ComponentMgr.registerType; // this will be called a lot internally, shorthand to keep the bytes down
12304
Ext.Component = function(config){
12305
config = config || {};
12306
if(config.initialConfig){
12307
if(config.isAction){ this.baseAction = config;
12309
config = config.initialConfig; }else if(config.tagName || config.dom || typeof config == "string"){ config = {applyTo: config, id: config.id || config};
12313
this.initialConfig = config;
12315
Ext.apply(this, config);
12338
'beforestaterestore',
12347
Ext.ComponentMgr.register(this);
12348
Ext.Component.superclass.constructor.call(this);
12350
if(this.baseAction){
12351
this.baseAction.addComponent(this);
12354
this.initComponent();
12357
if(Ext.isArray(this.plugins)){
12358
for(var i = 0, len = this.plugins.length; i < len; i++){
12359
this.plugins[i] = this.initPlugin(this.plugins[i]);
12362
this.plugins = this.initPlugin(this.plugins);
12366
if(this.stateful !== false){
12367
this.initState(config);
12371
this.applyToMarkup(this.applyTo);
12372
delete this.applyTo;
12373
}else if(this.renderTo){
12374
this.render(this.renderTo);
12375
delete this.renderTo;
12379
Ext.Component.AUTO_ID = 1000;
12381
Ext.extend(Ext.Component, Ext.util.Observable, {
12400
disabledClass : "x-item-disabled",
12402
allowDomMove : true,
12406
hideMode: 'display',
12418
ctype : "Ext.Component",
12422
getActionEl : function(){
12423
return this[this.actionMode];
12426
initPlugin : function(p){
12432
initComponent : Ext.emptyFn,
12435
render : function(container, position){
12436
if(!this.rendered && this.fireEvent("beforerender", this) !== false){
12437
if(!container && this.el){
12438
this.el = Ext.get(this.el);
12439
container = this.el.dom.parentNode;
12440
this.allowDomMove = false;
12442
this.container = Ext.get(container);
12444
this.container.addClass(this.ctCls);
12446
this.rendered = true;
12447
if(position !== undefined){
12448
if(typeof position == 'number'){
12449
position = this.container.dom.childNodes[position];
12451
position = Ext.getDom(position);
12454
this.onRender(this.container, position || null);
12456
this.el.removeClass(['x-hidden','x-hide-' + this.hideMode]);
12459
this.el.addClass(this.cls);
12463
this.el.applyStyles(this.style);
12466
this.fireEvent("render", this);
12467
this.afterRender(this.container);
12475
if(this.stateful !== false){
12476
this.initStateEvents();
12482
initState : function(config){
12483
if(Ext.state.Manager){
12484
var state = Ext.state.Manager.get(this.stateId || this.id);
12486
if(this.fireEvent('beforestaterestore', this, state) !== false){
12487
this.applyState(state);
12488
this.fireEvent('staterestore', this, state);
12494
initStateEvents : function(){
12495
if(this.stateEvents){
12496
for(var i = 0, e; e = this.stateEvents[i]; i++){
12497
this.on(e, this.saveState, this, {delay:100});
12502
applyState : function(state, config){
12504
Ext.apply(this, state);
12508
getState : function(){
12512
saveState : function(){
12513
if(Ext.state.Manager){
12514
var state = this.getState();
12515
if(this.fireEvent('beforestatesave', this, state) !== false){
12516
Ext.state.Manager.set(this.stateId || this.id, state);
12517
this.fireEvent('statesave', this, state);
12523
applyToMarkup : function(el){
12524
this.allowDomMove = false;
12525
this.el = Ext.get(el);
12526
this.render(this.el.dom.parentNode);
12530
addClass : function(cls){
12532
this.el.addClass(cls);
12534
this.cls = this.cls ? this.cls + ' ' + cls : cls;
12539
removeClass : function(cls){
12541
this.el.removeClass(cls);
12542
}else if(this.cls){
12543
this.cls = this.cls.split(' ').remove(cls).join(' ');
12547
onRender : function(ct, position){
12549
if(typeof this.autoEl == 'string'){
12550
this.el = document.createElement(this.autoEl);
12552
var div = document.createElement('div');
12553
Ext.DomHelper.overwrite(div, this.autoEl);
12554
this.el = div.firstChild;
12557
this.el.id = this.getId();
12561
this.el = Ext.get(this.el);
12562
if(this.allowDomMove !== false){
12563
ct.dom.insertBefore(this.el.dom, position);
12566
this.el.addClassOnOver(this.overCls);
12571
getAutoCreate : function(){
12572
var cfg = typeof this.autoCreate == "object" ?
12573
this.autoCreate : Ext.apply({}, this.defaultAutoCreate);
12574
if(this.id && !cfg.id){
12580
afterRender : Ext.emptyFn,
12583
destroy : function(){
12584
if(this.fireEvent("beforedestroy", this) !== false){
12585
this.beforeDestroy();
12587
this.el.removeAllListeners();
12589
if(this.actionMode == "container"){
12590
this.container.remove();
12594
Ext.ComponentMgr.unregister(this);
12595
this.fireEvent("destroy", this);
12596
this.purgeListeners();
12600
beforeDestroy : Ext.emptyFn,
12602
onDestroy : Ext.emptyFn,
12605
getEl : function(){
12610
getId : function(){
12611
return this.id || (this.id = "ext-comp-" + (++Ext.Component.AUTO_ID));
12615
getItemId : function(){
12616
return this.itemId || this.getId();
12620
focus : function(selectText, delay){
12622
this.focus.defer(typeof delay == 'number' ? delay : 10, this, [selectText, false]);
12627
if(selectText === true){
12628
this.el.dom.select();
12642
disable : function(){
12646
this.disabled = true;
12647
this.fireEvent("disable", this);
12651
onDisable : function(){
12652
this.getActionEl().addClass(this.disabledClass);
12653
this.el.dom.disabled = true;
12657
enable : function(){
12661
this.disabled = false;
12662
this.fireEvent("enable", this);
12666
onEnable : function(){
12667
this.getActionEl().removeClass(this.disabledClass);
12668
this.el.dom.disabled = false;
12672
setDisabled : function(disabled){
12673
this[disabled ? "disable" : "enable"]();
12678
if(this.fireEvent("beforeshow", this) !== false){
12679
this.hidden = false;
12680
if(this.autoRender){
12681
this.render(typeof this.autoRender == 'boolean' ? Ext.getBody() : this.autoRender);
12686
this.fireEvent("show", this);
12691
onShow : function(){
12692
if(this.hideParent){
12693
this.container.removeClass('x-hide-' + this.hideMode);
12695
this.getActionEl().removeClass('x-hide-' + this.hideMode);
12702
if(this.fireEvent("beforehide", this) !== false){
12703
this.hidden = true;
12707
this.fireEvent("hide", this);
12712
onHide : function(){
12713
if(this.hideParent){
12714
this.container.addClass('x-hide-' + this.hideMode);
12716
this.getActionEl().addClass('x-hide-' + this.hideMode);
12721
setVisible: function(visible){
12731
isVisible : function(){
12732
return this.rendered && this.getActionEl().isVisible();
12736
cloneConfig : function(overrides){
12737
overrides = overrides || {};
12738
var id = overrides.id || Ext.id();
12739
var cfg = Ext.applyIf(overrides, this.initialConfig);
12740
cfg.id = id; return new this.constructor(cfg);
12744
getXType : function(){
12745
return this.constructor.xtype;
12749
isXType : function(xtype, shallow){
12751
('/' + this.getXTypes() + '/').indexOf('/' + xtype + '/') != -1 :
12752
this.constructor.xtype == xtype;
12756
getXTypes : function(){
12757
var tc = this.constructor;
12759
var c = [], sc = this;
12760
while(sc && sc.constructor.xtype){
12761
c.unshift(sc.constructor.xtype);
12762
sc = sc.constructor.superclass;
12765
tc.xtypes = c.join('/');
12771
findParentBy: function(fn) {
12772
for (var p = this.ownerCt; (p != null) && !fn(p, this); p = p.ownerCt);
12777
findParentByType: function(xtype) {
12778
return typeof xtype == 'function' ?
12779
this.findParentBy(function(p){
12780
return p.constructor === xtype;
12782
this.findParentBy(function(p){
12783
return p.constructor.xtype === xtype;
12787
mon : function(item, ename, fn, scope, opt){
12790
this.on('beforedestroy', function(){
12791
for(var i= 0, len = this.mons.length; i < len; i++){
12792
var m = this.mons[i];
12793
m.item.un(m.ename, m.fn, m.scope);
12798
item: item, ename: ename, fn: fn, scope: scope
12800
item.on(ename, fn, scope, opt);
12804
Ext.reg('component', Ext.Component);
12807
Ext.Action = function(config){
12808
this.initialConfig = config;
12812
Ext.Action.prototype = {
12824
setText : function(text){
12825
this.initialConfig.text = text;
12826
this.callEach('setText', [text]);
12830
getText : function(){
12831
return this.initialConfig.text;
12835
setIconClass : function(cls){
12836
this.initialConfig.iconCls = cls;
12837
this.callEach('setIconClass', [cls]);
12841
getIconClass : function(){
12842
return this.initialConfig.iconCls;
12846
setDisabled : function(v){
12847
this.initialConfig.disabled = v;
12848
this.callEach('setDisabled', [v]);
12852
enable : function(){
12853
this.setDisabled(false);
12857
disable : function(){
12858
this.setDisabled(true);
12862
isDisabled : function(){
12863
return this.initialConfig.disabled;
12867
setHidden : function(v){
12868
this.initialConfig.hidden = v;
12869
this.callEach('setVisible', [!v]);
12874
this.setHidden(false);
12879
this.setHidden(true);
12883
isHidden : function(){
12884
return this.initialConfig.hidden;
12888
setHandler : function(fn, scope){
12889
this.initialConfig.handler = fn;
12890
this.initialConfig.scope = scope;
12891
this.callEach('setHandler', [fn, scope]);
12895
each : function(fn, scope){
12896
Ext.each(this.items, fn, scope);
12900
callEach : function(fnName, args){
12901
var cs = this.items;
12902
for(var i = 0, len = cs.length; i < len; i++){
12903
cs[i][fnName].apply(cs[i], args);
12908
addComponent : function(comp){
12909
this.items.push(comp);
12910
comp.on('destroy', this.removeComponent, this);
12914
removeComponent : function(comp){
12915
this.items.remove(comp);
12919
execute : function(){
12920
this.initialConfig.handler.apply(this.initialConfig.scope || window, arguments);
12925
Ext.Layer = function(config, existingEl){
12926
config = config || {};
12927
var dh = Ext.DomHelper;
12928
var cp = config.parentEl, pel = cp ? Ext.getDom(cp) : document.body;
12930
this.dom = Ext.getDom(existingEl);
12933
var o = config.dh || {tag: "div", cls: "x-layer"};
12934
this.dom = dh.append(pel, o);
12937
this.addClass(config.cls);
12939
this.constrain = config.constrain !== false;
12940
this.visibilityMode = Ext.Element.VISIBILITY;
12942
this.id = this.dom.id = config.id;
12944
this.id = Ext.id(this.dom);
12946
this.zindex = config.zindex || this.getZIndex();
12947
this.position("absolute", this.zindex);
12949
this.shadowOffset = config.shadowOffset || 4;
12950
this.shadow = new Ext.Shadow({
12951
offset : this.shadowOffset,
12952
mode : config.shadow
12955
this.shadowOffset = 0;
12957
this.useShim = config.shim !== false && Ext.useShims;
12958
this.useDisplay = config.useDisplay;
12962
var supr = Ext.Element.prototype;
12967
Ext.extend(Ext.Layer, Ext.Element, {
12969
getZIndex : function(){
12970
return this.zindex || parseInt(this.getStyle("z-index"), 10) || 11000;
12973
getShim : function(){
12980
var shim = shims.shift();
12982
shim = this.createShim();
12983
shim.enableDisplayMode('block');
12984
shim.dom.style.display = 'none';
12985
shim.dom.style.visibility = 'visible';
12987
var pn = this.dom.parentNode;
12988
if(shim.dom.parentNode != pn){
12989
pn.insertBefore(shim.dom, this.dom);
12991
shim.setStyle('z-index', this.getZIndex()-2);
12996
hideShim : function(){
12998
this.shim.setDisplayed(false);
12999
shims.push(this.shim);
13004
disableShadow : function(){
13006
this.shadowDisabled = true;
13007
this.shadow.hide();
13008
this.lastShadowOffset = this.shadowOffset;
13009
this.shadowOffset = 0;
13013
enableShadow : function(show){
13015
this.shadowDisabled = false;
13016
this.shadowOffset = this.lastShadowOffset;
13017
delete this.lastShadowOffset;
13027
sync : function(doShow){
13028
var sw = this.shadow;
13029
if(!this.updating && this.isVisible() && (sw || this.useShim)){
13030
var sh = this.getShim();
13032
var w = this.getWidth(),
13033
h = this.getHeight();
13035
var l = this.getLeft(true),
13036
t = this.getTop(true);
13038
if(sw && !this.shadowDisabled){
13039
if(doShow && !sw.isVisible()){
13042
sw.realign(l, t, w, h);
13049
var a = sw.adjusts, s = sh.dom.style;
13050
s.left = (Math.min(l, l+a.l))+"px";
13051
s.top = (Math.min(t, t+a.t))+"px";
13052
s.width = (w+a.w)+"px";
13053
s.height = (h+a.h)+"px";
13060
sh.setLeftTop(l, t);
13067
destroy : function(){
13070
this.shadow.hide();
13072
this.removeAllListeners();
13073
Ext.removeNode(this.dom);
13074
Ext.Element.uncache(this.id);
13077
remove : function(){
13082
beginUpdate : function(){
13083
this.updating = true;
13087
endUpdate : function(){
13088
this.updating = false;
13093
hideUnders : function(negOffset){
13095
this.shadow.hide();
13101
constrainXY : function(){
13102
if(this.constrain){
13103
var vw = Ext.lib.Dom.getViewWidth(),
13104
vh = Ext.lib.Dom.getViewHeight();
13105
var s = Ext.getDoc().getScroll();
13107
var xy = this.getXY();
13108
var x = xy[0], y = xy[1];
13109
var w = this.dom.offsetWidth+this.shadowOffset, h = this.dom.offsetHeight+this.shadowOffset;
13113
if((x + w) > vw+s.left){
13114
x = vw - w - this.shadowOffset;
13117
if((y + h) > vh+s.top){
13118
y = vh - h - this.shadowOffset;
13132
var ay = this.avoidY;
13133
if(y <= ay && (y+h) >= ay){
13139
supr.setXY.call(this, xy);
13145
isVisible : function(){
13146
return this.visible;
13150
showAction : function(){
13151
this.visible = true;
13152
if(this.useDisplay === true){
13153
this.setDisplayed("");
13154
}else if(this.lastXY){
13155
supr.setXY.call(this, this.lastXY);
13156
}else if(this.lastLT){
13157
supr.setLeftTop.call(this, this.lastLT[0], this.lastLT[1]);
13162
hideAction : function(){
13163
this.visible = false;
13164
if(this.useDisplay === true){
13165
this.setDisplayed(false);
13167
this.setLeftTop(-10000,-10000);
13172
setVisible : function(v, a, d, c, e){
13177
var cb = function(){
13182
}.createDelegate(this);
13183
supr.setVisible.call(this, true, true, d, cb, e);
13186
this.hideUnders(true);
13195
}.createDelegate(this);
13197
supr.setVisible.call(this, v, a, d, cb, e);
13206
storeXY : function(xy){
13207
delete this.lastLT;
13211
storeLeftTop : function(left, top){
13212
delete this.lastXY;
13213
this.lastLT = [left, top];
13217
beforeFx : function(){
13218
this.beforeAction();
13219
return Ext.Layer.superclass.beforeFx.apply(this, arguments);
13223
afterFx : function(){
13224
Ext.Layer.superclass.afterFx.apply(this, arguments);
13225
this.sync(this.isVisible());
13229
beforeAction : function(){
13230
if(!this.updating && this.shadow){
13231
this.shadow.hide();
13236
setLeft : function(left){
13237
this.storeLeftTop(left, this.getTop(true));
13238
supr.setLeft.apply(this, arguments);
13242
setTop : function(top){
13243
this.storeLeftTop(this.getLeft(true), top);
13244
supr.setTop.apply(this, arguments);
13248
setLeftTop : function(left, top){
13249
this.storeLeftTop(left, top);
13250
supr.setLeftTop.apply(this, arguments);
13254
setXY : function(xy, a, d, c, e){
13256
this.beforeAction();
13258
var cb = this.createCB(c);
13259
supr.setXY.call(this, xy, a, d, cb, e);
13266
createCB : function(c){
13278
setX : function(x, a, d, c, e){
13279
this.setXY([x, this.getY()], a, d, c, e);
13283
setY : function(y, a, d, c, e){
13284
this.setXY([this.getX(), y], a, d, c, e);
13288
setSize : function(w, h, a, d, c, e){
13289
this.beforeAction();
13290
var cb = this.createCB(c);
13291
supr.setSize.call(this, w, h, a, d, cb, e);
13298
setWidth : function(w, a, d, c, e){
13299
this.beforeAction();
13300
var cb = this.createCB(c);
13301
supr.setWidth.call(this, w, a, d, cb, e);
13308
setHeight : function(h, a, d, c, e){
13309
this.beforeAction();
13310
var cb = this.createCB(c);
13311
supr.setHeight.call(this, h, a, d, cb, e);
13318
setBounds : function(x, y, w, h, a, d, c, e){
13319
this.beforeAction();
13320
var cb = this.createCB(c);
13322
this.storeXY([x, y]);
13323
supr.setXY.call(this, [x, y]);
13324
supr.setSize.call(this, w, h, a, d, cb, e);
13327
supr.setBounds.call(this, x, y, w, h, a, d, cb, e);
13333
setZIndex : function(zindex){
13334
this.zindex = zindex;
13335
this.setStyle("z-index", zindex + 2);
13337
this.shadow.setZIndex(zindex + 1);
13340
this.shim.setStyle("z-index", zindex);
13346
Ext.Shadow = function(config){
13347
Ext.apply(this, config);
13348
if(typeof this.mode != "string"){
13349
this.mode = this.defaultMode;
13351
var o = this.offset, a = {h: 0};
13352
var rad = Math.floor(this.offset/2);
13353
switch(this.mode.toLowerCase()){ case "drop":
13358
a.l -= this.offset + rad;
13359
a.t -= this.offset + rad;
13370
a.l -= (this.offset - rad);
13371
a.t -= this.offset + rad;
13373
a.w -= (this.offset - rad)*2;
13384
a.l -= (this.offset - rad);
13385
a.t -= (this.offset - rad);
13387
a.w -= (this.offset + rad + 1);
13388
a.h -= (this.offset + rad);
13397
Ext.Shadow.prototype = {
13402
defaultMode: "drop",
13405
show : function(target){
13406
target = Ext.get(target);
13408
this.el = Ext.Shadow.Pool.pull();
13409
if(this.el.dom.nextSibling != target.dom){
13410
this.el.insertBefore(target);
13413
this.el.setStyle("z-index", this.zIndex || parseInt(target.getStyle("z-index"), 10)-1);
13415
this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")";
13418
target.getLeft(true),
13419
target.getTop(true),
13423
this.el.dom.style.display = "block";
13427
isVisible : function(){
13428
return this.el ? true : false;
13432
realign : function(l, t, w, h){
13436
var a = this.adjusts, d = this.el.dom, s = d.style;
13438
s.left = (l+a.l)+"px";
13439
s.top = (t+a.t)+"px";
13440
var sw = (w+a.w), sh = (h+a.h), sws = sw +"px", shs = sh + "px";
13441
if(s.width != sws || s.height != shs){
13445
var cn = d.childNodes;
13446
var sww = Math.max(0, (sw-12))+"px";
13447
cn[0].childNodes[1].style.width = sww;
13448
cn[1].childNodes[1].style.width = sww;
13449
cn[2].childNodes[1].style.width = sww;
13450
cn[1].style.height = Math.max(0, (sh-12))+"px";
13458
this.el.dom.style.display = "none";
13459
Ext.Shadow.Pool.push(this.el);
13465
setZIndex : function(z){
13468
this.el.setStyle("z-index", z);
13473
Ext.Shadow.Pool = function(){
13475
var markup = Ext.isIE ?
13476
'<div class="x-ie-shadow"></div>' :
13477
'<div class="x-shadow"><div class="xst"><div class="xstl"></div><div class="xstc"></div><div class="xstr"></div></div><div class="xsc"><div class="xsml"></div><div class="xsmc"></div><div class="xsmr"></div></div><div class="xsb"><div class="xsbl"></div><div class="xsbc"></div><div class="xsbr"></div></div></div>';
13480
var sh = p.shift();
13482
sh = Ext.get(Ext.DomHelper.insertHtml("beforeBegin", document.body.firstChild, markup));
13483
sh.autoBoxAdjust = false;
13488
push : function(sh){
13494
Ext.BoxComponent = Ext.extend(Ext.Component, {
13506
initComponent : function(){
13507
Ext.BoxComponent.superclass.initComponent.call(this);
13517
deferHeight: false,
13520
setSize : function(w, h){
13521
if(typeof w == 'object'){
13525
if(!this.boxReady){
13531
if(this.lastSize && this.lastSize.width == w && this.lastSize.height == h){
13534
this.lastSize = {width: w, height: h};
13535
var adj = this.adjustSize(w, h);
13536
var aw = adj.width, ah = adj.height;
13537
if(aw !== undefined || ah !== undefined){ var rz = this.getResizeEl();
13538
if(!this.deferHeight && aw !== undefined && ah !== undefined){
13539
rz.setSize(aw, ah);
13540
}else if(!this.deferHeight && ah !== undefined){
13542
}else if(aw !== undefined){
13545
this.onResize(aw, ah, w, h);
13546
this.fireEvent('resize', this, aw, ah, w, h);
13552
setWidth : function(width){
13553
return this.setSize(width);
13557
setHeight : function(height){
13558
return this.setSize(undefined, height);
13562
getSize : function(){
13563
return this.el.getSize();
13567
getPosition : function(local){
13568
if(local === true){
13569
return [this.el.getLeft(true), this.el.getTop(true)];
13571
return this.xy || this.el.getXY();
13575
getBox : function(local){
13576
var s = this.el.getSize();
13577
if(local === true){
13578
s.x = this.el.getLeft(true);
13579
s.y = this.el.getTop(true);
13581
var xy = this.xy || this.el.getXY();
13589
updateBox : function(box){
13590
this.setSize(box.width, box.height);
13591
this.setPagePosition(box.x, box.y);
13595
getResizeEl : function(){
13596
return this.resizeEl || this.el;
13599
getPositionEl : function(){
13600
return this.positionEl || this.el;
13604
setPosition : function(x, y){
13605
if(x && typeof x[1] == 'number'){
13611
if(!this.boxReady){
13614
var adj = this.adjustPosition(x, y);
13615
var ax = adj.x, ay = adj.y;
13617
var el = this.getPositionEl();
13618
if(ax !== undefined || ay !== undefined){
13619
if(ax !== undefined && ay !== undefined){
13620
el.setLeftTop(ax, ay);
13621
}else if(ax !== undefined){
13623
}else if(ay !== undefined){
13626
this.onPosition(ax, ay);
13627
this.fireEvent('move', this, ax, ay);
13633
setPagePosition : function(x, y){
13634
if(x && typeof x[1] == 'number'){
13640
if(!this.boxReady){
13643
if(x === undefined || y === undefined){ return;
13645
var p = this.el.translatePoints(x, y);
13646
this.setPosition(p.left, p.top);
13650
onRender : function(ct, position){
13651
Ext.BoxComponent.superclass.onRender.call(this, ct, position);
13653
this.resizeEl = Ext.get(this.resizeEl);
13655
if(this.positionEl){
13656
this.positionEl = Ext.get(this.positionEl);
13660
afterRender : function(){
13661
Ext.BoxComponent.superclass.afterRender.call(this);
13662
this.boxReady = true;
13663
this.setSize(this.width, this.height);
13664
if(this.x || this.y){
13665
this.setPosition(this.x, this.y);
13666
}else if(this.pageX || this.pageY){
13667
this.setPagePosition(this.pageX, this.pageY);
13672
syncSize : function(){
13673
delete this.lastSize;
13674
this.setSize(this.autoWidth ? undefined : this.el.getWidth(), this.autoHeight ? undefined : this.el.getHeight());
13679
onResize : function(adjWidth, adjHeight, rawWidth, rawHeight){
13684
onPosition : function(x, y){
13688
adjustSize : function(w, h){
13689
if(this.autoWidth){
13692
if(this.autoHeight){
13695
return {width : w, height: h};
13698
adjustPosition : function(x, y){
13699
return {x : x, y: y};
13702
Ext.reg('box', Ext.BoxComponent);
13704
Ext.SplitBar = function(dragElement, resizingElement, orientation, placement, existingProxy){
13707
this.el = Ext.get(dragElement, true);
13708
this.el.dom.unselectable = "on";
13710
this.resizingEl = Ext.get(resizingElement, true);
13713
this.orientation = orientation || Ext.SplitBar.HORIZONTAL;
13719
this.maxSize = 2000;
13722
this.animate = false;
13725
this.useShim = false;
13730
if(!existingProxy){
13732
this.proxy = Ext.SplitBar.createProxy(this.orientation);
13734
this.proxy = Ext.get(existingProxy).dom;
13737
this.dd = new Ext.dd.DDProxy(this.el.dom.id, "XSplitBars", {dragElId : this.proxy.id});
13740
this.dd.b4StartDrag = this.onStartProxyDrag.createDelegate(this);
13743
this.dd.endDrag = this.onEndProxyDrag.createDelegate(this);
13746
this.dragSpecs = {};
13749
this.adapter = new Ext.SplitBar.BasicLayoutAdapter();
13750
this.adapter.init(this);
13752
if(this.orientation == Ext.SplitBar.HORIZONTAL){
13754
this.placement = placement || (this.el.getX() > this.resizingEl.getX() ? Ext.SplitBar.LEFT : Ext.SplitBar.RIGHT);
13755
this.el.addClass("x-splitbar-h");
13758
this.placement = placement || (this.el.getY() > this.resizingEl.getY() ? Ext.SplitBar.TOP : Ext.SplitBar.BOTTOM);
13759
this.el.addClass("x-splitbar-v");
13773
Ext.SplitBar.superclass.constructor.call(this);
13776
Ext.extend(Ext.SplitBar, Ext.util.Observable, {
13777
onStartProxyDrag : function(x, y){
13778
this.fireEvent("beforeresize", this);
13779
this.overlay = Ext.DomHelper.append(document.body, {cls: "x-drag-overlay", html: " "}, true);
13780
this.overlay.unselectable();
13781
this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
13782
this.overlay.show();
13783
Ext.get(this.proxy).setDisplayed("block");
13784
var size = this.adapter.getElementSize(this);
13785
this.activeMinSize = this.getMinimumSize();;
13786
this.activeMaxSize = this.getMaximumSize();;
13787
var c1 = size - this.activeMinSize;
13788
var c2 = Math.max(this.activeMaxSize - size, 0);
13789
if(this.orientation == Ext.SplitBar.HORIZONTAL){
13790
this.dd.resetConstraints();
13791
this.dd.setXConstraint(
13792
this.placement == Ext.SplitBar.LEFT ? c1 : c2,
13793
this.placement == Ext.SplitBar.LEFT ? c2 : c1
13795
this.dd.setYConstraint(0, 0);
13797
this.dd.resetConstraints();
13798
this.dd.setXConstraint(0, 0);
13799
this.dd.setYConstraint(
13800
this.placement == Ext.SplitBar.TOP ? c1 : c2,
13801
this.placement == Ext.SplitBar.TOP ? c2 : c1
13804
this.dragSpecs.startSize = size;
13805
this.dragSpecs.startPoint = [x, y];
13806
Ext.dd.DDProxy.prototype.b4StartDrag.call(this.dd, x, y);
13810
onEndProxyDrag : function(e){
13811
Ext.get(this.proxy).setDisplayed(false);
13812
var endPoint = Ext.lib.Event.getXY(e);
13814
this.overlay.remove();
13815
delete this.overlay;
13818
if(this.orientation == Ext.SplitBar.HORIZONTAL){
13819
newSize = this.dragSpecs.startSize +
13820
(this.placement == Ext.SplitBar.LEFT ?
13821
endPoint[0] - this.dragSpecs.startPoint[0] :
13822
this.dragSpecs.startPoint[0] - endPoint[0]
13825
newSize = this.dragSpecs.startSize +
13826
(this.placement == Ext.SplitBar.TOP ?
13827
endPoint[1] - this.dragSpecs.startPoint[1] :
13828
this.dragSpecs.startPoint[1] - endPoint[1]
13831
newSize = Math.min(Math.max(newSize, this.activeMinSize), this.activeMaxSize);
13832
if(newSize != this.dragSpecs.startSize){
13833
if(this.fireEvent('beforeapply', this, newSize) !== false){
13834
this.adapter.setElementSize(this, newSize);
13835
this.fireEvent("moved", this, newSize);
13836
this.fireEvent("resize", this, newSize);
13842
getAdapter : function(){
13843
return this.adapter;
13847
setAdapter : function(adapter){
13848
this.adapter = adapter;
13849
this.adapter.init(this);
13853
getMinimumSize : function(){
13854
return this.minSize;
13858
setMinimumSize : function(minSize){
13859
this.minSize = minSize;
13863
getMaximumSize : function(){
13864
return this.maxSize;
13868
setMaximumSize : function(maxSize){
13869
this.maxSize = maxSize;
13873
setCurrentSize : function(size){
13874
var oldAnimate = this.animate;
13875
this.animate = false;
13876
this.adapter.setElementSize(this, size);
13877
this.animate = oldAnimate;
13881
destroy : function(removeEl){
13883
this.shim.remove();
13886
Ext.removeNode(this.proxy);
13894
Ext.SplitBar.createProxy = function(dir){
13895
var proxy = new Ext.Element(document.createElement("div"));
13896
proxy.unselectable();
13897
var cls = 'x-splitbar-proxy';
13898
proxy.addClass(cls + ' ' + (dir == Ext.SplitBar.HORIZONTAL ? cls +'-h' : cls + '-v'));
13899
document.body.appendChild(proxy.dom);
13904
Ext.SplitBar.BasicLayoutAdapter = function(){
13907
Ext.SplitBar.BasicLayoutAdapter.prototype = {
13909
init : function(s){
13913
getElementSize : function(s){
13914
if(s.orientation == Ext.SplitBar.HORIZONTAL){
13915
return s.resizingEl.getWidth();
13917
return s.resizingEl.getHeight();
13922
setElementSize : function(s, newSize, onComplete){
13923
if(s.orientation == Ext.SplitBar.HORIZONTAL){
13925
s.resizingEl.setWidth(newSize);
13927
onComplete(s, newSize);
13930
s.resizingEl.setWidth(newSize, true, .1, onComplete, 'easeOut');
13935
s.resizingEl.setHeight(newSize);
13937
onComplete(s, newSize);
13940
s.resizingEl.setHeight(newSize, true, .1, onComplete, 'easeOut');
13947
Ext.SplitBar.AbsoluteLayoutAdapter = function(container){
13948
this.basic = new Ext.SplitBar.BasicLayoutAdapter();
13949
this.container = Ext.get(container);
13952
Ext.SplitBar.AbsoluteLayoutAdapter.prototype = {
13953
init : function(s){
13954
this.basic.init(s);
13957
getElementSize : function(s){
13958
return this.basic.getElementSize(s);
13961
setElementSize : function(s, newSize, onComplete){
13962
this.basic.setElementSize(s, newSize, this.moveSplitter.createDelegate(this, [s]));
13965
moveSplitter : function(s){
13966
var yes = Ext.SplitBar;
13967
switch(s.placement){
13969
s.el.setX(s.resizingEl.getRight());
13972
s.el.setStyle("right", (this.container.getWidth() - s.resizingEl.getLeft()) + "px");
13975
s.el.setY(s.resizingEl.getBottom());
13978
s.el.setY(s.resizingEl.getTop() - s.el.getHeight());
13985
Ext.SplitBar.VERTICAL = 1;
13988
Ext.SplitBar.HORIZONTAL = 2;
13991
Ext.SplitBar.LEFT = 1;
13994
Ext.SplitBar.RIGHT = 2;
13997
Ext.SplitBar.TOP = 3;
14000
Ext.SplitBar.BOTTOM = 4;
14003
Ext.Container = Ext.extend(Ext.BoxComponent, {
14016
defaultType: 'panel',
14018
initComponent : function(){
14019
Ext.Container.superclass.initComponent.call(this);
14035
var items = this.items;
14038
if(Ext.isArray(items)){
14039
this.add.apply(this, items);
14046
initItems : function(){
14048
this.items = new Ext.util.MixedCollection(false, this.getComponentId);
14049
this.getLayout(); }
14052
setLayout : function(layout){
14053
if(this.layout && this.layout != layout){
14054
this.layout.setContainer(null);
14057
this.layout = layout;
14058
layout.setContainer(this);
14061
render : function(){
14062
Ext.Container.superclass.render.apply(this, arguments);
14064
if(typeof this.layout == 'string'){
14065
this.layout = new Ext.Container.LAYOUTS[this.layout.toLowerCase()](this.layoutConfig);
14067
this.setLayout(this.layout);
14069
if(this.activeItem !== undefined){
14070
var item = this.activeItem;
14071
delete this.activeItem;
14072
this.layout.setActiveItem(item);
14079
if(this.monitorResize === true){
14080
Ext.EventManager.onWindowResize(this.doLayout, this, [false]);
14084
getLayoutTarget : function(){
14088
getComponentId : function(comp){
14089
return comp.itemId || comp.id;
14093
add : function(comp){
14097
var a = arguments, len = a.length;
14099
for(var i = 0; i < len; i++) {
14104
var c = this.lookupComponent(this.applyDefaults(comp));
14105
var pos = this.items.length;
14106
if(this.fireEvent('beforeadd', this, c, pos) !== false && this.onBeforeAdd(c) !== false){
14109
this.fireEvent('add', this, c, pos);
14115
insert : function(index, comp){
14119
var a = arguments, len = a.length;
14121
for(var i = len-1; i >= 1; --i) {
14122
this.insert(index, a[i]);
14126
var c = this.lookupComponent(this.applyDefaults(comp));
14128
if(c.ownerCt == this && this.items.indexOf(c) < index){
14132
if(this.fireEvent('beforeadd', this, c, index) !== false && this.onBeforeAdd(c) !== false){
14133
this.items.insert(index, c);
14135
this.fireEvent('add', this, c, index);
14140
applyDefaults : function(c){
14142
if(typeof c == 'string'){
14143
c = Ext.ComponentMgr.get(c);
14144
Ext.apply(c, this.defaults);
14145
}else if(!c.events){
14146
Ext.applyIf(c, this.defaults);
14148
Ext.apply(c, this.defaults);
14154
onBeforeAdd : function(item){
14156
item.ownerCt.remove(item, false);
14158
if(this.hideBorders === true){
14159
item.border = (item.border === true);
14164
remove : function(comp, autoDestroy){
14165
var c = this.getComponent(comp);
14166
if(c && this.fireEvent('beforeremove', this, c) !== false){
14167
this.items.remove(c);
14169
if(autoDestroy === true || (autoDestroy !== false && this.autoDestroy)){
14172
if(this.layout && this.layout.activeItem == c){
14173
delete this.layout.activeItem;
14175
this.fireEvent('remove', this, c);
14181
getComponent : function(comp){
14182
if(typeof comp == 'object'){
14185
return this.items.get(comp);
14188
lookupComponent : function(comp){
14189
if(typeof comp == 'string'){
14190
return Ext.ComponentMgr.get(comp);
14191
}else if(!comp.events){
14192
return this.createComponent(comp);
14197
createComponent : function(config){
14198
return Ext.ComponentMgr.create(config, this.defaultType);
14202
doLayout : function(shallow){
14203
if(this.rendered && this.layout){
14204
this.layout.layout();
14206
if(shallow !== false && this.items){
14207
var cs = this.items.items;
14208
for(var i = 0, len = cs.length; i < len; i++) {
14218
getLayout : function(){
14220
var layout = new Ext.layout.ContainerLayout(this.layoutConfig);
14221
this.setLayout(layout);
14223
return this.layout;
14226
beforeDestroy : function(){
14228
Ext.destroy.apply(Ext, this.items.items);
14230
if(this.monitorResize){
14231
Ext.EventManager.removeResizeListener(this.doLayout, this);
14233
if (this.layout && this.layout.destroy) {
14234
this.layout.destroy();
14236
Ext.Container.superclass.beforeDestroy.call(this);
14240
bubble : function(fn, scope, args){
14243
if(fn.apply(scope || p, args || [p]) === false){
14251
cascade : function(fn, scope, args){
14252
if(fn.apply(scope || this, args || [this]) !== false){
14254
var cs = this.items.items;
14255
for(var i = 0, len = cs.length; i < len; i++){
14257
cs[i].cascade(fn, scope, args);
14259
fn.apply(scope || cs[i], args || [cs[i]]);
14267
findById : function(id){
14269
this.cascade(function(c){
14270
if(ct != c && c.id === id){
14279
findByType : function(xtype){
14280
return typeof xtype == 'function' ?
14281
this.findBy(function(c){
14282
return c.constructor === xtype;
14284
this.findBy(function(c){
14285
return c.constructor.xtype === xtype;
14290
find : function(prop, value){
14291
return this.findBy(function(c){
14292
return c[prop] === value;
14297
findBy : function(fn, scope){
14298
var m = [], ct = this;
14299
this.cascade(function(c){
14300
if(ct != c && fn.call(scope || c, c, ct) === true){
14308
Ext.Container.LAYOUTS = {};
14309
Ext.reg('container', Ext.Container);
14311
Ext.layout.ContainerLayout = function(config){
14312
Ext.apply(this, config);
14315
Ext.layout.ContainerLayout.prototype = {
14321
monitorResize:false,
14324
layout : function(){
14325
var target = this.container.getLayoutTarget();
14326
this.onLayout(this.container, target);
14327
this.container.fireEvent('afterlayout', this.container, this);
14330
onLayout : function(ct, target){
14331
this.renderAll(ct, target);
14334
isValidParent : function(c, target){
14335
var el = c.getPositionEl ? c.getPositionEl() : c.getEl();
14336
return el.dom.parentNode == target.dom;
14339
renderAll : function(ct, target){
14340
var items = ct.items.items;
14341
for(var i = 0, len = items.length; i < len; i++) {
14343
if(c && (!c.rendered || !this.isValidParent(c, target))){
14344
this.renderItem(c, i, target);
14349
renderItem : function(c, position, target){
14350
if(c && !c.rendered){
14351
c.render(target, position);
14353
var t = c.getPositionEl ? c.getPositionEl() : c;
14354
t.addClass(this.extraCls);
14356
if (this.renderHidden && c != this.activeItem) {
14359
}else if(c && !this.isValidParent(c, target)){
14361
c.addClass(this.extraCls);
14363
if(typeof position == 'number'){
14364
position = target.dom.childNodes[position];
14366
target.dom.insertBefore(c.getEl().dom, position || null);
14367
if (this.renderHidden && c != this.activeItem) {
14373
onResize: function(){
14374
if(this.container.collapsed){
14377
var b = this.container.bufferResize;
14379
if(!this.resizeTask){
14380
this.resizeTask = new Ext.util.DelayedTask(this.layout, this);
14381
this.resizeBuffer = typeof b == 'number' ? b : 100;
14383
this.resizeTask.delay(this.resizeBuffer);
14389
setContainer : function(ct){
14390
if(this.monitorResize && ct != this.container){
14391
if(this.container){
14392
this.container.un('resize', this.onResize, this);
14395
ct.on('resize', this.onResize, this);
14398
this.container = ct;
14401
parseMargins : function(v){
14402
var ms = v.split(' ');
14403
var len = ms.length;
14414
top:parseInt(ms[0], 10) || 0,
14415
right:parseInt(ms[1], 10) || 0,
14416
bottom:parseInt(ms[2], 10) || 0,
14417
left:parseInt(ms[3], 10) || 0
14421
destroy : Ext.emptyFn
14423
Ext.Container.LAYOUTS['auto'] = Ext.layout.ContainerLayout;
14425
Ext.layout.FitLayout = Ext.extend(Ext.layout.ContainerLayout, {
14427
monitorResize:true,
14430
onLayout : function(ct, target){
14431
Ext.layout.FitLayout.superclass.onLayout.call(this, ct, target);
14432
if(!this.container.collapsed){
14433
this.setItemSize(this.activeItem || ct.items.itemAt(0), target.getStyleSize());
14438
setItemSize : function(item, size){
14439
if(item && size.height > 0){
14440
item.setSize(size);
14444
Ext.Container.LAYOUTS['fit'] = Ext.layout.FitLayout;
14446
Ext.layout.CardLayout = Ext.extend(Ext.layout.FitLayout, {
14448
deferredRender : false,
14451
renderHidden : true,
14454
setActiveItem : function(item){
14455
item = this.container.getComponent(item);
14456
if(this.activeItem != item){
14457
if(this.activeItem){
14458
this.activeItem.hide();
14460
this.activeItem = item;
14467
renderAll : function(ct, target){
14468
if(this.deferredRender){
14469
this.renderItem(this.activeItem, undefined, target);
14471
Ext.layout.CardLayout.superclass.renderAll.call(this, ct, target);
14475
Ext.Container.LAYOUTS['card'] = Ext.layout.CardLayout;
14477
Ext.layout.AnchorLayout = Ext.extend(Ext.layout.ContainerLayout, {
14479
monitorResize:true,
14482
getAnchorViewSize : function(ct, target){
14483
return target.dom == document.body ?
14484
target.getViewSize() : target.getStyleSize();
14488
onLayout : function(ct, target){
14489
Ext.layout.AnchorLayout.superclass.onLayout.call(this, ct, target);
14491
var size = this.getAnchorViewSize(ct, target);
14493
var w = size.width, h = size.height;
14495
if(w < 20 || h < 20){
14502
if(typeof ct.anchorSize == 'number'){
14503
aw = ct.anchorSize;
14505
aw = ct.anchorSize.width;
14506
ah = ct.anchorSize.height;
14509
aw = ct.initialConfig.width;
14510
ah = ct.initialConfig.height;
14513
var cs = ct.items.items, len = cs.length, i, c, a, cw, ch;
14514
for(i = 0; i < len; i++){
14519
var vs = c.anchor.split(' ');
14520
c.anchorSpec = a = {
14521
right: this.parseAnchor(vs[0], c.initialConfig.width, aw),
14522
bottom: this.parseAnchor(vs[1], c.initialConfig.height, ah)
14525
cw = a.right ? this.adjustWidthAnchor(a.right(w), c) : undefined;
14526
ch = a.bottom ? this.adjustHeightAnchor(a.bottom(h), c) : undefined;
14529
c.setSize(cw || undefined, ch || undefined);
14536
parseAnchor : function(a, start, cstart){
14537
if(a && a != 'none'){
14539
if(/^(r|right|b|bottom)$/i.test(a)){
14540
var diff = cstart - start;
14541
return function(v){
14547
}else if(a.indexOf('%') != -1){
14548
var ratio = parseFloat(a.replace('%', ''))*.01;
14549
return function(v){
14552
return Math.floor(v*ratio);
14556
a = parseInt(a, 10);
14558
return function(v){
14571
adjustWidthAnchor : function(value, comp){
14576
adjustHeightAnchor : function(value, comp){
14582
Ext.Container.LAYOUTS['anchor'] = Ext.layout.AnchorLayout;
14584
Ext.layout.ColumnLayout = Ext.extend(Ext.layout.ContainerLayout, {
14586
monitorResize:true,
14588
extraCls: 'x-column',
14593
isValidParent : function(c, target){
14594
return c.getEl().dom.parentNode == this.innerCt.dom;
14598
onLayout : function(ct, target){
14599
var cs = ct.items.items, len = cs.length, c, i;
14602
target.addClass('x-column-layout-ct');
14606
this.innerCt = target.createChild({cls:'x-column-inner'});
14607
this.innerCt.createChild({cls:'x-clear'});
14609
this.renderAll(ct, this.innerCt);
14611
var size = Ext.isIE && target.dom != Ext.getBody().dom ? target.getStyleSize() : target.getViewSize();
14613
if(size.width < 1 && size.height < 1){
14617
var w = size.width - target.getPadding('lr') - this.scrollOffset,
14618
h = size.height - target.getPadding('tb'),
14621
this.innerCt.setWidth(w);
14626
for(i = 0; i < len; i++){
14628
if(!c.columnWidth){
14629
pw -= (c.getSize().width + c.getEl().getMargins('lr'));
14633
pw = pw < 0 ? 0 : pw;
14635
for(i = 0; i < len; i++){
14638
c.setSize(Math.floor(c.columnWidth*pw) - c.getEl().getMargins('lr'));
14646
Ext.Container.LAYOUTS['column'] = Ext.layout.ColumnLayout;
14648
Ext.layout.BorderLayout = Ext.extend(Ext.layout.ContainerLayout, {
14649
monitorResize:true,
14652
onLayout : function(ct, target){
14654
if(!this.rendered){
14656
target.addClass('x-border-layout-ct');
14657
var items = ct.items.items;
14659
for(var i = 0, len = items.length; i < len; i++) {
14661
var pos = c.region;
14665
c.collapsed = false;
14667
c.cls = c.cls ? c.cls +' x-border-panel' : 'x-border-panel';
14668
c.render(target, i);
14670
this[pos] = pos != 'center' && c.split ?
14671
new Ext.layout.BorderLayout.SplitRegion(this, c.initialConfig, pos) :
14672
new Ext.layout.BorderLayout.Region(this, c.initialConfig, pos);
14673
this[pos].render(target, c);
14675
this.rendered = true;
14678
var size = target.getViewSize();
14679
if(size.width < 20 || size.height < 20){ if(collapsed){
14680
this.restoreCollapsed = collapsed;
14683
}else if(this.restoreCollapsed){
14684
collapsed = this.restoreCollapsed;
14685
delete this.restoreCollapsed;
14688
var w = size.width, h = size.height;
14689
var centerW = w, centerH = h, centerY = 0, centerX = 0;
14691
var n = this.north, s = this.south, west = this.west, e = this.east, c = this.center;
14693
throw 'No center region defined in BorderLayout ' + ct.id;
14696
if(n && n.isVisible()){
14697
var b = n.getSize();
14698
var m = n.getMargins();
14699
b.width = w - (m.left+m.right);
14702
centerY = b.height + b.y + m.bottom;
14703
centerH -= centerY;
14706
if(s && s.isVisible()){
14707
var b = s.getSize();
14708
var m = s.getMargins();
14709
b.width = w - (m.left+m.right);
14711
var totalHeight = (b.height + m.top + m.bottom);
14712
b.y = h - totalHeight + m.top;
14713
centerH -= totalHeight;
14716
if(west && west.isVisible()){
14717
var b = west.getSize();
14718
var m = west.getMargins();
14719
b.height = centerH - (m.top+m.bottom);
14721
b.y = centerY + m.top;
14722
var totalWidth = (b.width + m.left + m.right);
14723
centerX += totalWidth;
14724
centerW -= totalWidth;
14725
west.applyLayout(b);
14727
if(e && e.isVisible()){
14728
var b = e.getSize();
14729
var m = e.getMargins();
14730
b.height = centerH - (m.top+m.bottom);
14731
var totalWidth = (b.width + m.left + m.right);
14732
b.x = w - totalWidth + m.left;
14733
b.y = centerY + m.top;
14734
centerW -= totalWidth;
14738
var m = c.getMargins();
14740
x: centerX + m.left,
14741
y: centerY + m.top,
14742
width: centerW - (m.left+m.right),
14743
height: centerH - (m.top+m.bottom)
14745
c.applyLayout(centerBox);
14748
for(var i = 0, len = collapsed.length; i < len; i++){
14749
collapsed[i].collapse(false);
14753
if(Ext.isIE && Ext.isStrict){ target.repaint();
14757
destroy: function() {
14758
var r = ['north', 'south', 'east', 'west'];
14759
for (var i = 0; i < r.length; i++) {
14760
var region = this[r[i]];
14761
if (region && region.split) {
14762
region.split.destroy(true);
14765
Ext.layout.BorderLayout.superclass.destroy.call(this);
14772
Ext.layout.BorderLayout.Region = function(layout, config, pos){
14773
Ext.apply(this, config);
14774
this.layout = layout;
14775
this.position = pos;
14777
if(typeof this.margins == 'string'){
14778
this.margins = this.layout.parseMargins(this.margins);
14780
this.margins = Ext.applyIf(this.margins || {}, this.defaultMargins);
14781
if(this.collapsible){
14782
if(typeof this.cmargins == 'string'){
14783
this.cmargins = this.layout.parseMargins(this.cmargins);
14785
if(this.collapseMode == 'mini' && !this.cmargins){
14786
this.cmargins = {left:0,top:0,right:0,bottom:0};
14788
this.cmargins = Ext.applyIf(this.cmargins || {},
14789
pos == 'north' || pos == 'south' ? this.defaultNSCMargins : this.defaultEWCMargins);
14794
Ext.layout.BorderLayout.Region.prototype = {
14802
collapsible : false,
14812
defaultMargins : {left:0,top:0,right:0,bottom:0},
14813
defaultNSCMargins : {left:5,top:5,right:5,bottom:5},
14814
defaultEWCMargins : {left:5,top:0,right:5,bottom:0},
14817
isCollapsed : false,
14823
render : function(ct, p){
14825
p.el.enableDisplayMode();
14826
this.targetEl = ct;
14829
var gs = p.getState, ps = this.position;
14830
p.getState = function(){
14831
return Ext.apply(gs.call(p) || {}, this.state);
14832
}.createDelegate(this);
14834
if(ps != 'center'){
14835
p.allowQueuedExpand = false;
14837
beforecollapse: this.beforeCollapse,
14838
collapse: this.onCollapse,
14839
beforeexpand: this.beforeExpand,
14840
expand: this.onExpand,
14845
if(this.collapsible){
14846
p.collapseEl = 'el';
14847
p.slideAnchor = this.getSlideAnchor();
14849
if(p.tools && p.tools.toggle){
14850
p.tools.toggle.addClass('x-tool-collapse-'+ps);
14851
p.tools.toggle.addClassOnOver('x-tool-collapse-'+ps+'-over');
14856
getCollapsedEl : function(){
14857
if(!this.collapsedEl){
14858
if(!this.toolTemplate){
14859
var tt = new Ext.Template(
14860
'<div class="x-tool x-tool-{id}"> </div>'
14862
tt.disableFormats = true;
14864
Ext.layout.BorderLayout.Region.prototype.toolTemplate = tt;
14866
this.collapsedEl = this.targetEl.createChild({
14867
cls: "x-layout-collapsed x-layout-collapsed-"+this.position,
14868
id: this.panel.id + '-xcollapsed'
14870
this.collapsedEl.enableDisplayMode('block');
14872
if(this.collapseMode == 'mini'){
14873
this.collapsedEl.addClass('x-layout-cmini-'+this.position);
14874
this.miniCollapsedEl = this.collapsedEl.createChild({
14875
cls: "x-layout-mini x-layout-mini-"+this.position, html: " "
14877
this.miniCollapsedEl.addClassOnOver('x-layout-mini-over');
14878
this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
14879
this.collapsedEl.on('click', this.onExpandClick, this, {stopEvent:true});
14881
var t = this.toolTemplate.append(
14882
this.collapsedEl.dom,
14883
{id:'expand-'+this.position}, true);
14884
t.addClassOnOver('x-tool-expand-'+this.position+'-over');
14885
t.on('click', this.onExpandClick, this, {stopEvent:true});
14887
if(this.floatable !== false){
14888
this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
14889
this.collapsedEl.on("click", this.collapseClick, this);
14893
return this.collapsedEl;
14896
onExpandClick : function(e){
14898
this.afterSlideIn();
14899
this.panel.expand(false);
14901
this.panel.expand();
14905
onCollapseClick : function(e){
14906
this.panel.collapse();
14909
beforeCollapse : function(p, animate){
14910
this.lastAnim = animate;
14912
this.splitEl.hide();
14914
this.getCollapsedEl().show();
14915
this.panel.el.setStyle('z-index', 100);
14916
this.isCollapsed = true;
14917
this.layout.layout();
14920
onCollapse : function(animate){
14921
this.panel.el.setStyle('z-index', 1);
14922
if(this.lastAnim === false || this.panel.animCollapse === false){
14923
this.getCollapsedEl().dom.style.visibility = 'visible';
14925
this.getCollapsedEl().slideIn(this.panel.slideAnchor, {duration:.2});
14927
this.state.collapsed = true;
14928
this.panel.saveState();
14931
beforeExpand : function(animate){
14932
var c = this.getCollapsedEl();
14934
if(this.position == 'east' || this.position == 'west'){
14935
this.panel.setSize(undefined, c.getHeight());
14937
this.panel.setSize(c.getWidth(), undefined);
14940
c.dom.style.visibility = 'hidden';
14941
this.panel.el.setStyle('z-index', 100);
14944
onExpand : function(){
14945
this.isCollapsed = false;
14947
this.splitEl.show();
14949
this.layout.layout();
14950
this.panel.el.setStyle('z-index', 1);
14951
this.state.collapsed = false;
14952
this.panel.saveState();
14955
collapseClick : function(e){
14957
e.stopPropagation();
14960
e.stopPropagation();
14965
onHide : function(){
14966
if(this.isCollapsed){
14967
this.getCollapsedEl().hide();
14968
}else if(this.splitEl){
14969
this.splitEl.hide();
14973
onShow : function(){
14974
if(this.isCollapsed){
14975
this.getCollapsedEl().show();
14976
}else if(this.splitEl){
14977
this.splitEl.show();
14982
isVisible : function(){
14983
return !this.panel.hidden;
14987
getMargins : function(){
14988
return this.isCollapsed && this.cmargins ? this.cmargins : this.margins;
14992
getSize : function(){
14993
return this.isCollapsed ? this.getCollapsedEl().getSize() : this.panel.getSize();
14997
setPanel : function(panel){
14998
this.panel = panel;
15002
getMinWidth: function(){
15003
return this.minWidth;
15007
getMinHeight: function(){
15008
return this.minHeight;
15011
applyLayoutCollapsed : function(box){
15012
var ce = this.getCollapsedEl();
15013
ce.setLeftTop(box.x, box.y);
15014
ce.setSize(box.width, box.height);
15017
applyLayout : function(box){
15018
if(this.isCollapsed){
15019
this.applyLayoutCollapsed(box);
15021
this.panel.setPosition(box.x, box.y);
15022
this.panel.setSize(box.width, box.height);
15026
beforeSlide: function(){
15027
this.panel.beforeEffect();
15030
afterSlide : function(){
15031
this.panel.afterEffect();
15034
initAutoHide : function(){
15035
if(this.autoHide !== false){
15036
if(!this.autoHideHd){
15037
var st = new Ext.util.DelayedTask(this.slideIn, this);
15038
this.autoHideHd = {
15039
"mouseout": function(e){
15040
if(!e.within(this.el, true)){
15044
"mouseover" : function(e){
15050
this.el.on(this.autoHideHd);
15054
clearAutoHide : function(){
15055
if(this.autoHide !== false){
15056
this.el.un("mouseout", this.autoHideHd.mouseout);
15057
this.el.un("mouseover", this.autoHideHd.mouseover);
15061
clearMonitor : function(){
15062
Ext.getDoc().un("click", this.slideInIf, this);
15065
slideOut : function(){
15066
if(this.isSlid || this.el.hasActiveFx()){
15069
this.isSlid = true;
15070
var ts = this.panel.tools;
15071
if(ts && ts.toggle){
15075
if(this.position == 'east' || this.position == 'west'){
15076
this.panel.setSize(undefined, this.collapsedEl.getHeight());
15078
this.panel.setSize(this.collapsedEl.getWidth(), undefined);
15080
this.restoreLT = [this.el.dom.style.left, this.el.dom.style.top];
15081
this.el.alignTo(this.collapsedEl, this.getCollapseAnchor());
15082
this.el.setStyle("z-index", 102);
15083
if(this.animFloat !== false){
15084
this.beforeSlide();
15085
this.el.slideIn(this.getSlideAnchor(), {
15086
callback: function(){
15088
this.initAutoHide();
15089
Ext.getDoc().on("click", this.slideInIf, this);
15095
this.initAutoHide();
15096
Ext.getDoc().on("click", this.slideInIf, this);
15100
afterSlideIn : function(){
15101
this.clearAutoHide();
15102
this.isSlid = false;
15103
this.clearMonitor();
15104
this.el.setStyle("z-index", "");
15105
this.el.dom.style.left = this.restoreLT[0];
15106
this.el.dom.style.top = this.restoreLT[1];
15108
var ts = this.panel.tools;
15109
if(ts && ts.toggle){
15114
slideIn : function(cb){
15115
if(!this.isSlid || this.el.hasActiveFx()){
15119
this.isSlid = false;
15120
if(this.animFloat !== false){
15121
this.beforeSlide();
15122
this.el.slideOut(this.getSlideAnchor(), {
15123
callback: function(){
15126
this.afterSlideIn();
15134
this.afterSlideIn();
15138
slideInIf : function(e){
15139
if(!e.within(this.el)){
15165
getAnchor : function(){
15166
return this.anchors[this.position];
15169
getCollapseAnchor : function(){
15170
return this.canchors[this.position];
15173
getSlideAnchor : function(){
15174
return this.sanchors[this.position];
15177
getAlignAdj : function(){
15178
var cm = this.cmargins;
15179
switch(this.position){
15195
getExpandAdj : function(){
15196
var c = this.collapsedEl, cm = this.cmargins;
15197
switch(this.position){
15199
return [-(cm.right+c.getWidth()+cm.left), 0];
15202
return [cm.right+c.getWidth()+cm.left, 0];
15205
return [0, -(cm.top+cm.bottom+c.getHeight())];
15208
return [0, cm.top+cm.bottom+c.getHeight()];
15215
Ext.layout.BorderLayout.SplitRegion = function(layout, config, pos){
15216
Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this, layout, config, pos);
15217
this.applyLayout = this.applyFns[pos];
15220
Ext.extend(Ext.layout.BorderLayout.SplitRegion, Ext.layout.BorderLayout.Region, {
15222
splitTip : "Drag to resize.",
15224
collapsibleSplitTip : "Drag to resize. Double click to hide.",
15226
useSplitTips : false,
15230
orientation: Ext.SplitBar.VERTICAL,
15231
placement: Ext.SplitBar.TOP,
15232
maxFn : 'getVMaxSize',
15233
minProp: 'minHeight',
15234
maxProp: 'maxHeight'
15237
orientation: Ext.SplitBar.VERTICAL,
15238
placement: Ext.SplitBar.BOTTOM,
15239
maxFn : 'getVMaxSize',
15240
minProp: 'minHeight',
15241
maxProp: 'maxHeight'
15244
orientation: Ext.SplitBar.HORIZONTAL,
15245
placement: Ext.SplitBar.RIGHT,
15246
maxFn : 'getHMaxSize',
15247
minProp: 'minWidth',
15248
maxProp: 'maxWidth'
15251
orientation: Ext.SplitBar.HORIZONTAL,
15252
placement: Ext.SplitBar.LEFT,
15253
maxFn : 'getHMaxSize',
15254
minProp: 'minWidth',
15255
maxProp: 'maxWidth'
15260
west : function(box){
15261
if(this.isCollapsed){
15262
return this.applyLayoutCollapsed(box);
15264
var sd = this.splitEl.dom, s = sd.style;
15265
this.panel.setPosition(box.x, box.y);
15266
var sw = sd.offsetWidth;
15267
s.left = (box.x+box.width-sw)+'px';
15268
s.top = (box.y)+'px';
15269
s.height = Math.max(0, box.height)+'px';
15270
this.panel.setSize(box.width-sw, box.height);
15272
east : function(box){
15273
if(this.isCollapsed){
15274
return this.applyLayoutCollapsed(box);
15276
var sd = this.splitEl.dom, s = sd.style;
15277
var sw = sd.offsetWidth;
15278
this.panel.setPosition(box.x+sw, box.y);
15279
s.left = (box.x)+'px';
15280
s.top = (box.y)+'px';
15281
s.height = Math.max(0, box.height)+'px';
15282
this.panel.setSize(box.width-sw, box.height);
15284
north : function(box){
15285
if(this.isCollapsed){
15286
return this.applyLayoutCollapsed(box);
15288
var sd = this.splitEl.dom, s = sd.style;
15289
var sh = sd.offsetHeight;
15290
this.panel.setPosition(box.x, box.y);
15291
s.left = (box.x)+'px';
15292
s.top = (box.y+box.height-sh)+'px';
15293
s.width = Math.max(0, box.width)+'px';
15294
this.panel.setSize(box.width, box.height-sh);
15296
south : function(box){
15297
if(this.isCollapsed){
15298
return this.applyLayoutCollapsed(box);
15300
var sd = this.splitEl.dom, s = sd.style;
15301
var sh = sd.offsetHeight;
15302
this.panel.setPosition(box.x, box.y+sh);
15303
s.left = (box.x)+'px';
15304
s.top = (box.y)+'px';
15305
s.width = Math.max(0, box.width)+'px';
15306
this.panel.setSize(box.width, box.height-sh);
15310
render : function(ct, p){
15311
Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this, ct, p);
15313
var ps = this.position;
15315
this.splitEl = ct.createChild({
15316
cls: "x-layout-split x-layout-split-"+ps, html: " ",
15317
id: this.panel.id + '-xsplit'
15320
if(this.collapseMode == 'mini'){
15321
this.miniSplitEl = this.splitEl.createChild({
15322
cls: "x-layout-mini x-layout-mini-"+ps, html: " "
15324
this.miniSplitEl.addClassOnOver('x-layout-mini-over');
15325
this.miniSplitEl.on('click', this.onCollapseClick, this, {stopEvent:true});
15328
var s = this.splitSettings[ps];
15330
this.split = new Ext.SplitBar(this.splitEl.dom, p.el, s.orientation);
15331
this.split.placement = s.placement;
15332
this.split.getMaximumSize = this[s.maxFn].createDelegate(this);
15333
this.split.minSize = this.minSize || this[s.minProp];
15334
this.split.on("beforeapply", this.onSplitMove, this);
15335
this.split.useShim = this.useShim === true;
15336
this.maxSize = this.maxSize || this[s.maxProp];
15339
this.splitEl.hide();
15342
if(this.useSplitTips){
15343
this.splitEl.dom.title = this.collapsible ? this.collapsibleSplitTip : this.splitTip;
15345
if(this.collapsible){
15346
this.splitEl.on("dblclick", this.onCollapseClick, this);
15350
getSize : function(){
15351
if(this.isCollapsed){
15352
return this.collapsedEl.getSize();
15354
var s = this.panel.getSize();
15355
if(this.position == 'north' || this.position == 'south'){
15356
s.height += this.splitEl.dom.offsetHeight;
15358
s.width += this.splitEl.dom.offsetWidth;
15363
getHMaxSize : function(){
15364
var cmax = this.maxSize || 10000;
15365
var center = this.layout.center;
15366
return Math.min(cmax, (this.el.getWidth()+center.el.getWidth())-center.getMinWidth());
15369
getVMaxSize : function(){
15370
var cmax = this.maxSize || 10000;
15371
var center = this.layout.center;
15372
return Math.min(cmax, (this.el.getHeight()+center.el.getHeight())-center.getMinHeight());
15375
onSplitMove : function(split, newSize){
15376
var s = this.panel.getSize();
15377
this.lastSplitSize = newSize;
15378
if(this.position == 'north' || this.position == 'south'){
15379
this.panel.setSize(s.width, newSize);
15380
this.state.height = newSize;
15382
this.panel.setSize(newSize, s.height);
15383
this.state.width = newSize;
15385
this.layout.layout();
15386
this.panel.saveState();
15391
getSplitBar : function(){
15396
Ext.Container.LAYOUTS['border'] = Ext.layout.BorderLayout;
15398
Ext.layout.FormLayout = Ext.extend(Ext.layout.AnchorLayout, {
15402
labelSeparator : ':',
15404
getAnchorViewSize : function(ct, target){
15405
return ct.body.getStyleSize();
15408
setContainer : function(ct){
15409
Ext.layout.FormLayout.superclass.setContainer.call(this, ct);
15412
ct.addClass('x-form-label-'+ct.labelAlign);
15416
this.labelStyle = "display:none";
15417
this.elementStyle = "padding-left:0;";
15418
this.labelAdjust = 0;
15420
this.labelSeparator = ct.labelSeparator || this.labelSeparator;
15421
ct.labelWidth = ct.labelWidth || 100;
15422
if(typeof ct.labelWidth == 'number'){
15423
var pad = (typeof ct.labelPad == 'number' ? ct.labelPad : 5);
15424
this.labelAdjust = ct.labelWidth+pad;
15425
this.labelStyle = "width:"+ct.labelWidth+"px;";
15426
this.elementStyle = "padding-left:"+(ct.labelWidth+pad)+'px';
15428
if(ct.labelAlign == 'top'){
15429
this.labelStyle = "width:auto;";
15430
this.labelAdjust = 0;
15431
this.elementStyle = "padding-left:0;";
15435
if(!this.fieldTpl){
15436
var t = new Ext.Template(
15437
'<div class="x-form-item {5}" tabIndex="-1">',
15438
'<label for="{0}" style="{2}" class="x-form-item-label">{1}{4}</label>',
15439
'<div class="x-form-element" id="x-form-el-{0}" style="{3}">',
15440
'</div><div class="{6}"></div>',
15443
t.disableFormats = true;
15445
Ext.layout.FormLayout.prototype.fieldTpl = t;
15449
renderItem : function(c, position, target){
15450
if(c && !c.rendered && c.isFormField && c.inputType != 'hidden'){
15452
c.id, c.fieldLabel,
15453
c.labelStyle||this.labelStyle||'',
15454
this.elementStyle||'',
15455
typeof c.labelSeparator == 'undefined' ? this.labelSeparator : c.labelSeparator,
15456
(c.itemCls||this.container.itemCls||'') + (c.hideLabel ? ' x-hide-label' : ''),
15457
c.clearCls || 'x-form-clear-left'
15459
if(typeof position == 'number'){
15460
position = target.dom.childNodes[position] || null;
15463
this.fieldTpl.insertBefore(position, args);
15465
this.fieldTpl.append(target, args);
15467
c.render('x-form-el-'+c.id);
15469
Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments);
15473
adjustWidthAnchor : function(value, comp){
15474
return value - (comp.isFormField ? (comp.hideLabel ? 0 : this.labelAdjust) : 0);
15477
isValidParent : function(c, target){
15484
Ext.Container.LAYOUTS['form'] = Ext.layout.FormLayout;
15486
Ext.layout.Accordion = Ext.extend(Ext.layout.FitLayout, {
15492
titleCollapse : true,
15494
hideCollapseTool : false,
15496
collapseFirst : false,
15502
activeOnTop : false,
15504
renderItem : function(c){
15505
if(this.animate === false){
15506
c.animCollapse = false;
15508
c.collapsible = true;
15509
if(this.autoWidth){
15510
c.autoWidth = true;
15512
if(this.titleCollapse){
15513
c.titleCollapse = true;
15515
if(this.hideCollapseTool){
15516
c.hideCollapseTool = true;
15518
if(this.collapseFirst !== undefined){
15519
c.collapseFirst = this.collapseFirst;
15521
if(!this.activeItem && !c.collapsed){
15522
this.activeItem = c;
15523
}else if(this.activeItem){
15524
c.collapsed = true;
15526
Ext.layout.Accordion.superclass.renderItem.apply(this, arguments);
15527
c.header.addClass('x-accordion-hd');
15528
c.on('beforeexpand', this.beforeExpand, this);
15532
beforeExpand : function(p, anim){
15533
var ai = this.activeItem;
15536
delete this.activeItem;
15537
if (!ai.collapsed){
15538
ai.collapse({callback:function(){
15539
p.expand(anim || true);
15544
ai.collapse(this.animate);
15547
this.activeItem = p;
15548
if(this.activeOnTop){
15549
p.el.dom.parentNode.insertBefore(p.el.dom, p.el.dom.parentNode.firstChild);
15555
setItemSize : function(item, size){
15556
if(this.fill && item){
15557
var items = this.container.items.items;
15559
for(var i = 0, len = items.length; i < len; i++){
15562
hh += (p.getSize().height - p.bwrap.getHeight());
15566
item.setSize(size);
15570
Ext.Container.LAYOUTS['accordion'] = Ext.layout.Accordion;
15572
Ext.layout.TableLayout = Ext.extend(Ext.layout.ContainerLayout, {
15576
monitorResize:false,
15579
setContainer : function(ct){
15580
Ext.layout.TableLayout.superclass.setContainer.call(this, ct);
15582
this.currentRow = 0;
15583
this.currentColumn = 0;
15588
onLayout : function(ct, target){
15589
var cs = ct.items.items, len = cs.length, c, i;
15592
target.addClass('x-table-layout-ct');
15594
this.table = target.createChild(
15595
{tag:'table', cls:'x-table-layout', cellspacing: 0, cn: {tag: 'tbody'}}, null, true);
15597
this.renderAll(ct, target);
15602
getRow : function(index){
15603
var row = this.table.tBodies[0].childNodes[index];
15605
row = document.createElement('tr');
15606
this.table.tBodies[0].appendChild(row);
15612
getNextCell : function(c){
15613
var cell = this.getNextNonSpan(this.currentColumn, this.currentRow);
15614
var curCol = this.currentColumn = cell[0], curRow = this.currentRow = cell[1];
15615
for(var rowIndex = curRow; rowIndex < curRow + (c.rowspan || 1); rowIndex++){
15616
if(!this.cells[rowIndex]){
15617
this.cells[rowIndex] = [];
15619
for(var colIndex = curCol; colIndex < curCol + (c.colspan || 1); colIndex++){
15620
this.cells[rowIndex][colIndex] = true;
15623
var td = document.createElement('td');
15627
var cls = 'x-table-layout-cell';
15629
cls += ' ' + c.cellCls;
15631
td.className = cls;
15633
td.colSpan = c.colspan;
15636
td.rowSpan = c.rowspan;
15638
this.getRow(curRow).appendChild(td);
15643
getNextNonSpan: function(colIndex, rowIndex){
15644
var cols = this.columns;
15645
while((cols && colIndex >= cols) || (this.cells[rowIndex] && this.cells[rowIndex][colIndex])) {
15646
if(cols && colIndex >= cols){
15653
return [colIndex, rowIndex];
15657
renderItem : function(c, position, target){
15658
if(c && !c.rendered){
15659
c.render(this.getNextCell(c));
15664
isValidParent : function(c, target){
15671
Ext.Container.LAYOUTS['table'] = Ext.layout.TableLayout;
15673
Ext.layout.AbsoluteLayout = Ext.extend(Ext.layout.AnchorLayout, {
15674
extraCls: 'x-abs-layout-item',
15677
setContainer : function(ct){
15678
Ext.layout.AbsoluteLayout.superclass.setContainer.call(this, ct);
15679
if(ct.isXType('form')){
15680
this.isForm = true;
15684
onLayout : function(ct, target){
15685
if(this.isForm){ ct.body.position(); } else { target.position(); }
15686
Ext.layout.AbsoluteLayout.superclass.onLayout.call(this, ct, target);
15690
getAnchorViewSize : function(ct, target){
15691
return this.isForm ? ct.body.getStyleSize() : Ext.layout.AbsoluteLayout.superclass.getAnchorViewSize.call(this, ct, target);
15695
isValidParent : function(c, target){
15696
return this.isForm ? true : Ext.layout.AbsoluteLayout.superclass.isValidParent.call(this, c, target);
15700
adjustWidthAnchor : function(value, comp){
15701
return value ? value - comp.getPosition(true)[0] : value;
15705
adjustHeightAnchor : function(value, comp){
15706
return value ? value - comp.getPosition(true)[1] : value;
15710
Ext.Container.LAYOUTS['absolute'] = Ext.layout.AbsoluteLayout;
15712
Ext.Viewport = Ext.extend(Ext.Container, {
15725
initComponent : function() {
15726
Ext.Viewport.superclass.initComponent.call(this);
15727
document.getElementsByTagName('html')[0].className += ' x-viewport';
15728
this.el = Ext.getBody();
15729
this.el.setHeight = Ext.emptyFn;
15730
this.el.setWidth = Ext.emptyFn;
15731
this.el.setSize = Ext.emptyFn;
15732
this.el.dom.scroll = 'no';
15733
this.allowDomMove = false;
15734
this.autoWidth = true;
15735
this.autoHeight = true;
15736
Ext.EventManager.onWindowResize(this.fireResize, this);
15737
this.renderTo = this.el;
15740
fireResize : function(w, h){
15741
this.fireEvent('resize', this, w, h, w, h);
15744
Ext.reg('viewport', Ext.Viewport);
15746
Ext.Panel = Ext.extend(Ext.Container, {
15781
baseCls : 'x-panel',
15783
collapsedCls : 'x-panel-collapsed',
15785
maskDisabled: true,
15787
animCollapse: Ext.enableFx,
15789
headerAsText: true,
15791
buttonAlign: 'right',
15795
collapseFirst: true,
15801
toolTarget : 'header',
15802
collapseEl : 'bwrap',
15810
collapseDefaults: {
15814
initComponent : function(){
15815
Ext.Panel.superclass.initComponent.call(this);
15841
this.elements += ',tbar';
15842
if(typeof this.tbar == 'object'){
15843
this.topToolbar = this.tbar;
15848
this.elements += ',bbar';
15849
if(typeof this.bbar == 'object'){
15850
this.bottomToolbar = this.bbar;
15855
if(this.header === true){
15856
this.elements += ',header';
15857
delete this.header;
15858
}else if(this.title && this.header !== false){
15859
this.elements += ',header';
15862
if(this.footer === true){
15863
this.elements += ',footer';
15864
delete this.footer;
15868
var btns = this.buttons;
15871
for(var i = 0, len = btns.length; i < len; i++) {
15872
if(btns[i].render){ btns[i].ownerCt = this;
15873
this.buttons.push(btns[i]);
15875
this.addButton(btns[i]);
15880
this.on('render', this.doAutoLoad, this, {delay:10});
15884
createElement : function(name, pnode){
15886
pnode.appendChild(this[name].dom);
15890
if(name === 'bwrap' || this.elements.indexOf(name) != -1){
15891
if(this[name+'Cfg']){
15892
this[name] = Ext.fly(pnode).createChild(this[name+'Cfg']);
15894
var el = document.createElement('div');
15895
el.className = this[name+'Cls'];
15896
this[name] = Ext.get(pnode.appendChild(el));
15901
onRender : function(ct, position){
15902
Ext.Panel.superclass.onRender.call(this, ct, position);
15904
this.createClasses();
15906
if(this.el){ this.el.addClass(this.baseCls);
15907
this.header = this.el.down('.'+this.headerCls);
15908
this.bwrap = this.el.down('.'+this.bwrapCls);
15909
var cp = this.bwrap ? this.bwrap : this.el;
15910
this.tbar = cp.down('.'+this.tbarCls);
15911
this.body = cp.down('.'+this.bodyCls);
15912
this.bbar = cp.down('.'+this.bbarCls);
15913
this.footer = cp.down('.'+this.footerCls);
15914
this.fromMarkup = true;
15916
this.el = ct.createChild({
15921
var el = this.el, d = el.dom;
15924
this.el.addClass(this.cls);
15928
this.elements += ',footer';
15933
el.insertHtml('afterBegin', String.format(Ext.Element.boxMarkup, this.baseCls));
15935
this.createElement('header', d.firstChild.firstChild.firstChild);
15936
this.createElement('bwrap', d);
15938
var bw = this.bwrap.dom;
15939
var ml = d.childNodes[1], bl = d.childNodes[2];
15940
bw.appendChild(ml);
15941
bw.appendChild(bl);
15943
var mc = bw.firstChild.firstChild.firstChild;
15944
this.createElement('tbar', mc);
15945
this.createElement('body', mc);
15946
this.createElement('bbar', mc);
15947
this.createElement('footer', bw.lastChild.firstChild.firstChild);
15950
this.bwrap.dom.lastChild.className += ' x-panel-nofooter';
15953
this.createElement('header', d);
15954
this.createElement('bwrap', d);
15956
var bw = this.bwrap.dom;
15957
this.createElement('tbar', bw);
15958
this.createElement('body', bw);
15959
this.createElement('bbar', bw);
15960
this.createElement('footer', bw);
15963
this.body.addClass(this.bodyCls + '-noheader');
15965
this.tbar.addClass(this.tbarCls + '-noheader');
15970
if(this.border === false){
15971
this.el.addClass(this.baseCls + '-noborder');
15972
this.body.addClass(this.bodyCls + '-noborder');
15974
this.header.addClass(this.headerCls + '-noborder');
15977
this.footer.addClass(this.footerCls + '-noborder');
15980
this.tbar.addClass(this.tbarCls + '-noborder');
15983
this.bbar.addClass(this.bbarCls + '-noborder');
15987
if(this.bodyBorder === false){
15988
this.body.addClass(this.bodyCls + '-noborder');
15991
if(this.bodyStyle){
15992
this.body.applyStyles(this.bodyStyle);
15995
this.bwrap.enableDisplayMode('block');
15998
this.header.unselectable();
16000
if(this.headerAsText){
16001
this.header.dom.innerHTML =
16002
'<span class="' + this.headerTextCls + '">'+this.header.dom.innerHTML+'</span>';
16005
this.setIconClass(this.iconCls);
16011
this.makeFloating(this.floating);
16014
if(this.collapsible){
16015
this.tools = this.tools ? this.tools.slice(0) : [];
16016
if(!this.hideCollapseTool){
16017
this.tools[this.collapseFirst?'unshift':'push']({
16019
handler : this.toggleCollapse,
16023
if(this.titleCollapse && this.header){
16024
this.header.on('click', this.toggleCollapse, this);
16025
this.header.setStyle('cursor', 'pointer');
16029
var ts = this.tools;
16031
this.addTool.apply(this, ts);
16036
if(this.buttons && this.buttons.length > 0){
16037
var tb = this.footer.createChild({cls:'x-panel-btns-ct', cn: {
16038
cls:"x-panel-btns x-panel-btns-"+this.buttonAlign,
16039
html:'<table cellspacing="0"><tbody><tr></tr></tbody></table><div class="x-clear"></div>'
16041
var tr = tb.getElementsByTagName('tr')[0];
16042
for(var i = 0, len = this.buttons.length; i < len; i++) {
16043
var b = this.buttons[i];
16044
var td = document.createElement('td');
16045
td.className = 'x-panel-btn-td';
16046
b.render(tr.appendChild(td));
16050
if(this.tbar && this.topToolbar){
16051
if(Ext.isArray(this.topToolbar)){
16052
this.topToolbar = new Ext.Toolbar(this.topToolbar);
16054
this.topToolbar.render(this.tbar);
16055
this.topToolbar.ownerCt = this;
16057
if(this.bbar && this.bottomToolbar){
16058
if(Ext.isArray(this.bottomToolbar)){
16059
this.bottomToolbar = new Ext.Toolbar(this.bottomToolbar);
16061
this.bottomToolbar.render(this.bbar);
16062
this.bottomToolbar.ownerCt = this;
16067
setIconClass : function(cls){
16068
var old = this.iconCls;
16069
this.iconCls = cls;
16070
if(this.rendered && this.header){
16072
this.header.addClass('x-panel-icon');
16073
this.header.replaceClass(old, this.iconCls);
16075
var hd = this.header.dom;
16076
var img = hd.firstChild && String(hd.firstChild.tagName).toLowerCase() == 'img' ? hd.firstChild : null;
16078
Ext.fly(img).replaceClass(old, this.iconCls);
16080
Ext.DomHelper.insertBefore(hd.firstChild, {
16081
tag:'img', src: Ext.BLANK_IMAGE_URL, cls:'x-panel-inline-icon '+this.iconCls
16088
makeFloating : function(cfg){
16089
this.floating = true;
16090
this.el = new Ext.Layer(
16091
typeof cfg == 'object' ? cfg : {
16092
shadow: this.shadow !== undefined ? this.shadow : 'sides',
16093
shadowOffset: this.shadowOffset,
16095
shim: this.shim === false ? false : undefined
16101
getTopToolbar : function(){
16102
return this.topToolbar;
16106
getBottomToolbar : function(){
16107
return this.bottomToolbar;
16111
addButton : function(config, handler, scope){
16115
minWidth: this.minButtonWidth,
16118
if(typeof config == "string"){
16121
Ext.apply(bc, config);
16123
var btn = new Ext.Button(bc);
16124
btn.ownerCt = this;
16128
this.buttons.push(btn);
16132
addTool : function(){
16133
if(!this[this.toolTarget]) { return;
16135
if(!this.toolTemplate){
16136
var tt = new Ext.Template(
16137
'<div class="x-tool x-tool-{id}"> </div>'
16139
tt.disableFormats = true;
16141
Ext.Panel.prototype.toolTemplate = tt;
16143
for(var i = 0, a = arguments, len = a.length; i < len; i++) {
16144
var tc = a[i], overCls = 'x-tool-'+tc.id+'-over';
16145
var t = this.toolTemplate.insertFirst((tc.align !== 'left') ? this[this.toolTarget] : this[this.toolTarget].child('span'), tc, true);
16146
this.tools[tc.id] = t;
16147
t.enableDisplayMode('block');
16148
t.on('click', this.createToolHandler(t, tc, overCls, this));
16156
if(typeof tc.qtip == 'object'){
16157
Ext.QuickTips.register(Ext.apply({
16161
t.dom.qtip = tc.qtip;
16164
t.addClassOnOver(overCls);
16168
onShow : function(){
16170
return this.el.show();
16172
Ext.Panel.superclass.onShow.call(this);
16175
onHide : function(){
16177
return this.el.hide();
16179
Ext.Panel.superclass.onHide.call(this);
16182
createToolHandler : function(t, tc, overCls, panel){
16183
return function(e){
16184
t.removeClass(overCls);
16187
tc.handler.call(tc.scope || t, e, t, panel);
16192
afterRender : function(){
16193
if(this.fromMarkup && this.height === undefined && !this.autoHeight){
16194
this.height = this.el.getHeight();
16196
if(this.floating && !this.hidden && !this.initHidden){
16200
this.setTitle(this.title);
16202
this.setAutoScroll();
16204
this.body.update(typeof this.html == 'object' ?
16205
Ext.DomHelper.markup(this.html) :
16209
if(this.contentEl){
16210
var ce = Ext.getDom(this.contentEl);
16211
Ext.fly(ce).removeClass(['x-hidden', 'x-hide-display']);
16212
this.body.dom.appendChild(ce);
16214
if(this.collapsed){
16215
this.collapsed = false;
16216
this.collapse(false);
16218
Ext.Panel.superclass.afterRender.call(this); this.initEvents();
16221
setAutoScroll : function(){
16222
if(this.rendered && this.autoScroll){
16223
var el = this.body || this.el;
16225
el.setOverflow('auto');
16230
getKeyMap : function(){
16232
this.keyMap = new Ext.KeyMap(this.el, this.keys);
16234
return this.keyMap;
16237
initEvents : function(){
16241
if(this.draggable){
16242
this.initDraggable();
16246
initDraggable : function(){
16248
this.dd = new Ext.Panel.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable);
16251
beforeEffect : function(){
16253
this.el.beforeAction();
16255
this.el.addClass('x-panel-animated');
16258
afterEffect : function(){
16260
this.el.removeClass('x-panel-animated');
16263
createEffect : function(a, cb, scope){
16271
}else if(!a.callback){
16273
}else { o.callback = function(){
16275
Ext.callback(a.callback, a.scope);
16278
return Ext.applyIf(o, a);
16282
collapse : function(animate){
16283
if(this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforecollapse', this, animate) === false){
16286
var doAnim = animate === true || (animate !== false && this.animCollapse);
16287
this.beforeEffect();
16288
this.onCollapse(doAnim, animate);
16292
onCollapse : function(doAnim, animArg){
16294
this[this.collapseEl].slideOut(this.slideAnchor,
16295
Ext.apply(this.createEffect(animArg||true, this.afterCollapse, this),
16296
this.collapseDefaults));
16298
this[this.collapseEl].hide();
16299
this.afterCollapse();
16303
afterCollapse : function(){
16304
this.collapsed = true;
16305
this.el.addClass(this.collapsedCls);
16306
this.afterEffect();
16307
this.fireEvent('collapse', this);
16311
expand : function(animate){
16312
if(!this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforeexpand', this, animate) === false){
16315
var doAnim = animate === true || (animate !== false && this.animCollapse);
16316
this.el.removeClass(this.collapsedCls);
16317
this.beforeEffect();
16318
this.onExpand(doAnim, animate);
16322
onExpand : function(doAnim, animArg){
16324
this[this.collapseEl].slideIn(this.slideAnchor,
16325
Ext.apply(this.createEffect(animArg||true, this.afterExpand, this),
16326
this.expandDefaults));
16328
this[this.collapseEl].show();
16329
this.afterExpand();
16333
afterExpand : function(){
16334
this.collapsed = false;
16335
this.afterEffect();
16336
this.fireEvent('expand', this);
16340
toggleCollapse : function(animate){
16341
this[this.collapsed ? 'expand' : 'collapse'](animate);
16345
onDisable : function(){
16346
if(this.rendered && this.maskDisabled){
16349
Ext.Panel.superclass.onDisable.call(this);
16352
onEnable : function(){
16353
if(this.rendered && this.maskDisabled){
16356
Ext.Panel.superclass.onEnable.call(this);
16359
onResize : function(w, h){
16360
if(w !== undefined || h !== undefined){
16361
if(!this.collapsed){
16362
if(typeof w == 'number'){
16363
this.body.setWidth(
16364
this.adjustBodyWidth(w - this.getFrameWidth()));
16365
}else if(w == 'auto'){
16366
this.body.setWidth(w);
16369
if(typeof h == 'number'){
16370
this.body.setHeight(
16371
this.adjustBodyHeight(h - this.getFrameHeight()));
16372
}else if(h == 'auto'){
16373
this.body.setHeight(h);
16376
if(this.disabled && this.el._mask){
16377
this.el._mask.setSize(this.el.dom.clientWidth, this.el.getHeight());
16380
this.queuedBodySize = {width: w, height: h};
16381
if(!this.queuedExpand && this.allowQueuedExpand !== false){
16382
this.queuedExpand = true;
16383
this.on('expand', function(){
16384
delete this.queuedExpand;
16385
this.onResize(this.queuedBodySize.width, this.queuedBodySize.height);
16387
}, this, {single:true});
16390
this.fireEvent('bodyresize', this, w, h);
16395
adjustBodyHeight : function(h){
16399
adjustBodyWidth : function(w){
16403
onPosition : function(){
16408
getFrameWidth : function(){
16409
var w = this.el.getFrameWidth('lr');
16412
var l = this.bwrap.dom.firstChild;
16413
w += (Ext.fly(l).getFrameWidth('l') + Ext.fly(l.firstChild).getFrameWidth('r'));
16414
var mc = this.bwrap.dom.firstChild.firstChild.firstChild;
16415
w += Ext.fly(mc).getFrameWidth('lr');
16421
getFrameHeight : function(){
16422
var h = this.el.getFrameWidth('tb');
16423
h += (this.tbar ? this.tbar.getHeight() : 0) +
16424
(this.bbar ? this.bbar.getHeight() : 0);
16427
var hd = this.el.dom.firstChild;
16428
var ft = this.bwrap.dom.lastChild;
16429
h += (hd.offsetHeight + ft.offsetHeight);
16430
var mc = this.bwrap.dom.firstChild.firstChild.firstChild;
16431
h += Ext.fly(mc).getFrameWidth('tb');
16433
h += (this.header ? this.header.getHeight() : 0) +
16434
(this.footer ? this.footer.getHeight() : 0);
16440
getInnerWidth : function(){
16441
return this.getSize().width - this.getFrameWidth();
16445
getInnerHeight : function(){
16446
return this.getSize().height - this.getFrameHeight();
16449
syncShadow : function(){
16451
this.el.sync(true);
16455
getLayoutTarget : function(){
16460
setTitle : function(title, iconCls){
16461
this.title = title;
16462
if(this.header && this.headerAsText){
16463
this.header.child('span').update(title);
16466
this.setIconClass(iconCls);
16468
this.fireEvent('titlechange', this, title);
16473
getUpdater : function(){
16474
return this.body.getUpdater();
16479
var um = this.body.getUpdater();
16480
um.update.apply(um, arguments);
16484
beforeDestroy : function(){
16485
Ext.Element.uncache(
16493
for(var k in this.tools){
16494
Ext.destroy(this.tools[k]);
16498
for(var b in this.buttons){
16499
Ext.destroy(this.buttons[b]);
16506
Ext.Panel.superclass.beforeDestroy.call(this);
16509
createClasses : function(){
16510
this.headerCls = this.baseCls + '-header';
16511
this.headerTextCls = this.baseCls + '-header-text';
16512
this.bwrapCls = this.baseCls + '-bwrap';
16513
this.tbarCls = this.baseCls + '-tbar';
16514
this.bodyCls = this.baseCls + '-body';
16515
this.bbarCls = this.baseCls + '-bbar';
16516
this.footerCls = this.baseCls + '-footer';
16519
createGhost : function(cls, useShim, appendTo){
16520
var el = document.createElement('div');
16521
el.className = 'x-panel-ghost ' + (cls ? cls : '');
16523
el.appendChild(this.el.dom.firstChild.cloneNode(true));
16525
Ext.fly(el.appendChild(document.createElement('ul'))).setHeight(this.bwrap.getHeight());
16526
el.style.width = this.el.dom.offsetWidth + 'px';;
16528
this.container.dom.appendChild(el);
16530
Ext.getDom(appendTo).appendChild(el);
16532
if(useShim !== false && this.el.useShim !== false){
16533
var layer = new Ext.Layer({shadow:false, useDisplay:true, constrain:false}, el);
16537
return new Ext.Element(el);
16541
doAutoLoad : function(){
16543
typeof this.autoLoad == 'object' ?
16544
this.autoLoad : {url: this.autoLoad});
16549
Ext.reg('panel', Ext.Panel);
16552
Ext.Window = Ext.extend(Ext.Panel, {
16562
baseCls : 'x-window',
16572
constrainHeader:false,
16576
minimizable : false,
16578
maximizable : false,
16584
expandOnShow: true,
16586
closeAction: 'close',
16588
elements: 'header,body',
16594
monitorResize : true,
16600
initComponent : function(){
16601
Ext.Window.superclass.initComponent.call(this);
16616
getState : function(){
16617
return Ext.apply(Ext.Window.superclass.getState.call(this) || {}, this.getBox());
16620
onRender : function(ct, position){
16621
Ext.Window.superclass.onRender.call(this, ct, position);
16624
this.el.addClass('x-window-plain');
16627
this.focusEl = this.el.createChild({
16628
tag: "a", href:"#", cls:"x-dlg-focus",
16629
tabIndex:"-1", html: " "});
16630
this.focusEl.swallowEvent('click', true);
16632
this.proxy = this.el.createProxy("x-window-proxy");
16633
this.proxy.enableDisplayMode('block');
16636
this.mask = this.container.createChild({cls:"ext-el-mask"}, this.el.dom);
16637
this.mask.enableDisplayMode("block");
16642
initEvents : function(){
16643
Ext.Window.superclass.initEvents.call(this);
16644
if(this.animateTarget){
16645
this.setAnimateTarget(this.animateTarget);
16648
if(this.resizable){
16649
this.resizer = new Ext.Resizable(this.el, {
16650
minWidth: this.minWidth,
16651
minHeight:this.minHeight,
16652
handles: this.resizeHandles || "all",
16654
resizeElement : this.resizerAction
16656
this.resizer.window = this;
16657
this.resizer.on("beforeresize", this.beforeResize, this);
16660
if(this.draggable){
16661
this.header.addClass("x-window-draggable");
16665
this.el.on("mousedown", this.toFront, this);
16666
this.manager = this.manager || Ext.WindowMgr;
16667
this.manager.register(this);
16668
this.hidden = true;
16669
if(this.maximized){
16670
this.maximized = false;
16674
var km = this.getKeyMap();
16675
km.on(27, this.onEsc, this);
16680
initDraggable : function(){
16682
this.dd = new Ext.Window.DD(this);
16685
onEsc : function(){
16686
this[this.closeAction]();
16689
beforeDestroy : function(){
16696
Ext.Window.superclass.beforeDestroy.call(this);
16699
onDestroy : function(){
16701
this.manager.unregister(this);
16703
Ext.Window.superclass.onDestroy.call(this);
16706
initTools : function(){
16707
if(this.minimizable){
16710
handler: this.minimize.createDelegate(this, [])
16713
if(this.maximizable){
16716
handler: this.maximize.createDelegate(this, [])
16720
handler: this.restore.createDelegate(this, []),
16723
this.header.on('dblclick', this.toggleMaximize, this);
16728
handler: this[this.closeAction].createDelegate(this, [])
16733
resizerAction : function(){
16734
var box = this.proxy.getBox();
16736
this.window.handleResize(box);
16740
beforeResize : function(){
16741
this.resizer.minHeight = Math.max(this.minHeight, this.getFrameHeight() + 40); this.resizer.minWidth = Math.max(this.minWidth, this.getFrameWidth() + 40);
16742
this.resizeBox = this.el.getBox();
16745
updateHandles : function(){
16746
if(Ext.isIE && this.resizer){
16747
this.resizer.syncHandleHeight();
16752
handleResize : function(box){
16753
var rz = this.resizeBox;
16754
if(rz.x != box.x || rz.y != box.y){
16755
this.updateBox(box);
16760
this.updateHandles();
16765
this.fireEvent("resize", this, box.width, box.height);
16769
focus : function(){
16770
var f = this.focusEl, db = this.defaultButton, t = typeof db;
16771
if(t != 'undefined'){
16773
f = this.buttons[db];
16774
}else if(t == 'string'){
16775
f = Ext.getCmp(db);
16780
f.focus.defer(10, f);
16784
setAnimateTarget : function(el){
16786
this.animateTarget = el;
16789
beforeShow : function(){
16790
delete this.el.lastXY;
16791
delete this.el.lastLT;
16792
if(this.x === undefined || this.y === undefined){
16793
var xy = this.el.getAlignToXY(this.container, 'c-c');
16794
var pos = this.el.translatePoints(xy[0], xy[1]);
16795
this.x = this.x === undefined? pos.left : this.x;
16796
this.y = this.y === undefined? pos.top : this.y;
16798
this.el.setLeftTop(this.x, this.y);
16800
if(this.expandOnShow){
16801
this.expand(false);
16805
Ext.getBody().addClass("x-body-masked");
16806
this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
16812
show : function(animateTarget, cb, scope){
16813
if(!this.rendered){
16814
this.render(Ext.getBody());
16816
if(this.hidden === false){
16820
if(this.fireEvent("beforeshow", this) === false){
16824
this.on('show', cb, scope, {single:true});
16826
this.hidden = false;
16827
if(animateTarget !== undefined){
16828
this.setAnimateTarget(animateTarget);
16831
if(this.animateTarget){
16838
afterShow : function(){
16840
this.el.setStyle('display', 'block');
16842
if(this.maximized){
16843
this.fitContainer();
16845
if(Ext.isMac && Ext.isGecko){ this.cascade(this.setAutoScroll);
16848
if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
16849
Ext.EventManager.onWindowResize(this.onWindowResize, this);
16851
this.doConstrain();
16856
this.keyMap.enable();
16859
this.updateHandles();
16860
this.fireEvent("show", this);
16863
animShow : function(){
16865
this.proxy.setBox(this.animateTarget.getBox());
16866
this.proxy.setOpacity(0);
16867
var b = this.getBox(false);
16868
b.callback = this.afterShow;
16871
b.easing = 'easeNone';
16874
this.el.setStyle('display', 'none');
16875
this.proxy.shift(b);
16879
hide : function(animateTarget, cb, scope){
16880
if(this.activeGhost){ this.hide.defer(100, this, [animateTarget, cb, scope]);
16883
if(this.hidden || this.fireEvent("beforehide", this) === false){
16887
this.on('hide', cb, scope, {single:true});
16889
this.hidden = true;
16890
if(animateTarget !== undefined){
16891
this.setAnimateTarget(animateTarget);
16893
if(this.animateTarget){
16901
afterHide : function(){
16903
if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
16904
Ext.EventManager.removeResizeListener(this.onWindowResize, this);
16908
Ext.getBody().removeClass("x-body-masked");
16911
this.keyMap.disable();
16913
this.fireEvent("hide", this);
16916
animHide : function(){
16917
this.proxy.setOpacity(.5);
16919
var tb = this.getBox(false);
16920
this.proxy.setBox(tb);
16922
var b = this.animateTarget.getBox();
16923
b.callback = this.afterHide;
16926
b.easing = 'easeNone';
16929
this.proxy.shift(b);
16932
onWindowResize : function(){
16933
if(this.maximized){
16934
this.fitContainer();
16937
this.mask.setSize('100%', '100%');
16938
var force = this.mask.dom.offsetHeight;
16939
this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
16941
this.doConstrain();
16944
doConstrain : function(){
16945
if(this.constrain || this.constrainHeader){
16947
if(this.constrain){
16949
right:this.el.shadowOffset,
16950
left:this.el.shadowOffset,
16951
bottom:this.el.shadowOffset
16954
var s = this.getSize();
16956
right:-(s.width - 100),
16957
bottom:-(s.height - 25)
16961
var xy = this.el.getConstrainToXY(this.container, true, offsets);
16963
this.setPosition(xy[0], xy[1]);
16968
ghost : function(cls){
16969
var ghost = this.createGhost(cls);
16970
var box = this.getBox(true);
16971
ghost.setLeftTop(box.x, box.y);
16972
ghost.setWidth(box.width);
16974
this.activeGhost = ghost;
16978
unghost : function(show, matchPosition){
16979
if(show !== false){
16982
if(Ext.isMac && Ext.isGecko){ this.cascade(this.setAutoScroll);
16985
if(matchPosition !== false){
16986
this.setPosition(this.activeGhost.getLeft(true), this.activeGhost.getTop(true));
16988
this.activeGhost.hide();
16989
this.activeGhost.remove();
16990
delete this.activeGhost;
16994
minimize : function(){
16995
this.fireEvent('minimize', this);
16999
close : function(){
17000
if(this.fireEvent("beforeclose", this) !== false){
17001
this.hide(null, function(){
17002
this.fireEvent('close', this);
17009
maximize : function(){
17010
if(!this.maximized){
17011
this.expand(false);
17012
this.restoreSize = this.getSize();
17013
this.restorePos = this.getPosition(true);
17014
if (this.maximizable){
17015
this.tools.maximize.hide();
17016
this.tools.restore.show();
17018
this.maximized = true;
17019
this.el.disableShadow();
17024
if(this.collapsible){
17025
this.tools.toggle.hide();
17027
this.el.addClass('x-window-maximized');
17028
this.container.addClass('x-window-maximized-ct');
17030
this.setPosition(0, 0);
17031
this.fitContainer();
17032
this.fireEvent('maximize', this);
17037
restore : function(){
17038
if(this.maximized){
17039
this.el.removeClass('x-window-maximized');
17040
this.tools.restore.hide();
17041
this.tools.maximize.show();
17042
this.setPosition(this.restorePos[0], this.restorePos[1]);
17043
this.setSize(this.restoreSize.width, this.restoreSize.height);
17044
delete this.restorePos;
17045
delete this.restoreSize;
17046
this.maximized = false;
17047
this.el.enableShadow(true);
17052
if(this.collapsible){
17053
this.tools.toggle.show();
17055
this.container.removeClass('x-window-maximized-ct');
17057
this.doConstrain();
17058
this.fireEvent('restore', this);
17063
toggleMaximize : function(){
17064
this[this.maximized ? 'restore' : 'maximize']();
17067
fitContainer : function(){
17068
var vs = this.container.getViewSize();
17069
this.setSize(vs.width, vs.height);
17072
setZIndex : function(index){
17074
this.mask.setStyle("z-index", index);
17076
this.el.setZIndex(++index);
17080
this.resizer.proxy.setStyle("z-index", ++index);
17083
this.lastZIndex = index;
17087
alignTo : function(element, position, offsets){
17088
var xy = this.el.getAlignToXY(element, position, offsets);
17089
this.setPagePosition(xy[0], xy[1]);
17094
anchorTo : function(el, alignment, offsets, monitorScroll, _pname){
17095
var action = function(){
17096
this.alignTo(el, alignment, offsets);
17098
Ext.EventManager.onWindowResize(action, this);
17099
var tm = typeof monitorScroll;
17100
if(tm != 'undefined'){
17101
Ext.EventManager.on(window, 'scroll', action, this,
17102
{buffer: tm == 'number' ? monitorScroll : 50});
17105
this[_pname] = action;
17110
toFront : function(){
17111
if(this.manager.bringToFront(this)){
17118
setActive : function(active){
17120
if(!this.maximized){
17121
this.el.enableShadow(true);
17123
this.fireEvent('activate', this);
17125
this.el.disableShadow();
17126
this.fireEvent('deactivate', this);
17131
toBack : function(){
17132
this.manager.sendToBack(this);
17137
center : function(){
17138
var xy = this.el.getAlignToXY(this.container, 'c-c');
17139
this.setPagePosition(xy[0], xy[1]);
17145
Ext.reg('window', Ext.Window);
17147
Ext.Window.DD = function(win){
17149
Ext.Window.DD.superclass.constructor.call(this, win.el.id, 'WindowDD-'+win.id);
17150
this.setHandleElId(win.header.id);
17151
this.scroll = false;
17154
Ext.extend(Ext.Window.DD, Ext.dd.DD, {
17156
headerOffsets:[100, 25],
17157
startDrag : function(){
17159
this.proxy = w.ghost();
17160
if(w.constrain !== false){
17161
var so = w.el.shadowOffset;
17162
this.constrainTo(w.container, {right: so, left: so, bottom: so});
17163
}else if(w.constrainHeader !== false){
17164
var s = this.proxy.getSize();
17165
this.constrainTo(w.container, {right: -(s.width-this.headerOffsets[0]), bottom: -(s.height-this.headerOffsets[1])});
17168
b4Drag : Ext.emptyFn,
17170
onDrag : function(e){
17171
this.alignElWithMouse(this.proxy, e.getPageX(), e.getPageY());
17174
endDrag : function(e){
17175
this.win.unghost();
17176
this.win.saveState();
17181
Ext.WindowGroup = function(){
17183
var accessList = [];
17186
var sortWindows = function(d1, d2){
17187
return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1;
17190
var orderWindows = function(){
17191
var a = accessList, len = a.length;
17193
a.sort(sortWindows);
17194
var seed = a[0].manager.zseed;
17195
for(var i = 0; i < len; i++){
17197
if(win && !win.hidden){
17198
win.setZIndex(seed + (i*10));
17205
var setActiveWin = function(win){
17208
front.setActive(false);
17212
win.setActive(true);
17217
var activateLast = function(){
17218
for(var i = accessList.length-1; i >=0; --i) {
17219
if(!accessList[i].hidden){
17220
setActiveWin(accessList[i]);
17224
setActiveWin(null);
17231
register : function(win){
17232
list[win.id] = win;
17233
accessList.push(win);
17234
win.on('hide', activateLast);
17237
unregister : function(win){
17238
delete list[win.id];
17239
win.un('hide', activateLast);
17240
accessList.remove(win);
17244
get : function(id){
17245
return typeof id == "object" ? id : list[id];
17249
bringToFront : function(win){
17250
win = this.get(win);
17252
win._lastAccess = new Date().getTime();
17260
sendToBack : function(win){
17261
win = this.get(win);
17262
win._lastAccess = -(new Date().getTime());
17268
hideAll : function(){
17269
for(var id in list){
17270
if(list[id] && typeof list[id] != "function" && list[id].isVisible()){
17277
getActive : function(){
17282
getBy : function(fn, scope){
17284
for(var i = accessList.length-1; i >=0; --i) {
17285
var win = accessList[i];
17286
if(fn.call(scope||win, win) !== false){
17294
each : function(fn, scope){
17295
for(var id in list){
17296
if(list[id] && typeof list[id] != "function"){
17297
if(fn.call(scope || list[id], list[id]) === false){
17308
Ext.WindowMgr = new Ext.WindowGroup();
17310
Ext.dd.PanelProxy = function(panel, config){
17311
this.panel = panel;
17312
this.id = this.panel.id +'-ddproxy';
17313
Ext.apply(this, config);
17316
Ext.dd.PanelProxy.prototype = {
17318
insertProxy : true,
17321
setStatus : Ext.emptyFn,
17322
reset : Ext.emptyFn,
17323
update : Ext.emptyFn,
17324
stop : Ext.emptyFn,
17328
getEl : function(){
17333
getGhost : function(){
17338
getProxy : function(){
17346
this.proxy.remove();
17349
this.panel.el.dom.style.display = '';
17350
this.ghost.remove();
17358
this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());
17359
this.ghost.setXY(this.panel.el.getXY())
17360
if(this.insertProxy){
17361
this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});
17362
this.proxy.setSize(this.panel.getSize());
17364
this.panel.el.dom.style.display = 'none';
17369
repair : function(xy, callback, scope){
17371
if(typeof callback == "function"){
17372
callback.call(scope || this);
17377
moveProxy : function(parentNode, before){
17379
parentNode.insertBefore(this.proxy.dom, before);
17385
Ext.Panel.DD = function(panel, cfg){
17386
this.panel = panel;
17387
this.dragData = {panel: panel};
17388
this.proxy = new Ext.dd.PanelProxy(panel, cfg);
17389
Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);
17390
var h = panel.header;
17392
this.setHandleElId(h.id);
17394
(h ? h : this.panel.body).setStyle('cursor', 'move');
17395
this.scroll = false;
17398
Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {
17399
showFrame: Ext.emptyFn,
17400
startDrag: Ext.emptyFn,
17401
b4StartDrag: function(x, y) {
17404
b4MouseDown: function(e) {
17405
var x = e.getPageX();
17406
var y = e.getPageY();
17407
this.autoOffset(x, y);
17409
onInitDrag : function(x, y){
17410
this.onStartDrag(x, y);
17413
createFrame : Ext.emptyFn,
17414
getDragEl : function(e){
17415
return this.proxy.ghost.dom;
17417
endDrag : function(e){
17419
this.panel.saveState();
17422
autoOffset : function(x, y) {
17423
x -= this.startPageX;
17424
y -= this.startPageY;
17425
this.setDelta(x, y);
17429
Ext.state.Provider = function(){
17431
this.addEvents("statechange");
17433
Ext.state.Provider.superclass.constructor.call(this);
17435
Ext.extend(Ext.state.Provider, Ext.util.Observable, {
17437
get : function(name, defaultValue){
17438
return typeof this.state[name] == "undefined" ?
17439
defaultValue : this.state[name];
17443
clear : function(name){
17444
delete this.state[name];
17445
this.fireEvent("statechange", this, name, null);
17449
set : function(name, value){
17450
this.state[name] = value;
17451
this.fireEvent("statechange", this, name, value);
17455
decodeValue : function(cookie){
17456
var re = /^(a|n|d|b|s|o)\:(.*)$/;
17457
var matches = re.exec(unescape(cookie));
17458
if(!matches || !matches[1]) return;
17459
var type = matches[1];
17460
var v = matches[2];
17463
return parseFloat(v);
17465
return new Date(Date.parse(v));
17470
var values = v.split("^");
17471
for(var i = 0, len = values.length; i < len; i++){
17472
all.push(this.decodeValue(values[i]));
17477
var values = v.split("^");
17478
for(var i = 0, len = values.length; i < len; i++){
17479
var kv = values[i].split("=");
17480
all[kv[0]] = this.decodeValue(kv[1]);
17489
encodeValue : function(v){
17491
if(typeof v == "number"){
17493
}else if(typeof v == "boolean"){
17494
enc = "b:" + (v ? "1" : "0");
17495
}else if(Ext.isDate(v)){
17496
enc = "d:" + v.toGMTString();
17497
}else if(Ext.isArray(v)){
17499
for(var i = 0, len = v.length; i < len; i++){
17500
flat += this.encodeValue(v[i]);
17501
if(i != len-1) flat += "^";
17504
}else if(typeof v == "object"){
17507
if(typeof v[key] != "function" && v[key] !== undefined){
17508
flat += key + "=" + this.encodeValue(v[key]) + "^";
17511
enc = "o:" + flat.substring(0, flat.length-1);
17515
return escape(enc);
17520
Ext.state.Manager = function(){
17521
var provider = new Ext.state.Provider();
17525
setProvider : function(stateProvider){
17526
provider = stateProvider;
17530
get : function(key, defaultValue){
17531
return provider.get(key, defaultValue);
17535
set : function(key, value){
17536
provider.set(key, value);
17540
clear : function(key){
17541
provider.clear(key);
17545
getProvider : function(){
17552
Ext.state.CookieProvider = function(config){
17553
Ext.state.CookieProvider.superclass.constructor.call(this);
17555
this.expires = new Date(new Date().getTime()+(1000*60*60*24*7));
17556
this.domain = null;
17557
this.secure = false;
17558
Ext.apply(this, config);
17559
this.state = this.readCookies();
17562
Ext.extend(Ext.state.CookieProvider, Ext.state.Provider, {
17564
set : function(name, value){
17565
if(typeof value == "undefined" || value === null){
17569
this.setCookie(name, value);
17570
Ext.state.CookieProvider.superclass.set.call(this, name, value);
17574
clear : function(name){
17575
this.clearCookie(name);
17576
Ext.state.CookieProvider.superclass.clear.call(this, name);
17580
readCookies : function(){
17582
var c = document.cookie + ";";
17583
var re = /\s?(.*?)=(.*?);/g;
17585
while((matches = re.exec(c)) != null){
17586
var name = matches[1];
17587
var value = matches[2];
17588
if(name && name.substring(0,3) == "ys-"){
17589
cookies[name.substr(3)] = this.decodeValue(value);
17596
setCookie : function(name, value){
17597
document.cookie = "ys-"+ name + "=" + this.encodeValue(value) +
17598
((this.expires == null) ? "" : ("; expires=" + this.expires.toGMTString())) +
17599
((this.path == null) ? "" : ("; path=" + this.path)) +
17600
((this.domain == null) ? "" : ("; domain=" + this.domain)) +
17601
((this.secure == true) ? "; secure" : "");
17605
clearCookie : function(name){
17606
document.cookie = "ys-" + name + "=null; expires=Thu, 01-Jan-70 00:00:01 GMT" +
17607
((this.path == null) ? "" : ("; path=" + this.path)) +
17608
((this.domain == null) ? "" : ("; domain=" + this.domain)) +
17609
((this.secure == true) ? "; secure" : "");
17613
Ext.DataView = Ext.extend(Ext.BoxComponent, {
17623
selectedClass : "x-view-selected",
17628
deferEmptyText: true,
17635
initComponent : function(){
17636
Ext.DataView.superclass.initComponent.call(this);
17637
if(typeof this.tpl == "string"){
17638
this.tpl = new Ext.XTemplate(this.tpl);
17663
this.all = new Ext.CompositeElementLite();
17664
this.selected = new Ext.CompositeElementLite();
17667
onRender : function(){
17669
this.el = document.createElement('div');
17670
this.el.id = this.id;
17672
Ext.DataView.superclass.onRender.apply(this, arguments);
17675
afterRender : function(){
17676
Ext.DataView.superclass.afterRender.call(this);
17679
"click": this.onClick,
17680
"dblclick": this.onDblClick,
17681
"contextmenu": this.onContextMenu,
17685
if(this.overClass || this.trackOver){
17687
"mouseover": this.onMouseOver,
17688
"mouseout": this.onMouseOut,
17694
this.setStore(this.store, true);
17699
refresh : function(){
17700
this.clearSelections(false, true);
17701
this.el.update("");
17702
var records = this.store.getRange();
17703
if(records.length < 1){
17704
if(!this.deferEmptyText || this.hasSkippedEmptyText){
17705
this.el.update(this.emptyText);
17707
this.hasSkippedEmptyText = true;
17711
this.tpl.overwrite(this.el, this.collectData(records, 0));
17712
this.all.fill(Ext.query(this.itemSelector, this.el.dom));
17713
this.updateIndexes(0);
17717
prepareData : function(data){
17722
collectData : function(records, startIndex){
17724
for(var i = 0, len = records.length; i < len; i++){
17725
r[r.length] = this.prepareData(records[i].data, startIndex+i, records[i]);
17730
bufferRender : function(records){
17731
var div = document.createElement('div');
17732
this.tpl.overwrite(div, this.collectData(records));
17733
return Ext.query(this.itemSelector, div);
17736
onUpdate : function(ds, record){
17737
var index = this.store.indexOf(record);
17738
var sel = this.isSelected(index);
17739
var original = this.all.elements[index];
17740
var node = this.bufferRender([record], index)[0];
17742
this.all.replaceElement(index, node, true);
17744
this.selected.replaceElement(original, node);
17745
this.all.item(index).addClass(this.selectedClass);
17747
this.updateIndexes(index, index);
17750
onAdd : function(ds, records, index){
17751
if(this.all.getCount() == 0){
17755
var nodes = this.bufferRender(records, index), n, a = this.all.elements;
17756
if(index < this.all.getCount()){
17757
n = this.all.item(index).insertSibling(nodes, 'before', true);
17758
a.splice.apply(a, [index, 0].concat(nodes));
17760
n = this.all.last().insertSibling(nodes, 'after', true);
17761
a.push.apply(a, nodes);
17763
this.updateIndexes(index);
17766
onRemove : function(ds, record, index){
17767
this.deselect(index);
17768
this.all.removeElement(index, true);
17769
this.updateIndexes(index);
17773
refreshNode : function(index){
17774
this.onUpdate(this.store, this.store.getAt(index));
17777
updateIndexes : function(startIndex, endIndex){
17778
var ns = this.all.elements;
17779
startIndex = startIndex || 0;
17780
endIndex = endIndex || ((endIndex === 0) ? 0 : (ns.length - 1));
17781
for(var i = startIndex; i <= endIndex; i++){
17782
ns[i].viewIndex = i;
17787
setStore : function(store, initial){
17788
if(!initial && this.store){
17789
this.store.un("beforeload", this.onBeforeLoad, this);
17790
this.store.un("datachanged", this.refresh, this);
17791
this.store.un("add", this.onAdd, this);
17792
this.store.un("remove", this.onRemove, this);
17793
this.store.un("update", this.onUpdate, this);
17794
this.store.un("clear", this.refresh, this);
17797
store = Ext.StoreMgr.lookup(store);
17798
store.on("beforeload", this.onBeforeLoad, this);
17799
store.on("datachanged", this.refresh, this);
17800
store.on("add", this.onAdd, this);
17801
store.on("remove", this.onRemove, this);
17802
store.on("update", this.onUpdate, this);
17803
store.on("clear", this.refresh, this);
17805
this.store = store;
17812
findItemFromChild : function(node){
17813
return Ext.fly(node).findParent(this.itemSelector, this.el);
17816
onClick : function(e){
17817
var item = e.getTarget(this.itemSelector, this.el);
17819
var index = this.indexOf(item);
17820
if(this.onItemClick(item, index, e) !== false){
17821
this.fireEvent("click", this, index, item, e);
17824
if(this.fireEvent("containerclick", this, e) !== false){
17825
this.clearSelections();
17830
onContextMenu : function(e){
17831
var item = e.getTarget(this.itemSelector, this.el);
17833
this.fireEvent("contextmenu", this, this.indexOf(item), item, e);
17837
onDblClick : function(e){
17838
var item = e.getTarget(this.itemSelector, this.el);
17840
this.fireEvent("dblclick", this, this.indexOf(item), item, e);
17844
onMouseOver : function(e){
17845
var item = e.getTarget(this.itemSelector, this.el);
17846
if(item && item !== this.lastItem){
17847
this.lastItem = item;
17848
Ext.fly(item).addClass(this.overClass);
17849
this.fireEvent("mouseenter", this, this.indexOf(item), item, e);
17853
onMouseOut : function(e){
17855
if(!e.within(this.lastItem, true)){
17856
Ext.fly(this.lastItem).removeClass(this.overClass);
17857
this.fireEvent("mouseleave", this, this.indexOf(this.lastItem), this.lastItem, e);
17858
delete this.lastItem;
17863
onItemClick : function(item, index, e){
17864
if(this.fireEvent("beforeclick", this, index, item, e) === false){
17867
if(this.multiSelect){
17868
this.doMultiSelection(item, index, e);
17869
e.preventDefault();
17870
}else if(this.singleSelect){
17871
this.doSingleSelection(item, index, e);
17872
e.preventDefault();
17877
doSingleSelection : function(item, index, e){
17878
if(e.ctrlKey && this.isSelected(index)){
17879
this.deselect(index);
17881
this.select(index, false);
17885
doMultiSelection : function(item, index, e){
17886
if(e.shiftKey && this.last !== false){
17887
var last = this.last;
17888
this.selectRange(last, index, e.ctrlKey);
17889
this.last = last; }else{
17890
if((e.ctrlKey||this.simpleSelect) && this.isSelected(index)){
17891
this.deselect(index);
17893
this.select(index, e.ctrlKey || e.shiftKey || this.simpleSelect);
17899
getSelectionCount : function(){
17900
return this.selected.getCount()
17904
getSelectedNodes : function(){
17905
return this.selected.elements;
17909
getSelectedIndexes : function(){
17910
var indexes = [], s = this.selected.elements;
17911
for(var i = 0, len = s.length; i < len; i++){
17912
indexes.push(s[i].viewIndex);
17918
getSelectedRecords : function(){
17919
var r = [], s = this.selected.elements;
17920
for(var i = 0, len = s.length; i < len; i++){
17921
r[r.length] = this.store.getAt(s[i].viewIndex);
17927
getRecords : function(nodes){
17928
var r = [], s = nodes;
17929
for(var i = 0, len = s.length; i < len; i++){
17930
r[r.length] = this.store.getAt(s[i].viewIndex);
17936
getRecord : function(node){
17937
return this.store.getAt(node.viewIndex);
17941
clearSelections : function(suppressEvent, skipUpdate){
17942
if((this.multiSelect || this.singleSelect) && this.selected.getCount() > 0){
17944
this.selected.removeClass(this.selectedClass);
17946
this.selected.clear();
17948
if(!suppressEvent){
17949
this.fireEvent("selectionchange", this, this.selected.elements);
17955
isSelected : function(node){
17956
return this.selected.contains(this.getNode(node));
17960
deselect : function(node){
17961
if(this.isSelected(node)){
17962
node = this.getNode(node);
17963
this.selected.removeElement(node);
17964
if(this.last == node.viewIndex){
17967
Ext.fly(node).removeClass(this.selectedClass);
17968
this.fireEvent("selectionchange", this, this.selected.elements);
17973
select : function(nodeInfo, keepExisting, suppressEvent){
17974
if(Ext.isArray(nodeInfo)){
17976
this.clearSelections(true);
17978
for(var i = 0, len = nodeInfo.length; i < len; i++){
17979
this.select(nodeInfo[i], true, true);
17981
if(!suppressEvent){
17982
this.fireEvent("selectionchange", this, this.selected.elements);
17985
var node = this.getNode(nodeInfo);
17987
this.clearSelections(true);
17989
if(node && !this.isSelected(node)){
17990
if(this.fireEvent("beforeselect", this, node, this.selected.elements) !== false){
17991
Ext.fly(node).addClass(this.selectedClass);
17992
this.selected.add(node);
17993
this.last = node.viewIndex;
17994
if(!suppressEvent){
17995
this.fireEvent("selectionchange", this, this.selected.elements);
18003
selectRange : function(start, end, keepExisting){
18005
this.clearSelections(true);
18007
this.select(this.getNodes(start, end), true);
18011
getNode : function(nodeInfo){
18012
if(typeof nodeInfo == "string"){
18013
return document.getElementById(nodeInfo);
18014
}else if(typeof nodeInfo == "number"){
18015
return this.all.elements[nodeInfo];
18021
getNodes : function(start, end){
18022
var ns = this.all.elements;
18023
start = start || 0;
18024
end = typeof end == "undefined" ? Math.max(ns.length - 1, 0) : end;
18027
for(i = start; i <= end && ns[i]; i++){
18031
for(i = start; i >= end && ns[i]; i--){
18039
indexOf : function(node){
18040
node = this.getNode(node);
18041
if(typeof node.viewIndex == "number"){
18042
return node.viewIndex;
18044
return this.all.indexOf(node);
18047
onBeforeLoad : function(){
18048
if(this.loadingText){
18049
this.clearSelections(false, true);
18050
this.el.update('<div class="loading-indicator">'+this.loadingText+'</div>');
18055
onDestroy : function(){
18056
Ext.DataView.superclass.onDestroy.call(this);
18057
this.setStore(null);
18061
Ext.reg('dataview', Ext.DataView);
18063
Ext.ColorPalette = function(config){
18064
Ext.ColorPalette.superclass.constructor.call(this, config);
18071
this.on("select", this.handler, this.scope, true);
18074
Ext.extend(Ext.ColorPalette, Ext.Component, {
18077
itemCls : "x-color-palette",
18080
clickEvent:'click',
18081
ctype: "Ext.ColorPalette",
18084
allowReselect : false,
18088
"000000", "993300", "333300", "003300", "003366", "000080", "333399", "333333",
18089
"800000", "FF6600", "808000", "008000", "008080", "0000FF", "666699", "808080",
18090
"FF0000", "FF9900", "99CC00", "339966", "33CCCC", "3366FF", "800080", "969696",
18091
"FF00FF", "FFCC00", "FFFF00", "00FF00", "00FFFF", "00CCFF", "993366", "C0C0C0",
18092
"FF99CC", "FFCC99", "FFFF99", "CCFFCC", "CCFFFF", "99CCFF", "CC99FF", "FFFFFF"
18095
onRender : function(container, position){
18096
var t = this.tpl || new Ext.XTemplate(
18097
'<tpl for="."><a href="#" class="color-{.}" hidefocus="on"><em><span style="background:#{.}" unselectable="on"> </span></em></a></tpl>'
18099
var el = document.createElement("div");
18100
el.className = this.itemCls;
18101
t.overwrite(el, this.colors);
18102
container.dom.insertBefore(el, position);
18103
this.el = Ext.get(el);
18104
this.el.on(this.clickEvent, this.handleClick, this, {delegate: "a"});
18105
if(this.clickEvent != 'click'){
18106
this.el.on('click', Ext.emptyFn, this, {delegate: "a", preventDefault:true});
18110
afterRender : function(){
18111
Ext.ColorPalette.superclass.afterRender.call(this);
18113
var s = this.value;
18119
handleClick : function(e, t){
18120
e.preventDefault();
18121
if(!this.disabled){
18122
var c = t.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1];
18123
this.select(c.toUpperCase());
18128
select : function(color){
18129
color = color.replace("#", "");
18130
if(color != this.value || this.allowReselect){
18133
el.child("a.color-"+this.value).removeClass("x-color-palette-sel");
18135
el.child("a.color-"+color).addClass("x-color-palette-sel");
18136
this.value = color;
18137
this.fireEvent("select", this, color);
18143
Ext.reg('colorpalette', Ext.ColorPalette);
18145
Ext.DatePicker = Ext.extend(Ext.Component, {
18147
todayText : "Today",
18149
okText : " OK ",
18151
cancelText : "Cancel",
18153
todayTip : "{0} (Spacebar)",
18155
minText : "This date is before the minimum date",
18157
maxText : "This date is after the maximum date",
18161
disabledDaysText : "Disabled",
18163
disabledDatesText : "Disabled",
18165
constrainToViewport : true,
18167
monthNames : Date.monthNames,
18169
dayNames : Date.dayNames,
18171
nextText: 'Next Month (Control+Right)',
18173
prevText: 'Previous Month (Control+Left)',
18175
monthYearText: 'Choose a month (Control+Up/Down to move years)',
18187
initComponent : function(){
18188
Ext.DatePicker.superclass.initComponent.call(this);
18190
this.value = this.value ?
18191
this.value.clearTime() : new Date().clearTime();
18199
this.on("select", this.handler, this.scope || this);
18202
this.initDisabledDays();
18206
initDisabledDays : function(){
18207
if(!this.disabledDatesRE && this.disabledDates){
18208
var dd = this.disabledDates;
18210
for(var i = 0; i < dd.length; i++){
18212
if(i != dd.length-1) re += "|";
18214
this.disabledDatesRE = new RegExp(re + ")");
18219
setDisabledDates : function(dd){
18220
if(Ext.isArray(dd)){
18221
this.disabledDates = dd;
18222
this.disabledDatesRE = null;
18224
this.disabledDatesRE = dd;
18226
this.initDisabledDays();
18227
this.update(this.value, true);
18231
setDisabledDays : function(dd){
18232
this.disabledDays = dd;
18233
this.update(this.value, true);
18237
setMinDate : function(dt){
18239
this.update(this.value, true);
18243
setMaxDate : function(dt){
18245
this.update(this.value, true);
18249
setValue : function(value){
18250
var old = this.value;
18251
this.value = value.clearTime(true);
18253
this.update(this.value);
18258
getValue : function(){
18263
focus : function(){
18265
this.update(this.activeDate);
18270
onRender : function(container, position){
18272
'<table cellspacing="0">',
18273
'<tr><td class="x-date-left"><a href="#" title="', this.prevText ,'"> </a></td><td class="x-date-middle" align="center"></td><td class="x-date-right"><a href="#" title="', this.nextText ,'"> </a></td></tr>',
18274
'<tr><td colspan="3"><table class="x-date-inner" cellspacing="0"><thead><tr>'];
18275
var dn = this.dayNames;
18276
for(var i = 0; i < 7; i++){
18277
var d = this.startDay+i;
18281
m.push("<th><span>", dn[d].substr(0,1), "</span></th>");
18283
m[m.length] = "</tr></thead><tbody><tr>";
18284
for(var i = 0; i < 42; i++) {
18285
if(i % 7 == 0 && i != 0){
18286
m[m.length] = "</tr><tr>";
18288
m[m.length] = '<td><a href="#" hidefocus="on" class="x-date-date" tabIndex="1"><em><span></span></em></a></td>';
18290
m.push('</tr></tbody></table></td></tr>',
18291
this.showToday ? '<tr><td colspan="3" class="x-date-bottom" align="center"></td></tr>' : '',
18292
'</table><div class="x-date-mp"></div>');
18294
var el = document.createElement("div");
18295
el.className = "x-date-picker";
18296
el.innerHTML = m.join("");
18298
container.dom.insertBefore(el, position);
18300
this.el = Ext.get(el);
18301
this.eventEl = Ext.get(el.firstChild);
18303
new Ext.util.ClickRepeater(this.el.child("td.x-date-left a"), {
18304
handler: this.showPrevMonth,
18306
preventDefault:true,
18310
new Ext.util.ClickRepeater(this.el.child("td.x-date-right a"), {
18311
handler: this.showNextMonth,
18313
preventDefault:true,
18317
this.eventEl.on("mousewheel", this.handleMouseWheel, this);
18319
this.monthPicker = this.el.down('div.x-date-mp');
18320
this.monthPicker.enableDisplayMode('block');
18322
var kn = new Ext.KeyNav(this.eventEl, {
18323
"left" : function(e){
18325
this.showPrevMonth() :
18326
this.update(this.activeDate.add("d", -1));
18329
"right" : function(e){
18331
this.showNextMonth() :
18332
this.update(this.activeDate.add("d", 1));
18335
"up" : function(e){
18337
this.showNextYear() :
18338
this.update(this.activeDate.add("d", -7));
18341
"down" : function(e){
18343
this.showPrevYear() :
18344
this.update(this.activeDate.add("d", 7));
18347
"pageUp" : function(e){
18348
this.showNextMonth();
18351
"pageDown" : function(e){
18352
this.showPrevMonth();
18355
"enter" : function(e){
18356
e.stopPropagation();
18363
this.eventEl.on("click", this.handleDateClick, this, {delegate: "a.x-date-date"});
18365
this.el.unselectable();
18367
this.cells = this.el.select("table.x-date-inner tbody td");
18368
this.textNodes = this.el.query("table.x-date-inner tbody span");
18370
this.mbtn = new Ext.Button({
18372
tooltip: this.monthYearText,
18373
renderTo: this.el.child("td.x-date-middle", true)
18376
this.mbtn.on('click', this.showMonthPicker, this);
18377
this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu");
18379
if(this.showToday){
18380
this.todayKeyListener = this.eventEl.addKeyListener(Ext.EventObject.SPACE, this.selectToday, this);
18381
var today = (new Date()).dateFormat(this.format);
18382
this.todayBtn = new Ext.Button({
18383
renderTo: this.el.child("td.x-date-bottom", true),
18384
text: String.format(this.todayText, today),
18385
tooltip: String.format(this.todayTip, today),
18386
handler: this.selectToday,
18394
this.update(this.value);
18398
createMonthPicker : function(){
18399
if(!this.monthPicker.dom.firstChild){
18400
var buf = ['<table border="0" cellspacing="0">'];
18401
for(var i = 0; i < 6; i++){
18403
'<tr><td class="x-date-mp-month"><a href="#">', this.monthNames[i].substr(0, 3), '</a></td>',
18404
'<td class="x-date-mp-month x-date-mp-sep"><a href="#">', this.monthNames[i+6].substr(0, 3), '</a></td>',
18406
'<td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-prev"></a></td><td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-next"></a></td></tr>' :
18407
'<td class="x-date-mp-year"><a href="#"></a></td><td class="x-date-mp-year"><a href="#"></a></td></tr>'
18411
'<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">',
18413
'</button><button type="button" class="x-date-mp-cancel">',
18415
'</button></td></tr>',
18418
this.monthPicker.update(buf.join(''));
18419
this.monthPicker.on('click', this.onMonthClick, this);
18420
this.monthPicker.on('dblclick', this.onMonthDblClick, this);
18422
this.mpMonths = this.monthPicker.select('td.x-date-mp-month');
18423
this.mpYears = this.monthPicker.select('td.x-date-mp-year');
18425
this.mpMonths.each(function(m, a, i){
18428
m.dom.xmonth = 5 + Math.round(i * .5);
18430
m.dom.xmonth = Math.round((i-1) * .5);
18437
showMonthPicker : function(){
18438
this.createMonthPicker();
18439
var size = this.el.getSize();
18440
this.monthPicker.setSize(size);
18441
this.monthPicker.child('table').setSize(size);
18443
this.mpSelMonth = (this.activeDate || this.value).getMonth();
18444
this.updateMPMonth(this.mpSelMonth);
18445
this.mpSelYear = (this.activeDate || this.value).getFullYear();
18446
this.updateMPYear(this.mpSelYear);
18448
this.monthPicker.slideIn('t', {duration:.2});
18452
updateMPYear : function(y){
18454
var ys = this.mpYears.elements;
18455
for(var i = 1; i <= 10; i++){
18456
var td = ys[i-1], y2;
18458
y2 = y + Math.round(i * .5);
18459
td.firstChild.innerHTML = y2;
18462
y2 = y - (5-Math.round(i * .5));
18463
td.firstChild.innerHTML = y2;
18466
this.mpYears.item(i-1)[y2 == this.mpSelYear ? 'addClass' : 'removeClass']('x-date-mp-sel');
18471
updateMPMonth : function(sm){
18472
this.mpMonths.each(function(m, a, i){
18473
m[m.dom.xmonth == sm ? 'addClass' : 'removeClass']('x-date-mp-sel');
18478
selectMPMonth: function(m){
18483
onMonthClick : function(e, t){
18485
var el = new Ext.Element(t), pn;
18486
if(el.is('button.x-date-mp-cancel')){
18487
this.hideMonthPicker();
18489
else if(el.is('button.x-date-mp-ok')){
18490
var d = new Date(this.mpSelYear, this.mpSelMonth, (this.activeDate || this.value).getDate());
18491
if(d.getMonth() != this.mpSelMonth){
18493
d = new Date(this.mpSelYear, this.mpSelMonth, 1).getLastDateOfMonth();
18496
this.hideMonthPicker();
18498
else if(pn = el.up('td.x-date-mp-month', 2)){
18499
this.mpMonths.removeClass('x-date-mp-sel');
18500
pn.addClass('x-date-mp-sel');
18501
this.mpSelMonth = pn.dom.xmonth;
18503
else if(pn = el.up('td.x-date-mp-year', 2)){
18504
this.mpYears.removeClass('x-date-mp-sel');
18505
pn.addClass('x-date-mp-sel');
18506
this.mpSelYear = pn.dom.xyear;
18508
else if(el.is('a.x-date-mp-prev')){
18509
this.updateMPYear(this.mpyear-10);
18511
else if(el.is('a.x-date-mp-next')){
18512
this.updateMPYear(this.mpyear+10);
18517
onMonthDblClick : function(e, t){
18519
var el = new Ext.Element(t), pn;
18520
if(pn = el.up('td.x-date-mp-month', 2)){
18521
this.update(new Date(this.mpSelYear, pn.dom.xmonth, (this.activeDate || this.value).getDate()));
18522
this.hideMonthPicker();
18524
else if(pn = el.up('td.x-date-mp-year', 2)){
18525
this.update(new Date(pn.dom.xyear, this.mpSelMonth, (this.activeDate || this.value).getDate()));
18526
this.hideMonthPicker();
18531
hideMonthPicker : function(disableAnim){
18532
if(this.monthPicker){
18533
if(disableAnim === true){
18534
this.monthPicker.hide();
18536
this.monthPicker.slideOut('t', {duration:.2});
18542
showPrevMonth : function(e){
18543
this.update(this.activeDate.add("mo", -1));
18547
showNextMonth : function(e){
18548
this.update(this.activeDate.add("mo", 1));
18552
showPrevYear : function(){
18553
this.update(this.activeDate.add("y", -1));
18557
showNextYear : function(){
18558
this.update(this.activeDate.add("y", 1));
18562
handleMouseWheel : function(e){
18563
var delta = e.getWheelDelta();
18565
this.showPrevMonth();
18567
} else if(delta < 0){
18568
this.showNextMonth();
18574
handleDateClick : function(e, t){
18576
if(t.dateValue && !Ext.fly(t.parentNode).hasClass("x-date-disabled")){
18577
this.setValue(new Date(t.dateValue));
18578
this.fireEvent("select", this, this.value);
18583
selectToday : function(){
18584
if(this.todayBtn && !this.todayBtn.disabled){
18585
this.setValue(new Date().clearTime());
18586
this.fireEvent("select", this, this.value);
18591
update : function(date, forceRefresh){
18592
var vd = this.activeDate;
18593
this.activeDate = date;
18594
if(!forceRefresh && vd && this.el){
18595
var t = date.getTime();
18596
if(vd.getMonth() == date.getMonth() && vd.getFullYear() == date.getFullYear()){
18597
this.cells.removeClass("x-date-selected");
18598
this.cells.each(function(c){
18599
if(c.dom.firstChild.dateValue == t){
18600
c.addClass("x-date-selected");
18601
setTimeout(function(){
18602
try{c.dom.firstChild.focus();}catch(e){}
18610
var days = date.getDaysInMonth();
18611
var firstOfMonth = date.getFirstDateOfMonth();
18612
var startingPos = firstOfMonth.getDay()-this.startDay;
18614
if(startingPos <= this.startDay){
18618
var pm = date.add("mo", -1);
18619
var prevStart = pm.getDaysInMonth()-startingPos;
18621
var cells = this.cells.elements;
18622
var textEls = this.textNodes;
18623
days += startingPos;
18626
var day = 86400000;
18627
var d = (new Date(pm.getFullYear(), pm.getMonth(), prevStart)).clearTime();
18628
var today = new Date().clearTime().getTime();
18629
var sel = date.clearTime().getTime();
18630
var min = this.minDate ? this.minDate.clearTime() : Number.NEGATIVE_INFINITY;
18631
var max = this.maxDate ? this.maxDate.clearTime() : Number.POSITIVE_INFINITY;
18632
var ddMatch = this.disabledDatesRE;
18633
var ddText = this.disabledDatesText;
18634
var ddays = this.disabledDays ? this.disabledDays.join("") : false;
18635
var ddaysText = this.disabledDaysText;
18636
var format = this.format;
18638
if(this.showToday){
18639
var td = new Date().clearTime();
18640
var disable = (td < min || td > max ||
18641
(ddMatch && format && ddMatch.test(td.dateFormat(format))) ||
18642
(ddays && ddays.indexOf(td.getDay()) != -1));
18644
this.todayBtn.setDisabled(disable);
18645
this.todayKeyListener[disable ? 'disable' : 'enable']();
18648
var setCellClass = function(cal, cell){
18650
var t = d.getTime();
18651
cell.firstChild.dateValue = t;
18653
cell.className += " x-date-today";
18654
cell.title = cal.todayText;
18657
cell.className += " x-date-selected";
18658
setTimeout(function(){
18659
try{cell.firstChild.focus();}catch(e){}
18664
cell.className = " x-date-disabled";
18665
cell.title = cal.minText;
18669
cell.className = " x-date-disabled";
18670
cell.title = cal.maxText;
18674
if(ddays.indexOf(d.getDay()) != -1){
18675
cell.title = ddaysText;
18676
cell.className = " x-date-disabled";
18679
if(ddMatch && format){
18680
var fvalue = d.dateFormat(format);
18681
if(ddMatch.test(fvalue)){
18682
cell.title = ddText.replace("%0", fvalue);
18683
cell.className = " x-date-disabled";
18689
for(; i < startingPos; i++) {
18690
textEls[i].innerHTML = (++prevStart);
18691
d.setDate(d.getDate()+1);
18692
cells[i].className = "x-date-prevday";
18693
setCellClass(this, cells[i]);
18695
for(; i < days; i++){
18696
intDay = i - startingPos + 1;
18697
textEls[i].innerHTML = (intDay);
18698
d.setDate(d.getDate()+1);
18699
cells[i].className = "x-date-active";
18700
setCellClass(this, cells[i]);
18703
for(; i < 42; i++) {
18704
textEls[i].innerHTML = (++extraDays);
18705
d.setDate(d.getDate()+1);
18706
cells[i].className = "x-date-nextday";
18707
setCellClass(this, cells[i]);
18710
this.mbtn.setText(this.monthNames[date.getMonth()] + " " + date.getFullYear());
18712
if(!this.internalRender){
18713
var main = this.el.dom.firstChild;
18714
var w = main.offsetWidth;
18715
this.el.setWidth(w + this.el.getBorderWidth("lr"));
18716
Ext.fly(main).setWidth(w);
18717
this.internalRender = true;
18721
if(Ext.isOpera && !this.secondPass){
18722
main.rows[0].cells[1].style.width = (w - (main.rows[0].cells[0].offsetWidth+main.rows[0].cells[2].offsetWidth)) + "px";
18723
this.secondPass = true;
18724
this.update.defer(10, this, [date]);
18730
beforeDestroy : function() {
18732
Ext.destroy(this.mbtn, this.todayBtn);
18738
Ext.reg('datepicker', Ext.DatePicker);
18740
Ext.TabPanel = Ext.extend(Ext.Panel, {
18743
monitorResize : true,
18745
deferredRender : true,
18753
enableTabScroll: false,
18755
scrollIncrement : 0,
18757
scrollRepeatInterval : 400,
18759
scrollDuration : .35,
18763
tabPosition: 'top',
18765
baseCls: 'x-tab-panel',
18769
autoTabSelector:'div.x-tab',
18777
wheelIncrement : 20,
18780
idDelimiter : '__',
18782
itemCls : 'x-tab-item',
18785
headerAsText: false,
18789
initComponent : function(){
18790
this.frame = false;
18791
Ext.TabPanel.superclass.initComponent.call(this);
18800
this.setLayout(new Ext.layout.CardLayout({
18801
deferredRender: this.deferredRender
18803
if(this.tabPosition == 'top'){
18804
this.elements += ',header';
18805
this.stripTarget = 'header';
18807
this.elements += ',footer';
18808
this.stripTarget = 'footer';
18811
this.stack = Ext.TabPanel.AccessStack();
18816
render : function(){
18817
Ext.TabPanel.superclass.render.apply(this, arguments);
18818
if(this.activeTab !== undefined){
18819
var item = this.activeTab;
18820
delete this.activeTab;
18821
this.setActiveTab(item);
18825
onRender : function(ct, position){
18826
Ext.TabPanel.superclass.onRender.call(this, ct, position);
18829
var pos = this.tabPosition == 'top' ? 'header' : 'footer';
18830
this[pos].addClass('x-tab-panel-'+pos+'-plain');
18833
var st = this[this.stripTarget];
18835
this.stripWrap = st.createChild({cls:'x-tab-strip-wrap', cn:{
18836
tag:'ul', cls:'x-tab-strip x-tab-strip-'+this.tabPosition}});
18838
var beforeEl = (this.tabPosition=='bottom' ? this.stripWrap : null);
18839
this.stripSpacer = st.createChild({cls:'x-tab-strip-spacer'}, beforeEl);
18840
this.strip = new Ext.Element(this.stripWrap.dom.firstChild);
18842
this.edge = this.strip.createChild({tag:'li', cls:'x-tab-edge'});
18843
this.strip.createChild({cls:'x-clear'});
18845
this.body.addClass('x-tab-panel-body-'+this.tabPosition);
18848
var tt = new Ext.Template(
18849
'<li class="{cls}" id="{id}"><a class="x-tab-strip-close" onclick="return false;"></a>',
18850
'<a class="x-tab-right" href="#" onclick="return false;"><em class="x-tab-left">',
18851
'<span class="x-tab-strip-inner"><span class="x-tab-strip-text {iconCls}">{text}</span></span>',
18854
tt.disableFormats = true;
18856
Ext.TabPanel.prototype.itemTpl = tt;
18859
this.items.each(this.initTab, this);
18862
afterRender : function(){
18863
Ext.TabPanel.superclass.afterRender.call(this);
18865
this.readTabs(false);
18869
initEvents : function(){
18870
Ext.TabPanel.superclass.initEvents.call(this);
18871
this.on('add', this.onAdd, this);
18872
this.on('remove', this.onRemove, this);
18874
this.strip.on('mousedown', this.onStripMouseDown, this);
18875
this.strip.on('contextmenu', this.onStripContextMenu, this);
18876
if(this.enableTabScroll){
18877
this.strip.on('mousewheel', this.onWheel, this);
18881
findTargets : function(e){
18883
var itemEl = e.getTarget('li', this.strip);
18885
item = this.getComponent(itemEl.id.split(this.idDelimiter)[1]);
18895
close : e.getTarget('.x-tab-strip-close', this.strip),
18901
onStripMouseDown : function(e){
18905
e.preventDefault();
18906
var t = this.findTargets(e);
18908
this.remove(t.item);
18911
if(t.item && t.item != this.activeTab){
18912
this.setActiveTab(t.item);
18916
onStripContextMenu : function(e){
18917
e.preventDefault();
18918
var t = this.findTargets(e);
18920
this.fireEvent('contextmenu', this, t.item, e);
18925
readTabs : function(removeExisting){
18926
if(removeExisting === true){
18927
this.items.each(function(item){
18931
var tabs = this.el.query(this.autoTabSelector);
18932
for(var i = 0, len = tabs.length; i < len; i++){
18934
var title = tab.getAttribute('title');
18935
tab.removeAttribute('title');
18943
initTab : function(item, index){
18944
var before = this.strip.dom.childNodes[index];
18945
var cls = item.closable ? 'x-tab-strip-closable' : '';
18947
cls += ' x-item-disabled';
18950
cls += ' x-tab-with-icon';
18953
cls += ' ' + item.tabCls;
18957
id: this.id + this.idDelimiter + item.getItemId(),
18960
iconCls: item.iconCls || ''
18963
this.itemTpl.insertBefore(before, p) :
18964
this.itemTpl.append(this.strip, p);
18966
Ext.fly(el).addClassOnOver('x-tab-strip-over');
18969
Ext.fly(el).child('span.x-tab-strip-text', true).qtip = item.tabTip;
18971
item.on('disable', this.onItemDisabled, this);
18972
item.on('enable', this.onItemEnabled, this);
18973
item.on('titlechange', this.onItemTitleChanged, this);
18974
item.on('beforeshow', this.onBeforeShowItem, this);
18977
onAdd : function(tp, item, index){
18978
this.initTab(item, index);
18979
if(this.items.getCount() == 1){
18982
this.delegateUpdates();
18985
onBeforeAdd : function(item){
18986
var existing = item.events ? (this.items.containsKey(item.getItemId()) ? item : null) : this.items.get(item);
18988
this.setActiveTab(item);
18991
Ext.TabPanel.superclass.onBeforeAdd.apply(this, arguments);
18992
var es = item.elements;
18993
item.elements = es ? es.replace(',header', '') : es;
18994
item.border = (item.border === true);
18997
onRemove : function(tp, item){
18998
Ext.removeNode(this.getTabEl(item));
18999
this.stack.remove(item);
19000
item.un('disable', this.onItemDisabled, this);
19001
item.un('enable', this.onItemEnabled, this);
19002
item.un('titlechange', this.onItemTitleChanged, this);
19003
item.un('beforeshow', this.onBeforeShowItem, this);
19004
if(item == this.activeTab){
19005
var next = this.stack.next();
19007
this.setActiveTab(next);
19009
this.setActiveTab(0);
19012
this.delegateUpdates();
19015
onBeforeShowItem : function(item){
19016
if(item != this.activeTab){
19017
this.setActiveTab(item);
19022
onItemDisabled : function(item){
19023
var el = this.getTabEl(item);
19025
Ext.fly(el).addClass('x-item-disabled');
19027
this.stack.remove(item);
19030
onItemEnabled : function(item){
19031
var el = this.getTabEl(item);
19033
Ext.fly(el).removeClass('x-item-disabled');
19037
onItemTitleChanged : function(item){
19038
var el = this.getTabEl(item);
19040
Ext.fly(el).child('span.x-tab-strip-text', true).innerHTML = item.title;
19045
getTabEl : function(item){
19046
var itemId = (typeof item === 'number')?this.items.items[item].getItemId() : item.getItemId();
19047
return document.getElementById(this.id+this.idDelimiter+itemId);
19050
onResize : function(){
19051
Ext.TabPanel.superclass.onResize.apply(this, arguments);
19052
this.delegateUpdates();
19056
beginUpdate : function(){
19057
this.suspendUpdates = true;
19061
endUpdate : function(){
19062
this.suspendUpdates = false;
19063
this.delegateUpdates();
19067
hideTabStripItem : function(item){
19068
item = this.getComponent(item);
19069
var el = this.getTabEl(item);
19071
el.style.display = 'none';
19072
this.delegateUpdates();
19074
this.stack.remove(item);
19078
unhideTabStripItem : function(item){
19079
item = this.getComponent(item);
19080
var el = this.getTabEl(item);
19082
el.style.display = '';
19083
this.delegateUpdates();
19087
delegateUpdates : function(){
19088
if(this.suspendUpdates){
19091
if(this.resizeTabs && this.rendered){
19092
this.autoSizeTabs();
19094
if(this.enableTabScroll && this.rendered){
19095
this.autoScrollTabs();
19099
autoSizeTabs : function(){
19100
var count = this.items.length;
19101
var ce = this.tabPosition != 'bottom' ? 'header' : 'footer';
19102
var ow = this[ce].dom.offsetWidth;
19103
var aw = this[ce].dom.clientWidth;
19105
if(!this.resizeTabs || count < 1 || !aw){ return;
19108
var each = Math.max(Math.min(Math.floor((aw-4) / count) - this.tabMargin, this.tabWidth), this.minTabWidth); this.lastTabWidth = each;
19109
var lis = this.stripWrap.dom.getElementsByTagName('li');
19110
for(var i = 0, len = lis.length-1; i < len; i++) { var li = lis[i];
19111
var inner = li.childNodes[1].firstChild.firstChild;
19112
var tw = li.offsetWidth;
19113
var iw = inner.offsetWidth;
19114
inner.style.width = (each - (tw-iw)) + 'px';
19118
adjustBodyWidth : function(w){
19120
this.header.setWidth(w);
19123
this.footer.setWidth(w);
19129
setActiveTab : function(item){
19130
item = this.getComponent(item);
19131
if(!item || this.fireEvent('beforetabchange', this, item, this.activeTab) === false){
19134
if(!this.rendered){
19135
this.activeTab = item;
19138
if(this.activeTab != item){
19139
if(this.activeTab){
19140
var oldEl = this.getTabEl(this.activeTab);
19142
Ext.fly(oldEl).removeClass('x-tab-strip-active');
19144
this.activeTab.fireEvent('deactivate', this.activeTab);
19146
var el = this.getTabEl(item);
19147
Ext.fly(el).addClass('x-tab-strip-active');
19148
this.activeTab = item;
19149
this.stack.add(item);
19151
this.layout.setActiveItem(item);
19152
if(this.layoutOnTabChange && item.doLayout){
19155
if(this.scrolling){
19156
this.scrollToTab(item, this.animScroll);
19159
item.fireEvent('activate', item);
19160
this.fireEvent('tabchange', this, item);
19165
getActiveTab : function(){
19166
return this.activeTab || null;
19170
getItem : function(item){
19171
return this.getComponent(item);
19174
autoScrollTabs : function(){
19175
var count = this.items.length;
19176
var ow = this.header.dom.offsetWidth;
19177
var tw = this.header.dom.clientWidth;
19179
var wrap = this.stripWrap;
19181
var cw = wd.offsetWidth;
19182
var pos = this.getScrollPos();
19183
var l = this.edge.getOffsetsTo(this.stripWrap)[0] + pos;
19185
if(!this.enableTabScroll || count < 1 || cw < 20){ return;
19190
if(this.scrolling){
19191
this.scrolling = false;
19192
this.header.removeClass('x-tab-scrolling');
19193
this.scrollLeft.hide();
19194
this.scrollRight.hide();
19196
wd.style.marginLeft = '';
19197
wd.style.marginRight = '';
19201
if(!this.scrolling){
19202
this.header.addClass('x-tab-scrolling');
19204
wd.style.marginLeft = '18px';
19205
wd.style.marginRight = '18px';
19208
tw -= wrap.getMargins('lr');
19209
wrap.setWidth(tw > 20 ? tw : 20);
19210
if(!this.scrolling){
19211
if(!this.scrollLeft){
19212
this.createScrollers();
19214
this.scrollLeft.show();
19215
this.scrollRight.show();
19218
this.scrolling = true;
19219
if(pos > (l-tw)){ wd.scrollLeft = l-tw;
19220
}else{ this.scrollToTab(this.activeTab, false);
19222
this.updateScrollButtons();
19226
createScrollers : function(){
19227
var h = this.stripWrap.dom.offsetHeight;
19229
var sl = this.header.insertFirst({
19230
cls:'x-tab-scroller-left'
19233
sl.addClassOnOver('x-tab-scroller-left-over');
19234
this.leftRepeater = new Ext.util.ClickRepeater(sl, {
19235
interval : this.scrollRepeatInterval,
19236
handler: this.onScrollLeft,
19239
this.scrollLeft = sl;
19241
var sr = this.header.insertFirst({
19242
cls:'x-tab-scroller-right'
19245
sr.addClassOnOver('x-tab-scroller-right-over');
19246
this.rightRepeater = new Ext.util.ClickRepeater(sr, {
19247
interval : this.scrollRepeatInterval,
19248
handler: this.onScrollRight,
19251
this.scrollRight = sr;
19254
getScrollWidth : function(){
19255
return this.edge.getOffsetsTo(this.stripWrap)[0] + this.getScrollPos();
19258
getScrollPos : function(){
19259
return parseInt(this.stripWrap.dom.scrollLeft, 10) || 0;
19262
getScrollArea : function(){
19263
return parseInt(this.stripWrap.dom.clientWidth, 10) || 0;
19266
getScrollAnim : function(){
19267
return {duration:this.scrollDuration, callback: this.updateScrollButtons, scope: this};
19270
getScrollIncrement : function(){
19271
return this.scrollIncrement || (this.resizeTabs ? this.lastTabWidth+2 : 100);
19276
scrollToTab : function(item, animate){
19277
if(!item){ return; }
19278
var el = this.getTabEl(item);
19279
var pos = this.getScrollPos(), area = this.getScrollArea();
19280
var left = Ext.fly(el).getOffsetsTo(this.stripWrap)[0] + pos;
19281
var right = left + el.offsetWidth;
19283
this.scrollTo(left, animate);
19284
}else if(right > (pos + area)){
19285
this.scrollTo(right - area, animate);
19289
scrollTo : function(pos, animate){
19290
this.stripWrap.scrollTo('left', pos, animate ? this.getScrollAnim() : false);
19292
this.updateScrollButtons();
19296
onWheel : function(e){
19297
var d = e.getWheelDelta()*this.wheelIncrement*-1;
19300
var pos = this.getScrollPos();
19301
var newpos = pos + d;
19302
var sw = this.getScrollWidth()-this.getScrollArea();
19304
var s = Math.max(0, Math.min(sw, newpos));
19306
this.scrollTo(s, false);
19310
onScrollRight : function(){
19311
var sw = this.getScrollWidth()-this.getScrollArea();
19312
var pos = this.getScrollPos();
19313
var s = Math.min(sw, pos + this.getScrollIncrement());
19315
this.scrollTo(s, this.animScroll);
19319
onScrollLeft : function(){
19320
var pos = this.getScrollPos();
19321
var s = Math.max(0, pos - this.getScrollIncrement());
19323
this.scrollTo(s, this.animScroll);
19327
updateScrollButtons : function(){
19328
var pos = this.getScrollPos();
19329
this.scrollLeft[pos == 0 ? 'addClass' : 'removeClass']('x-tab-scroller-left-disabled');
19330
this.scrollRight[pos >= (this.getScrollWidth()-this.getScrollArea()) ? 'addClass' : 'removeClass']('x-tab-scroller-right-disabled');
19346
Ext.reg('tabpanel', Ext.TabPanel);
19349
Ext.TabPanel.prototype.activate = Ext.TabPanel.prototype.setActiveTab;
19351
Ext.TabPanel.AccessStack = function(){
19354
add : function(item){
19356
if(items.length > 10){
19361
remove : function(item){
19363
for(var i = 0, len = items.length; i < len; i++) {
19364
if(items[i] != item){
19372
return items.pop();
19380
Ext.Button = Ext.extend(Ext.Component, {
19394
enableToggle: false,
19398
menuAlign : "tl-bl?",
19404
menuClassTarget: 'tr',
19407
clickEvent : 'click',
19410
handleMouseEvents : true,
19413
tooltipType : 'qtip',
19415
buttonSelector : "button:first",
19420
initComponent : function(){
19421
Ext.Button.superclass.initComponent.call(this);
19442
this.menu = Ext.menu.MenuMgr.get(this.menu);
19444
if(typeof this.toggleGroup === 'string'){
19445
this.enableToggle = true;
19449
onRender : function(ct, position){
19450
if(!this.template){
19451
if(!Ext.Button.buttonTemplate){
19452
Ext.Button.buttonTemplate = new Ext.Template(
19453
'<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>',
19454
'<td class="x-btn-left"><i> </i></td><td class="x-btn-center"><em unselectable="on"><button class="x-btn-text" type="{1}">{0}</button></em></td><td class="x-btn-right"><i> </i></td>',
19455
"</tr></tbody></table>");
19457
this.template = Ext.Button.buttonTemplate;
19459
var btn, targs = [this.text || ' ', this.type];
19462
btn = this.template.insertBefore(position, targs, true);
19464
btn = this.template.append(ct, targs, true);
19466
var btnEl = btn.child(this.buttonSelector);
19467
btnEl.on('focus', this.onFocus, this);
19468
btnEl.on('blur', this.onBlur, this);
19470
this.initButtonEl(btn, btnEl);
19473
this.el.child(this.menuClassTarget).addClass("x-btn-with-menu");
19475
Ext.ButtonToggleMgr.register(this);
19478
initButtonEl : function(btn, btnEl){
19481
btn.addClass("x-btn");
19484
btnEl.setStyle('background-image', 'url(' +this.icon +')');
19487
btnEl.addClass(this.iconCls);
19489
btn.addClass(this.text ? 'x-btn-text-icon' : 'x-btn-icon');
19492
if(this.tabIndex !== undefined){
19493
btnEl.dom.tabIndex = this.tabIndex;
19496
if(typeof this.tooltip == 'object'){
19497
Ext.QuickTips.register(Ext.apply({
19501
btnEl.dom[this.tooltipType] = this.tooltip;
19506
this.el.addClass("x-btn-pressed");
19509
if(this.handleMouseEvents){
19510
btn.on("mouseover", this.onMouseOver, this);
19511
btn.on("mousedown", this.onMouseDown, this);
19515
this.menu.on("show", this.onMenuShow, this);
19516
this.menu.on("hide", this.onMenuHide, this);
19520
this.el.dom.id = this.el.id = this.id;
19524
var repeater = new Ext.util.ClickRepeater(btn,
19525
typeof this.repeat == "object" ? this.repeat : {}
19527
repeater.on("click", this.onClick, this);
19530
btn.on(this.clickEvent, this.onClick, this);
19533
afterRender : function(){
19534
Ext.Button.superclass.afterRender.call(this);
19536
this.autoWidth.defer(1, this);
19543
setIconClass : function(cls){
19545
this.el.child(this.buttonSelector).replaceClass(this.iconCls, cls);
19547
this.iconCls = cls;
19550
beforeDestroy: function(){
19552
var btn = this.el.child(this.buttonSelector);
19554
btn.removeAllListeners();
19558
Ext.destroy(this.menu);
19562
onDestroy : function(){
19564
Ext.ButtonToggleMgr.unregister(this);
19568
autoWidth : function(){
19570
this.el.setWidth("auto");
19571
if(Ext.isIE7 && Ext.isStrict){
19572
var ib = this.el.child(this.buttonSelector);
19573
if(ib && ib.getWidth() > 20){
19575
ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr'));
19579
if(this.el.getWidth() < this.minWidth){
19580
this.el.setWidth(this.minWidth);
19587
setHandler : function(handler, scope){
19588
this.handler = handler;
19589
this.scope = scope;
19593
setText : function(text){
19596
this.el.child("td.x-btn-center " + this.buttonSelector).update(text);
19602
getText : function(){
19607
toggle : function(state){
19608
state = state === undefined ? !this.pressed : state;
19609
if(state != this.pressed){
19611
this.el.addClass("x-btn-pressed");
19612
this.pressed = true;
19613
this.fireEvent("toggle", this, true);
19615
this.el.removeClass("x-btn-pressed");
19616
this.pressed = false;
19617
this.fireEvent("toggle", this, false);
19619
if(this.toggleHandler){
19620
this.toggleHandler.call(this.scope || this, this, state);
19626
focus : function(){
19627
this.el.child(this.buttonSelector).focus();
19630
onDisable : function(){
19632
if(!Ext.isIE6 || !this.text){
19633
this.el.addClass(this.disabledClass);
19635
this.el.dom.disabled = true;
19637
this.disabled = true;
19640
onEnable : function(){
19642
if(!Ext.isIE6 || !this.text){
19643
this.el.removeClass(this.disabledClass);
19645
this.el.dom.disabled = false;
19647
this.disabled = false;
19651
showMenu : function(){
19653
this.menu.show(this.el, this.menuAlign);
19659
hideMenu : function(){
19667
hasVisibleMenu : function(){
19668
return this.menu && this.menu.isVisible();
19671
onClick : function(e){
19673
e.preventDefault();
19678
if(!this.disabled){
19679
if(this.enableToggle && (this.allowDepress !== false || !this.pressed)){
19682
if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){
19685
this.fireEvent("click", this, e);
19687
this.handler.call(this.scope || this, this, e);
19692
isMenuTriggerOver : function(e, internal){
19693
return this.menu && !internal;
19696
isMenuTriggerOut : function(e, internal){
19697
return this.menu && !internal;
19700
onMouseOver : function(e){
19701
if(!this.disabled){
19702
var internal = e.within(this.el, true);
19704
this.el.addClass("x-btn-over");
19705
if(!this.monitoringMouseOver){
19706
Ext.getDoc().on('mouseover', this.monitorMouseOver, this);
19707
this.monitoringMouseOver = true;
19709
this.fireEvent('mouseover', this, e);
19711
if(this.isMenuTriggerOver(e, internal)){
19712
this.fireEvent('menutriggerover', this, this.menu, e);
19717
monitorMouseOver : function(e){
19718
if(e.target != this.el.dom && !e.within(this.el)){
19719
if(this.monitoringMouseOver){
19720
Ext.getDoc().un('mouseover', this.monitorMouseOver, this);
19721
this.monitoringMouseOver = false;
19723
this.onMouseOut(e);
19727
onMouseOut : function(e){
19728
var internal = e.within(this.el) && e.target != this.el.dom;
19729
this.el.removeClass("x-btn-over");
19730
this.fireEvent('mouseout', this, e);
19731
if(this.isMenuTriggerOut(e, internal)){
19732
this.fireEvent('menutriggerout', this, this.menu, e);
19735
onFocus : function(e){
19736
if(!this.disabled){
19737
this.el.addClass("x-btn-focus");
19740
onBlur : function(e){
19741
this.el.removeClass("x-btn-focus");
19744
getClickEl : function(e, isUp){
19748
onMouseDown : function(e){
19749
if(!this.disabled && e.button == 0){
19750
this.getClickEl(e).addClass("x-btn-click");
19751
Ext.getDoc().on('mouseup', this.onMouseUp, this);
19754
onMouseUp : function(e){
19756
this.getClickEl(e, true).removeClass("x-btn-click");
19757
Ext.getDoc().un('mouseup', this.onMouseUp, this);
19760
onMenuShow : function(e){
19761
this.ignoreNextClick = 0;
19762
this.el.addClass("x-btn-menu-active");
19763
this.fireEvent('menushow', this, this.menu);
19765
onMenuHide : function(e){
19766
this.el.removeClass("x-btn-menu-active");
19767
this.ignoreNextClick = this.restoreClick.defer(250, this);
19768
this.fireEvent('menuhide', this, this.menu);
19771
restoreClick : function(){
19772
this.ignoreNextClick = 0;
19779
Ext.reg('button', Ext.Button);
19781
Ext.ButtonToggleMgr = function(){
19784
function toggleGroup(btn, state){
19786
var g = groups[btn.toggleGroup];
19787
for(var i = 0, l = g.length; i < l; i++){
19789
g[i].toggle(false);
19796
register : function(btn){
19797
if(!btn.toggleGroup){
19800
var g = groups[btn.toggleGroup];
19802
g = groups[btn.toggleGroup] = [];
19805
btn.on("toggle", toggleGroup);
19808
unregister : function(btn){
19809
if(!btn.toggleGroup){
19812
var g = groups[btn.toggleGroup];
19815
btn.un("toggle", toggleGroup);
19821
Ext.SplitButton = Ext.extend(Ext.Button, {
19823
arrowSelector : 'button:last',
19826
initComponent : function(){
19827
Ext.SplitButton.superclass.initComponent.call(this);
19829
this.addEvents("arrowclick");
19833
onRender : function(ct, position){
19835
var tpl = new Ext.Template(
19836
'<table cellspacing="0" class="x-btn-menu-wrap x-btn"><tr><td>',
19837
'<table cellspacing="0" class="x-btn-wrap x-btn-menu-text-wrap"><tbody>',
19838
'<tr><td class="x-btn-left"><i> </i></td><td class="x-btn-center"><button class="x-btn-text" type="{1}">{0}</button></td></tr>',
19839
"</tbody></table></td><td>",
19840
'<table cellspacing="0" class="x-btn-wrap x-btn-menu-arrow-wrap"><tbody>',
19841
'<tr><td class="x-btn-center"><button class="x-btn-menu-arrow-el" type="button"> </button></td><td class="x-btn-right"><i> </i></td></tr>',
19842
"</tbody></table></td></tr></table>"
19844
var btn, targs = [this.text || ' ', this.type];
19846
btn = tpl.insertBefore(position, targs, true);
19848
btn = tpl.append(ct, targs, true);
19850
var btnEl = btn.child(this.buttonSelector);
19852
this.initButtonEl(btn, btnEl);
19853
this.arrowBtnTable = btn.child("table:last");
19854
if(this.arrowTooltip){
19855
btn.child(this.arrowSelector).dom[this.tooltipType] = this.arrowTooltip;
19860
autoWidth : function(){
19862
var tbl = this.el.child("table:first");
19863
var tbl2 = this.el.child("table:last");
19864
this.el.setWidth("auto");
19865
tbl.setWidth("auto");
19866
if(Ext.isIE7 && Ext.isStrict){
19867
var ib = this.el.child(this.buttonSelector);
19868
if(ib && ib.getWidth() > 20){
19870
ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr'));
19874
if((tbl.getWidth()+tbl2.getWidth()) < this.minWidth){
19875
tbl.setWidth(this.minWidth-tbl2.getWidth());
19878
this.el.setWidth(tbl.getWidth()+tbl2.getWidth());
19883
setArrowHandler : function(handler, scope){
19884
this.arrowHandler = handler;
19885
this.scope = scope;
19889
onClick : function(e){
19890
e.preventDefault();
19891
if(!this.disabled){
19892
if(e.getTarget(".x-btn-menu-arrow-wrap")){
19893
if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){
19896
this.fireEvent("arrowclick", this, e);
19897
if(this.arrowHandler){
19898
this.arrowHandler.call(this.scope || this, this, e);
19901
if(this.enableToggle){
19904
this.fireEvent("click", this, e);
19906
this.handler.call(this.scope || this, this, e);
19913
getClickEl : function(e, isUp){
19915
return (this.lastClickEl = e.getTarget("table", 10, true));
19917
return this.lastClickEl;
19921
onDisable : function(){
19924
this.el.addClass("x-item-disabled");
19926
this.el.child(this.buttonSelector).dom.disabled = true;
19927
this.el.child(this.arrowSelector).dom.disabled = true;
19929
this.disabled = true;
19933
onEnable : function(){
19936
this.el.removeClass("x-item-disabled");
19938
this.el.child(this.buttonSelector).dom.disabled = false;
19939
this.el.child(this.arrowSelector).dom.disabled = false;
19941
this.disabled = false;
19945
isMenuTriggerOver : function(e){
19946
return this.menu && e.within(this.arrowBtnTable) && !e.within(this.arrowBtnTable, true);
19950
isMenuTriggerOut : function(e, internal){
19951
return this.menu && !e.within(this.arrowBtnTable);
19955
onDestroy : function(){
19956
Ext.destroy(this.arrowBtnTable);
19957
Ext.SplitButton.superclass.onDestroy.call(this);
19962
Ext.MenuButton = Ext.SplitButton;
19965
Ext.reg('splitbutton', Ext.SplitButton);
19967
Ext.CycleButton = Ext.extend(Ext.SplitButton, {
19975
getItemText : function(item){
19976
if(item && this.showText === true){
19978
if(this.prependText){
19979
text += this.prependText;
19988
setActiveItem : function(item, suppressEvent){
19989
if(typeof item != 'object'){
19990
item = this.menu.items.get(item);
19993
if(!this.rendered){
19994
this.text = this.getItemText(item);
19995
this.iconCls = item.iconCls;
19997
var t = this.getItemText(item);
20001
this.setIconClass(item.iconCls);
20003
this.activeItem = item;
20005
item.setChecked(true, true);
20007
if(this.forceIcon){
20008
this.setIconClass(this.forceIcon);
20010
if(!suppressEvent){
20011
this.fireEvent('change', this, item);
20017
getActiveItem : function(){
20018
return this.activeItem;
20022
initComponent : function(){
20028
if(this.changeHandler){
20029
this.on('change', this.changeHandler, this.scope||this);
20030
delete this.changeHandler;
20033
this.itemCount = this.items.length;
20035
this.menu = {cls:'x-cycle-menu', items:[]};
20037
for(var i = 0, len = this.itemCount; i < len; i++){
20038
var item = this.items[i];
20039
item.group = item.group || this.id;
20040
item.itemIndex = i;
20041
item.checkHandler = this.checkHandler;
20043
item.checked = item.checked || false;
20044
this.menu.items.push(item);
20049
this.setActiveItem(checked, true);
20050
Ext.CycleButton.superclass.initComponent.call(this);
20052
this.on('click', this.toggleSelected, this);
20056
checkHandler : function(item, pressed){
20058
this.setActiveItem(item);
20063
toggleSelected : function(){
20064
this.menu.render();
20066
var nextIdx, checkItem;
20067
for (var i = 1; i < this.itemCount; i++) {
20068
nextIdx = (this.activeItem.itemIndex + i) % this.itemCount;
20070
checkItem = this.menu.items.itemAt(nextIdx);
20072
if (!checkItem.disabled) {
20073
checkItem.setChecked(true);
20079
Ext.reg('cycle', Ext.CycleButton);
20081
Ext.Toolbar = function(config){
20082
if(Ext.isArray(config)){
20083
config = {buttons:config};
20085
Ext.Toolbar.superclass.constructor.call(this, config);
20090
var T = Ext.Toolbar;
20092
Ext.extend(T, Ext.BoxComponent, {
20097
initComponent : function(){
20098
T.superclass.initComponent.call(this);
20101
this.buttons = this.items;
20104
this.items = new Ext.util.MixedCollection(false, function(o){
20105
return o.itemId || o.id || Ext.id();
20111
cls:'x-toolbar x-small-editor',
20112
html:'<table cellspacing="0"><tr></tr></table>'
20116
onRender : function(ct, position){
20117
this.el = ct.createChild(Ext.apply({ id: this.id },this.autoCreate), position);
20118
this.tr = this.el.child("tr", true);
20122
afterRender : function(){
20123
T.superclass.afterRender.call(this);
20125
this.add.apply(this, this.buttons);
20126
delete this.buttons;
20132
var a = arguments, l = a.length;
20133
for(var i = 0; i < l; i++){
20135
if(el.isFormField){
20137
}else if(el.render){
20139
}else if(typeof el == "string"){
20140
if(el == "separator" || el == "-"){
20141
this.addSeparator();
20142
}else if(el == " "){
20144
}else if(el == "->"){
20149
}else if(el.tagName){
20150
this.addElement(el);
20151
}else if(typeof el == "object"){
20153
this.addField(Ext.ComponentMgr.create(el, 'button'));
20155
this.addButton(el);
20162
addSeparator : function(){
20163
return this.addItem(new T.Separator());
20167
addSpacer : function(){
20168
return this.addItem(new T.Spacer());
20172
addFill : function(){
20173
return this.addItem(new T.Fill());
20177
addElement : function(el){
20178
return this.addItem(new T.Item(el));
20182
addItem : function(item){
20183
var td = this.nextBlock();
20184
this.initMenuTracking(item);
20186
this.items.add(item);
20191
addButton : function(config){
20192
if(Ext.isArray(config)){
20194
for(var i = 0, len = config.length; i < len; i++) {
20195
buttons.push(this.addButton(config[i]));
20200
if(!(config instanceof T.Button)){
20202
new T.SplitButton(config) :
20203
new T.Button(config);
20205
var td = this.nextBlock();
20206
this.initMenuTracking(b);
20213
initMenuTracking : function(item){
20214
if(this.trackMenus && item.menu){
20216
'menutriggerover' : this.onButtonTriggerOver,
20217
'menushow' : this.onButtonMenuShow,
20218
'menuhide' : this.onButtonMenuHide,
20225
addText : function(text){
20226
return this.addItem(new T.TextItem(text));
20230
insertButton : function(index, item){
20231
if(Ext.isArray(item)){
20233
for(var i = 0, len = item.length; i < len; i++) {
20234
buttons.push(this.insertButton(index + i, item[i]));
20238
if (!(item instanceof T.Button)){
20239
item = new T.Button(item);
20241
var td = document.createElement("td");
20242
this.tr.insertBefore(td, this.tr.childNodes[index]);
20243
this.initMenuTracking(item);
20245
this.items.insert(index, item);
20250
addDom : function(config, returnEl){
20251
var td = this.nextBlock();
20252
Ext.DomHelper.overwrite(td, config);
20253
var ti = new T.Item(td.firstChild);
20255
this.items.add(ti);
20260
addField : function(field){
20261
var td = this.nextBlock();
20263
var ti = new T.Item(td.firstChild);
20265
this.items.add(field);
20270
nextBlock : function(){
20271
var td = document.createElement("td");
20272
this.tr.appendChild(td);
20277
onDestroy : function(){
20278
Ext.Toolbar.superclass.onDestroy.call(this);
20281
Ext.destroy.apply(Ext, this.items.items);
20283
Ext.Element.uncache(this.tr);
20288
onDisable : function(){
20289
this.items.each(function(item){
20297
onEnable : function(){
20298
this.items.each(function(item){
20306
onButtonTriggerOver : function(btn){
20307
if(this.activeMenuBtn && this.activeMenuBtn != btn){
20308
this.activeMenuBtn.hideMenu();
20310
this.activeMenuBtn = btn;
20315
onButtonMenuShow : function(btn){
20316
this.activeMenuBtn = btn;
20320
onButtonMenuHide : function(btn){
20321
delete this.activeMenuBtn;
20326
Ext.reg('toolbar', Ext.Toolbar);
20329
T.Item = function(el){
20330
this.el = Ext.getDom(el);
20331
this.id = Ext.id(this.el);
20332
this.hidden = false;
20335
T.Item.prototype = {
20338
getEl : function(){
20343
render : function(td){
20345
td.appendChild(this.el);
20349
destroy : function(){
20350
if(this.td && this.td.parentNode){
20351
this.td.parentNode.removeChild(this.td);
20357
this.hidden = false;
20358
this.td.style.display = "";
20363
this.hidden = true;
20364
this.td.style.display = "none";
20368
setVisible: function(visible){
20377
focus : function(){
20378
Ext.fly(this.el).focus();
20382
disable : function(){
20383
Ext.fly(this.td).addClass("x-item-disabled");
20384
this.disabled = true;
20385
this.el.disabled = true;
20389
enable : function(){
20390
Ext.fly(this.td).removeClass("x-item-disabled");
20391
this.disabled = false;
20392
this.el.disabled = false;
20395
Ext.reg('tbitem', T.Item);
20399
T.Separator = function(){
20400
var s = document.createElement("span");
20401
s.className = "ytb-sep";
20402
T.Separator.superclass.constructor.call(this, s);
20404
Ext.extend(T.Separator, T.Item, {
20405
enable:Ext.emptyFn,
20406
disable:Ext.emptyFn,
20409
Ext.reg('tbseparator', T.Separator);
20412
T.Spacer = function(){
20413
var s = document.createElement("div");
20414
s.className = "ytb-spacer";
20415
T.Spacer.superclass.constructor.call(this, s);
20417
Ext.extend(T.Spacer, T.Item, {
20418
enable:Ext.emptyFn,
20419
disable:Ext.emptyFn,
20423
Ext.reg('tbspacer', T.Spacer);
20426
T.Fill = Ext.extend(T.Spacer, {
20428
render : function(td){
20429
td.style.width = '100%';
20430
T.Fill.superclass.render.call(this, td);
20433
Ext.reg('tbfill', T.Fill);
20436
T.TextItem = function(t){
20437
var s = document.createElement("span");
20438
s.className = "ytb-text";
20439
s.innerHTML = t.text ? t.text : t;
20440
T.TextItem.superclass.constructor.call(this, s);
20442
Ext.extend(T.TextItem, T.Item, {
20443
enable:Ext.emptyFn,
20444
disable:Ext.emptyFn,
20447
Ext.reg('tbtext', T.TextItem);
20451
T.Button = Ext.extend(Ext.Button, {
20454
onDestroy : function(){
20455
T.Button.superclass.onDestroy.call(this);
20456
if(this.container){
20457
this.container.remove();
20461
Ext.reg('tbbutton', T.Button);
20464
T.SplitButton = Ext.extend(Ext.SplitButton, {
20467
onDestroy : function(){
20468
T.SplitButton.superclass.onDestroy.call(this);
20469
if(this.container){
20470
this.container.remove();
20475
Ext.reg('tbsplit', T.SplitButton);
20477
T.MenuButton = T.SplitButton;
20482
Ext.PagingToolbar = Ext.extend(Ext.Toolbar, {
20488
displayMsg : 'Displaying {0} - {1} of {2}',
20490
emptyMsg : 'No data to display',
20492
beforePageText : "Page",
20494
afterPageText : "of {0}",
20496
firstText : "First Page",
20498
prevText : "Previous Page",
20500
nextText : "Next Page",
20502
lastText : "Last Page",
20504
refreshText : "Refresh",
20507
paramNames : {start: 'start', limit: 'limit'},
20509
initComponent : function(){
20510
this.addEvents('change', 'beforechange');
20511
Ext.PagingToolbar.superclass.initComponent.call(this);
20513
this.bind(this.store);
20516
onRender : function(ct, position){
20517
Ext.PagingToolbar.superclass.onRender.call(this, ct, position);
20518
this.first = this.addButton({
20519
tooltip: this.firstText,
20520
iconCls: "x-tbar-page-first",
20522
handler: this.onClick.createDelegate(this, ["first"])
20524
this.prev = this.addButton({
20525
tooltip: this.prevText,
20526
iconCls: "x-tbar-page-prev",
20528
handler: this.onClick.createDelegate(this, ["prev"])
20530
this.addSeparator();
20531
this.add(this.beforePageText);
20532
this.field = Ext.get(this.addDom({
20537
cls: "x-tbar-page-number"
20539
this.field.on("keydown", this.onPagingKeydown, this);
20540
this.field.on("focus", function(){this.dom.select();});
20541
this.afterTextEl = this.addText(String.format(this.afterPageText, 1));
20542
this.field.setHeight(18);
20543
this.addSeparator();
20544
this.next = this.addButton({
20545
tooltip: this.nextText,
20546
iconCls: "x-tbar-page-next",
20548
handler: this.onClick.createDelegate(this, ["next"])
20550
this.last = this.addButton({
20551
tooltip: this.lastText,
20552
iconCls: "x-tbar-page-last",
20554
handler: this.onClick.createDelegate(this, ["last"])
20556
this.addSeparator();
20557
this.loading = this.addButton({
20558
tooltip: this.refreshText,
20559
iconCls: "x-tbar-loading",
20560
handler: this.onClick.createDelegate(this, ["refresh"])
20563
if(this.displayInfo){
20564
this.displayEl = Ext.fly(this.el.dom).createChild({cls:'x-paging-info'});
20567
this.onLoad.apply(this, this.dsLoaded);
20571
updateInfo : function(){
20572
if(this.displayEl){
20573
var count = this.store.getCount();
20574
var msg = count == 0 ?
20578
this.cursor+1, this.cursor+count, this.store.getTotalCount()
20580
this.displayEl.update(msg);
20584
onLoad : function(store, r, o){
20585
if(!this.rendered){
20586
this.dsLoaded = [store, r, o];
20589
this.cursor = o.params ? o.params[this.paramNames.start] : 0;
20590
var d = this.getPageData(), ap = d.activePage, ps = d.pages;
20592
this.afterTextEl.el.innerHTML = String.format(this.afterPageText, d.pages);
20593
this.field.dom.value = ap;
20594
this.first.setDisabled(ap == 1);
20595
this.prev.setDisabled(ap == 1);
20596
this.next.setDisabled(ap == ps);
20597
this.last.setDisabled(ap == ps);
20598
this.loading.enable();
20600
this.fireEvent('change', this, d);
20603
getPageData : function(){
20604
var total = this.store.getTotalCount();
20607
activePage : Math.ceil((this.cursor+this.pageSize)/this.pageSize),
20608
pages : total < this.pageSize ? 1 : Math.ceil(total/this.pageSize)
20612
onLoadError : function(){
20613
if(!this.rendered){
20616
this.loading.enable();
20619
readPage : function(d){
20620
var v = this.field.dom.value, pageNum;
20621
if (!v || isNaN(pageNum = parseInt(v, 10))) {
20622
this.field.dom.value = d.activePage;
20628
onPagingKeydown : function(e){
20629
var k = e.getKey(), d = this.getPageData(), pageNum;
20630
if (k == e.RETURN) {
20632
pageNum = this.readPage(d);
20633
if(pageNum !== false){
20634
pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1;
20635
this.doLoad(pageNum * this.pageSize);
20637
}else if (k == e.HOME || k == e.END){
20639
pageNum = k == e.HOME ? 1 : d.pages;
20640
this.field.dom.value = pageNum;
20641
}else if (k == e.UP || k == e.PAGEUP || k == e.DOWN || k == e.PAGEDOWN){
20643
if(pageNum = this.readPage(d)){
20644
var increment = e.shiftKey ? 10 : 1;
20645
if(k == e.DOWN || k == e.PAGEDOWN){
20648
pageNum += increment;
20649
if(pageNum >= 1 & pageNum <= d.pages){
20650
this.field.dom.value = pageNum;
20656
beforeLoad : function(){
20657
if(this.rendered && this.loading){
20658
this.loading.disable();
20662
doLoad : function(start){
20663
var o = {}, pn = this.paramNames;
20664
o[pn.start] = start;
20665
o[pn.limit] = this.pageSize;
20666
if(this.fireEvent('beforechange', this, o) !== false){
20667
this.store.load({params:o});
20672
changePage: function(page){
20673
this.doLoad(((page-1) * this.pageSize).constrain(0, this.store.getTotalCount()));
20676
onClick : function(which){
20677
var store = this.store;
20683
this.doLoad(Math.max(0, this.cursor-this.pageSize));
20686
this.doLoad(this.cursor+this.pageSize);
20689
var total = store.getTotalCount();
20690
var extra = total % this.pageSize;
20691
var lastStart = extra ? (total - extra) : total-this.pageSize;
20692
this.doLoad(lastStart);
20695
this.doLoad(this.cursor);
20701
unbind : function(store){
20702
store = Ext.StoreMgr.lookup(store);
20703
store.un("beforeload", this.beforeLoad, this);
20704
store.un("load", this.onLoad, this);
20705
store.un("loadexception", this.onLoadError, this);
20706
this.store = undefined;
20710
bind : function(store){
20711
store = Ext.StoreMgr.lookup(store);
20712
store.on("beforeload", this.beforeLoad, this);
20713
store.on("load", this.onLoad, this);
20714
store.on("loadexception", this.onLoadError, this);
20715
this.store = store;
20718
Ext.reg('paging', Ext.PagingToolbar);
20720
Ext.Resizable = function(el, config){
20721
this.el = Ext.get(el);
20723
if(config && config.wrap){
20724
config.resizeChild = this.el;
20725
this.el = this.el.wrap(typeof config.wrap == "object" ? config.wrap : {cls:"xresizable-wrap"});
20726
this.el.id = this.el.dom.id = config.resizeChild.id + "-rzwrap";
20727
this.el.setStyle("overflow", "hidden");
20728
this.el.setPositioning(config.resizeChild.getPositioning());
20729
config.resizeChild.clearPositioning();
20730
if(!config.width || !config.height){
20731
var csize = config.resizeChild.getSize();
20732
this.el.setSize(csize.width, csize.height);
20734
if(config.pinned && !config.adjustments){
20735
config.adjustments = "auto";
20740
this.proxy = this.el.createProxy({tag: "div", cls: "x-resizable-proxy", id: this.el.id + "-rzproxy"}, Ext.getBody());
20741
this.proxy.unselectable();
20742
this.proxy.enableDisplayMode('block');
20744
Ext.apply(this, config);
20747
this.disableTrackOver = true;
20748
this.el.addClass("x-resizable-pinned");
20751
var position = this.el.getStyle("position");
20752
if(position != "absolute" && position != "fixed"){
20753
this.el.setStyle("position", "relative");
20756
this.handles = 's,e,se';
20757
if(this.multiDirectional){
20758
this.handles += ',n,w';
20761
if(this.handles == "all"){
20762
this.handles = "n s e w ne nw se sw";
20764
var hs = this.handles.split(/\s*?[,;]\s*?| /);
20765
var ps = Ext.Resizable.positions;
20766
for(var i = 0, len = hs.length; i < len; i++){
20767
if(hs[i] && ps[hs[i]]){
20768
var pos = ps[hs[i]];
20769
this[pos] = new Ext.Resizable.Handle(this, pos, this.disableTrackOver, this.transparent);
20773
this.corner = this.southeast;
20775
if(this.handles.indexOf("n") != -1 || this.handles.indexOf("w") != -1){
20776
this.updateBox = true;
20779
this.activeHandle = null;
20781
if(this.resizeChild){
20782
if(typeof this.resizeChild == "boolean"){
20783
this.resizeChild = Ext.get(this.el.dom.firstChild, true);
20785
this.resizeChild = Ext.get(this.resizeChild, true);
20789
if(this.adjustments == "auto"){
20790
var rc = this.resizeChild;
20791
var hw = this.west, he = this.east, hn = this.north, hs = this.south;
20792
if(rc && (hw || hn)){
20793
rc.position("relative");
20794
rc.setLeft(hw ? hw.el.getWidth() : 0);
20795
rc.setTop(hn ? hn.el.getHeight() : 0);
20797
this.adjustments = [
20798
(he ? -he.el.getWidth() : 0) + (hw ? -hw.el.getWidth() : 0),
20799
(hn ? -hn.el.getHeight() : 0) + (hs ? -hs.el.getHeight() : 0) -1
20803
if(this.draggable){
20804
this.dd = this.dynamic ?
20805
this.el.initDD(null) : this.el.initDDProxy(null, {dragElId: this.proxy.id});
20806
this.dd.setHandleElId(this.resizeChild ? this.resizeChild.id : this.el.id);
20815
if(this.width !== null && this.height !== null){
20816
this.resizeTo(this.width, this.height);
20818
this.updateChildSize();
20821
this.el.dom.style.zoom = 1;
20823
Ext.Resizable.superclass.constructor.call(this);
20826
Ext.extend(Ext.Resizable, Ext.util.Observable, {
20827
resizeChild : false,
20828
adjustments : [0, 0],
20838
multiDirectional : false,
20839
disableTrackOver : false,
20840
easing : 'easeOutStrong',
20841
widthIncrement : 0,
20842
heightIncrement : 0,
20846
preserveRatio : false,
20847
transparent: false,
20859
resizeTo : function(width, height){
20860
this.el.setSize(width, height);
20861
this.updateChildSize();
20862
this.fireEvent("resize", this, width, height, null);
20866
startSizing : function(e, handle){
20867
this.fireEvent("beforeresize", this, e);
20871
this.overlay = this.el.createProxy({tag: "div", cls: "x-resizable-overlay", html: " "}, Ext.getBody());
20872
this.overlay.unselectable();
20873
this.overlay.enableDisplayMode("block");
20874
this.overlay.on("mousemove", this.onMouseMove, this);
20875
this.overlay.on("mouseup", this.onMouseUp, this);
20877
this.overlay.setStyle("cursor", handle.el.getStyle("cursor"));
20879
this.resizing = true;
20880
this.startBox = this.el.getBox();
20881
this.startPoint = e.getXY();
20882
this.offsets = [(this.startBox.x + this.startBox.width) - this.startPoint[0],
20883
(this.startBox.y + this.startBox.height) - this.startPoint[1]];
20885
this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
20886
this.overlay.show();
20888
if(this.constrainTo) {
20889
var ct = Ext.get(this.constrainTo);
20890
this.resizeRegion = ct.getRegion().adjust(
20891
ct.getFrameWidth('t'),
20892
ct.getFrameWidth('l'),
20893
-ct.getFrameWidth('b'),
20894
-ct.getFrameWidth('r')
20898
this.proxy.setStyle('visibility', 'hidden');
20900
this.proxy.setBox(this.startBox);
20902
this.proxy.setStyle('visibility', 'visible');
20908
onMouseDown : function(handle, e){
20911
this.activeHandle = handle;
20912
this.startSizing(e, handle);
20917
onMouseUp : function(e){
20918
var size = this.resizeElement();
20919
this.resizing = false;
20921
this.overlay.hide();
20923
this.fireEvent("resize", this, size.width, size.height, e);
20927
updateChildSize : function(){
20928
if(this.resizeChild){
20930
var child = this.resizeChild;
20931
var adj = this.adjustments;
20932
if(el.dom.offsetWidth){
20933
var b = el.getSize(true);
20934
child.setSize(b.width+adj[0], b.height+adj[1]);
20941
setTimeout(function(){
20942
if(el.dom.offsetWidth){
20943
var b = el.getSize(true);
20944
child.setSize(b.width+adj[0], b.height+adj[1]);
20952
snap : function(value, inc, min){
20953
if(!inc || !value) return value;
20954
var newValue = value;
20955
var m = value % inc;
20958
newValue = value + (inc-m);
20960
newValue = value - m;
20963
return Math.max(min, newValue);
20967
resizeElement : function(){
20968
var box = this.proxy.getBox();
20969
if(this.updateBox){
20970
this.el.setBox(box, false, this.animate, this.duration, null, this.easing);
20972
this.el.setSize(box.width, box.height, this.animate, this.duration, null, this.easing);
20974
this.updateChildSize();
20982
constrain : function(v, diff, m, mx){
20985
}else if(v - diff > mx){
20992
onMouseMove : function(e){
20996
if(this.resizeRegion && !this.resizeRegion.contains(e.getPoint())) {
21001
var curSize = this.curSize || this.startBox;
21002
var x = this.startBox.x, y = this.startBox.y;
21003
var ox = x, oy = y;
21004
var w = curSize.width, h = curSize.height;
21005
var ow = w, oh = h;
21006
var mw = this.minWidth, mh = this.minHeight;
21007
var mxw = this.maxWidth, mxh = this.maxHeight;
21008
var wi = this.widthIncrement;
21009
var hi = this.heightIncrement;
21011
var eventXY = e.getXY();
21012
var diffX = -(this.startPoint[0] - Math.max(this.minX, eventXY[0]));
21013
var diffY = -(this.startPoint[1] - Math.max(this.minY, eventXY[1]));
21015
var pos = this.activeHandle.position;
21020
w = Math.min(Math.max(mw, w), mxw);
21024
h = Math.min(Math.max(mh, h), mxh);
21029
w = Math.min(Math.max(mw, w), mxw);
21030
h = Math.min(Math.max(mh, h), mxh);
21033
diffY = this.constrain(h, diffY, mh, mxh);
21038
diffX = this.constrain(w, diffX, mw, mxw);
21044
w = Math.min(Math.max(mw, w), mxw);
21045
diffY = this.constrain(h, diffY, mh, mxh);
21050
diffX = this.constrain(w, diffX, mw, mxw);
21051
diffY = this.constrain(h, diffY, mh, mxh);
21058
diffX = this.constrain(w, diffX, mw, mxw);
21060
h = Math.min(Math.max(mh, h), mxh);
21066
var sw = this.snap(w, wi, mw);
21067
var sh = this.snap(h, hi, mh);
21068
if(sw != w || sh != h){
21091
if(this.preserveRatio){
21096
h = Math.min(Math.max(mh, h), mxh);
21101
w = Math.min(Math.max(mw, w), mxw);
21106
w = Math.min(Math.max(mw, w), mxw);
21112
w = Math.min(Math.max(mw, w), mxw);
21118
h = Math.min(Math.max(mh, h), mxh);
21126
h = Math.min(Math.max(mh, h), mxh);
21136
h = Math.min(Math.max(mh, h), mxh);
21144
this.proxy.setBounds(x, y, w, h);
21146
this.resizeElement();
21153
handleOver : function(){
21155
this.el.addClass("x-resizable-over");
21160
handleOut : function(){
21161
if(!this.resizing){
21162
this.el.removeClass("x-resizable-over");
21167
getEl : function(){
21172
getResizeChild : function(){
21173
return this.resizeChild;
21177
destroy : function(removeEl){
21178
this.proxy.remove();
21180
this.overlay.removeAllListeners();
21181
this.overlay.remove();
21183
var ps = Ext.Resizable.positions;
21185
if(typeof ps[k] != "function" && this[ps[k]]){
21186
var h = this[ps[k]];
21187
h.el.removeAllListeners();
21192
this.el.update("");
21197
syncHandleHeight : function(){
21198
var h = this.el.getHeight(true);
21200
this.west.el.setHeight(h);
21203
this.east.el.setHeight(h);
21210
Ext.Resizable.positions = {
21211
n: "north", s: "south", e: "east", w: "west", se: "southeast", sw: "southwest", nw: "northwest", ne: "northeast"
21215
Ext.Resizable.Handle = function(rz, pos, disableTrackOver, transparent){
21218
var tpl = Ext.DomHelper.createTemplate(
21219
{tag: "div", cls: "x-resizable-handle x-resizable-handle-{0}"}
21222
Ext.Resizable.Handle.prototype.tpl = tpl;
21224
this.position = pos;
21226
this.el = this.tpl.append(rz.el.dom, [this.position], true);
21227
this.el.unselectable();
21229
this.el.setOpacity(0);
21231
this.el.on("mousedown", this.onMouseDown, this);
21232
if(!disableTrackOver){
21233
this.el.on("mouseover", this.onMouseOver, this);
21234
this.el.on("mouseout", this.onMouseOut, this);
21239
Ext.Resizable.Handle.prototype = {
21240
afterResize : function(rz){
21244
onMouseDown : function(e){
21245
this.rz.onMouseDown(this, e);
21248
onMouseOver : function(e){
21249
this.rz.handleOver(this, e);
21252
onMouseOut : function(e){
21253
this.rz.handleOut(this, e);
21261
Ext.Editor = function(field, config){
21262
this.field = field;
21263
Ext.Editor.superclass.constructor.call(this, config);
21266
Ext.extend(Ext.Editor, Ext.Component, {
21280
swallowKeys : true,
21282
completeOnEnter : false,
21284
cancelOnEsc : false,
21288
initComponent : function(){
21289
Ext.Editor.superclass.initComponent.call(this);
21306
onRender : function(ct, position){
21307
this.el = new Ext.Layer({
21308
shadow: this.shadow,
21314
constrain: this.constrain
21316
this.el.setStyle("overflow", Ext.isGecko ? "auto" : "hidden");
21317
if(this.field.msgTarget != 'title'){
21318
this.field.msgTarget = 'qtip';
21320
this.field.inEditor = true;
21321
this.field.render(this.el);
21323
this.field.el.dom.setAttribute('autocomplete', 'off');
21325
this.field.on("specialkey", this.onSpecialKey, this);
21326
if(this.swallowKeys){
21327
this.field.el.swallowEvent(['keydown','keypress']);
21330
this.field.on("blur", this.onBlur, this);
21331
if(this.field.grow){
21332
this.field.on("autosize", this.el.sync, this.el, {delay:1});
21336
onSpecialKey : function(field, e){
21337
var key = e.getKey();
21338
if(this.completeOnEnter && key == e.ENTER){
21340
this.completeEdit();
21341
}else if(this.cancelOnEsc && key == e.ESC){
21344
this.fireEvent('specialkey', field, e);
21346
if(this.field.triggerBlur && (key == e.ENTER || key == e.ESC || key == e.TAB)){
21347
this.field.triggerBlur();
21352
startEdit : function(el, value){
21354
this.completeEdit();
21356
this.boundEl = Ext.get(el);
21357
var v = value !== undefined ? value : this.boundEl.dom.innerHTML;
21358
if(!this.rendered){
21359
this.render(this.parentEl || document.body);
21361
if(this.fireEvent("beforestartedit", this, this.boundEl, v) === false){
21364
this.startValue = v;
21365
this.field.setValue(v);
21367
this.el.alignTo(this.boundEl, this.alignment);
21368
this.editing = true;
21372
doAutoSize : function(){
21374
var sz = this.boundEl.getSize();
21375
switch(this.autoSize){
21377
this.setSize(sz.width, "");
21380
this.setSize("", sz.height);
21383
this.setSize(sz.width, sz.height);
21389
setSize : function(w, h){
21390
delete this.field.lastSize;
21391
this.field.setSize(w, h);
21393
if(Ext.isGecko2 || Ext.isOpera){
21394
this.el.setSize(w, h);
21401
realign : function(){
21402
this.el.alignTo(this.boundEl, this.alignment);
21406
completeEdit : function(remainVisible){
21410
var v = this.getValue();
21411
if(this.revertInvalid !== false && !this.field.isValid()){
21412
v = this.startValue;
21413
this.cancelEdit(true);
21415
if(String(v) === String(this.startValue) && this.ignoreNoChange){
21416
this.editing = false;
21420
if(this.fireEvent("beforecomplete", this, v, this.startValue) !== false){
21421
this.editing = false;
21422
if(this.updateEl && this.boundEl){
21423
this.boundEl.update(v);
21425
if(remainVisible !== true){
21428
this.fireEvent("complete", this, v, this.startValue);
21432
onShow : function(){
21434
if(this.hideEl !== false){
21435
this.boundEl.hide();
21438
if(Ext.isIE && !this.fixIEFocus){ this.fixIEFocus = true;
21439
this.deferredFocus.defer(50, this);
21441
this.field.focus();
21443
this.fireEvent("startedit", this.boundEl, this.startValue);
21446
deferredFocus : function(){
21448
this.field.focus();
21453
cancelEdit : function(remainVisible){
21455
var v = this.getValue();
21456
this.setValue(this.startValue);
21457
if(remainVisible !== true){
21460
this.fireEvent("canceledit", this, v, this.startValue);
21464
onBlur : function(){
21465
if(this.allowBlur !== true && this.editing){
21466
this.completeEdit();
21470
onHide : function(){
21472
this.completeEdit();
21476
if(this.field.collapse){
21477
this.field.collapse();
21480
if(this.hideEl !== false){
21481
this.boundEl.show();
21486
setValue : function(v){
21487
this.field.setValue(v);
21491
getValue : function(){
21492
return this.field.getValue();
21495
beforeDestroy : function(){
21496
this.field.destroy();
21500
Ext.reg('editor', Ext.Editor);
21502
Ext.MessageBox = function(){
21503
var dlg, opt, mask, waitTimer;
21504
var bodyEl, msgEl, textboxEl, textareaEl, progressBar, pp, iconEl, spacerEl;
21505
var buttons, activeTextEl, bwidth, iconCls = '';
21507
var handleButton = function(button){
21508
if(dlg.isVisible()){
21510
Ext.callback(opt.fn, opt.scope||window, [button, activeTextEl.dom.value], 1);
21514
var handleHide = function(){
21515
if(opt && opt.cls){
21516
dlg.el.removeClass(opt.cls);
21518
progressBar.reset();
21521
var handleEsc = function(d, k, e){
21522
if(opt && opt.closable !== false){
21530
var updateButtons = function(b){
21533
buttons["ok"].hide();
21534
buttons["cancel"].hide();
21535
buttons["yes"].hide();
21536
buttons["no"].hide();
21539
dlg.footer.dom.style.display = '';
21540
for(var k in buttons){
21541
if(typeof buttons[k] != "function"){
21544
buttons[k].setText(typeof b[k] == "string" ? b[k] : Ext.MessageBox.buttonText[k]);
21545
width += buttons[k].el.getWidth()+15;
21556
getDialog : function(titleText){
21558
dlg = new Ext.Window({
21563
constrainHeader:true,
21564
minimizable : false,
21565
maximizable : false,
21569
buttonAlign:"center",
21576
close : function(){
21577
if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){
21578
handleButton("no");
21580
handleButton("cancel");
21585
var bt = this.buttonText;
21586
buttons["ok"] = dlg.addButton(bt["ok"], handleButton.createCallback("ok"));
21587
buttons["yes"] = dlg.addButton(bt["yes"], handleButton.createCallback("yes"));
21588
buttons["no"] = dlg.addButton(bt["no"], handleButton.createCallback("no"));
21589
buttons["cancel"] = dlg.addButton(bt["cancel"], handleButton.createCallback("cancel"));
21590
buttons["ok"].hideMode = buttons["yes"].hideMode = buttons["no"].hideMode = buttons["cancel"].hideMode = 'offsets';
21591
dlg.render(document.body);
21592
dlg.getEl().addClass('x-window-dlg');
21594
bodyEl = dlg.body.createChild({
21595
html:'<div class="ext-mb-icon"></div><div class="ext-mb-content"><span class="ext-mb-text"></span><br /><div class="ext-mb-fix-cursor"><input type="text" class="ext-mb-input" /><textarea class="ext-mb-textarea"></textarea></div></div>'
21597
iconEl = Ext.get(bodyEl.dom.firstChild);
21598
var contentEl = bodyEl.dom.childNodes[1];
21599
msgEl = Ext.get(contentEl.firstChild);
21600
textboxEl = Ext.get(contentEl.childNodes[2].firstChild);
21601
textboxEl.enableDisplayMode();
21602
textboxEl.addKeyListener([10,13], function(){
21603
if(dlg.isVisible() && opt && opt.buttons){
21604
if(opt.buttons.ok){
21605
handleButton("ok");
21606
}else if(opt.buttons.yes){
21607
handleButton("yes");
21611
textareaEl = Ext.get(contentEl.childNodes[2].childNodes[1]);
21612
textareaEl.enableDisplayMode();
21613
progressBar = new Ext.ProgressBar({
21616
bodyEl.createChild({cls:'x-clear'});
21622
updateText : function(text){
21623
if(!dlg.isVisible() && !opt.width){
21624
dlg.setSize(this.maxWidth, 100); }
21625
msgEl.update(text || ' ');
21627
var iw = iconCls != '' ? (iconEl.getWidth() + iconEl.getMargins('lr')) : 0;
21628
var mw = msgEl.getWidth() + msgEl.getMargins('lr');
21629
var fw = dlg.getFrameWidth('lr');
21630
var bw = dlg.body.getFrameWidth('lr');
21631
if (Ext.isIE && iw > 0){
21634
var w = Math.max(Math.min(opt.width || iw+mw+fw+bw, this.maxWidth),
21635
Math.max(opt.minWidth || this.minWidth, bwidth || 0));
21637
if(opt.prompt === true){
21638
activeTextEl.setWidth(w-iw-fw-bw);
21640
if(opt.progress === true || opt.wait === true){
21641
progressBar.setSize(w-iw-fw-bw);
21643
dlg.setSize(w, 'auto').center();
21648
updateProgress : function(value, progressText, msg){
21649
progressBar.updateProgress(value, progressText);
21651
this.updateText(msg);
21657
isVisible : function(){
21658
return dlg && dlg.isVisible();
21663
if(this.isVisible()){
21671
show : function(options){
21672
if(this.isVisible()){
21676
var d = this.getDialog(opt.title || " ");
21678
d.setTitle(opt.title || " ");
21679
var allowClose = (opt.closable !== false && opt.progress !== true && opt.wait !== true);
21680
d.tools.close.setDisplayed(allowClose);
21681
activeTextEl = textboxEl;
21682
opt.prompt = opt.prompt || (opt.multiline ? true : false);
21687
textareaEl.setHeight(typeof opt.multiline == "number" ?
21688
opt.multiline : this.defaultTextHeight);
21689
activeTextEl = textareaEl;
21698
activeTextEl.dom.value = opt.value || "";
21700
d.focusEl = activeTextEl;
21702
var bs = opt.buttons;
21705
db = buttons["ok"];
21706
}else if(bs && bs.yes){
21707
db = buttons["yes"];
21714
d.setIconClass(opt.iconCls);
21716
this.setIcon(opt.icon);
21717
bwidth = updateButtons(opt.buttons);
21718
progressBar.setVisible(opt.progress === true || opt.wait === true);
21719
this.updateProgress(0, opt.progressText);
21720
this.updateText(opt.msg);
21722
d.el.addClass(opt.cls);
21724
d.proxyDrag = opt.proxyDrag === true;
21725
d.modal = opt.modal !== false;
21726
d.mask = opt.modal !== false ? mask : false;
21727
if(!d.isVisible()){
21728
document.body.appendChild(dlg.el.dom);
21729
d.setAnimateTarget(opt.animEl);
21730
d.show(opt.animEl);
21733
d.on('show', function(){
21734
if(allowClose === true){
21737
d.keyMap.disable();
21739
}, this, {single:true});
21741
if(opt.wait === true){
21742
progressBar.wait(opt.waitConfig);
21748
setIcon : function(icon){
21749
if(icon && icon != ''){
21750
iconEl.removeClass('x-hidden');
21751
iconEl.replaceClass(iconCls, icon);
21754
iconEl.replaceClass(iconCls, 'x-hidden');
21761
progress : function(title, msg, progressText){
21768
minWidth: this.minProgressWidth,
21769
progressText: progressText
21775
wait : function(msg, title, config){
21783
minWidth: this.minProgressWidth,
21790
alert : function(title, msg, fn, scope){
21802
confirm : function(title, msg, fn, scope){
21806
buttons: this.YESNO,
21809
icon: this.QUESTION
21815
prompt : function(title, msg, fn, scope, multiline, value){
21819
buttons: this.OKCANCEL,
21824
multiline: multiline,
21833
CANCEL : {cancel:true},
21835
OKCANCEL : {ok:true, cancel:true},
21837
YESNO : {yes:true, no:true},
21839
YESNOCANCEL : {yes:true, no:true, cancel:true},
21841
INFO : 'ext-mb-info',
21843
WARNING : 'ext-mb-warning',
21845
QUESTION : 'ext-mb-question',
21847
ERROR : 'ext-mb-error',
21850
defaultTextHeight : 75,
21856
minProgressWidth : 250,
21868
Ext.Msg = Ext.MessageBox;
21870
Ext.Tip = Ext.extend(Ext.Panel, {
21880
defaultAlign : "tl-bl?",
21882
quickShowInterval : 250,
21888
floating:{shadow:true,shim:true,useDisplay:true,constrain:false},
21892
initComponent : function(){
21893
Ext.Tip.superclass.initComponent.call(this);
21894
if(this.closable && !this.title){
21895
this.elements += ',header';
21900
afterRender : function(){
21901
Ext.Tip.superclass.afterRender.call(this);
21905
handler: this.hide,
21912
showAt : function(xy){
21913
Ext.Tip.superclass.show.call(this);
21914
if(this.measureWidth !== false && (!this.initialConfig || typeof this.initialConfig.width != 'number')){
21915
this.doAutoWidth();
21917
if(this.constrainPosition){
21918
xy = this.el.adjustForConstraints(xy);
21920
this.setPagePosition(xy[0], xy[1]);
21924
doAutoWidth : function(){
21925
var bw = this.body.getTextWidth();
21927
bw = Math.max(bw, this.header.child('span').getTextWidth(this.title));
21929
bw += this.getFrameWidth() + (this.closable ? 20 : 0) + this.body.getPadding("lr");
21930
this.setWidth(bw.constrain(this.minWidth, this.maxWidth));
21933
if(Ext.isIE7 && !this.repainted){
21935
this.repainted = true;
21940
showBy : function(el, pos){
21941
if(!this.rendered){
21942
this.render(Ext.getBody());
21944
this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign));
21947
initDraggable : function(){
21948
this.dd = new Ext.Tip.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable);
21949
this.header.addClass('x-tip-draggable');
21954
Ext.Tip.DD = function(tip, config){
21955
Ext.apply(this, config);
21957
Ext.Tip.DD.superclass.constructor.call(this, tip.el.id, 'WindowDD-'+tip.id);
21958
this.setHandleElId(tip.header.id);
21959
this.scroll = false;
21962
Ext.extend(Ext.Tip.DD, Ext.dd.DD, {
21965
headerOffsets:[100, 25],
21966
startDrag : function(){
21967
this.tip.el.disableShadow();
21969
endDrag : function(e){
21970
this.tip.el.enableShadow(true);
21974
Ext.ToolTip = Ext.extend(Ext.Tip, {
21982
dismissDelay: 5000,
21984
mouseOffset: [15,18],
21986
trackMouse : false,
21987
constrainPosition: true,
21990
initComponent: function(){
21991
Ext.ToolTip.superclass.initComponent.call(this);
21992
this.lastActive = new Date();
21997
initTarget : function(){
21999
this.target = Ext.get(this.target);
22000
this.target.on('mouseover', this.onTargetOver, this);
22001
this.target.on('mouseout', this.onTargetOut, this);
22002
this.target.on('mousemove', this.onMouseMove, this);
22007
onMouseMove : function(e){
22008
this.targetXY = e.getXY();
22009
if(!this.hidden && this.trackMouse){
22010
this.setPagePosition(this.getTargetXY());
22015
getTargetXY : function(){
22016
return [this.targetXY[0]+this.mouseOffset[0], this.targetXY[1]+this.mouseOffset[1]];
22020
onTargetOver : function(e){
22021
if(this.disabled || e.within(this.target.dom, true)){
22024
this.clearTimer('hide');
22025
this.targetXY = e.getXY();
22030
delayShow : function(){
22031
if(this.hidden && !this.showTimer){
22032
if(this.lastActive.getElapsed() < this.quickShowInterval){
22035
this.showTimer = this.show.defer(this.showDelay, this);
22037
}else if(!this.hidden && this.autoHide !== false){
22043
onTargetOut : function(e){
22044
if(this.disabled || e.within(this.target.dom, true)){
22047
this.clearTimer('show');
22048
if(this.autoHide !== false){
22054
delayHide : function(){
22055
if(!this.hidden && !this.hideTimer){
22056
this.hideTimer = this.hide.defer(this.hideDelay, this);
22062
this.clearTimer('dismiss');
22063
this.lastActive = new Date();
22064
Ext.ToolTip.superclass.hide.call(this);
22069
this.showAt(this.getTargetXY());
22073
showAt : function(xy){
22074
this.lastActive = new Date();
22075
this.clearTimers();
22076
Ext.ToolTip.superclass.showAt.call(this, xy);
22077
if(this.dismissDelay && this.autoHide !== false){
22078
this.dismissTimer = this.hide.defer(this.dismissDelay, this);
22083
clearTimer : function(name){
22084
name = name + 'Timer';
22085
clearTimeout(this[name]);
22090
clearTimers : function(){
22091
this.clearTimer('show');
22092
this.clearTimer('dismiss');
22093
this.clearTimer('hide');
22097
onShow : function(){
22098
Ext.ToolTip.superclass.onShow.call(this);
22099
Ext.getDoc().on('mousedown', this.onDocMouseDown, this);
22103
onHide : function(){
22104
Ext.ToolTip.superclass.onHide.call(this);
22105
Ext.getDoc().un('mousedown', this.onDocMouseDown, this);
22109
onDocMouseDown : function(e){
22110
if(this.autoHide !== false && !e.within(this.el.dom)){
22112
this.enable.defer(100, this);
22117
onDisable : function(){
22118
this.clearTimers();
22123
adjustPosition : function(x, y){
22125
var ay = this.targetXY[1], h = this.getSize().height;
22126
if(this.constrainPosition && y <= ay && (y+h) >= ay){
22129
return {x : x, y: y};
22133
onDestroy : function(){
22134
Ext.ToolTip.superclass.onDestroy.call(this);
22136
this.target.un('mouseover', this.onTargetOver, this);
22137
this.target.un('mouseout', this.onTargetOut, this);
22138
this.target.un('mousemove', this.onMouseMove, this);
22143
Ext.QuickTip = Ext.extend(Ext.ToolTip, {
22146
interceptTitles : false,
22151
attribute : "qtip",
22161
initComponent : function(){
22162
this.target = this.target || Ext.getDoc();
22163
this.targets = this.targets || {};
22164
Ext.QuickTip.superclass.initComponent.call(this);
22168
register : function(config){
22169
var cs = Ext.isArray(config) ? config : arguments;
22170
for(var i = 0, len = cs.length; i < len; i++){
22172
var target = c.target;
22174
if(Ext.isArray(target)){
22175
for(var j = 0, jlen = target.length; j < jlen; j++){
22176
this.targets[Ext.id(target[j])] = c;
22179
this.targets[Ext.id(target)] = c;
22186
unregister : function(el){
22187
delete this.targets[Ext.id(el)];
22191
onTargetOver : function(e){
22195
this.targetXY = e.getXY();
22196
var t = e.getTarget();
22197
if(!t || t.nodeType !== 1 || t == document || t == document.body){
22200
if(this.activeTarget && t == this.activeTarget.el){
22201
this.clearTimer('hide');
22205
if(t && this.targets[t.id]){
22206
this.activeTarget = this.targets[t.id];
22207
this.activeTarget.el = t;
22211
var ttp, et = Ext.fly(t), cfg = this.tagConfig;
22212
var ns = cfg.namespace;
22213
if(this.interceptTitles && t.title){
22216
t.removeAttribute("title");
22217
e.preventDefault();
22219
ttp = t.qtip || et.getAttributeNS(ns, cfg.attribute);
22222
var autoHide = et.getAttributeNS(ns, cfg.hide);
22223
this.activeTarget = {
22226
width: et.getAttributeNS(ns, cfg.width),
22227
autoHide: autoHide != "user" && autoHide !== 'false',
22228
title: et.getAttributeNS(ns, cfg.title),
22229
cls: et.getAttributeNS(ns, cfg.cls),
22230
align: et.getAttributeNS(ns, cfg.align)
22237
onTargetOut : function(e){
22238
this.clearTimer('show');
22239
if(this.autoHide !== false){
22245
showAt : function(xy){
22246
var t = this.activeTarget;
22248
if(!this.rendered){
22249
this.render(Ext.getBody());
22250
this.activeTarget = t;
22253
this.setWidth(t.width);
22254
this.body.setWidth(this.adjustBodyWidth(t.width - this.getFrameWidth()));
22255
this.measureWidth = false;
22257
this.measureWidth = true;
22259
this.setTitle(t.title || '');
22260
this.body.update(t.text);
22261
this.autoHide = t.autoHide;
22262
this.dismissDelay = t.dismissDelay || this.dismissDelay;
22264
this.el.removeClass(this.lastCls);
22265
delete this.lastCls;
22268
this.el.addClass(t.cls);
22269
this.lastCls = t.cls;
22272
xy = this.el.getAlignToXY(t.el, t.align);
22273
this.constrainPosition = false;
22275
this.constrainPosition = true;
22278
Ext.QuickTip.superclass.showAt.call(this, xy);
22283
delete this.activeTarget;
22284
Ext.QuickTip.superclass.hide.call(this);
22288
Ext.QuickTips = function(){
22289
var tip, locks = [];
22292
init : function(autoRender){
22295
Ext.onReady(function(){
22296
Ext.QuickTips.init(autoRender);
22300
tip = new Ext.QuickTip({elements:'header,body'});
22301
if(autoRender !== false){
22302
tip.render(Ext.getBody());
22308
enable : function(){
22311
if(locks.length < 1){
22318
disable : function(){
22326
isEnabled : function(){
22327
return tip !== undefined && !tip.disabled;
22331
getQuickTip : function(){
22336
register : function(){
22337
tip.register.apply(tip, arguments);
22341
unregister : function(){
22342
tip.unregister.apply(tip, arguments);
22347
tip.register.apply(tip, arguments);
22352
Ext.tree.TreePanel = Ext.extend(Ext.Panel, {
22353
rootVisible : true,
22354
animate: Ext.enableFx,
22357
hlDrop : Ext.enableFx,
22358
pathSeparator: "/",
22360
initComponent : function(){
22361
Ext.tree.TreePanel.superclass.initComponent.call(this);
22363
if(!this.eventModel){
22364
this.eventModel = new Ext.tree.TreeEventModel(this);
22368
var l = this.loader;
22370
l = new Ext.tree.TreeLoader({
22371
dataUrl: this.dataUrl
22373
}else if(typeof l == 'object' && !l.load){
22374
l = new Ext.tree.TreeLoader(l);
22378
this.nodeHash = {};
22382
this.setRootNode(this.root);
22411
"beforeexpandnode",
22413
"beforecollapsenode",
22431
"beforechildrenrendered",
22445
if(this.singleExpand){
22446
this.on("beforeexpandnode", this.restrictExpand, this);
22451
proxyNodeEvent : function(ename, a1, a2, a3, a4, a5, a6){
22452
if(ename == 'collapse' || ename == 'expand' || ename == 'beforecollapse' || ename == 'beforeexpand' || ename == 'move' || ename == 'beforemove'){
22453
ename = ename+'node';
22456
return this.fireEvent(ename, a1, a2, a3, a4, a5, a6);
22461
getRootNode : function(){
22466
setRootNode : function(node){
22468
node = this.loader.createNode(node);
22471
node.ownerTree = this;
22472
node.isRoot = true;
22473
this.registerNode(node);
22474
if(!this.rootVisible){
22475
var uiP = node.attributes.uiProvider;
22476
node.ui = uiP ? new uiP(node) : new Ext.tree.RootTreeNodeUI(node);
22482
getNodeById : function(id){
22483
return this.nodeHash[id];
22487
registerNode : function(node){
22488
this.nodeHash[node.id] = node;
22492
unregisterNode : function(node){
22493
delete this.nodeHash[node.id];
22497
toString : function(){
22498
return "[Tree"+(this.id?" "+this.id:"")+"]";
22502
restrictExpand : function(node){
22503
var p = node.parentNode;
22505
if(p.expandedChild && p.expandedChild.parentNode == p){
22506
p.expandedChild.collapse();
22508
p.expandedChild = node;
22513
getChecked : function(a, startNode){
22514
startNode = startNode || this.root;
22516
var f = function(){
22517
if(this.attributes.checked){
22518
r.push(!a ? this : (a == 'id' ? this.id : this.attributes[a]));
22521
startNode.cascade(f);
22526
getEl : function(){
22531
getLoader : function(){
22532
return this.loader;
22536
expandAll : function(){
22537
this.root.expand(true);
22541
collapseAll : function(){
22542
this.root.collapse(true);
22546
getSelectionModel : function(){
22547
if(!this.selModel){
22548
this.selModel = new Ext.tree.DefaultSelectionModel();
22550
return this.selModel;
22554
expandPath : function(path, attr, callback){
22555
attr = attr || "id";
22556
var keys = path.split(this.pathSeparator);
22557
var curNode = this.root;
22558
if(curNode.attributes[attr] != keys[1]){
22560
callback(false, null);
22565
var f = function(){
22566
if(++index == keys.length){
22568
callback(true, curNode);
22572
var c = curNode.findChild(attr, keys[index]);
22575
callback(false, curNode);
22580
c.expand(false, false, f);
22582
curNode.expand(false, false, f);
22586
selectPath : function(path, attr, callback){
22587
attr = attr || "id";
22588
var keys = path.split(this.pathSeparator);
22589
var v = keys.pop();
22590
if(keys.length > 0){
22591
var f = function(success, node){
22592
if(success && node){
22593
var n = node.findChild(attr, v);
22599
}else if(callback){
22600
callback(false, n);
22604
callback(false, n);
22608
this.expandPath(keys.join(this.pathSeparator), attr, f);
22610
this.root.select();
22612
callback(true, this.root);
22618
getTreeEl : function(){
22623
onRender : function(ct, position){
22624
Ext.tree.TreePanel.superclass.onRender.call(this, ct, position);
22625
this.el.addClass('x-tree');
22626
this.innerCt = this.body.createChild({tag:"ul",
22627
cls:"x-tree-root-ct " +
22628
(this.useArrows ? 'x-tree-arrows' : this.lines ? "x-tree-lines" : "x-tree-no-lines")});
22632
initEvents : function(){
22633
Ext.tree.TreePanel.superclass.initEvents.call(this);
22635
if(this.containerScroll){
22636
Ext.dd.ScrollManager.register(this.body);
22638
if((this.enableDD || this.enableDrop) && !this.dropZone){
22640
this.dropZone = new Ext.tree.TreeDropZone(this, this.dropConfig || {
22641
ddGroup: this.ddGroup || "TreeDD", appendOnly: this.ddAppendOnly === true
22644
if((this.enableDD || this.enableDrag) && !this.dragZone){
22646
this.dragZone = new Ext.tree.TreeDragZone(this, this.dragConfig || {
22647
ddGroup: this.ddGroup || "TreeDD",
22648
scroll: this.ddScroll
22651
this.getSelectionModel().init(this);
22655
afterRender : function(){
22656
Ext.tree.TreePanel.superclass.afterRender.call(this);
22657
this.root.render();
22658
if(!this.rootVisible){
22659
this.root.renderChildren();
22663
onDestroy : function(){
22665
this.body.removeAllListeners();
22666
Ext.dd.ScrollManager.unregister(this.body);
22668
this.dropZone.unreg();
22671
this.dragZone.unreg();
22674
this.root.destroy();
22675
this.nodeHash = null;
22676
Ext.tree.TreePanel.superclass.onDestroy.call(this);
22727
Ext.tree.TreePanel.nodeTypes = {};
22729
Ext.reg('treepanel', Ext.tree.TreePanel);
22730
Ext.tree.TreeEventModel = function(tree){
22732
this.tree.on('render', this.initEvents, this);
22735
Ext.tree.TreeEventModel.prototype = {
22736
initEvents : function(){
22737
var el = this.tree.getTreeEl();
22738
el.on('click', this.delegateClick, this);
22739
if(this.tree.trackMouseOver !== false){
22740
el.on('mouseover', this.delegateOver, this);
22741
el.on('mouseout', this.delegateOut, this);
22743
el.on('dblclick', this.delegateDblClick, this);
22744
el.on('contextmenu', this.delegateContextMenu, this);
22747
getNode : function(e){
22749
if(t = e.getTarget('.x-tree-node-el', 10)){
22750
var id = Ext.fly(t, '_treeEvents').getAttributeNS('ext', 'tree-node-id');
22752
return this.tree.getNodeById(id);
22758
getNodeTarget : function(e){
22759
var t = e.getTarget('.x-tree-node-icon', 1);
22761
t = e.getTarget('.x-tree-node-el', 6);
22766
delegateOut : function(e, t){
22767
if(!this.beforeEvent(e)){
22770
if(e.getTarget('.x-tree-ec-icon', 1)){
22771
var n = this.getNode(e);
22772
this.onIconOut(e, n);
22773
if(n == this.lastEcOver){
22774
delete this.lastEcOver;
22777
if((t = this.getNodeTarget(e)) && !e.within(t, true)){
22778
this.onNodeOut(e, this.getNode(e));
22782
delegateOver : function(e, t){
22783
if(!this.beforeEvent(e)){
22786
if(this.lastEcOver){
22787
this.onIconOut(e, this.lastEcOver);
22788
delete this.lastEcOver;
22790
if(e.getTarget('.x-tree-ec-icon', 1)){
22791
this.lastEcOver = this.getNode(e);
22792
this.onIconOver(e, this.lastEcOver);
22794
if(t = this.getNodeTarget(e)){
22795
this.onNodeOver(e, this.getNode(e));
22799
delegateClick : function(e, t){
22800
if(!this.beforeEvent(e)){
22804
if(e.getTarget('input[type=checkbox]', 1)){
22805
this.onCheckboxClick(e, this.getNode(e));
22807
else if(e.getTarget('.x-tree-ec-icon', 1)){
22808
this.onIconClick(e, this.getNode(e));
22810
else if(this.getNodeTarget(e)){
22811
this.onNodeClick(e, this.getNode(e));
22815
delegateDblClick : function(e, t){
22816
if(this.beforeEvent(e) && this.getNodeTarget(e)){
22817
this.onNodeDblClick(e, this.getNode(e));
22821
delegateContextMenu : function(e, t){
22822
if(this.beforeEvent(e) && this.getNodeTarget(e)){
22823
this.onNodeContextMenu(e, this.getNode(e));
22827
onNodeClick : function(e, node){
22828
node.ui.onClick(e);
22831
onNodeOver : function(e, node){
22835
onNodeOut : function(e, node){
22839
onIconOver : function(e, node){
22840
node.ui.addClass('x-tree-ec-over');
22843
onIconOut : function(e, node){
22844
node.ui.removeClass('x-tree-ec-over');
22847
onIconClick : function(e, node){
22848
node.ui.ecClick(e);
22851
onCheckboxClick : function(e, node){
22852
node.ui.onCheckChange(e);
22855
onNodeDblClick : function(e, node){
22856
node.ui.onDblClick(e);
22859
onNodeContextMenu : function(e, node){
22860
node.ui.onContextMenu(e);
22863
beforeEvent : function(e){
22871
disable: function(){
22872
this.disabled = true;
22875
enable: function(){
22876
this.disabled = false;
22880
Ext.tree.DefaultSelectionModel = function(config){
22881
this.selNode = null;
22891
Ext.apply(this, config);
22892
Ext.tree.DefaultSelectionModel.superclass.constructor.call(this);
22895
Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {
22896
init : function(tree){
22898
tree.getTreeEl().on("keydown", this.onKeyDown, this);
22899
tree.on("click", this.onNodeClick, this);
22902
onNodeClick : function(node, e){
22907
select : function(node){
22908
var last = this.selNode;
22909
if(last != node && this.fireEvent('beforeselect', this, node, last) !== false){
22911
last.ui.onSelectedChange(false);
22913
this.selNode = node;
22914
node.ui.onSelectedChange(true);
22915
this.fireEvent("selectionchange", this, node, last);
22921
unselect : function(node){
22922
if(this.selNode == node){
22923
this.clearSelections();
22928
clearSelections : function(){
22929
var n = this.selNode;
22931
n.ui.onSelectedChange(false);
22932
this.selNode = null;
22933
this.fireEvent("selectionchange", this, null);
22939
getSelectedNode : function(){
22940
return this.selNode;
22944
isSelected : function(node){
22945
return this.selNode == node;
22949
selectPrevious : function(){
22950
var s = this.selNode || this.lastSelNode;
22954
var ps = s.previousSibling;
22956
if(!ps.isExpanded() || ps.childNodes.length < 1){
22957
return this.select(ps);
22959
var lc = ps.lastChild;
22960
while(lc && lc.isExpanded() && lc.childNodes.length > 0){
22963
return this.select(lc);
22965
} else if(s.parentNode && (this.tree.rootVisible || !s.parentNode.isRoot)){
22966
return this.select(s.parentNode);
22972
selectNext : function(){
22973
var s = this.selNode || this.lastSelNode;
22977
if(s.firstChild && s.isExpanded()){
22978
return this.select(s.firstChild);
22979
}else if(s.nextSibling){
22980
return this.select(s.nextSibling);
22981
}else if(s.parentNode){
22983
s.parentNode.bubble(function(){
22984
if(this.nextSibling){
22985
newS = this.getOwnerTree().selModel.select(this.nextSibling);
22994
onKeyDown : function(e){
22995
var s = this.selNode || this.lastSelNode;
23001
var k = e.getKey();
23009
this.selectPrevious();
23012
e.preventDefault();
23013
if(s.hasChildNodes()){
23014
if(!s.isExpanded()){
23016
}else if(s.firstChild){
23017
this.select(s.firstChild, e);
23022
e.preventDefault();
23023
if(s.hasChildNodes() && s.isExpanded()){
23025
}else if(s.parentNode && (this.tree.rootVisible || s.parentNode != this.tree.getRootNode())){
23026
this.select(s.parentNode, e);
23034
Ext.tree.MultiSelectionModel = function(config){
23035
this.selNodes = [];
23041
Ext.apply(this, config);
23042
Ext.tree.MultiSelectionModel.superclass.constructor.call(this);
23045
Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {
23046
init : function(tree){
23048
tree.getTreeEl().on("keydown", this.onKeyDown, this);
23049
tree.on("click", this.onNodeClick, this);
23052
onNodeClick : function(node, e){
23053
this.select(node, e, e.ctrlKey);
23057
select : function(node, e, keepExisting){
23058
if(keepExisting !== true){
23059
this.clearSelections(true);
23061
if(this.isSelected(node)){
23062
this.lastSelNode = node;
23065
this.selNodes.push(node);
23066
this.selMap[node.id] = node;
23067
this.lastSelNode = node;
23068
node.ui.onSelectedChange(true);
23069
this.fireEvent("selectionchange", this, this.selNodes);
23074
unselect : function(node){
23075
if(this.selMap[node.id]){
23076
node.ui.onSelectedChange(false);
23077
var sn = this.selNodes;
23078
var index = sn.indexOf(node);
23080
this.selNodes.splice(index, 1);
23082
delete this.selMap[node.id];
23083
this.fireEvent("selectionchange", this, this.selNodes);
23088
clearSelections : function(suppressEvent){
23089
var sn = this.selNodes;
23091
for(var i = 0, len = sn.length; i < len; i++){
23092
sn[i].ui.onSelectedChange(false);
23094
this.selNodes = [];
23096
if(suppressEvent !== true){
23097
this.fireEvent("selectionchange", this, this.selNodes);
23103
isSelected : function(node){
23104
return this.selMap[node.id] ? true : false;
23108
getSelectedNodes : function(){
23109
return this.selNodes;
23112
onKeyDown : Ext.tree.DefaultSelectionModel.prototype.onKeyDown,
23114
selectNext : Ext.tree.DefaultSelectionModel.prototype.selectNext,
23116
selectPrevious : Ext.tree.DefaultSelectionModel.prototype.selectPrevious
23119
Ext.tree.TreeNode = function(attributes){
23120
attributes = attributes || {};
23121
if(typeof attributes == "string"){
23122
attributes = {text: attributes};
23124
this.childrenRendered = false;
23125
this.rendered = false;
23126
Ext.tree.TreeNode.superclass.constructor.call(this, attributes);
23127
this.expanded = attributes.expanded === true;
23128
this.isTarget = attributes.isTarget !== false;
23129
this.draggable = attributes.draggable !== false && attributes.allowDrag !== false;
23130
this.allowChildren = attributes.allowChildren !== false && attributes.allowDrop !== false;
23133
this.text = attributes.text;
23135
this.disabled = attributes.disabled === true;
23161
"beforechildrenrendered"
23164
var uiClass = this.attributes.uiProvider || this.defaultUI || Ext.tree.TreeNodeUI;
23167
this.ui = new uiClass(this);
23169
Ext.extend(Ext.tree.TreeNode, Ext.data.Node, {
23170
preventHScroll: true,
23172
isExpanded : function(){
23173
return this.expanded;
23177
getUI : function(){
23181
getLoader : function(){
23183
return this.loader || ((owner = this.getOwnerTree()) && owner.loader ? owner.loader : new Ext.tree.TreeLoader());
23187
setFirstChild : function(node){
23188
var of = this.firstChild;
23189
Ext.tree.TreeNode.superclass.setFirstChild.call(this, node);
23190
if(this.childrenRendered && of && node != of){
23191
of.renderIndent(true, true);
23194
this.renderIndent(true, true);
23199
setLastChild : function(node){
23200
var ol = this.lastChild;
23201
Ext.tree.TreeNode.superclass.setLastChild.call(this, node);
23202
if(this.childrenRendered && ol && node != ol){
23203
ol.renderIndent(true, true);
23206
this.renderIndent(true, true);
23212
appendChild : function(n){
23213
if(!n.render && !Ext.isArray(n)){
23214
n = this.getLoader().createNode(n);
23216
var node = Ext.tree.TreeNode.superclass.appendChild.call(this, n);
23217
if(node && this.childrenRendered){
23220
this.ui.updateExpandIcon();
23225
removeChild : function(node){
23226
this.ownerTree.getSelectionModel().unselect(node);
23227
Ext.tree.TreeNode.superclass.removeChild.apply(this, arguments);
23229
if(this.childrenRendered){
23232
if(this.childNodes.length < 1){
23233
this.collapse(false, false);
23235
this.ui.updateExpandIcon();
23237
if(!this.firstChild && !this.isHiddenRoot()) {
23238
this.childrenRendered = false;
23244
insertBefore : function(node, refNode){
23246
node = this.getLoader().createNode(node);
23248
var newNode = Ext.tree.TreeNode.superclass.insertBefore.apply(this, arguments);
23249
if(newNode && refNode && this.childrenRendered){
23252
this.ui.updateExpandIcon();
23257
setText : function(text){
23258
var oldText = this.text;
23260
this.attributes.text = text;
23262
this.ui.onTextChange(this, text, oldText);
23264
this.fireEvent("textchange", this, text, oldText);
23268
select : function(){
23269
this.getOwnerTree().getSelectionModel().select(this);
23273
unselect : function(){
23274
this.getOwnerTree().getSelectionModel().unselect(this);
23278
isSelected : function(){
23279
return this.getOwnerTree().getSelectionModel().isSelected(this);
23283
expand : function(deep, anim, callback){
23284
if(!this.expanded){
23285
if(this.fireEvent("beforeexpand", this, deep, anim) === false){
23288
if(!this.childrenRendered){
23289
this.renderChildren();
23291
this.expanded = true;
23292
if(!this.isHiddenRoot() && (this.getOwnerTree().animate && anim !== false) || anim){
23293
this.ui.animExpand(function(){
23294
this.fireEvent("expand", this);
23295
if(typeof callback == "function"){
23299
this.expandChildNodes(true);
23301
}.createDelegate(this));
23305
this.fireEvent("expand", this);
23306
if(typeof callback == "function"){
23311
if(typeof callback == "function"){
23316
this.expandChildNodes(true);
23320
isHiddenRoot : function(){
23321
return this.isRoot && !this.getOwnerTree().rootVisible;
23325
collapse : function(deep, anim){
23326
if(this.expanded && !this.isHiddenRoot()){
23327
if(this.fireEvent("beforecollapse", this, deep, anim) === false){
23330
this.expanded = false;
23331
if((this.getOwnerTree().animate && anim !== false) || anim){
23332
this.ui.animCollapse(function(){
23333
this.fireEvent("collapse", this);
23335
this.collapseChildNodes(true);
23337
}.createDelegate(this));
23340
this.ui.collapse();
23341
this.fireEvent("collapse", this);
23345
var cs = this.childNodes;
23346
for(var i = 0, len = cs.length; i < len; i++) {
23347
cs[i].collapse(true, false);
23353
delayedExpand : function(delay){
23354
if(!this.expandProcId){
23355
this.expandProcId = this.expand.defer(delay, this);
23360
cancelExpand : function(){
23361
if(this.expandProcId){
23362
clearTimeout(this.expandProcId);
23364
this.expandProcId = false;
23368
toggle : function(){
23377
ensureVisible : function(callback){
23378
var tree = this.getOwnerTree();
23379
tree.expandPath(this.parentNode.getPath(), false, function(){
23380
var node = tree.getNodeById(this.id);
23381
tree.getTreeEl().scrollChildIntoView(node.ui.anchor);
23382
Ext.callback(callback);
23383
}.createDelegate(this));
23387
expandChildNodes : function(deep){
23388
var cs = this.childNodes;
23389
for(var i = 0, len = cs.length; i < len; i++) {
23390
cs[i].expand(deep);
23395
collapseChildNodes : function(deep){
23396
var cs = this.childNodes;
23397
for(var i = 0, len = cs.length; i < len; i++) {
23398
cs[i].collapse(deep);
23403
disable : function(){
23404
this.disabled = true;
23406
if(this.rendered && this.ui.onDisableChange){
23407
this.ui.onDisableChange(this, true);
23409
this.fireEvent("disabledchange", this, true);
23413
enable : function(){
23414
this.disabled = false;
23415
if(this.rendered && this.ui.onDisableChange){
23416
this.ui.onDisableChange(this, false);
23418
this.fireEvent("disabledchange", this, false);
23422
renderChildren : function(suppressEvent){
23423
if(suppressEvent !== false){
23424
this.fireEvent("beforechildrenrendered", this);
23426
var cs = this.childNodes;
23427
for(var i = 0, len = cs.length; i < len; i++){
23428
cs[i].render(true);
23430
this.childrenRendered = true;
23434
sort : function(fn, scope){
23435
Ext.tree.TreeNode.superclass.sort.apply(this, arguments);
23436
if(this.childrenRendered){
23437
var cs = this.childNodes;
23438
for(var i = 0, len = cs.length; i < len; i++){
23439
cs[i].render(true);
23445
render : function(bulkRender){
23446
this.ui.render(bulkRender);
23447
if(!this.rendered){
23449
this.getOwnerTree().registerNode(this);
23450
this.rendered = true;
23452
this.expanded = false;
23453
this.expand(false, false);
23459
renderIndent : function(deep, refresh){
23461
this.ui.childIndent = null;
23463
this.ui.renderIndent();
23464
if(deep === true && this.childrenRendered){
23465
var cs = this.childNodes;
23466
for(var i = 0, len = cs.length; i < len; i++){
23467
cs[i].renderIndent(true, refresh);
23472
beginUpdate : function(){
23473
this.childrenRendered = false;
23476
endUpdate : function(){
23477
if(this.expanded && this.rendered){
23478
this.renderChildren();
23482
destroy : function(){
23483
if(this.childNodes){
23484
for(var i = 0,l = this.childNodes.length; i < l; i++){
23485
this.childNodes[i].destroy();
23487
this.childNodes = null;
23489
if(this.ui.destroy){
23495
Ext.tree.TreePanel.nodeTypes.node = Ext.tree.TreeNode;
23497
Ext.tree.AsyncTreeNode = function(config){
23498
this.loaded = config && config.loaded === true;
23499
this.loading = false;
23500
Ext.tree.AsyncTreeNode.superclass.constructor.apply(this, arguments);
23502
this.addEvents('beforeload', 'load');
23506
Ext.extend(Ext.tree.AsyncTreeNode, Ext.tree.TreeNode, {
23507
expand : function(deep, anim, callback){
23510
var f = function(){
23512
clearInterval(timer);
23513
this.expand(deep, anim, callback);
23515
}.createDelegate(this);
23516
timer = setInterval(f, 200);
23520
if(this.fireEvent("beforeload", this) === false){
23523
this.loading = true;
23524
this.ui.beforeLoad(this);
23525
var loader = this.loader || this.attributes.loader || this.getOwnerTree().getLoader();
23527
loader.load(this, this.loadComplete.createDelegate(this, [deep, anim, callback]));
23531
Ext.tree.AsyncTreeNode.superclass.expand.call(this, deep, anim, callback);
23535
isLoading : function(){
23536
return this.loading;
23539
loadComplete : function(deep, anim, callback){
23540
this.loading = false;
23541
this.loaded = true;
23542
this.ui.afterLoad(this);
23543
this.fireEvent("load", this);
23544
this.expand(deep, anim, callback);
23548
isLoaded : function(){
23549
return this.loaded;
23552
hasChildNodes : function(){
23553
if(!this.isLeaf() && !this.loaded){
23556
return Ext.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);
23561
reload : function(callback){
23562
this.collapse(false, false);
23563
while(this.firstChild){
23564
this.removeChild(this.firstChild);
23566
this.childrenRendered = false;
23567
this.loaded = false;
23568
if(this.isHiddenRoot()){
23569
this.expanded = false;
23571
this.expand(false, false, callback);
23575
Ext.tree.TreePanel.nodeTypes.async = Ext.tree.AsyncTreeNode;
23577
Ext.tree.TreeNodeUI = function(node){
23579
this.rendered = false;
23580
this.animating = false;
23581
this.wasLeaf = true;
23582
this.ecc = 'x-tree-ec-icon x-tree-elbow';
23583
this.emptyIcon = Ext.BLANK_IMAGE_URL;
23586
Ext.tree.TreeNodeUI.prototype = {
23588
removeChild : function(node){
23590
this.ctNode.removeChild(node.ui.getEl());
23595
beforeLoad : function(){
23596
this.addClass("x-tree-node-loading");
23600
afterLoad : function(){
23601
this.removeClass("x-tree-node-loading");
23605
onTextChange : function(node, text, oldText){
23607
this.textNode.innerHTML = text;
23612
onDisableChange : function(node, state){
23613
this.disabled = state;
23614
if (this.checkbox) {
23615
this.checkbox.disabled = state;
23618
this.addClass("x-tree-node-disabled");
23620
this.removeClass("x-tree-node-disabled");
23625
onSelectedChange : function(state){
23628
this.addClass("x-tree-selected");
23631
this.removeClass("x-tree-selected");
23636
onMove : function(tree, node, oldParent, newParent, index, refNode){
23637
this.childIndent = null;
23639
var targetNode = newParent.ui.getContainer();
23641
this.holder = document.createElement("div");
23642
this.holder.appendChild(this.wrap);
23645
var insertBefore = refNode ? refNode.ui.getEl() : null;
23647
targetNode.insertBefore(this.wrap, insertBefore);
23649
targetNode.appendChild(this.wrap);
23651
this.node.renderIndent(true);
23656
addClass : function(cls){
23658
Ext.fly(this.elNode).addClass(cls);
23663
removeClass : function(cls){
23665
Ext.fly(this.elNode).removeClass(cls);
23670
remove : function(){
23672
this.holder = document.createElement("div");
23673
this.holder.appendChild(this.wrap);
23678
fireEvent : function(){
23679
return this.node.fireEvent.apply(this.node, arguments);
23683
initEvents : function(){
23684
this.node.on("move", this.onMove, this);
23686
if(this.node.disabled){
23687
this.addClass("x-tree-node-disabled");
23688
if (this.checkbox) {
23689
this.checkbox.disabled = true;
23692
if(this.node.hidden){
23695
var ot = this.node.getOwnerTree();
23696
var dd = ot.enableDD || ot.enableDrag || ot.enableDrop;
23697
if(dd && (!this.node.isRoot || ot.rootVisible)){
23698
Ext.dd.Registry.register(this.elNode, {
23700
handles: this.getDDHandles(),
23707
getDDHandles : function(){
23708
return [this.iconNode, this.textNode, this.elNode];
23713
this.node.hidden = true;
23715
this.wrap.style.display = "none";
23721
this.node.hidden = false;
23723
this.wrap.style.display = "";
23728
onContextMenu : function(e){
23729
if (this.node.hasListener("contextmenu") || this.node.getOwnerTree().hasListener("contextmenu")) {
23730
e.preventDefault();
23732
this.fireEvent("contextmenu", this.node, e);
23737
onClick : function(e){
23742
if(this.fireEvent("beforeclick", this.node, e) !== false){
23743
var a = e.getTarget('a');
23744
if(!this.disabled && this.node.attributes.href && a){
23745
this.fireEvent("click", this.node, e);
23747
}else if(a && e.ctrlKey){
23750
e.preventDefault();
23755
if(this.node.attributes.singleClickExpand && !this.animating && this.node.isExpandable()){
23756
this.node.toggle();
23759
this.fireEvent("click", this.node, e);
23766
onDblClick : function(e){
23767
e.preventDefault();
23772
this.toggleCheck();
23774
if(!this.animating && this.node.isExpandable()){
23775
this.node.toggle();
23777
this.fireEvent("dblclick", this.node, e);
23780
onOver : function(e){
23781
this.addClass('x-tree-node-over');
23784
onOut : function(e){
23785
this.removeClass('x-tree-node-over');
23789
onCheckChange : function(){
23790
var checked = this.checkbox.checked;
23792
this.checkbox.defaultChecked = checked;
23793
this.node.attributes.checked = checked;
23794
this.fireEvent('checkchange', this.node, checked);
23798
ecClick : function(e){
23799
if(!this.animating && this.node.isExpandable()){
23800
this.node.toggle();
23805
startDrop : function(){
23806
this.dropping = true;
23810
endDrop : function(){
23811
setTimeout(function(){
23812
this.dropping = false;
23813
}.createDelegate(this), 50);
23817
expand : function(){
23818
this.updateExpandIcon();
23819
this.ctNode.style.display = "";
23823
focus : function(){
23824
if(!this.node.preventHScroll){
23825
try{this.anchor.focus();
23827
}else if(!Ext.isIE){
23829
var noscroll = this.node.getOwnerTree().getTreeEl().dom;
23830
var l = noscroll.scrollLeft;
23831
this.anchor.focus();
23832
noscroll.scrollLeft = l;
23838
toggleCheck : function(value){
23839
var cb = this.checkbox;
23841
cb.checked = (value === undefined ? !cb.checked : value);
23842
this.onCheckChange();
23849
this.anchor.blur();
23854
animExpand : function(callback){
23855
var ct = Ext.get(this.ctNode);
23857
if(!this.node.isExpandable()){
23858
this.updateExpandIcon();
23859
this.ctNode.style.display = "";
23860
Ext.callback(callback);
23863
this.animating = true;
23864
this.updateExpandIcon();
23867
callback : function(){
23868
this.animating = false;
23869
Ext.callback(callback);
23872
duration: this.node.ownerTree.duration || .25
23877
highlight : function(){
23878
var tree = this.node.getOwnerTree();
23879
Ext.fly(this.wrap).highlight(
23880
tree.hlColor || "C3DAF9",
23881
{endColor: tree.hlBaseColor}
23886
collapse : function(){
23887
this.updateExpandIcon();
23888
this.ctNode.style.display = "none";
23892
animCollapse : function(callback){
23893
var ct = Ext.get(this.ctNode);
23894
ct.enableDisplayMode('block');
23897
this.animating = true;
23898
this.updateExpandIcon();
23901
callback : function(){
23902
this.animating = false;
23903
Ext.callback(callback);
23906
duration: this.node.ownerTree.duration || .25
23911
getContainer : function(){
23912
return this.ctNode;
23916
getEl : function(){
23921
appendDDGhost : function(ghostNode){
23922
ghostNode.appendChild(this.elNode.cloneNode(true));
23926
getDDRepairXY : function(){
23927
return Ext.lib.Dom.getXY(this.iconNode);
23931
onRender : function(){
23936
render : function(bulkRender){
23937
var n = this.node, a = n.attributes;
23938
var targetNode = n.parentNode ?
23939
n.parentNode.ui.getContainer() : n.ownerTree.innerCt.dom;
23941
if(!this.rendered){
23942
this.rendered = true;
23944
this.renderElements(n, a, targetNode, bulkRender);
23947
if(this.textNode.setAttributeNS){
23948
this.textNode.setAttributeNS("ext", "qtip", a.qtip);
23950
this.textNode.setAttributeNS("ext", "qtitle", a.qtipTitle);
23953
this.textNode.setAttribute("ext:qtip", a.qtip);
23955
this.textNode.setAttribute("ext:qtitle", a.qtipTitle);
23958
}else if(a.qtipCfg){
23959
a.qtipCfg.target = Ext.id(this.textNode);
23960
Ext.QuickTips.register(a.qtipCfg);
23963
if(!this.node.expanded){
23964
this.updateExpandIcon(true);
23967
if(bulkRender === true) {
23968
targetNode.appendChild(this.wrap);
23974
renderElements : function(n, a, targetNode, bulkRender){
23976
this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
23978
var cb = typeof a.checked == 'boolean';
23980
var href = a.href ? a.href : Ext.isGecko ? "" : "#";
23981
var buf = ['<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ', a.cls,'" unselectable="on">',
23982
'<span class="x-tree-node-indent">',this.indentMarkup,"</span>",
23983
'<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow" />',
23984
'<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " "+a.iconCls : ""),'" unselectable="on" />',
23985
cb ? ('<input class="x-tree-node-cb" type="checkbox" ' + (a.checked ? 'checked="checked" />' : '/>')) : '',
23986
'<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ',
23987
a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '><span unselectable="on">',n.text,"</span></a></div>",
23988
'<ul class="x-tree-node-ct" style="display:none;"></ul>',
23992
if(bulkRender !== true && n.nextSibling && (nel = n.nextSibling.ui.getEl())){
23993
this.wrap = Ext.DomHelper.insertHtml("beforeBegin", nel, buf);
23995
this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf);
23998
this.elNode = this.wrap.childNodes[0];
23999
this.ctNode = this.wrap.childNodes[1];
24000
var cs = this.elNode.childNodes;
24001
this.indentNode = cs[0];
24002
this.ecNode = cs[1];
24003
this.iconNode = cs[2];
24006
this.checkbox = cs[3];
24008
this.checkbox.defaultChecked = this.checkbox.checked;
24011
this.anchor = cs[index];
24012
this.textNode = cs[index].firstChild;
24016
getAnchor : function(){
24017
return this.anchor;
24021
getTextEl : function(){
24022
return this.textNode;
24026
getIconEl : function(){
24027
return this.iconNode;
24031
isChecked : function(){
24032
return this.checkbox ? this.checkbox.checked : false;
24036
updateExpandIcon : function(){
24038
var n = this.node, c1, c2;
24039
var cls = n.isLast() ? "x-tree-elbow-end" : "x-tree-elbow";
24040
if(n.isExpandable()){
24043
c1 = "x-tree-node-collapsed";
24044
c2 = "x-tree-node-expanded";
24047
c1 = "x-tree-node-expanded";
24048
c2 = "x-tree-node-collapsed";
24051
this.removeClass("x-tree-node-leaf");
24052
this.wasLeaf = false;
24054
if(this.c1 != c1 || this.c2 != c2){
24055
Ext.fly(this.elNode).replaceClass(c1, c2);
24056
this.c1 = c1; this.c2 = c2;
24060
Ext.fly(this.elNode).replaceClass("x-tree-node-expanded", "x-tree-node-leaf");
24063
this.wasLeaf = true;
24066
var ecc = "x-tree-ec-icon "+cls;
24067
if(this.ecc != ecc){
24068
this.ecNode.className = ecc;
24075
getChildIndent : function(){
24076
if(!this.childIndent){
24080
if(!p.isRoot || (p.isRoot && p.ownerTree.rootVisible)){
24082
buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-elbow-line" />');
24084
buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-icon" />');
24089
this.childIndent = buf.join("");
24091
return this.childIndent;
24095
renderIndent : function(){
24098
var p = this.node.parentNode;
24100
indent = p.ui.getChildIndent();
24102
if(this.indentMarkup != indent){
24103
this.indentNode.innerHTML = indent;
24104
this.indentMarkup = indent;
24106
this.updateExpandIcon();
24110
destroy : function(){
24112
Ext.dd.Registry.unregister(this.elNode.id);
24114
delete this.elNode;
24115
delete this.ctNode;
24116
delete this.indentNode;
24117
delete this.ecNode;
24118
delete this.iconNode;
24119
delete this.checkbox;
24120
delete this.anchor;
24121
delete this.textNode;
24122
Ext.removeNode(this.ctNode);
24127
Ext.tree.RootTreeNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
24129
render : function(){
24130
if(!this.rendered){
24131
var targetNode = this.node.ownerTree.innerCt.dom;
24132
this.node.expanded = true;
24133
targetNode.innerHTML = '<div class="x-tree-root-node"></div>';
24134
this.wrap = this.ctNode = targetNode.firstChild;
24137
collapse : Ext.emptyFn,
24138
expand : Ext.emptyFn
24141
Ext.tree.TreeLoader = function(config){
24142
this.baseParams = {};
24143
Ext.apply(this, config);
24154
Ext.tree.TreeLoader.superclass.constructor.call(this);
24157
Ext.extend(Ext.tree.TreeLoader, Ext.util.Observable, {
24168
clearOnLoad : true,
24171
load : function(node, callback){
24172
if(this.clearOnLoad){
24173
while(node.firstChild){
24174
node.removeChild(node.firstChild);
24177
if(this.doPreload(node)){
24178
if(typeof callback == "function"){
24181
}else if(this.dataUrl||this.url){
24182
this.requestData(node, callback);
24186
doPreload : function(node){
24187
if(node.attributes.children){
24188
if(node.childNodes.length < 1){
24189
var cs = node.attributes.children;
24190
node.beginUpdate();
24191
for(var i = 0, len = cs.length; i < len; i++){
24192
var cn = node.appendChild(this.createNode(cs[i]));
24193
if(this.preloadChildren){
24194
this.doPreload(cn);
24205
getParams: function(node){
24206
var buf = [], bp = this.baseParams;
24207
for(var key in bp){
24208
if(typeof bp[key] != "function"){
24209
buf.push(encodeURIComponent(key), "=", encodeURIComponent(bp[key]), "&");
24212
buf.push("node=", encodeURIComponent(node.id));
24213
return buf.join("");
24216
requestData : function(node, callback){
24217
if(this.fireEvent("beforeload", this, node, callback) !== false){
24218
this.transId = Ext.Ajax.request({
24219
method:this.requestMethod,
24220
url: this.dataUrl||this.url,
24221
success: this.handleResponse,
24222
failure: this.handleFailure,
24224
argument: {callback: callback, node: node},
24225
params: this.getParams(node)
24230
if(typeof callback == "function"){
24236
isLoading : function(){
24237
return !!this.transId;
24240
abort : function(){
24241
if(this.isLoading()){
24242
Ext.Ajax.abort(this.transId);
24247
createNode : function(attr){
24249
if(this.baseAttrs){
24250
Ext.applyIf(attr, this.baseAttrs);
24252
if(this.applyLoader !== false){
24253
attr.loader = this;
24255
if(typeof attr.uiProvider == 'string'){
24256
attr.uiProvider = this.uiProviders[attr.uiProvider] || eval(attr.uiProvider);
24259
return new Ext.tree.TreePanel.nodeTypes[attr.nodeType](attr);
24262
new Ext.tree.TreeNode(attr) :
24263
new Ext.tree.AsyncTreeNode(attr);
24267
processResponse : function(response, node, callback){
24268
var json = response.responseText;
24270
var o = eval("("+json+")");
24271
node.beginUpdate();
24272
for(var i = 0, len = o.length; i < len; i++){
24273
var n = this.createNode(o[i]);
24275
node.appendChild(n);
24279
if(typeof callback == "function"){
24280
callback(this, node);
24283
this.handleFailure(response);
24287
handleResponse : function(response){
24288
this.transId = false;
24289
var a = response.argument;
24290
this.processResponse(response, a.node, a.callback);
24291
this.fireEvent("load", this, a.node, response);
24294
handleFailure : function(response){
24295
this.transId = false;
24296
var a = response.argument;
24297
this.fireEvent("loadexception", this, a.node, response);
24298
if(typeof a.callback == "function"){
24299
a.callback(this, a.node);
24304
Ext.tree.TreeFilter = function(tree, config){
24306
this.filtered = {};
24307
Ext.apply(this, config);
24310
Ext.tree.TreeFilter.prototype = {
24317
filter : function(value, attr, startNode){
24318
attr = attr || "text";
24320
if(typeof value == "string"){
24321
var vlen = value.length;
24323
if(vlen == 0 && this.clearBlank){
24327
value = value.toLowerCase();
24329
return n.attributes[attr].substr(0, vlen).toLowerCase() == value;
24331
}else if(value.exec){
24333
return value.test(n.attributes[attr]);
24336
throw 'Illegal filter type, must be string or regex';
24338
this.filterBy(f, null, startNode);
24342
filterBy : function(fn, scope, startNode){
24343
startNode = startNode || this.tree.root;
24344
if(this.autoClear){
24347
var af = this.filtered, rv = this.reverse;
24348
var f = function(n){
24349
if(n == startNode){
24355
var m = fn.call(scope || n, n);
24363
startNode.cascade(f);
24366
if(typeof id != "function"){
24368
if(n && n.parentNode){
24369
n.parentNode.removeChild(n);
24377
clear : function(){
24379
var af = this.filtered;
24381
if(typeof id != "function"){
24388
this.filtered = {};
24393
Ext.tree.TreeSorter = function(tree, config){
24401
Ext.apply(this, config);
24402
tree.on("beforechildrenrendered", this.doSort, this);
24403
tree.on("append", this.updateSort, this);
24404
tree.on("insert", this.updateSort, this);
24405
tree.on("textchange", this.updateSortParent, this);
24407
var dsc = this.dir && this.dir.toLowerCase() == "desc";
24408
var p = this.property || "text";
24409
var sortType = this.sortType;
24410
var fs = this.folderSort;
24411
var cs = this.caseSensitive === true;
24412
var leafAttr = this.leafAttr || 'leaf';
24414
this.sortFn = function(n1, n2){
24416
if(n1.attributes[leafAttr] && !n2.attributes[leafAttr]){
24419
if(!n1.attributes[leafAttr] && n2.attributes[leafAttr]){
24423
var v1 = sortType ? sortType(n1) : (cs ? n1.attributes[p] : n1.attributes[p].toUpperCase());
24424
var v2 = sortType ? sortType(n2) : (cs ? n2.attributes[p] : n2.attributes[p].toUpperCase());
24426
return dsc ? +1 : -1;
24428
return dsc ? -1 : +1;
24435
Ext.tree.TreeSorter.prototype = {
24436
doSort : function(node){
24437
node.sort(this.sortFn);
24440
compareNodes : function(n1, n2){
24441
return (n1.text.toUpperCase() > n2.text.toUpperCase() ? 1 : -1);
24444
updateSort : function(tree, node){
24445
if(node.childrenRendered){
24446
this.doSort.defer(1, this, [node]);
24450
updateSortParent : function(node){
24451
var p = node.parentNode;
24452
if(p && p.childrenRendered){
24453
this.doSort.defer(1, this, [p]);
24458
if(Ext.dd.DropZone){
24460
Ext.tree.TreeDropZone = function(tree, config){
24462
this.allowParentInsert = false;
24464
this.allowContainerDrop = false;
24466
this.appendOnly = false;
24467
Ext.tree.TreeDropZone.superclass.constructor.call(this, tree.innerCt, config);
24471
this.dragOverData = {};
24473
this.lastInsertClass = "x-tree-no-status";
24476
Ext.extend(Ext.tree.TreeDropZone, Ext.dd.DropZone, {
24478
ddGroup : "TreeDD",
24481
expandDelay : 1000,
24484
expandNode : function(node){
24485
if(node.hasChildNodes() && !node.isExpanded()){
24486
node.expand(false, null, this.triggerCacheRefresh.createDelegate(this));
24491
queueExpand : function(node){
24492
this.expandProcId = this.expandNode.defer(this.expandDelay, this, [node]);
24496
cancelExpand : function(){
24497
if(this.expandProcId){
24498
clearTimeout(this.expandProcId);
24499
this.expandProcId = false;
24504
isValidDropPoint : function(n, pt, dd, e, data){
24505
if(!n || !data){ return false; }
24506
var targetNode = n.node;
24507
var dropNode = data.node;
24509
if(!(targetNode && targetNode.isTarget && pt)){
24512
if(pt == "append" && targetNode.allowChildren === false){
24515
if((pt == "above" || pt == "below") && (targetNode.parentNode && targetNode.parentNode.allowChildren === false)){
24518
if(dropNode && (targetNode == dropNode || dropNode.contains(targetNode))){
24522
var overEvent = this.dragOverData;
24523
overEvent.tree = this.tree;
24524
overEvent.target = targetNode;
24525
overEvent.data = data;
24526
overEvent.point = pt;
24527
overEvent.source = dd;
24528
overEvent.rawEvent = e;
24529
overEvent.dropNode = dropNode;
24530
overEvent.cancel = false;
24531
var result = this.tree.fireEvent("nodedragover", overEvent);
24532
return overEvent.cancel === false && result !== false;
24536
getDropPoint : function(e, n, dd){
24539
return tn.allowChildren !== false ? "append" : false;
24541
var dragEl = n.ddel;
24542
var t = Ext.lib.Dom.getY(dragEl), b = t + dragEl.offsetHeight;
24543
var y = Ext.lib.Event.getPageY(e);
24544
var noAppend = tn.allowChildren === false || tn.isLeaf();
24545
if(this.appendOnly || tn.parentNode.allowChildren === false){
24546
return noAppend ? false : "append";
24548
var noBelow = false;
24549
if(!this.allowParentInsert){
24550
noBelow = tn.hasChildNodes() && tn.isExpanded();
24552
var q = (b - t) / (noAppend ? 2 : 3);
24553
if(y >= t && y < (t + q)){
24555
}else if(!noBelow && (noAppend || y >= b-q && y <= b)){
24563
onNodeEnter : function(n, dd, e, data){
24564
this.cancelExpand();
24568
onNodeOver : function(n, dd, e, data){
24569
var pt = this.getDropPoint(e, n, dd);
24573
if(!this.expandProcId && pt == "append" && node.hasChildNodes() && !n.node.isExpanded()){
24574
this.queueExpand(node);
24575
}else if(pt != "append"){
24576
this.cancelExpand();
24580
var returnCls = this.dropNotAllowed;
24581
if(this.isValidDropPoint(n, pt, dd, e, data)){
24586
returnCls = n.node.isFirst() ? "x-tree-drop-ok-above" : "x-tree-drop-ok-between";
24587
cls = "x-tree-drag-insert-above";
24588
}else if(pt == "below"){
24589
returnCls = n.node.isLast() ? "x-tree-drop-ok-below" : "x-tree-drop-ok-between";
24590
cls = "x-tree-drag-insert-below";
24592
returnCls = "x-tree-drop-ok-append";
24593
cls = "x-tree-drag-append";
24595
if(this.lastInsertClass != cls){
24596
Ext.fly(el).replaceClass(this.lastInsertClass, cls);
24597
this.lastInsertClass = cls;
24605
onNodeOut : function(n, dd, e, data){
24606
this.cancelExpand();
24607
this.removeDropIndicators(n);
24611
onNodeDrop : function(n, dd, e, data){
24612
var point = this.getDropPoint(e, n, dd);
24613
var targetNode = n.node;
24614
targetNode.ui.startDrop();
24615
if(!this.isValidDropPoint(n, point, dd, e, data)){
24616
targetNode.ui.endDrop();
24620
var dropNode = data.node || (dd.getTreeNode ? dd.getTreeNode(data, targetNode, point, e) : null);
24623
target: targetNode,
24628
dropNode: dropNode,
24632
var retval = this.tree.fireEvent("beforenodedrop", dropEvent);
24633
if(retval === false || dropEvent.cancel === true || !dropEvent.dropNode){
24634
targetNode.ui.endDrop();
24635
return dropEvent.dropStatus;
24638
targetNode = dropEvent.target;
24639
if(point == "append" && !targetNode.isExpanded()){
24640
targetNode.expand(false, null, function(){
24641
this.completeDrop(dropEvent);
24642
}.createDelegate(this));
24644
this.completeDrop(dropEvent);
24650
completeDrop : function(de){
24651
var ns = de.dropNode, p = de.point, t = de.target;
24652
if(!Ext.isArray(ns)){
24656
for(var i = 0, len = ns.length; i < len; i++){
24659
t.parentNode.insertBefore(n, t);
24660
}else if(p == "below"){
24661
t.parentNode.insertBefore(n, t.nextSibling);
24667
if(Ext.enableFx && this.tree.hlDrop){
24671
this.tree.fireEvent("nodedrop", de);
24675
afterNodeMoved : function(dd, data, e, targetNode, dropNode){
24676
if(Ext.enableFx && this.tree.hlDrop){
24677
dropNode.ui.focus();
24678
dropNode.ui.highlight();
24680
this.tree.fireEvent("nodedrop", this.tree, targetNode, data, dd, e);
24684
getTree : function(){
24689
removeDropIndicators : function(n){
24692
Ext.fly(el).removeClass([
24693
"x-tree-drag-insert-above",
24694
"x-tree-drag-insert-below",
24695
"x-tree-drag-append"]);
24696
this.lastInsertClass = "_noclass";
24701
beforeDragDrop : function(target, e, id){
24702
this.cancelExpand();
24707
afterRepair : function(data){
24708
if(data && Ext.enableFx){
24709
data.node.ui.highlight();
24717
if(Ext.dd.DragZone){
24718
Ext.tree.TreeDragZone = function(tree, config){
24719
Ext.tree.TreeDragZone.superclass.constructor.call(this, tree.getTreeEl(), config);
24724
Ext.extend(Ext.tree.TreeDragZone, Ext.dd.DragZone, {
24726
ddGroup : "TreeDD",
24729
onBeforeDrag : function(data, e){
24731
return n && n.draggable && !n.disabled;
24735
onInitDrag : function(e){
24736
var data = this.dragData;
24737
this.tree.getSelectionModel().select(data.node);
24738
this.tree.eventModel.disable();
24739
this.proxy.update("");
24740
data.node.ui.appendDDGhost(this.proxy.ghost.dom);
24741
this.tree.fireEvent("startdrag", this.tree, data.node, e);
24745
getRepairXY : function(e, data){
24746
return data.node.ui.getDDRepairXY();
24750
onEndDrag : function(data, e){
24751
this.tree.eventModel.enable.defer(100, this.tree.eventModel);
24752
this.tree.fireEvent("enddrag", this.tree, data.node, e);
24756
onValidDrop : function(dd, e, id){
24757
this.tree.fireEvent("dragdrop", this.tree, this.dragData.node, dd, e);
24762
beforeInvalidDrop : function(e, id){
24764
var sm = this.tree.getSelectionModel();
24765
sm.clearSelections();
24766
sm.select(this.dragData.node);
24770
afterRepair : function(){
24771
if (Ext.enableFx && this.tree.hlDrop) {
24772
Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9");
24774
this.dragging = false;
24779
Ext.tree.TreeEditor = function(tree, fc, config){
24781
var field = fc.events ? fc : new Ext.form.TextField(fc);
24782
Ext.tree.TreeEditor.superclass.constructor.call(this, field, config);
24786
if(!tree.rendered){
24787
tree.on('render', this.initEditor, this);
24789
this.initEditor(tree);
24793
Ext.extend(Ext.tree.TreeEditor, Ext.Editor, {
24800
cls: "x-small-editor x-tree-editor",
24809
initEditor : function(tree){
24810
tree.on('beforeclick', this.beforeNodeClick, this);
24811
tree.on('dblclick', this.onNodeDblClick, this);
24812
this.on('complete', this.updateNode, this);
24813
this.on('beforestartedit', this.fitToTree, this);
24814
this.on('startedit', this.bindScroll, this, {delay:10});
24815
this.on('specialkey', this.onSpecialKey, this);
24818
fitToTree : function(ed, el){
24819
var td = this.tree.getTreeEl().dom, nd = el.dom;
24820
if(td.scrollLeft > nd.offsetLeft){ td.scrollLeft = nd.offsetLeft;
24824
(td.clientWidth > 20 ? td.clientWidth : td.offsetWidth) - Math.max(0, nd.offsetLeft-td.scrollLeft) - 5);
24825
this.setSize(w, '');
24828
triggerEdit : function(node, defer){
24829
this.completeEdit();
24830
if(node.attributes.editable !== false){
24832
this.editNode = node;
24833
if(this.tree.autoScroll){
24834
node.ui.getEl().scrollIntoView(this.tree.body);
24836
this.autoEditTimer = this.startEdit.defer(this.editDelay, this, [node.ui.textNode, node.text]);
24841
bindScroll : function(){
24842
this.tree.getTreeEl().on('scroll', this.cancelEdit, this);
24845
beforeNodeClick : function(node, e){
24846
clearTimeout(this.autoEditTimer);
24847
if(this.tree.getSelectionModel().isSelected(node)){
24849
return this.triggerEdit(node);
24853
onNodeDblClick : function(node, e){
24854
clearTimeout(this.autoEditTimer);
24857
updateNode : function(ed, value){
24858
this.tree.getTreeEl().un('scroll', this.cancelEdit, this);
24859
this.editNode.setText(value);
24862
onHide : function(){
24863
Ext.tree.TreeEditor.superclass.onHide.call(this);
24865
this.editNode.ui.focus.defer(50, this.editNode.ui);
24869
onSpecialKey : function(field, e){
24870
var k = e.getKey();
24874
}else if(k == e.ENTER && !e.hasModifier()){
24876
this.completeEdit();
24881
Ext.menu.Menu = function(config){
24882
if(Ext.isArray(config)){
24883
config = {items:config};
24885
Ext.apply(this, config);
24886
this.id = this.id || Ext.id();
24905
Ext.menu.MenuMgr.register(this);
24906
Ext.menu.Menu.superclass.constructor.call(this);
24907
var mis = this.items;
24910
this.items = new Ext.util.MixedCollection();
24912
this.add.apply(this, mis);
24916
Ext.extend(Ext.menu.Menu, Ext.util.Observable, {
24924
subMenuAlign : "tl-tr?",
24926
defaultAlign : "tl-bl?",
24928
allowOtherMenus : false,
24930
ignoreParentClicks : false,
24934
createEl : function(){
24935
return new Ext.Layer({
24937
shadow:this.shadow,
24939
parentEl: this.parentEl || document.body,
24944
render : function(){
24948
var el = this.el = this.createEl();
24951
this.keyNav = new Ext.menu.MenuNav(this);
24954
el.addClass("x-menu-plain");
24957
el.addClass(this.cls);
24959
this.focusEl = el.createChild({
24960
tag: "a", cls: "x-menu-focus", href: "#", onclick: "return false;", tabIndex:"-1"
24962
var ul = el.createChild({tag: "ul", cls: "x-menu-list"});
24963
ul.on("click", this.onClick, this);
24964
ul.on("mouseover", this.onMouseOver, this);
24965
ul.on("mouseout", this.onMouseOut, this);
24966
this.items.each(function(item){
24967
var li = document.createElement("li");
24968
li.className = "x-menu-list-item";
24969
ul.dom.appendChild(li);
24970
item.render(li, this);
24976
autoWidth : function(){
24977
var el = this.el, ul = this.ul;
24981
var w = this.width;
24984
}else if(Ext.isIE){
24985
el.setWidth(this.minWidth);
24986
var t = el.dom.offsetWidth; el.setWidth(ul.getWidth()+el.getFrameWidth("lr"));
24990
delayAutoWidth : function(){
24993
this.awTask = new Ext.util.DelayedTask(this.autoWidth, this);
24995
this.awTask.delay(20);
24999
findTargetItem : function(e){
25000
var t = e.getTarget(".x-menu-list-item", this.ul, true);
25001
if(t && t.menuItemId){
25002
return this.items.get(t.menuItemId);
25006
onClick : function(e){
25008
if(t = this.findTargetItem(e)){
25009
if(t.menu && this.ignoreParentClicks){
25013
this.fireEvent("click", this, t, e);
25018
setActiveItem : function(item, autoExpand){
25019
if(item != this.activeItem){
25020
if(this.activeItem){
25021
this.activeItem.deactivate();
25023
this.activeItem = item;
25024
item.activate(autoExpand);
25025
}else if(autoExpand){
25030
tryActivate : function(start, step){
25031
var items = this.items;
25032
for(var i = start, len = items.length; i >= 0 && i < len; i+= step){
25033
var item = items.get(i);
25034
if(!item.disabled && item.canActivate){
25035
this.setActiveItem(item, false);
25042
onMouseOver : function(e){
25044
if(t = this.findTargetItem(e)){
25045
if(t.canActivate && !t.disabled){
25046
this.setActiveItem(t, true);
25050
this.fireEvent("mouseover", this, e, t);
25053
onMouseOut : function(e){
25055
if(t = this.findTargetItem(e)){
25056
if(t == this.activeItem && t.shouldDeactivate(e)){
25057
this.activeItem.deactivate();
25058
delete this.activeItem;
25062
this.fireEvent("mouseout", this, e, t);
25066
isVisible : function(){
25067
return this.el && !this.hidden;
25071
show : function(el, pos, parentMenu){
25072
this.parentMenu = parentMenu;
25076
this.fireEvent("beforeshow", this);
25077
this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign), parentMenu, false);
25081
showAt : function(xy, parentMenu, _e){
25082
this.parentMenu = parentMenu;
25087
this.fireEvent("beforeshow", this);
25088
xy = this.el.adjustForConstraints(xy);
25092
this.hidden = false;
25094
this.fireEvent("show", this);
25099
focus : function(){
25101
this.doFocus.defer(50, this);
25105
doFocus : function(){
25107
this.focusEl.focus();
25112
hide : function(deep){
25113
if(this.el && this.isVisible()){
25114
this.fireEvent("beforehide", this);
25115
if(this.activeItem){
25116
this.activeItem.deactivate();
25117
this.activeItem = null;
25120
this.hidden = true;
25121
this.fireEvent("hide", this);
25123
if(deep === true && this.parentMenu){
25124
this.parentMenu.hide(true);
25130
var a = arguments, l = a.length, item;
25131
for(var i = 0; i < l; i++){
25133
if(el.render){ item = this.addItem(el);
25134
}else if(typeof el == "string"){ if(el == "separator" || el == "-"){
25135
item = this.addSeparator();
25137
item = this.addText(el);
25139
}else if(el.tagName || el.el){ item = this.addElement(el);
25140
}else if(typeof el == "object"){ Ext.applyIf(el, this.defaults);
25141
item = this.addMenuItem(el);
25148
getEl : function(){
25156
addSeparator : function(){
25157
return this.addItem(new Ext.menu.Separator());
25161
addElement : function(el){
25162
return this.addItem(new Ext.menu.BaseItem(el));
25166
addItem : function(item){
25167
this.items.add(item);
25169
var li = document.createElement("li");
25170
li.className = "x-menu-list-item";
25171
this.ul.dom.appendChild(li);
25172
item.render(li, this);
25173
this.delayAutoWidth();
25179
addMenuItem : function(config){
25180
if(!(config instanceof Ext.menu.Item)){
25181
if(typeof config.checked == "boolean"){ config = new Ext.menu.CheckItem(config);
25183
config = new Ext.menu.Item(config);
25186
return this.addItem(config);
25190
addText : function(text){
25191
return this.addItem(new Ext.menu.TextItem(text));
25195
insert : function(index, item){
25196
this.items.insert(index, item);
25198
var li = document.createElement("li");
25199
li.className = "x-menu-list-item";
25200
this.ul.dom.insertBefore(li, this.ul.dom.childNodes[index]);
25201
item.render(li, this);
25202
this.delayAutoWidth();
25208
remove : function(item){
25209
this.items.removeKey(item.id);
25214
removeAll : function(){
25217
while(f = this.items.first()){
25224
destroy : function(){
25225
this.beforeDestroy();
25226
Ext.menu.MenuMgr.unregister(this);
25228
this.keyNav.disable();
25232
this.ul.removeAllListeners();
25239
beforeDestroy : Ext.emptyFn
25243
Ext.menu.MenuNav = function(menu){
25244
Ext.menu.MenuNav.superclass.constructor.call(this, menu.el);
25245
this.scope = this.menu = menu;
25248
Ext.extend(Ext.menu.MenuNav, Ext.KeyNav, {
25249
doRelay : function(e, h){
25250
var k = e.getKey();
25251
if(!this.menu.activeItem && e.isNavKeyPress() && k != e.SPACE && k != e.RETURN){
25252
this.menu.tryActivate(0, 1);
25255
return h.call(this.scope || this, e, this.menu);
25258
up : function(e, m){
25259
if(!m.tryActivate(m.items.indexOf(m.activeItem)-1, -1)){
25260
m.tryActivate(m.items.length-1, -1);
25264
down : function(e, m){
25265
if(!m.tryActivate(m.items.indexOf(m.activeItem)+1, 1)){
25266
m.tryActivate(0, 1);
25270
right : function(e, m){
25272
m.activeItem.expandMenu(true);
25276
left : function(e, m){
25278
if(m.parentMenu && m.parentMenu.activeItem){
25279
m.parentMenu.activeItem.activate();
25283
enter : function(e, m){
25285
e.stopPropagation();
25286
m.activeItem.onClick(e);
25287
m.fireEvent("click", this, m.activeItem);
25293
Ext.menu.MenuMgr = function(){
25294
var menus, active, groups = {}, attached = false, lastShow = new Date();
25298
active = new Ext.util.MixedCollection();
25299
Ext.getDoc().addKeyListener(27, function(){
25300
if(active.length > 0){
25306
function hideAll(){
25307
if(active && active.length > 0){
25308
var c = active.clone();
25309
c.each(function(m){
25315
function onHide(m){
25317
if(active.length < 1){
25318
Ext.getDoc().un("mousedown", onMouseDown);
25323
function onShow(m){
25324
var last = active.last();
25325
lastShow = new Date();
25328
Ext.getDoc().on("mousedown", onMouseDown);
25332
m.getEl().setZIndex(parseInt(m.parentMenu.getEl().getStyle("z-index"), 10) + 3);
25333
m.parentMenu.activeChild = m;
25334
}else if(last && last.isVisible()){
25335
m.getEl().setZIndex(parseInt(last.getEl().getStyle("z-index"), 10) + 3);
25339
function onBeforeHide(m){
25341
m.activeChild.hide();
25343
if(m.autoHideTimer){
25344
clearTimeout(m.autoHideTimer);
25345
delete m.autoHideTimer;
25349
function onBeforeShow(m){
25350
var pm = m.parentMenu;
25351
if(!pm && !m.allowOtherMenus){
25353
}else if(pm && pm.activeChild){
25354
pm.activeChild.hide();
25358
function onMouseDown(e){
25359
if(lastShow.getElapsed() > 50 && active.length > 0 && !e.getTarget(".x-menu")){
25364
function onBeforeCheck(mi, state){
25366
var g = groups[mi.group];
25367
for(var i = 0, l = g.length; i < l; i++){
25369
g[i].setChecked(false);
25378
hideAll : function(){
25382
register : function(menu){
25386
menus[menu.id] = menu;
25387
menu.on("beforehide", onBeforeHide);
25388
menu.on("hide", onHide);
25389
menu.on("beforeshow", onBeforeShow);
25390
menu.on("show", onShow);
25391
var g = menu.group;
25392
if(g && menu.events["checkchange"]){
25396
groups[g].push(menu);
25397
menu.on("checkchange", onCheck);
25402
get : function(menu){
25403
if(typeof menu == "string"){ if(!menus){ return null;
25405
return menus[menu];
25406
}else if(menu.events){ return menu;
25407
}else if(typeof menu.length == 'number'){ return new Ext.menu.Menu({items:menu});
25408
}else{ return new Ext.menu.Menu(menu);
25412
unregister : function(menu){
25413
delete menus[menu.id];
25414
menu.un("beforehide", onBeforeHide);
25415
menu.un("hide", onHide);
25416
menu.un("beforeshow", onBeforeShow);
25417
menu.un("show", onShow);
25418
var g = menu.group;
25419
if(g && menu.events["checkchange"]){
25420
groups[g].remove(menu);
25421
menu.un("checkchange", onCheck);
25425
registerCheckable : function(menuItem){
25426
var g = menuItem.group;
25431
groups[g].push(menuItem);
25432
menuItem.on("beforecheckchange", onBeforeCheck);
25436
unregisterCheckable : function(menuItem){
25437
var g = menuItem.group;
25439
groups[g].remove(menuItem);
25440
menuItem.un("beforecheckchange", onBeforeCheck);
25444
getCheckedItem : function(groupId){
25445
var g = groups[groupId];
25447
for(var i = 0, l = g.length; i < l; i++){
25456
setCheckedItem : function(groupId, itemId){
25457
var g = groups[groupId];
25459
for(var i = 0, l = g.length; i < l; i++){
25460
if(g[i].id == itemId){
25461
g[i].setChecked(true);
25471
Ext.menu.BaseItem = function(config){
25472
Ext.menu.BaseItem.superclass.constructor.call(this, config);
25484
this.on("click", this.handler, this.scope);
25488
Ext.extend(Ext.menu.BaseItem, Ext.Component, {
25492
canActivate : false,
25494
activeClass : "x-menu-item-active",
25496
hideOnClick : true,
25500
ctype: "Ext.menu.BaseItem",
25502
actionMode : "container",
25504
render : function(container, parentMenu){
25506
this.parentMenu = parentMenu;
25507
Ext.menu.BaseItem.superclass.render.call(this, container);
25508
this.container.menuItemId = this.id;
25511
onRender : function(container, position){
25512
this.el = Ext.get(this.el);
25513
container.dom.appendChild(this.el.dom);
25517
setHandler : function(handler, scope){
25519
this.un("click", this.handler, this.scope);
25521
this.on("click", this.handler = handler, this.scope = scope);
25524
onClick : function(e){
25525
if(!this.disabled && this.fireEvent("click", this, e) !== false
25526
&& this.parentMenu.fireEvent("itemclick", this, e) !== false){
25527
this.handleClick(e);
25533
activate : function(){
25537
var li = this.container;
25538
li.addClass(this.activeClass);
25539
this.region = li.getRegion().adjust(2, 2, -2, -2);
25540
this.fireEvent("activate", this);
25544
deactivate : function(){
25545
this.container.removeClass(this.activeClass);
25546
this.fireEvent("deactivate", this);
25549
shouldDeactivate : function(e){
25550
return !this.region || !this.region.contains(e.getPoint());
25553
handleClick : function(e){
25554
if(this.hideOnClick){
25555
this.parentMenu.hide.defer(this.hideDelay, this.parentMenu, [true]);
25559
expandMenu : function(autoActivate){
25562
hideMenu : function(){
25566
Ext.menu.TextItem = function(cfg){
25567
if(typeof cfg == 'string'){
25570
Ext.menu.TextItem.superclass.constructor.call(this, cfg);
25573
Ext.extend(Ext.menu.TextItem, Ext.menu.BaseItem, {
25576
hideOnClick : false,
25578
itemCls : "x-menu-text",
25580
onRender : function(){
25581
var s = document.createElement("span");
25582
s.className = this.itemCls;
25583
s.innerHTML = this.text;
25585
Ext.menu.TextItem.superclass.onRender.apply(this, arguments);
25589
Ext.menu.Separator = function(config){
25590
Ext.menu.Separator.superclass.constructor.call(this, config);
25593
Ext.extend(Ext.menu.Separator, Ext.menu.BaseItem, {
25595
itemCls : "x-menu-sep",
25597
hideOnClick : false,
25599
onRender : function(li){
25600
var s = document.createElement("span");
25601
s.className = this.itemCls;
25602
s.innerHTML = " ";
25604
li.addClass("x-menu-sep-li");
25605
Ext.menu.Separator.superclass.onRender.apply(this, arguments);
25609
Ext.menu.Item = function(config){
25610
Ext.menu.Item.superclass.constructor.call(this, config);
25612
this.menu = Ext.menu.MenuMgr.get(this.menu);
25615
Ext.extend(Ext.menu.Item, Ext.menu.BaseItem, {
25623
itemCls : "x-menu-item",
25625
canActivate : true,
25630
ctype: "Ext.menu.Item",
25632
onRender : function(container, position){
25633
var el = document.createElement("a");
25634
el.hideFocus = true;
25635
el.unselectable = "on";
25636
el.href = this.href || "#";
25637
if(this.hrefTarget){
25638
el.target = this.hrefTarget;
25640
el.className = this.itemCls + (this.menu ? " x-menu-item-arrow" : "") + (this.cls ? " " + this.cls : "");
25641
el.innerHTML = String.format(
25642
'<img src="{0}" class="x-menu-item-icon {2}" />{1}',
25643
this.icon || Ext.BLANK_IMAGE_URL, this.itemText||this.text, this.iconCls || '');
25645
Ext.menu.Item.superclass.onRender.call(this, container, position);
25649
setText : function(text){
25652
this.el.update(String.format(
25653
'<img src="{0}" class="x-menu-item-icon {2}">{1}',
25654
this.icon || Ext.BLANK_IMAGE_URL, this.text, this.iconCls || ''));
25655
this.parentMenu.autoWidth();
25660
setIconClass : function(cls){
25661
var oldCls = this.iconCls;
25662
this.iconCls = cls;
25664
this.el.child('img.x-menu-item-icon').replaceClass(oldCls, this.iconCls);
25668
handleClick : function(e){
25669
if(!this.href){ e.stopEvent();
25671
Ext.menu.Item.superclass.handleClick.apply(this, arguments);
25674
activate : function(autoExpand){
25675
if(Ext.menu.Item.superclass.activate.apply(this, arguments)){
25684
shouldDeactivate : function(e){
25685
if(Ext.menu.Item.superclass.shouldDeactivate.call(this, e)){
25686
if(this.menu && this.menu.isVisible()){
25687
return !this.menu.getEl().getRegion().contains(e.getPoint());
25694
deactivate : function(){
25695
Ext.menu.Item.superclass.deactivate.apply(this, arguments);
25699
expandMenu : function(autoActivate){
25700
if(!this.disabled && this.menu){
25701
clearTimeout(this.hideTimer);
25702
delete this.hideTimer;
25703
if(!this.menu.isVisible() && !this.showTimer){
25704
this.showTimer = this.deferExpand.defer(this.showDelay, this, [autoActivate]);
25705
}else if (this.menu.isVisible() && autoActivate){
25706
this.menu.tryActivate(0, 1);
25711
deferExpand : function(autoActivate){
25712
delete this.showTimer;
25713
this.menu.show(this.container, this.parentMenu.subMenuAlign || "tl-tr?", this.parentMenu);
25715
this.menu.tryActivate(0, 1);
25719
hideMenu : function(){
25720
clearTimeout(this.showTimer);
25721
delete this.showTimer;
25722
if(!this.hideTimer && this.menu && this.menu.isVisible()){
25723
this.hideTimer = this.deferHide.defer(this.hideDelay, this);
25727
deferHide : function(){
25728
delete this.hideTimer;
25729
if(this.menu.over){
25730
this.parentMenu.setActiveItem(this, false);
25737
Ext.menu.CheckItem = function(config){
25738
Ext.menu.CheckItem.superclass.constructor.call(this, config);
25741
"beforecheckchange" ,
25746
if(this.checkHandler){
25747
this.on('checkchange', this.checkHandler, this.scope);
25749
Ext.menu.MenuMgr.registerCheckable(this);
25751
Ext.extend(Ext.menu.CheckItem, Ext.menu.Item, {
25754
itemCls : "x-menu-item x-menu-check-item",
25756
groupClass : "x-menu-group-item",
25761
ctype: "Ext.menu.CheckItem",
25763
onRender : function(c){
25764
Ext.menu.CheckItem.superclass.onRender.apply(this, arguments);
25766
this.el.addClass(this.groupClass);
25769
this.checked = false;
25770
this.setChecked(true, true);
25774
destroy : function(){
25775
Ext.menu.MenuMgr.unregisterCheckable(this);
25776
Ext.menu.CheckItem.superclass.destroy.apply(this, arguments);
25780
setChecked : function(state, suppressEvent){
25781
if(this.checked != state && this.fireEvent("beforecheckchange", this, state) !== false){
25782
if(this.container){
25783
this.container[state ? "addClass" : "removeClass"]("x-menu-item-checked");
25785
this.checked = state;
25786
if(suppressEvent !== true){
25787
this.fireEvent("checkchange", this, state);
25792
handleClick : function(e){
25793
if(!this.disabled && !(this.checked && this.group)){ this.setChecked(!this.checked);
25795
Ext.menu.CheckItem.superclass.handleClick.apply(this, arguments);
25799
Ext.menu.Adapter = function(component, config){
25800
Ext.menu.Adapter.superclass.constructor.call(this, config);
25801
this.component = component;
25803
Ext.extend(Ext.menu.Adapter, Ext.menu.BaseItem, {
25804
canActivate : true,
25806
onRender : function(container, position){
25807
this.component.render(container);
25808
this.el = this.component.getEl();
25811
activate : function(){
25815
this.component.focus();
25816
this.fireEvent("activate", this);
25820
deactivate : function(){
25821
this.fireEvent("deactivate", this);
25824
disable : function(){
25825
this.component.disable();
25826
Ext.menu.Adapter.superclass.disable.call(this);
25829
enable : function(){
25830
this.component.enable();
25831
Ext.menu.Adapter.superclass.enable.call(this);
25835
Ext.menu.DateItem = function(config){
25836
Ext.menu.DateItem.superclass.constructor.call(this, new Ext.DatePicker(config), config);
25838
this.picker = this.component;
25839
this.addEvents('select');
25841
this.picker.on("render", function(picker){
25842
picker.getEl().swallowEvent("click");
25843
picker.container.addClass("x-menu-date-item");
25846
this.picker.on("select", this.onSelect, this);
25849
Ext.extend(Ext.menu.DateItem, Ext.menu.Adapter, {
25850
onSelect : function(picker, date){
25851
this.fireEvent("select", this, date, picker);
25852
Ext.menu.DateItem.superclass.handleClick.call(this);
25856
Ext.menu.ColorItem = function(config){
25857
Ext.menu.ColorItem.superclass.constructor.call(this, new Ext.ColorPalette(config), config);
25859
this.palette = this.component;
25860
this.relayEvents(this.palette, ["select"]);
25861
if(this.selectHandler){
25862
this.on('select', this.selectHandler, this.scope);
25865
Ext.extend(Ext.menu.ColorItem, Ext.menu.Adapter);
25867
Ext.menu.DateMenu = function(config){
25868
Ext.menu.DateMenu.superclass.constructor.call(this, config);
25870
var di = new Ext.menu.DateItem(config);
25873
this.picker = di.picker;
25875
this.relayEvents(di, ["select"]);
25877
this.on('beforeshow', function(){
25879
this.picker.hideMonthPicker(true);
25883
Ext.extend(Ext.menu.DateMenu, Ext.menu.Menu, {
25886
beforeDestroy : function() {
25887
this.picker.destroy();
25891
Ext.menu.ColorMenu = function(config){
25892
Ext.menu.ColorMenu.superclass.constructor.call(this, config);
25894
var ci = new Ext.menu.ColorItem(config);
25897
this.palette = ci.palette;
25899
this.relayEvents(ci, ["select"]);
25901
Ext.extend(Ext.menu.ColorMenu, Ext.menu.Menu);
25903
Ext.form.Field = Ext.extend(Ext.BoxComponent, {
25917
invalidClass : "x-form-invalid",
25919
invalidText : "The value in this field is invalid",
25921
focusClass : "x-form-focus",
25923
validationEvent : "keyup",
25925
validateOnBlur : true,
25927
validationDelay : 250,
25929
defaultAutoCreate : {tag: "input", type: "text", size: "20", autocomplete: "off"},
25931
fieldClass : "x-form-field",
25933
msgTarget : 'qtip',
25941
isFormField : true,
25945
initComponent : function(){
25946
Ext.form.Field.superclass.initComponent.call(this);
25964
getName: function(){
25965
return this.rendered && this.el.dom.name ? this.el.dom.name : (this.hiddenName || '');
25968
onRender : function(ct, position){
25969
Ext.form.Field.superclass.onRender.call(this, ct, position);
25971
var cfg = this.getAutoCreate();
25973
cfg.name = this.name || this.id;
25975
if(this.inputType){
25976
cfg.type = this.inputType;
25978
this.el = ct.createChild(cfg, position);
25980
var type = this.el.dom.type;
25982
if(type == 'password'){
25985
this.el.addClass('x-form-'+type);
25988
this.el.dom.readOnly = true;
25990
if(this.tabIndex !== undefined){
25991
this.el.dom.setAttribute('tabIndex', this.tabIndex);
25994
this.el.addClass([this.fieldClass, this.cls]);
25997
initValue : function(){
25998
if(this.value !== undefined){
25999
this.setValue(this.value);
26000
}else if(this.el.dom.value.length > 0 && this.el.dom.value != this.emptyText){
26001
this.setValue(this.el.dom.value);
26003
this.originalValue = this.getValue();
26007
isDirty : function() {
26008
if(this.disabled) {
26011
return String(this.getValue()) !== String(this.originalValue);
26014
afterRender : function(){
26015
Ext.form.Field.superclass.afterRender.call(this);
26020
fireKey : function(e){
26021
if(e.isSpecialKey()){
26022
this.fireEvent("specialkey", this, e);
26027
reset : function(){
26028
this.setValue(this.originalValue);
26029
this.clearInvalid();
26032
initEvents : function(){
26033
this.el.on(Ext.isIE || Ext.isSafari3 ? "keydown" : "keypress", this.fireKey, this);
26034
this.el.on("focus", this.onFocus, this);
26036
var o = this.inEditor && Ext.isWindows && Ext.isGecko ? {buffer:10} : null;
26037
this.el.on("blur", this.onBlur, this, o);
26039
this.originalValue = this.getValue();
26042
onFocus : function(){
26043
if(!Ext.isOpera && this.focusClass){ this.el.addClass(this.focusClass);
26045
if(!this.hasFocus){
26046
this.hasFocus = true;
26047
this.startValue = this.getValue();
26048
this.fireEvent("focus", this);
26052
beforeBlur : Ext.emptyFn,
26054
onBlur : function(){
26056
if(!Ext.isOpera && this.focusClass){ this.el.removeClass(this.focusClass);
26058
this.hasFocus = false;
26059
if(this.validationEvent !== false && this.validateOnBlur && this.validationEvent != "blur"){
26062
var v = this.getValue();
26063
if(String(v) !== String(this.startValue)){
26064
this.fireEvent('change', this, v, this.startValue);
26066
this.fireEvent("blur", this);
26070
isValid : function(preventMark){
26074
var restore = this.preventMark;
26075
this.preventMark = preventMark === true;
26076
var v = this.validateValue(this.processValue(this.getRawValue()));
26077
this.preventMark = restore;
26082
validate : function(){
26083
if(this.disabled || this.validateValue(this.processValue(this.getRawValue()))){
26084
this.clearInvalid();
26090
processValue : function(value){
26094
validateValue : function(value){
26099
markInvalid : function(msg){
26100
if(!this.rendered || this.preventMark){ return;
26102
this.el.addClass(this.invalidClass);
26103
msg = msg || this.invalidText;
26105
switch(this.msgTarget){
26107
this.el.dom.qtip = msg;
26108
this.el.dom.qclass = 'x-form-invalid-tip';
26109
if(Ext.QuickTips){ Ext.QuickTips.enable();
26113
this.el.dom.title = msg;
26117
var elp = this.getErrorCt();
26118
if(!elp){ this.el.dom.title = msg;
26121
this.errorEl = elp.createChild({cls:'x-form-invalid-msg'});
26122
this.errorEl.setWidth(elp.getWidth(true)-20);
26124
this.errorEl.update(msg);
26125
Ext.form.Field.msgFx[this.msgFx].show(this.errorEl, this);
26128
if(!this.errorIcon){
26129
var elp = this.getErrorCt();
26130
if(!elp){ this.el.dom.title = msg;
26133
this.errorIcon = elp.createChild({cls:'x-form-invalid-icon'});
26135
this.alignErrorIcon();
26136
this.errorIcon.dom.qtip = msg;
26137
this.errorIcon.dom.qclass = 'x-form-invalid-tip';
26138
this.errorIcon.show();
26139
this.on('resize', this.alignErrorIcon, this);
26142
var t = Ext.getDom(this.msgTarget);
26144
t.style.display = this.msgDisplay;
26147
this.fireEvent('invalid', this, msg);
26150
getErrorCt : function(){
26151
return this.el.findParent('.x-form-element', 5, true) || this.el.findParent('.x-form-field-wrap', 5, true); },
26153
alignErrorIcon : function(){
26154
this.errorIcon.alignTo(this.el, 'tl-tr', [2, 0]);
26158
clearInvalid : function(){
26159
if(!this.rendered || this.preventMark){ return;
26161
this.el.removeClass(this.invalidClass);
26162
switch(this.msgTarget){
26164
this.el.dom.qtip = '';
26167
this.el.dom.title = '';
26171
Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl, this);
26175
if(this.errorIcon){
26176
this.errorIcon.dom.qtip = '';
26177
this.errorIcon.hide();
26178
this.un('resize', this.alignErrorIcon, this);
26182
var t = Ext.getDom(this.msgTarget);
26184
t.style.display = 'none';
26187
this.fireEvent('valid', this);
26191
getRawValue : function(){
26192
var v = this.rendered ? this.el.getValue() : Ext.value(this.value, '');
26193
if(v === this.emptyText){
26200
getValue : function(){
26201
if(!this.rendered) {
26204
var v = this.el.getValue();
26205
if(v === this.emptyText || v === undefined){
26212
setRawValue : function(v){
26213
return this.el.dom.value = (v === null || v === undefined ? '' : v);
26217
setValue : function(v){
26220
this.el.dom.value = (v === null || v === undefined ? '' : v);
26225
adjustSize : function(w, h){
26226
var s = Ext.form.Field.superclass.adjustSize.call(this, w, h);
26227
s.width = this.adjustWidth(this.el.dom.tagName, s.width);
26231
adjustWidth : function(tag, w){
26232
tag = tag.toLowerCase();
26233
if(typeof w == 'number' && !Ext.isSafari){
26234
if(Ext.isIE && (tag == 'input' || tag == 'textarea')){
26235
if(tag == 'input' && !Ext.isStrict){
26236
return this.inEditor ? w : w - 3;
26238
if(tag == 'input' && Ext.isStrict){
26239
return w - (Ext.isIE6 ? 4 : 1);
26241
if(tag == 'textarea' && Ext.isStrict){
26244
}else if(Ext.isOpera && Ext.isStrict){
26245
if(tag == 'input'){
26248
if(tag == 'textarea'){
26262
Ext.form.MessageTargets = {
26265
this.el.dom.qtip = msg;
26266
this.el.dom.qclass = 'x-form-invalid-tip';
26267
if(Ext.QuickTips){ Ext.QuickTips.enable();
26270
clear: function(f){
26271
this.el.dom.qtip = '';
26276
this.el.dom.title = msg;
26278
clear: function(f){
26279
this.el.dom.title = '';
26285
var elp = this.getErrorCt();
26286
if(!elp){ this.el.dom.title = msg;
26289
this.errorEl = elp.createChild({cls:'x-form-invalid-msg'});
26290
this.errorEl.setWidth(elp.getWidth(true)-20);
26292
this.errorEl.update(msg);
26293
Ext.form.Field.msgFx[this.msgFx].show(this.errorEl, this);
26295
clear: function(f){
26297
Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl, this);
26299
this.el.dom.title = '';
26305
if(!this.errorIcon){
26306
var elp = this.getErrorCt();
26307
if(!elp){ this.el.dom.title = msg;
26310
this.errorIcon = elp.createChild({cls:'x-form-invalid-icon'});
26312
this.alignErrorIcon();
26313
this.errorIcon.dom.qtip = msg;
26314
this.errorIcon.dom.qclass = 'x-form-invalid-tip';
26315
this.errorIcon.show();
26316
this.on('resize', this.alignErrorIcon, this);
26318
clear: function(f){
26319
if(this.errorIcon){
26320
this.errorIcon.dom.qtip = '';
26321
this.errorIcon.hide();
26322
this.un('resize', this.alignErrorIcon, this);
26324
this.el.dom.title = '';
26332
clear: function(f){
26339
Ext.form.Field.msgFx = {
26341
show: function(msgEl, f){
26342
msgEl.setDisplayed('block');
26345
hide : function(msgEl, f){
26346
msgEl.setDisplayed(false).update('');
26351
show: function(msgEl, f){
26352
msgEl.slideIn('t', {stopFx:true});
26355
hide : function(msgEl, f){
26356
msgEl.slideOut('t', {stopFx:true,useDisplay:true});
26361
show: function(msgEl, f){
26362
msgEl.fixDisplay();
26363
msgEl.alignTo(f.el, 'tl-tr');
26364
msgEl.slideIn('l', {stopFx:true});
26367
hide : function(msgEl, f){
26368
msgEl.slideOut('l', {stopFx:true,useDisplay:true});
26372
Ext.reg('field', Ext.form.Field);
26375
Ext.form.TextField = Ext.extend(Ext.form.Field, {
26388
disableKeyFilter : false,
26394
maxLength : Number.MAX_VALUE,
26396
minLengthText : "The minimum length for this field is {0}",
26398
maxLengthText : "The maximum length for this field is {0}",
26400
selectOnFocus : false,
26402
blankText : "This field is required",
26412
emptyClass : 'x-form-empty-field',
26416
initComponent : function(){
26417
Ext.form.TextField.superclass.initComponent.call(this);
26431
initEvents : function(){
26432
Ext.form.TextField.superclass.initEvents.call(this);
26433
if(this.validationEvent == 'keyup'){
26434
this.validationTask = new Ext.util.DelayedTask(this.validate, this);
26435
this.el.on('keyup', this.filterValidation, this);
26437
else if(this.validationEvent !== false){
26438
this.el.on(this.validationEvent, this.validate, this, {buffer: this.validationDelay});
26440
if(this.selectOnFocus || this.emptyText){
26441
this.on("focus", this.preFocus, this);
26442
this.el.on('mousedown', function(){
26443
if(!this.hasFocus){
26444
this.el.on('mouseup', function(e){
26445
e.preventDefault();
26446
}, this, {single:true});
26449
if(this.emptyText){
26450
this.on('blur', this.postBlur, this);
26451
this.applyEmptyText();
26454
if(this.maskRe || (this.vtype && this.disableKeyFilter !== true && (this.maskRe = Ext.form.VTypes[this.vtype+'Mask']))){
26455
this.el.on("keypress", this.filterKeys, this);
26458
this.el.on("keyup", this.onKeyUpBuffered, this, {buffer:50});
26459
this.el.on("click", this.autoSize, this);
26462
if(this.enableKeyEvents){
26463
this.el.on("keyup", this.onKeyUp, this);
26464
this.el.on("keydown", this.onKeyDown, this);
26465
this.el.on("keypress", this.onKeyPress, this);
26469
processValue : function(value){
26470
if(this.stripCharsRe){
26471
var newValue = value.replace(this.stripCharsRe, '');
26472
if(newValue !== value){
26473
this.setRawValue(newValue);
26480
filterValidation : function(e){
26481
if(!e.isNavKeyPress()){
26482
this.validationTask.delay(this.validationDelay);
26486
onKeyUpBuffered : function(e){
26487
if(!e.isNavKeyPress()){
26492
onKeyUp : function(e){
26493
this.fireEvent('keyup', this, e);
26496
onKeyDown : function(e){
26497
this.fireEvent('keydown', this, e);
26500
onKeyPress : function(e){
26501
this.fireEvent('keypress', this, e);
26505
reset : function(){
26506
Ext.form.TextField.superclass.reset.call(this);
26507
this.applyEmptyText();
26510
applyEmptyText : function(){
26511
if(this.rendered && this.emptyText && this.getRawValue().length < 1){
26512
this.setRawValue(this.emptyText);
26513
this.el.addClass(this.emptyClass);
26517
preFocus : function(){
26518
if(this.emptyText){
26519
if(this.el.dom.value == this.emptyText){
26520
this.setRawValue('');
26522
this.el.removeClass(this.emptyClass);
26524
if(this.selectOnFocus){
26525
this.el.dom.select();
26529
postBlur : function(){
26530
this.applyEmptyText();
26533
filterKeys : function(e){
26537
var k = e.getKey();
26538
if(Ext.isGecko && (e.isNavKeyPress() || k == e.BACKSPACE || (k == e.DELETE && e.button == -1))){
26541
var c = e.getCharCode(), cc = String.fromCharCode(c);
26542
if(!Ext.isGecko && e.isSpecialKey() && !cc){
26545
if(!this.maskRe.test(cc)){
26550
setValue : function(v){
26551
if(this.emptyText && this.el && v !== undefined && v !== null && v !== ''){
26552
this.el.removeClass(this.emptyClass);
26554
Ext.form.TextField.superclass.setValue.apply(this, arguments);
26555
this.applyEmptyText();
26560
validateValue : function(value){
26561
if(value.length < 1 || value === this.emptyText){ if(this.allowBlank){
26562
this.clearInvalid();
26565
this.markInvalid(this.blankText);
26569
if(value.length < this.minLength){
26570
this.markInvalid(String.format(this.minLengthText, this.minLength));
26573
if(value.length > this.maxLength){
26574
this.markInvalid(String.format(this.maxLengthText, this.maxLength));
26578
var vt = Ext.form.VTypes;
26579
if(!vt[this.vtype](value, this)){
26580
this.markInvalid(this.vtypeText || vt[this.vtype +'Text']);
26584
if(typeof this.validator == "function"){
26585
var msg = this.validator(value);
26587
this.markInvalid(msg);
26591
if(this.regex && !this.regex.test(value)){
26592
this.markInvalid(this.regexText);
26599
selectText : function(start, end){
26600
var v = this.getRawValue();
26602
start = start === undefined ? 0 : start;
26603
end = end === undefined ? v.length : end;
26604
var d = this.el.dom;
26605
if(d.setSelectionRange){
26606
d.setSelectionRange(start, end);
26607
}else if(d.createTextRange){
26608
var range = d.createTextRange();
26609
range.moveStart("character", start);
26610
range.moveEnd("character", end-v.length);
26617
autoSize : function(){
26618
if(!this.grow || !this.rendered){
26622
this.metrics = Ext.util.TextMetrics.createInstance(this.el);
26625
var v = el.dom.value;
26626
var d = document.createElement('div');
26627
d.appendChild(document.createTextNode(v));
26631
var w = Math.min(this.growMax, Math.max(this.metrics.getWidth(v) + 10, this.growMin));
26632
this.el.setWidth(w);
26633
this.fireEvent("autosize", this, w);
26636
Ext.reg('textfield', Ext.form.TextField);
26639
Ext.form.TriggerField = Ext.extend(Ext.form.TextField, {
26642
defaultAutoCreate : {tag: "input", type: "text", size: "16", autocomplete: "off"},
26647
autoSize: Ext.emptyFn,
26649
deferHeight : true,
26652
onResize : function(w, h){
26653
Ext.form.TriggerField.superclass.onResize.call(this, w, h);
26654
if(typeof w == 'number'){
26655
this.el.setWidth(this.adjustWidth('input', w - this.trigger.getWidth()));
26657
this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());
26660
adjustSize : Ext.BoxComponent.prototype.adjustSize,
26662
getResizeEl : function(){
26666
getPositionEl : function(){
26670
alignErrorIcon : function(){
26672
this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]);
26676
onRender : function(ct, position){
26677
Ext.form.TriggerField.superclass.onRender.call(this, ct, position);
26678
this.wrap = this.el.wrap({cls: "x-form-field-wrap"});
26679
this.trigger = this.wrap.createChild(this.triggerConfig ||
26680
{tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.triggerClass});
26681
if(this.hideTrigger){
26682
this.trigger.setDisplayed(false);
26684
this.initTrigger();
26686
this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());
26690
afterRender : function(){
26691
Ext.form.TriggerField.superclass.afterRender.call(this);
26693
if(Ext.isIE && this.el.getY() != (y = this.trigger.getY())){
26694
this.el.position();
26699
initTrigger : function(){
26700
this.trigger.on("click", this.onTriggerClick, this, {preventDefault:true});
26701
this.trigger.addClassOnOver('x-form-trigger-over');
26702
this.trigger.addClassOnClick('x-form-trigger-click');
26705
onDestroy : function(){
26707
this.trigger.removeAllListeners();
26708
this.trigger.remove();
26711
this.wrap.remove();
26713
Ext.form.TriggerField.superclass.onDestroy.call(this);
26716
onFocus : function(){
26717
Ext.form.TriggerField.superclass.onFocus.call(this);
26718
if(!this.mimicing){
26719
this.wrap.addClass('x-trigger-wrap-focus');
26720
this.mimicing = true;
26721
Ext.get(Ext.isIE ? document.body : document).on("mousedown", this.mimicBlur, this, {delay: 10});
26722
if(this.monitorTab){
26723
this.el.on("keydown", this.checkTab, this);
26728
checkTab : function(e){
26729
if(e.getKey() == e.TAB){
26730
this.triggerBlur();
26734
onBlur : function(){
26737
mimicBlur : function(e){
26738
if(!this.wrap.contains(e.target) && this.validateBlur(e)){
26739
this.triggerBlur();
26743
triggerBlur : function(){
26744
this.mimicing = false;
26745
Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur, this);
26746
if(this.monitorTab){
26747
this.el.un("keydown", this.checkTab, this);
26750
this.wrap.removeClass('x-trigger-wrap-focus');
26751
Ext.form.TriggerField.superclass.onBlur.call(this);
26754
beforeBlur : Ext.emptyFn,
26756
validateBlur : function(e){
26760
onDisable : function(){
26761
Ext.form.TriggerField.superclass.onDisable.call(this);
26763
this.wrap.addClass(this.disabledClass);
26764
this.el.removeClass(this.disabledClass);
26768
onEnable : function(){
26769
Ext.form.TriggerField.superclass.onEnable.call(this);
26771
this.wrap.removeClass(this.disabledClass);
26775
onShow : function(){
26777
this.wrap.dom.style.display = '';
26778
this.wrap.dom.style.visibility = 'visible';
26782
onHide : function(){
26783
this.wrap.dom.style.display = 'none';
26787
onTriggerClick : Ext.emptyFn
26794
Ext.form.TwinTriggerField = Ext.extend(Ext.form.TriggerField, {
26795
initComponent : function(){
26796
Ext.form.TwinTriggerField.superclass.initComponent.call(this);
26798
this.triggerConfig = {
26799
tag:'span', cls:'x-form-twin-triggers', cn:[
26800
{tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger1Class},
26801
{tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger2Class}
26805
getTrigger : function(index){
26806
return this.triggers[index];
26809
initTrigger : function(){
26810
var ts = this.trigger.select('.x-form-trigger', true);
26811
this.wrap.setStyle('overflow', 'hidden');
26812
var triggerField = this;
26813
ts.each(function(t, all, index){
26814
t.hide = function(){
26815
var w = triggerField.wrap.getWidth();
26816
this.dom.style.display = 'none';
26817
triggerField.el.setWidth(w-triggerField.trigger.getWidth());
26819
t.show = function(){
26820
var w = triggerField.wrap.getWidth();
26821
this.dom.style.display = '';
26822
triggerField.el.setWidth(w-triggerField.trigger.getWidth());
26824
var triggerIndex = 'Trigger'+(index+1);
26826
if(this['hide'+triggerIndex]){
26827
t.dom.style.display = 'none';
26829
t.on("click", this['on'+triggerIndex+'Click'], this, {preventDefault:true});
26830
t.addClassOnOver('x-form-trigger-over');
26831
t.addClassOnClick('x-form-trigger-click');
26833
this.triggers = ts.elements;
26836
onTrigger1Click : Ext.emptyFn,
26837
onTrigger2Click : Ext.emptyFn
26839
Ext.reg('trigger', Ext.form.TriggerField);
26841
Ext.form.TextArea = Ext.extend(Ext.form.TextField, {
26846
growAppend : ' \n ',
26849
enterIsSpecial : false,
26852
preventScrollbars: false,
26855
onRender : function(ct, position){
26857
this.defaultAutoCreate = {
26859
style:"width:100px;height:60px;",
26860
autocomplete: "off"
26863
Ext.form.TextArea.superclass.onRender.call(this, ct, position);
26865
this.textSizeEl = Ext.DomHelper.append(document.body, {
26866
tag: "pre", cls: "x-form-grow-sizer"
26868
if(this.preventScrollbars){
26869
this.el.setStyle("overflow", "hidden");
26871
this.el.setHeight(this.growMin);
26875
onDestroy : function(){
26876
if(this.textSizeEl){
26877
Ext.removeNode(this.textSizeEl);
26879
Ext.form.TextArea.superclass.onDestroy.call(this);
26882
fireKey : function(e){
26883
if(e.isSpecialKey() && (this.enterIsSpecial || (e.getKey() != e.ENTER || e.hasModifier()))){
26884
this.fireEvent("specialkey", this, e);
26888
onKeyUp : function(e){
26889
if(!e.isNavKeyPress() || e.getKey() == e.ENTER){
26892
Ext.form.TextArea.superclass.onKeyUp.call(this, e);
26896
autoSize : function(){
26897
if(!this.grow || !this.textSizeEl){
26901
var v = el.dom.value;
26902
var ts = this.textSizeEl;
26904
ts.appendChild(document.createTextNode(v));
26907
Ext.fly(ts).setWidth(this.el.getWidth());
26909
v = "  ";
26912
v = v.replace(/\n/g, '<p> </p>');
26914
v += this.growAppend;
26917
var h = Math.min(this.growMax, Math.max(ts.offsetHeight, this.growMin)+this.growPad);
26918
if(h != this.lastHeight){
26919
this.lastHeight = h;
26920
this.el.setHeight(h);
26921
this.fireEvent("autosize", this, h);
26925
Ext.reg('textarea', Ext.form.TextArea);
26927
Ext.form.NumberField = Ext.extend(Ext.form.TextField, {
26929
fieldClass: "x-form-field x-form-num-field",
26931
allowDecimals : true,
26933
decimalSeparator : ".",
26935
decimalPrecision : 2,
26937
allowNegative : true,
26939
minValue : Number.NEGATIVE_INFINITY,
26941
maxValue : Number.MAX_VALUE,
26943
minText : "The minimum value for this field is {0}",
26945
maxText : "The maximum value for this field is {0}",
26947
nanText : "{0} is not a valid number",
26949
baseChars : "0123456789",
26951
initEvents : function(){
26952
Ext.form.NumberField.superclass.initEvents.call(this);
26953
var allowed = this.baseChars+'';
26954
if(this.allowDecimals){
26955
allowed += this.decimalSeparator;
26957
if(this.allowNegative){
26960
this.stripCharsRe = new RegExp('[^'+allowed+']', 'gi');
26961
var keyPress = function(e){
26962
var k = e.getKey();
26963
if(!Ext.isIE && (e.isSpecialKey() || k == e.BACKSPACE || k == e.DELETE)){
26966
var c = e.getCharCode();
26967
if(allowed.indexOf(String.fromCharCode(c)) === -1){
26971
this.el.on("keypress", keyPress, this);
26974
validateValue : function(value){
26975
if(!Ext.form.NumberField.superclass.validateValue.call(this, value)){
26978
if(value.length < 1){ return true;
26980
value = String(value).replace(this.decimalSeparator, ".");
26982
this.markInvalid(String.format(this.nanText, value));
26985
var num = this.parseValue(value);
26986
if(num < this.minValue){
26987
this.markInvalid(String.format(this.minText, this.minValue));
26990
if(num > this.maxValue){
26991
this.markInvalid(String.format(this.maxText, this.maxValue));
26997
getValue : function(){
26998
return this.fixPrecision(this.parseValue(Ext.form.NumberField.superclass.getValue.call(this)));
27001
setValue : function(v){
27002
v = typeof v == 'number' ? v : parseFloat(String(v).replace(this.decimalSeparator, "."));
27003
v = isNaN(v) ? '' : String(v).replace(".", this.decimalSeparator);
27004
Ext.form.NumberField.superclass.setValue.call(this, v);
27007
parseValue : function(value){
27008
value = parseFloat(String(value).replace(this.decimalSeparator, "."));
27009
return isNaN(value) ? '' : value;
27012
fixPrecision : function(value){
27013
var nan = isNaN(value);
27014
if(!this.allowDecimals || this.decimalPrecision == -1 || nan || !value){
27015
return nan ? '' : value;
27017
return parseFloat(parseFloat(value).toFixed(this.decimalPrecision));
27020
beforeBlur : function(){
27021
var v = this.parseValue(this.getRawValue());
27023
this.setValue(this.fixPrecision(v));
27027
Ext.reg('numberfield', Ext.form.NumberField);
27029
Ext.form.DateField = Ext.extend(Ext.form.TriggerField, {
27033
altFormats : "m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d",
27035
disabledDaysText : "Disabled",
27037
disabledDatesText : "Disabled",
27039
minText : "The date in this field must be equal to or after {0}",
27041
maxText : "The date in this field must be equal to or before {0}",
27043
invalidText : "{0} is not a valid date - it must be in the format {1}",
27045
triggerClass : 'x-form-date-trigger',
27054
defaultAutoCreate : {tag: "input", type: "text", size: "10", autocomplete: "off"},
27056
initComponent : function(){
27057
Ext.form.DateField.superclass.initComponent.call(this);
27058
if(typeof this.minValue == "string"){
27059
this.minValue = this.parseDate(this.minValue);
27061
if(typeof this.maxValue == "string"){
27062
this.maxValue = this.parseDate(this.maxValue);
27064
this.ddMatch = null;
27065
this.initDisabledDays();
27068
initDisabledDays : function(){
27069
if(this.disabledDates){
27070
var dd = this.disabledDates;
27072
for(var i = 0; i < dd.length; i++){
27074
if(i != dd.length-1) re += "|";
27076
this.disabledDatesRE = new RegExp(re + ")");
27081
setDisabledDates : function(dd){
27082
this.disabledDates = dd;
27083
this.initDisabledDays();
27085
this.menu.picker.setDisabledDates(this.disabledDatesRE);
27090
setDisabledDays : function(dd){
27091
this.disabledDays = dd;
27093
this.menu.picker.setDisabledDays(dd);
27098
setMinValue : function(dt){
27099
this.minValue = (typeof dt == "string" ? this.parseDate(dt) : dt);
27101
this.menu.picker.setMinDate(this.minValue);
27106
setMaxValue : function(dt){
27107
this.maxValue = (typeof dt == "string" ? this.parseDate(dt) : dt);
27109
this.menu.picker.setMaxDate(this.maxValue);
27113
validateValue : function(value){
27114
value = this.formatDate(value);
27115
if(!Ext.form.DateField.superclass.validateValue.call(this, value)){
27118
if(value.length < 1){ return true;
27120
var svalue = value;
27121
value = this.parseDate(value);
27123
this.markInvalid(String.format(this.invalidText, svalue, this.format));
27126
var time = value.getTime();
27127
if(this.minValue && time < this.minValue.getTime()){
27128
this.markInvalid(String.format(this.minText, this.formatDate(this.minValue)));
27131
if(this.maxValue && time > this.maxValue.getTime()){
27132
this.markInvalid(String.format(this.maxText, this.formatDate(this.maxValue)));
27135
if(this.disabledDays){
27136
var day = value.getDay();
27137
for(var i = 0; i < this.disabledDays.length; i++) {
27138
if(day === this.disabledDays[i]){
27139
this.markInvalid(this.disabledDaysText);
27144
var fvalue = this.formatDate(value);
27145
if(this.ddMatch && this.ddMatch.test(fvalue)){
27146
this.markInvalid(String.format(this.disabledDatesText, fvalue));
27152
validateBlur : function(){
27153
return !this.menu || !this.menu.isVisible();
27157
getValue : function(){
27158
return this.parseDate(Ext.form.DateField.superclass.getValue.call(this)) || "";
27162
setValue : function(date){
27163
Ext.form.DateField.superclass.setValue.call(this, this.formatDate(this.parseDate(date)));
27166
parseDate : function(value){
27167
if(!value || Ext.isDate(value)){
27170
var v = Date.parseDate(value, this.format);
27171
if(!v && this.altFormats){
27172
if(!this.altFormatsArray){
27173
this.altFormatsArray = this.altFormats.split("|");
27175
for(var i = 0, len = this.altFormatsArray.length; i < len && !v; i++){
27176
v = Date.parseDate(value, this.altFormatsArray[i]);
27182
onDestroy : function(){
27184
this.menu.destroy();
27187
this.wrap.remove();
27189
Ext.form.DateField.superclass.onDestroy.call(this);
27192
formatDate : function(date){
27193
return Ext.isDate(date) ? date.dateFormat(this.format) : date;
27197
select: function(m, d){
27200
show : function(){ this.onFocus();
27203
this.focus.defer(10, this);
27204
var ml = this.menuListeners;
27205
this.menu.un("select", ml.select, this);
27206
this.menu.un("show", ml.show, this);
27207
this.menu.un("hide", ml.hide, this);
27212
onTriggerClick : function(){
27216
if(this.menu == null){
27217
this.menu = new Ext.menu.DateMenu();
27219
Ext.apply(this.menu.picker, {
27220
minDate : this.minValue,
27221
maxDate : this.maxValue,
27222
disabledDatesRE : this.ddMatch,
27223
disabledDatesText : this.disabledDatesText,
27224
disabledDays : this.disabledDays,
27225
disabledDaysText : this.disabledDaysText,
27226
format : this.format,
27227
showToday : this.showToday,
27228
minText : String.format(this.minText, this.formatDate(this.minValue)),
27229
maxText : String.format(this.maxText, this.formatDate(this.maxValue))
27231
this.menu.on(Ext.apply({}, this.menuListeners, {
27234
this.menu.picker.setValue(this.getValue() || new Date());
27235
this.menu.show(this.el, "tl-bl?");
27238
beforeBlur : function(){
27239
var v = this.parseDate(this.getRawValue());
27250
Ext.reg('datefield', Ext.form.DateField);
27252
Ext.form.ComboBox = Ext.extend(Ext.form.TriggerField, {
27259
defaultAutoCreate : {tag: "input", type: "text", size: "24", autocomplete: "off"},
27268
selectedClass: 'x-combo-selected',
27270
triggerClass : 'x-form-arrow-trigger',
27274
listAlign: 'tl-bl?',
27280
triggerAction: 'query',
27290
selectOnFocus:false,
27292
queryParam: 'query',
27294
loadingText: 'Loading...',
27308
forceSelection:false,
27310
typeAheadDelay : 250,
27316
initComponent : function(){
27317
Ext.form.ComboBox.superclass.initComponent.call(this);
27330
if(this.transform){
27331
this.allowDomMove = false;
27332
var s = Ext.getDom(this.transform);
27333
if(!this.hiddenName){
27334
this.hiddenName = s.name;
27337
this.mode = 'local';
27338
var d = [], opts = s.options;
27339
for(var i = 0, len = opts.length;i < len; i++){
27341
var value = (Ext.isIE ? o.getAttributeNode('value').specified : o.hasAttribute('value')) ? o.value : o.text;
27343
this.value = value;
27345
d.push([value, o.text]);
27347
this.store = new Ext.data.SimpleStore({
27349
fields: ['value', 'text'],
27352
this.valueField = 'value';
27353
this.displayField = 'text';
27355
s.name = Ext.id(); if(!this.lazyRender){
27356
this.target = true;
27357
this.el = Ext.DomHelper.insertBefore(s, this.autoCreate || this.defaultAutoCreate);
27358
Ext.removeNode(s); this.render(this.el.parentNode);
27360
Ext.removeNode(s); }
27362
else if(Ext.isArray(this.store)){
27363
if (Ext.isArray(this.store[0])){
27364
this.store = new Ext.data.SimpleStore({
27365
fields: ['value','text'],
27368
this.valueField = 'value';
27370
this.store = new Ext.data.SimpleStore({
27375
this.valueField = 'text';
27377
this.displayField = 'text';
27378
this.mode = 'local';
27381
this.selectedIndex = -1;
27382
if(this.mode == 'local'){
27383
if(this.initialConfig.queryDelay === undefined){
27384
this.queryDelay = 10;
27386
if(this.initialConfig.minChars === undefined){
27392
onRender : function(ct, position){
27393
Ext.form.ComboBox.superclass.onRender.call(this, ct, position);
27394
if(this.hiddenName){
27395
this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName,
27396
id: (this.hiddenId||this.hiddenName)}, 'before', true);
27398
this.el.dom.removeAttribute('name');
27401
this.el.dom.setAttribute('autocomplete', 'off');
27404
if(!this.lazyInit){
27407
this.on('focus', this.initList, this, {single: true});
27410
if(!this.editable){
27411
this.editable = true;
27412
this.setEditable(false);
27416
initValue : function(){
27417
Ext.form.ComboBox.superclass.initValue.call(this);
27418
if(this.hiddenField){
27419
this.hiddenField.value =
27420
this.hiddenValue !== undefined ? this.hiddenValue :
27421
this.value !== undefined ? this.value : '';
27425
initList : function(){
27427
var cls = 'x-combo-list';
27429
this.list = new Ext.Layer({
27430
shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false
27433
var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth);
27434
this.list.setWidth(lw);
27435
this.list.swallowEvent('mousewheel');
27436
this.assetHeight = 0;
27439
this.header = this.list.createChild({cls:cls+'-hd', html: this.title});
27440
this.assetHeight += this.header.getHeight();
27443
this.innerList = this.list.createChild({cls:cls+'-inner'});
27444
this.innerList.on('mouseover', this.onViewOver, this);
27445
this.innerList.on('mousemove', this.onViewMove, this);
27446
this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));
27449
this.footer = this.list.createChild({cls:cls+'-ft'});
27450
this.pageTb = new Ext.PagingToolbar({
27452
pageSize: this.pageSize,
27453
renderTo:this.footer
27455
this.assetHeight += this.footer.getHeight();
27460
this.tpl = '<tpl for="."><div class="'+cls+'-item">{' + this.displayField + '}</div></tpl>';
27465
this.view = new Ext.DataView({
27466
applyTo: this.innerList,
27468
singleSelect: true,
27469
selectedClass: this.selectedClass,
27470
itemSelector: this.itemSelector || '.' + cls + '-item'
27473
this.view.on('click', this.onViewClick, this);
27475
this.bindStore(this.store, true);
27477
if(this.resizable){
27478
this.resizer = new Ext.Resizable(this.list, {
27479
pinned:true, handles:'se'
27481
this.resizer.on('resize', function(r, w, h){
27482
this.maxHeight = h-this.handleHeight-this.list.getFrameWidth('tb')-this.assetHeight;
27483
this.listWidth = w;
27484
this.innerList.setWidth(w - this.list.getFrameWidth('lr'));
27485
this.restrictHeight();
27487
this[this.pageSize?'footer':'innerList'].setStyle('margin-bottom', this.handleHeight+'px');
27492
bindStore : function(store, initial){
27493
if(this.store && !initial){
27494
this.store.un('beforeload', this.onBeforeLoad, this);
27495
this.store.un('load', this.onLoad, this);
27496
this.store.un('loadexception', this.collapse, this);
27500
this.view.setStore(null);
27505
this.store = Ext.StoreMgr.lookup(store);
27507
this.store.on('beforeload', this.onBeforeLoad, this);
27508
this.store.on('load', this.onLoad, this);
27509
this.store.on('loadexception', this.collapse, this);
27512
this.view.setStore(store);
27517
initEvents : function(){
27518
Ext.form.ComboBox.superclass.initEvents.call(this);
27520
this.keyNav = new Ext.KeyNav(this.el, {
27521
"up" : function(e){
27522
this.inKeyMode = true;
27526
"down" : function(e){
27527
if(!this.isExpanded()){
27528
this.onTriggerClick();
27530
this.inKeyMode = true;
27535
"enter" : function(e){
27536
this.onViewClick();
27537
this.delayedCheck = true;
27538
this.unsetDelayCheck.defer(10, this);
27541
"esc" : function(e){
27545
"tab" : function(e){
27546
this.onViewClick(false);
27552
doRelay : function(foo, bar, hname){
27553
if(hname == 'down' || this.scope.isExpanded()){
27554
return Ext.KeyNav.prototype.doRelay.apply(this, arguments);
27559
forceKeyDown : true
27561
this.queryDelay = Math.max(this.queryDelay || 10,
27562
this.mode == 'local' ? 10 : 250);
27563
this.dqTask = new Ext.util.DelayedTask(this.initQuery, this);
27564
if(this.typeAhead){
27565
this.taTask = new Ext.util.DelayedTask(this.onTypeAhead, this);
27567
if(this.editable !== false){
27568
this.el.on("keyup", this.onKeyUp, this);
27570
if(this.forceSelection){
27571
this.on('blur', this.doForce, this);
27575
onDestroy : function(){
27577
this.view.el.removeAllListeners();
27578
this.view.el.remove();
27579
this.view.purgeListeners();
27582
this.list.destroy();
27584
this.bindStore(null);
27585
Ext.form.ComboBox.superclass.onDestroy.call(this);
27588
unsetDelayCheck : function(){
27589
delete this.delayedCheck;
27592
fireKey : function(e){
27593
if(e.isNavKeyPress() && !this.isExpanded() && !this.delayedCheck){
27594
this.fireEvent("specialkey", this, e);
27598
onResize: function(w, h){
27599
Ext.form.ComboBox.superclass.onResize.apply(this, arguments);
27600
if(this.list && this.listWidth === undefined){
27601
var lw = Math.max(w, this.minListWidth);
27602
this.list.setWidth(lw);
27603
this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));
27607
onEnable: function(){
27608
Ext.form.ComboBox.superclass.onEnable.apply(this, arguments);
27609
if(this.hiddenField){
27610
this.hiddenField.disabled = false;
27614
onDisable: function(){
27615
Ext.form.ComboBox.superclass.onDisable.apply(this, arguments);
27616
if(this.hiddenField){
27617
this.hiddenField.disabled = true;
27622
setEditable : function(value){
27623
if(value == this.editable){
27626
this.editable = value;
27628
this.el.dom.setAttribute('readOnly', true);
27629
this.el.on('mousedown', this.onTriggerClick, this);
27630
this.el.addClass('x-combo-noedit');
27632
this.el.dom.setAttribute('readOnly', false);
27633
this.el.un('mousedown', this.onTriggerClick, this);
27634
this.el.removeClass('x-combo-noedit');
27638
onBeforeLoad : function(){
27639
if(!this.hasFocus){
27642
this.innerList.update(this.loadingText ?
27643
'<div class="loading-indicator">'+this.loadingText+'</div>' : '');
27644
this.restrictHeight();
27645
this.selectedIndex = -1;
27648
onLoad : function(){
27649
if(!this.hasFocus){
27652
if(this.store.getCount() > 0){
27654
this.restrictHeight();
27655
if(this.lastQuery == this.allQuery){
27657
this.el.dom.select();
27659
if(!this.selectByValue(this.value, true)){
27660
this.select(0, true);
27664
if(this.typeAhead && this.lastKey != Ext.EventObject.BACKSPACE && this.lastKey != Ext.EventObject.DELETE){
27665
this.taTask.delay(this.typeAheadDelay);
27669
this.onEmptyResults();
27673
onTypeAhead : function(){
27674
if(this.store.getCount() > 0){
27675
var r = this.store.getAt(0);
27676
var newValue = r.data[this.displayField];
27677
var len = newValue.length;
27678
var selStart = this.getRawValue().length;
27679
if(selStart != len){
27680
this.setRawValue(newValue);
27681
this.selectText(selStart, newValue.length);
27686
onSelect : function(record, index){
27687
if(this.fireEvent('beforeselect', this, record, index) !== false){
27688
this.setValue(record.data[this.valueField || this.displayField]);
27690
this.fireEvent('select', this, record, index);
27695
getValue : function(){
27696
if(this.valueField){
27697
return typeof this.value != 'undefined' ? this.value : '';
27699
return Ext.form.ComboBox.superclass.getValue.call(this);
27704
clearValue : function(){
27705
if(this.hiddenField){
27706
this.hiddenField.value = '';
27708
this.setRawValue('');
27709
this.lastSelectionText = '';
27710
this.applyEmptyText();
27715
setValue : function(v){
27717
if(this.valueField){
27718
var r = this.findRecord(this.valueField, v);
27720
text = r.data[this.displayField];
27721
}else if(this.valueNotFoundText !== undefined){
27722
text = this.valueNotFoundText;
27725
this.lastSelectionText = text;
27726
if(this.hiddenField){
27727
this.hiddenField.value = v;
27729
Ext.form.ComboBox.superclass.setValue.call(this, text);
27733
findRecord : function(prop, value){
27735
if(this.store.getCount() > 0){
27736
this.store.each(function(r){
27737
if(r.data[prop] == value){
27746
onViewMove : function(e, t){
27747
this.inKeyMode = false;
27750
onViewOver : function(e, t){
27751
if(this.inKeyMode){ return;
27753
var item = this.view.findItemFromChild(t);
27755
var index = this.view.indexOf(item);
27756
this.select(index, false);
27760
onViewClick : function(doFocus){
27761
var index = this.view.getSelectedIndexes()[0];
27762
var r = this.store.getAt(index);
27764
this.onSelect(r, index);
27766
if(doFocus !== false){
27771
restrictHeight : function(){
27772
this.innerList.dom.style.height = '';
27773
var inner = this.innerList.dom;
27774
var pad = this.list.getFrameWidth('tb')+(this.resizable?this.handleHeight:0)+this.assetHeight;
27775
var h = Math.max(inner.clientHeight, inner.offsetHeight, inner.scrollHeight);
27776
var ha = this.getPosition()[1]-Ext.getBody().getScroll().top;
27777
var hb = Ext.lib.Dom.getViewHeight()-ha-this.getSize().height;
27778
var space = Math.max(ha, hb, this.minHeight || 0)-this.list.shadowOffset-pad-5;
27779
h = Math.min(h, space, this.maxHeight);
27781
this.innerList.setHeight(h);
27782
this.list.beginUpdate();
27783
this.list.setHeight(h+pad);
27784
this.list.alignTo(this.wrap, this.listAlign);
27785
this.list.endUpdate();
27788
onEmptyResults : function(){
27793
isExpanded : function(){
27794
return this.list && this.list.isVisible();
27798
selectByValue : function(v, scrollIntoView){
27799
if(v !== undefined && v !== null){
27800
var r = this.findRecord(this.valueField || this.displayField, v);
27802
this.select(this.store.indexOf(r), scrollIntoView);
27810
select : function(index, scrollIntoView){
27811
this.selectedIndex = index;
27812
this.view.select(index);
27813
if(scrollIntoView !== false){
27814
var el = this.view.getNode(index);
27816
this.innerList.scrollChildIntoView(el, false);
27821
selectNext : function(){
27822
var ct = this.store.getCount();
27824
if(this.selectedIndex == -1){
27826
}else if(this.selectedIndex < ct-1){
27827
this.select(this.selectedIndex+1);
27832
selectPrev : function(){
27833
var ct = this.store.getCount();
27835
if(this.selectedIndex == -1){
27837
}else if(this.selectedIndex != 0){
27838
this.select(this.selectedIndex-1);
27843
onKeyUp : function(e){
27844
if(this.editable !== false && !e.isSpecialKey()){
27845
this.lastKey = e.getKey();
27846
this.dqTask.delay(this.queryDelay);
27850
validateBlur : function(){
27851
return !this.list || !this.list.isVisible();
27854
initQuery : function(){
27855
this.doQuery(this.getRawValue());
27858
doForce : function(){
27859
if(this.el.dom.value.length > 0){
27860
this.el.dom.value =
27861
this.lastSelectionText === undefined ? '' : this.lastSelectionText;
27862
this.applyEmptyText();
27867
doQuery : function(q, forceAll){
27868
if(q === undefined || q === null){
27873
forceAll: forceAll,
27877
if(this.fireEvent('beforequery', qe)===false || qe.cancel){
27881
forceAll = qe.forceAll;
27882
if(forceAll === true || (q.length >= this.minChars)){
27883
if(this.lastQuery !== q){
27884
this.lastQuery = q;
27885
if(this.mode == 'local'){
27886
this.selectedIndex = -1;
27888
this.store.clearFilter();
27890
this.store.filter(this.displayField, q);
27894
this.store.baseParams[this.queryParam] = q;
27896
params: this.getParams(q)
27901
this.selectedIndex = -1;
27907
getParams : function(q){
27911
p.limit = this.pageSize;
27917
collapse : function(){
27918
if(!this.isExpanded()){
27922
Ext.getDoc().un('mousewheel', this.collapseIf, this);
27923
Ext.getDoc().un('mousedown', this.collapseIf, this);
27924
this.fireEvent('collapse', this);
27927
collapseIf : function(e){
27928
if(!e.within(this.wrap) && !e.within(this.list)){
27934
expand : function(){
27935
if(this.isExpanded() || !this.hasFocus){
27938
this.list.alignTo(this.wrap, this.listAlign);
27940
this.innerList.setOverflow('auto'); Ext.getDoc().on('mousewheel', this.collapseIf, this);
27941
Ext.getDoc().on('mousedown', this.collapseIf, this);
27942
this.fireEvent('expand', this);
27946
onTriggerClick : function(){
27950
if(this.isExpanded()){
27955
if(this.triggerAction == 'all') {
27956
this.doQuery(this.allQuery, true);
27958
this.doQuery(this.getRawValue());
27970
Ext.reg('combo', Ext.form.ComboBox);
27972
Ext.form.Checkbox = Ext.extend(Ext.form.Field, {
27974
checkedCls: 'x-form-check-checked',
27976
focusCls: 'x-form-check-focus',
27978
overCls: 'x-form-check-over',
27980
mouseDownCls: 'x-form-check-down',
27986
defaultAutoCreate: {tag: 'input', type: 'checkbox', autocomplete: 'off'},
27991
baseCls: 'x-form-check',
27993
initComponent : function(){
27994
Ext.form.Checkbox.superclass.initComponent.call(this);
28001
initEvents : function(){
28002
Ext.form.Checkbox.superclass.initEvents.call(this);
28003
this.initCheckEvents();
28006
initCheckEvents : function(){
28007
this.innerWrap.removeAllListeners();
28008
this.innerWrap.addClassOnOver(this.overCls);
28009
this.innerWrap.addClassOnClick(this.mouseDownCls);
28010
this.innerWrap.on('click', this.onClick, this);
28011
this.innerWrap.on('keyup', this.onKeyUp, this);
28014
onRender : function(ct, position){
28015
Ext.form.Checkbox.superclass.onRender.call(this, ct, position);
28016
if(this.inputValue !== undefined){
28017
this.el.dom.value = this.inputValue;
28019
this.el.addClass('x-hidden');
28021
this.innerWrap = this.el.wrap({
28022
tabIndex: this.tabIndex,
28023
cls: this.baseCls+'-wrap-inner'
28025
this.wrap = this.innerWrap.wrap({cls: this.baseCls+'-wrap'});
28028
this.labelEl = this.innerWrap.createChild({
28030
htmlFor: this.el.id,
28031
cls: 'x-form-cb-label',
28032
html: this.boxLabel
28036
this.imageEl = this.innerWrap.createChild({
28038
src: Ext.BLANK_IMAGE_URL,
28043
this.setValue(true);
28045
this.checked = this.el.dom.checked;
28047
this.originalValue = this.checked;
28050
onDestroy : function(){
28052
Ext.destroy(this.imageEl, this.labelEl, this.innerWrap, this.wrap);
28054
Ext.form.Checkbox.superclass.onDestroy.call(this);
28057
onFocus: function(e) {
28058
Ext.form.Checkbox.superclass.onFocus.call(this, e);
28059
this.el.addClass(this.focusCls);
28062
onBlur: function(e) {
28063
Ext.form.Checkbox.superclass.onBlur.call(this, e);
28064
this.el.removeClass(this.focusCls);
28067
onResize : function(){
28068
Ext.form.Checkbox.superclass.onResize.apply(this, arguments);
28069
if(!this.boxLabel && !this.fieldLabel){
28070
this.el.alignTo(this.wrap, 'c-c');
28074
onKeyUp : function(e){
28075
if(e.getKey() == Ext.EventObject.SPACE){
28080
onClick : function(e){
28081
if (!this.disabled && !this.readOnly) {
28082
this.toggleValue();
28087
onEnable : function(){
28088
Ext.form.Checkbox.superclass.onEnable.call(this);
28089
this.initCheckEvents();
28092
onDisable : function(){
28093
Ext.form.Checkbox.superclass.onDisable.call(this);
28094
this.innerWrap.removeAllListeners();
28097
toggleValue : function(){
28098
this.setValue(!this.checked);
28101
getResizeEl : function(){
28102
if(!this.resizeEl){
28103
this.resizeEl = Ext.isSafari ? this.wrap : (this.wrap.up('.x-form-element', 5) || this.wrap);
28105
return this.resizeEl;
28108
getPositionEl : function(){
28112
getActionEl : function(){
28117
markInvalid : Ext.emptyFn,
28119
clearInvalid : Ext.emptyFn,
28121
initValue : Ext.emptyFn,
28124
getValue : function(){
28126
return this.el.dom.checked;
28132
setValue : function(v) {
28133
var checked = this.checked;
28134
this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
28136
if(this.el && this.el.dom){
28137
this.el.dom.checked = this.checked;
28138
this.el.dom.defaultChecked = this.checked;
28140
this.wrap[this.checked? 'addClass' : 'removeClass'](this.checkedCls);
28142
if(checked != this.checked){
28143
this.fireEvent("check", this, this.checked);
28145
this.handler.call(this.scope || this, this, this.checked);
28154
Ext.reg('checkbox', Ext.form.Checkbox);
28157
Ext.form.CheckboxGroup = Ext.extend(Ext.form.Field, {
28165
blankText : "You must select at least one item in this group",
28167
defaultType : 'checkbox',
28169
groupCls: 'x-form-check-group',
28171
onRender : function(ct, position){
28174
cls: this.groupCls,
28180
defaultType: this.defaultType,
28189
if(this.items[0].items){
28192
Ext.apply(panelCfg, {
28193
layoutConfig: {columns: this.items.length},
28194
defaults: this.defaults,
28197
for(var i=0, len=this.items.length; i<len; i++){
28198
Ext.applyIf(this.items[i], colCfg);
28204
var numCols, cols = [];
28206
if(typeof this.columns == 'string'){ this.columns = this.items.length;
28208
if(!Ext.isArray(this.columns)){
28210
for(var i=0; i<this.columns; i++){
28211
cs.push((100/this.columns)*.01); }
28215
numCols = this.columns.length;
28217
for(var i=0; i<numCols; i++){
28218
var cc = Ext.apply({items:[]}, colCfg);
28219
cc[this.columns[i] <= 1 ? 'columnWidth' : 'width'] = this.columns[i];
28221
cc.defaults = Ext.apply(cc.defaults || {}, this.defaults)
28227
var rows = Math.ceil(this.items.length / numCols), ri = 0;
28228
for(var i=0, len=this.items.length; i<len; i++){
28229
if(i>0 && i%rows==0){
28232
if(this.items[i].fieldLabel){
28233
this.items[i].hideLabel = false;
28235
cols[ri].items.push(this.items[i]);
28238
for(var i=0, len=this.items.length; i<len; i++){
28239
var ci = i % numCols;
28240
if(this.items[i].fieldLabel){
28241
this.items[i].hideLabel = false;
28243
cols[ci].items.push(this.items[i]);
28247
Ext.apply(panelCfg, {
28248
layoutConfig: {columns: numCols},
28253
this.panel = new Ext.Panel(panelCfg);
28254
this.el = this.panel.getEl();
28256
if(this.forId && this.itemCls){
28257
var l = this.el.up(this.itemCls).child('label', true);
28259
l.setAttribute('htmlFor', this.forId);
28263
var fields = this.panel.findBy(function(c){
28264
return c.isFormField;
28267
this.items = new Ext.util.MixedCollection();
28268
this.items.addAll(fields);
28270
Ext.form.CheckboxGroup.superclass.onRender.call(this, ct, position);
28273
validateValue : function(value){
28274
if(!this.allowBlank){
28276
this.items.each(function(f){
28278
return blank = false;
28282
this.markInvalid(this.blankText);
28289
onDisable : function(){
28290
this.items.each(function(item){
28295
onEnable : function(){
28296
this.items.each(function(item){
28301
onResize : function(w, h){
28302
this.panel.setSize(w, h);
28303
this.panel.doLayout();
28306
reset : function(){
28307
Ext.form.CheckboxGroup.superclass.reset.call(this);
28308
this.items.each(function(c){
28317
initValue : Ext.emptyFn,
28319
getValue : Ext.emptyFn,
28321
getRawValue : Ext.emptyFn,
28323
setValue : Ext.emptyFn,
28325
setRawValue : Ext.emptyFn
28329
Ext.reg('checkboxgroup', Ext.form.CheckboxGroup);
28332
Ext.form.Radio = Ext.extend(Ext.form.Checkbox, {
28333
inputType: 'radio',
28334
baseCls: 'x-form-radio',
28337
getGroupValue : function(){
28338
var c = this.getParent().child('input[name='+this.el.dom.name+']:checked', true);
28339
return c ? c.value : null;
28342
getParent : function(){
28343
return this.el.up('form') || Ext.getBody();
28346
toggleValue : function() {
28348
var els = this.getParent().select('input[name='+this.el.dom.name+']');
28349
els.each(function(el){
28350
if(el.dom.id == this.id){
28351
this.setValue(true);
28353
Ext.getCmp(el.dom.id).setValue(false);
28360
setValue : function(v){
28361
if(typeof v=='boolean') {
28362
Ext.form.Radio.superclass.setValue.call(this, v);
28364
var r = this.getParent().child('input[name='+this.el.dom.name+'][value='+v+']', true);
28365
if(r && !r.checked){
28366
Ext.getCmp(r.id).toggleValue();
28372
markInvalid : Ext.emptyFn,
28374
clearInvalid : Ext.emptyFn
28377
Ext.reg('radio', Ext.form.Radio);
28380
Ext.form.RadioGroup = Ext.extend(Ext.form.CheckboxGroup, {
28384
blankText : "You must select one item in this group",
28386
defaultType : 'radio',
28388
groupCls: 'x-form-radio-group'
28391
Ext.reg('radiogroup', Ext.form.RadioGroup);
28394
Ext.form.Hidden = Ext.extend(Ext.form.Field, {
28396
inputType : 'hidden',
28399
onRender : function(){
28400
Ext.form.Hidden.superclass.onRender.apply(this, arguments);
28404
initEvents : function(){
28405
this.originalValue = this.getValue();
28409
setSize : Ext.emptyFn,
28410
setWidth : Ext.emptyFn,
28411
setHeight : Ext.emptyFn,
28412
setPosition : Ext.emptyFn,
28413
setPagePosition : Ext.emptyFn,
28414
markInvalid : Ext.emptyFn,
28415
clearInvalid : Ext.emptyFn
28417
Ext.reg('hidden', Ext.form.Hidden);
28419
Ext.form.BasicForm = function(el, config){
28420
Ext.apply(this, config);
28422
this.items = new Ext.util.MixedCollection(false, function(o){
28423
return o.id || (o.id = Ext.id());
28437
Ext.form.BasicForm.superclass.constructor.call(this);
28440
Ext.extend(Ext.form.BasicForm, Ext.util.Observable, {
28450
activeAction : null,
28453
trackResetOnLoad : false,
28458
initEl : function(el){
28459
this.el = Ext.get(el);
28460
this.id = this.el.id || Ext.id();
28461
if(!this.standardSubmit){
28462
this.el.on('submit', this.onSubmit, this);
28464
this.el.addClass('x-form');
28472
onSubmit : function(e){
28476
destroy: function() {
28477
this.items.each(function(f){
28481
this.el.removeAllListeners();
28484
this.purgeListeners();
28488
isValid : function(){
28490
this.items.each(function(f){
28499
isDirty : function(){
28501
this.items.each(function(f){
28511
doAction : function(action, options){
28512
if(typeof action == 'string'){
28513
action = new Ext.form.Action.ACTION_TYPES[action](this, options);
28515
if(this.fireEvent('beforeaction', this, action) !== false){
28516
this.beforeAction(action);
28517
action.run.defer(100, action);
28523
submit : function(options){
28524
if(this.standardSubmit){
28525
var v = this.isValid();
28527
this.el.dom.submit();
28531
this.doAction('submit', options);
28536
load : function(options){
28537
this.doAction('load', options);
28542
updateRecord : function(record){
28543
record.beginEdit();
28544
var fs = record.fields;
28545
fs.each(function(f){
28546
var field = this.findField(f.name);
28548
record.set(f.name, field.getValue());
28556
loadRecord : function(record){
28557
this.setValues(record.data);
28561
beforeAction : function(action){
28562
var o = action.options;
28564
if(this.waitMsgTarget === true){
28565
this.el.mask(o.waitMsg, 'x-mask-loading');
28566
}else if(this.waitMsgTarget){
28567
this.waitMsgTarget = Ext.get(this.waitMsgTarget);
28568
this.waitMsgTarget.mask(o.waitMsg, 'x-mask-loading');
28570
Ext.MessageBox.wait(o.waitMsg, o.waitTitle || this.waitTitle || 'Please Wait...');
28575
afterAction : function(action, success){
28576
this.activeAction = null;
28577
var o = action.options;
28579
if(this.waitMsgTarget === true){
28581
}else if(this.waitMsgTarget){
28582
this.waitMsgTarget.unmask();
28584
Ext.MessageBox.updateProgress(1);
28585
Ext.MessageBox.hide();
28592
Ext.callback(o.success, o.scope, [this, action]);
28593
this.fireEvent('actioncomplete', this, action);
28595
Ext.callback(o.failure, o.scope, [this, action]);
28596
this.fireEvent('actionfailed', this, action);
28601
findField : function(id){
28602
var field = this.items.get(id);
28604
this.items.each(function(f){
28605
if(f.isFormField && (f.dataIndex == id || f.id == id || f.getName() == id)){
28611
return field || null;
28616
markInvalid : function(errors){
28617
if(Ext.isArray(errors)){
28618
for(var i = 0, len = errors.length; i < len; i++){
28619
var fieldError = errors[i];
28620
var f = this.findField(fieldError.id);
28622
f.markInvalid(fieldError.msg);
28628
if(typeof errors[id] != 'function' && (field = this.findField(id))){
28629
field.markInvalid(errors[id]);
28637
setValues : function(values){
28638
if(Ext.isArray(values)){ for(var i = 0, len = values.length; i < len; i++){
28640
var f = this.findField(v.id);
28642
f.setValue(v.value);
28643
if(this.trackResetOnLoad){
28644
f.originalValue = f.getValue();
28648
}else{ var field, id;
28650
if(typeof values[id] != 'function' && (field = this.findField(id))){
28651
field.setValue(values[id]);
28652
if(this.trackResetOnLoad){
28653
field.originalValue = field.getValue();
28662
getValues : function(asString){
28663
var fs = Ext.lib.Ajax.serializeForm(this.el.dom);
28664
if(asString === true){
28667
return Ext.urlDecode(fs);
28671
clearInvalid : function(){
28672
this.items.each(function(f){
28679
reset : function(){
28680
this.items.each(function(f){
28688
this.items.addAll(Array.prototype.slice.call(arguments, 0));
28694
remove : function(field){
28695
this.items.remove(field);
28700
render : function(){
28701
this.items.each(function(f){
28702
if(f.isFormField && !f.rendered && document.getElementById(f.id)){ f.applyToMarkup(f.id);
28709
applyToFields : function(o){
28710
this.items.each(function(f){
28717
applyIfToFields : function(o){
28718
this.items.each(function(f){
28725
Ext.BasicForm = Ext.form.BasicForm;
28727
Ext.FormPanel = Ext.extend(Ext.Panel, {
28732
buttonAlign:'center',
28741
monitorValid : false,
28749
initComponent :function(){
28750
this.form = this.createForm();
28754
cls: this.baseCls + '-body',
28755
method : this.method || 'POST',
28756
id : this.formId || Ext.id()
28758
if(this.fileUpload) {
28759
this.bodyCfg.enctype = 'multipart/form-data';
28762
Ext.FormPanel.superclass.initComponent.call(this);
28769
this.relayEvents(this.form, ['beforeaction', 'actionfailed', 'actioncomplete']);
28772
createForm: function(){
28773
delete this.initialConfig.listeners;
28774
return new Ext.form.BasicForm(null, this.initialConfig);
28777
initFields : function(){
28779
var formPanel = this;
28780
var fn = function(c){
28783
}else if(c.doLayout && c != formPanel){
28785
labelAlign: c.ownerCt.labelAlign,
28786
labelWidth: c.ownerCt.labelWidth,
28787
itemCls: c.ownerCt.itemCls
28794
this.items.each(fn);
28797
getLayoutTarget : function(){
28798
return this.form.el;
28802
getForm : function(){
28806
onRender : function(ct, position){
28809
Ext.FormPanel.superclass.onRender.call(this, ct, position);
28810
this.form.initEl(this.body);
28813
beforeDestroy: function(){
28814
Ext.FormPanel.superclass.beforeDestroy.call(this);
28815
this.stopMonitoring();
28816
Ext.destroy(this.form);
28819
initEvents : function(){
28820
Ext.FormPanel.superclass.initEvents.call(this);
28821
this.items.on('remove', this.onRemove, this);
28822
this.items.on('add', this.onAdd, this);
28823
if(this.monitorValid){ this.startMonitoring();
28827
onAdd : function(ct, c) {
28828
if (c.isFormField) {
28833
onRemove : function(c) {
28834
if (c.isFormField) {
28835
Ext.destroy(c.container.up('.x-form-item'));
28836
this.form.remove(c);
28841
startMonitoring : function(){
28844
Ext.TaskMgr.start({
28845
run : this.bindHandler,
28846
interval : this.monitorPoll || 200,
28853
stopMonitoring : function(){
28854
this.bound = false;
28859
this.form.load.apply(this.form, arguments);
28862
onDisable : function(){
28863
Ext.FormPanel.superclass.onDisable.call(this);
28865
this.form.items.each(function(){
28871
onEnable : function(){
28872
Ext.FormPanel.superclass.onEnable.call(this);
28874
this.form.items.each(function(){
28880
bindHandler : function(){
28884
this.form.items.each(function(f){
28885
if(!f.isValid(true)){
28891
for(var i = 0, len = this.buttons.length; i < len; i++){
28892
var btn = this.buttons[i];
28893
if(btn.formBind === true && btn.disabled === valid){
28894
btn.setDisabled(!valid);
28898
this.fireEvent('clientvalidation', this, valid);
28901
Ext.reg('form', Ext.FormPanel);
28903
Ext.form.FormPanel = Ext.FormPanel;
28907
Ext.form.FieldSet = Ext.extend(Ext.Panel, {
28913
baseCls:'x-fieldset',
28918
onRender : function(ct, position){
28920
this.el = document.createElement('fieldset');
28921
this.el.id = this.id;
28922
if (this.title || this.header || this.checkboxToggle) {
28923
this.el.appendChild(document.createElement('legend')).className = 'x-fieldset-header';
28927
Ext.form.FieldSet.superclass.onRender.call(this, ct, position);
28929
if(this.checkboxToggle){
28930
var o = typeof this.checkboxToggle == 'object' ?
28931
this.checkboxToggle :
28932
{tag: 'input', type: 'checkbox', name: this.checkboxName || this.id+'-checkbox'};
28933
this.checkbox = this.header.insertFirst(o);
28934
this.checkbox.dom.checked = !this.collapsed;
28935
this.checkbox.on('click', this.onCheckClick, this);
28940
onCollapse : function(doAnim, animArg){
28942
this.checkbox.dom.checked = false;
28944
this.afterCollapse();
28949
onExpand : function(doAnim, animArg){
28951
this.checkbox.dom.checked = true;
28953
this.afterExpand();
28957
onCheckClick : function(){
28958
this[this.checkbox.dom.checked ? 'expand' : 'collapse']();
28999
Ext.reg('fieldset', Ext.form.FieldSet);
29004
Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, {
29006
enableFormat : true,
29008
enableFontSize : true,
29010
enableColors : true,
29012
enableAlignments : true,
29014
enableLists : true,
29016
enableSourceEdit : true,
29018
enableLinks : true,
29022
createLinkText : 'Please enter the URL for the link:',
29024
defaultLinkValue : 'http:/'+'/',
29033
defaultFont: 'tahoma',
29036
validationEvent : false,
29038
initialized : false,
29040
sourceEditMode : false,
29041
onFocus : Ext.emptyFn,
29043
hideMode:'offsets',
29044
defaultAutoCreate : {
29046
style:"width:500px;height:300px;",
29047
autocomplete: "off"
29051
initComponent : function(){
29071
createFontOptions : function(){
29072
var buf = [], fs = this.fontFamilies, ff, lc;
29073
for(var i = 0, len = fs.length; i< len; i++){
29075
lc = ff.toLowerCase();
29077
'<option value="',lc,'" style="font-family:',ff,';"',
29078
(this.defaultFont == lc ? ' selected="true">' : '>'),
29083
return buf.join('');
29087
createToolbar : function(editor){
29089
var tipsEnabled = Ext.QuickTips && Ext.QuickTips.isEnabled();
29091
function btn(id, toggle, handler){
29094
cls : 'x-btn-icon x-edit-'+id,
29095
enableToggle:toggle !== false,
29097
handler:handler||editor.relayBtnCmd,
29098
clickEvent:'mousedown',
29099
tooltip: tipsEnabled ? editor.buttonTips[id] || undefined : undefined,
29105
var tb = new Ext.Toolbar({
29106
renderTo:this.wrap.dom.firstChild
29110
tb.el.on('click', function(e){
29111
e.preventDefault();
29114
if(this.enableFont && !Ext.isSafari2){
29115
this.fontSelect = tb.el.createChild({
29117
cls:'x-font-select',
29118
html: this.createFontOptions()
29120
this.fontSelect.on('change', function(){
29121
var font = this.fontSelect.dom.value;
29122
this.relayCmd('fontname', font);
29126
this.fontSelect.dom,
29131
if(this.enableFormat){
29139
if(this.enableFontSize){
29142
btn('increasefontsize', false, this.adjustFont),
29143
btn('decreasefontsize', false, this.adjustFont)
29147
if(this.enableColors){
29150
itemId:'forecolor',
29151
cls:'x-btn-icon x-edit-forecolor',
29152
clickEvent:'mousedown',
29153
tooltip: tipsEnabled ? editor.buttonTips['forecolor'] || undefined : undefined,
29155
menu : new Ext.menu.ColorMenu({
29156
allowReselect: true,
29157
focus: Ext.emptyFn,
29160
selectHandler: function(cp, color){
29161
this.execCmd('forecolor', Ext.isSafari || Ext.isIE ? '#'+color : color);
29165
clickEvent:'mousedown'
29168
itemId:'backcolor',
29169
cls:'x-btn-icon x-edit-backcolor',
29170
clickEvent:'mousedown',
29171
tooltip: tipsEnabled ? editor.buttonTips['backcolor'] || undefined : undefined,
29173
menu : new Ext.menu.ColorMenu({
29174
focus: Ext.emptyFn,
29177
allowReselect: true,
29178
selectHandler: function(cp, color){
29180
this.execCmd('useCSS', false);
29181
this.execCmd('hilitecolor', color);
29182
this.execCmd('useCSS', true);
29185
this.execCmd(Ext.isOpera ? 'hilitecolor' : 'backcolor', Ext.isSafari || Ext.isIE ? '#'+color : color);
29190
clickEvent:'mousedown'
29196
if(this.enableAlignments){
29199
btn('justifyleft'),
29200
btn('justifycenter'),
29201
btn('justifyright')
29205
if(!Ext.isSafari2){
29206
if(this.enableLinks){
29209
btn('createlink', false, this.createLink)
29213
if(this.enableLists){
29216
btn('insertorderedlist'),
29217
btn('insertunorderedlist')
29220
if(this.enableSourceEdit){
29223
btn('sourceedit', true, function(btn){
29224
this.toggleSourceEdit(btn.pressed);
29234
getDocMarkup : function(){
29235
return '<html><head><style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style></head><body></body></html>';
29239
getEditorBody : function(){
29240
return this.doc.body || this.doc.documentElement;
29244
getDoc : function(){
29245
return Ext.isIE ? this.getWin().document : (this.iframe.contentDocument || this.getWin().document);
29249
getWin : function(){
29250
return Ext.isIE ? this.iframe.contentWindow : window.frames[this.iframe.name];
29254
onRender : function(ct, position){
29255
Ext.form.HtmlEditor.superclass.onRender.call(this, ct, position);
29256
this.el.dom.style.border = '0 none';
29257
this.el.dom.setAttribute('tabIndex', -1);
29258
this.el.addClass('x-hidden');
29260
this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;')
29262
this.wrap = this.el.wrap({
29263
cls:'x-html-editor-wrap', cn:{cls:'x-html-editor-tb'}
29266
this.createToolbar(this);
29268
this.tb.items.each(function(item){
29269
if(item.itemId != 'sourceedit'){
29274
var iframe = document.createElement('iframe');
29275
iframe.name = Ext.id();
29276
iframe.frameBorder = '0';
29278
iframe.src = Ext.isIE ? Ext.SSL_SECURE_URL : "javascript:;";
29280
this.wrap.dom.appendChild(iframe);
29282
this.iframe = iframe;
29286
if(this.autoMonitorDesignMode !== false){
29287
this.monitorTask = Ext.TaskMgr.start({
29288
run: this.checkDesignMode,
29295
var sz = this.el.getSize();
29296
this.setSize(sz.width, this.height || sz.height);
29300
initFrame : function(){
29301
this.doc = this.getDoc();
29302
this.win = this.getWin();
29305
this.doc.write(this.getDocMarkup());
29310
if(this.doc.body || this.doc.readyState == 'complete'){
29311
Ext.TaskMgr.stop(task);
29312
this.doc.designMode="on";
29313
this.initEditor.defer(10, this);
29320
Ext.TaskMgr.start(task);
29324
checkDesignMode : function(){
29325
if(this.wrap && this.wrap.dom.offsetWidth){
29326
var doc = this.getDoc();
29330
if(!doc.editorInitialized || String(doc.designMode).toLowerCase() != 'on'){
29337
onResize : function(w, h){
29338
Ext.form.HtmlEditor.superclass.onResize.apply(this, arguments);
29339
if(this.el && this.iframe){
29340
if(typeof w == 'number'){
29341
var aw = w - this.wrap.getFrameWidth('lr');
29342
this.el.setWidth(this.adjustWidth('textarea', aw));
29343
this.iframe.style.width = aw + 'px';
29345
if(typeof h == 'number'){
29346
var ah = h - this.wrap.getFrameWidth('tb') - this.tb.el.getHeight();
29347
this.el.setHeight(this.adjustWidth('textarea', ah));
29348
this.iframe.style.height = ah + 'px';
29350
this.getEditorBody().style.height = (ah - (this.iframePad*2)) + 'px';
29357
toggleSourceEdit : function(sourceEditMode){
29358
if(sourceEditMode === undefined){
29359
sourceEditMode = !this.sourceEditMode;
29361
this.sourceEditMode = sourceEditMode === true;
29362
var btn = this.tb.items.get('sourceedit');
29363
if(btn.pressed !== this.sourceEditMode){
29364
btn.toggle(this.sourceEditMode);
29367
if(this.sourceEditMode){
29368
this.tb.items.each(function(item){
29369
if(item.itemId != 'sourceedit'){
29374
this.iframe.className = 'x-hidden';
29375
this.el.removeClass('x-hidden');
29376
this.el.dom.removeAttribute('tabIndex');
29379
if(this.initialized){
29380
this.tb.items.each(function(item){
29385
this.iframe.className = '';
29386
this.el.addClass('x-hidden');
29387
this.el.dom.setAttribute('tabIndex', -1);
29390
var lastSize = this.lastSize;
29392
delete this.lastSize;
29393
this.setSize(lastSize);
29395
this.fireEvent('editmodechange', this, this.sourceEditMode);
29399
createLink : function(){
29400
var url = prompt(this.createLinkText, this.defaultLinkValue);
29401
if(url && url != 'http:/'+'/'){
29402
this.relayCmd('createlink', url);
29407
adjustSize : Ext.BoxComponent.prototype.adjustSize,
29410
getResizeEl : function(){
29415
getPositionEl : function(){
29420
initEvents : function(){
29421
this.originalValue = this.getValue();
29425
markInvalid : Ext.emptyFn,
29428
clearInvalid : Ext.emptyFn,
29431
setValue : function(v){
29432
Ext.form.HtmlEditor.superclass.setValue.call(this, v);
29437
cleanHtml : function(html){
29438
html = String(html);
29439
if(html.length > 5){
29441
html = html.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi, '');
29444
if(html == ' '){
29451
syncValue : function(){
29452
if(this.initialized){
29453
var bd = this.getEditorBody();
29454
var html = bd.innerHTML;
29456
var bs = bd.getAttribute('style');
29457
var m = bs.match(/text-align:(.*?);/i);
29459
html = '<div style="'+m[0]+'">' + html + '</div>';
29462
html = this.cleanHtml(html);
29463
if(this.fireEvent('beforesync', this, html) !== false){
29464
this.el.dom.value = html;
29465
this.fireEvent('sync', this, html);
29471
pushValue : function(){
29472
if(this.initialized){
29473
var v = this.el.dom.value;
29474
if(!this.activated && v.length < 1){
29477
if(this.fireEvent('beforepush', this, v) !== false){
29478
this.getEditorBody().innerHTML = v;
29479
this.fireEvent('push', this, v);
29485
deferFocus : function(){
29486
this.focus.defer(10, this);
29490
focus : function(){
29491
if(this.win && !this.sourceEditMode){
29499
initEditor : function(){
29500
var dbody = this.getEditorBody();
29501
var ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat');
29502
ss['background-attachment'] = 'fixed';
29503
dbody.bgProperties = 'fixed';
29505
Ext.DomHelper.applyStyles(dbody, ss);
29509
Ext.EventManager.removeAll(this.doc);
29513
this.doc = this.getDoc();
29515
Ext.EventManager.on(this.doc, {
29516
'mousedown': this.onEditorEvent,
29517
'dblclick': this.onEditorEvent,
29518
'click': this.onEditorEvent,
29519
'keyup': this.onEditorEvent,
29525
Ext.EventManager.on(this.doc, 'keypress', this.applyCommand, this);
29527
if(Ext.isIE || Ext.isSafari || Ext.isOpera){
29528
Ext.EventManager.on(this.doc, 'keydown', this.fixKeys, this);
29530
this.initialized = true;
29532
this.fireEvent('initialize', this);
29534
this.doc.editorInitialized = true;
29540
onDestroy : function(){
29541
if(this.monitorTask){
29542
Ext.TaskMgr.stop(this.monitorTask);
29545
this.tb.items.each(function(item){
29547
item.menu.removeAll();
29549
item.menu.el.destroy();
29554
this.wrap.dom.innerHTML = '';
29555
this.wrap.remove();
29560
onFirstFocus : function(){
29561
this.activated = true;
29562
this.tb.items.each(function(item){
29567
var s = this.win.getSelection();
29568
if(!s.focusNode || s.focusNode.nodeType != 3){
29569
var r = s.getRangeAt(0);
29570
r.selectNodeContents(this.getEditorBody());
29575
this.execCmd('useCSS', true);
29576
this.execCmd('styleWithCSS', false);
29579
this.fireEvent('activate', this);
29583
adjustFont: function(btn){
29584
var adjust = btn.itemId == 'increasefontsize' ? 1 : -1;
29586
var v = parseInt(this.doc.queryCommandValue('FontSize') || 2, 10);
29587
if(Ext.isSafari3 || Ext.isAir){
29603
v = v.constrain(1, 6);
29608
v = Math.max(1, v+adjust) + (Ext.isSafari ? 'px' : 0);
29610
this.execCmd('FontSize', v);
29614
onEditorEvent : function(e){
29615
this.updateToolbar();
29620
updateToolbar: function(){
29622
if(!this.activated){
29623
this.onFirstFocus();
29627
var btns = this.tb.items.map, doc = this.doc;
29629
if(this.enableFont && !Ext.isSafari2){
29630
var name = (this.doc.queryCommandValue('FontName')||this.defaultFont).toLowerCase();
29631
if(name != this.fontSelect.dom.value){
29632
this.fontSelect.dom.value = name;
29635
if(this.enableFormat){
29636
btns.bold.toggle(doc.queryCommandState('bold'));
29637
btns.italic.toggle(doc.queryCommandState('italic'));
29638
btns.underline.toggle(doc.queryCommandState('underline'));
29640
if(this.enableAlignments){
29641
btns.justifyleft.toggle(doc.queryCommandState('justifyleft'));
29642
btns.justifycenter.toggle(doc.queryCommandState('justifycenter'));
29643
btns.justifyright.toggle(doc.queryCommandState('justifyright'));
29645
if(!Ext.isSafari2 && this.enableLists){
29646
btns.insertorderedlist.toggle(doc.queryCommandState('insertorderedlist'));
29647
btns.insertunorderedlist.toggle(doc.queryCommandState('insertunorderedlist'));
29650
Ext.menu.MenuMgr.hideAll();
29656
relayBtnCmd : function(btn){
29657
this.relayCmd(btn.itemId);
29661
relayCmd : function(cmd, value){
29664
this.execCmd(cmd, value);
29665
this.updateToolbar();
29666
}).defer(10, this);
29670
execCmd : function(cmd, value){
29671
this.doc.execCommand(cmd, false, value === undefined ? null : value);
29676
applyCommand : function(e){
29678
var c = e.getCharCode(), cmd;
29680
c = String.fromCharCode(c);
29696
e.preventDefault();
29703
insertAtCursor : function(text){
29704
if(!this.activated){
29709
var r = this.doc.selection.createRange();
29716
}else if(Ext.isGecko || Ext.isOpera){
29718
this.execCmd('InsertHTML', text);
29720
}else if(Ext.isSafari){
29721
this.execCmd('InsertText', text);
29727
fixKeys : function(){
29729
return function(e){
29730
var k = e.getKey(), r;
29733
r = this.doc.selection.createRange();
29736
r.pasteHTML(' ');
29739
}else if(k == e.ENTER){
29740
r = this.doc.selection.createRange();
29742
var target = r.parentElement();
29743
if(!target || target.tagName.toLowerCase() != 'li'){
29745
r.pasteHTML('<br />');
29752
}else if(Ext.isOpera){
29753
return function(e){
29754
var k = e.getKey();
29758
this.execCmd('InsertHTML',' ');
29762
}else if(Ext.isSafari){
29763
return function(e){
29764
var k = e.getKey();
29767
this.execCmd('InsertText','\t');
29775
getToolbar : function(){
29782
title: 'Bold (Ctrl+B)',
29783
text: 'Make the selected text bold.',
29784
cls: 'x-html-editor-tip'
29787
title: 'Italic (Ctrl+I)',
29788
text: 'Make the selected text italic.',
29789
cls: 'x-html-editor-tip'
29792
title: 'Underline (Ctrl+U)',
29793
text: 'Underline the selected text.',
29794
cls: 'x-html-editor-tip'
29796
increasefontsize : {
29797
title: 'Grow Text',
29798
text: 'Increase the font size.',
29799
cls: 'x-html-editor-tip'
29801
decreasefontsize : {
29802
title: 'Shrink Text',
29803
text: 'Decrease the font size.',
29804
cls: 'x-html-editor-tip'
29807
title: 'Text Highlight Color',
29808
text: 'Change the background color of the selected text.',
29809
cls: 'x-html-editor-tip'
29812
title: 'Font Color',
29813
text: 'Change the color of the selected text.',
29814
cls: 'x-html-editor-tip'
29817
title: 'Align Text Left',
29818
text: 'Align text to the left.',
29819
cls: 'x-html-editor-tip'
29822
title: 'Center Text',
29823
text: 'Center text in the editor.',
29824
cls: 'x-html-editor-tip'
29827
title: 'Align Text Right',
29828
text: 'Align text to the right.',
29829
cls: 'x-html-editor-tip'
29831
insertunorderedlist : {
29832
title: 'Bullet List',
29833
text: 'Start a bulleted list.',
29834
cls: 'x-html-editor-tip'
29836
insertorderedlist : {
29837
title: 'Numbered List',
29838
text: 'Start a numbered list.',
29839
cls: 'x-html-editor-tip'
29842
title: 'Hyperlink',
29843
text: 'Make the selected text a hyperlink.',
29844
cls: 'x-html-editor-tip'
29847
title: 'Source Edit',
29848
text: 'Switch to source editing mode.',
29849
cls: 'x-html-editor-tip'
29888
Ext.reg('htmleditor', Ext.form.HtmlEditor);
29890
Ext.form.TimeField = Ext.extend(Ext.form.ComboBox, {
29896
minText : "The time in this field must be equal to or after {0}",
29898
maxText : "The time in this field must be equal to or before {0}",
29900
invalidText : "{0} is not a valid time",
29904
altFormats : "g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H",
29911
triggerAction: 'all',
29918
initDate: '1/1/2008',
29921
initComponent : function(){
29922
Ext.form.TimeField.superclass.initComponent.call(this);
29924
if(typeof this.minValue == "string"){
29925
this.minValue = this.parseDate(this.minValue);
29927
if(typeof this.maxValue == "string"){
29928
this.maxValue = this.parseDate(this.maxValue);
29932
var min = this.parseDate(this.minValue);
29934
min = new Date(this.initDate).clearTime();
29936
var max = this.parseDate(this.maxValue);
29938
max = new Date(this.initDate).clearTime().add('mi', (24 * 60) - 1);
29942
times.push([min.dateFormat(this.format)]);
29943
min = min.add('mi', this.increment);
29945
this.store = new Ext.data.SimpleStore({
29949
this.displayField = 'text';
29954
getValue : function(){
29955
var v = Ext.form.TimeField.superclass.getValue.call(this);
29956
return this.formatDate(this.parseDate(v)) || '';
29960
setValue : function(value){
29961
Ext.form.TimeField.superclass.setValue.call(this, this.formatDate(this.parseDate(value)));
29965
validateValue : Ext.form.DateField.prototype.validateValue,
29966
parseDate : Ext.form.DateField.prototype.parseDate,
29967
formatDate : Ext.form.DateField.prototype.formatDate,
29970
beforeBlur : function(){
29971
var v = this.parseDate(this.getRawValue());
29973
this.setValue(v.dateFormat(this.format));
29982
Ext.reg('timefield', Ext.form.TimeField);
29984
Ext.form.Label = Ext.extend(Ext.BoxComponent, {
29989
onRender : function(ct, position){
29991
this.el = document.createElement('label');
29992
this.el.id = this.getId();
29993
this.el.innerHTML = this.text ? Ext.util.Format.htmlEncode(this.text) : (this.html || '');
29995
this.el.setAttribute('htmlFor', this.forId);
29998
Ext.form.Label.superclass.onRender.call(this, ct, position);
30002
setText: function(t, encode){
30005
this.el.dom.innerHTML = encode !== false ? Ext.util.Format.htmlEncode(t) : t;
30011
Ext.reg('label', Ext.form.Label);
30013
Ext.form.Action = function(form, options){
30015
this.options = options || {};
30019
Ext.form.Action.CLIENT_INVALID = 'client';
30021
Ext.form.Action.SERVER_INVALID = 'server';
30023
Ext.form.Action.CONNECT_FAILURE = 'connect';
30025
Ext.form.Action.LOAD_FAILURE = 'load';
30027
Ext.form.Action.prototype = {
30043
run : function(options){
30047
success : function(response){
30051
handleResponse : function(response){
30055
failure : function(response){
30056
this.response = response;
30057
this.failureType = Ext.form.Action.CONNECT_FAILURE;
30058
this.form.afterAction(this, false);
30061
processResponse : function(response){
30062
this.response = response;
30063
if(!response.responseText){
30066
this.result = this.handleResponse(response);
30067
return this.result;
30070
getUrl : function(appendParams){
30071
var url = this.options.url || this.form.url || this.form.el.dom.action;
30073
var p = this.getParams();
30075
url += (url.indexOf('?') != -1 ? '&' : '?') + p;
30081
getMethod : function(){
30082
return (this.options.method || this.form.method || this.form.el.dom.method || 'POST').toUpperCase();
30085
getParams : function(){
30086
var bp = this.form.baseParams;
30087
var p = this.options.params;
30089
if(typeof p == "object"){
30090
p = Ext.urlEncode(Ext.applyIf(p, bp));
30091
}else if(typeof p == 'string' && bp){
30092
p += '&' + Ext.urlEncode(bp);
30095
p = Ext.urlEncode(bp);
30100
createCallback : function(opts){
30101
var opts = opts || {};
30103
success: this.success,
30104
failure: this.failure,
30106
timeout: (opts.timeout*1000) || (this.form.timeout*1000),
30107
upload: this.form.fileUpload ? this.success : undefined
30113
Ext.form.Action.Submit = function(form, options){
30114
Ext.form.Action.Submit.superclass.constructor.call(this, form, options);
30117
Ext.extend(Ext.form.Action.Submit, Ext.form.Action, {
30123
var o = this.options;
30124
var method = this.getMethod();
30125
var isGet = method == 'GET';
30126
if(o.clientValidation === false || this.form.isValid()){
30127
Ext.Ajax.request(Ext.apply(this.createCallback(o), {
30128
form:this.form.el.dom,
30129
url:this.getUrl(isGet),
30131
headers: o.headers,
30132
params:!isGet ? this.getParams() : null,
30133
isUpload: this.form.fileUpload
30135
}else if (o.clientValidation !== false){ this.failureType = Ext.form.Action.CLIENT_INVALID;
30136
this.form.afterAction(this, false);
30140
success : function(response){
30141
var result = this.processResponse(response);
30142
if(result === true || result.success){
30143
this.form.afterAction(this, true);
30147
this.form.markInvalid(result.errors);
30148
this.failureType = Ext.form.Action.SERVER_INVALID;
30150
this.form.afterAction(this, false);
30153
handleResponse : function(response){
30154
if(this.form.errorReader){
30155
var rs = this.form.errorReader.read(response);
30158
for(var i = 0, len = rs.records.length; i < len; i++) {
30159
var r = rs.records[i];
30160
errors[i] = r.data;
30163
if(errors.length < 1){
30167
success : rs.success,
30171
return Ext.decode(response.responseText);
30177
Ext.form.Action.Load = function(form, options){
30178
Ext.form.Action.Load.superclass.constructor.call(this, form, options);
30179
this.reader = this.form.reader;
30182
Ext.extend(Ext.form.Action.Load, Ext.form.Action, {
30186
Ext.Ajax.request(Ext.apply(
30187
this.createCallback(this.options), {
30188
method:this.getMethod(),
30189
url:this.getUrl(false),
30190
headers: this.options.headers,
30191
params:this.getParams()
30195
success : function(response){
30196
var result = this.processResponse(response);
30197
if(result === true || !result.success || !result.data){
30198
this.failureType = Ext.form.Action.LOAD_FAILURE;
30199
this.form.afterAction(this, false);
30202
this.form.clearInvalid();
30203
this.form.setValues(result.data);
30204
this.form.afterAction(this, true);
30207
handleResponse : function(response){
30208
if(this.form.reader){
30209
var rs = this.form.reader.read(response);
30210
var data = rs.records && rs.records[0] ? rs.records[0].data : null;
30212
success : rs.success,
30216
return Ext.decode(response.responseText);
30220
Ext.form.Action.ACTION_TYPES = {
30221
'load' : Ext.form.Action.Load,
30222
'submit' : Ext.form.Action.Submit
30226
Ext.form.VTypes = function(){
30227
var alpha = /^[a-zA-Z_]+$/;
30228
var alphanum = /^[a-zA-Z0-9_]+$/;
30229
var email = /^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/;
30230
var url = /(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
30234
'email' : function(v){
30235
return email.test(v);
30238
'emailText' : 'This field should be an e-mail address in the format "user@domain.com"',
30240
'emailMask' : /[a-z0-9_\.\-@]/i,
30243
'url' : function(v){
30244
return url.test(v);
30247
'urlText' : 'This field should be a URL in the format "http:/'+'/www.domain.com"',
30250
'alpha' : function(v){
30251
return alpha.test(v);
30254
'alphaText' : 'This field should only contain letters and _',
30256
'alphaMask' : /[a-z_]/i,
30259
'alphanum' : function(v){
30260
return alphanum.test(v);
30263
'alphanumText' : 'This field should only contain letters, numbers and _',
30265
'alphanumMask' : /[a-z0-9_]/i
30269
Ext.grid.GridPanel = Ext.extend(Ext.Panel, {
30284
ddText : "{0} selected row{1}",
30286
minColumnWidth : 25,
30288
trackMouseOver : true,
30290
enableDragDrop : false,
30292
enableColumnMove : true,
30294
enableColumnHide : true,
30296
enableHdMenu : true,
30298
stripeRows : false,
30300
autoExpandColumn : false,
30302
autoExpandMin : 50,
30304
autoExpandMax : 1000,
30311
deferRowRender : true,
30318
stateEvents: ["columnmove", "columnresize", "sortchange"],
30321
initComponent : function(){
30322
Ext.grid.GridPanel.superclass.initComponent.call(this);
30326
this.autoScroll = false;
30327
this.autoWidth = false;
30329
if(Ext.isArray(this.columns)){
30330
this.colModel = new Ext.grid.ColumnModel(this.columns);
30331
delete this.columns;
30336
this.store = this.ds;
30340
this.colModel = this.cm;
30344
this.selModel = this.sm;
30347
this.store = Ext.StoreMgr.lookup(this.store);
30395
"headercontextmenu",
30408
onRender : function(ct, position){
30409
Ext.grid.GridPanel.superclass.onRender.apply(this, arguments);
30413
this.el.addClass('x-grid-panel');
30415
var view = this.getView();
30418
c.on("mousedown", this.onMouseDown, this);
30419
c.on("click", this.onClick, this);
30420
c.on("dblclick", this.onDblClick, this);
30421
c.on("contextmenu", this.onContextMenu, this);
30422
c.on("keydown", this.onKeyDown, this);
30424
this.relayEvents(c, ["mousedown","mouseup","mouseover","mouseout","keypress"]);
30426
this.getSelectionModel().init(this);
30427
this.view.render();
30431
initEvents : function(){
30432
Ext.grid.GridPanel.superclass.initEvents.call(this);
30435
this.loadMask = new Ext.LoadMask(this.bwrap,
30436
Ext.apply({store:this.store}, this.loadMask));
30440
initStateEvents : function(){
30441
Ext.grid.GridPanel.superclass.initStateEvents.call(this);
30442
this.colModel.on('hiddenchange', this.saveState, this, {delay: 100});
30445
applyState : function(state){
30446
var cm = this.colModel;
30447
var cs = state.columns;
30449
for(var i = 0, len = cs.length; i < len; i++){
30451
var c = cm.getColumnById(s.id);
30453
c.hidden = s.hidden;
30455
var oldIndex = cm.getIndexById(s.id);
30457
cm.moveColumn(oldIndex, i);
30463
this.store[this.store.remoteSort ? 'setDefaultSort' : 'sort'](state.sort.field, state.sort.direction);
30467
getState : function(){
30468
var o = {columns: []};
30469
for(var i = 0, c; c = this.colModel.config[i]; i++){
30475
o.columns[i].hidden = true;
30478
var ss = this.store.getSortState();
30486
afterRender : function(){
30487
Ext.grid.GridPanel.superclass.afterRender.call(this);
30488
this.view.layout();
30489
if(this.deferRowRender){
30490
this.view.afterRender.defer(10, this.view);
30492
this.view.afterRender();
30494
this.viewReady = true;
30498
reconfigure : function(store, colModel){
30500
this.loadMask.destroy();
30501
this.loadMask = new Ext.LoadMask(this.bwrap,
30502
Ext.apply({store:store}, this.initialConfig.loadMask));
30504
this.view.bind(store, colModel);
30505
this.store = store;
30506
this.colModel = colModel;
30508
this.view.refresh(true);
30513
onKeyDown : function(e){
30514
this.fireEvent("keydown", e);
30518
onDestroy : function(){
30521
this.loadMask.destroy();
30524
c.removeAllListeners();
30525
this.view.destroy();
30528
this.colModel.purgeListeners();
30529
Ext.grid.GridPanel.superclass.onDestroy.call(this);
30533
processEvent : function(name, e){
30534
this.fireEvent(name, e);
30535
var t = e.getTarget();
30537
var header = v.findHeaderIndex(t);
30538
if(header !== false){
30539
this.fireEvent("header" + name, this, header, e);
30541
var row = v.findRowIndex(t);
30542
var cell = v.findCellIndex(t);
30544
this.fireEvent("row" + name, this, row, e);
30545
if(cell !== false){
30546
this.fireEvent("cell" + name, this, row, cell, e);
30553
onClick : function(e){
30554
this.processEvent("click", e);
30558
onMouseDown : function(e){
30559
this.processEvent("mousedown", e);
30563
onContextMenu : function(e, t){
30564
this.processEvent("contextmenu", e);
30568
onDblClick : function(e){
30569
this.processEvent("dblclick", e);
30573
walkCells : function(row, col, step, fn, scope){
30574
var cm = this.colModel, clen = cm.getColumnCount();
30575
var ds = this.store, rlen = ds.getCount(), first = true;
30587
if(fn.call(scope || this, row, col, cm) === true){
30605
if(fn.call(scope || this, row, col, cm) === true){
30617
getSelections : function(){
30618
return this.selModel.getSelections();
30622
onResize : function(){
30623
Ext.grid.GridPanel.superclass.onResize.apply(this, arguments);
30624
if(this.viewReady){
30625
this.view.layout();
30630
getGridEl : function(){
30635
stopEditing : function(){},
30638
getSelectionModel : function(){
30639
if(!this.selModel){
30640
this.selModel = new Ext.grid.RowSelectionModel(
30641
this.disableSelection ? {selectRow: Ext.emptyFn} : null);
30643
return this.selModel;
30647
getStore : function(){
30652
getColumnModel : function(){
30653
return this.colModel;
30657
getView : function(){
30659
this.view = new Ext.grid.GridView(this.viewConfig);
30664
getDragDropText : function(){
30665
var count = this.selModel.getCount();
30666
return String.format(this.ddText, count, count == 1 ? '' : 's');
30719
Ext.reg('grid', Ext.grid.GridPanel);
30721
Ext.grid.GridView = function(config){
30722
Ext.apply(this, config);
30725
"beforerowremoved",
30727
"beforerowsinserted",
30739
Ext.grid.GridView.superclass.constructor.call(this);
30742
Ext.extend(Ext.grid.GridView, Ext.util.Observable, {
30748
deferEmptyText: true,
30756
sortClasses : ["sort-asc", "sort-desc"],
30758
sortAscText : "Sort Ascending",
30760
sortDescText : "Sort Descending",
30762
columnsText : "Columns",
30765
tdClass: 'x-grid3-cell',
30766
hdCls: 'x-grid3-hd',
30769
cellSelectorDepth: 4,
30771
rowSelectorDepth: 10,
30774
cellSelector: 'td.x-grid3-cell',
30776
rowSelector: 'div.x-grid3-row',
30780
initTemplates : function(){
30781
var ts = this.templates || {};
30783
ts.master = new Ext.Template(
30784
'<div class="x-grid3" hidefocus="true">',
30785
'<div class="x-grid3-viewport">',
30786
'<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset">{header}</div></div><div class="x-clear"></div></div>',
30787
'<div class="x-grid3-scroller"><div class="x-grid3-body">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',
30789
'<div class="x-grid3-resize-marker"> </div>',
30790
'<div class="x-grid3-resize-proxy"> </div>',
30796
ts.header = new Ext.Template(
30797
'<table border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
30798
'<thead><tr class="x-grid3-hd-row">{cells}</tr></thead>',
30804
ts.hcell = new Ext.Template(
30805
'<td class="x-grid3-hd x-grid3-cell x-grid3-td-{id}" style="{style}"><div {tooltip} {attr} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">', this.grid.enableHdMenu ? '<a class="x-grid3-hd-btn" href="#"></a>' : '',
30806
'{value}<img class="x-grid3-sort-icon" src="', Ext.BLANK_IMAGE_URL, '" />',
30812
ts.body = new Ext.Template('{rows}');
30816
ts.row = new Ext.Template(
30817
'<div class="x-grid3-row {alt}" style="{tstyle}"><table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
30818
'<tbody><tr>{cells}</tr>',
30819
(this.enableRowBody ? '<tr class="x-grid3-row-body-tr" style="{bodyStyle}"><td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on"><div class="x-grid3-row-body">{body}</div></td></tr>' : ''),
30820
'</tbody></table></div>'
30825
ts.cell = new Ext.Template(
30826
'<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}" tabIndex="0" {cellAttr}>',
30827
'<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on" {attr}>{value}</div>',
30834
if(t && typeof t.compile == 'function' && !t.compiled){
30835
t.disableFormats = true;
30840
this.templates = ts;
30841
this.colRe = new RegExp("x-grid3-td-([^\\s]+)", "");
30844
fly : function(el){
30845
if(!this._flyweight){
30846
this._flyweight = new Ext.Element.Flyweight(document.body);
30848
this._flyweight.dom = el;
30849
return this._flyweight;
30852
getEditorParent : function(ed){
30853
return this.scroller.dom;
30856
initElements : function(){
30857
var E = Ext.Element;
30859
var el = this.grid.getGridEl().dom.firstChild;
30860
var cs = el.childNodes;
30862
this.el = new E(el);
30864
this.mainWrap = new E(cs[0]);
30865
this.mainHd = new E(this.mainWrap.dom.firstChild);
30867
if(this.grid.hideHeaders){
30868
this.mainHd.setDisplayed(false);
30871
this.innerHd = this.mainHd.dom.firstChild;
30872
this.scroller = new E(this.mainWrap.dom.childNodes[1]);
30874
this.scroller.setStyle('overflow-x', 'hidden');
30876
this.mainBody = new E(this.scroller.dom.firstChild);
30878
this.focusEl = new E(this.scroller.dom.childNodes[1]);
30879
this.focusEl.swallowEvent("click", true);
30881
this.resizeMarker = new E(cs[1]);
30882
this.resizeProxy = new E(cs[2]);
30885
getRows : function(){
30886
return this.hasRows() ? this.mainBody.dom.childNodes : [];
30890
findCell : function(el){
30894
return this.fly(el).findParent(this.cellSelector, this.cellSelectorDepth);
30897
findCellIndex : function(el, requiredCls){
30898
var cell = this.findCell(el);
30899
if(cell && (!requiredCls || this.fly(cell).hasClass(requiredCls))){
30900
return this.getCellIndex(cell);
30905
getCellIndex : function(el){
30907
var m = el.className.match(this.colRe);
30909
return this.cm.getIndexById(m[1]);
30915
findHeaderCell : function(el){
30916
var cell = this.findCell(el);
30917
return cell && this.fly(cell).hasClass(this.hdCls) ? cell : null;
30920
findHeaderIndex : function(el){
30921
return this.findCellIndex(el, this.hdCls);
30924
findRow : function(el){
30928
return this.fly(el).findParent(this.rowSelector, this.rowSelectorDepth);
30931
findRowIndex : function(el){
30932
var r = this.findRow(el);
30933
return r ? r.rowIndex : false;
30938
getRow : function(row){
30939
return this.getRows()[row];
30943
getCell : function(row, col){
30944
return this.getRow(row).getElementsByTagName('td')[col];
30948
getHeaderCell : function(index){
30949
return this.mainHd.dom.getElementsByTagName('td')[index];
30953
addRowClass : function(row, cls){
30954
var r = this.getRow(row);
30956
this.fly(r).addClass(cls);
30960
removeRowClass : function(row, cls){
30961
var r = this.getRow(row);
30963
this.fly(r).removeClass(cls);
30967
removeRow : function(row){
30968
Ext.removeNode(this.getRow(row));
30969
this.focusRow(row);
30972
removeRows : function(firstRow, lastRow){
30973
var bd = this.mainBody.dom;
30974
for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){
30975
Ext.removeNode(bd.childNodes[firstRow]);
30977
this.focusRow(firstRow);
30981
getScrollState : function(){
30982
var sb = this.scroller.dom;
30983
return {left: sb.scrollLeft, top: sb.scrollTop};
30986
restoreScroll : function(state){
30987
var sb = this.scroller.dom;
30988
sb.scrollLeft = state.left;
30989
sb.scrollTop = state.top;
30993
scrollToTop : function(){
30994
this.scroller.dom.scrollTop = 0;
30995
this.scroller.dom.scrollLeft = 0;
30998
syncScroll : function(){
30999
this.syncHeaderScroll();
31000
var mb = this.scroller.dom;
31001
this.grid.fireEvent("bodyscroll", mb.scrollLeft, mb.scrollTop);
31004
syncHeaderScroll : function(){
31005
var mb = this.scroller.dom;
31006
this.innerHd.scrollLeft = mb.scrollLeft;
31007
this.innerHd.scrollLeft = mb.scrollLeft; },
31009
updateSortIcon : function(col, dir){
31010
var sc = this.sortClasses;
31011
var hds = this.mainHd.select('td').removeClass(sc);
31012
hds.item(col).addClass(sc[dir == "DESC" ? 1 : 0]);
31015
updateAllColumnWidths : function(){
31016
var tw = this.getTotalWidth();
31017
var clen = this.cm.getColumnCount();
31019
for(var i = 0; i < clen; i++){
31020
ws[i] = this.getColumnWidth(i);
31023
this.innerHd.firstChild.firstChild.style.width = tw;
31025
for(var i = 0; i < clen; i++){
31026
var hd = this.getHeaderCell(i);
31027
hd.style.width = ws[i];
31030
var ns = this.getRows();
31031
for(var i = 0, len = ns.length; i < len; i++){
31032
ns[i].style.width = tw;
31033
ns[i].firstChild.style.width = tw;
31034
var row = ns[i].firstChild.rows[0];
31035
for(var j = 0; j < clen; j++){
31036
row.childNodes[j].style.width = ws[j];
31040
this.onAllColumnWidthsUpdated(ws, tw);
31043
updateColumnWidth : function(col, width){
31044
var w = this.getColumnWidth(col);
31045
var tw = this.getTotalWidth();
31047
this.innerHd.firstChild.firstChild.style.width = tw;
31048
var hd = this.getHeaderCell(col);
31049
hd.style.width = w;
31051
var ns = this.getRows();
31052
for(var i = 0, len = ns.length; i < len; i++){
31053
ns[i].style.width = tw;
31054
ns[i].firstChild.style.width = tw;
31055
ns[i].firstChild.rows[0].childNodes[col].style.width = w;
31058
this.onColumnWidthUpdated(col, w, tw);
31061
updateColumnHidden : function(col, hidden){
31062
var tw = this.getTotalWidth();
31064
this.innerHd.firstChild.firstChild.style.width = tw;
31066
var display = hidden ? 'none' : '';
31068
var hd = this.getHeaderCell(col);
31069
hd.style.display = display;
31071
var ns = this.getRows();
31072
for(var i = 0, len = ns.length; i < len; i++){
31073
ns[i].style.width = tw;
31074
ns[i].firstChild.style.width = tw;
31075
ns[i].firstChild.rows[0].childNodes[col].style.display = display;
31078
this.onColumnHiddenUpdated(col, hidden, tw);
31080
delete this.lastViewWidth; this.layout();
31083
doRender : function(cs, rs, ds, startRow, colCount, stripe){
31084
var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1;
31085
var tstyle = 'width:'+this.getTotalWidth()+';';
31086
var buf = [], cb, c, p = {}, rp = {tstyle: tstyle}, r;
31087
for(var j = 0, len = rs.length; j < len; j++){
31088
r = rs[j]; cb = [];
31089
var rowIndex = (j+startRow);
31090
for(var i = 0; i < colCount; i++){
31093
p.css = i == 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '');
31094
p.attr = p.cellAttr = "";
31095
p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds);
31097
if(p.value == undefined || p.value === "") p.value = " ";
31098
if(r.dirty && typeof r.modified[c.name] !== 'undefined'){
31099
p.css += ' x-grid3-dirty-cell';
31101
cb[cb.length] = ct.apply(p);
31104
if(stripe && ((rowIndex+1) % 2 == 0)){
31105
alt[0] = "x-grid3-row-alt";
31108
alt[1] = " x-grid3-dirty-row";
31110
rp.cols = colCount;
31111
if(this.getRowClass){
31112
alt[2] = this.getRowClass(r, rowIndex, rp, ds);
31114
rp.alt = alt.join(" ");
31115
rp.cells = cb.join("");
31116
buf[buf.length] = rt.apply(rp);
31118
return buf.join("");
31121
processRows : function(startRow, skipStripe){
31122
if(this.ds.getCount() < 1){
31125
skipStripe = skipStripe || !this.grid.stripeRows;
31126
startRow = startRow || 0;
31127
var rows = this.getRows();
31128
var cls = ' x-grid3-row-alt ';
31129
for(var i = startRow, len = rows.length; i < len; i++){
31133
var isAlt = ((i+1) % 2 == 0);
31134
var hasAlt = (' '+row.className + ' ').indexOf(cls) != -1;
31135
if(isAlt == hasAlt){
31139
row.className += " x-grid3-row-alt";
31141
row.className = row.className.replace("x-grid3-row-alt", "");
31147
afterRender: function(){
31148
this.mainBody.dom.innerHTML = this.renderRows();
31149
this.processRows(0, true);
31151
if(this.deferEmptyText !== true){
31152
this.applyEmptyText();
31156
renderUI : function(){
31158
var header = this.renderHeaders();
31159
var body = this.templates.body.apply({rows:''});
31162
var html = this.templates.master.apply({
31169
g.getGridEl().dom.innerHTML = html;
31171
this.initElements();
31173
Ext.fly(this.innerHd).on("click", this.handleHdDown, this);
31174
this.mainHd.on("mouseover", this.handleHdOver, this);
31175
this.mainHd.on("mouseout", this.handleHdOut, this);
31176
this.mainHd.on("mousemove", this.handleHdMove, this);
31178
this.scroller.on('scroll', this.syncScroll, this);
31179
if(g.enableColumnResize !== false){
31180
this.splitone = new Ext.grid.GridView.SplitDragZone(g, this.mainHd.dom);
31183
if(g.enableColumnMove){
31184
this.columnDrag = new Ext.grid.GridView.ColumnDragZone(g, this.innerHd);
31185
this.columnDrop = new Ext.grid.HeaderDropZone(g, this.mainHd.dom);
31188
if(g.enableHdMenu !== false){
31189
if(g.enableColumnHide !== false){
31190
this.colMenu = new Ext.menu.Menu({id:g.id + "-hcols-menu"});
31191
this.colMenu.on("beforeshow", this.beforeColMenuShow, this);
31192
this.colMenu.on("itemclick", this.handleHdMenuClick, this);
31194
this.hmenu = new Ext.menu.Menu({id: g.id + "-hctx"});
31196
{id:"asc", text: this.sortAscText, cls: "xg-hmenu-sort-asc"},
31197
{id:"desc", text: this.sortDescText, cls: "xg-hmenu-sort-desc"}
31199
if(g.enableColumnHide !== false){
31200
this.hmenu.add('-',
31201
{id:"columns", text: this.columnsText, menu: this.colMenu, iconCls: 'x-cols-icon'}
31204
this.hmenu.on("itemclick", this.handleHdMenuClick, this);
31208
if(g.enableDragDrop || g.enableDrag){
31209
this.dragZone = new Ext.grid.GridDragZone(g, {
31210
ddGroup : g.ddGroup || 'GridDD'
31214
this.updateHeaderSortState();
31218
layout : function(){
31219
if(!this.mainBody){
31222
var c = g.getGridEl();
31223
var csize = c.getSize(true);
31224
var vw = csize.width;
31226
if(vw < 20 || csize.height < 20){ return;
31230
this.scroller.dom.style.overflow = 'visible';
31232
this.el.setSize(csize.width, csize.height);
31234
var hdHeight = this.mainHd.getHeight();
31235
var vh = csize.height - (hdHeight);
31237
this.scroller.setSize(vw, vh);
31239
this.innerHd.style.width = (vw)+'px';
31243
if(this.lastViewWidth != vw){
31244
this.fitColumns(false, false);
31245
this.lastViewWidth = vw;
31249
this.syncHeaderScroll();
31251
this.onLayout(vw, vh);
31254
onLayout : function(vw, vh){
31257
onColumnWidthUpdated : function(col, w, tw){
31260
onAllColumnWidthsUpdated : function(ws, tw){
31263
onColumnHiddenUpdated : function(col, hidden, tw){
31266
updateColumnText : function(col, text){
31269
afterMove : function(colIndex){
31273
init: function(grid){
31276
this.initTemplates();
31277
this.initData(grid.store, grid.colModel);
31281
getColumnId : function(index){
31282
return this.cm.getColumnId(index);
31285
renderHeaders : function(){
31286
var cm = this.cm, ts = this.templates;
31289
var cb = [], sb = [], p = {};
31291
for(var i = 0, len = cm.getColumnCount(); i < len; i++){
31292
p.id = cm.getColumnId(i);
31293
p.value = cm.getColumnHeader(i) || "";
31294
p.style = this.getColumnStyle(i, true);
31295
p.tooltip = this.getColumnTooltip(i);
31296
if(cm.config[i].align == 'right'){
31297
p.istyle = 'padding-right:16px';
31301
cb[cb.length] = ct.apply(p);
31303
return ts.header.apply({cells: cb.join(""), tstyle:'width:'+this.getTotalWidth()+';'});
31306
getColumnTooltip : function(i){
31307
var tt = this.cm.getColumnTooltip(i);
31309
if(Ext.QuickTips.isEnabled()){
31310
return 'ext:qtip="'+tt+'"';
31312
return 'title="'+tt+'"';
31318
beforeUpdate : function(){
31319
this.grid.stopEditing(true);
31322
updateHeaders : function(){
31323
this.innerHd.firstChild.innerHTML = this.renderHeaders();
31327
focusRow : function(row){
31328
this.focusCell(row, 0, false);
31332
focusCell : function(row, col, hscroll){
31333
row = Math.min(row, Math.max(0, this.getRows().length-1));
31334
var xy = this.ensureVisible(row, col, hscroll);
31335
this.focusEl.setXY(xy||this.scroller.getXY());
31338
this.focusEl.focus();
31340
this.focusEl.focus.defer(1, this.focusEl);
31344
ensureVisible : function(row, col, hscroll){
31345
if(typeof row != "number"){
31346
row = row.rowIndex;
31351
if(row < 0 || row >= this.ds.getCount()){
31354
col = (col !== undefined ? col : 0);
31356
var rowEl = this.getRow(row), cellEl;
31357
if(!(hscroll === false && col === 0)){
31358
while(this.cm.isHidden(col)){
31361
cellEl = this.getCell(row, col);
31367
var c = this.scroller.dom;
31370
var p = rowEl, stop = this.el.dom;
31371
while(p && p != stop){
31372
ctop += p.offsetTop;
31373
p = p.offsetParent;
31375
ctop -= this.mainHd.dom.offsetHeight;
31377
var cbot = ctop + rowEl.offsetHeight;
31379
var ch = c.clientHeight;
31380
var stop = parseInt(c.scrollTop, 10);
31381
var sbot = stop + ch;
31384
c.scrollTop = ctop;
31385
}else if(cbot > sbot){
31386
c.scrollTop = cbot-ch;
31389
if(hscroll !== false){
31390
var cleft = parseInt(cellEl.offsetLeft, 10);
31391
var cright = cleft + cellEl.offsetWidth;
31393
var sleft = parseInt(c.scrollLeft, 10);
31394
var sright = sleft + c.clientWidth;
31396
c.scrollLeft = cleft;
31397
}else if(cright > sright){
31398
c.scrollLeft = cright-c.clientWidth;
31401
return cellEl ? Ext.fly(cellEl).getXY() : [c.scrollLeft+this.el.getX(), Ext.fly(rowEl).getY()];
31404
insertRows : function(dm, firstRow, lastRow, isUpdate){
31405
if(!isUpdate && firstRow === 0 && lastRow >= dm.getCount()-1){
31409
this.fireEvent("beforerowsinserted", this, firstRow, lastRow);
31411
var html = this.renderRows(firstRow, lastRow);
31412
var before = this.getRow(firstRow);
31414
Ext.DomHelper.insertHtml('beforeBegin', before, html);
31416
Ext.DomHelper.insertHtml('beforeEnd', this.mainBody.dom, html);
31419
this.fireEvent("rowsinserted", this, firstRow, lastRow);
31420
this.processRows(firstRow);
31423
this.focusRow(firstRow);
31426
deleteRows : function(dm, firstRow, lastRow){
31427
if(dm.getRowCount()<1){
31430
this.fireEvent("beforerowsdeleted", this, firstRow, lastRow);
31432
this.removeRows(firstRow, lastRow);
31434
this.processRows(firstRow);
31435
this.fireEvent("rowsdeleted", this, firstRow, lastRow);
31439
getColumnStyle : function(col, isHeader){
31440
var style = !isHeader ? (this.cm.config[col].css || '') : '';
31441
style += 'width:'+this.getColumnWidth(col)+';';
31442
if(this.cm.isHidden(col)){
31443
style += 'display:none;';
31445
var align = this.cm.config[col].align;
31447
style += 'text-align:'+align+';';
31452
getColumnWidth : function(col){
31453
var w = this.cm.getColumnWidth(col);
31454
if(typeof w == 'number'){
31455
return (Ext.isBorderBox ? w : (w-this.borderWidth > 0 ? w-this.borderWidth:0)) + 'px';
31460
getTotalWidth : function(){
31461
return this.cm.getTotalWidth()+'px';
31464
fitColumns : function(preventRefresh, onlyExpand, omitColumn){
31465
var cm = this.cm, leftOver, dist, i;
31466
var tw = cm.getTotalWidth(false);
31467
var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset;
31469
if(aw < 20){ return;
31471
var extra = aw - tw;
31477
var vc = cm.getColumnCount(true);
31478
var ac = vc-(typeof omitColumn == 'number' ? 1 : 0);
31481
omitColumn = undefined;
31483
var colCount = cm.getColumnCount();
31488
for (i = 0; i < colCount; i++){
31489
if(!cm.isHidden(i) && !cm.isFixed(i) && i !== omitColumn){
31490
w = cm.getColumnWidth(i);
31497
var frac = (aw - cm.getTotalWidth())/width;
31498
while (cols.length){
31501
cm.setColumnWidth(i, Math.max(this.grid.minColumnWidth, Math.floor(w + w*frac)), true);
31504
if((tw = cm.getTotalWidth(false)) > aw){
31505
var adjustCol = ac != vc ? omitColumn : extraCol;
31506
cm.setColumnWidth(adjustCol, Math.max(1,
31507
cm.getColumnWidth(adjustCol)- (tw-aw)), true);
31510
if(preventRefresh !== true){
31511
this.updateAllColumnWidths();
31518
autoExpand : function(preventUpdate){
31519
var g = this.grid, cm = this.cm;
31520
if(!this.userResized && g.autoExpandColumn){
31521
var tw = cm.getTotalWidth(false);
31522
var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset;
31524
var ci = cm.getIndexById(g.autoExpandColumn);
31525
var currentWidth = cm.getColumnWidth(ci);
31526
var cw = Math.min(Math.max(((aw-tw)+currentWidth), g.autoExpandMin), g.autoExpandMax);
31527
if(cw != currentWidth){
31528
cm.setColumnWidth(ci, cw, true);
31529
if(preventUpdate !== true){
31530
this.updateColumnWidth(ci, cw);
31537
getColumnData : function(){
31538
var cs = [], cm = this.cm, colCount = cm.getColumnCount();
31539
for(var i = 0; i < colCount; i++){
31540
var name = cm.getDataIndex(i);
31542
name : (typeof name == 'undefined' ? this.ds.fields.get(i).name : name),
31543
renderer : cm.getRenderer(i),
31544
id : cm.getColumnId(i),
31545
style : this.getColumnStyle(i)
31551
renderRows : function(startRow, endRow){
31552
var g = this.grid, cm = g.colModel, ds = g.store, stripe = g.stripeRows;
31553
var colCount = cm.getColumnCount();
31555
if(ds.getCount() < 1){
31559
var cs = this.getColumnData();
31561
startRow = startRow || 0;
31562
endRow = typeof endRow == "undefined"? ds.getCount()-1 : endRow;
31564
var rs = ds.getRange(startRow, endRow);
31566
return this.doRender(cs, rs, ds, startRow, colCount, stripe);
31569
renderBody : function(){
31570
var markup = this.renderRows();
31571
return this.templates.body.apply({rows: markup});
31574
refreshRow : function(record){
31575
var ds = this.ds, index;
31576
if(typeof record == 'number'){
31578
record = ds.getAt(index);
31580
index = ds.indexOf(record);
31583
this.insertRows(ds, index, index, true);
31584
this.getRow(index).rowIndex = index;
31585
this.onRemove(ds, record, index+1, true);
31586
this.fireEvent("rowupdated", this, index, record);
31590
refresh : function(headersToo){
31591
this.fireEvent("beforerefresh", this);
31592
this.grid.stopEditing(true);
31594
var result = this.renderBody();
31595
this.mainBody.update(result);
31597
if(headersToo === true){
31598
this.updateHeaders();
31599
this.updateHeaderSortState();
31601
this.processRows(0, true);
31603
this.applyEmptyText();
31604
this.fireEvent("refresh", this);
31607
applyEmptyText : function(){
31608
if(this.emptyText && !this.hasRows()){
31609
this.mainBody.update('<div class="x-grid-empty">' + this.emptyText + '</div>');
31613
updateHeaderSortState : function(){
31614
var state = this.ds.getSortState();
31618
if(!this.sortState || (this.sortState.field != state.field || this.sortState.direction != state.direction)){
31619
this.grid.fireEvent('sortchange', this.grid, state);
31621
this.sortState = state;
31622
var sortColumn = this.cm.findColumnIndex(state.field);
31623
if(sortColumn != -1){
31624
var sortDir = state.direction;
31625
this.updateSortIcon(sortColumn, sortDir);
31629
destroy : function(){
31631
this.colMenu.removeAll();
31632
Ext.menu.MenuMgr.unregister(this.colMenu);
31633
this.colMenu.getEl().remove();
31634
delete this.colMenu;
31637
this.hmenu.removeAll();
31638
Ext.menu.MenuMgr.unregister(this.hmenu);
31639
this.hmenu.getEl().remove();
31642
if(this.grid.enableColumnMove){
31643
var dds = Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];
31645
for(var dd in dds){
31646
if(!dds[dd].config.isTarget && dds[dd].dragElId){
31647
var elid = dds[dd].dragElId;
31649
Ext.get(elid).remove();
31650
} else if(dds[dd].config.isTarget){
31651
dds[dd].proxyTop.remove();
31652
dds[dd].proxyBottom.remove();
31655
if(Ext.dd.DDM.locationCache[dd]){
31656
delete Ext.dd.DDM.locationCache[dd];
31659
delete Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];
31663
Ext.destroy(this.resizeMarker, this.resizeProxy);
31666
this.dragZone.unreg();
31669
this.initData(null, null);
31670
Ext.EventManager.removeResizeListener(this.onWindowResize, this);
31673
onDenyColumnHide : function(){
31677
render : function(){
31680
this.fitColumns(true, true);
31681
}else if(this.forceFit){
31682
this.fitColumns(true, false);
31683
}else if(this.grid.autoExpandColumn){
31684
this.autoExpand(true);
31691
initData : function(ds, cm){
31693
this.ds.un("load", this.onLoad, this);
31694
this.ds.un("datachanged", this.onDataChange, this);
31695
this.ds.un("add", this.onAdd, this);
31696
this.ds.un("remove", this.onRemove, this);
31697
this.ds.un("update", this.onUpdate, this);
31698
this.ds.un("clear", this.onClear, this);
31701
ds.on("load", this.onLoad, this);
31702
ds.on("datachanged", this.onDataChange, this);
31703
ds.on("add", this.onAdd, this);
31704
ds.on("remove", this.onRemove, this);
31705
ds.on("update", this.onUpdate, this);
31706
ds.on("clear", this.onClear, this);
31711
this.cm.un("configchange", this.onColConfigChange, this);
31712
this.cm.un("widthchange", this.onColWidthChange, this);
31713
this.cm.un("headerchange", this.onHeaderChange, this);
31714
this.cm.un("hiddenchange", this.onHiddenChange, this);
31715
this.cm.un("columnmoved", this.onColumnMove, this);
31716
this.cm.un("columnlockchange", this.onColumnLock, this);
31719
delete this.lastViewWidth;
31720
cm.on("configchange", this.onColConfigChange, this);
31721
cm.on("widthchange", this.onColWidthChange, this);
31722
cm.on("headerchange", this.onHeaderChange, this);
31723
cm.on("hiddenchange", this.onHiddenChange, this);
31724
cm.on("columnmoved", this.onColumnMove, this);
31725
cm.on("columnlockchange", this.onColumnLock, this);
31730
onDataChange : function(){
31732
this.updateHeaderSortState();
31735
onClear : function(){
31739
onUpdate : function(ds, record){
31740
this.refreshRow(record);
31743
onAdd : function(ds, records, index){
31744
this.insertRows(ds, index, index + (records.length-1));
31747
onRemove : function(ds, record, index, isUpdate){
31748
if(isUpdate !== true){
31749
this.fireEvent("beforerowremoved", this, index, record);
31751
this.removeRow(index);
31752
if(isUpdate !== true){
31753
this.processRows(index);
31754
this.applyEmptyText();
31755
this.fireEvent("rowremoved", this, index, record);
31759
onLoad : function(){
31760
this.scrollToTop();
31763
onColWidthChange : function(cm, col, width){
31764
this.updateColumnWidth(col, width);
31767
onHeaderChange : function(cm, col, text){
31768
this.updateHeaders();
31771
onHiddenChange : function(cm, col, hidden){
31772
this.updateColumnHidden(col, hidden);
31775
onColumnMove : function(cm, oldIndex, newIndex){
31776
this.indexMap = null;
31777
var s = this.getScrollState();
31778
this.refresh(true);
31779
this.restoreScroll(s);
31780
this.afterMove(newIndex);
31783
onColConfigChange : function(){
31784
delete this.lastViewWidth;
31785
this.indexMap = null;
31786
this.refresh(true);
31790
initUI : function(grid){
31791
grid.on("headerclick", this.onHeaderClick, this);
31793
if(grid.trackMouseOver){
31794
grid.on("mouseover", this.onRowOver, this);
31795
grid.on("mouseout", this.onRowOut, this);
31799
initEvents : function(){
31803
onHeaderClick : function(g, index){
31804
if(this.headersDisabled || !this.cm.isSortable(index)){
31807
g.stopEditing(true);
31808
g.store.sort(this.cm.getDataIndex(index));
31811
onRowOver : function(e, t){
31813
if((row = this.findRowIndex(t)) !== false){
31814
this.addRowClass(row, "x-grid3-row-over");
31818
onRowOut : function(e, t){
31820
if((row = this.findRowIndex(t)) !== false && row !== this.findRowIndex(e.getRelatedTarget())){
31821
this.removeRowClass(row, "x-grid3-row-over");
31825
handleWheel : function(e){
31826
e.stopPropagation();
31829
onRowSelect : function(row){
31830
this.addRowClass(row, "x-grid3-row-selected");
31833
onRowDeselect : function(row){
31834
this.removeRowClass(row, "x-grid3-row-selected");
31837
onCellSelect : function(row, col){
31838
var cell = this.getCell(row, col);
31840
this.fly(cell).addClass("x-grid3-cell-selected");
31844
onCellDeselect : function(row, col){
31845
var cell = this.getCell(row, col);
31847
this.fly(cell).removeClass("x-grid3-cell-selected");
31851
onColumnSplitterMoved : function(i, w){
31852
this.userResized = true;
31853
var cm = this.grid.colModel;
31854
cm.setColumnWidth(i, w, true);
31857
this.fitColumns(true, false, i);
31858
this.updateAllColumnWidths();
31860
this.updateColumnWidth(i, w);
31863
this.grid.fireEvent("columnresize", i, w);
31866
handleHdMenuClick : function(item){
31867
var index = this.hdCtxIndex;
31868
var cm = this.cm, ds = this.ds;
31871
ds.sort(cm.getDataIndex(index), "ASC");
31874
ds.sort(cm.getDataIndex(index), "DESC");
31877
index = cm.getIndexById(item.id.substr(4));
31879
if(item.checked && cm.getColumnsBy(this.isHideableColumn, this).length <= 1){
31880
this.onDenyColumnHide();
31883
cm.setHidden(index, item.checked);
31889
isHideableColumn : function(c){
31890
return !c.hidden && !c.fixed;
31893
beforeColMenuShow : function(){
31894
var cm = this.cm, colCount = cm.getColumnCount();
31895
this.colMenu.removeAll();
31896
for(var i = 0; i < colCount; i++){
31897
if(cm.config[i].fixed !== true && cm.config[i].hideable !== false){
31898
this.colMenu.add(new Ext.menu.CheckItem({
31899
id: "col-"+cm.getColumnId(i),
31900
text: cm.getColumnHeader(i),
31901
checked: !cm.isHidden(i),
31903
disabled: cm.config[i].hideable === false
31909
handleHdDown : function(e, t){
31910
if(Ext.fly(t).hasClass('x-grid3-hd-btn')){
31912
var hd = this.findHeaderCell(t);
31913
Ext.fly(hd).addClass('x-grid3-hd-menu-open');
31914
var index = this.getCellIndex(hd);
31915
this.hdCtxIndex = index;
31916
var ms = this.hmenu.items, cm = this.cm;
31917
ms.get("asc").setDisabled(!cm.isSortable(index));
31918
ms.get("desc").setDisabled(!cm.isSortable(index));
31919
this.hmenu.on("hide", function(){
31920
Ext.fly(hd).removeClass('x-grid3-hd-menu-open');
31921
}, this, {single:true});
31922
this.hmenu.show(t, "tl-bl?");
31926
handleHdOver : function(e, t){
31927
var hd = this.findHeaderCell(t);
31928
if(hd && !this.headersDisabled){
31929
this.activeHd = hd;
31930
this.activeHdIndex = this.getCellIndex(hd);
31931
var fly = this.fly(hd);
31932
this.activeHdRegion = fly.getRegion();
31933
if(!this.cm.isMenuDisabled(this.activeHdIndex)){
31934
fly.addClass("x-grid3-hd-over");
31935
this.activeHdBtn = fly.child('.x-grid3-hd-btn');
31936
if(this.activeHdBtn){
31937
this.activeHdBtn.dom.style.height = (hd.firstChild.offsetHeight-1)+'px';
31943
handleHdMove : function(e, t){
31944
if(this.activeHd && !this.headersDisabled){
31945
var hw = this.splitHandleWidth || 5;
31946
var r = this.activeHdRegion;
31947
var x = e.getPageX();
31948
var ss = this.activeHd.style;
31949
if(x - r.left <= hw && this.cm.isResizable(this.activeHdIndex-1)){
31950
ss.cursor = Ext.isAir ? 'move' : Ext.isSafari ? 'e-resize' : 'col-resize'; }else if(r.right - x <= (!this.activeHdBtn ? hw : 2) && this.cm.isResizable(this.activeHdIndex)){
31951
ss.cursor = Ext.isAir ? 'move' : Ext.isSafari ? 'w-resize' : 'col-resize';
31958
handleHdOut : function(e, t){
31959
var hd = this.findHeaderCell(t);
31960
if(hd && (!Ext.isIE || !e.within(hd, true))){
31961
this.activeHd = null;
31962
this.fly(hd).removeClass("x-grid3-hd-over");
31963
hd.style.cursor = '';
31967
hasRows : function(){
31968
var fc = this.mainBody.dom.firstChild;
31969
return fc && fc.className != 'x-grid-empty';
31972
bind : function(d, c){
31973
this.initData(d, c);
31978
Ext.grid.GridView.SplitDragZone = function(grid, hd){
31980
this.view = grid.getView();
31981
this.marker = this.view.resizeMarker;
31982
this.proxy = this.view.resizeProxy;
31983
Ext.grid.GridView.SplitDragZone.superclass.constructor.call(this, hd,
31984
"gridSplitters" + this.grid.getGridEl().id, {
31985
dragElId : Ext.id(this.proxy.dom), resizeFrame:false
31987
this.scroll = false;
31988
this.hw = this.view.splitHandleWidth || 5;
31990
Ext.extend(Ext.grid.GridView.SplitDragZone, Ext.dd.DDProxy, {
31992
b4StartDrag : function(x, y){
31993
this.view.headersDisabled = true;
31994
var h = this.view.mainWrap.getHeight();
31995
this.marker.setHeight(h);
31996
this.marker.show();
31997
this.marker.alignTo(this.view.getHeaderCell(this.cellIndex), 'tl-tl', [-2, 0]);
31998
this.proxy.setHeight(h);
31999
var w = this.cm.getColumnWidth(this.cellIndex);
32000
var minw = Math.max(w-this.grid.minColumnWidth, 0);
32001
this.resetConstraints();
32002
this.setXConstraint(minw, 1000);
32003
this.setYConstraint(0, 0);
32004
this.minX = x - minw;
32005
this.maxX = x + 1000;
32007
Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
32011
handleMouseDown : function(e){
32012
var t = this.view.findHeaderCell(e.getTarget());
32014
var xy = this.view.fly(t).getXY(), x = xy[0], y = xy[1];
32015
var exy = e.getXY(), ex = exy[0], ey = exy[1];
32016
var w = t.offsetWidth, adjust = false;
32017
if((ex - x) <= this.hw){
32019
}else if((x+w) - ex <= this.hw){
32022
if(adjust !== false){
32023
this.cm = this.grid.colModel;
32024
var ci = this.view.getCellIndex(t);
32026
if (ci + adjust < 0) {
32029
while(this.cm.isHidden(ci+adjust)){
32036
this.cellIndex = ci+adjust;
32037
this.split = t.dom;
32038
if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){
32039
Ext.grid.GridView.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
32041
}else if(this.view.columnDrag){
32042
this.view.columnDrag.callHandleMouseDown(e);
32047
endDrag : function(e){
32048
this.marker.hide();
32050
var endX = Math.max(this.minX, e.getPageX());
32051
var diff = endX - this.startPos;
32052
v.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
32053
setTimeout(function(){
32054
v.headersDisabled = false;
32058
autoOffset : function(){
32059
this.setDelta(0,0);
32064
Ext.grid.GroupingView = Ext.extend(Ext.grid.GridView, {
32066
hideGroupedColumn:false,
32068
showGroupName:true,
32070
startCollapsed:false,
32072
enableGrouping:true,
32074
enableGroupingMenu:true,
32076
enableNoGroups:true,
32078
emptyGroupText : '(None)',
32082
groupTextTpl : '{text}',
32090
initTemplates : function(){
32091
Ext.grid.GroupingView.superclass.initTemplates.call(this);
32094
var sm = this.grid.getSelectionModel();
32095
sm.on(sm.selectRow ? 'beforerowselect' : 'beforecellselect',
32096
this.onBeforeRowSelect, this);
32098
if(!this.startGroup){
32099
this.startGroup = new Ext.XTemplate(
32100
'<div id="{groupId}" class="x-grid-group {cls}">',
32101
'<div id="{groupId}-hd" class="x-grid-group-hd" style="{style}"><div>', this.groupTextTpl ,'</div></div>',
32102
'<div id="{groupId}-bd" class="x-grid-group-body">'
32105
this.startGroup.compile();
32106
this.endGroup = '</div></div>';
32110
findGroup : function(el){
32111
return Ext.fly(el).up('.x-grid-group', this.mainBody.dom);
32115
getGroups : function(){
32116
return this.hasRows() ? this.mainBody.dom.childNodes : [];
32120
onAdd : function(){
32121
if(this.enableGrouping && !this.ignoreAdd){
32122
var ss = this.getScrollState();
32124
this.restoreScroll(ss);
32125
}else if(!this.enableGrouping){
32126
Ext.grid.GroupingView.superclass.onAdd.apply(this, arguments);
32131
onRemove : function(ds, record, index, isUpdate){
32132
Ext.grid.GroupingView.superclass.onRemove.apply(this, arguments);
32133
var g = document.getElementById(record._groupId);
32134
if(g && g.childNodes[1].childNodes.length < 1){
32137
this.applyEmptyText();
32141
refreshRow : function(record){
32142
if(this.ds.getCount()==1){
32145
this.isUpdating = true;
32146
Ext.grid.GroupingView.superclass.refreshRow.apply(this, arguments);
32147
this.isUpdating = false;
32152
beforeMenuShow : function(){
32153
var field = this.getGroupField();
32154
var g = this.hmenu.items.get('groupBy');
32156
g.setDisabled(this.cm.config[this.hdCtxIndex].groupable === false);
32158
var s = this.hmenu.items.get('showGroups');
32160
s.setDisabled(!field && this.cm.config[this.hdCtxIndex].groupable === false);
32161
s.setChecked(!!field, true);
32166
renderUI : function(){
32167
Ext.grid.GroupingView.superclass.renderUI.call(this);
32168
this.mainBody.on('mousedown', this.interceptMouse, this);
32170
if(this.enableGroupingMenu && this.hmenu){
32171
this.hmenu.add('-',{
32173
text: this.groupByText,
32174
handler: this.onGroupByClick,
32176
iconCls:'x-group-by-icon'
32178
if(this.enableNoGroups){
32181
text: this.showGroupsText,
32183
checkHandler: this.onShowGroupsClick,
32187
this.hmenu.on('beforeshow', this.beforeMenuShow, this);
32192
onGroupByClick : function(){
32193
this.grid.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex));
32194
this.beforeMenuShow();
32198
onShowGroupsClick : function(mi, checked){
32200
this.onGroupByClick();
32202
this.grid.store.clearGrouping();
32207
toggleGroup : function(group, expanded){
32208
this.grid.stopEditing(true);
32209
group = Ext.getDom(group);
32210
var gel = Ext.fly(group);
32211
expanded = expanded !== undefined ?
32212
expanded : gel.hasClass('x-grid-group-collapsed');
32214
this.state[gel.dom.id] = expanded;
32215
gel[expanded ? 'removeClass' : 'addClass']('x-grid-group-collapsed');
32219
toggleAllGroups : function(expanded){
32220
var groups = this.getGroups();
32221
for(var i = 0, len = groups.length; i < len; i++){
32222
this.toggleGroup(groups[i], expanded);
32227
expandAllGroups : function(){
32228
this.toggleAllGroups(true);
32232
collapseAllGroups : function(){
32233
this.toggleAllGroups(false);
32237
interceptMouse : function(e){
32238
var hd = e.getTarget('.x-grid-group-hd', this.mainBody);
32241
this.toggleGroup(hd.parentNode);
32246
getGroup : function(v, r, groupRenderer, rowIndex, colIndex, ds){
32247
var g = groupRenderer ? groupRenderer(v, {}, r, rowIndex, colIndex, ds) : String(v);
32249
g = this.cm.config[colIndex].emptyGroupText || this.emptyGroupText;
32255
getGroupField : function(){
32256
return this.grid.store.getGroupState();
32260
renderRows : function(){
32261
var groupField = this.getGroupField();
32262
var eg = !!groupField;
32264
if(this.hideGroupedColumn) {
32265
var colIndex = this.cm.findColumnIndex(groupField);
32266
if(!eg && this.lastGroupField !== undefined) {
32267
this.mainBody.update('');
32268
this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField), false);
32269
delete this.lastGroupField;
32270
}else if (eg && this.lastGroupField === undefined) {
32271
this.lastGroupField = groupField;
32272
this.cm.setHidden(colIndex, true);
32273
}else if (eg && this.lastGroupField !== undefined && groupField !== this.lastGroupField) {
32274
this.mainBody.update('');
32275
var oldIndex = this.cm.findColumnIndex(this.lastGroupField);
32276
this.cm.setHidden(oldIndex, false);
32277
this.lastGroupField = groupField;
32278
this.cm.setHidden(colIndex, true);
32281
return Ext.grid.GroupingView.superclass.renderRows.apply(
32286
doRender : function(cs, rs, ds, startRow, colCount, stripe){
32290
var groupField = this.getGroupField();
32291
var colIndex = this.cm.findColumnIndex(groupField);
32293
this.enableGrouping = !!groupField;
32295
if(!this.enableGrouping || this.isUpdating){
32296
return Ext.grid.GroupingView.superclass.doRender.apply(
32299
var gstyle = 'width:'+this.getTotalWidth()+';';
32301
var gidPrefix = this.grid.getGridEl().id;
32302
var cfg = this.cm.config[colIndex];
32303
var groupRenderer = cfg.groupRenderer || cfg.renderer;
32304
var prefix = this.showGroupName ?
32305
(cfg.groupName || cfg.header)+': ' : '';
32307
var groups = [], curGroup, i, len, gid;
32308
for(i = 0, len = rs.length; i < len; i++){
32309
var rowIndex = startRow + i;
32311
gvalue = r.data[groupField],
32312
g = this.getGroup(gvalue, r, groupRenderer, rowIndex, colIndex, ds);
32313
if(!curGroup || curGroup.group != g){
32314
gid = gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(g);
32317
var isCollapsed = typeof this.state[gid] !== 'undefined' ? !this.state[gid] : this.startCollapsed;
32318
var gcls = isCollapsed ? 'x-grid-group-collapsed' : '';
32324
startRow: rowIndex,
32329
groups.push(curGroup);
32331
curGroup.rs.push(r);
32337
for(i = 0, len = groups.length; i < len; i++){
32339
this.doGroupStart(buf, g, cs, ds, colCount);
32340
buf[buf.length] = Ext.grid.GroupingView.superclass.doRender.call(
32341
this, cs, g.rs, ds, g.startRow, colCount, stripe);
32343
this.doGroupEnd(buf, g, cs, ds, colCount);
32345
return buf.join('');
32349
getGroupId : function(value){
32350
var gidPrefix = this.grid.getGridEl().id;
32351
var groupField = this.getGroupField();
32352
var colIndex = this.cm.findColumnIndex(groupField);
32353
var cfg = this.cm.config[colIndex];
32354
var groupRenderer = cfg.groupRenderer || cfg.renderer;
32355
var gtext = this.getGroup(value, {data:{}}, groupRenderer, 0, colIndex, this.ds);
32356
return gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(value);
32360
doGroupStart : function(buf, g, cs, ds, colCount){
32361
buf[buf.length] = this.startGroup.apply(g);
32365
doGroupEnd : function(buf, g, cs, ds, colCount){
32366
buf[buf.length] = this.endGroup;
32370
getRows : function(){
32371
if(!this.enableGrouping){
32372
return Ext.grid.GroupingView.superclass.getRows.call(this);
32375
var g, gs = this.getGroups();
32376
for(var i = 0, len = gs.length; i < len; i++){
32377
g = gs[i].childNodes[1].childNodes;
32378
for(var j = 0, jlen = g.length; j < jlen; j++){
32379
r[r.length] = g[j];
32386
updateGroupWidths : function(){
32387
if(!this.enableGrouping || !this.hasRows()){
32390
var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.scrollOffset) +'px';
32391
var gs = this.getGroups();
32392
for(var i = 0, len = gs.length; i < len; i++){
32393
gs[i].firstChild.style.width = tw;
32398
onColumnWidthUpdated : function(col, w, tw){
32399
this.updateGroupWidths();
32403
onAllColumnWidthsUpdated : function(ws, tw){
32404
this.updateGroupWidths();
32408
onColumnHiddenUpdated : function(col, hidden, tw){
32409
this.updateGroupWidths();
32413
onLayout : function(){
32414
this.updateGroupWidths();
32418
onBeforeRowSelect : function(sm, rowIndex){
32419
if(!this.enableGrouping){
32422
var row = this.getRow(rowIndex);
32423
if(row && !row.offsetParent){
32424
var g = this.findGroup(row);
32425
this.toggleGroup(g, true);
32430
groupByText: 'Group By This Field',
32432
showGroupsText: 'Show in Groups'
32435
Ext.grid.GroupingView.GROUP_ID = 1000;
32438
Ext.grid.HeaderDragZone = function(grid, hd, hd2){
32440
this.view = grid.getView();
32441
this.ddGroup = "gridHeader" + this.grid.getGridEl().id;
32442
Ext.grid.HeaderDragZone.superclass.constructor.call(this, hd);
32444
this.setHandleElId(Ext.id(hd));
32445
this.setOuterHandleElId(Ext.id(hd2));
32447
this.scroll = false;
32449
Ext.extend(Ext.grid.HeaderDragZone, Ext.dd.DragZone, {
32451
getDragData : function(e){
32452
var t = Ext.lib.Event.getTarget(e);
32453
var h = this.view.findHeaderCell(t);
32455
return {ddel: h.firstChild, header:h};
32460
onInitDrag : function(e){
32461
this.view.headersDisabled = true;
32462
var clone = this.dragData.ddel.cloneNode(true);
32463
clone.id = Ext.id();
32464
clone.style.width = Math.min(this.dragData.header.offsetWidth,this.maxDragWidth) + "px";
32465
this.proxy.update(clone);
32469
afterValidDrop : function(){
32471
setTimeout(function(){
32472
v.headersDisabled = false;
32476
afterInvalidDrop : function(){
32478
setTimeout(function(){
32479
v.headersDisabled = false;
32486
Ext.grid.HeaderDropZone = function(grid, hd, hd2){
32488
this.view = grid.getView();
32490
this.proxyTop = Ext.DomHelper.append(document.body, {
32491
cls:"col-move-top", html:" "
32493
this.proxyBottom = Ext.DomHelper.append(document.body, {
32494
cls:"col-move-bottom", html:" "
32496
this.proxyTop.hide = this.proxyBottom.hide = function(){
32497
this.setLeftTop(-100,-100);
32498
this.setStyle("visibility", "hidden");
32500
this.ddGroup = "gridHeader" + this.grid.getGridEl().id;
32503
Ext.grid.HeaderDropZone.superclass.constructor.call(this, grid.getGridEl().dom);
32505
Ext.extend(Ext.grid.HeaderDropZone, Ext.dd.DropZone, {
32506
proxyOffsets : [-4, -9],
32507
fly: Ext.Element.fly,
32509
getTargetFromEvent : function(e){
32510
var t = Ext.lib.Event.getTarget(e);
32511
var cindex = this.view.findCellIndex(t);
32512
if(cindex !== false){
32513
return this.view.getHeaderCell(cindex);
32517
nextVisible : function(h){
32518
var v = this.view, cm = this.grid.colModel;
32521
if(!cm.isHidden(v.getCellIndex(h))){
32529
prevVisible : function(h){
32530
var v = this.view, cm = this.grid.colModel;
32533
if(!cm.isHidden(v.getCellIndex(h))){
32541
positionIndicator : function(h, n, e){
32542
var x = Ext.lib.Event.getPageX(e);
32543
var r = Ext.lib.Dom.getRegion(n.firstChild);
32544
var px, pt, py = r.top + this.proxyOffsets[1];
32545
if((r.right - x) <= (r.right-r.left)/2){
32546
px = r.right+this.view.borderWidth;
32552
var oldIndex = this.view.getCellIndex(h);
32553
var newIndex = this.view.getCellIndex(n);
32555
if(this.grid.colModel.isFixed(newIndex)){
32559
var locked = this.grid.colModel.isLocked(newIndex);
32564
if(oldIndex < newIndex){
32567
if(oldIndex == newIndex && (locked == this.grid.colModel.isLocked(oldIndex))){
32570
px += this.proxyOffsets[0];
32571
this.proxyTop.setLeftTop(px, py);
32572
this.proxyTop.show();
32573
if(!this.bottomOffset){
32574
this.bottomOffset = this.view.mainHd.getHeight();
32576
this.proxyBottom.setLeftTop(px, py+this.proxyTop.dom.offsetHeight+this.bottomOffset);
32577
this.proxyBottom.show();
32581
onNodeEnter : function(n, dd, e, data){
32582
if(data.header != n){
32583
this.positionIndicator(data.header, n, e);
32587
onNodeOver : function(n, dd, e, data){
32588
var result = false;
32589
if(data.header != n){
32590
result = this.positionIndicator(data.header, n, e);
32593
this.proxyTop.hide();
32594
this.proxyBottom.hide();
32596
return result ? this.dropAllowed : this.dropNotAllowed;
32599
onNodeOut : function(n, dd, e, data){
32600
this.proxyTop.hide();
32601
this.proxyBottom.hide();
32604
onNodeDrop : function(n, dd, e, data){
32605
var h = data.header;
32607
var cm = this.grid.colModel;
32608
var x = Ext.lib.Event.getPageX(e);
32609
var r = Ext.lib.Dom.getRegion(n.firstChild);
32610
var pt = (r.right - x) <= ((r.right-r.left)/2) ? "after" : "before";
32611
var oldIndex = this.view.getCellIndex(h);
32612
var newIndex = this.view.getCellIndex(n);
32613
var locked = cm.isLocked(newIndex);
32617
if(oldIndex < newIndex){
32620
if(oldIndex == newIndex && (locked == cm.isLocked(oldIndex))){
32623
cm.setLocked(oldIndex, locked, true);
32624
cm.moveColumn(oldIndex, newIndex);
32625
this.grid.fireEvent("columnmove", oldIndex, newIndex);
32633
Ext.grid.GridView.ColumnDragZone = function(grid, hd){
32634
Ext.grid.GridView.ColumnDragZone.superclass.constructor.call(this, grid, hd, null);
32635
this.proxy.el.addClass('x-grid3-col-dd');
32638
Ext.extend(Ext.grid.GridView.ColumnDragZone, Ext.grid.HeaderDragZone, {
32639
handleMouseDown : function(e){
32643
callHandleMouseDown : function(e){
32644
Ext.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this, e);
32647
Ext.grid.SplitDragZone = function(grid, hd, hd2){
32649
this.view = grid.getView();
32650
this.proxy = this.view.resizeProxy;
32651
Ext.grid.SplitDragZone.superclass.constructor.call(this, hd,
32652
"gridSplitters" + this.grid.getGridEl().id, {
32653
dragElId : Ext.id(this.proxy.dom), resizeFrame:false
32655
this.setHandleElId(Ext.id(hd));
32656
this.setOuterHandleElId(Ext.id(hd2));
32657
this.scroll = false;
32659
Ext.extend(Ext.grid.SplitDragZone, Ext.dd.DDProxy, {
32660
fly: Ext.Element.fly,
32662
b4StartDrag : function(x, y){
32663
this.view.headersDisabled = true;
32664
this.proxy.setHeight(this.view.mainWrap.getHeight());
32665
var w = this.cm.getColumnWidth(this.cellIndex);
32666
var minw = Math.max(w-this.grid.minColumnWidth, 0);
32667
this.resetConstraints();
32668
this.setXConstraint(minw, 1000);
32669
this.setYConstraint(0, 0);
32670
this.minX = x - minw;
32671
this.maxX = x + 1000;
32673
Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
32677
handleMouseDown : function(e){
32678
ev = Ext.EventObject.setEvent(e);
32679
var t = this.fly(ev.getTarget());
32680
if(t.hasClass("x-grid-split")){
32681
this.cellIndex = this.view.getCellIndex(t.dom);
32682
this.split = t.dom;
32683
this.cm = this.grid.colModel;
32684
if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){
32685
Ext.grid.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
32690
endDrag : function(e){
32691
this.view.headersDisabled = false;
32692
var endX = Math.max(this.minX, Ext.lib.Event.getPageX(e));
32693
var diff = endX - this.startPos;
32694
this.view.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
32697
autoOffset : function(){
32698
this.setDelta(0,0);
32702
Ext.grid.GridDragZone = function(grid, config){
32703
this.view = grid.getView();
32704
Ext.grid.GridDragZone.superclass.constructor.call(this, this.view.mainBody.dom, config);
32705
if(this.view.lockedBody){
32706
this.setHandleElId(Ext.id(this.view.mainBody.dom));
32707
this.setOuterHandleElId(Ext.id(this.view.lockedBody.dom));
32709
this.scroll = false;
32711
this.ddel = document.createElement('div');
32712
this.ddel.className = 'x-grid-dd-wrap';
32715
Ext.extend(Ext.grid.GridDragZone, Ext.dd.DragZone, {
32716
ddGroup : "GridDD",
32719
getDragData : function(e){
32720
var t = Ext.lib.Event.getTarget(e);
32721
var rowIndex = this.view.findRowIndex(t);
32722
if(rowIndex !== false){
32723
var sm = this.grid.selModel;
32724
if(!sm.isSelected(rowIndex) || e.hasModifier()){
32725
sm.handleMouseDown(this.grid, rowIndex, e);
32727
return {grid: this.grid, ddel: this.ddel, rowIndex: rowIndex, selections:sm.getSelections()};
32733
onInitDrag : function(e){
32734
var data = this.dragData;
32735
this.ddel.innerHTML = this.grid.getDragDropText();
32736
this.proxy.update(this.ddel);
32740
afterRepair : function(){
32741
this.dragging = false;
32745
getRepairXY : function(e, data){
32749
onEndDrag : function(data, e){
32752
onValidDrop : function(dd, e, id){
32756
beforeInvalidDrop : function(e, id){
32762
Ext.grid.ColumnModel = function(config){
32764
this.defaultWidth = 100;
32767
this.defaultSortable = false;
32770
if(config.columns){
32771
Ext.apply(this, config);
32772
this.setConfig(config.columns, true);
32774
this.setConfig(config, true);
32785
"columnlockchange",
32789
Ext.grid.ColumnModel.superclass.constructor.call(this);
32791
Ext.extend(Ext.grid.ColumnModel, Ext.util.Observable, {
32809
getColumnId : function(index){
32810
return this.config[index].id;
32814
setConfig : function(config, initial){
32815
if(!initial){ delete this.totalWidth;
32816
for(var i = 0, len = this.config.length; i < len; i++){
32817
var c = this.config[i];
32819
c.editor.destroy();
32823
this.config = config;
32825
for(var i = 0, len = config.length; i < len; i++){
32827
if(typeof c.renderer == "string"){
32828
c.renderer = Ext.util.Format[c.renderer];
32830
if(typeof c.id == "undefined"){
32833
if(c.editor && c.editor.isFormField){
32834
c.editor = new Ext.grid.GridEditor(c.editor);
32836
this.lookup[c.id] = c;
32839
this.fireEvent('configchange', this);
32844
getColumnById : function(id){
32845
return this.lookup[id];
32849
getIndexById : function(id){
32850
for(var i = 0, len = this.config.length; i < len; i++){
32851
if(this.config[i].id == id){
32859
moveColumn : function(oldIndex, newIndex){
32860
var c = this.config[oldIndex];
32861
this.config.splice(oldIndex, 1);
32862
this.config.splice(newIndex, 0, c);
32863
this.dataMap = null;
32864
this.fireEvent("columnmoved", this, oldIndex, newIndex);
32867
isLocked : function(colIndex){
32868
return this.config[colIndex].locked === true;
32871
setLocked : function(colIndex, value, suppressEvent){
32872
if(this.isLocked(colIndex) == value){
32875
this.config[colIndex].locked = value;
32876
if(!suppressEvent){
32877
this.fireEvent("columnlockchange", this, colIndex, value);
32881
getTotalLockedWidth : function(){
32882
var totalWidth = 0;
32883
for(var i = 0; i < this.config.length; i++){
32884
if(this.isLocked(i) && !this.isHidden(i)){
32885
this.totalWidth += this.getColumnWidth(i);
32891
getLockedCount : function(){
32892
for(var i = 0, len = this.config.length; i < len; i++){
32893
if(!this.isLocked(i)){
32900
getColumnCount : function(visibleOnly){
32901
if(visibleOnly === true){
32903
for(var i = 0, len = this.config.length; i < len; i++){
32904
if(!this.isHidden(i)){
32910
return this.config.length;
32914
getColumnsBy : function(fn, scope){
32916
for(var i = 0, len = this.config.length; i < len; i++){
32917
var c = this.config[i];
32918
if(fn.call(scope||this, c, i) === true){
32926
isSortable : function(col){
32927
if(typeof this.config[col].sortable == "undefined"){
32928
return this.defaultSortable;
32930
return this.config[col].sortable;
32934
isMenuDisabled : function(col){
32935
return !!this.config[col].menuDisabled;
32939
getRenderer : function(col){
32940
if(!this.config[col].renderer){
32941
return Ext.grid.ColumnModel.defaultRenderer;
32943
return this.config[col].renderer;
32947
setRenderer : function(col, fn){
32948
this.config[col].renderer = fn;
32952
getColumnWidth : function(col){
32953
return this.config[col].width || this.defaultWidth;
32957
setColumnWidth : function(col, width, suppressEvent){
32958
this.config[col].width = width;
32959
this.totalWidth = null;
32960
if(!suppressEvent){
32961
this.fireEvent("widthchange", this, col, width);
32966
getTotalWidth : function(includeHidden){
32967
if(!this.totalWidth){
32968
this.totalWidth = 0;
32969
for(var i = 0, len = this.config.length; i < len; i++){
32970
if(includeHidden || !this.isHidden(i)){
32971
this.totalWidth += this.getColumnWidth(i);
32975
return this.totalWidth;
32979
getColumnHeader : function(col){
32980
return this.config[col].header;
32984
setColumnHeader : function(col, header){
32985
this.config[col].header = header;
32986
this.fireEvent("headerchange", this, col, header);
32990
getColumnTooltip : function(col){
32991
return this.config[col].tooltip;
32994
setColumnTooltip : function(col, tooltip){
32995
this.config[col].tooltip = tooltip;
32999
getDataIndex : function(col){
33000
return this.config[col].dataIndex;
33004
setDataIndex : function(col, dataIndex){
33005
this.config[col].dataIndex = dataIndex;
33009
findColumnIndex : function(dataIndex){
33010
var c = this.config;
33011
for(var i = 0, len = c.length; i < len; i++){
33012
if(c[i].dataIndex == dataIndex){
33020
isCellEditable : function(colIndex, rowIndex){
33021
return (this.config[colIndex].editable || (typeof this.config[colIndex].editable == "undefined" && this.config[colIndex].editor)) ? true : false;
33025
getCellEditor : function(colIndex, rowIndex){
33026
return this.config[colIndex].editor;
33030
setEditable : function(col, editable){
33031
this.config[col].editable = editable;
33036
isHidden : function(colIndex){
33037
return this.config[colIndex].hidden;
33042
isFixed : function(colIndex){
33043
return this.config[colIndex].fixed;
33047
isResizable : function(colIndex){
33048
return colIndex >= 0 && this.config[colIndex].resizable !== false && this.config[colIndex].fixed !== true;
33051
setHidden : function(colIndex, hidden){
33052
var c = this.config[colIndex];
33053
if(c.hidden !== hidden){
33055
this.totalWidth = null;
33056
this.fireEvent("hiddenchange", this, colIndex, hidden);
33061
setEditor : function(col, editor){
33062
this.config[col].editor = editor;
33066
Ext.grid.ColumnModel.defaultRenderer = function(value){
33067
if(typeof value == "string" && value.length < 1){
33073
Ext.grid.DefaultColumnModel = Ext.grid.ColumnModel;
33076
Ext.grid.AbstractSelectionModel = function(){
33077
this.locked = false;
33078
Ext.grid.AbstractSelectionModel.superclass.constructor.call(this);
33081
Ext.extend(Ext.grid.AbstractSelectionModel, Ext.util.Observable, {
33083
init : function(grid){
33090
this.locked = true;
33094
unlock : function(){
33095
this.locked = false;
33099
isLocked : function(){
33100
return this.locked;
33104
Ext.grid.RowSelectionModel = function(config){
33105
Ext.apply(this, config);
33106
this.selections = new Ext.util.MixedCollection(false, function(o){
33111
this.lastActive = false;
33124
Ext.grid.RowSelectionModel.superclass.constructor.call(this);
33127
Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel, {
33129
singleSelect : false,
33132
initEvents : function(){
33134
if(!this.grid.enableDragDrop && !this.grid.enableDrag){
33135
this.grid.on("rowmousedown", this.handleMouseDown, this);
33136
}else{ this.grid.on("rowclick", function(grid, rowIndex, e) {
33137
if(e.button === 0 && !e.shiftKey && !e.ctrlKey) {
33138
this.selectRow(rowIndex, false);
33139
grid.view.focusRow(rowIndex);
33144
this.rowNav = new Ext.KeyNav(this.grid.getGridEl(), {
33145
"up" : function(e){
33147
this.selectPrevious(e.shiftKey);
33148
}else if(this.last !== false && this.lastActive !== false){
33149
var last = this.last;
33150
this.selectRange(this.last, this.lastActive-1);
33151
this.grid.getView().focusRow(this.lastActive);
33152
if(last !== false){
33156
this.selectFirstRow();
33159
"down" : function(e){
33161
this.selectNext(e.shiftKey);
33162
}else if(this.last !== false && this.lastActive !== false){
33163
var last = this.last;
33164
this.selectRange(this.last, this.lastActive+1);
33165
this.grid.getView().focusRow(this.lastActive);
33166
if(last !== false){
33170
this.selectFirstRow();
33176
var view = this.grid.view;
33177
view.on("refresh", this.onRefresh, this);
33178
view.on("rowupdated", this.onRowUpdated, this);
33179
view.on("rowremoved", this.onRemove, this);
33182
onRefresh : function(){
33183
var ds = this.grid.store, index;
33184
var s = this.getSelections();
33185
this.clearSelections(true);
33186
for(var i = 0, len = s.length; i < len; i++){
33188
if((index = ds.indexOfId(r.id)) != -1){
33189
this.selectRow(index, true);
33192
if(s.length != this.selections.getCount()){
33193
this.fireEvent("selectionchange", this);
33197
onRemove : function(v, index, r){
33198
if(this.selections.remove(r) !== false){
33199
this.fireEvent('selectionchange', this);
33203
onRowUpdated : function(v, index, r){
33204
if(this.isSelected(r)){
33205
v.onRowSelect(index);
33210
selectRecords : function(records, keepExisting){
33212
this.clearSelections();
33214
var ds = this.grid.store;
33215
for(var i = 0, len = records.length; i < len; i++){
33216
this.selectRow(ds.indexOf(records[i]), true);
33221
getCount : function(){
33222
return this.selections.length;
33226
selectFirstRow : function(){
33231
selectLastRow : function(keepExisting){
33232
this.selectRow(this.grid.store.getCount() - 1, keepExisting);
33236
selectNext : function(keepExisting){
33237
if(this.hasNext()){
33238
this.selectRow(this.last+1, keepExisting);
33239
this.grid.getView().focusRow(this.last);
33246
selectPrevious : function(keepExisting){
33247
if(this.hasPrevious()){
33248
this.selectRow(this.last-1, keepExisting);
33249
this.grid.getView().focusRow(this.last);
33256
hasNext : function(){
33257
return this.last !== false && (this.last+1) < this.grid.store.getCount();
33261
hasPrevious : function(){
33262
return !!this.last;
33267
getSelections : function(){
33268
return [].concat(this.selections.items);
33272
getSelected : function(){
33273
return this.selections.itemAt(0);
33277
each : function(fn, scope){
33278
var s = this.getSelections();
33279
for(var i = 0, len = s.length; i < len; i++){
33280
if(fn.call(scope || this, s[i], i) === false){
33288
clearSelections : function(fast){
33289
if(this.locked) return;
33291
var ds = this.grid.store;
33292
var s = this.selections;
33293
s.each(function(r){
33294
this.deselectRow(ds.indexOfId(r.id));
33298
this.selections.clear();
33305
selectAll : function(){
33306
if(this.locked) return;
33307
this.selections.clear();
33308
for(var i = 0, len = this.grid.store.getCount(); i < len; i++){
33309
this.selectRow(i, true);
33314
hasSelection : function(){
33315
return this.selections.length > 0;
33319
isSelected : function(index){
33320
var r = typeof index == "number" ? this.grid.store.getAt(index) : index;
33321
return (r && this.selections.key(r.id) ? true : false);
33325
isIdSelected : function(id){
33326
return (this.selections.key(id) ? true : false);
33329
handleMouseDown : function(g, rowIndex, e){
33330
if(e.button !== 0 || this.isLocked()){
33333
var view = this.grid.getView();
33334
if(e.shiftKey && this.last !== false){
33335
var last = this.last;
33336
this.selectRange(last, rowIndex, e.ctrlKey);
33337
this.last = last; view.focusRow(rowIndex);
33339
var isSelected = this.isSelected(rowIndex);
33340
if(e.ctrlKey && isSelected){
33341
this.deselectRow(rowIndex);
33342
}else if(!isSelected || this.getCount() > 1){
33343
this.selectRow(rowIndex, e.ctrlKey || e.shiftKey);
33344
view.focusRow(rowIndex);
33350
selectRows : function(rows, keepExisting){
33352
this.clearSelections();
33354
for(var i = 0, len = rows.length; i < len; i++){
33355
this.selectRow(rows[i], true);
33360
selectRange : function(startRow, endRow, keepExisting){
33361
if(this.locked) return;
33363
this.clearSelections();
33365
if(startRow <= endRow){
33366
for(var i = startRow; i <= endRow; i++){
33367
this.selectRow(i, true);
33370
for(var i = startRow; i >= endRow; i--){
33371
this.selectRow(i, true);
33377
deselectRange : function(startRow, endRow, preventViewNotify){
33378
if(this.locked) return;
33379
for(var i = startRow; i <= endRow; i++){
33380
this.deselectRow(i, preventViewNotify);
33385
selectRow : function(index, keepExisting, preventViewNotify){
33386
if(this.locked || (index < 0 || index >= this.grid.store.getCount()) || this.isSelected(index)) return;
33387
var r = this.grid.store.getAt(index);
33388
if(r && this.fireEvent("beforerowselect", this, index, keepExisting, r) !== false){
33389
if(!keepExisting || this.singleSelect){
33390
this.clearSelections();
33392
this.selections.add(r);
33393
this.last = this.lastActive = index;
33394
if(!preventViewNotify){
33395
this.grid.getView().onRowSelect(index);
33397
this.fireEvent("rowselect", this, index, r);
33398
this.fireEvent("selectionchange", this);
33403
deselectRow : function(index, preventViewNotify){
33404
if(this.locked) return;
33405
if(this.last == index){
33408
if(this.lastActive == index){
33409
this.lastActive = false;
33411
var r = this.grid.store.getAt(index);
33413
this.selections.remove(r);
33414
if(!preventViewNotify){
33415
this.grid.getView().onRowDeselect(index);
33417
this.fireEvent("rowdeselect", this, index, r);
33418
this.fireEvent("selectionchange", this);
33422
restoreLast : function(){
33424
this.last = this._last;
33428
acceptsNav : function(row, col, cm){
33429
return !cm.isHidden(col) && cm.isCellEditable(col, row);
33432
onEditorKey : function(field, e){
33433
var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;
33434
var shift = e.shiftKey;
33439
newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this);
33441
newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);
33443
}else if(k == e.ENTER){
33446
if(this.moveEditorOnEnter !== false){
33448
newCell = g.walkCells(ed.row - 1, ed.col, -1, this.acceptsNav, this);
33450
newCell = g.walkCells(ed.row + 1, ed.col, 1, this.acceptsNav, this);
33453
}else if(k == e.ESC){
33457
g.startEditing(newCell[0], newCell[1]);
33462
Ext.grid.CellSelectionModel = function(config){
33463
Ext.apply(this, config);
33465
this.selection = null;
33469
"beforecellselect",
33476
Ext.grid.CellSelectionModel.superclass.constructor.call(this);
33479
Ext.extend(Ext.grid.CellSelectionModel, Ext.grid.AbstractSelectionModel, {
33482
initEvents : function(){
33483
this.grid.on("cellmousedown", this.handleMouseDown, this);
33484
this.grid.getGridEl().on(Ext.isIE || Ext.isSafari3 ? "keydown" : "keypress", this.handleKeyDown, this);
33485
var view = this.grid.view;
33486
view.on("refresh", this.onViewChange, this);
33487
view.on("rowupdated", this.onRowUpdated, this);
33488
view.on("beforerowremoved", this.clearSelections, this);
33489
view.on("beforerowsinserted", this.clearSelections, this);
33490
if(this.grid.isEditor){
33491
this.grid.on("beforeedit", this.beforeEdit, this);
33495
beforeEdit : function(e){
33496
this.select(e.row, e.column, false, true, e.record);
33499
onRowUpdated : function(v, index, r){
33500
if(this.selection && this.selection.record == r){
33501
v.onCellSelect(index, this.selection.cell[1]);
33505
onViewChange : function(){
33506
this.clearSelections(true);
33510
getSelectedCell : function(){
33511
return this.selection ? this.selection.cell : null;
33515
clearSelections : function(preventNotify){
33516
var s = this.selection;
33518
if(preventNotify !== true){
33519
this.grid.view.onCellDeselect(s.cell[0], s.cell[1]);
33521
this.selection = null;
33522
this.fireEvent("selectionchange", this, null);
33527
hasSelection : function(){
33528
return this.selection ? true : false;
33532
handleMouseDown : function(g, row, cell, e){
33533
if(e.button !== 0 || this.isLocked()){
33536
this.select(row, cell);
33540
select : function(rowIndex, colIndex, preventViewNotify, preventFocus, r){
33541
if(this.fireEvent("beforecellselect", this, rowIndex, colIndex) !== false){
33542
this.clearSelections();
33543
r = r || this.grid.store.getAt(rowIndex);
33546
cell : [rowIndex, colIndex]
33548
if(!preventViewNotify){
33549
var v = this.grid.getView();
33550
v.onCellSelect(rowIndex, colIndex);
33551
if(preventFocus !== true){
33552
v.focusCell(rowIndex, colIndex);
33555
this.fireEvent("cellselect", this, rowIndex, colIndex);
33556
this.fireEvent("selectionchange", this, this.selection);
33560
isSelectable : function(rowIndex, colIndex, cm){
33561
return !cm.isHidden(colIndex);
33565
handleKeyDown : function(e){
33566
if(!e.isNavKeyPress()){
33569
var g = this.grid, s = this.selection;
33572
var cell = g.walkCells(0, 0, 1, this.isSelectable, this);
33574
this.select(cell[0], cell[1]);
33579
var walk = function(row, col, step){
33580
return g.walkCells(row, col, step, sm.isSelectable, sm);
33582
var k = e.getKey(), r = s.cell[0], c = s.cell[1];
33588
newCell = walk(r, c-1, -1);
33590
newCell = walk(r, c+1, 1);
33594
newCell = walk(r+1, c, 1);
33597
newCell = walk(r-1, c, -1);
33600
newCell = walk(r, c+1, 1);
33603
newCell = walk(r, c-1, -1);
33606
if(g.isEditor && !g.editing){
33607
g.startEditing(r, c);
33614
this.select(newCell[0], newCell[1]);
33619
acceptsNav : function(row, col, cm){
33620
return !cm.isHidden(col) && cm.isCellEditable(col, row);
33623
onEditorKey : function(field, e){
33624
var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;
33627
newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this);
33629
newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);
33632
}else if(k == e.ENTER){
33635
}else if(k == e.ESC){
33640
g.startEditing(newCell[0], newCell[1]);
33645
Ext.grid.EditorGridPanel = Ext.extend(Ext.grid.GridPanel, {
33653
autoEncode : false,
33656
trackMouseOver: false,
33657
initComponent : function(){
33658
Ext.grid.EditorGridPanel.superclass.initComponent.call(this);
33660
if(!this.selModel){
33662
this.selModel = new Ext.grid.CellSelectionModel();
33665
this.activeEditor = null;
33677
initEvents : function(){
33678
Ext.grid.EditorGridPanel.superclass.initEvents.call(this);
33680
this.on("bodyscroll", this.stopEditing, this, [true]);
33682
if(this.clicksToEdit == 1){
33683
this.on("cellclick", this.onCellDblClick, this);
33685
if(this.clicksToEdit == 'auto' && this.view.mainBody){
33686
this.view.mainBody.on("mousedown", this.onAutoEditClick, this);
33688
this.on("celldblclick", this.onCellDblClick, this);
33690
this.getGridEl().addClass("xedit-grid");
33693
onCellDblClick : function(g, row, col){
33694
this.startEditing(row, col);
33697
onAutoEditClick : function(e, t){
33698
if(e.button !== 0){
33701
var row = this.view.findRowIndex(t);
33702
var col = this.view.findCellIndex(t);
33703
if(row !== false && col !== false){
33704
this.stopEditing();
33705
if(this.selModel.getSelectedCell){ var sc = this.selModel.getSelectedCell();
33706
if(sc && sc.cell[0] === row && sc.cell[1] === col){
33707
this.startEditing(row, col);
33710
if(this.selModel.isSelected(row)){
33711
this.startEditing(row, col);
33717
onEditComplete : function(ed, value, startValue){
33718
this.editing = false;
33719
this.activeEditor = null;
33720
ed.un("specialkey", this.selModel.onEditorKey, this.selModel);
33722
var field = this.colModel.getDataIndex(ed.col);
33723
value = this.postEditValue(value, startValue, r, field);
33724
if(String(value) !== String(startValue)){
33729
originalValue: startValue,
33735
if(this.fireEvent("validateedit", e) !== false && !e.cancel){
33736
r.set(field, e.value);
33738
this.fireEvent("afteredit", e);
33741
this.view.focusCell(ed.row, ed.col);
33745
startEditing : function(row, col){
33746
this.stopEditing();
33747
if(this.colModel.isCellEditable(col, row)){
33748
this.view.ensureVisible(row, col, true);
33749
var r = this.store.getAt(row);
33750
var field = this.colModel.getDataIndex(col);
33755
value: r.data[field],
33760
if(this.fireEvent("beforeedit", e) !== false && !e.cancel){
33761
this.editing = true;
33762
var ed = this.colModel.getCellEditor(col, row);
33764
ed.render(this.view.getEditorParent(ed));
33766
(function(){ ed.row = row;
33769
ed.on("complete", this.onEditComplete, this, {single: true});
33770
ed.on("specialkey", this.selModel.onEditorKey, this.selModel);
33771
this.activeEditor = ed;
33772
var v = this.preEditValue(r, field);
33773
ed.startEdit(this.view.getCell(row, col).firstChild, v);
33774
}).defer(50, this);
33779
preEditValue : function(r, field){
33780
var value = r.data[field];
33781
return this.autoEncode && typeof value == 'string' ? Ext.util.Format.htmlDecode(value) : value;
33784
postEditValue : function(value, originalValue, r, field){
33785
return this.autoEncode && typeof value == 'string' ? Ext.util.Format.htmlEncode(value) : value;
33789
stopEditing : function(cancel){
33790
if(this.activeEditor){
33791
this.activeEditor[cancel === true ? 'cancelEdit' : 'completeEdit']();
33793
this.activeEditor = null;
33796
onDestroy: function() {
33798
var cols = this.colModel.config;
33799
for(var i = 0, len = cols.length; i < len; i++){
33801
Ext.destroy(c.editor);
33804
Ext.grid.EditorGridPanel.superclass.onDestroy.call(this);
33807
Ext.reg('editorgrid', Ext.grid.EditorGridPanel);
33808
Ext.grid.GridEditor = function(field, config){
33809
Ext.grid.GridEditor.superclass.constructor.call(this, field, config);
33810
field.monitorTab = false;
33813
Ext.extend(Ext.grid.GridEditor, Ext.Editor, {
33814
alignment: "tl-tl",
33817
cls: "x-small-editor x-grid-editor",
33822
Ext.grid.PropertyRecord = Ext.data.Record.create([
33823
{name:'name',type:'string'}, 'value'
33827
Ext.grid.PropertyStore = function(grid, source){
33829
this.store = new Ext.data.Store({
33830
recordType : Ext.grid.PropertyRecord
33832
this.store.on('update', this.onUpdate, this);
33834
this.setSource(source);
33836
Ext.grid.PropertyStore.superclass.constructor.call(this);
33838
Ext.extend(Ext.grid.PropertyStore, Ext.util.Observable, {
33839
setSource : function(o){
33841
this.store.removeAll();
33844
if(this.isEditableValue(o[k])){
33845
data.push(new Ext.grid.PropertyRecord({name: k, value: o[k]}, k));
33848
this.store.loadRecords({records: data}, {}, true);
33851
onUpdate : function(ds, record, type){
33852
if(type == Ext.data.Record.EDIT){
33853
var v = record.data['value'];
33854
var oldValue = record.modified['value'];
33855
if(this.grid.fireEvent('beforepropertychange', this.source, record.id, v, oldValue) !== false){
33856
this.source[record.id] = v;
33858
this.grid.fireEvent('propertychange', this.source, record.id, v, oldValue);
33865
getProperty : function(row){
33866
return this.store.getAt(row);
33869
isEditableValue: function(val){
33870
if(Ext.isDate(val)){
33872
}else if(typeof val == 'object' || typeof val == 'function'){
33878
setValue : function(prop, value){
33879
this.source[prop] = value;
33880
this.store.getById(prop).set('value', value);
33883
getSource : function(){
33884
return this.source;
33889
Ext.grid.PropertyColumnModel = function(grid, store){
33892
g.PropertyColumnModel.superclass.constructor.call(this, [
33893
{header: this.nameText, width:50, sortable: true, dataIndex:'name', id: 'name', menuDisabled:true},
33894
{header: this.valueText, width:50, resizable:false, dataIndex: 'value', id: 'value', menuDisabled:true}
33896
this.store = store;
33897
this.bselect = Ext.DomHelper.append(document.body, {
33898
tag: 'select', cls: 'x-grid-editor x-hide-display', children: [
33899
{tag: 'option', value: 'true', html: 'true'},
33900
{tag: 'option', value: 'false', html: 'false'}
33905
var bfield = new f.Field({
33907
bselect : this.bselect,
33909
getValue : function(){
33910
return this.bselect.value == 'true';
33914
'date' : new g.GridEditor(new f.DateField({selectOnFocus:true})),
33915
'string' : new g.GridEditor(new f.TextField({selectOnFocus:true})),
33916
'number' : new g.GridEditor(new f.NumberField({selectOnFocus:true, style:'text-align:left;'})),
33917
'boolean' : new g.GridEditor(bfield)
33919
this.renderCellDelegate = this.renderCell.createDelegate(this);
33920
this.renderPropDelegate = this.renderProp.createDelegate(this);
33923
Ext.extend(Ext.grid.PropertyColumnModel, Ext.grid.ColumnModel, {
33925
valueText : 'Value',
33926
dateFormat : 'm/j/Y',
33928
renderDate : function(dateVal){
33929
return dateVal.dateFormat(this.dateFormat);
33932
renderBool : function(bVal){
33933
return bVal ? 'true' : 'false';
33936
isCellEditable : function(colIndex, rowIndex){
33937
return colIndex == 1;
33940
getRenderer : function(col){
33942
this.renderCellDelegate : this.renderPropDelegate;
33945
renderProp : function(v){
33946
return this.getPropertyName(v);
33949
renderCell : function(val){
33951
if(Ext.isDate(val)){
33952
rv = this.renderDate(val);
33953
}else if(typeof val == 'boolean'){
33954
rv = this.renderBool(val);
33956
return Ext.util.Format.htmlEncode(rv);
33959
getPropertyName : function(name){
33960
var pn = this.grid.propertyNames;
33961
return pn && pn[name] ? pn[name] : name;
33964
getCellEditor : function(colIndex, rowIndex){
33965
var p = this.store.getProperty(rowIndex);
33966
var n = p.data['name'], val = p.data['value'];
33967
if(this.grid.customEditors[n]){
33968
return this.grid.customEditors[n];
33970
if(Ext.isDate(val)){
33971
return this.editors['date'];
33972
}else if(typeof val == 'number'){
33973
return this.editors['number'];
33974
}else if(typeof val == 'boolean'){
33975
return this.editors['boolean'];
33977
return this.editors['string'];
33983
Ext.grid.PropertyGrid = Ext.extend(Ext.grid.EditorGridPanel, {
33987
enableColumnMove:false,
33989
trackMouseOver: false,
33991
enableHdMenu : false,
33996
initComponent : function(){
33997
this.customEditors = this.customEditors || {};
33998
this.lastEditRow = null;
33999
var store = new Ext.grid.PropertyStore(this);
34000
this.propStore = store;
34001
var cm = new Ext.grid.PropertyColumnModel(this, store);
34002
store.store.sort('name', 'ASC');
34005
'beforepropertychange',
34010
this.ds = store.store;
34011
Ext.grid.PropertyGrid.superclass.initComponent.call(this);
34013
this.selModel.on('beforecellselect', function(sm, rowIndex, colIndex){
34014
if(colIndex === 0){
34015
this.startEditing.defer(200, this, [rowIndex, 1]);
34021
onRender : function(){
34022
Ext.grid.PropertyGrid.superclass.onRender.apply(this, arguments);
34024
this.getGridEl().addClass('x-props-grid');
34027
afterRender: function(){
34028
Ext.grid.PropertyGrid.superclass.afterRender.apply(this, arguments);
34030
this.setSource(this.source);
34035
setSource : function(source){
34036
this.propStore.setSource(source);
34040
getSource : function(){
34041
return this.propStore.getSource();
34044
Ext.reg("propertygrid", Ext.grid.PropertyGrid);
34047
Ext.grid.RowNumberer = function(config){
34048
Ext.apply(this, config);
34050
this.renderer = this.renderer.createDelegate(this);
34054
Ext.grid.RowNumberer.prototype = {
34067
rowspan: undefined,
34070
renderer : function(v, p, record, rowIndex){
34072
p.cellAttr = 'rowspan="'+this.rowspan+'"';
34078
Ext.grid.CheckboxSelectionModel = Ext.extend(Ext.grid.RowSelectionModel, {
34080
header: '<div class="x-grid3-hd-checker"> </div>',
34093
initEvents : function(){
34094
Ext.grid.CheckboxSelectionModel.superclass.initEvents.call(this);
34095
this.grid.on('render', function(){
34096
var view = this.grid.getView();
34097
view.mainBody.on('mousedown', this.onMouseDown, this);
34098
Ext.fly(view.innerHd).on('mousedown', this.onHdMouseDown, this);
34104
onMouseDown : function(e, t){
34105
if(e.button === 0 && t.className == 'x-grid3-row-checker'){
34107
var row = e.getTarget('.x-grid3-row');
34109
var index = row.rowIndex;
34110
if(this.isSelected(index)){
34111
this.deselectRow(index);
34113
this.selectRow(index, true);
34120
onHdMouseDown : function(e, t){
34121
if(t.className == 'x-grid3-hd-checker'){
34123
var hd = Ext.fly(t.parentNode);
34124
var isChecked = hd.hasClass('x-grid3-hd-checker-on');
34126
hd.removeClass('x-grid3-hd-checker-on');
34127
this.clearSelections();
34129
hd.addClass('x-grid3-hd-checker-on');
34136
renderer : function(v, p, record){
34137
return '<div class="x-grid3-row-checker"> </div>';
34141
Ext.LoadMask = function(el, config){
34142
this.el = Ext.get(el);
34143
Ext.apply(this, config);
34145
this.store.on('beforeload', this.onBeforeLoad, this);
34146
this.store.on('load', this.onLoad, this);
34147
this.store.on('loadexception', this.onLoad, this);
34148
this.removeMask = Ext.value(this.removeMask, false);
34150
var um = this.el.getUpdater();
34151
um.showLoadIndicator = false; um.on('beforeupdate', this.onBeforeLoad, this);
34152
um.on('update', this.onLoad, this);
34153
um.on('failure', this.onLoad, this);
34154
this.removeMask = Ext.value(this.removeMask, true);
34158
Ext.LoadMask.prototype = {
34162
msg : 'Loading...',
34164
msgCls : 'x-mask-loading',
34170
disable : function(){
34171
this.disabled = true;
34175
enable : function(){
34176
this.disabled = false;
34179
onLoad : function(){
34180
this.el.unmask(this.removeMask);
34183
onBeforeLoad : function(){
34184
if(!this.disabled){
34185
this.el.mask(this.msg, this.msgCls);
34191
this.onBeforeLoad();
34199
destroy : function(){
34201
this.store.un('beforeload', this.onBeforeLoad, this);
34202
this.store.un('load', this.onLoad, this);
34203
this.store.un('loadexception', this.onLoad, this);
34205
var um = this.el.getUpdater();
34206
um.un('beforeupdate', this.onBeforeLoad, this);
34207
um.un('update', this.onLoad, this);
34208
um.un('failure', this.onLoad, this);
34213
Ext.ProgressBar = Ext.extend(Ext.BoxComponent, {
34215
baseCls : 'x-progress',
34221
initComponent : function(){
34222
Ext.ProgressBar.superclass.initComponent.call(this);
34230
onRender : function(ct, position){
34231
Ext.ProgressBar.superclass.onRender.call(this, ct, position);
34233
var tpl = new Ext.Template(
34234
'<div class="{cls}-wrap">',
34235
'<div class="{cls}-inner">',
34236
'<div class="{cls}-bar">',
34237
'<div class="{cls}-text">',
34238
'<div> </div>',
34241
'<div class="{cls}-text {cls}-text-back">',
34242
'<div> </div>',
34249
this.el = tpl.insertBefore(position, {cls: this.baseCls}, true);
34251
this.el = tpl.append(ct, {cls: this.baseCls}, true);
34254
this.el.dom.id = this.id;
34256
var inner = this.el.dom.firstChild;
34257
this.progressBar = Ext.get(inner.firstChild);
34261
this.textEl = Ext.get(this.textEl);
34262
delete this.textTopEl;
34265
this.textTopEl = Ext.get(this.progressBar.dom.firstChild);
34266
var textBackEl = Ext.get(inner.childNodes[1]);
34267
this.textTopEl.setStyle("z-index", 99).addClass('x-hidden');
34268
this.textEl = new Ext.CompositeElement([this.textTopEl.dom.firstChild, textBackEl.dom.firstChild]);
34269
this.textEl.setWidth(inner.offsetWidth);
34271
this.progressBar.setHeight(inner.offsetHeight);
34275
afterRender : function(){
34276
Ext.ProgressBar.superclass.afterRender.call(this);
34278
this.updateProgress(this.value, this.text);
34280
this.updateText(this.text);
34285
updateProgress : function(value, text){
34286
this.value = value || 0;
34288
this.updateText(text);
34291
var w = Math.floor(value*this.el.dom.firstChild.offsetWidth);
34292
this.progressBar.setWidth(w);
34293
if(this.textTopEl){
34295
this.textTopEl.removeClass('x-hidden').setWidth(w);
34298
this.fireEvent('update', this, value, text);
34303
wait : function(o){
34304
if(!this.waitTimer){
34307
this.updateText(o.text);
34308
this.waitTimer = Ext.TaskMgr.start({
34310
var inc = o.increment || 10;
34311
this.updateProgress(((((i+inc)%inc)+1)*(100/inc))*.01);
34313
interval: o.interval || 1000,
34314
duration: o.duration,
34315
onStop: function(){
34317
o.fn.apply(o.scope || this);
34328
isWaiting : function(){
34329
return this.waitTimer != null;
34333
updateText : function(text){
34334
this.text = text || ' ';
34336
this.textEl.update(this.text);
34342
syncProgressBar : function(){
34344
this.updateProgress(this.value, this.text);
34350
setSize : function(w, h){
34351
Ext.ProgressBar.superclass.setSize.call(this, w, h);
34352
if(this.textTopEl){
34353
var inner = this.el.dom.firstChild;
34354
this.textEl.setSize(inner.offsetWidth, inner.offsetHeight);
34356
this.syncProgressBar();
34361
reset : function(hide){
34362
this.updateProgress(0);
34363
if(this.textTopEl){
34364
this.textTopEl.addClass('x-hidden');
34366
if(this.waitTimer){
34367
this.waitTimer.onStop = null;
34368
Ext.TaskMgr.stop(this.waitTimer);
34369
this.waitTimer = null;
34377
Ext.reg('progress', Ext.ProgressBar);
34379
Ext.Slider = Ext.extend(Ext.BoxComponent, {
34392
clickRange: [5,15],
34394
clickToChange : true,
34402
initComponent : function(){
34403
if(this.value === undefined){
34404
this.value = this.minValue;
34406
Ext.Slider.superclass.initComponent.call(this);
34407
this.keyIncrement = Math.max(this.increment, this.keyIncrement);
34424
Ext.apply(this, Ext.Slider.Vertical);
34429
onRender : function(){
34431
cls: 'x-slider ' + (this.vertical ? 'x-slider-vert' : 'x-slider-horz'),
34432
cn:{cls:'x-slider-end',cn:{cls:'x-slider-inner',cn:[{cls:'x-slider-thumb'},{tag:'a', cls:'x-slider-focus', href:"#", tabIndex: '-1', hidefocus:'on'}]}}
34434
Ext.Slider.superclass.onRender.apply(this, arguments);
34435
this.endEl = this.el.first();
34436
this.innerEl = this.endEl.first();
34437
this.thumb = this.innerEl.first();
34438
this.halfThumb = (this.vertical ? this.thumb.getHeight() : this.thumb.getWidth())/2;
34439
this.focusEl = this.thumb.next();
34444
initEvents : function(){
34445
this.thumb.addClassOnOver('x-slider-thumb-over');
34446
this.mon(this.el, 'mousedown', this.onMouseDown, this);
34447
this.mon(this.el, 'keydown', this.onKeyDown, this);
34449
this.focusEl.swallowEvent("click", true);
34451
this.tracker = new Ext.dd.DragTracker({
34452
onBeforeStart: this.onBeforeDragStart.createDelegate(this),
34453
onStart: this.onDragStart.createDelegate(this),
34454
onDrag: this.onDrag.createDelegate(this),
34455
onEnd: this.onDragEnd.createDelegate(this),
34459
this.tracker.initEl(this.thumb);
34460
this.on('beforedestroy', this.tracker.destroy, this.tracker);
34464
onMouseDown : function(e){
34465
if(this.disabled) {return;}
34466
if(this.clickToChange && e.target != this.thumb.dom){
34467
var local = this.innerEl.translatePoints(e.getXY());
34468
this.onClickChange(local);
34474
onClickChange : function(local){
34475
if(local.top > this.clickRange[0] && local.top < this.clickRange[1]){
34476
this.setValue(Math.round(this.reverseValue(local.left)), undefined, true);
34481
onKeyDown : function(e){
34482
if(this.disabled){e.preventDefault();return;}
34483
var k = e.getKey();
34489
this.setValue(this.maxValue, undefined, true);
34491
this.setValue(this.value+this.keyIncrement, undefined, true);
34498
this.setValue(this.minValue, undefined, true);
34500
this.setValue(this.value-this.keyIncrement, undefined, true);
34504
e.preventDefault();
34509
doSnap : function(value){
34510
if(!this.increment || this.increment == 1 || !value) {
34513
var newValue = value, inc = this.increment;
34514
var m = value % inc;
34517
newValue = value + (inc-m);
34519
newValue = value - m;
34522
return newValue.constrain(this.minValue, this.maxValue);
34526
afterRender : function(){
34527
Ext.Slider.superclass.afterRender.apply(this, arguments);
34528
if(this.value !== undefined){
34529
var v = this.normalizeValue(this.value);
34530
if(v !== this.value){
34532
this.setValue(v, false);
34534
this.moveThumb(this.translateValue(v), false);
34540
getRatio : function(){
34541
var w = this.innerEl.getWidth();
34542
var v = this.maxValue - this.minValue;
34543
return v == 0 ? w : (w/v);
34547
normalizeValue : function(v){
34548
if(typeof v != 'number'){
34552
v = this.doSnap(v);
34553
v = v.constrain(this.minValue, this.maxValue);
34558
setValue : function(v, animate, changeComplete){
34559
v = this.normalizeValue(v);
34560
if(v !== this.value && this.fireEvent('beforechange', this, v, this.value) !== false){
34562
this.moveThumb(this.translateValue(v), animate !== false);
34563
this.fireEvent('change', this, v);
34564
if(changeComplete){
34565
this.fireEvent('changecomplete', this, v);
34571
translateValue : function(v){
34572
var ratio = this.getRatio();
34573
return (v * ratio)-(this.minValue * ratio)-this.halfThumb;
34576
reverseValue : function(pos){
34577
var ratio = this.getRatio();
34578
return (pos+this.halfThumb+(this.minValue * ratio))/ratio;
34582
moveThumb: function(v, animate){
34583
if(!animate || this.animate === false){
34584
this.thumb.setLeft(v);
34586
this.thumb.shift({left: v, stopFx: true, duration:.35});
34591
focus : function(){
34592
this.focusEl.focus(10);
34596
onBeforeDragStart : function(e){
34597
return !this.disabled;
34601
onDragStart: function(e){
34602
this.thumb.addClass('x-slider-thumb-drag');
34603
this.dragging = true;
34604
this.dragStartValue = this.value;
34605
this.fireEvent('dragstart', this, e);
34609
onDrag: function(e){
34610
var pos = this.innerEl.translatePoints(this.tracker.getXY());
34611
this.setValue(Math.round(this.reverseValue(pos.left)), false);
34612
this.fireEvent('drag', this, e);
34616
onDragEnd: function(e){
34617
this.thumb.removeClass('x-slider-thumb-drag');
34618
this.dragging = false;
34619
this.fireEvent('dragend', this, e);
34620
if(this.dragStartValue != this.value){
34621
this.fireEvent('changecomplete', this, this.value);
34626
onResize : function(w, h){
34627
this.innerEl.setWidth(w - (this.el.getPadding('l') + this.endEl.getPadding('r')));
34632
syncThumb : function(){
34634
this.moveThumb(this.translateValue(this.value));
34639
getValue : function(){
34643
Ext.reg('slider', Ext.Slider);
34646
Ext.Slider.Vertical = {
34647
onResize : function(w, h){
34648
this.innerEl.setHeight(h - (this.el.getPadding('t') + this.endEl.getPadding('b')));
34652
getRatio : function(){
34653
var h = this.innerEl.getHeight();
34654
var v = this.maxValue - this.minValue;
34658
moveThumb: function(v, animate){
34659
if(!animate || this.animate === false){
34660
this.thumb.setBottom(v);
34662
this.thumb.shift({bottom: v, stopFx: true, duration:.35});
34666
onDrag: function(e){
34667
var pos = this.innerEl.translatePoints(this.tracker.getXY());
34668
var bottom = this.innerEl.getHeight()-pos.top;
34669
this.setValue(Math.round(bottom/this.getRatio()), false);
34670
this.fireEvent('drag', this, e);
34673
onClickChange : function(local){
34674
if(local.left > this.clickRange[0] && local.left < this.clickRange[1]){
34675
var bottom = this.innerEl.getHeight()-local.top;
34676
this.setValue(Math.round(bottom/this.getRatio()), undefined, true);
34681
Ext.StatusBar = Ext.extend(Ext.Toolbar, {
34689
cls : 'x-statusbar',
34691
busyIconCls : 'x-status-busy',
34693
busyText : 'Loading...',
34697
activeThreadId : 0,
34699
initComponent : function(){
34700
if(this.statusAlign=='right'){
34701
this.cls += ' x-status-right';
34703
Ext.StatusBar.superclass.initComponent.call(this);
34706
afterRender : function(){
34707
Ext.StatusBar.superclass.afterRender.call(this);
34709
var right = this.statusAlign=='right',
34710
td = Ext.get(this.nextBlock());
34713
this.tr.appendChild(td.dom);
34715
td.insertBefore(this.tr.firstChild);
34718
this.statusEl = td.createChild({
34719
cls: 'x-status-text ' + (this.iconCls || this.defaultIconCls || ''),
34720
html: this.text || this.defaultText || ''
34722
this.statusEl.unselectable();
34724
this.spacerEl = td.insertSibling({
34726
style: 'width:100%',
34727
cn: [{cls:'ytb-spacer'}]
34728
}, right ? 'before' : 'after');
34732
setStatus : function(o){
34735
if(typeof o == 'string'){
34738
if(o.text !== undefined){
34739
this.setText(o.text);
34741
if(o.iconCls !== undefined){
34742
this.setIcon(o.iconCls);
34747
wait = this.autoClear,
34748
defaults = {useDefaults: true, anim: true};
34750
if(typeof c == 'object'){
34751
c = Ext.applyIf(c, defaults);
34755
}else if(typeof c == 'number'){
34758
}else if(typeof c == 'boolean'){
34762
c.threadId = this.activeThreadId;
34763
this.clearStatus.defer(wait, this, [c]);
34769
clearStatus : function(o){
34772
if(o.threadId && o.threadId !== this.activeThreadId){
34776
var text = o.useDefaults ? this.defaultText : '',
34777
iconCls = o.useDefaults ? (this.defaultIconCls ? this.defaultIconCls : '') : '';
34780
this.statusEl.fadeOut({
34784
callback: function(){
34789
this.statusEl.show();
34793
this.statusEl.hide();
34798
this.statusEl.show();
34804
setText : function(text){
34805
this.activeThreadId++;
34806
this.text = text || '';
34808
this.statusEl.update(this.text);
34814
getText : function(){
34819
setIcon : function(cls){
34820
this.activeThreadId++;
34824
if(this.currIconCls){
34825
this.statusEl.removeClass(this.currIconCls);
34826
this.currIconCls = null;
34828
if(cls.length > 0){
34829
this.statusEl.addClass(cls);
34830
this.currIconCls = cls;
34833
this.currIconCls = cls;
34839
showBusy : function(o){
34840
if(typeof o == 'string'){
34843
o = Ext.applyIf(o || {}, {
34844
text: this.busyText,
34845
iconCls: this.busyIconCls
34847
return this.setStatus(o);
34850
Ext.reg('statusbar', Ext.StatusBar);
34853
Ext.History = (function () {
34854
var iframe, hiddenField;
34858
function getHash() {
34859
var href = top.location.href, i = href.indexOf("#");
34860
return i >= 0 ? href.substr(i + 1) : null;
34863
function doSave() {
34864
hiddenField.value = currentToken;
34867
function handleStateChange(token) {
34868
currentToken = token;
34869
Ext.History.fireEvent('change', token);
34872
function updateIFrame (token) {
34873
var html = ['<html><body><div id="state">',token,'</div></body></html>'].join('');
34875
var doc = iframe.contentWindow.document;
34885
function checkIFrame() {
34886
if (!iframe.contentWindow || !iframe.contentWindow.document) {
34887
setTimeout(checkIFrame, 10);
34891
var doc = iframe.contentWindow.document;
34892
var elem = doc.getElementById("state");
34893
var token = elem ? elem.innerText : null;
34895
var hash = getHash();
34897
setInterval(function () {
34899
doc = iframe.contentWindow.document;
34900
elem = doc.getElementById("state");
34902
var newtoken = elem ? elem.innerText : null;
34904
var newHash = getHash();
34906
if (newtoken !== token) {
34908
handleStateChange(token);
34909
top.location.hash = token;
34912
} else if (newHash !== hash) {
34914
updateIFrame(newHash);
34921
Ext.History.fireEvent('ready', Ext.History);
34924
function startUp() {
34925
currentToken = hiddenField.value;
34930
var hash = getHash();
34931
setInterval(function () {
34932
var newHash = getHash();
34933
if (newHash !== hash) {
34935
handleStateChange(hash);
34940
Ext.History.fireEvent('ready', Ext.History);
34946
fieldId: 'x-history-field',
34948
iframeId: 'x-history-frame',
34953
init: function (onReady, scope) {
34955
Ext.callback(onReady, scope, [this]);
34959
Ext.onReady(function(){
34960
Ext.History.init(onReady, scope);
34964
hiddenField = Ext.getDom(Ext.History.fieldId);
34966
iframe = Ext.getDom(Ext.History.iframeId);
34968
this.addEvents('ready', 'change');
34970
this.on('ready', onReady, scope, {single:true});
34976
add: function (token, preventDup) {
34977
if(preventDup !== false){
34978
if(this.getToken() == token){
34983
return updateIFrame(token);
34985
top.location.hash = token;
34996
forward: function(){
35001
getToken: function() {
35002
return ready ? currentToken : getHash();
35006
Ext.apply(Ext.History, new Ext.util.Observable());
35013
function createConsole(){
35015
var scriptPanel = new Ext.debug.ScriptsPanel();
35016
var logView = new Ext.debug.LogPanel();
35017
var tree = new Ext.debug.DomTree();
35019
var tabs = new Ext.TabPanel({
35022
tabPosition: 'bottom',
35024
title: 'Debug Console',
35026
items: [logView, scriptPanel]
35028
title: 'DOM Inspector',
35034
cp = new Ext.Panel({
35035
id: 'x-debug-browser',
35038
animCollapse: false,
35039
style: 'position:absolute;left:0;bottom:0;',
35046
handler: function(){
35049
Ext.EventManager.removeResizeListener(handleResize);
35056
cp.render(document.body);
35058
cp.resizer = new Ext.Resizable(cp.el, {
35063
resizeElement : function(){
35064
var box = this.proxy.getBox();
35066
cp.setHeight(box.height);
35071
function handleResize(){
35072
cp.setWidth(Ext.getBody().getViewSize().width);
35074
Ext.EventManager.onWindowResize(handleResize);
35085
cp.logView.log.apply(cp.logView, arguments);
35088
logf : function(format, arg1, arg2, etc){
35089
Ext.log(String.format.apply(String, arguments));
35092
dump : function(o){
35093
if(typeof o == 'string' || typeof o == 'number' || typeof o == 'undefined' || Ext.isDate(o)){
35097
}else if(typeof o != "object"){
35098
Ext.log('Unknown return type');
35099
}else if(Ext.isArray(o)){
35100
Ext.log('['+o.join(',')+']');
35104
var to = typeof o[key];
35105
if(to != "function" && to != "object"){
35106
b.push(String.format(" {0}: {1},\n", key, o[key]));
35109
var s = b.join("");
35111
s = s.substr(0, s.length-2);
35113
Ext.log(s + "\n}");
35119
time : function(name){
35120
name = name || "def";
35121
Ext._timers[name] = new Date().getTime();
35124
timeEnd : function(name, printResults){
35125
var t = new Date().getTime();
35126
name = name || "def";
35127
var v = String.format("{0} ms", t-Ext._timers[name]);
35128
Ext._timers[name] = new Date().getTime();
35129
if(printResults !== false){
35130
Ext.log('Timer ' + (name == "def" ? v : name + ": " + v));
35139
Ext.debug.ScriptsPanel = Ext.extend(Ext.Panel, {
35140
id:'x-debug-scripts',
35147
style:'border-width:0 0 0 1px;',
35149
initComponent : function(){
35151
this.scriptField = new Ext.form.TextArea({
35152
anchor: '100% -26',
35153
style:'border-width:0;'
35156
this.trapBox = new Ext.form.Checkbox({
35157
id: 'console-trap',
35158
boxLabel: 'Trap Errors',
35162
this.toolbar = new Ext.Toolbar([{
35165
handler: this.evalScript
35169
handler: this.clear
35176
this.items = [this.toolbar, this.scriptField];
35178
Ext.debug.ScriptsPanel.superclass.initComponent.call(this);
35181
evalScript : function(){
35182
var s = this.scriptField.getValue();
35183
if(this.trapBox.getValue()){
35186
Ext.dump(rt === undefined? '(no return)' : rt);
35188
Ext.log(e.message || e.descript);
35192
Ext.dump(rt === undefined? '(no return)' : rt);
35196
clear : function(){
35197
this.scriptField.setValue('');
35198
this.scriptField.focus();
35203
Ext.debug.LogPanel = Ext.extend(Ext.Panel, {
35207
style:'border-width:0 1px 0 0',
35210
var markup = [ '<div style="padding:5px !important;border-bottom:1px solid #ccc;">',
35211
Ext.util.Format.htmlEncode(Array.prototype.join.call(arguments, ', ')).replace(/\n/g, '<br />').replace(/\s/g, ' '),
35212
'</div>'].join('');
35214
this.body.insertHtml('beforeend', markup);
35215
this.body.scrollTo('top', 100000);
35218
clear : function(){
35219
this.body.update('');
35220
this.body.dom.scrollTop = 0;
35224
Ext.debug.DomTree = Ext.extend(Ext.tree.TreePanel, {
35234
initComponent : function(){
35237
Ext.debug.DomTree.superclass.initComponent.call(this);
35239
var styles = false, hnode;
35240
var nonSpace = /^\s*$/;
35241
var html = Ext.util.Format.htmlEncode;
35242
var ellipsis = Ext.util.Format.ellipsis;
35243
var styleRe = /\s?([a-z\-]*)\:([^;]*)(?:[;\s\n\r]*)/gi;
35245
function findNode(n){
35246
if(!n || n.nodeType != 1 || n == document.body || n == document){
35249
var pn = [n], p = n;
35250
while((p = p.parentNode) && p.nodeType == 1 && p.tagName.toUpperCase() != 'HTML'){
35254
for(var i = 0, len = pn.length; i < len; i++){
35256
cn = cn.findChild('htmlNode', pn[i]);
35257
if(!cn){ return false;
35261
var a = cn.ui.anchor;
35262
treeEl.dom.scrollTop = Math.max(0 ,a.offsetTop-10);
35267
function nodeTitle(n){
35271
}else if(n.className){
35272
s += '.'+n.className;
35277
function onNodeSelect(t, n, last){
35279
if(last && last.unframe){
35283
if(n && n.htmlNode){
35284
if(frameEl.pressed){
35291
reload.setDisabled(n.leaf);
35292
var dom = n.htmlNode;
35293
stylePanel.setTitle(nodeTitle(dom));
35294
if(styles && !showAll.pressed){
35295
var s = dom.style ? dom.style.cssText : '';
35298
while ((m = styleRe.exec(s)) != null){
35299
props[m[1].toLowerCase()] = m[2];
35303
var cl = Ext.debug.cssList;
35304
var s = dom.style, fly = Ext.fly(dom);
35306
for(var i = 0, len = cl.length; i<len; i++){
35308
var v = s[st] || fly.getStyle(st);
35309
if(v != undefined && v !== null && v !== ''){
35317
if((isNaN(a+10)) && v != undefined && v !== null && v !== '' && !(Ext.isGecko && a[0] == a[0].toUpperCase())){
35326
addStyle.disable();
35329
stylesGrid.setSource(props);
35330
stylesGrid.treeNode = n;
35331
stylesGrid.view.fitColumns();
35334
this.loader = new Ext.tree.TreeLoader();
35335
this.loader.load = function(n, cb){
35336
var isBody = n.htmlNode == document.body;
35337
var cn = n.htmlNode.childNodes;
35338
for(var i = 0, c; c = cn[i]; i++){
35339
if(isBody && c.id == 'x-debug-browser'){
35342
if(c.nodeType == 1){
35343
n.appendChild(new Ext.debug.HtmlNode(c));
35344
}else if(c.nodeType == 3 && !nonSpace.test(c.nodeValue)){
35345
n.appendChild(new Ext.tree.TreeNode({
35346
text:'<em>' + ellipsis(html(String(c.nodeValue)), 35) + '</em>',
35347
cls: 'x-tree-noicon'
35355
this.root = this.setRootNode(new Ext.tree.TreeNode('Ext'));
35357
hnode = this.root.appendChild(new Ext.debug.HtmlNode(
35358
document.getElementsByTagName('html')[0]
35365
Ext.debug.HtmlNode = function(){
35366
var html = Ext.util.Format.htmlEncode;
35367
var ellipsis = Ext.util.Format.ellipsis;
35368
var nonSpace = /^\s*$/;
35371
{n: 'id', v: 'id'},
35372
{n: 'className', v: 'class'},
35373
{n: 'name', v: 'name'},
35374
{n: 'type', v: 'type'},
35375
{n: 'src', v: 'src'},
35376
{n: 'href', v: 'href'}
35379
function hasChild(n){
35380
for(var i = 0, c; c = n.childNodes[i]; i++){
35381
if(c.nodeType == 1){
35388
function renderNode(n, leaf){
35389
var tag = n.tagName.toLowerCase();
35390
var s = '<' + tag;
35391
for(var i = 0, len = attrs.length; i < len; i++){
35394
if(v && !nonSpace.test(v)){
35395
s += ' ' + a.v + '="<i>' + html(v) +'</i>"';
35398
var style = n.style ? n.style.cssText : '';
35400
s += ' style="<i>' + html(style.toLowerCase()) +'</i>"';
35402
if(leaf && n.childNodes.length > 0){
35403
s+='><em>' + ellipsis(html(String(n.innerHTML)), 35) + '</em></'+tag+'>';
35412
var HtmlNode = function(n){
35413
var leaf = !hasChild(n);
35415
this.tagName = n.tagName.toLowerCase();
35417
text : renderNode(n, leaf),
35419
cls: 'x-tree-noicon'
35421
HtmlNode.superclass.constructor.call(this, attr);
35422
this.attributes.htmlNode = n; if(!leaf){
35423
this.on('expand', this.onExpand, this);
35424
this.on('collapse', this.onCollapse, this);
35429
Ext.extend(HtmlNode, Ext.tree.AsyncTreeNode, {
35430
cls: 'x-tree-noicon',
35431
preventHScroll: true,
35432
refresh : function(highlight){
35433
var leaf = !hasChild(this.htmlNode);
35434
this.setText(renderNode(this.htmlNode, leaf));
35436
Ext.fly(this.ui.textNode).highlight();
35440
onExpand : function(){
35441
if(!this.closeNode && this.parentNode){
35442
this.closeNode = this.parentNode.insertBefore(new Ext.tree.TreeNode({
35443
text:'</' + this.tagName + '>',
35444
cls: 'x-tree-noicon'
35445
}), this.nextSibling);
35446
}else if(this.closeNode){
35447
this.closeNode.ui.show();
35451
onCollapse : function(){
35452
if(this.closeNode){
35453
this.closeNode.ui.hide();
35457
render : function(bulkRender){
35458
HtmlNode.superclass.render.call(this, bulkRender);
35461
highlightNode : function(){
35464
highlight : function(){
35467
frame : function(){
35468
this.htmlNode.style.border = '1px solid #0000ff';
35471
unframe : function(){
35472
this.htmlNode.style.border = '';